@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
|
@@ -76,12 +76,15 @@ class Tenants {
|
|
|
76
76
|
* })
|
|
77
77
|
*/
|
|
78
78
|
createOrReplace(tenantId, request, requestOptions) {
|
|
79
|
+
return core.HttpResponsePromise.fromPromise(this.__createOrReplace(tenantId, request, requestOptions));
|
|
80
|
+
}
|
|
81
|
+
__createOrReplace(tenantId, request, requestOptions) {
|
|
79
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
83
|
var _a, _b, _c;
|
|
81
84
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
85
|
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
83
86
|
method: "PUT",
|
|
84
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
87
|
+
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),
|
|
85
88
|
contentType: "application/json",
|
|
86
89
|
requestType: "json",
|
|
87
90
|
body: request,
|
|
@@ -90,16 +93,17 @@ class Tenants {
|
|
|
90
93
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
94
|
});
|
|
92
95
|
if (_response.ok) {
|
|
93
|
-
return _response.body;
|
|
96
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
94
97
|
}
|
|
95
98
|
if (_response.error.reason === "status-code") {
|
|
96
99
|
switch (_response.error.statusCode) {
|
|
97
100
|
case 400:
|
|
98
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
101
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
99
102
|
default:
|
|
100
103
|
throw new errors.CourierError({
|
|
101
104
|
statusCode: _response.error.statusCode,
|
|
102
105
|
body: _response.error.body,
|
|
106
|
+
rawResponse: _response.rawResponse,
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
109
|
}
|
|
@@ -108,12 +112,14 @@ class Tenants {
|
|
|
108
112
|
throw new errors.CourierError({
|
|
109
113
|
statusCode: _response.error.statusCode,
|
|
110
114
|
body: _response.error.rawBody,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
111
116
|
});
|
|
112
117
|
case "timeout":
|
|
113
118
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}.");
|
|
114
119
|
case "unknown":
|
|
115
120
|
throw new errors.CourierError({
|
|
116
121
|
message: _response.error.errorMessage,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
125
|
});
|
|
@@ -128,12 +134,15 @@ class Tenants {
|
|
|
128
134
|
* await client.tenants.get("tenant_id")
|
|
129
135
|
*/
|
|
130
136
|
get(tenantId, requestOptions) {
|
|
137
|
+
return core.HttpResponsePromise.fromPromise(this.__get(tenantId, requestOptions));
|
|
138
|
+
}
|
|
139
|
+
__get(tenantId, requestOptions) {
|
|
131
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
141
|
var _a, _b, _c;
|
|
133
142
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
134
143
|
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
135
144
|
method: "GET",
|
|
136
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
145
|
+
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),
|
|
137
146
|
contentType: "application/json",
|
|
138
147
|
requestType: "json",
|
|
139
148
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -141,16 +150,17 @@ class Tenants {
|
|
|
141
150
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
151
|
});
|
|
143
152
|
if (_response.ok) {
|
|
144
|
-
return _response.body;
|
|
153
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
145
154
|
}
|
|
146
155
|
if (_response.error.reason === "status-code") {
|
|
147
156
|
switch (_response.error.statusCode) {
|
|
148
157
|
case 400:
|
|
149
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
158
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
150
159
|
default:
|
|
151
160
|
throw new errors.CourierError({
|
|
152
161
|
statusCode: _response.error.statusCode,
|
|
153
162
|
body: _response.error.body,
|
|
163
|
+
rawResponse: _response.rawResponse,
|
|
154
164
|
});
|
|
155
165
|
}
|
|
156
166
|
}
|
|
@@ -159,12 +169,14 @@ class Tenants {
|
|
|
159
169
|
throw new errors.CourierError({
|
|
160
170
|
statusCode: _response.error.statusCode,
|
|
161
171
|
body: _response.error.rawBody,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
162
173
|
});
|
|
163
174
|
case "timeout":
|
|
164
175
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}.");
|
|
165
176
|
case "unknown":
|
|
166
177
|
throw new errors.CourierError({
|
|
167
178
|
message: _response.error.errorMessage,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
168
180
|
});
|
|
169
181
|
}
|
|
170
182
|
});
|
|
@@ -176,7 +188,10 @@ class Tenants {
|
|
|
176
188
|
* @example
|
|
177
189
|
* await client.tenants.list()
|
|
178
190
|
*/
|
|
179
|
-
list() {
|
|
191
|
+
list(request = {}, requestOptions) {
|
|
192
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
193
|
+
}
|
|
194
|
+
__list() {
|
|
180
195
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
181
196
|
var _a, _b, _c;
|
|
182
197
|
const { parent_tenant_id: parentTenantId, limit, cursor } = request;
|
|
@@ -193,7 +208,7 @@ class Tenants {
|
|
|
193
208
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
194
209
|
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, "/tenants"),
|
|
195
210
|
method: "GET",
|
|
196
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
211
|
+
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),
|
|
197
212
|
contentType: "application/json",
|
|
198
213
|
queryParameters: _queryParams,
|
|
199
214
|
requestType: "json",
|
|
@@ -202,12 +217,13 @@ class Tenants {
|
|
|
202
217
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
203
218
|
});
|
|
204
219
|
if (_response.ok) {
|
|
205
|
-
return _response.body;
|
|
220
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
206
221
|
}
|
|
207
222
|
if (_response.error.reason === "status-code") {
|
|
208
223
|
throw new errors.CourierError({
|
|
209
224
|
statusCode: _response.error.statusCode,
|
|
210
225
|
body: _response.error.body,
|
|
226
|
+
rawResponse: _response.rawResponse,
|
|
211
227
|
});
|
|
212
228
|
}
|
|
213
229
|
switch (_response.error.reason) {
|
|
@@ -215,12 +231,14 @@ class Tenants {
|
|
|
215
231
|
throw new errors.CourierError({
|
|
216
232
|
statusCode: _response.error.statusCode,
|
|
217
233
|
body: _response.error.rawBody,
|
|
234
|
+
rawResponse: _response.rawResponse,
|
|
218
235
|
});
|
|
219
236
|
case "timeout":
|
|
220
237
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants.");
|
|
221
238
|
case "unknown":
|
|
222
239
|
throw new errors.CourierError({
|
|
223
240
|
message: _response.error.errorMessage,
|
|
241
|
+
rawResponse: _response.rawResponse,
|
|
224
242
|
});
|
|
225
243
|
}
|
|
226
244
|
});
|
|
@@ -233,12 +251,15 @@ class Tenants {
|
|
|
233
251
|
* await client.tenants.delete("tenant_id")
|
|
234
252
|
*/
|
|
235
253
|
delete(tenantId, requestOptions) {
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(tenantId, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
__delete(tenantId, requestOptions) {
|
|
236
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
258
|
var _a, _b, _c;
|
|
238
259
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
239
260
|
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
240
261
|
method: "DELETE",
|
|
241
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
262
|
+
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),
|
|
242
263
|
contentType: "application/json",
|
|
243
264
|
requestType: "json",
|
|
244
265
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -246,12 +267,13 @@ class Tenants {
|
|
|
246
267
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
247
268
|
});
|
|
248
269
|
if (_response.ok) {
|
|
249
|
-
return;
|
|
270
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
250
271
|
}
|
|
251
272
|
if (_response.error.reason === "status-code") {
|
|
252
273
|
throw new errors.CourierError({
|
|
253
274
|
statusCode: _response.error.statusCode,
|
|
254
275
|
body: _response.error.body,
|
|
276
|
+
rawResponse: _response.rawResponse,
|
|
255
277
|
});
|
|
256
278
|
}
|
|
257
279
|
switch (_response.error.reason) {
|
|
@@ -259,12 +281,14 @@ class Tenants {
|
|
|
259
281
|
throw new errors.CourierError({
|
|
260
282
|
statusCode: _response.error.statusCode,
|
|
261
283
|
body: _response.error.rawBody,
|
|
284
|
+
rawResponse: _response.rawResponse,
|
|
262
285
|
});
|
|
263
286
|
case "timeout":
|
|
264
287
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}.");
|
|
265
288
|
case "unknown":
|
|
266
289
|
throw new errors.CourierError({
|
|
267
290
|
message: _response.error.errorMessage,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
268
292
|
});
|
|
269
293
|
}
|
|
270
294
|
});
|
|
@@ -279,7 +303,10 @@ class Tenants {
|
|
|
279
303
|
* @example
|
|
280
304
|
* await client.tenants.getUsersByTenant("tenant_id")
|
|
281
305
|
*/
|
|
282
|
-
getUsersByTenant(
|
|
306
|
+
getUsersByTenant(tenantId, request = {}, requestOptions) {
|
|
307
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsersByTenant(tenantId, request, requestOptions));
|
|
308
|
+
}
|
|
309
|
+
__getUsersByTenant(tenantId_1) {
|
|
283
310
|
return __awaiter(this, arguments, void 0, function* (tenantId, request = {}, requestOptions) {
|
|
284
311
|
var _a, _b, _c;
|
|
285
312
|
const { limit, cursor } = request;
|
|
@@ -293,7 +320,7 @@ class Tenants {
|
|
|
293
320
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
294
321
|
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, `/tenants/${encodeURIComponent(tenantId)}/users`),
|
|
295
322
|
method: "GET",
|
|
296
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
323
|
+
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),
|
|
297
324
|
contentType: "application/json",
|
|
298
325
|
queryParameters: _queryParams,
|
|
299
326
|
requestType: "json",
|
|
@@ -302,16 +329,17 @@ class Tenants {
|
|
|
302
329
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
303
330
|
});
|
|
304
331
|
if (_response.ok) {
|
|
305
|
-
return _response.body;
|
|
332
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
306
333
|
}
|
|
307
334
|
if (_response.error.reason === "status-code") {
|
|
308
335
|
switch (_response.error.statusCode) {
|
|
309
336
|
case 400:
|
|
310
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
337
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
311
338
|
default:
|
|
312
339
|
throw new errors.CourierError({
|
|
313
340
|
statusCode: _response.error.statusCode,
|
|
314
341
|
body: _response.error.body,
|
|
342
|
+
rawResponse: _response.rawResponse,
|
|
315
343
|
});
|
|
316
344
|
}
|
|
317
345
|
}
|
|
@@ -320,12 +348,14 @@ class Tenants {
|
|
|
320
348
|
throw new errors.CourierError({
|
|
321
349
|
statusCode: _response.error.statusCode,
|
|
322
350
|
body: _response.error.rawBody,
|
|
351
|
+
rawResponse: _response.rawResponse,
|
|
323
352
|
});
|
|
324
353
|
case "timeout":
|
|
325
354
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}/users.");
|
|
326
355
|
case "unknown":
|
|
327
356
|
throw new errors.CourierError({
|
|
328
357
|
message: _response.error.errorMessage,
|
|
358
|
+
rawResponse: _response.rawResponse,
|
|
329
359
|
});
|
|
330
360
|
}
|
|
331
361
|
});
|
|
@@ -344,12 +374,15 @@ class Tenants {
|
|
|
344
374
|
* })
|
|
345
375
|
*/
|
|
346
376
|
createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions) {
|
|
377
|
+
return core.HttpResponsePromise.fromPromise(this.__createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions));
|
|
378
|
+
}
|
|
379
|
+
__createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions) {
|
|
347
380
|
return __awaiter(this, void 0, void 0, function* () {
|
|
348
381
|
var _a, _b, _c;
|
|
349
382
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
350
383
|
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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
|
|
351
384
|
method: "PUT",
|
|
352
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
385
|
+
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),
|
|
353
386
|
contentType: "application/json",
|
|
354
387
|
requestType: "json",
|
|
355
388
|
body: request,
|
|
@@ -358,12 +391,13 @@ class Tenants {
|
|
|
358
391
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
359
392
|
});
|
|
360
393
|
if (_response.ok) {
|
|
361
|
-
return;
|
|
394
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
362
395
|
}
|
|
363
396
|
if (_response.error.reason === "status-code") {
|
|
364
397
|
throw new errors.CourierError({
|
|
365
398
|
statusCode: _response.error.statusCode,
|
|
366
399
|
body: _response.error.body,
|
|
400
|
+
rawResponse: _response.rawResponse,
|
|
367
401
|
});
|
|
368
402
|
}
|
|
369
403
|
switch (_response.error.reason) {
|
|
@@ -371,12 +405,14 @@ class Tenants {
|
|
|
371
405
|
throw new errors.CourierError({
|
|
372
406
|
statusCode: _response.error.statusCode,
|
|
373
407
|
body: _response.error.rawBody,
|
|
408
|
+
rawResponse: _response.rawResponse,
|
|
374
409
|
});
|
|
375
410
|
case "timeout":
|
|
376
411
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
|
|
377
412
|
case "unknown":
|
|
378
413
|
throw new errors.CourierError({
|
|
379
414
|
message: _response.error.errorMessage,
|
|
415
|
+
rawResponse: _response.rawResponse,
|
|
380
416
|
});
|
|
381
417
|
}
|
|
382
418
|
});
|
|
@@ -390,12 +426,15 @@ class Tenants {
|
|
|
390
426
|
* await client.tenants.removeDefaultPreferencesForTopic("tenant_id", "topic_id")
|
|
391
427
|
*/
|
|
392
428
|
removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions) {
|
|
429
|
+
return core.HttpResponsePromise.fromPromise(this.__removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions));
|
|
430
|
+
}
|
|
431
|
+
__removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions) {
|
|
393
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
394
433
|
var _a, _b, _c;
|
|
395
434
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
396
435
|
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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
|
|
397
436
|
method: "DELETE",
|
|
398
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
437
|
+
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),
|
|
399
438
|
contentType: "application/json",
|
|
400
439
|
requestType: "json",
|
|
401
440
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -403,12 +442,13 @@ class Tenants {
|
|
|
403
442
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
404
443
|
});
|
|
405
444
|
if (_response.ok) {
|
|
406
|
-
return;
|
|
445
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
407
446
|
}
|
|
408
447
|
if (_response.error.reason === "status-code") {
|
|
409
448
|
throw new errors.CourierError({
|
|
410
449
|
statusCode: _response.error.statusCode,
|
|
411
450
|
body: _response.error.body,
|
|
451
|
+
rawResponse: _response.rawResponse,
|
|
412
452
|
});
|
|
413
453
|
}
|
|
414
454
|
switch (_response.error.reason) {
|
|
@@ -416,12 +456,14 @@ class Tenants {
|
|
|
416
456
|
throw new errors.CourierError({
|
|
417
457
|
statusCode: _response.error.statusCode,
|
|
418
458
|
body: _response.error.rawBody,
|
|
459
|
+
rawResponse: _response.rawResponse,
|
|
419
460
|
});
|
|
420
461
|
case "timeout":
|
|
421
462
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
|
|
422
463
|
case "unknown":
|
|
423
464
|
throw new errors.CourierError({
|
|
424
465
|
message: _response.error.errorMessage,
|
|
466
|
+
rawResponse: _response.rawResponse,
|
|
425
467
|
});
|
|
426
468
|
}
|
|
427
469
|
});
|
|
@@ -37,7 +37,8 @@ export declare class Translations {
|
|
|
37
37
|
* @example
|
|
38
38
|
* await client.translations.get("domain", "locale")
|
|
39
39
|
*/
|
|
40
|
-
get(domain: string, locale: string, requestOptions?: Translations.RequestOptions):
|
|
40
|
+
get(domain: string, locale: string, requestOptions?: Translations.RequestOptions): core.HttpResponsePromise<string>;
|
|
41
|
+
private __get;
|
|
41
42
|
/**
|
|
42
43
|
* Update a translation
|
|
43
44
|
*
|
|
@@ -51,6 +52,7 @@ export declare class Translations {
|
|
|
51
52
|
* @example
|
|
52
53
|
* await client.translations.update("domain", "locale", "string")
|
|
53
54
|
*/
|
|
54
|
-
update(domain: string, locale: string, request: string, requestOptions?: Translations.RequestOptions):
|
|
55
|
+
update(domain: string, locale: string, request: string, requestOptions?: Translations.RequestOptions): core.HttpResponsePromise<void>;
|
|
56
|
+
private __update;
|
|
55
57
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
56
58
|
}
|
|
@@ -71,12 +71,15 @@ class Translations {
|
|
|
71
71
|
* await client.translations.get("domain", "locale")
|
|
72
72
|
*/
|
|
73
73
|
get(domain, locale, requestOptions) {
|
|
74
|
+
return core.HttpResponsePromise.fromPromise(this.__get(domain, locale, requestOptions));
|
|
75
|
+
}
|
|
76
|
+
__get(domain, locale, requestOptions) {
|
|
74
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
78
|
var _a, _b, _c;
|
|
76
79
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
77
80
|
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, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
|
|
78
81
|
method: "GET",
|
|
79
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
82
|
+
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),
|
|
80
83
|
contentType: "application/json",
|
|
81
84
|
requestType: "json",
|
|
82
85
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -84,16 +87,17 @@ class Translations {
|
|
|
84
87
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
85
88
|
});
|
|
86
89
|
if (_response.ok) {
|
|
87
|
-
return _response.body;
|
|
90
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
88
91
|
}
|
|
89
92
|
if (_response.error.reason === "status-code") {
|
|
90
93
|
switch (_response.error.statusCode) {
|
|
91
94
|
case 404:
|
|
92
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
95
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
93
96
|
default:
|
|
94
97
|
throw new errors.CourierError({
|
|
95
98
|
statusCode: _response.error.statusCode,
|
|
96
99
|
body: _response.error.body,
|
|
100
|
+
rawResponse: _response.rawResponse,
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
103
|
}
|
|
@@ -102,12 +106,14 @@ class Translations {
|
|
|
102
106
|
throw new errors.CourierError({
|
|
103
107
|
statusCode: _response.error.statusCode,
|
|
104
108
|
body: _response.error.rawBody,
|
|
109
|
+
rawResponse: _response.rawResponse,
|
|
105
110
|
});
|
|
106
111
|
case "timeout":
|
|
107
112
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /translations/{domain}/{locale}.");
|
|
108
113
|
case "unknown":
|
|
109
114
|
throw new errors.CourierError({
|
|
110
115
|
message: _response.error.errorMessage,
|
|
116
|
+
rawResponse: _response.rawResponse,
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
119
|
});
|
|
@@ -126,12 +132,15 @@ class Translations {
|
|
|
126
132
|
* await client.translations.update("domain", "locale", "string")
|
|
127
133
|
*/
|
|
128
134
|
update(domain, locale, request, requestOptions) {
|
|
135
|
+
return core.HttpResponsePromise.fromPromise(this.__update(domain, locale, request, requestOptions));
|
|
136
|
+
}
|
|
137
|
+
__update(domain, locale, request, requestOptions) {
|
|
129
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
139
|
var _a, _b, _c;
|
|
131
140
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
132
141
|
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, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
|
|
133
142
|
method: "PUT",
|
|
134
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
143
|
+
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),
|
|
135
144
|
contentType: "application/json",
|
|
136
145
|
requestType: "json",
|
|
137
146
|
body: request,
|
|
@@ -140,16 +149,17 @@ class Translations {
|
|
|
140
149
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
141
150
|
});
|
|
142
151
|
if (_response.ok) {
|
|
143
|
-
return;
|
|
152
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
144
153
|
}
|
|
145
154
|
if (_response.error.reason === "status-code") {
|
|
146
155
|
switch (_response.error.statusCode) {
|
|
147
156
|
case 404:
|
|
148
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
157
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
149
158
|
default:
|
|
150
159
|
throw new errors.CourierError({
|
|
151
160
|
statusCode: _response.error.statusCode,
|
|
152
161
|
body: _response.error.body,
|
|
162
|
+
rawResponse: _response.rawResponse,
|
|
153
163
|
});
|
|
154
164
|
}
|
|
155
165
|
}
|
|
@@ -158,12 +168,14 @@ class Translations {
|
|
|
158
168
|
throw new errors.CourierError({
|
|
159
169
|
statusCode: _response.error.statusCode,
|
|
160
170
|
body: _response.error.rawBody,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
161
172
|
});
|
|
162
173
|
case "timeout":
|
|
163
174
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /translations/{domain}/{locale}.");
|
|
164
175
|
case "unknown":
|
|
165
176
|
throw new errors.CourierError({
|
|
166
177
|
message: _response.error.errorMessage,
|
|
178
|
+
rawResponse: _response.rawResponse,
|
|
167
179
|
});
|
|
168
180
|
}
|
|
169
181
|
});
|
|
@@ -38,7 +38,8 @@ export declare class Preferences {
|
|
|
38
38
|
* @example
|
|
39
39
|
* await client.users.preferences.list("user_id")
|
|
40
40
|
*/
|
|
41
|
-
list(userId: string, request?: Courier.users.UserPreferencesParams, requestOptions?: Preferences.RequestOptions):
|
|
41
|
+
list(userId: string, request?: Courier.users.UserPreferencesParams, requestOptions?: Preferences.RequestOptions): core.HttpResponsePromise<Courier.users.UserPreferencesListResponse>;
|
|
42
|
+
private __list;
|
|
42
43
|
/**
|
|
43
44
|
* Fetch user preferences for a specific subscription topic.
|
|
44
45
|
*
|
|
@@ -52,7 +53,8 @@ export declare class Preferences {
|
|
|
52
53
|
* @example
|
|
53
54
|
* await client.users.preferences.get("user_id", "topic_id")
|
|
54
55
|
*/
|
|
55
|
-
get(userId: string, topicId: string, request?: Courier.users.UserPreferencesTopicParams, requestOptions?: Preferences.RequestOptions):
|
|
56
|
+
get(userId: string, topicId: string, request?: Courier.users.UserPreferencesTopicParams, requestOptions?: Preferences.RequestOptions): core.HttpResponsePromise<Courier.users.UserPreferencesGetResponse>;
|
|
57
|
+
private __get;
|
|
56
58
|
/**
|
|
57
59
|
* Update or Create user preferences for a specific subscription topic.
|
|
58
60
|
*
|
|
@@ -72,6 +74,7 @@ export declare class Preferences {
|
|
|
72
74
|
* }
|
|
73
75
|
* })
|
|
74
76
|
*/
|
|
75
|
-
update(userId: string, topicId: string, request: Courier.users.UserPreferencesUpdateParams, requestOptions?: Preferences.RequestOptions):
|
|
77
|
+
update(userId: string, topicId: string, request: Courier.users.UserPreferencesUpdateParams, requestOptions?: Preferences.RequestOptions): core.HttpResponsePromise<Courier.users.UserPreferencesUpdateResponse>;
|
|
78
|
+
private __update;
|
|
76
79
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
77
80
|
}
|