@trycourier/courier 6.0.7 → 6.1.0
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 +1 -0
- package/Client.js +4 -4
- package/api/resources/audiences/client/Client.d.ts +1 -0
- package/api/resources/audiences/client/Client.js +20 -20
- package/api/resources/auditEvents/client/Client.d.ts +1 -0
- package/api/resources/auditEvents/client/Client.js +8 -8
- package/api/resources/authTokens/client/Client.d.ts +1 -0
- package/api/resources/authTokens/client/Client.js +4 -4
- package/api/resources/automations/client/Client.d.ts +1 -0
- package/api/resources/automations/client/Client.js +8 -8
- package/api/resources/brands/client/Client.d.ts +1 -0
- package/api/resources/brands/client/Client.js +20 -20
- package/api/resources/bulk/client/Client.d.ts +1 -0
- package/api/resources/bulk/client/Client.js +20 -20
- package/api/resources/lists/client/Client.d.ts +2 -1
- package/api/resources/lists/client/Client.js +41 -50
- package/api/resources/lists/client/requests/index.d.ts +0 -1
- package/api/resources/lists/types/index.d.ts +0 -5
- package/api/resources/lists/types/index.js +0 -5
- package/api/resources/messages/client/Client.d.ts +1 -0
- package/api/resources/messages/client/Client.js +24 -24
- package/api/resources/notifications/client/Client.d.ts +1 -0
- package/api/resources/notifications/client/Client.js +32 -32
- package/api/resources/profiles/client/Client.d.ts +1 -0
- package/api/resources/profiles/client/Client.js +28 -28
- package/api/resources/templates/client/Client.d.ts +1 -0
- package/api/resources/templates/client/Client.js +4 -4
- package/api/resources/tenants/client/Client.d.ts +3 -2
- package/api/resources/tenants/client/Client.js +40 -22
- package/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
- package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
- package/api/resources/tenants/client/requests/index.d.ts +2 -0
- package/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
- package/api/resources/translations/client/Client.d.ts +1 -0
- package/api/resources/translations/client/Client.js +8 -8
- package/api/resources/users/client/Client.d.ts +1 -0
- package/api/resources/users/resources/preferences/client/Client.d.ts +1 -0
- package/api/resources/users/resources/preferences/client/Client.js +12 -12
- package/api/resources/users/resources/tenants/client/Client.d.ts +5 -0
- package/api/resources/users/resources/tenants/client/Client.js +62 -19
- package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
- package/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
- package/api/resources/users/resources/tokens/client/Client.d.ts +1 -0
- package/api/resources/users/resources/tokens/client/Client.js +20 -20
- package/core/fetcher/Fetcher.js +3 -5
- package/dist/Client.d.ts +1 -0
- package/dist/Client.js +4 -4
- package/dist/api/resources/audiences/client/Client.d.ts +1 -0
- package/dist/api/resources/audiences/client/Client.js +20 -20
- package/dist/api/resources/auditEvents/client/Client.d.ts +1 -0
- package/dist/api/resources/auditEvents/client/Client.js +8 -8
- package/dist/api/resources/authTokens/client/Client.d.ts +1 -0
- package/dist/api/resources/authTokens/client/Client.js +4 -4
- package/dist/api/resources/automations/client/Client.d.ts +1 -0
- package/dist/api/resources/automations/client/Client.js +8 -8
- package/dist/api/resources/brands/client/Client.d.ts +1 -0
- package/dist/api/resources/brands/client/Client.js +20 -20
- package/dist/api/resources/bulk/client/Client.d.ts +1 -0
- package/dist/api/resources/bulk/client/Client.js +20 -20
- package/dist/api/resources/lists/client/Client.d.ts +2 -1
- package/dist/api/resources/lists/client/Client.js +41 -50
- package/dist/api/resources/lists/client/requests/index.d.ts +0 -1
- package/dist/api/resources/lists/types/index.d.ts +0 -5
- package/dist/api/resources/lists/types/index.js +0 -5
- package/dist/api/resources/messages/client/Client.d.ts +1 -0
- package/dist/api/resources/messages/client/Client.js +24 -24
- package/dist/api/resources/notifications/client/Client.d.ts +1 -0
- package/dist/api/resources/notifications/client/Client.js +32 -32
- package/dist/api/resources/profiles/client/Client.d.ts +1 -0
- package/dist/api/resources/profiles/client/Client.js +28 -28
- package/dist/api/resources/templates/client/Client.d.ts +1 -0
- package/dist/api/resources/templates/client/Client.js +4 -4
- package/dist/api/resources/tenants/client/Client.d.ts +3 -2
- package/dist/api/resources/tenants/client/Client.js +40 -22
- package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
- package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
- package/dist/api/resources/tenants/client/requests/index.d.ts +2 -0
- package/dist/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
- package/dist/api/resources/translations/client/Client.d.ts +1 -0
- package/dist/api/resources/translations/client/Client.js +8 -8
- package/dist/api/resources/users/client/Client.d.ts +1 -0
- package/dist/api/resources/users/resources/preferences/client/Client.d.ts +1 -0
- package/dist/api/resources/users/resources/preferences/client/Client.js +12 -12
- package/dist/api/resources/users/resources/tenants/client/Client.d.ts +5 -0
- package/dist/api/resources/users/resources/tenants/client/Client.js +62 -19
- package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
- package/dist/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/client/Client.d.ts +1 -0
- package/dist/api/resources/users/resources/tokens/client/Client.js +20 -20
- package/dist/core/fetcher/Fetcher.js +3 -5
- package/jest.config.js +5 -0
- package/package.json +6 -2
- package/tests/client.test.ts +11 -0
- package/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
- package/api/resources/lists/types/ListFindByRecipientIdParams.d.ts +0 -6
- package/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
- package/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
- package/api/resources/lists/types/ListGetSubscriptionsParams.d.ts +0 -6
- package/api/resources/lists/types/ListGetSubscriptionsParams.js +0 -5
- package/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
- package/api/resources/lists/types/RecipientSubscriptionsResponse.js +0 -5
- package/dist/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
- package/dist/api/resources/lists/client/requests/GetListRequest.js +0 -5
- package/dist/api/resources/lists/types/ListFindByRecipientIdParams.d.ts +0 -6
- package/dist/api/resources/lists/types/ListFindByRecipientIdParams.js +0 -5
- package/dist/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
- package/dist/api/resources/lists/types/ListFindByRecipientIdResponse.js +0 -5
- package/dist/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
- package/dist/api/resources/lists/types/ListGetAllParams.js +0 -5
- package/dist/api/resources/lists/types/ListGetSubscriptionsParams.d.ts +0 -6
- package/dist/api/resources/lists/types/ListGetSubscriptionsParams.js +0 -5
- package/dist/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
- package/dist/api/resources/lists/types/RecipientSubscriptionsResponse.js +0 -5
- /package/api/resources/{lists/client/requests/GetListRequest.js → tenants/client/requests/ListTenantParams.js} +0 -0
- /package/api/resources/{lists/types/ListFindByRecipientIdParams.js → tenants/client/requests/ListUsersForTenantParams.js} +0 -0
- /package/{api/resources/lists/types/ListFindByRecipientIdResponse.js → dist/api/resources/tenants/client/requests/ListTenantParams.js} +0 -0
- /package/{api/resources/lists/types/ListGetAllParams.js → dist/api/resources/tenants/client/requests/ListUsersForTenantParams.js} +0 -0
|
@@ -52,16 +52,16 @@ class Tenants {
|
|
|
52
52
|
* @throws {@link Courier.BadRequestError}
|
|
53
53
|
*/
|
|
54
54
|
createOrReplace(tenantId, request, requestOptions) {
|
|
55
|
-
var _a;
|
|
55
|
+
var _a, _b;
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const _response = yield core.fetcher({
|
|
58
|
-
url: (0, url_join_1.default)((
|
|
57
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
58
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${tenantId}`),
|
|
59
59
|
method: "PUT",
|
|
60
60
|
headers: {
|
|
61
61
|
Authorization: yield this._getAuthorizationHeader(),
|
|
62
62
|
"X-Fern-Language": "JavaScript",
|
|
63
63
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
64
|
-
"X-Fern-SDK-Version": "v6.0
|
|
64
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
65
65
|
},
|
|
66
66
|
contentType: "application/json",
|
|
67
67
|
body: request,
|
|
@@ -101,16 +101,16 @@ class Tenants {
|
|
|
101
101
|
* @throws {@link Courier.BadRequestError}
|
|
102
102
|
*/
|
|
103
103
|
get(tenantId, requestOptions) {
|
|
104
|
-
var _a;
|
|
104
|
+
var _a, _b;
|
|
105
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
const _response = yield core.fetcher({
|
|
107
|
-
url: (0, url_join_1.default)((
|
|
106
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
107
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${tenantId}`),
|
|
108
108
|
method: "GET",
|
|
109
109
|
headers: {
|
|
110
110
|
Authorization: yield this._getAuthorizationHeader(),
|
|
111
111
|
"X-Fern-Language": "JavaScript",
|
|
112
112
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
113
|
-
"X-Fern-SDK-Version": "v6.0
|
|
113
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
114
114
|
},
|
|
115
115
|
contentType: "application/json",
|
|
116
116
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -145,19 +145,28 @@ class Tenants {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
list(requestOptions) {
|
|
149
|
-
var _a;
|
|
148
|
+
list(request = {}, requestOptions) {
|
|
149
|
+
var _a, _b;
|
|
150
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
const
|
|
152
|
-
|
|
151
|
+
const { limit, cursor } = request;
|
|
152
|
+
const _queryParams = {};
|
|
153
|
+
if (limit != null) {
|
|
154
|
+
_queryParams["limit"] = limit.toString();
|
|
155
|
+
}
|
|
156
|
+
if (cursor != null) {
|
|
157
|
+
_queryParams["cursor"] = cursor;
|
|
158
|
+
}
|
|
159
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
160
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, "/tenants"),
|
|
153
161
|
method: "GET",
|
|
154
162
|
headers: {
|
|
155
163
|
Authorization: yield this._getAuthorizationHeader(),
|
|
156
164
|
"X-Fern-Language": "JavaScript",
|
|
157
165
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
158
|
-
"X-Fern-SDK-Version": "v6.0
|
|
166
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
159
167
|
},
|
|
160
168
|
contentType: "application/json",
|
|
169
|
+
queryParameters: _queryParams,
|
|
161
170
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
162
171
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
163
172
|
});
|
|
@@ -186,16 +195,16 @@ class Tenants {
|
|
|
186
195
|
});
|
|
187
196
|
}
|
|
188
197
|
delete(tenantId, requestOptions) {
|
|
189
|
-
var _a;
|
|
198
|
+
var _a, _b;
|
|
190
199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
const _response = yield core.fetcher({
|
|
192
|
-
url: (0, url_join_1.default)((
|
|
200
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
201
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${tenantId}`),
|
|
193
202
|
method: "DELETE",
|
|
194
203
|
headers: {
|
|
195
204
|
Authorization: yield this._getAuthorizationHeader(),
|
|
196
205
|
"X-Fern-Language": "JavaScript",
|
|
197
206
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
198
|
-
"X-Fern-SDK-Version": "v6.0
|
|
207
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
199
208
|
},
|
|
200
209
|
contentType: "application/json",
|
|
201
210
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -228,19 +237,28 @@ class Tenants {
|
|
|
228
237
|
/**
|
|
229
238
|
* @throws {@link Courier.BadRequestError}
|
|
230
239
|
*/
|
|
231
|
-
getUsersByTenant(tenantId, requestOptions) {
|
|
232
|
-
var _a;
|
|
240
|
+
getUsersByTenant(tenantId, request = {}, requestOptions) {
|
|
241
|
+
var _a, _b;
|
|
233
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
const
|
|
235
|
-
|
|
243
|
+
const { limit, cursor } = request;
|
|
244
|
+
const _queryParams = {};
|
|
245
|
+
if (limit != null) {
|
|
246
|
+
_queryParams["limit"] = limit.toString();
|
|
247
|
+
}
|
|
248
|
+
if (cursor != null) {
|
|
249
|
+
_queryParams["cursor"] = cursor;
|
|
250
|
+
}
|
|
251
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
252
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${tenantId}/users`),
|
|
236
253
|
method: "GET",
|
|
237
254
|
headers: {
|
|
238
255
|
Authorization: yield this._getAuthorizationHeader(),
|
|
239
256
|
"X-Fern-Language": "JavaScript",
|
|
240
257
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
241
|
-
"X-Fern-SDK-Version": "v6.0
|
|
258
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
242
259
|
},
|
|
243
260
|
contentType: "application/json",
|
|
261
|
+
queryParameters: _queryParams,
|
|
244
262
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
245
263
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
246
264
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface ListTenantParams {
|
|
5
|
+
/**
|
|
6
|
+
* The number of accousnts to return
|
|
7
|
+
* (defaults to 20, maximum value of 100)
|
|
8
|
+
*/
|
|
9
|
+
limit?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Continue the pagination with the next cursor
|
|
12
|
+
*/
|
|
13
|
+
cursor?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface ListUsersForTenantParams {
|
|
5
|
+
/**
|
|
6
|
+
* The number of accounts to return
|
|
7
|
+
* (defaults to 20, maximum value of 100)
|
|
8
|
+
*/
|
|
9
|
+
limit?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Continue the pagination with the next cursor
|
|
12
|
+
*/
|
|
13
|
+
cursor?: string;
|
|
14
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Courier from "../../..";
|
|
5
5
|
export interface ListUsersForTenantResponse {
|
|
6
|
-
items?: Courier.UserTenantAssociation;
|
|
6
|
+
items?: Courier.UserTenantAssociation[];
|
|
7
7
|
/** Set to true when there are more pages that can be retrieved. */
|
|
8
8
|
has_more: boolean;
|
|
9
9
|
/** A url that may be used to generate these results. */
|
|
@@ -7,6 +7,7 @@ export declare namespace Translations {
|
|
|
7
7
|
interface Options {
|
|
8
8
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
9
9
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
10
|
+
fetcher?: core.FetchFunction;
|
|
10
11
|
}
|
|
11
12
|
interface RequestOptions {
|
|
12
13
|
timeoutInSeconds?: number;
|
|
@@ -53,16 +53,16 @@ class Translations {
|
|
|
53
53
|
* @throws {@link Courier.NotFoundError}
|
|
54
54
|
*/
|
|
55
55
|
get(domain, locale, requestOptions) {
|
|
56
|
-
var _a;
|
|
56
|
+
var _a, _b;
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const _response = yield core.fetcher({
|
|
59
|
-
url: (0, url_join_1.default)((
|
|
58
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
59
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/translations/${domain}/${locale}`),
|
|
60
60
|
method: "GET",
|
|
61
61
|
headers: {
|
|
62
62
|
Authorization: yield this._getAuthorizationHeader(),
|
|
63
63
|
"X-Fern-Language": "JavaScript",
|
|
64
64
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
65
|
-
"X-Fern-SDK-Version": "v6.0
|
|
65
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
66
66
|
},
|
|
67
67
|
contentType: "application/json",
|
|
68
68
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -102,16 +102,16 @@ class Translations {
|
|
|
102
102
|
* @throws {@link Courier.NotFoundError}
|
|
103
103
|
*/
|
|
104
104
|
update(domain, locale, request, requestOptions) {
|
|
105
|
-
var _a;
|
|
105
|
+
var _a, _b;
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const _response = yield core.fetcher({
|
|
108
|
-
url: (0, url_join_1.default)((
|
|
107
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
108
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/translations/${domain}/${locale}`),
|
|
109
109
|
method: "PUT",
|
|
110
110
|
headers: {
|
|
111
111
|
Authorization: yield this._getAuthorizationHeader(),
|
|
112
112
|
"X-Fern-Language": "JavaScript",
|
|
113
113
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
114
|
-
"X-Fern-SDK-Version": "v6.0
|
|
114
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
115
115
|
},
|
|
116
116
|
contentType: "application/json",
|
|
117
117
|
body: request,
|
|
@@ -10,6 +10,7 @@ export declare namespace Users {
|
|
|
10
10
|
interface Options {
|
|
11
11
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
12
12
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
13
|
+
fetcher?: core.FetchFunction;
|
|
13
14
|
}
|
|
14
15
|
interface RequestOptions {
|
|
15
16
|
timeoutInSeconds?: number;
|
|
@@ -8,6 +8,7 @@ export declare namespace Preferences {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
10
10
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
@@ -53,16 +53,16 @@ class Preferences {
|
|
|
53
53
|
* @throws {@link Courier.BadRequestError}
|
|
54
54
|
*/
|
|
55
55
|
list(userId, requestOptions) {
|
|
56
|
-
var _a;
|
|
56
|
+
var _a, _b;
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const _response = yield core.fetcher({
|
|
59
|
-
url: (0, url_join_1.default)((
|
|
58
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
59
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/preferences`),
|
|
60
60
|
method: "GET",
|
|
61
61
|
headers: {
|
|
62
62
|
Authorization: yield this._getAuthorizationHeader(),
|
|
63
63
|
"X-Fern-Language": "JavaScript",
|
|
64
64
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
65
|
-
"X-Fern-SDK-Version": "v6.0
|
|
65
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
66
66
|
},
|
|
67
67
|
contentType: "application/json",
|
|
68
68
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -102,16 +102,16 @@ class Preferences {
|
|
|
102
102
|
* @throws {@link Courier.NotFoundError}
|
|
103
103
|
*/
|
|
104
104
|
get(userId, topicId, requestOptions) {
|
|
105
|
-
var _a;
|
|
105
|
+
var _a, _b;
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const _response = yield core.fetcher({
|
|
108
|
-
url: (0, url_join_1.default)((
|
|
107
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
108
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/preferences/${topicId}`),
|
|
109
109
|
method: "GET",
|
|
110
110
|
headers: {
|
|
111
111
|
Authorization: yield this._getAuthorizationHeader(),
|
|
112
112
|
"X-Fern-Language": "JavaScript",
|
|
113
113
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
114
|
-
"X-Fern-SDK-Version": "v6.0
|
|
114
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
115
115
|
},
|
|
116
116
|
contentType: "application/json",
|
|
117
117
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -151,16 +151,16 @@ class Preferences {
|
|
|
151
151
|
* @throws {@link Courier.BadRequestError}
|
|
152
152
|
*/
|
|
153
153
|
update(userId, topicId, request, requestOptions) {
|
|
154
|
-
var _a;
|
|
154
|
+
var _a, _b;
|
|
155
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
const _response = yield core.fetcher({
|
|
157
|
-
url: (0, url_join_1.default)((
|
|
156
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
157
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/preferences/${topicId}`),
|
|
158
158
|
method: "PUT",
|
|
159
159
|
headers: {
|
|
160
160
|
Authorization: yield this._getAuthorizationHeader(),
|
|
161
161
|
"X-Fern-Language": "JavaScript",
|
|
162
162
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
163
|
-
"X-Fern-SDK-Version": "v6.0
|
|
163
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
164
164
|
},
|
|
165
165
|
contentType: "application/json",
|
|
166
166
|
body: request,
|
|
@@ -8,6 +8,7 @@ export declare namespace Tenants {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
10
10
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
@@ -33,6 +34,10 @@ export declare class Tenants {
|
|
|
33
34
|
* when sending to the user with that tenant.
|
|
34
35
|
*/
|
|
35
36
|
add(userId: string, tenantId: string, request: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Removes a user from any tenants they may have been associated with.
|
|
39
|
+
*/
|
|
40
|
+
removeAll(userId: string, requestOptions?: Tenants.RequestOptions): Promise<void>;
|
|
36
41
|
/**
|
|
37
42
|
* Removes a user from the supplied tenant.
|
|
38
43
|
*/
|
|
@@ -55,16 +55,16 @@ class Tenants {
|
|
|
55
55
|
* profile when sending to the user with that tenant.
|
|
56
56
|
*/
|
|
57
57
|
addMultple(userId, request, requestOptions) {
|
|
58
|
-
var _a;
|
|
58
|
+
var _a, _b;
|
|
59
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const _response = yield core.fetcher({
|
|
61
|
-
url: (0, url_join_1.default)((
|
|
60
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
61
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants`),
|
|
62
62
|
method: "PUT",
|
|
63
63
|
headers: {
|
|
64
64
|
Authorization: yield this._getAuthorizationHeader(),
|
|
65
65
|
"X-Fern-Language": "JavaScript",
|
|
66
66
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
67
|
-
"X-Fern-SDK-Version": "v6.0
|
|
67
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
68
68
|
},
|
|
69
69
|
contentType: "application/json",
|
|
70
70
|
body: request,
|
|
@@ -103,16 +103,16 @@ class Tenants {
|
|
|
103
103
|
* when sending to the user with that tenant.
|
|
104
104
|
*/
|
|
105
105
|
add(userId, tenantId, request, requestOptions) {
|
|
106
|
-
var _a;
|
|
106
|
+
var _a, _b;
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const _response = yield core.fetcher({
|
|
109
|
-
url: (0, url_join_1.default)((
|
|
108
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
109
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants/${tenantId}`),
|
|
110
110
|
method: "PUT",
|
|
111
111
|
headers: {
|
|
112
112
|
Authorization: yield this._getAuthorizationHeader(),
|
|
113
113
|
"X-Fern-Language": "JavaScript",
|
|
114
114
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
115
|
-
"X-Fern-SDK-Version": "v6.0
|
|
115
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
116
116
|
},
|
|
117
117
|
contentType: "application/json",
|
|
118
118
|
body: request,
|
|
@@ -143,20 +143,63 @@ class Tenants {
|
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Removes a user from any tenants they may have been associated with.
|
|
148
|
+
*/
|
|
149
|
+
removeAll(userId, requestOptions) {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
153
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants`),
|
|
154
|
+
method: "DELETE",
|
|
155
|
+
headers: {
|
|
156
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
157
|
+
"X-Fern-Language": "JavaScript",
|
|
158
|
+
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
159
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
160
|
+
},
|
|
161
|
+
contentType: "application/json",
|
|
162
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
163
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
164
|
+
});
|
|
165
|
+
if (_response.ok) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (_response.error.reason === "status-code") {
|
|
169
|
+
throw new errors.CourierError({
|
|
170
|
+
statusCode: _response.error.statusCode,
|
|
171
|
+
body: _response.error.body,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
switch (_response.error.reason) {
|
|
175
|
+
case "non-json":
|
|
176
|
+
throw new errors.CourierError({
|
|
177
|
+
statusCode: _response.error.statusCode,
|
|
178
|
+
body: _response.error.rawBody,
|
|
179
|
+
});
|
|
180
|
+
case "timeout":
|
|
181
|
+
throw new errors.CourierTimeoutError();
|
|
182
|
+
case "unknown":
|
|
183
|
+
throw new errors.CourierError({
|
|
184
|
+
message: _response.error.errorMessage,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
146
189
|
/**
|
|
147
190
|
* Removes a user from the supplied tenant.
|
|
148
191
|
*/
|
|
149
192
|
remove(userId, tenantId, requestOptions) {
|
|
150
|
-
var _a;
|
|
193
|
+
var _a, _b;
|
|
151
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
const _response = yield core.fetcher({
|
|
153
|
-
url: (0, url_join_1.default)((
|
|
195
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
196
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants/${tenantId}`),
|
|
154
197
|
method: "DELETE",
|
|
155
198
|
headers: {
|
|
156
199
|
Authorization: yield this._getAuthorizationHeader(),
|
|
157
200
|
"X-Fern-Language": "JavaScript",
|
|
158
201
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
159
|
-
"X-Fern-SDK-Version": "v6.0
|
|
202
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
160
203
|
},
|
|
161
204
|
contentType: "application/json",
|
|
162
205
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -190,24 +233,24 @@ class Tenants {
|
|
|
190
233
|
* Returns a paginated list of user tenant associations.
|
|
191
234
|
*/
|
|
192
235
|
list(userId, request = {}, requestOptions) {
|
|
193
|
-
var _a;
|
|
236
|
+
var _a, _b;
|
|
194
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const { limit,
|
|
238
|
+
const { limit, cursor } = request;
|
|
196
239
|
const _queryParams = {};
|
|
197
240
|
if (limit != null) {
|
|
198
241
|
_queryParams["limit"] = limit.toString();
|
|
199
242
|
}
|
|
200
|
-
if (
|
|
201
|
-
_queryParams["
|
|
243
|
+
if (cursor != null) {
|
|
244
|
+
_queryParams["cursor"] = cursor;
|
|
202
245
|
}
|
|
203
|
-
const _response = yield core.fetcher({
|
|
204
|
-
url: (0, url_join_1.default)((
|
|
246
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
247
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants`),
|
|
205
248
|
method: "GET",
|
|
206
249
|
headers: {
|
|
207
250
|
Authorization: yield this._getAuthorizationHeader(),
|
|
208
251
|
"X-Fern-Language": "JavaScript",
|
|
209
252
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
210
|
-
"X-Fern-SDK-Version": "v6.0
|
|
253
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
211
254
|
},
|
|
212
255
|
contentType: "application/json",
|
|
213
256
|
queryParameters: _queryParams,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Courier from "../../../../..";
|
|
5
5
|
export interface ListTenantsForUserResponse {
|
|
6
|
-
items?: Courier.UserTenantAssociation;
|
|
6
|
+
items?: Courier.UserTenantAssociation[];
|
|
7
7
|
/** Set to true when there are more pages that can be retrieved. */
|
|
8
8
|
has_more: boolean;
|
|
9
9
|
/** A url that may be used to generate these results. */
|
|
@@ -8,6 +8,7 @@ export declare namespace Tokens {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
10
10
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
@@ -53,16 +53,16 @@ class Tokens {
|
|
|
53
53
|
* @throws {@link Courier.BadRequestError}
|
|
54
54
|
*/
|
|
55
55
|
addMultiple(userId, requestOptions) {
|
|
56
|
-
var _a;
|
|
56
|
+
var _a, _b;
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const _response = yield core.fetcher({
|
|
59
|
-
url: (0, url_join_1.default)((
|
|
58
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
59
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/tokens`),
|
|
60
60
|
method: "PUT",
|
|
61
61
|
headers: {
|
|
62
62
|
Authorization: yield this._getAuthorizationHeader(),
|
|
63
63
|
"X-Fern-Language": "JavaScript",
|
|
64
64
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
65
|
-
"X-Fern-SDK-Version": "v6.0
|
|
65
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
66
66
|
},
|
|
67
67
|
contentType: "application/json",
|
|
68
68
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -102,16 +102,16 @@ class Tokens {
|
|
|
102
102
|
* @throws {@link Courier.BadRequestError}
|
|
103
103
|
*/
|
|
104
104
|
add(userId, token, request, requestOptions) {
|
|
105
|
-
var _a;
|
|
105
|
+
var _a, _b;
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const _response = yield core.fetcher({
|
|
108
|
-
url: (0, url_join_1.default)((
|
|
107
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
108
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}`),
|
|
109
109
|
method: "PUT",
|
|
110
110
|
headers: {
|
|
111
111
|
Authorization: yield this._getAuthorizationHeader(),
|
|
112
112
|
"X-Fern-Language": "JavaScript",
|
|
113
113
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
114
|
-
"X-Fern-SDK-Version": "v6.0
|
|
114
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
115
115
|
},
|
|
116
116
|
contentType: "application/json",
|
|
117
117
|
body: request,
|
|
@@ -152,16 +152,16 @@ class Tokens {
|
|
|
152
152
|
* @throws {@link Courier.BadRequestError}
|
|
153
153
|
*/
|
|
154
154
|
update(userId, token, request, requestOptions) {
|
|
155
|
-
var _a;
|
|
155
|
+
var _a, _b;
|
|
156
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
const _response = yield core.fetcher({
|
|
158
|
-
url: (0, url_join_1.default)((
|
|
157
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
158
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}`),
|
|
159
159
|
method: "PATCH",
|
|
160
160
|
headers: {
|
|
161
161
|
Authorization: yield this._getAuthorizationHeader(),
|
|
162
162
|
"X-Fern-Language": "JavaScript",
|
|
163
163
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
164
|
-
"X-Fern-SDK-Version": "v6.0
|
|
164
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
165
165
|
},
|
|
166
166
|
contentType: "application/json",
|
|
167
167
|
body: request,
|
|
@@ -202,16 +202,16 @@ class Tokens {
|
|
|
202
202
|
* @throws {@link Courier.BadRequestError}
|
|
203
203
|
*/
|
|
204
204
|
get(userId, token, requestOptions) {
|
|
205
|
-
var _a;
|
|
205
|
+
var _a, _b;
|
|
206
206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
const _response = yield core.fetcher({
|
|
208
|
-
url: (0, url_join_1.default)((
|
|
207
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
208
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}`),
|
|
209
209
|
method: "GET",
|
|
210
210
|
headers: {
|
|
211
211
|
Authorization: yield this._getAuthorizationHeader(),
|
|
212
212
|
"X-Fern-Language": "JavaScript",
|
|
213
213
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
214
|
-
"X-Fern-SDK-Version": "v6.0
|
|
214
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
215
215
|
},
|
|
216
216
|
contentType: "application/json",
|
|
217
217
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -251,16 +251,16 @@ class Tokens {
|
|
|
251
251
|
* @throws {@link Courier.BadRequestError}
|
|
252
252
|
*/
|
|
253
253
|
list(userId, requestOptions) {
|
|
254
|
-
var _a;
|
|
254
|
+
var _a, _b;
|
|
255
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
-
const _response = yield core.fetcher({
|
|
257
|
-
url: (0, url_join_1.default)((
|
|
256
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
257
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/users/${userId}/tokens`),
|
|
258
258
|
method: "GET",
|
|
259
259
|
headers: {
|
|
260
260
|
Authorization: yield this._getAuthorizationHeader(),
|
|
261
261
|
"X-Fern-Language": "JavaScript",
|
|
262
262
|
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
263
|
-
"X-Fern-SDK-Version": "v6.0
|
|
263
|
+
"X-Fern-SDK-Version": "v6.1.0",
|
|
264
264
|
},
|
|
265
265
|
contentType: "application/json",
|
|
266
266
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|