@trycourier/courier 6.4.0 → 6.4.2
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/Client.d.ts +14 -48
- package/Client.js +20 -49
- package/README.md +113 -808
- package/api/client/requests/SendMessageRequest.d.ts +12 -47
- package/api/resources/audiences/client/Client.d.ts +10 -5
- package/api/resources/audiences/client/Client.js +45 -15
- package/api/resources/auditEvents/client/Client.d.ts +4 -2
- package/api/resources/auditEvents/client/Client.js +17 -5
- package/api/resources/authTokens/client/Client.d.ts +2 -1
- package/api/resources/authTokens/client/Client.js +8 -2
- package/api/resources/automations/client/Client.d.ts +4 -2
- package/api/resources/automations/client/Client.js +16 -4
- package/api/resources/brands/client/Client.d.ts +10 -5
- package/api/resources/brands/client/Client.js +45 -15
- package/api/resources/bulk/client/Client.d.ts +10 -5
- package/api/resources/bulk/client/Client.js +45 -15
- package/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/api/resources/commons/errors/AlreadyExistsError.js +2 -1
- package/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/api/resources/commons/errors/BadRequestError.js +2 -1
- package/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/api/resources/commons/errors/ConflictError.js +2 -1
- package/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/MessageNotFoundError.js +2 -1
- package/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/NotFoundError.js +2 -1
- package/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/api/resources/commons/errors/PaymentRequiredError.js +2 -1
- package/api/resources/inbound/client/Client.d.ts +2 -1
- package/api/resources/inbound/client/Client.js +10 -4
- package/api/resources/lists/client/Client.d.ts +20 -10
- package/api/resources/lists/client/Client.js +89 -29
- package/api/resources/messages/client/Client.d.ts +12 -6
- package/api/resources/messages/client/Client.js +56 -20
- package/api/resources/notifications/client/Client.d.ts +12 -6
- package/api/resources/notifications/client/Client.js +58 -13
- package/api/resources/profiles/client/Client.d.ts +16 -8
- package/api/resources/profiles/client/Client.js +75 -24
- package/api/resources/templates/client/Client.d.ts +2 -1
- package/api/resources/templates/client/Client.js +9 -3
- package/api/resources/tenants/client/Client.d.ts +14 -7
- package/api/resources/tenants/client/Client.js +61 -19
- package/api/resources/translations/client/Client.d.ts +4 -2
- package/api/resources/translations/client/Client.js +18 -6
- package/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
- package/api/resources/users/resources/preferences/client/Client.js +38 -11
- package/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
- package/api/resources/users/resources/tenants/client/Client.js +45 -12
- package/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
- package/api/resources/users/resources/tokens/client/Client.js +53 -17
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.js +7 -0
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/dist/Client.d.ts +14 -48
- package/dist/Client.js +20 -49
- package/dist/api/client/requests/SendMessageRequest.d.ts +12 -47
- package/dist/api/resources/audiences/client/Client.d.ts +10 -5
- package/dist/api/resources/audiences/client/Client.js +45 -15
- package/dist/api/resources/auditEvents/client/Client.d.ts +4 -2
- package/dist/api/resources/auditEvents/client/Client.js +17 -5
- package/dist/api/resources/authTokens/client/Client.d.ts +2 -1
- package/dist/api/resources/authTokens/client/Client.js +8 -2
- package/dist/api/resources/automations/client/Client.d.ts +4 -2
- package/dist/api/resources/automations/client/Client.js +16 -4
- package/dist/api/resources/brands/client/Client.d.ts +10 -5
- package/dist/api/resources/brands/client/Client.js +45 -15
- package/dist/api/resources/bulk/client/Client.d.ts +10 -5
- package/dist/api/resources/bulk/client/Client.js +45 -15
- package/dist/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/dist/api/resources/commons/errors/AlreadyExistsError.js +2 -1
- package/dist/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/dist/api/resources/commons/errors/BadRequestError.js +2 -1
- package/dist/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/dist/api/resources/commons/errors/ConflictError.js +2 -1
- package/dist/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/MessageNotFoundError.js +2 -1
- package/dist/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/NotFoundError.js +2 -1
- package/dist/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/resources/commons/errors/PaymentRequiredError.js +2 -1
- package/dist/api/resources/inbound/client/Client.d.ts +2 -1
- package/dist/api/resources/inbound/client/Client.js +10 -4
- package/dist/api/resources/lists/client/Client.d.ts +20 -10
- package/dist/api/resources/lists/client/Client.js +89 -29
- package/dist/api/resources/messages/client/Client.d.ts +12 -6
- package/dist/api/resources/messages/client/Client.js +56 -20
- package/dist/api/resources/notifications/client/Client.d.ts +12 -6
- package/dist/api/resources/notifications/client/Client.js +58 -13
- package/dist/api/resources/profiles/client/Client.d.ts +16 -8
- package/dist/api/resources/profiles/client/Client.js +75 -24
- package/dist/api/resources/templates/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/client/Client.js +9 -3
- package/dist/api/resources/tenants/client/Client.d.ts +14 -7
- package/dist/api/resources/tenants/client/Client.js +61 -19
- package/dist/api/resources/translations/client/Client.d.ts +4 -2
- package/dist/api/resources/translations/client/Client.js +18 -6
- package/dist/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
- package/dist/api/resources/users/resources/preferences/client/Client.js +38 -11
- package/dist/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
- package/dist/api/resources/users/resources/tenants/client/Client.js +45 -12
- package/dist/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
- package/dist/api/resources/users/resources/tokens/client/Client.js +53 -17
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.js +7 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/errors/CourierError.d.ts +4 -1
- package/dist/errors/CourierError.js +4 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/CourierError.d.ts +4 -1
- package/errors/CourierError.js +4 -7
- package/package.json +3 -2
- package/reference.md +12 -50
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -67,7 +67,10 @@ class Messages {
|
|
|
67
67
|
* @example
|
|
68
68
|
* await client.messages.list()
|
|
69
69
|
*/
|
|
70
|
-
list() {
|
|
70
|
+
list(request = {}, requestOptions) {
|
|
71
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
72
|
+
}
|
|
73
|
+
__list() {
|
|
71
74
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
72
75
|
var _a, _b, _c;
|
|
73
76
|
const { archived, cursor, event, list, messageId, notification, provider, recipient, status, tag, tags, tenant_id: tenantId, enqueued_after: enqueuedAfter, traceId, } = request;
|
|
@@ -132,7 +135,7 @@ class Messages {
|
|
|
132
135
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
133
136
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, "messages"),
|
|
134
137
|
method: "GET",
|
|
135
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
138
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
136
139
|
contentType: "application/json",
|
|
137
140
|
queryParameters: _queryParams,
|
|
138
141
|
requestType: "json",
|
|
@@ -141,12 +144,13 @@ class Messages {
|
|
|
141
144
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
145
|
});
|
|
143
146
|
if (_response.ok) {
|
|
144
|
-
return _response.body;
|
|
147
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
145
148
|
}
|
|
146
149
|
if (_response.error.reason === "status-code") {
|
|
147
150
|
throw new errors.CourierError({
|
|
148
151
|
statusCode: _response.error.statusCode,
|
|
149
152
|
body: _response.error.body,
|
|
153
|
+
rawResponse: _response.rawResponse,
|
|
150
154
|
});
|
|
151
155
|
}
|
|
152
156
|
switch (_response.error.reason) {
|
|
@@ -154,12 +158,14 @@ class Messages {
|
|
|
154
158
|
throw new errors.CourierError({
|
|
155
159
|
statusCode: _response.error.statusCode,
|
|
156
160
|
body: _response.error.rawBody,
|
|
161
|
+
rawResponse: _response.rawResponse,
|
|
157
162
|
});
|
|
158
163
|
case "timeout":
|
|
159
164
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages.");
|
|
160
165
|
case "unknown":
|
|
161
166
|
throw new errors.CourierError({
|
|
162
167
|
message: _response.error.errorMessage,
|
|
168
|
+
rawResponse: _response.rawResponse,
|
|
163
169
|
});
|
|
164
170
|
}
|
|
165
171
|
});
|
|
@@ -177,12 +183,15 @@ class Messages {
|
|
|
177
183
|
* await client.messages.get("message_id")
|
|
178
184
|
*/
|
|
179
185
|
get(messageId, requestOptions) {
|
|
186
|
+
return core.HttpResponsePromise.fromPromise(this.__get(messageId, requestOptions));
|
|
187
|
+
}
|
|
188
|
+
__get(messageId, requestOptions) {
|
|
180
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
181
190
|
var _a, _b, _c;
|
|
182
191
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
183
192
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}`),
|
|
184
193
|
method: "GET",
|
|
185
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
194
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
186
195
|
contentType: "application/json",
|
|
187
196
|
requestType: "json",
|
|
188
197
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -190,18 +199,19 @@ class Messages {
|
|
|
190
199
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
191
200
|
});
|
|
192
201
|
if (_response.ok) {
|
|
193
|
-
return _response.body;
|
|
202
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
194
203
|
}
|
|
195
204
|
if (_response.error.reason === "status-code") {
|
|
196
205
|
switch (_response.error.statusCode) {
|
|
197
206
|
case 400:
|
|
198
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
207
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
199
208
|
case 404:
|
|
200
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
209
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
201
210
|
default:
|
|
202
211
|
throw new errors.CourierError({
|
|
203
212
|
statusCode: _response.error.statusCode,
|
|
204
213
|
body: _response.error.body,
|
|
214
|
+
rawResponse: _response.rawResponse,
|
|
205
215
|
});
|
|
206
216
|
}
|
|
207
217
|
}
|
|
@@ -210,12 +220,14 @@ class Messages {
|
|
|
210
220
|
throw new errors.CourierError({
|
|
211
221
|
statusCode: _response.error.statusCode,
|
|
212
222
|
body: _response.error.rawBody,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
213
224
|
});
|
|
214
225
|
case "timeout":
|
|
215
226
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}.");
|
|
216
227
|
case "unknown":
|
|
217
228
|
throw new errors.CourierError({
|
|
218
229
|
message: _response.error.errorMessage,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
219
231
|
});
|
|
220
232
|
}
|
|
221
233
|
});
|
|
@@ -230,12 +242,15 @@ class Messages {
|
|
|
230
242
|
* await client.messages.cancel("message_id")
|
|
231
243
|
*/
|
|
232
244
|
cancel(messageId, requestOptions) {
|
|
245
|
+
return core.HttpResponsePromise.fromPromise(this.__cancel(messageId, requestOptions));
|
|
246
|
+
}
|
|
247
|
+
__cancel(messageId, requestOptions) {
|
|
233
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
249
|
var _a, _b, _c;
|
|
235
250
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
236
251
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/cancel`),
|
|
237
252
|
method: "POST",
|
|
238
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
253
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
239
254
|
contentType: "application/json",
|
|
240
255
|
requestType: "json",
|
|
241
256
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -243,12 +258,13 @@ class Messages {
|
|
|
243
258
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
244
259
|
});
|
|
245
260
|
if (_response.ok) {
|
|
246
|
-
return _response.body;
|
|
261
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
247
262
|
}
|
|
248
263
|
if (_response.error.reason === "status-code") {
|
|
249
264
|
throw new errors.CourierError({
|
|
250
265
|
statusCode: _response.error.statusCode,
|
|
251
266
|
body: _response.error.body,
|
|
267
|
+
rawResponse: _response.rawResponse,
|
|
252
268
|
});
|
|
253
269
|
}
|
|
254
270
|
switch (_response.error.reason) {
|
|
@@ -256,12 +272,14 @@ class Messages {
|
|
|
256
272
|
throw new errors.CourierError({
|
|
257
273
|
statusCode: _response.error.statusCode,
|
|
258
274
|
body: _response.error.rawBody,
|
|
275
|
+
rawResponse: _response.rawResponse,
|
|
259
276
|
});
|
|
260
277
|
case "timeout":
|
|
261
278
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /messages/{message_id}/cancel.");
|
|
262
279
|
case "unknown":
|
|
263
280
|
throw new errors.CourierError({
|
|
264
281
|
message: _response.error.errorMessage,
|
|
282
|
+
rawResponse: _response.rawResponse,
|
|
265
283
|
});
|
|
266
284
|
}
|
|
267
285
|
});
|
|
@@ -279,7 +297,10 @@ class Messages {
|
|
|
279
297
|
* @example
|
|
280
298
|
* await client.messages.getHistory("message_id")
|
|
281
299
|
*/
|
|
282
|
-
getHistory(
|
|
300
|
+
getHistory(messageId, request = {}, requestOptions) {
|
|
301
|
+
return core.HttpResponsePromise.fromPromise(this.__getHistory(messageId, request, requestOptions));
|
|
302
|
+
}
|
|
303
|
+
__getHistory(messageId_1) {
|
|
283
304
|
return __awaiter(this, arguments, void 0, function* (messageId, request = {}, requestOptions) {
|
|
284
305
|
var _a, _b, _c;
|
|
285
306
|
const { type: type_ } = request;
|
|
@@ -290,7 +311,7 @@ class Messages {
|
|
|
290
311
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
291
312
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/history`),
|
|
292
313
|
method: "GET",
|
|
293
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
314
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
294
315
|
contentType: "application/json",
|
|
295
316
|
queryParameters: _queryParams,
|
|
296
317
|
requestType: "json",
|
|
@@ -299,18 +320,19 @@ class Messages {
|
|
|
299
320
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
300
321
|
});
|
|
301
322
|
if (_response.ok) {
|
|
302
|
-
return _response.body;
|
|
323
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
303
324
|
}
|
|
304
325
|
if (_response.error.reason === "status-code") {
|
|
305
326
|
switch (_response.error.statusCode) {
|
|
306
327
|
case 400:
|
|
307
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
328
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
308
329
|
case 404:
|
|
309
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
330
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
310
331
|
default:
|
|
311
332
|
throw new errors.CourierError({
|
|
312
333
|
statusCode: _response.error.statusCode,
|
|
313
334
|
body: _response.error.body,
|
|
335
|
+
rawResponse: _response.rawResponse,
|
|
314
336
|
});
|
|
315
337
|
}
|
|
316
338
|
}
|
|
@@ -319,12 +341,14 @@ class Messages {
|
|
|
319
341
|
throw new errors.CourierError({
|
|
320
342
|
statusCode: _response.error.statusCode,
|
|
321
343
|
body: _response.error.rawBody,
|
|
344
|
+
rawResponse: _response.rawResponse,
|
|
322
345
|
});
|
|
323
346
|
case "timeout":
|
|
324
347
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}/history.");
|
|
325
348
|
case "unknown":
|
|
326
349
|
throw new errors.CourierError({
|
|
327
350
|
message: _response.error.errorMessage,
|
|
351
|
+
rawResponse: _response.rawResponse,
|
|
328
352
|
});
|
|
329
353
|
}
|
|
330
354
|
});
|
|
@@ -340,12 +364,15 @@ class Messages {
|
|
|
340
364
|
* await client.messages.getContent("message_id")
|
|
341
365
|
*/
|
|
342
366
|
getContent(messageId, requestOptions) {
|
|
367
|
+
return core.HttpResponsePromise.fromPromise(this.__getContent(messageId, requestOptions));
|
|
368
|
+
}
|
|
369
|
+
__getContent(messageId, requestOptions) {
|
|
343
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
344
371
|
var _a, _b, _c;
|
|
345
372
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
346
373
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/output`),
|
|
347
374
|
method: "GET",
|
|
348
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
375
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
349
376
|
contentType: "application/json",
|
|
350
377
|
requestType: "json",
|
|
351
378
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -353,18 +380,19 @@ class Messages {
|
|
|
353
380
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
354
381
|
});
|
|
355
382
|
if (_response.ok) {
|
|
356
|
-
return _response.body;
|
|
383
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
357
384
|
}
|
|
358
385
|
if (_response.error.reason === "status-code") {
|
|
359
386
|
switch (_response.error.statusCode) {
|
|
360
387
|
case 400:
|
|
361
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
388
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
362
389
|
case 404:
|
|
363
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
390
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
364
391
|
default:
|
|
365
392
|
throw new errors.CourierError({
|
|
366
393
|
statusCode: _response.error.statusCode,
|
|
367
394
|
body: _response.error.body,
|
|
395
|
+
rawResponse: _response.rawResponse,
|
|
368
396
|
});
|
|
369
397
|
}
|
|
370
398
|
}
|
|
@@ -373,12 +401,14 @@ class Messages {
|
|
|
373
401
|
throw new errors.CourierError({
|
|
374
402
|
statusCode: _response.error.statusCode,
|
|
375
403
|
body: _response.error.rawBody,
|
|
404
|
+
rawResponse: _response.rawResponse,
|
|
376
405
|
});
|
|
377
406
|
case "timeout":
|
|
378
407
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}/output.");
|
|
379
408
|
case "unknown":
|
|
380
409
|
throw new errors.CourierError({
|
|
381
410
|
message: _response.error.errorMessage,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
382
412
|
});
|
|
383
413
|
}
|
|
384
414
|
});
|
|
@@ -391,12 +421,15 @@ class Messages {
|
|
|
391
421
|
* await client.messages.archive("request_id")
|
|
392
422
|
*/
|
|
393
423
|
archive(requestId, requestOptions) {
|
|
424
|
+
return core.HttpResponsePromise.fromPromise(this.__archive(requestId, requestOptions));
|
|
425
|
+
}
|
|
426
|
+
__archive(requestId, requestOptions) {
|
|
394
427
|
return __awaiter(this, void 0, void 0, function* () {
|
|
395
428
|
var _a, _b, _c;
|
|
396
429
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
397
430
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `requests/${encodeURIComponent(requestId)}/archive`),
|
|
398
431
|
method: "PUT",
|
|
399
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
432
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
400
433
|
contentType: "application/json",
|
|
401
434
|
requestType: "json",
|
|
402
435
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -404,12 +437,13 @@ class Messages {
|
|
|
404
437
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
405
438
|
});
|
|
406
439
|
if (_response.ok) {
|
|
407
|
-
return;
|
|
440
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
408
441
|
}
|
|
409
442
|
if (_response.error.reason === "status-code") {
|
|
410
443
|
throw new errors.CourierError({
|
|
411
444
|
statusCode: _response.error.statusCode,
|
|
412
445
|
body: _response.error.body,
|
|
446
|
+
rawResponse: _response.rawResponse,
|
|
413
447
|
});
|
|
414
448
|
}
|
|
415
449
|
switch (_response.error.reason) {
|
|
@@ -417,12 +451,14 @@ class Messages {
|
|
|
417
451
|
throw new errors.CourierError({
|
|
418
452
|
statusCode: _response.error.statusCode,
|
|
419
453
|
body: _response.error.rawBody,
|
|
454
|
+
rawResponse: _response.rawResponse,
|
|
420
455
|
});
|
|
421
456
|
case "timeout":
|
|
422
457
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /requests/{request_id}/archive.");
|
|
423
458
|
case "unknown":
|
|
424
459
|
throw new errors.CourierError({
|
|
425
460
|
message: _response.error.errorMessage,
|
|
461
|
+
rawResponse: _response.rawResponse,
|
|
426
462
|
});
|
|
427
463
|
}
|
|
428
464
|
});
|
|
@@ -33,7 +33,8 @@ export declare class Notifications {
|
|
|
33
33
|
* @example
|
|
34
34
|
* await client.notifications.list()
|
|
35
35
|
*/
|
|
36
|
-
list(request?: Courier.NotificationListParams, requestOptions?: Notifications.RequestOptions):
|
|
36
|
+
list(request?: Courier.NotificationListParams, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Courier.NotificationListResponse>;
|
|
37
|
+
private __list;
|
|
37
38
|
/**
|
|
38
39
|
* @param {string} id
|
|
39
40
|
* @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -41,7 +42,8 @@ export declare class Notifications {
|
|
|
41
42
|
* @example
|
|
42
43
|
* await client.notifications.getContent("id")
|
|
43
44
|
*/
|
|
44
|
-
getContent(id: string, requestOptions?: Notifications.RequestOptions):
|
|
45
|
+
getContent(id: string, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Courier.NotificationGetContentResponse>;
|
|
46
|
+
private __getContent;
|
|
45
47
|
/**
|
|
46
48
|
* @param {string} id
|
|
47
49
|
* @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -49,7 +51,8 @@ export declare class Notifications {
|
|
|
49
51
|
* @example
|
|
50
52
|
* await client.notifications.getDraftContent("id")
|
|
51
53
|
*/
|
|
52
|
-
getDraftContent(id: string, requestOptions?: Notifications.RequestOptions):
|
|
54
|
+
getDraftContent(id: string, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Courier.NotificationGetContentResponse>;
|
|
55
|
+
private __getDraftContent;
|
|
53
56
|
/**
|
|
54
57
|
* @param {string} id
|
|
55
58
|
* @param {string} submissionId
|
|
@@ -58,7 +61,8 @@ export declare class Notifications {
|
|
|
58
61
|
* @example
|
|
59
62
|
* await client.notifications.getSubmissionChecks("id", "submissionId")
|
|
60
63
|
*/
|
|
61
|
-
getSubmissionChecks(id: string, submissionId: string, requestOptions?: Notifications.RequestOptions):
|
|
64
|
+
getSubmissionChecks(id: string, submissionId: string, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Courier.SubmissionChecksGetResponse>;
|
|
65
|
+
private __getSubmissionChecks;
|
|
62
66
|
/**
|
|
63
67
|
* @param {string} id
|
|
64
68
|
* @param {string} submissionId
|
|
@@ -78,7 +82,8 @@ export declare class Notifications {
|
|
|
78
82
|
* }]
|
|
79
83
|
* })
|
|
80
84
|
*/
|
|
81
|
-
replaceSubmissionChecks(id: string, submissionId: string, request: Courier.SubmissionChecksReplaceParams, requestOptions?: Notifications.RequestOptions):
|
|
85
|
+
replaceSubmissionChecks(id: string, submissionId: string, request: Courier.SubmissionChecksReplaceParams, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Courier.SubmissionChecksReplaceResponse>;
|
|
86
|
+
private __replaceSubmissionChecks;
|
|
82
87
|
/**
|
|
83
88
|
* @param {string} id
|
|
84
89
|
* @param {string} submissionId
|
|
@@ -87,6 +92,7 @@ export declare class Notifications {
|
|
|
87
92
|
* @example
|
|
88
93
|
* await client.notifications.cancelSubmission("id", "submissionId")
|
|
89
94
|
*/
|
|
90
|
-
cancelSubmission(id: string, submissionId: string, requestOptions?: Notifications.RequestOptions):
|
|
95
|
+
cancelSubmission(id: string, submissionId: string, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<void>;
|
|
96
|
+
private __cancelSubmission;
|
|
91
97
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
92
98
|
}
|