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.
Files changed (100) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/messages/client/Client.d.ts +6 -21
  3. package/dist/cjs/api/resources/messages/client/Client.js +16 -84
  4. package/dist/cjs/api/resources/messages/resources/blast/client/Client.d.ts +105 -0
  5. package/dist/cjs/api/resources/messages/resources/blast/client/Client.js +325 -0
  6. package/dist/cjs/api/resources/messages/resources/blast/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/messages/resources/blast/client/index.js +17 -0
  8. package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastMms.d.ts +61 -0
  9. package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastRcs.d.ts +110 -0
  10. package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastRcs.js +23 -0
  11. package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastSms.d.ts +47 -0
  12. package/dist/cjs/api/resources/messages/resources/blast/client/requests/BlastSms.js +3 -0
  13. package/dist/cjs/api/resources/messages/resources/blast/client/requests/index.d.ts +3 -0
  14. package/dist/cjs/api/resources/messages/resources/blast/client/requests/index.js +2 -0
  15. package/dist/cjs/api/resources/messages/resources/blast/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/messages/resources/blast/index.js +18 -0
  17. package/dist/cjs/api/resources/messages/resources/blast/types/BlastMmsResponse.d.ts +2 -0
  18. package/dist/cjs/api/resources/messages/resources/blast/types/BlastMmsResponse.js +3 -0
  19. package/dist/cjs/api/resources/messages/resources/blast/types/BlastRcsResponse.d.ts +2 -0
  20. package/dist/cjs/api/resources/messages/resources/blast/types/BlastRcsResponse.js +3 -0
  21. package/dist/cjs/api/resources/messages/resources/blast/types/BlastSmsResponse.d.ts +2 -0
  22. package/dist/cjs/api/resources/messages/resources/blast/types/BlastSmsResponse.js +3 -0
  23. package/dist/cjs/api/resources/messages/resources/blast/types/index.d.ts +3 -0
  24. package/dist/cjs/api/resources/messages/resources/blast/types/index.js +19 -0
  25. package/dist/cjs/api/resources/messages/resources/index.d.ts +4 -0
  26. package/dist/cjs/api/resources/messages/resources/index.js +5 -1
  27. package/dist/cjs/api/resources/messages/resources/schedule/client/Client.d.ts +32 -0
  28. package/dist/cjs/api/resources/messages/resources/schedule/client/Client.js +135 -0
  29. package/dist/cjs/api/resources/messages/resources/schedule/client/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/messages/resources/schedule/client/index.js +2 -0
  31. package/dist/cjs/api/resources/messages/resources/schedule/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/messages/resources/schedule/index.js +17 -0
  33. package/dist/cjs/api/types/BlastDetails.d.ts +17 -0
  34. package/dist/cjs/api/types/BlastDetails.js +3 -0
  35. package/dist/cjs/api/types/DlcCampaignWithExtendedBrandAndStatus.d.ts +42 -0
  36. package/dist/cjs/api/types/DlcCampaignWithExtendedBrandAndStatus.js +32 -0
  37. package/dist/cjs/api/types/MessageSchedule.d.ts +25 -11
  38. package/dist/cjs/api/types/MessageStatusEnum.d.ts +1 -0
  39. package/dist/cjs/api/types/MessageStatusEnum.js +1 -0
  40. package/dist/cjs/api/types/ScheduleCancelResult.d.ts +7 -0
  41. package/dist/cjs/api/types/ScheduleCancelResult.js +3 -0
  42. package/dist/cjs/api/types/ScheduledBlastDetails.d.ts +24 -0
  43. package/dist/cjs/api/types/ScheduledBlastDetails.js +3 -0
  44. package/dist/cjs/api/types/index.d.ts +3 -1
  45. package/dist/cjs/api/types/index.js +3 -1
  46. package/dist/cjs/version.d.ts +1 -1
  47. package/dist/cjs/version.js +1 -1
  48. package/dist/esm/Client.mjs +2 -2
  49. package/dist/esm/api/resources/messages/client/Client.d.mts +6 -21
  50. package/dist/esm/api/resources/messages/client/Client.mjs +10 -78
  51. package/dist/esm/api/resources/messages/resources/blast/client/Client.d.mts +105 -0
  52. package/dist/esm/api/resources/messages/resources/blast/client/Client.mjs +288 -0
  53. package/dist/esm/api/resources/messages/resources/blast/client/index.d.mts +1 -0
  54. package/dist/esm/api/resources/messages/resources/blast/client/index.mjs +1 -0
  55. package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastMms.d.mts +61 -0
  56. package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastRcs.d.mts +110 -0
  57. package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastRcs.mjs +20 -0
  58. package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastSms.d.mts +47 -0
  59. package/dist/esm/api/resources/messages/resources/blast/client/requests/BlastSms.mjs +2 -0
  60. package/dist/esm/api/resources/messages/resources/blast/client/requests/index.d.mts +3 -0
  61. package/dist/esm/api/resources/messages/resources/blast/client/requests/index.mjs +1 -0
  62. package/dist/esm/api/resources/messages/resources/blast/index.d.mts +2 -0
  63. package/dist/esm/api/resources/messages/resources/blast/index.mjs +2 -0
  64. package/dist/esm/api/resources/messages/resources/blast/types/BlastMmsResponse.d.mts +2 -0
  65. package/dist/esm/api/resources/messages/resources/blast/types/BlastMmsResponse.mjs +2 -0
  66. package/dist/esm/api/resources/messages/resources/blast/types/BlastRcsResponse.d.mts +2 -0
  67. package/dist/esm/api/resources/messages/resources/blast/types/BlastRcsResponse.mjs +2 -0
  68. package/dist/esm/api/resources/messages/resources/blast/types/BlastSmsResponse.d.mts +2 -0
  69. package/dist/esm/api/resources/messages/resources/blast/types/BlastSmsResponse.mjs +2 -0
  70. package/dist/esm/api/resources/messages/resources/blast/types/index.d.mts +3 -0
  71. package/dist/esm/api/resources/messages/resources/blast/types/index.mjs +3 -0
  72. package/dist/esm/api/resources/messages/resources/index.d.mts +4 -0
  73. package/dist/esm/api/resources/messages/resources/index.mjs +4 -0
  74. package/dist/esm/api/resources/messages/resources/schedule/client/Client.d.mts +32 -0
  75. package/dist/esm/api/resources/messages/resources/schedule/client/Client.mjs +98 -0
  76. package/dist/esm/api/resources/messages/resources/schedule/client/index.d.mts +1 -0
  77. package/dist/esm/api/resources/messages/resources/schedule/client/index.mjs +1 -0
  78. package/dist/esm/api/resources/messages/resources/schedule/index.d.mts +1 -0
  79. package/dist/esm/api/resources/messages/resources/schedule/index.mjs +1 -0
  80. package/dist/esm/api/types/BlastDetails.d.mts +17 -0
  81. package/dist/esm/api/types/BlastDetails.mjs +2 -0
  82. package/dist/esm/api/types/DlcCampaignWithExtendedBrandAndStatus.d.mts +42 -0
  83. package/dist/esm/api/types/DlcCampaignWithExtendedBrandAndStatus.mjs +31 -1
  84. package/dist/esm/api/types/MessageSchedule.d.mts +25 -11
  85. package/dist/esm/api/types/MessageStatusEnum.d.mts +1 -0
  86. package/dist/esm/api/types/MessageStatusEnum.mjs +1 -0
  87. package/dist/esm/api/types/ScheduleCancelResult.d.mts +7 -0
  88. package/dist/esm/api/types/ScheduleCancelResult.mjs +2 -0
  89. package/dist/esm/api/types/ScheduledBlastDetails.d.mts +24 -0
  90. package/dist/esm/api/types/ScheduledBlastDetails.mjs +2 -0
  91. package/dist/esm/api/types/index.d.mts +3 -1
  92. package/dist/esm/api/types/index.mjs +3 -1
  93. package/dist/esm/version.d.mts +1 -1
  94. package/dist/esm/version.mjs +1 -1
  95. package/package.json +1 -1
  96. package/reference.md +299 -68
  97. package/dist/cjs/api/types/CancelScheduledMessageResponse.d.ts +0 -4
  98. package/dist/esm/api/types/CancelScheduledMessageResponse.d.mts +0 -4
  99. /package/dist/cjs/api/{types/CancelScheduledMessageResponse.js → resources/messages/resources/blast/client/requests/BlastMms.js} +0 -0
  100. /package/dist/esm/api/{types/CancelScheduledMessageResponse.mjs → resources/messages/resources/blast/client/requests/BlastMms.mjs} +0 -0
@@ -0,0 +1,288 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
12
+ import * as core from "../../../../../../core/index.mjs";
13
+ import * as environments from "../../../../../../environments.mjs";
14
+ import * as errors from "../../../../../../errors/index.mjs";
15
+ import * as Pinnacle from "../../../../../index.mjs";
16
+ export class Blast {
17
+ constructor(_options = {}) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * Send an SMS message to all contacts in an audience. <br>
22
+ *
23
+ * Messages are distributed evenly across the provided sender phone numbers. <br>
24
+ *
25
+ * 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.
26
+ *
27
+ * @param {Pinnacle.messages.BlastSms} request
28
+ * @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link Pinnacle.BadRequestError}
31
+ * @throws {@link Pinnacle.UnauthorizedError}
32
+ * @throws {@link Pinnacle.PaymentRequiredError}
33
+ * @throws {@link Pinnacle.InternalServerError}
34
+ *
35
+ * @example
36
+ * await client.messages.blast.sms({
37
+ * audienceId: "aud_abc123",
38
+ * senders: ["+14155164736", "+14155164737"],
39
+ * message: {
40
+ * text: "Hello from Pinnacle!"
41
+ * }
42
+ * })
43
+ */
44
+ sms(request, requestOptions) {
45
+ return core.HttpResponsePromise.fromPromise(this.__sms(request, requestOptions));
46
+ }
47
+ __sms(request, requestOptions) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
50
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
51
+ const _response = yield core.fetcher({
52
+ 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"),
53
+ method: "POST",
54
+ headers: _headers,
55
+ contentType: "application/json",
56
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
57
+ requestType: "json",
58
+ body: request,
59
+ 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,
60
+ 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,
61
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
62
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
63
+ logging: this._options.logging,
64
+ });
65
+ if (_response.ok) {
66
+ return { data: _response.body, rawResponse: _response.rawResponse };
67
+ }
68
+ if (_response.error.reason === "status-code") {
69
+ switch (_response.error.statusCode) {
70
+ case 400:
71
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
72
+ case 401:
73
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
74
+ case 402:
75
+ throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
76
+ case 500:
77
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
78
+ default:
79
+ throw new errors.PinnacleError({
80
+ statusCode: _response.error.statusCode,
81
+ body: _response.error.body,
82
+ rawResponse: _response.rawResponse,
83
+ });
84
+ }
85
+ }
86
+ switch (_response.error.reason) {
87
+ case "non-json":
88
+ throw new errors.PinnacleError({
89
+ statusCode: _response.error.statusCode,
90
+ body: _response.error.rawBody,
91
+ rawResponse: _response.rawResponse,
92
+ });
93
+ case "timeout":
94
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/sms.");
95
+ case "unknown":
96
+ throw new errors.PinnacleError({
97
+ message: _response.error.errorMessage,
98
+ rawResponse: _response.rawResponse,
99
+ });
100
+ }
101
+ });
102
+ }
103
+ /**
104
+ * Send an MMS message to all contacts in an audience. <br>
105
+ *
106
+ * Messages are distributed evenly across the provided sender phone numbers. <br>
107
+ *
108
+ * 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.
109
+ *
110
+ * @param {Pinnacle.messages.BlastMms} request
111
+ * @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link Pinnacle.BadRequestError}
114
+ * @throws {@link Pinnacle.UnauthorizedError}
115
+ * @throws {@link Pinnacle.PaymentRequiredError}
116
+ * @throws {@link Pinnacle.InternalServerError}
117
+ *
118
+ * @example
119
+ * await client.messages.blast.mms({
120
+ * audienceId: "aud_abc123",
121
+ * senders: ["+14155164736", "+14155164737"],
122
+ * message: {
123
+ * mediaUrls: ["https://fastly.picsum.photos/id/941/300/300.jpg"],
124
+ * text: "Check out this image!"
125
+ * },
126
+ * options: {
127
+ * validate: true
128
+ * }
129
+ * })
130
+ */
131
+ mms(request, requestOptions) {
132
+ return core.HttpResponsePromise.fromPromise(this.__mms(request, requestOptions));
133
+ }
134
+ __mms(request, requestOptions) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
137
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
138
+ const _response = yield core.fetcher({
139
+ 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"),
140
+ method: "POST",
141
+ headers: _headers,
142
+ contentType: "application/json",
143
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
144
+ requestType: "json",
145
+ body: request,
146
+ 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,
147
+ 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,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
150
+ logging: this._options.logging,
151
+ });
152
+ if (_response.ok) {
153
+ return { data: _response.body, rawResponse: _response.rawResponse };
154
+ }
155
+ if (_response.error.reason === "status-code") {
156
+ switch (_response.error.statusCode) {
157
+ case 400:
158
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
159
+ case 401:
160
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
161
+ case 402:
162
+ throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
163
+ case 500:
164
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
165
+ default:
166
+ throw new errors.PinnacleError({
167
+ statusCode: _response.error.statusCode,
168
+ body: _response.error.body,
169
+ rawResponse: _response.rawResponse,
170
+ });
171
+ }
172
+ }
173
+ switch (_response.error.reason) {
174
+ case "non-json":
175
+ throw new errors.PinnacleError({
176
+ statusCode: _response.error.statusCode,
177
+ body: _response.error.rawBody,
178
+ rawResponse: _response.rawResponse,
179
+ });
180
+ case "timeout":
181
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/mms.");
182
+ case "unknown":
183
+ throw new errors.PinnacleError({
184
+ message: _response.error.errorMessage,
185
+ rawResponse: _response.rawResponse,
186
+ });
187
+ }
188
+ });
189
+ }
190
+ /**
191
+ * Send an RCS message to all contacts in an audience. <br>
192
+ *
193
+ * 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>
194
+ *
195
+ * 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.
196
+ *
197
+ * @param {Pinnacle.messages.BlastRcs} request
198
+ * @param {Blast.RequestOptions} requestOptions - Request-specific configuration.
199
+ *
200
+ * @throws {@link Pinnacle.BadRequestError}
201
+ * @throws {@link Pinnacle.UnauthorizedError}
202
+ * @throws {@link Pinnacle.PaymentRequiredError}
203
+ * @throws {@link Pinnacle.InternalServerError}
204
+ *
205
+ * @example
206
+ * await client.messages.blast.rcs({
207
+ * audienceId: "aud_abc123",
208
+ * senders: ["agent_pinnacle", "agent_pinnacle2"],
209
+ * message: {
210
+ * quickReplies: [{
211
+ * type: "trigger",
212
+ * payload: "payload",
213
+ * title: "title"
214
+ * }],
215
+ * text: "Hello from Pinnacle RCS!"
216
+ * },
217
+ * options: {
218
+ * transcode: true,
219
+ * validate: true
220
+ * }
221
+ * })
222
+ */
223
+ rcs(request, requestOptions) {
224
+ return core.HttpResponsePromise.fromPromise(this.__rcs(request, requestOptions));
225
+ }
226
+ __rcs(request, requestOptions) {
227
+ return __awaiter(this, void 0, void 0, function* () {
228
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
229
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
230
+ const _response = yield core.fetcher({
231
+ 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"),
232
+ method: "POST",
233
+ headers: _headers,
234
+ contentType: "application/json",
235
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
236
+ requestType: "json",
237
+ body: request,
238
+ 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,
239
+ 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,
240
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
241
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
242
+ logging: this._options.logging,
243
+ });
244
+ if (_response.ok) {
245
+ return { data: _response.body, rawResponse: _response.rawResponse };
246
+ }
247
+ if (_response.error.reason === "status-code") {
248
+ switch (_response.error.statusCode) {
249
+ case 400:
250
+ throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
251
+ case 401:
252
+ throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
253
+ case 402:
254
+ throw new Pinnacle.PaymentRequiredError(_response.error.body, _response.rawResponse);
255
+ case 500:
256
+ throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
257
+ default:
258
+ throw new errors.PinnacleError({
259
+ statusCode: _response.error.statusCode,
260
+ body: _response.error.body,
261
+ rawResponse: _response.rawResponse,
262
+ });
263
+ }
264
+ }
265
+ switch (_response.error.reason) {
266
+ case "non-json":
267
+ throw new errors.PinnacleError({
268
+ statusCode: _response.error.statusCode,
269
+ body: _response.error.rawBody,
270
+ rawResponse: _response.rawResponse,
271
+ });
272
+ case "timeout":
273
+ throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/blast/rcs.");
274
+ case "unknown":
275
+ throw new errors.PinnacleError({
276
+ message: _response.error.errorMessage,
277
+ rawResponse: _response.rawResponse,
278
+ });
279
+ }
280
+ });
281
+ }
282
+ _getCustomAuthorizationHeaders() {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
285
+ return { "PINNACLE-API-KEY": apiKeyValue };
286
+ });
287
+ }
288
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,61 @@
1
+ import type * as Pinnacle from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * audienceId: "aud_abc123",
6
+ * senders: ["+14155164736", "+14155164737"],
7
+ * message: {
8
+ * mediaUrls: ["https://fastly.picsum.photos/id/941/300/300.jpg"],
9
+ * text: "Check out this image!"
10
+ * },
11
+ * options: {
12
+ * validate: true
13
+ * }
14
+ * }
15
+ *
16
+ * @example
17
+ * {
18
+ * audienceId: "aud_abc123",
19
+ * senders: ["+14155164736", "+14155164737"],
20
+ * message: {
21
+ * mediaUrls: ["https://fastly.picsum.photos/id/941/300/300.jpg"],
22
+ * text: "Check out this image!"
23
+ * },
24
+ * options: {
25
+ * validate: true
26
+ * }
27
+ * }
28
+ */
29
+ export interface BlastMms {
30
+ /**
31
+ * The audience ID to send the blast to. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. <br>
32
+ *
33
+ * You can create an audience via [the dashboard](https://app.pinnacle.sh/dashboard/audiences) or [API](/api-reference/audiences/create).
34
+ */
35
+ audienceId: string;
36
+ /**
37
+ * Array of phone numbers to send from in E.164 format. <br>
38
+ *
39
+ * Messages will be distributed evenly across these senders.
40
+ *
41
+ * > **Note:** Sandbox numbers cannot be used for blasts.
42
+ */
43
+ senders: string[];
44
+ message: Pinnacle.MmsContent;
45
+ /** Additional settings to customize MMS blast delivery. */
46
+ options?: BlastMms.Options;
47
+ }
48
+ export declare namespace BlastMms {
49
+ /**
50
+ * Additional settings to customize MMS blast delivery.
51
+ */
52
+ interface Options {
53
+ /**
54
+ * Set to true to validate the message before sending. <br>
55
+ *
56
+ * If validation fails, the blast is not sent.
57
+ */
58
+ validate?: boolean;
59
+ schedule?: Pinnacle.MessageSchedule;
60
+ }
61
+ }
@@ -0,0 +1,110 @@
1
+ import type * as Pinnacle from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * audienceId: "aud_abc123",
6
+ * senders: ["agent_pinnacle", "agent_pinnacle2"],
7
+ * message: {
8
+ * quickReplies: [{
9
+ * type: "trigger",
10
+ * payload: "payload",
11
+ * title: "title"
12
+ * }],
13
+ * text: "Hello from Pinnacle RCS!"
14
+ * },
15
+ * options: {
16
+ * transcode: true,
17
+ * validate: true
18
+ * }
19
+ * }
20
+ *
21
+ * @example
22
+ * {
23
+ * audienceId: "aud_abc123",
24
+ * senders: ["agent_pinnacle", "agent_pinnacle2"],
25
+ * message: {
26
+ * quickReplies: [{
27
+ * type: "trigger",
28
+ * payload: "payload",
29
+ * title: "title"
30
+ * }],
31
+ * text: "Hello from Pinnacle RCS!"
32
+ * },
33
+ * options: {
34
+ * transcode: true,
35
+ * validate: true
36
+ * }
37
+ * }
38
+ */
39
+ export interface BlastRcs {
40
+ /**
41
+ * The audience ID to send the blast to. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. <br>
42
+ *
43
+ * You can create an audience via [the dashboard](https://app.pinnacle.sh/dashboard/audiences) or [API](/api-reference/audiences/create).
44
+ */
45
+ audienceId: string;
46
+ /**
47
+ * Array of RCS agent IDs to send from. Each must be prefixed with `agent_`. <br>
48
+ *
49
+ * Messages will be evenly distributed across these agents.
50
+ *
51
+ * > **Note:** Test agents cannot be used for blasts.
52
+ */
53
+ senders: string[];
54
+ message: Pinnacle.RcsValidateContent;
55
+ /** Configure how your RCS blast is sent and tracked. */
56
+ options?: BlastRcs.Options;
57
+ }
58
+ export declare namespace BlastRcs {
59
+ /**
60
+ * Configure how your RCS blast is sent and tracked.
61
+ */
62
+ interface Options {
63
+ /** Media files and card media will be transcoded to a supported RCS format. This adds a small delay to sending the message. Ignored for rich text messages. */
64
+ transcode?: boolean;
65
+ /**
66
+ * Validate your message for any unsupported files. <br>
67
+ *
68
+ * If failed, errors will be thrown and the blast will not be sent.
69
+ */
70
+ validate?: boolean;
71
+ /**
72
+ * Configure standalone card layout options for enhanced visual presentation.
73
+ *
74
+ * > **⚠️ Important Restriction**
75
+ * >
76
+ * > This option is **only valid for single card messages**. Using it with multiple cards will cause the request to fail with a validation error.
77
+ */
78
+ standalone_card?: Options.StandaloneCard;
79
+ schedule?: Pinnacle.MessageSchedule;
80
+ }
81
+ namespace Options {
82
+ /**
83
+ * Configure standalone card layout options for enhanced visual presentation.
84
+ *
85
+ * > **⚠️ Important Restriction**
86
+ * >
87
+ * > This option is **only valid for single card messages**. Using it with multiple cards will cause the request to fail with a validation error.
88
+ */
89
+ interface StandaloneCard {
90
+ /** The orientation of the standalone card. */
91
+ orientation?: StandaloneCard.Orientation;
92
+ /** The alignment of the image in the standalone card. This field is ignored if orientation is VERTICAL. */
93
+ image_alignment?: StandaloneCard.ImageAlignment;
94
+ }
95
+ namespace StandaloneCard {
96
+ /** The orientation of the standalone card. */
97
+ const Orientation: {
98
+ readonly Horizontal: "HORIZONTAL";
99
+ readonly Vertical: "VERTICAL";
100
+ };
101
+ type Orientation = (typeof Orientation)[keyof typeof Orientation];
102
+ /** The alignment of the image in the standalone card. This field is ignored if orientation is VERTICAL. */
103
+ const ImageAlignment: {
104
+ readonly Left: "LEFT";
105
+ readonly Right: "RIGHT";
106
+ };
107
+ type ImageAlignment = (typeof ImageAlignment)[keyof typeof ImageAlignment];
108
+ }
109
+ }
110
+ }
@@ -0,0 +1,20 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var BlastRcs;
3
+ (function (BlastRcs) {
4
+ let Options;
5
+ (function (Options) {
6
+ let StandaloneCard;
7
+ (function (StandaloneCard) {
8
+ /** The orientation of the standalone card. */
9
+ StandaloneCard.Orientation = {
10
+ Horizontal: "HORIZONTAL",
11
+ Vertical: "VERTICAL",
12
+ };
13
+ /** The alignment of the image in the standalone card. This field is ignored if orientation is VERTICAL. */
14
+ StandaloneCard.ImageAlignment = {
15
+ Left: "LEFT",
16
+ Right: "RIGHT",
17
+ };
18
+ })(StandaloneCard = Options.StandaloneCard || (Options.StandaloneCard = {}));
19
+ })(Options = BlastRcs.Options || (BlastRcs.Options = {}));
20
+ })(BlastRcs || (BlastRcs = {}));
@@ -0,0 +1,47 @@
1
+ import type * as Pinnacle from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * audienceId: "aud_abc123",
6
+ * senders: ["+14155164736", "+14155164737"],
7
+ * message: {
8
+ * text: "Hello from Pinnacle!"
9
+ * }
10
+ * }
11
+ *
12
+ * @example
13
+ * {
14
+ * audienceId: "aud_abc123",
15
+ * senders: ["+14155164736", "+14155164737"],
16
+ * message: {
17
+ * text: "Hello from Pinnacle!"
18
+ * }
19
+ * }
20
+ */
21
+ export interface BlastSms {
22
+ /**
23
+ * The audience ID to send the blast to. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. <br>
24
+ *
25
+ * You can create an audience via [the dashboard](https://app.pinnacle.sh/dashboard/audiences) or [API](/api-reference/audiences/create).
26
+ */
27
+ audienceId: string;
28
+ /**
29
+ * Array of phone numbers to send from in E.164 format. <br>
30
+ *
31
+ * Messages will be distributed evenly across these senders.
32
+ *
33
+ * > **Note:** Sandbox numbers cannot be used for blasts.
34
+ */
35
+ senders: string[];
36
+ message: Pinnacle.SmsContent;
37
+ /** Additional settings to customize SMS blast delivery. */
38
+ options?: BlastSms.Options;
39
+ }
40
+ export declare namespace BlastSms {
41
+ /**
42
+ * Additional settings to customize SMS blast delivery.
43
+ */
44
+ interface Options {
45
+ schedule?: Pinnacle.MessageSchedule;
46
+ }
47
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { BlastMms } from "./BlastMms.mjs";
2
+ export type { BlastRcs } from "./BlastRcs.mjs";
3
+ export type { BlastSms } from "./BlastSms.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ import type * as Pinnacle from "../../../../../index.mjs";
2
+ export type BlastMmsResponse = Pinnacle.BlastDetails | Pinnacle.ScheduledBlastDetails;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,2 @@
1
+ import type * as Pinnacle from "../../../../../index.mjs";
2
+ export type BlastRcsResponse = Pinnacle.BlastDetails | Pinnacle.ScheduledBlastDetails;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,2 @@
1
+ import type * as Pinnacle from "../../../../../index.mjs";
2
+ export type BlastSmsResponse = Pinnacle.BlastDetails | Pinnacle.ScheduledBlastDetails;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./BlastMmsResponse.mjs";
2
+ export * from "./BlastRcsResponse.mjs";
3
+ export * from "./BlastSmsResponse.mjs";
@@ -0,0 +1,3 @@
1
+ export * from "./BlastMmsResponse.mjs";
2
+ export * from "./BlastRcsResponse.mjs";
3
+ export * from "./BlastSmsResponse.mjs";
@@ -1,9 +1,13 @@
1
+ export * from "./blast/client/requests/index.mjs";
2
+ export * as blast from "./blast/index.mjs";
3
+ export * from "./blast/types/index.mjs";
1
4
  export * from "./mms/client/requests/index.mjs";
2
5
  export * as mms from "./mms/index.mjs";
3
6
  export * from "./mms/types/index.mjs";
4
7
  export * from "./rcs/client/requests/index.mjs";
5
8
  export * as rcs from "./rcs/index.mjs";
6
9
  export * from "./rcs/types/index.mjs";
10
+ export * as schedule from "./schedule/index.mjs";
7
11
  export * from "./sms/client/requests/index.mjs";
8
12
  export * as sms from "./sms/index.mjs";
9
13
  export * from "./sms/types/index.mjs";
@@ -1,9 +1,13 @@
1
+ export * from "./blast/client/requests/index.mjs";
2
+ export * as blast from "./blast/index.mjs";
3
+ export * from "./blast/types/index.mjs";
1
4
  export * from "./mms/client/requests/index.mjs";
2
5
  export * as mms from "./mms/index.mjs";
3
6
  export * from "./mms/types/index.mjs";
4
7
  export * from "./rcs/client/requests/index.mjs";
5
8
  export * as rcs from "./rcs/index.mjs";
6
9
  export * from "./rcs/types/index.mjs";
10
+ export * as schedule from "./schedule/index.mjs";
7
11
  export * from "./sms/client/requests/index.mjs";
8
12
  export * as sms from "./sms/index.mjs";
9
13
  export * from "./sms/types/index.mjs";
@@ -0,0 +1,32 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import * as core from "../../../../../../core/index.mjs";
3
+ import * as Pinnacle from "../../../../../index.mjs";
4
+ export declare namespace Schedule {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Schedule {
11
+ protected readonly _options: Schedule.Options;
12
+ constructor(_options?: Schedule.Options);
13
+ /**
14
+ * Cancel a scheduled message or blast. <br>
15
+ *
16
+ * Works for both individual scheduled messages and scheduled blasts. Use the `scheduleId` returned when the message or blast was scheduled.
17
+ *
18
+ * @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`.
19
+ * @param {Schedule.RequestOptions} requestOptions - Request-specific configuration.
20
+ *
21
+ * @throws {@link Pinnacle.BadRequestError}
22
+ * @throws {@link Pinnacle.UnauthorizedError}
23
+ * @throws {@link Pinnacle.NotFoundError}
24
+ * @throws {@link Pinnacle.InternalServerError}
25
+ *
26
+ * @example
27
+ * await client.messages.schedule.cancel("id")
28
+ */
29
+ cancel(id: string, requestOptions?: Schedule.RequestOptions): core.HttpResponsePromise<Pinnacle.ScheduleCancelResult>;
30
+ private __cancel;
31
+ protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
32
+ }