rcs-js 2.0.14-rc.1 → 2.0.15
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/phoneNumbers/client/Client.d.ts +0 -3
- package/dist/cjs/api/resources/phoneNumbers/client/Client.js +0 -5
- package/dist/cjs/api/resources/phoneNumbers/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/index.js +1 -2
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +43 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +157 -0
- package/dist/cjs/api/resources/webhooks/client/requests/AttachWebhookParams.d.ts +23 -0
- package/dist/cjs/api/resources/webhooks/client/requests/DetachWebhookParams.d.ts +13 -0
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/AttachWebhookResult.d.ts +22 -0
- package/dist/cjs/api/types/DetachWebhookResult.d.ts +9 -0
- package/dist/cjs/api/{resources/phoneNumbers/resources/webhook/client/index.js → types/DetachWebhookResult.js} +1 -0
- package/dist/cjs/api/types/FailedSender.d.ts +6 -0
- package/dist/cjs/api/types/FailedSender.js +3 -0
- package/dist/cjs/api/types/WebhookEventEnum.d.ts +3 -2
- package/dist/cjs/api/types/WebhookEventEnum.js +3 -2
- package/dist/cjs/api/types/index.d.ts +3 -3
- package/dist/cjs/api/types/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/phoneNumbers/client/Client.d.mts +0 -3
- package/dist/esm/api/resources/phoneNumbers/client/Client.mjs +0 -5
- package/dist/esm/api/resources/phoneNumbers/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/index.mjs +0 -1
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +43 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +157 -0
- package/dist/esm/api/resources/webhooks/client/requests/AttachWebhookParams.d.mts +23 -0
- package/dist/esm/api/resources/webhooks/client/requests/DetachWebhookParams.d.mts +13 -0
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/AttachWebhookResult.d.mts +22 -0
- package/dist/esm/api/types/DetachWebhookResult.d.mts +9 -0
- package/dist/esm/api/types/DetachWebhookResult.mjs +2 -0
- package/dist/esm/api/types/FailedSender.d.mts +6 -0
- package/dist/esm/api/types/FailedSender.mjs +2 -0
- package/dist/esm/api/types/WebhookEventEnum.d.mts +3 -2
- package/dist/esm/api/types/WebhookEventEnum.mjs +3 -2
- package/dist/esm/api/types/index.d.mts +3 -3
- package/dist/esm/api/types/index.mjs +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +137 -160
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.d.ts +0 -63
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.js +0 -231
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/index.js +0 -17
- package/dist/cjs/api/types/AttachWebhookParams.d.ts +0 -19
- package/dist/cjs/api/types/ConfiguredWebhook.d.ts +0 -32
- package/dist/cjs/api/types/DetachedWebhookInfo.d.ts +0 -8
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.d.mts +0 -63
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.mjs +0 -194
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/index.mjs +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/index.mjs +0 -1
- package/dist/esm/api/types/AttachWebhookParams.d.mts +0 -19
- package/dist/esm/api/types/ConfiguredWebhook.d.mts +0 -32
- package/dist/esm/api/types/DetachedWebhookInfo.d.mts +0 -8
- /package/dist/cjs/api/{types → resources/webhooks/client/requests}/AttachWebhookParams.js +0 -0
- /package/dist/cjs/api/{types/ConfiguredWebhook.js → resources/webhooks/client/requests/DetachWebhookParams.js} +0 -0
- /package/dist/cjs/api/types/{DetachedWebhookInfo.js → AttachWebhookResult.js} +0 -0
- /package/dist/esm/api/{types → resources/webhooks/client/requests}/AttachWebhookParams.mjs +0 -0
- /package/dist/esm/api/{types/ConfiguredWebhook.mjs → resources/webhooks/client/requests/DetachWebhookParams.mjs} +0 -0
- /package/dist/esm/api/types/{DetachedWebhookInfo.mjs → AttachWebhookResult.mjs} +0 -0
package/dist/cjs/Client.js
CHANGED
|
@@ -53,8 +53,8 @@ class PinnacleClient {
|
|
|
53
53
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
|
|
54
54
|
"X-Fern-Language": "JavaScript",
|
|
55
55
|
"X-Fern-SDK-Name": "rcs-js",
|
|
56
|
-
"X-Fern-SDK-Version": "2.0.
|
|
57
|
-
"User-Agent": "rcs-js/2.0.
|
|
56
|
+
"X-Fern-SDK-Version": "2.0.15",
|
|
57
|
+
"User-Agent": "rcs-js/2.0.15",
|
|
58
58
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
59
59
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
60
60
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -2,7 +2,6 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import * as Pinnacle from "../../../index.js";
|
|
4
4
|
import { Campaign } from "../resources/campaign/client/Client.js";
|
|
5
|
-
import { Webhook } from "../resources/webhook/client/Client.js";
|
|
6
5
|
export declare namespace PhoneNumbers {
|
|
7
6
|
interface Options extends BaseClientOptions {
|
|
8
7
|
}
|
|
@@ -11,10 +10,8 @@ export declare namespace PhoneNumbers {
|
|
|
11
10
|
}
|
|
12
11
|
export declare class PhoneNumbers {
|
|
13
12
|
protected readonly _options: PhoneNumbers.Options;
|
|
14
|
-
protected _webhook: Webhook | undefined;
|
|
15
13
|
protected _campaign: Campaign | undefined;
|
|
16
14
|
constructor(_options: PhoneNumbers.Options);
|
|
17
|
-
get webhook(): Webhook;
|
|
18
15
|
get campaign(): Campaign;
|
|
19
16
|
/**
|
|
20
17
|
* Search for available phone numbers that match your exact criteria.
|
|
@@ -50,15 +50,10 @@ const environments = __importStar(require("../../../../environments.js"));
|
|
|
50
50
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
51
|
const Pinnacle = __importStar(require("../../../index.js"));
|
|
52
52
|
const Client_js_1 = require("../resources/campaign/client/Client.js");
|
|
53
|
-
const Client_js_2 = require("../resources/webhook/client/Client.js");
|
|
54
53
|
class PhoneNumbers {
|
|
55
54
|
constructor(_options) {
|
|
56
55
|
this._options = _options;
|
|
57
56
|
}
|
|
58
|
-
get webhook() {
|
|
59
|
-
var _a;
|
|
60
|
-
return ((_a = this._webhook) !== null && _a !== void 0 ? _a : (this._webhook = new Client_js_2.Webhook(this._options)));
|
|
61
|
-
}
|
|
62
57
|
get campaign() {
|
|
63
58
|
var _a;
|
|
64
59
|
return ((_a = this._campaign) !== null && _a !== void 0 ? _a : (this._campaign = new Client_js_1.Campaign(this._options)));
|
|
@@ -36,7 +36,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.campaign = void 0;
|
|
40
40
|
__exportStar(require("./campaign/client/requests/index.js"), exports);
|
|
41
41
|
exports.campaign = __importStar(require("./campaign/index.js"));
|
|
42
|
-
exports.webhook = __importStar(require("./webhook/index.js"));
|
|
@@ -43,5 +43,48 @@ export declare class Webhooks {
|
|
|
43
43
|
*/
|
|
44
44
|
list(request?: Pinnacle.ListWebhooksParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.ListWebhooksResponse>;
|
|
45
45
|
private __list;
|
|
46
|
+
/**
|
|
47
|
+
* Attach a webhook to one or more senders (phone numbers or RCS agent IDs) to receive real-time event notifications. <br>
|
|
48
|
+
*
|
|
49
|
+
* You can attach an existing webhook by providing its ID, or create a new webhook by specifying a name and URL. Supports bulk operations with up to 50 senders per request. <br>
|
|
50
|
+
*
|
|
51
|
+
* Subscriptions are additive — attaching new senders does not remove existing ones. Re-attaching the same sender updates the event type filter without creating duplicates.
|
|
52
|
+
*
|
|
53
|
+
* @param {Pinnacle.AttachWebhookParams} request
|
|
54
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
|
+
*
|
|
56
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
57
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
58
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
59
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* await client.webhooks.attach({
|
|
63
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
64
|
+
* })
|
|
65
|
+
*/
|
|
66
|
+
attach(request: Pinnacle.AttachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.AttachWebhookResult>;
|
|
67
|
+
private __attach;
|
|
68
|
+
/**
|
|
69
|
+
* Detach a webhook from one or more senders (phone numbers or RCS agent IDs) to stop receiving event notifications. <br>
|
|
70
|
+
*
|
|
71
|
+
* The webhook itself is not deleted and remains available for use with other senders. Works regardless of webhook status. Supports bulk operations with up to 50 senders per request.
|
|
72
|
+
*
|
|
73
|
+
* @param {Pinnacle.DetachWebhookParams} request
|
|
74
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
77
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
78
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
79
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.webhooks.detach({
|
|
83
|
+
* webhookId: "webhookId",
|
|
84
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
85
|
+
* })
|
|
86
|
+
*/
|
|
87
|
+
detach(request: Pinnacle.DetachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.DetachWebhookResult>;
|
|
88
|
+
private __detach;
|
|
46
89
|
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
47
90
|
}
|
|
@@ -198,6 +198,163 @@ class Webhooks {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Attach a webhook to one or more senders (phone numbers or RCS agent IDs) to receive real-time event notifications. <br>
|
|
203
|
+
*
|
|
204
|
+
* You can attach an existing webhook by providing its ID, or create a new webhook by specifying a name and URL. Supports bulk operations with up to 50 senders per request. <br>
|
|
205
|
+
*
|
|
206
|
+
* Subscriptions are additive — attaching new senders does not remove existing ones. Re-attaching the same sender updates the event type filter without creating duplicates.
|
|
207
|
+
*
|
|
208
|
+
* @param {Pinnacle.AttachWebhookParams} request
|
|
209
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
210
|
+
*
|
|
211
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
212
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
213
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
214
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* await client.webhooks.attach({
|
|
218
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
219
|
+
* })
|
|
220
|
+
*/
|
|
221
|
+
attach(request, requestOptions) {
|
|
222
|
+
return core.HttpResponsePromise.fromPromise(this.__attach(request, requestOptions));
|
|
223
|
+
}
|
|
224
|
+
__attach(request, requestOptions) {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
227
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
228
|
+
const _response = yield core.fetcher({
|
|
229
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "webhooks/attach"),
|
|
230
|
+
method: "POST",
|
|
231
|
+
headers: _headers,
|
|
232
|
+
contentType: "application/json",
|
|
233
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
234
|
+
requestType: "json",
|
|
235
|
+
body: request,
|
|
236
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
237
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
238
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
239
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
240
|
+
logging: this._options.logging,
|
|
241
|
+
});
|
|
242
|
+
if (_response.ok) {
|
|
243
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
244
|
+
}
|
|
245
|
+
if (_response.error.reason === "status-code") {
|
|
246
|
+
switch (_response.error.statusCode) {
|
|
247
|
+
case 400:
|
|
248
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
249
|
+
case 401:
|
|
250
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
251
|
+
case 404:
|
|
252
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
253
|
+
case 500:
|
|
254
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
255
|
+
default:
|
|
256
|
+
throw new errors.PinnacleError({
|
|
257
|
+
statusCode: _response.error.statusCode,
|
|
258
|
+
body: _response.error.body,
|
|
259
|
+
rawResponse: _response.rawResponse,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
switch (_response.error.reason) {
|
|
264
|
+
case "non-json":
|
|
265
|
+
throw new errors.PinnacleError({
|
|
266
|
+
statusCode: _response.error.statusCode,
|
|
267
|
+
body: _response.error.rawBody,
|
|
268
|
+
rawResponse: _response.rawResponse,
|
|
269
|
+
});
|
|
270
|
+
case "timeout":
|
|
271
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /webhooks/attach.");
|
|
272
|
+
case "unknown":
|
|
273
|
+
throw new errors.PinnacleError({
|
|
274
|
+
message: _response.error.errorMessage,
|
|
275
|
+
rawResponse: _response.rawResponse,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Detach a webhook from one or more senders (phone numbers or RCS agent IDs) to stop receiving event notifications. <br>
|
|
282
|
+
*
|
|
283
|
+
* The webhook itself is not deleted and remains available for use with other senders. Works regardless of webhook status. Supports bulk operations with up to 50 senders per request.
|
|
284
|
+
*
|
|
285
|
+
* @param {Pinnacle.DetachWebhookParams} request
|
|
286
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
287
|
+
*
|
|
288
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
289
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
290
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
291
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* await client.webhooks.detach({
|
|
295
|
+
* webhookId: "webhookId",
|
|
296
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
297
|
+
* })
|
|
298
|
+
*/
|
|
299
|
+
detach(request, requestOptions) {
|
|
300
|
+
return core.HttpResponsePromise.fromPromise(this.__detach(request, requestOptions));
|
|
301
|
+
}
|
|
302
|
+
__detach(request, requestOptions) {
|
|
303
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
305
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
306
|
+
const _response = yield core.fetcher({
|
|
307
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "webhooks/detach"),
|
|
308
|
+
method: "POST",
|
|
309
|
+
headers: _headers,
|
|
310
|
+
contentType: "application/json",
|
|
311
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
312
|
+
requestType: "json",
|
|
313
|
+
body: request,
|
|
314
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
315
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
316
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
317
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
318
|
+
logging: this._options.logging,
|
|
319
|
+
});
|
|
320
|
+
if (_response.ok) {
|
|
321
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
322
|
+
}
|
|
323
|
+
if (_response.error.reason === "status-code") {
|
|
324
|
+
switch (_response.error.statusCode) {
|
|
325
|
+
case 400:
|
|
326
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
327
|
+
case 401:
|
|
328
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
329
|
+
case 404:
|
|
330
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
331
|
+
case 500:
|
|
332
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
333
|
+
default:
|
|
334
|
+
throw new errors.PinnacleError({
|
|
335
|
+
statusCode: _response.error.statusCode,
|
|
336
|
+
body: _response.error.body,
|
|
337
|
+
rawResponse: _response.rawResponse,
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
switch (_response.error.reason) {
|
|
342
|
+
case "non-json":
|
|
343
|
+
throw new errors.PinnacleError({
|
|
344
|
+
statusCode: _response.error.statusCode,
|
|
345
|
+
body: _response.error.rawBody,
|
|
346
|
+
rawResponse: _response.rawResponse,
|
|
347
|
+
});
|
|
348
|
+
case "timeout":
|
|
349
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /webhooks/detach.");
|
|
350
|
+
case "unknown":
|
|
351
|
+
throw new errors.PinnacleError({
|
|
352
|
+
message: _response.error.errorMessage,
|
|
353
|
+
rawResponse: _response.rawResponse,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
201
358
|
_getCustomAuthorizationHeaders() {
|
|
202
359
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
360
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as Pinnacle from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface AttachWebhookParams {
|
|
9
|
+
/** Array of senders to attach the webhook to. Can be phone numbers in E.164 format or RCS agent IDs. */
|
|
10
|
+
senders: string[];
|
|
11
|
+
/** Existing webhook ID (starts with `wh_`). Provide this OR `name` + `url` to create a new webhook. The webhook must be in ENABLED status. Disabled webhooks can be re-enabled from the [dashboard](https://app.pinnacle.sh/dashboard/development/webhooks). */
|
|
12
|
+
webhookId?: string;
|
|
13
|
+
/** Name for a new webhook (required if no `webhookId`). */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** HTTPS endpoint URL for a new webhook (required if no `webhookId`). */
|
|
16
|
+
url?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Event type filter for the subscription. Set to `null` to receive all events. <br>
|
|
19
|
+
*
|
|
20
|
+
* `USER.TYPING` is only supported for RCS agent senders, not phone numbers.
|
|
21
|
+
*/
|
|
22
|
+
event?: Pinnacle.WebhookEventEnum | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* webhookId: "webhookId",
|
|
5
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface DetachWebhookParams {
|
|
9
|
+
/** Webhook ID to detach (starts with `wh_`). Must be a webhook owned by your team. */
|
|
10
|
+
webhookId: string;
|
|
11
|
+
/** Array of senders to detach the webhook from. Can be phone numbers in E.164 format or RCS agent IDs. */
|
|
12
|
+
senders: string[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
export interface AttachWebhookResult {
|
|
3
|
+
webhook: AttachWebhookResult.Webhook;
|
|
4
|
+
/** The event type filter applied to these subscriptions. */
|
|
5
|
+
event: Pinnacle.WebhookEventEnum | null;
|
|
6
|
+
/** Senders that were successfully attached (phone numbers in E.164 format or RCS agent IDs). */
|
|
7
|
+
senders: string[];
|
|
8
|
+
/** Senders that could not be attached, with error details. */
|
|
9
|
+
failed: Pinnacle.FailedSender[];
|
|
10
|
+
}
|
|
11
|
+
export declare namespace AttachWebhookResult {
|
|
12
|
+
interface Webhook {
|
|
13
|
+
/** Unique webhook identifier (starts with `wh_`). */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Name of the webhook. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** HTTPS endpoint URL where events are delivered. */
|
|
18
|
+
url: string;
|
|
19
|
+
/** Signing secret sent in the `PINNACLE-SIGNING-SECRET` header for request verification. */
|
|
20
|
+
secret: string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
export interface DetachWebhookResult {
|
|
3
|
+
/** The webhook that was detached from the senders. */
|
|
4
|
+
webhookId: string;
|
|
5
|
+
/** Senders that were successfully detached (phone numbers in E.164 format or RCS agent IDs). */
|
|
6
|
+
senders: string[];
|
|
7
|
+
/** Senders that could not be detached, with error details. */
|
|
8
|
+
failed: Pinnacle.FailedSender[];
|
|
9
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Types of events that can trigger webhook notifications
|
|
3
|
-
* Subscribe to specific events to receive real-time updates about your
|
|
2
|
+
* Types of events that can trigger webhook notifications.
|
|
3
|
+
* Subscribe to specific events to receive real-time updates about your sender activity.
|
|
4
4
|
* Use `null` to listen to all events.
|
|
5
5
|
*/
|
|
6
6
|
export declare const WebhookEventEnum: {
|
|
7
7
|
readonly MessageStatus: "MESSAGE.STATUS";
|
|
8
8
|
readonly MessageReceived: "MESSAGE.RECEIVED";
|
|
9
|
+
readonly UserTyping: "USER.TYPING";
|
|
9
10
|
};
|
|
10
11
|
export type WebhookEventEnum = (typeof WebhookEventEnum)[keyof typeof WebhookEventEnum];
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.WebhookEventEnum = void 0;
|
|
5
5
|
/**
|
|
6
|
-
* Types of events that can trigger webhook notifications
|
|
7
|
-
* Subscribe to specific events to receive real-time updates about your
|
|
6
|
+
* Types of events that can trigger webhook notifications.
|
|
7
|
+
* Subscribe to specific events to receive real-time updates about your sender activity.
|
|
8
8
|
* Use `null` to listen to all events.
|
|
9
9
|
*/
|
|
10
10
|
exports.WebhookEventEnum = {
|
|
11
11
|
MessageStatus: "MESSAGE.STATUS",
|
|
12
12
|
MessageReceived: "MESSAGE.RECEIVED",
|
|
13
|
+
UserTyping: "USER.TYPING",
|
|
13
14
|
};
|
|
@@ -5,7 +5,7 @@ export * from "./AgentSummary.js";
|
|
|
5
5
|
export * from "./AgentUseCase.js";
|
|
6
6
|
export * from "./AgentWebsiteEntry.js";
|
|
7
7
|
export * from "./AttachedPhoneNumberResult.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./AttachWebhookResult.js";
|
|
9
9
|
export * from "./AudienceCountOnly.js";
|
|
10
10
|
export * from "./AudienceSummary.js";
|
|
11
11
|
export * from "./AudienceWithPagination.js";
|
|
@@ -29,7 +29,6 @@ export * from "./CarrierLaunchStatus.js";
|
|
|
29
29
|
export * from "./CompanyEntityTypeEnum.js";
|
|
30
30
|
export * from "./CompanySectorEnum.js";
|
|
31
31
|
export * from "./CompanyTypeEnum.js";
|
|
32
|
-
export * from "./ConfiguredWebhook.js";
|
|
33
32
|
export * from "./Contact.js";
|
|
34
33
|
export * from "./ContactId.js";
|
|
35
34
|
export * from "./Conversation.js";
|
|
@@ -37,7 +36,7 @@ export * from "./ConversationList.js";
|
|
|
37
36
|
export * from "./CreateUrlOptions.js";
|
|
38
37
|
export * from "./DeleteAudienceResponse.js";
|
|
39
38
|
export * from "./DetachedPhoneNumberResult.js";
|
|
40
|
-
export * from "./
|
|
39
|
+
export * from "./DetachWebhookResult.js";
|
|
41
40
|
export * from "./DetailedPhoneNumberEnum.js";
|
|
42
41
|
export * from "./DlcAssignmentStatusEnum.js";
|
|
43
42
|
export * from "./DlcCampaignStatus.js";
|
|
@@ -50,6 +49,7 @@ export * from "./Error_.js";
|
|
|
50
49
|
export * from "./ExtendedBrand.js";
|
|
51
50
|
export * from "./ExtendedBrandWithVetting.js";
|
|
52
51
|
export * from "./ExtendedRcsCampaign.js";
|
|
52
|
+
export * from "./FailedSender.js";
|
|
53
53
|
export * from "./FallbackMessage.js";
|
|
54
54
|
export * from "./GetConversationParams.js";
|
|
55
55
|
export * from "./LinkClickEvent.js";
|
|
@@ -21,7 +21,7 @@ __exportStar(require("./AgentSummary.js"), exports);
|
|
|
21
21
|
__exportStar(require("./AgentUseCase.js"), exports);
|
|
22
22
|
__exportStar(require("./AgentWebsiteEntry.js"), exports);
|
|
23
23
|
__exportStar(require("./AttachedPhoneNumberResult.js"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./AttachWebhookResult.js"), exports);
|
|
25
25
|
__exportStar(require("./AudienceCountOnly.js"), exports);
|
|
26
26
|
__exportStar(require("./AudienceSummary.js"), exports);
|
|
27
27
|
__exportStar(require("./AudienceWithPagination.js"), exports);
|
|
@@ -45,7 +45,6 @@ __exportStar(require("./CarrierLaunchStatus.js"), exports);
|
|
|
45
45
|
__exportStar(require("./CompanyEntityTypeEnum.js"), exports);
|
|
46
46
|
__exportStar(require("./CompanySectorEnum.js"), exports);
|
|
47
47
|
__exportStar(require("./CompanyTypeEnum.js"), exports);
|
|
48
|
-
__exportStar(require("./ConfiguredWebhook.js"), exports);
|
|
49
48
|
__exportStar(require("./Contact.js"), exports);
|
|
50
49
|
__exportStar(require("./ContactId.js"), exports);
|
|
51
50
|
__exportStar(require("./Conversation.js"), exports);
|
|
@@ -53,7 +52,7 @@ __exportStar(require("./ConversationList.js"), exports);
|
|
|
53
52
|
__exportStar(require("./CreateUrlOptions.js"), exports);
|
|
54
53
|
__exportStar(require("./DeleteAudienceResponse.js"), exports);
|
|
55
54
|
__exportStar(require("./DetachedPhoneNumberResult.js"), exports);
|
|
56
|
-
__exportStar(require("./
|
|
55
|
+
__exportStar(require("./DetachWebhookResult.js"), exports);
|
|
57
56
|
__exportStar(require("./DetailedPhoneNumberEnum.js"), exports);
|
|
58
57
|
__exportStar(require("./DlcAssignmentStatusEnum.js"), exports);
|
|
59
58
|
__exportStar(require("./DlcCampaignStatus.js"), exports);
|
|
@@ -66,6 +65,7 @@ __exportStar(require("./Error_.js"), exports);
|
|
|
66
65
|
__exportStar(require("./ExtendedBrand.js"), exports);
|
|
67
66
|
__exportStar(require("./ExtendedBrandWithVetting.js"), exports);
|
|
68
67
|
__exportStar(require("./ExtendedRcsCampaign.js"), exports);
|
|
68
|
+
__exportStar(require("./FailedSender.js"), exports);
|
|
69
69
|
__exportStar(require("./FallbackMessage.js"), exports);
|
|
70
70
|
__exportStar(require("./GetConversationParams.js"), exports);
|
|
71
71
|
__exportStar(require("./LinkClickEvent.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.15";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -17,8 +17,8 @@ export class PinnacleClient {
|
|
|
17
17
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
|
|
18
18
|
"X-Fern-Language": "JavaScript",
|
|
19
19
|
"X-Fern-SDK-Name": "rcs-js",
|
|
20
|
-
"X-Fern-SDK-Version": "2.0.
|
|
21
|
-
"User-Agent": "rcs-js/2.0.
|
|
20
|
+
"X-Fern-SDK-Version": "2.0.15",
|
|
21
|
+
"User-Agent": "rcs-js/2.0.15",
|
|
22
22
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
23
23
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
24
24
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -2,7 +2,6 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import * as Pinnacle from "../../../index.mjs";
|
|
4
4
|
import { Campaign } from "../resources/campaign/client/Client.mjs";
|
|
5
|
-
import { Webhook } from "../resources/webhook/client/Client.mjs";
|
|
6
5
|
export declare namespace PhoneNumbers {
|
|
7
6
|
interface Options extends BaseClientOptions {
|
|
8
7
|
}
|
|
@@ -11,10 +10,8 @@ export declare namespace PhoneNumbers {
|
|
|
11
10
|
}
|
|
12
11
|
export declare class PhoneNumbers {
|
|
13
12
|
protected readonly _options: PhoneNumbers.Options;
|
|
14
|
-
protected _webhook: Webhook | undefined;
|
|
15
13
|
protected _campaign: Campaign | undefined;
|
|
16
14
|
constructor(_options: PhoneNumbers.Options);
|
|
17
|
-
get webhook(): Webhook;
|
|
18
15
|
get campaign(): Campaign;
|
|
19
16
|
/**
|
|
20
17
|
* Search for available phone numbers that match your exact criteria.
|
|
@@ -14,15 +14,10 @@ import * as environments from "../../../../environments.mjs";
|
|
|
14
14
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
15
|
import * as Pinnacle from "../../../index.mjs";
|
|
16
16
|
import { Campaign } from "../resources/campaign/client/Client.mjs";
|
|
17
|
-
import { Webhook } from "../resources/webhook/client/Client.mjs";
|
|
18
17
|
export class PhoneNumbers {
|
|
19
18
|
constructor(_options) {
|
|
20
19
|
this._options = _options;
|
|
21
20
|
}
|
|
22
|
-
get webhook() {
|
|
23
|
-
var _a;
|
|
24
|
-
return ((_a = this._webhook) !== null && _a !== void 0 ? _a : (this._webhook = new Webhook(this._options)));
|
|
25
|
-
}
|
|
26
21
|
get campaign() {
|
|
27
22
|
var _a;
|
|
28
23
|
return ((_a = this._campaign) !== null && _a !== void 0 ? _a : (this._campaign = new Campaign(this._options)));
|
|
@@ -43,5 +43,48 @@ export declare class Webhooks {
|
|
|
43
43
|
*/
|
|
44
44
|
list(request?: Pinnacle.ListWebhooksParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.ListWebhooksResponse>;
|
|
45
45
|
private __list;
|
|
46
|
+
/**
|
|
47
|
+
* Attach a webhook to one or more senders (phone numbers or RCS agent IDs) to receive real-time event notifications. <br>
|
|
48
|
+
*
|
|
49
|
+
* You can attach an existing webhook by providing its ID, or create a new webhook by specifying a name and URL. Supports bulk operations with up to 50 senders per request. <br>
|
|
50
|
+
*
|
|
51
|
+
* Subscriptions are additive — attaching new senders does not remove existing ones. Re-attaching the same sender updates the event type filter without creating duplicates.
|
|
52
|
+
*
|
|
53
|
+
* @param {Pinnacle.AttachWebhookParams} request
|
|
54
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
|
+
*
|
|
56
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
57
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
58
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
59
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* await client.webhooks.attach({
|
|
63
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
64
|
+
* })
|
|
65
|
+
*/
|
|
66
|
+
attach(request: Pinnacle.AttachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.AttachWebhookResult>;
|
|
67
|
+
private __attach;
|
|
68
|
+
/**
|
|
69
|
+
* Detach a webhook from one or more senders (phone numbers or RCS agent IDs) to stop receiving event notifications. <br>
|
|
70
|
+
*
|
|
71
|
+
* The webhook itself is not deleted and remains available for use with other senders. Works regardless of webhook status. Supports bulk operations with up to 50 senders per request.
|
|
72
|
+
*
|
|
73
|
+
* @param {Pinnacle.DetachWebhookParams} request
|
|
74
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
77
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
78
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
79
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.webhooks.detach({
|
|
83
|
+
* webhookId: "webhookId",
|
|
84
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
85
|
+
* })
|
|
86
|
+
*/
|
|
87
|
+
detach(request: Pinnacle.DetachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.DetachWebhookResult>;
|
|
88
|
+
private __detach;
|
|
46
89
|
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
47
90
|
}
|