rcs-js 2.0.7 → 2.0.8
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/messages/client/Client.d.ts +6 -21
- package/dist/cjs/api/resources/messages/client/Client.js +16 -84
- package/dist/cjs/api/resources/messages/resources/blast/client/Client.d.ts +105 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/Client.js +325 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/index.js +17 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastMms.d.ts +61 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastRcs.d.ts +110 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastRcs.js +23 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastSms.d.ts +47 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastSms.js +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/messages/resources/blast/index.d.ts +2 -0
- package/dist/cjs/api/resources/messages/resources/blast/index.js +18 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastMmsResponse.d.ts +2 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastMmsResponse.js +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastRcsResponse.d.ts +2 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastRcsResponse.js +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastSmsResponse.d.ts +2 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/BlastSmsResponse.js +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/messages/resources/blast/types/index.js +19 -0
- package/dist/cjs/api/resources/messages/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/messages/resources/index.js +5 -1
- package/dist/cjs/api/resources/messages/resources/schedule/client/Client.d.ts +32 -0
- package/dist/cjs/api/resources/messages/resources/schedule/client/Client.js +135 -0
- package/dist/cjs/api/resources/messages/resources/schedule/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/schedule/client/index.js +2 -0
- package/dist/cjs/api/resources/messages/resources/schedule/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/schedule/index.js +17 -0
- package/dist/cjs/api/types/BlastDetails.d.ts +17 -0
- package/dist/cjs/api/types/BlastDetails.js +3 -0
- package/dist/cjs/api/types/DlcCampaignWithExtendedBrandAndStatus.d.ts +42 -0
- package/dist/cjs/api/types/DlcCampaignWithExtendedBrandAndStatus.js +32 -0
- package/dist/cjs/api/types/MessageSchedule.d.ts +25 -11
- package/dist/cjs/api/types/MessageStatusEnum.d.ts +1 -0
- package/dist/cjs/api/types/MessageStatusEnum.js +1 -0
- package/dist/cjs/api/types/ScheduleCancelResult.d.ts +7 -0
- package/dist/cjs/api/types/ScheduleCancelResult.js +3 -0
- package/dist/cjs/api/types/ScheduledBlastDetails.d.ts +24 -0
- package/dist/cjs/api/types/ScheduledBlastDetails.js +3 -0
- package/dist/cjs/api/types/index.d.ts +3 -1
- package/dist/cjs/api/types/index.js +3 -1
- 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/messages/client/Client.d.mts +6 -21
- package/dist/esm/api/resources/messages/client/Client.mjs +10 -78
- package/dist/esm/api/resources/messages/resources/blast/client/Client.d.mts +105 -0
- package/dist/esm/api/resources/messages/resources/blast/client/Client.mjs +288 -0
- package/dist/esm/api/resources/messages/resources/blast/client/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/blast/client/index.mjs +1 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastMms.d.mts +61 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastRcs.d.mts +110 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastRcs.mjs +20 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastSms.d.mts +47 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastSms.mjs +2 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/messages/resources/blast/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/messages/resources/blast/index.d.mts +2 -0
- package/dist/esm/api/resources/messages/resources/blast/index.mjs +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastMmsResponse.d.mts +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastMmsResponse.mjs +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastRcsResponse.d.mts +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastRcsResponse.mjs +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastSmsResponse.d.mts +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/BlastSmsResponse.mjs +2 -0
- package/dist/esm/api/resources/messages/resources/blast/types/index.d.mts +3 -0
- package/dist/esm/api/resources/messages/resources/blast/types/index.mjs +3 -0
- package/dist/esm/api/resources/messages/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/messages/resources/index.mjs +4 -0
- package/dist/esm/api/resources/messages/resources/schedule/client/Client.d.mts +32 -0
- package/dist/esm/api/resources/messages/resources/schedule/client/Client.mjs +98 -0
- package/dist/esm/api/resources/messages/resources/schedule/client/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/schedule/client/index.mjs +1 -0
- package/dist/esm/api/resources/messages/resources/schedule/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/schedule/index.mjs +1 -0
- package/dist/esm/api/types/BlastDetails.d.mts +17 -0
- package/dist/esm/api/types/BlastDetails.mjs +2 -0
- package/dist/esm/api/types/DlcCampaignWithExtendedBrandAndStatus.d.mts +42 -0
- package/dist/esm/api/types/DlcCampaignWithExtendedBrandAndStatus.mjs +31 -1
- package/dist/esm/api/types/MessageSchedule.d.mts +25 -11
- package/dist/esm/api/types/MessageStatusEnum.d.mts +1 -0
- package/dist/esm/api/types/MessageStatusEnum.mjs +1 -0
- package/dist/esm/api/types/ScheduleCancelResult.d.mts +7 -0
- package/dist/esm/api/types/ScheduleCancelResult.mjs +2 -0
- package/dist/esm/api/types/ScheduledBlastDetails.d.mts +24 -0
- package/dist/esm/api/types/ScheduledBlastDetails.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +3 -1
- package/dist/esm/api/types/index.mjs +3 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +299 -68
- package/dist/cjs/api/types/CancelScheduledMessageResponse.d.ts +0 -4
- package/dist/esm/api/types/CancelScheduledMessageResponse.d.mts +0 -4
- /package/dist/cjs/api/{types/CancelScheduledMessageResponse.js → resources/messages/resources/blast/client/requests/BlastMms.js} +0 -0
- /package/dist/esm/api/{types/CancelScheduledMessageResponse.mjs → resources/messages/resources/blast/client/requests/BlastMms.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.8",
|
|
57
|
+
"User-Agent": "rcs-js/2.0.8",
|
|
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) });
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import * as Pinnacle from "../../../index.js";
|
|
4
|
+
import { Blast } from "../resources/blast/client/Client.js";
|
|
4
5
|
import { Mms } from "../resources/mms/client/Client.js";
|
|
5
6
|
import { Rcs } from "../resources/rcs/client/Client.js";
|
|
7
|
+
import { Schedule } from "../resources/schedule/client/Client.js";
|
|
6
8
|
import { Sms } from "../resources/sms/client/Client.js";
|
|
7
9
|
export declare namespace Messages {
|
|
8
10
|
interface Options extends BaseClientOptions {
|
|
@@ -15,10 +17,14 @@ export declare class Messages {
|
|
|
15
17
|
protected _sms: Sms | undefined;
|
|
16
18
|
protected _mms: Mms | undefined;
|
|
17
19
|
protected _rcs: Rcs | undefined;
|
|
20
|
+
protected _blast: Blast | undefined;
|
|
21
|
+
protected _schedule: Schedule | undefined;
|
|
18
22
|
constructor(_options?: Messages.Options);
|
|
19
23
|
get sms(): Sms;
|
|
20
24
|
get mms(): Mms;
|
|
21
25
|
get rcs(): Rcs;
|
|
26
|
+
get blast(): Blast;
|
|
27
|
+
get schedule(): Schedule;
|
|
22
28
|
/**
|
|
23
29
|
* Retrieve a previously sent message.
|
|
24
30
|
*
|
|
@@ -59,26 +65,5 @@ export declare class Messages {
|
|
|
59
65
|
*/
|
|
60
66
|
react(request: Pinnacle.ReactMessageParams, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<Pinnacle.ReactionResult>;
|
|
61
67
|
private __react;
|
|
62
|
-
/**
|
|
63
|
-
* Cancel a previously scheduled message before it is sent.
|
|
64
|
-
*
|
|
65
|
-
* Use the `scheduleId` returned from a scheduled send request (SMS, MMS, or RCS) to cancel the message.
|
|
66
|
-
* Once cancelled, the scheduled message will stop being sent.
|
|
67
|
-
*
|
|
68
|
-
* > **Note:** You cannot cancel a message that has already been sent.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} id - Unique identifier of the scheduled message. This identifier is a string that always begins with the prefix `msg_sched_`, for example: `msg_sched_1234567890`.
|
|
71
|
-
* @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
|
-
*
|
|
73
|
-
* @throws {@link Pinnacle.BadRequestError}
|
|
74
|
-
* @throws {@link Pinnacle.UnauthorizedError}
|
|
75
|
-
* @throws {@link Pinnacle.NotFoundError}
|
|
76
|
-
* @throws {@link Pinnacle.InternalServerError}
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* await client.messages.cancel("msg_sched_1234567890")
|
|
80
|
-
*/
|
|
81
|
-
cancel(id: string, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<Pinnacle.CancelScheduledMessageResponse>;
|
|
82
|
-
private __cancel;
|
|
83
68
|
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
84
69
|
}
|
|
@@ -49,24 +49,34 @@ const core = __importStar(require("../../../../core/index.js"));
|
|
|
49
49
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
50
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
51
|
const Pinnacle = __importStar(require("../../../index.js"));
|
|
52
|
-
const Client_js_1 = require("../resources/
|
|
53
|
-
const Client_js_2 = require("../resources/
|
|
54
|
-
const Client_js_3 = require("../resources/
|
|
52
|
+
const Client_js_1 = require("../resources/blast/client/Client.js");
|
|
53
|
+
const Client_js_2 = require("../resources/mms/client/Client.js");
|
|
54
|
+
const Client_js_3 = require("../resources/rcs/client/Client.js");
|
|
55
|
+
const Client_js_4 = require("../resources/schedule/client/Client.js");
|
|
56
|
+
const Client_js_5 = require("../resources/sms/client/Client.js");
|
|
55
57
|
class Messages {
|
|
56
58
|
constructor(_options = {}) {
|
|
57
59
|
this._options = _options;
|
|
58
60
|
}
|
|
59
61
|
get sms() {
|
|
60
62
|
var _a;
|
|
61
|
-
return ((_a = this._sms) !== null && _a !== void 0 ? _a : (this._sms = new
|
|
63
|
+
return ((_a = this._sms) !== null && _a !== void 0 ? _a : (this._sms = new Client_js_5.Sms(this._options)));
|
|
62
64
|
}
|
|
63
65
|
get mms() {
|
|
64
66
|
var _a;
|
|
65
|
-
return ((_a = this._mms) !== null && _a !== void 0 ? _a : (this._mms = new
|
|
67
|
+
return ((_a = this._mms) !== null && _a !== void 0 ? _a : (this._mms = new Client_js_2.Mms(this._options)));
|
|
66
68
|
}
|
|
67
69
|
get rcs() {
|
|
68
70
|
var _a;
|
|
69
|
-
return ((_a = this._rcs) !== null && _a !== void 0 ? _a : (this._rcs = new
|
|
71
|
+
return ((_a = this._rcs) !== null && _a !== void 0 ? _a : (this._rcs = new Client_js_3.Rcs(this._options)));
|
|
72
|
+
}
|
|
73
|
+
get blast() {
|
|
74
|
+
var _a;
|
|
75
|
+
return ((_a = this._blast) !== null && _a !== void 0 ? _a : (this._blast = new Client_js_1.Blast(this._options)));
|
|
76
|
+
}
|
|
77
|
+
get schedule() {
|
|
78
|
+
var _a;
|
|
79
|
+
return ((_a = this._schedule) !== null && _a !== void 0 ? _a : (this._schedule = new Client_js_4.Schedule(this._options)));
|
|
70
80
|
}
|
|
71
81
|
/**
|
|
72
82
|
* Retrieve a previously sent message.
|
|
@@ -223,84 +233,6 @@ class Messages {
|
|
|
223
233
|
}
|
|
224
234
|
});
|
|
225
235
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Cancel a previously scheduled message before it is sent.
|
|
228
|
-
*
|
|
229
|
-
* Use the `scheduleId` returned from a scheduled send request (SMS, MMS, or RCS) to cancel the message.
|
|
230
|
-
* Once cancelled, the scheduled message will stop being sent.
|
|
231
|
-
*
|
|
232
|
-
* > **Note:** You cannot cancel a message that has already been sent.
|
|
233
|
-
*
|
|
234
|
-
* @param {string} id - Unique identifier of the scheduled message. This identifier is a string that always begins with the prefix `msg_sched_`, for example: `msg_sched_1234567890`.
|
|
235
|
-
* @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
|
|
236
|
-
*
|
|
237
|
-
* @throws {@link Pinnacle.BadRequestError}
|
|
238
|
-
* @throws {@link Pinnacle.UnauthorizedError}
|
|
239
|
-
* @throws {@link Pinnacle.NotFoundError}
|
|
240
|
-
* @throws {@link Pinnacle.InternalServerError}
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* await client.messages.cancel("msg_sched_1234567890")
|
|
244
|
-
*/
|
|
245
|
-
cancel(id, requestOptions) {
|
|
246
|
-
return core.HttpResponsePromise.fromPromise(this.__cancel(id, requestOptions));
|
|
247
|
-
}
|
|
248
|
-
__cancel(id, requestOptions) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
251
|
-
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);
|
|
252
|
-
const _response = yield core.fetcher({
|
|
253
|
-
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, `messages/send/schedule/${core.url.encodePathParam(id)}`),
|
|
254
|
-
method: "DELETE",
|
|
255
|
-
headers: _headers,
|
|
256
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
257
|
-
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,
|
|
258
|
-
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,
|
|
259
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
261
|
-
logging: this._options.logging,
|
|
262
|
-
});
|
|
263
|
-
if (_response.ok) {
|
|
264
|
-
return {
|
|
265
|
-
data: _response.body,
|
|
266
|
-
rawResponse: _response.rawResponse,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
if (_response.error.reason === "status-code") {
|
|
270
|
-
switch (_response.error.statusCode) {
|
|
271
|
-
case 400:
|
|
272
|
-
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
273
|
-
case 401:
|
|
274
|
-
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
275
|
-
case 404:
|
|
276
|
-
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
277
|
-
case 500:
|
|
278
|
-
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
279
|
-
default:
|
|
280
|
-
throw new errors.PinnacleError({
|
|
281
|
-
statusCode: _response.error.statusCode,
|
|
282
|
-
body: _response.error.body,
|
|
283
|
-
rawResponse: _response.rawResponse,
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
switch (_response.error.reason) {
|
|
288
|
-
case "non-json":
|
|
289
|
-
throw new errors.PinnacleError({
|
|
290
|
-
statusCode: _response.error.statusCode,
|
|
291
|
-
body: _response.error.rawBody,
|
|
292
|
-
rawResponse: _response.rawResponse,
|
|
293
|
-
});
|
|
294
|
-
case "timeout":
|
|
295
|
-
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling DELETE /messages/send/schedule/{id}.");
|
|
296
|
-
case "unknown":
|
|
297
|
-
throw new errors.PinnacleError({
|
|
298
|
-
message: _response.error.errorMessage,
|
|
299
|
-
rawResponse: _response.rawResponse,
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
236
|
_getCustomAuthorizationHeaders() {
|
|
305
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
238
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
|
|
2
|
+
import * as core from "../../../../../../core/index.js";
|
|
3
|
+
import * as Pinnacle from "../../../../../index.js";
|
|
4
|
+
export declare namespace Blast {
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
6
|
+
}
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class Blast {
|
|
11
|
+
protected readonly _options: Blast.Options;
|
|
12
|
+
constructor(_options?: Blast.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Send an SMS message to all contacts in an audience. <br>
|
|
15
|
+
*
|
|
16
|
+
* Messages are distributed evenly across the provided sender phone numbers. <br>
|
|
17
|
+
*
|
|
18
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
19
|
+
*
|
|
20
|
+
* @param {Pinnacle.messages.BlastSms} request
|
|
21
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
22
|
+
*
|
|
23
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
24
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
25
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
26
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* await client.messages.blast.sms({
|
|
30
|
+
* audienceId: "aud_abc123",
|
|
31
|
+
* senders: ["+14155164736", "+14155164737"],
|
|
32
|
+
* message: {
|
|
33
|
+
* text: "Hello from Pinnacle!"
|
|
34
|
+
* }
|
|
35
|
+
* })
|
|
36
|
+
*/
|
|
37
|
+
sms(request: Pinnacle.messages.BlastSms, requestOptions?: Blast.RequestOptions): core.HttpResponsePromise<Pinnacle.messages.BlastSmsResponse>;
|
|
38
|
+
private __sms;
|
|
39
|
+
/**
|
|
40
|
+
* Send an MMS message to all contacts in an audience. <br>
|
|
41
|
+
*
|
|
42
|
+
* Messages are distributed evenly across the provided sender phone numbers. <br>
|
|
43
|
+
*
|
|
44
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
45
|
+
*
|
|
46
|
+
* @param {Pinnacle.messages.BlastMms} request
|
|
47
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
+
*
|
|
49
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
50
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
51
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
52
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.messages.blast.mms({
|
|
56
|
+
* audienceId: "aud_abc123",
|
|
57
|
+
* senders: ["+14155164736", "+14155164737"],
|
|
58
|
+
* message: {
|
|
59
|
+
* mediaUrls: ["https://fastly.picsum.photos/id/941/300/300.jpg"],
|
|
60
|
+
* text: "Check out this image!"
|
|
61
|
+
* },
|
|
62
|
+
* options: {
|
|
63
|
+
* validate: true
|
|
64
|
+
* }
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
mms(request: Pinnacle.messages.BlastMms, requestOptions?: Blast.RequestOptions): core.HttpResponsePromise<Pinnacle.messages.BlastMmsResponse>;
|
|
68
|
+
private __mms;
|
|
69
|
+
/**
|
|
70
|
+
* Send an RCS message to all contacts in an audience. <br>
|
|
71
|
+
*
|
|
72
|
+
* Messages are distributed evenly across the provided RCS agents for load balancing. Requires active RCS agents and recipient devices that support RCS Business Messaging. <br>
|
|
73
|
+
*
|
|
74
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
75
|
+
*
|
|
76
|
+
* @param {Pinnacle.messages.BlastRcs} request
|
|
77
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
|
+
*
|
|
79
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
80
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
81
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
82
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* await client.messages.blast.rcs({
|
|
86
|
+
* audienceId: "aud_abc123",
|
|
87
|
+
* senders: ["agent_pinnacle", "agent_pinnacle2"],
|
|
88
|
+
* message: {
|
|
89
|
+
* quickReplies: [{
|
|
90
|
+
* type: "trigger",
|
|
91
|
+
* payload: "payload",
|
|
92
|
+
* title: "title"
|
|
93
|
+
* }],
|
|
94
|
+
* text: "Hello from Pinnacle RCS!"
|
|
95
|
+
* },
|
|
96
|
+
* options: {
|
|
97
|
+
* transcode: true,
|
|
98
|
+
* validate: true
|
|
99
|
+
* }
|
|
100
|
+
* })
|
|
101
|
+
*/
|
|
102
|
+
rcs(request: Pinnacle.messages.BlastRcs, requestOptions?: Blast.RequestOptions): core.HttpResponsePromise<Pinnacle.messages.BlastRcsResponse>;
|
|
103
|
+
private __rcs;
|
|
104
|
+
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
105
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.Blast = void 0;
|
|
47
|
+
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
48
|
+
const core = __importStar(require("../../../../../../core/index.js"));
|
|
49
|
+
const environments = __importStar(require("../../../../../../environments.js"));
|
|
50
|
+
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
51
|
+
const Pinnacle = __importStar(require("../../../../../index.js"));
|
|
52
|
+
class Blast {
|
|
53
|
+
constructor(_options = {}) {
|
|
54
|
+
this._options = _options;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Send an SMS message to all contacts in an audience. <br>
|
|
58
|
+
*
|
|
59
|
+
* Messages are distributed evenly across the provided sender phone numbers. <br>
|
|
60
|
+
*
|
|
61
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
62
|
+
*
|
|
63
|
+
* @param {Pinnacle.messages.BlastSms} request
|
|
64
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
|
+
*
|
|
66
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
67
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
68
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
69
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* await client.messages.blast.sms({
|
|
73
|
+
* audienceId: "aud_abc123",
|
|
74
|
+
* senders: ["+14155164736", "+14155164737"],
|
|
75
|
+
* message: {
|
|
76
|
+
* text: "Hello from Pinnacle!"
|
|
77
|
+
* }
|
|
78
|
+
* })
|
|
79
|
+
*/
|
|
80
|
+
sms(request, requestOptions) {
|
|
81
|
+
return core.HttpResponsePromise.fromPromise(this.__sms(request, requestOptions));
|
|
82
|
+
}
|
|
83
|
+
__sms(request, requestOptions) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
86
|
+
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);
|
|
87
|
+
const _response = yield core.fetcher({
|
|
88
|
+
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, "messages/blast/sms"),
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: _headers,
|
|
91
|
+
contentType: "application/json",
|
|
92
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
93
|
+
requestType: "json",
|
|
94
|
+
body: request,
|
|
95
|
+
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,
|
|
96
|
+
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,
|
|
97
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
98
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
99
|
+
logging: this._options.logging,
|
|
100
|
+
});
|
|
101
|
+
if (_response.ok) {
|
|
102
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
103
|
+
}
|
|
104
|
+
if (_response.error.reason === "status-code") {
|
|
105
|
+
switch (_response.error.statusCode) {
|
|
106
|
+
case 400:
|
|
107
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
108
|
+
case 401:
|
|
109
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
110
|
+
case 402:
|
|
111
|
+
throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
112
|
+
case 500:
|
|
113
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
114
|
+
default:
|
|
115
|
+
throw new errors.PinnacleError({
|
|
116
|
+
statusCode: _response.error.statusCode,
|
|
117
|
+
body: _response.error.body,
|
|
118
|
+
rawResponse: _response.rawResponse,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
switch (_response.error.reason) {
|
|
123
|
+
case "non-json":
|
|
124
|
+
throw new errors.PinnacleError({
|
|
125
|
+
statusCode: _response.error.statusCode,
|
|
126
|
+
body: _response.error.rawBody,
|
|
127
|
+
rawResponse: _response.rawResponse,
|
|
128
|
+
});
|
|
129
|
+
case "timeout":
|
|
130
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/sms.");
|
|
131
|
+
case "unknown":
|
|
132
|
+
throw new errors.PinnacleError({
|
|
133
|
+
message: _response.error.errorMessage,
|
|
134
|
+
rawResponse: _response.rawResponse,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Send an MMS message to all contacts in an audience. <br>
|
|
141
|
+
*
|
|
142
|
+
* Messages are distributed evenly across the provided sender phone numbers. <br>
|
|
143
|
+
*
|
|
144
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
145
|
+
*
|
|
146
|
+
* @param {Pinnacle.messages.BlastMms} request
|
|
147
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
148
|
+
*
|
|
149
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
150
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
151
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
152
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* await client.messages.blast.mms({
|
|
156
|
+
* audienceId: "aud_abc123",
|
|
157
|
+
* senders: ["+14155164736", "+14155164737"],
|
|
158
|
+
* message: {
|
|
159
|
+
* mediaUrls: ["https://fastly.picsum.photos/id/941/300/300.jpg"],
|
|
160
|
+
* text: "Check out this image!"
|
|
161
|
+
* },
|
|
162
|
+
* options: {
|
|
163
|
+
* validate: true
|
|
164
|
+
* }
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
mms(request, requestOptions) {
|
|
168
|
+
return core.HttpResponsePromise.fromPromise(this.__mms(request, requestOptions));
|
|
169
|
+
}
|
|
170
|
+
__mms(request, requestOptions) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
173
|
+
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);
|
|
174
|
+
const _response = yield core.fetcher({
|
|
175
|
+
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, "messages/blast/mms"),
|
|
176
|
+
method: "POST",
|
|
177
|
+
headers: _headers,
|
|
178
|
+
contentType: "application/json",
|
|
179
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
180
|
+
requestType: "json",
|
|
181
|
+
body: request,
|
|
182
|
+
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,
|
|
183
|
+
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,
|
|
184
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
185
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
186
|
+
logging: this._options.logging,
|
|
187
|
+
});
|
|
188
|
+
if (_response.ok) {
|
|
189
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
190
|
+
}
|
|
191
|
+
if (_response.error.reason === "status-code") {
|
|
192
|
+
switch (_response.error.statusCode) {
|
|
193
|
+
case 400:
|
|
194
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
195
|
+
case 401:
|
|
196
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
197
|
+
case 402:
|
|
198
|
+
throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
199
|
+
case 500:
|
|
200
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
201
|
+
default:
|
|
202
|
+
throw new errors.PinnacleError({
|
|
203
|
+
statusCode: _response.error.statusCode,
|
|
204
|
+
body: _response.error.body,
|
|
205
|
+
rawResponse: _response.rawResponse,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
switch (_response.error.reason) {
|
|
210
|
+
case "non-json":
|
|
211
|
+
throw new errors.PinnacleError({
|
|
212
|
+
statusCode: _response.error.statusCode,
|
|
213
|
+
body: _response.error.rawBody,
|
|
214
|
+
rawResponse: _response.rawResponse,
|
|
215
|
+
});
|
|
216
|
+
case "timeout":
|
|
217
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/mms.");
|
|
218
|
+
case "unknown":
|
|
219
|
+
throw new errors.PinnacleError({
|
|
220
|
+
message: _response.error.errorMessage,
|
|
221
|
+
rawResponse: _response.rawResponse,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Send an RCS message to all contacts in an audience. <br>
|
|
228
|
+
*
|
|
229
|
+
* Messages are distributed evenly across the provided RCS agents for load balancing. Requires active RCS agents and recipient devices that support RCS Business Messaging. <br>
|
|
230
|
+
*
|
|
231
|
+
* Use the optional `schedule` parameter in `options` to schedule the blast for future delivery. When scheduled, the response will contain a `scheduleId` instead of blast details.
|
|
232
|
+
*
|
|
233
|
+
* @param {Pinnacle.messages.BlastRcs} request
|
|
234
|
+
* @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
|
|
235
|
+
*
|
|
236
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
237
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
238
|
+
* @throws {@link Pinnacle.PaymentRequiredError}
|
|
239
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* await client.messages.blast.rcs({
|
|
243
|
+
* audienceId: "aud_abc123",
|
|
244
|
+
* senders: ["agent_pinnacle", "agent_pinnacle2"],
|
|
245
|
+
* message: {
|
|
246
|
+
* quickReplies: [{
|
|
247
|
+
* type: "trigger",
|
|
248
|
+
* payload: "payload",
|
|
249
|
+
* title: "title"
|
|
250
|
+
* }],
|
|
251
|
+
* text: "Hello from Pinnacle RCS!"
|
|
252
|
+
* },
|
|
253
|
+
* options: {
|
|
254
|
+
* transcode: true,
|
|
255
|
+
* validate: true
|
|
256
|
+
* }
|
|
257
|
+
* })
|
|
258
|
+
*/
|
|
259
|
+
rcs(request, requestOptions) {
|
|
260
|
+
return core.HttpResponsePromise.fromPromise(this.__rcs(request, requestOptions));
|
|
261
|
+
}
|
|
262
|
+
__rcs(request, requestOptions) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
265
|
+
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);
|
|
266
|
+
const _response = yield core.fetcher({
|
|
267
|
+
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, "messages/blast/rcs"),
|
|
268
|
+
method: "POST",
|
|
269
|
+
headers: _headers,
|
|
270
|
+
contentType: "application/json",
|
|
271
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
272
|
+
requestType: "json",
|
|
273
|
+
body: request,
|
|
274
|
+
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,
|
|
275
|
+
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,
|
|
276
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
277
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
278
|
+
logging: this._options.logging,
|
|
279
|
+
});
|
|
280
|
+
if (_response.ok) {
|
|
281
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
282
|
+
}
|
|
283
|
+
if (_response.error.reason === "status-code") {
|
|
284
|
+
switch (_response.error.statusCode) {
|
|
285
|
+
case 400:
|
|
286
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
287
|
+
case 401:
|
|
288
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
289
|
+
case 402:
|
|
290
|
+
throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
291
|
+
case 500:
|
|
292
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
293
|
+
default:
|
|
294
|
+
throw new errors.PinnacleError({
|
|
295
|
+
statusCode: _response.error.statusCode,
|
|
296
|
+
body: _response.error.body,
|
|
297
|
+
rawResponse: _response.rawResponse,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
switch (_response.error.reason) {
|
|
302
|
+
case "non-json":
|
|
303
|
+
throw new errors.PinnacleError({
|
|
304
|
+
statusCode: _response.error.statusCode,
|
|
305
|
+
body: _response.error.rawBody,
|
|
306
|
+
rawResponse: _response.rawResponse,
|
|
307
|
+
});
|
|
308
|
+
case "timeout":
|
|
309
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/rcs.");
|
|
310
|
+
case "unknown":
|
|
311
|
+
throw new errors.PinnacleError({
|
|
312
|
+
message: _response.error.errorMessage,
|
|
313
|
+
rawResponse: _response.rawResponse,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
_getCustomAuthorizationHeaders() {
|
|
319
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
321
|
+
return { "PINNACLE-API-KEY": apiKeyValue };
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.Blast = Blast;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|