rcs-js 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -199
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +25 -20
- package/dist/cjs/api/resources/audiences/client/Client.d.ts +129 -0
- package/dist/cjs/api/resources/audiences/client/Client.js +385 -0
- package/dist/cjs/api/resources/audiences/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/client/index.js +17 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesDeleteRequest.d.ts +13 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesDeleteRequest.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesGetRequest.d.ts +22 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesGetRequest.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/CreateAudienceParams.d.ts +31 -0
- package/dist/cjs/api/resources/audiences/client/requests/CreateAudienceParams.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/UpdateAudienceParams.d.ts +19 -0
- package/dist/cjs/api/resources/audiences/client/requests/UpdateAudienceParams.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/audiences/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/audiences/index.d.ts +3 -0
- package/dist/cjs/api/resources/audiences/index.js +19 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/Client.d.ts +80 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/Client.js +220 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/index.js +17 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.d.ts +16 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.js +5 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.d.ts +16 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.js +5 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/index.d.ts +1 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/index.js +17 -0
- package/dist/cjs/api/resources/audiences/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/index.js +41 -0
- package/dist/cjs/api/resources/audiences/types/AudiencesGetResponse.d.ts +11 -0
- package/dist/cjs/api/resources/audiences/types/AudiencesGetResponse.js +5 -0
- package/dist/cjs/api/resources/audiences/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/audiences/types/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/types/AudienceCountOnly.d.ts +17 -0
- package/dist/cjs/api/types/AudienceCountOnly.js +5 -0
- package/dist/cjs/api/types/AudienceWithPagination.d.ts +17 -0
- package/dist/cjs/api/types/AudienceWithPagination.js +5 -0
- package/dist/cjs/api/types/DeleteAudienceResponse.d.ts +7 -0
- package/dist/cjs/api/types/DeleteAudienceResponse.js +5 -0
- package/dist/cjs/api/types/Pagination.d.ts +13 -0
- package/dist/cjs/api/types/Pagination.js +5 -0
- package/dist/cjs/api/types/SentMmsDetails.d.ts +5 -1
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/audiences/client/Client.d.mts +129 -0
- package/dist/esm/api/resources/audiences/client/Client.mjs +348 -0
- package/dist/esm/api/resources/audiences/client/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/client/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesDeleteRequest.d.mts +13 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesDeleteRequest.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesGetRequest.d.mts +22 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesGetRequest.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/CreateAudienceParams.d.mts +31 -0
- package/dist/esm/api/resources/audiences/client/requests/CreateAudienceParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/UpdateAudienceParams.d.mts +19 -0
- package/dist/esm/api/resources/audiences/client/requests/UpdateAudienceParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/audiences/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/index.d.mts +3 -0
- package/dist/esm/api/resources/audiences/index.mjs +3 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/Client.d.mts +80 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/Client.mjs +183 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.d.mts +16 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.d.mts +16 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/index.d.mts +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/index.mjs +2 -0
- package/dist/esm/api/resources/audiences/types/AudiencesGetResponse.d.mts +11 -0
- package/dist/esm/api/resources/audiences/types/AudiencesGetResponse.mjs +4 -0
- package/dist/esm/api/resources/audiences/types/index.d.mts +1 -0
- package/dist/esm/api/resources/audiences/types/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/types/AudienceCountOnly.d.mts +17 -0
- package/dist/esm/api/types/AudienceCountOnly.mjs +4 -0
- package/dist/esm/api/types/AudienceWithPagination.d.mts +17 -0
- package/dist/esm/api/types/AudienceWithPagination.mjs +4 -0
- package/dist/esm/api/types/DeleteAudienceResponse.d.mts +7 -0
- package/dist/esm/api/types/DeleteAudienceResponse.mjs +4 -0
- package/dist/esm/api/types/Pagination.d.mts +13 -0
- package/dist/esm/api/types/Pagination.mjs +4 -0
- package/dist/esm/api/types/SentMmsDetails.d.mts +5 -1
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +408 -0
package/README.md
CHANGED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# Pinnacle TypeScript Library
|
|
2
|
-
|
|
3
|
-
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fpinnacle-dev%2Frcs-js)
|
|
4
|
-
[](https://www.npmjs.com/package/rcs-js)
|
|
5
|
-
|
|
6
|
-
The Pinnacle TypeScript library provides convenient access to the Pinnacle APIs from TypeScript.
|
|
7
|
-
|
|
8
|
-
## Table of Contents
|
|
9
|
-
|
|
10
|
-
- [Installation](#installation)
|
|
11
|
-
- [Usage](#usage)
|
|
12
|
-
- [Request and Response Types](#request-and-response-types)
|
|
13
|
-
- [Exception Handling](#exception-handling)
|
|
14
|
-
- [Advanced](#advanced)
|
|
15
|
-
- [Additional Headers](#additional-headers)
|
|
16
|
-
- [Additional Query String Parameters](#additional-query-string-parameters)
|
|
17
|
-
- [Retries](#retries)
|
|
18
|
-
- [Timeouts](#timeouts)
|
|
19
|
-
- [Aborting Requests](#aborting-requests)
|
|
20
|
-
- [Access Raw Response Data](#access-raw-response-data)
|
|
21
|
-
- [Runtime Compatibility](#runtime-compatibility)
|
|
22
|
-
- [Contributing](#contributing)
|
|
23
|
-
- [Reference](#reference)
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
npm i -s rcs-js
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
Instantiate and use the client with the following:
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { PinnacleClient } from "rcs-js";
|
|
37
|
-
|
|
38
|
-
const client = new PinnacleClient({ apiKey: "YOUR_API_KEY" });
|
|
39
|
-
await client.brands.autofill({
|
|
40
|
-
additional_info: "A developer-friendly, compliant API for SMS, MMS, and RCS, built to scale real conversations.",
|
|
41
|
-
name: "Pinnacle",
|
|
42
|
-
options: {
|
|
43
|
-
forceReload: true,
|
|
44
|
-
},
|
|
45
|
-
website: "https://www.pinnacle.sh",
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Request and Response Types
|
|
50
|
-
|
|
51
|
-
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
|
52
|
-
following namespace:
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { Pinnacle } from "rcs-js";
|
|
56
|
-
|
|
57
|
-
const request: Pinnacle.AutofillBrandParams = {
|
|
58
|
-
...
|
|
59
|
-
};
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Exception Handling
|
|
63
|
-
|
|
64
|
-
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
65
|
-
will be thrown.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { PinnacleError } from "rcs-js";
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
await client.brands.autofill(...);
|
|
72
|
-
} catch (err) {
|
|
73
|
-
if (err instanceof PinnacleError) {
|
|
74
|
-
console.log(err.statusCode);
|
|
75
|
-
console.log(err.message);
|
|
76
|
-
console.log(err.body);
|
|
77
|
-
console.log(err.rawResponse);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Advanced
|
|
83
|
-
|
|
84
|
-
### Additional Headers
|
|
85
|
-
|
|
86
|
-
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
const response = await client.brands.autofill(..., {
|
|
90
|
-
headers: {
|
|
91
|
-
'X-Custom-Header': 'custom value'
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Additional Query String Parameters
|
|
97
|
-
|
|
98
|
-
If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
const response = await client.brands.autofill(..., {
|
|
102
|
-
queryParams: {
|
|
103
|
-
'customQueryParamKey': 'custom query param value'
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Retries
|
|
109
|
-
|
|
110
|
-
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
111
|
-
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
112
|
-
retry limit (default: 2).
|
|
113
|
-
|
|
114
|
-
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
115
|
-
|
|
116
|
-
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
117
|
-
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
118
|
-
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
119
|
-
|
|
120
|
-
Use the `maxRetries` request option to configure this behavior.
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
const response = await client.brands.autofill(..., {
|
|
124
|
-
maxRetries: 0 // override maxRetries at the request level
|
|
125
|
-
});
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Timeouts
|
|
129
|
-
|
|
130
|
-
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
const response = await client.brands.autofill(..., {
|
|
134
|
-
timeoutInSeconds: 30 // override timeout to 30s
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Aborting Requests
|
|
139
|
-
|
|
140
|
-
The SDK allows users to abort requests at any point by passing in an abort signal.
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
const controller = new AbortController();
|
|
144
|
-
const response = await client.brands.autofill(..., {
|
|
145
|
-
abortSignal: controller.signal
|
|
146
|
-
});
|
|
147
|
-
controller.abort(); // aborts the request
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Access Raw Response Data
|
|
151
|
-
|
|
152
|
-
The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
|
|
153
|
-
The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
const { data, rawResponse } = await client.brands.autofill(...).withRawResponse();
|
|
157
|
-
|
|
158
|
-
console.log(data);
|
|
159
|
-
console.log(rawResponse.headers['X-My-Header']);
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Runtime Compatibility
|
|
163
|
-
|
|
164
|
-
The SDK works in the following runtimes:
|
|
165
|
-
|
|
166
|
-
- Node.js 18+
|
|
167
|
-
- Vercel
|
|
168
|
-
- Cloudflare Workers
|
|
169
|
-
- Deno v1.25+
|
|
170
|
-
- Bun 1.0+
|
|
171
|
-
- React Native
|
|
172
|
-
|
|
173
|
-
### Customizing Fetch Client
|
|
174
|
-
|
|
175
|
-
The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
|
|
176
|
-
unsupported environment, this provides a way for you to break glass and ensure the SDK works.
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
import { PinnacleClient } from "rcs-js";
|
|
180
|
-
|
|
181
|
-
const client = new PinnacleClient({
|
|
182
|
-
...
|
|
183
|
-
fetcher: // provide your implementation here
|
|
184
|
-
});
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Contributing
|
|
188
|
-
|
|
189
|
-
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
190
|
-
Additions made directly to this library would have to be moved over to our generation code,
|
|
191
|
-
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
192
|
-
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
193
|
-
an issue first to discuss with us!
|
|
194
|
-
|
|
195
|
-
On the other hand, contributions to the README are always very welcome!
|
|
196
|
-
|
|
197
|
-
## Reference
|
|
198
|
-
|
|
199
|
-
A full reference for this library is available [here](https://github.com/pinnacle-dev/rcs-js/blob/HEAD/./reference.md).
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as environments from "./environments.js";
|
|
5
5
|
import * as core from "./core/index.js";
|
|
6
6
|
import { Brands } from "./api/resources/brands/client/Client.js";
|
|
7
|
+
import { Audiences } from "./api/resources/audiences/client/Client.js";
|
|
7
8
|
import { Contacts } from "./api/resources/contacts/client/Client.js";
|
|
8
9
|
import { Conversations } from "./api/resources/conversations/client/Client.js";
|
|
9
10
|
import { Messages } from "./api/resources/messages/client/Client.js";
|
|
@@ -38,6 +39,7 @@ export declare namespace PinnacleClient {
|
|
|
38
39
|
export declare class PinnacleClient {
|
|
39
40
|
protected readonly _options: PinnacleClient.Options;
|
|
40
41
|
protected _brands: Brands | undefined;
|
|
42
|
+
protected _audiences: Audiences | undefined;
|
|
41
43
|
protected _contacts: Contacts | undefined;
|
|
42
44
|
protected _conversations: Conversations | undefined;
|
|
43
45
|
protected _messages: Messages | undefined;
|
|
@@ -49,6 +51,7 @@ export declare class PinnacleClient {
|
|
|
49
51
|
protected _tools: Tools | undefined;
|
|
50
52
|
constructor(_options?: PinnacleClient.Options);
|
|
51
53
|
get brands(): Brands;
|
|
54
|
+
get audiences(): Audiences;
|
|
52
55
|
get contacts(): Contacts;
|
|
53
56
|
get conversations(): Conversations;
|
|
54
57
|
get messages(): Messages;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -40,22 +40,23 @@ exports.PinnacleClient = void 0;
|
|
|
40
40
|
const core = __importStar(require("./core/index.js"));
|
|
41
41
|
const headers_js_1 = require("./core/headers.js");
|
|
42
42
|
const Client_js_1 = require("./api/resources/brands/client/Client.js");
|
|
43
|
-
const Client_js_2 = require("./api/resources/
|
|
44
|
-
const Client_js_3 = require("./api/resources/
|
|
45
|
-
const Client_js_4 = require("./api/resources/
|
|
46
|
-
const Client_js_5 = require("./api/resources/
|
|
47
|
-
const Client_js_6 = require("./api/resources/
|
|
48
|
-
const Client_js_7 = require("./api/resources/
|
|
49
|
-
const Client_js_8 = require("./api/resources/
|
|
50
|
-
const Client_js_9 = require("./api/resources/
|
|
51
|
-
const Client_js_10 = require("./api/resources/
|
|
43
|
+
const Client_js_2 = require("./api/resources/audiences/client/Client.js");
|
|
44
|
+
const Client_js_3 = require("./api/resources/contacts/client/Client.js");
|
|
45
|
+
const Client_js_4 = require("./api/resources/conversations/client/Client.js");
|
|
46
|
+
const Client_js_5 = require("./api/resources/messages/client/Client.js");
|
|
47
|
+
const Client_js_6 = require("./api/resources/phoneNumbers/client/Client.js");
|
|
48
|
+
const Client_js_7 = require("./api/resources/rcs/client/Client.js");
|
|
49
|
+
const Client_js_8 = require("./api/resources/webhooks/client/Client.js");
|
|
50
|
+
const Client_js_9 = require("./api/resources/campaigns/client/Client.js");
|
|
51
|
+
const Client_js_10 = require("./api/resources/status/client/Client.js");
|
|
52
|
+
const Client_js_11 = require("./api/resources/tools/client/Client.js");
|
|
52
53
|
class PinnacleClient {
|
|
53
54
|
constructor(_options = {}) {
|
|
54
55
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
55
56
|
"X-Fern-Language": "JavaScript",
|
|
56
57
|
"X-Fern-SDK-Name": "rcs-js",
|
|
57
|
-
"X-Fern-SDK-Version": "2.0.
|
|
58
|
-
"User-Agent": "rcs-js/2.0.
|
|
58
|
+
"X-Fern-SDK-Version": "2.0.6",
|
|
59
|
+
"User-Agent": "rcs-js/2.0.6",
|
|
59
60
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
60
61
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
61
62
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -64,41 +65,45 @@ class PinnacleClient {
|
|
|
64
65
|
var _a;
|
|
65
66
|
return ((_a = this._brands) !== null && _a !== void 0 ? _a : (this._brands = new Client_js_1.Brands(this._options)));
|
|
66
67
|
}
|
|
68
|
+
get audiences() {
|
|
69
|
+
var _a;
|
|
70
|
+
return ((_a = this._audiences) !== null && _a !== void 0 ? _a : (this._audiences = new Client_js_2.Audiences(this._options)));
|
|
71
|
+
}
|
|
67
72
|
get contacts() {
|
|
68
73
|
var _a;
|
|
69
|
-
return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new
|
|
74
|
+
return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_js_3.Contacts(this._options)));
|
|
70
75
|
}
|
|
71
76
|
get conversations() {
|
|
72
77
|
var _a;
|
|
73
|
-
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new
|
|
78
|
+
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_4.Conversations(this._options)));
|
|
74
79
|
}
|
|
75
80
|
get messages() {
|
|
76
81
|
var _a;
|
|
77
|
-
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new
|
|
82
|
+
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_5.Messages(this._options)));
|
|
78
83
|
}
|
|
79
84
|
get phoneNumbers() {
|
|
80
85
|
var _a;
|
|
81
|
-
return ((_a = this._phoneNumbers) !== null && _a !== void 0 ? _a : (this._phoneNumbers = new
|
|
86
|
+
return ((_a = this._phoneNumbers) !== null && _a !== void 0 ? _a : (this._phoneNumbers = new Client_js_6.PhoneNumbers(this._options)));
|
|
82
87
|
}
|
|
83
88
|
get rcs() {
|
|
84
89
|
var _a;
|
|
85
|
-
return ((_a = this._rcs) !== null && _a !== void 0 ? _a : (this._rcs = new
|
|
90
|
+
return ((_a = this._rcs) !== null && _a !== void 0 ? _a : (this._rcs = new Client_js_7.Rcs(this._options)));
|
|
86
91
|
}
|
|
87
92
|
get webhooks() {
|
|
88
93
|
var _a;
|
|
89
|
-
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new
|
|
94
|
+
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_8.Webhooks(this._options)));
|
|
90
95
|
}
|
|
91
96
|
get campaigns() {
|
|
92
97
|
var _a;
|
|
93
|
-
return ((_a = this._campaigns) !== null && _a !== void 0 ? _a : (this._campaigns = new
|
|
98
|
+
return ((_a = this._campaigns) !== null && _a !== void 0 ? _a : (this._campaigns = new Client_js_9.Campaigns(this._options)));
|
|
94
99
|
}
|
|
95
100
|
get status() {
|
|
96
101
|
var _a;
|
|
97
|
-
return ((_a = this._status) !== null && _a !== void 0 ? _a : (this._status = new
|
|
102
|
+
return ((_a = this._status) !== null && _a !== void 0 ? _a : (this._status = new Client_js_10.Status(this._options)));
|
|
98
103
|
}
|
|
99
104
|
get tools() {
|
|
100
105
|
var _a;
|
|
101
|
-
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new
|
|
106
|
+
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_js_11.Tools(this._options)));
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
109
|
exports.PinnacleClient = PinnacleClient;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments.js";
|
|
5
|
+
import * as core from "../../../../core/index.js";
|
|
6
|
+
import * as Pinnacle from "../../../index.js";
|
|
7
|
+
import { Contacts } from "../resources/contacts/client/Client.js";
|
|
8
|
+
export declare namespace Audiences {
|
|
9
|
+
interface Options {
|
|
10
|
+
environment?: core.Supplier<environments.PinnacleEnvironment | string>;
|
|
11
|
+
/** Specify a custom URL to connect the client to. */
|
|
12
|
+
baseUrl?: core.Supplier<string>;
|
|
13
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
14
|
+
/** Additional headers to include in requests. */
|
|
15
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
16
|
+
}
|
|
17
|
+
interface RequestOptions {
|
|
18
|
+
/** The maximum time to wait for a response in seconds. */
|
|
19
|
+
timeoutInSeconds?: number;
|
|
20
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
/** A hook to abort the request. */
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
24
|
+
/** Additional query string parameters to include in the request. */
|
|
25
|
+
queryParams?: Record<string, unknown>;
|
|
26
|
+
/** Additional headers to include in the request. */
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare class Audiences {
|
|
31
|
+
protected readonly _options: Audiences.Options;
|
|
32
|
+
protected _contacts: Contacts | undefined;
|
|
33
|
+
constructor(_options?: Audiences.Options);
|
|
34
|
+
get contacts(): Contacts;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve an audience by ID with optional pagination.
|
|
37
|
+
*
|
|
38
|
+
* @param {Pinnacle.AudiencesGetRequest} request
|
|
39
|
+
* @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
|
|
40
|
+
*
|
|
41
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
42
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
43
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
44
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* await client.audiences.get({
|
|
48
|
+
* id: "aud_abc123"
|
|
49
|
+
* })
|
|
50
|
+
*/
|
|
51
|
+
get(request: Pinnacle.AudiencesGetRequest, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Pinnacle.AudiencesGetResponse>;
|
|
52
|
+
private __get;
|
|
53
|
+
/**
|
|
54
|
+
* Create a new audience with optional initial contacts. Phone numbers that don't exist will be auto-created as contacts.
|
|
55
|
+
*
|
|
56
|
+
* @param {Pinnacle.CreateAudienceParams} request
|
|
57
|
+
* @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
|
+
*
|
|
59
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
60
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
61
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.audiences.create({
|
|
65
|
+
* name: "Marketing Campaign Q1",
|
|
66
|
+
* description: "Contacts for Q1 marketing push"
|
|
67
|
+
* })
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.audiences.create({
|
|
71
|
+
* name: "VIP Customers",
|
|
72
|
+
* description: "Our best customers",
|
|
73
|
+
* contacts: ["+12125551234", "+13105551234"]
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.audiences.create({
|
|
78
|
+
* name: "Mixed Audience",
|
|
79
|
+
* contacts: ["+12125551234", "co_abc123", "+13105551234"]
|
|
80
|
+
* })
|
|
81
|
+
*/
|
|
82
|
+
create(request: Pinnacle.CreateAudienceParams, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Pinnacle.AudienceCountOnly>;
|
|
83
|
+
private __create;
|
|
84
|
+
/**
|
|
85
|
+
* Permanently delete an audience and all its contact associations.
|
|
86
|
+
*
|
|
87
|
+
* Note: This will NOT delete the contacts themselves, only the audience and its memberships.
|
|
88
|
+
*
|
|
89
|
+
* @param {Pinnacle.AudiencesDeleteRequest} request
|
|
90
|
+
* @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
|
|
91
|
+
*
|
|
92
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
93
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
94
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
95
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* await client.audiences.delete({
|
|
99
|
+
* id: "aud_abc123"
|
|
100
|
+
* })
|
|
101
|
+
*/
|
|
102
|
+
delete(request: Pinnacle.AudiencesDeleteRequest, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Pinnacle.DeleteAudienceResponse>;
|
|
103
|
+
private __delete;
|
|
104
|
+
/**
|
|
105
|
+
* Update audience metadata. This endpoint does NOT modify contacts.
|
|
106
|
+
*
|
|
107
|
+
* To add or remove contacts, use the [Add Contacts](/api-reference/audiences/add-contacts) or [Remove Contacts](/api-reference/audiences/remove-contacts) endpoints.
|
|
108
|
+
*
|
|
109
|
+
* @param {Pinnacle.UpdateAudienceParams} request
|
|
110
|
+
* @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
|
+
*
|
|
112
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
113
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
114
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
115
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* await client.audiences.update({
|
|
119
|
+
* id: "aud_abc123",
|
|
120
|
+
* name: "Updated Audience Name",
|
|
121
|
+
* description: "New description"
|
|
122
|
+
* })
|
|
123
|
+
*/
|
|
124
|
+
update(request: Pinnacle.UpdateAudienceParams, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Pinnacle.AudienceCountOnly>;
|
|
125
|
+
private __update;
|
|
126
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
127
|
+
"PINNACLE-API-KEY": string | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
}
|