@trycourier/courier 6.4.0 → 6.4.1
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
|
@@ -81,7 +81,10 @@ class Preferences {
|
|
|
81
81
|
* @example
|
|
82
82
|
* await client.users.preferences.list("user_id")
|
|
83
83
|
*/
|
|
84
|
-
list(
|
|
84
|
+
list(userId, request = {}, requestOptions) {
|
|
85
|
+
return core.HttpResponsePromise.fromPromise(this.__list(userId, request, requestOptions));
|
|
86
|
+
}
|
|
87
|
+
__list(userId_1) {
|
|
85
88
|
return __awaiter(this, arguments, void 0, function* (userId, request = {}, requestOptions) {
|
|
86
89
|
var _a, _b, _c;
|
|
87
90
|
const { tenant_id: tenantId } = request;
|
|
@@ -92,7 +95,7 @@ class Preferences {
|
|
|
92
95
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
93
96
|
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, `/users/${encodeURIComponent(userId)}/preferences`),
|
|
94
97
|
method: "GET",
|
|
95
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
98
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
96
99
|
contentType: "application/json",
|
|
97
100
|
queryParameters: _queryParams,
|
|
98
101
|
requestType: "json",
|
|
@@ -101,16 +104,20 @@ class Preferences {
|
|
|
101
104
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
105
|
});
|
|
103
106
|
if (_response.ok) {
|
|
104
|
-
return
|
|
107
|
+
return {
|
|
108
|
+
data: _response.body,
|
|
109
|
+
rawResponse: _response.rawResponse,
|
|
110
|
+
};
|
|
105
111
|
}
|
|
106
112
|
if (_response.error.reason === "status-code") {
|
|
107
113
|
switch (_response.error.statusCode) {
|
|
108
114
|
case 400:
|
|
109
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
115
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
110
116
|
default:
|
|
111
117
|
throw new errors.CourierError({
|
|
112
118
|
statusCode: _response.error.statusCode,
|
|
113
119
|
body: _response.error.body,
|
|
120
|
+
rawResponse: _response.rawResponse,
|
|
114
121
|
});
|
|
115
122
|
}
|
|
116
123
|
}
|
|
@@ -119,12 +126,14 @@ class Preferences {
|
|
|
119
126
|
throw new errors.CourierError({
|
|
120
127
|
statusCode: _response.error.statusCode,
|
|
121
128
|
body: _response.error.rawBody,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
122
130
|
});
|
|
123
131
|
case "timeout":
|
|
124
132
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/preferences.");
|
|
125
133
|
case "unknown":
|
|
126
134
|
throw new errors.CourierError({
|
|
127
135
|
message: _response.error.errorMessage,
|
|
136
|
+
rawResponse: _response.rawResponse,
|
|
128
137
|
});
|
|
129
138
|
}
|
|
130
139
|
});
|
|
@@ -142,7 +151,10 @@ class Preferences {
|
|
|
142
151
|
* @example
|
|
143
152
|
* await client.users.preferences.get("user_id", "topic_id")
|
|
144
153
|
*/
|
|
145
|
-
get(
|
|
154
|
+
get(userId, topicId, request = {}, requestOptions) {
|
|
155
|
+
return core.HttpResponsePromise.fromPromise(this.__get(userId, topicId, request, requestOptions));
|
|
156
|
+
}
|
|
157
|
+
__get(userId_1, topicId_1) {
|
|
146
158
|
return __awaiter(this, arguments, void 0, function* (userId, topicId, request = {}, requestOptions) {
|
|
147
159
|
var _a, _b, _c;
|
|
148
160
|
const { tenant_id: tenantId } = request;
|
|
@@ -153,7 +165,7 @@ class Preferences {
|
|
|
153
165
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
154
166
|
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, `/users/${encodeURIComponent(userId)}/preferences/${encodeURIComponent(topicId)}`),
|
|
155
167
|
method: "GET",
|
|
156
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
168
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
157
169
|
contentType: "application/json",
|
|
158
170
|
queryParameters: _queryParams,
|
|
159
171
|
requestType: "json",
|
|
@@ -162,16 +174,20 @@ class Preferences {
|
|
|
162
174
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
163
175
|
});
|
|
164
176
|
if (_response.ok) {
|
|
165
|
-
return
|
|
177
|
+
return {
|
|
178
|
+
data: _response.body,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
180
|
+
};
|
|
166
181
|
}
|
|
167
182
|
if (_response.error.reason === "status-code") {
|
|
168
183
|
switch (_response.error.statusCode) {
|
|
169
184
|
case 404:
|
|
170
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
185
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
171
186
|
default:
|
|
172
187
|
throw new errors.CourierError({
|
|
173
188
|
statusCode: _response.error.statusCode,
|
|
174
189
|
body: _response.error.body,
|
|
190
|
+
rawResponse: _response.rawResponse,
|
|
175
191
|
});
|
|
176
192
|
}
|
|
177
193
|
}
|
|
@@ -180,12 +196,14 @@ class Preferences {
|
|
|
180
196
|
throw new errors.CourierError({
|
|
181
197
|
statusCode: _response.error.statusCode,
|
|
182
198
|
body: _response.error.rawBody,
|
|
199
|
+
rawResponse: _response.rawResponse,
|
|
183
200
|
});
|
|
184
201
|
case "timeout":
|
|
185
202
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/preferences/{topic_id}.");
|
|
186
203
|
case "unknown":
|
|
187
204
|
throw new errors.CourierError({
|
|
188
205
|
message: _response.error.errorMessage,
|
|
206
|
+
rawResponse: _response.rawResponse,
|
|
189
207
|
});
|
|
190
208
|
}
|
|
191
209
|
});
|
|
@@ -210,6 +228,9 @@ class Preferences {
|
|
|
210
228
|
* })
|
|
211
229
|
*/
|
|
212
230
|
update(userId, topicId, request, requestOptions) {
|
|
231
|
+
return core.HttpResponsePromise.fromPromise(this.__update(userId, topicId, request, requestOptions));
|
|
232
|
+
}
|
|
233
|
+
__update(userId, topicId, request, requestOptions) {
|
|
213
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
214
235
|
var _a, _b, _c;
|
|
215
236
|
const { tenant_id: tenantId } = request, _body = __rest(request, ["tenant_id"]);
|
|
@@ -220,7 +241,7 @@ class Preferences {
|
|
|
220
241
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
221
242
|
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, `/users/${encodeURIComponent(userId)}/preferences/${encodeURIComponent(topicId)}`),
|
|
222
243
|
method: "PUT",
|
|
223
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
244
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
224
245
|
contentType: "application/json",
|
|
225
246
|
queryParameters: _queryParams,
|
|
226
247
|
requestType: "json",
|
|
@@ -230,16 +251,20 @@ class Preferences {
|
|
|
230
251
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
231
252
|
});
|
|
232
253
|
if (_response.ok) {
|
|
233
|
-
return
|
|
254
|
+
return {
|
|
255
|
+
data: _response.body,
|
|
256
|
+
rawResponse: _response.rawResponse,
|
|
257
|
+
};
|
|
234
258
|
}
|
|
235
259
|
if (_response.error.reason === "status-code") {
|
|
236
260
|
switch (_response.error.statusCode) {
|
|
237
261
|
case 400:
|
|
238
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
262
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
239
263
|
default:
|
|
240
264
|
throw new errors.CourierError({
|
|
241
265
|
statusCode: _response.error.statusCode,
|
|
242
266
|
body: _response.error.body,
|
|
267
|
+
rawResponse: _response.rawResponse,
|
|
243
268
|
});
|
|
244
269
|
}
|
|
245
270
|
}
|
|
@@ -248,12 +273,14 @@ class Preferences {
|
|
|
248
273
|
throw new errors.CourierError({
|
|
249
274
|
statusCode: _response.error.statusCode,
|
|
250
275
|
body: _response.error.rawBody,
|
|
276
|
+
rawResponse: _response.rawResponse,
|
|
251
277
|
});
|
|
252
278
|
case "timeout":
|
|
253
279
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/preferences/{topic_id}.");
|
|
254
280
|
case "unknown":
|
|
255
281
|
throw new errors.CourierError({
|
|
256
282
|
message: _response.error.errorMessage,
|
|
283
|
+
rawResponse: _response.rawResponse,
|
|
257
284
|
});
|
|
258
285
|
}
|
|
259
286
|
});
|
|
@@ -52,7 +52,8 @@ export declare class Tenants {
|
|
|
52
52
|
* }]
|
|
53
53
|
* })
|
|
54
54
|
*/
|
|
55
|
-
addMultple(userId: string, request: Courier.users.AddUserToMultipleTenantsParams, requestOptions?: Tenants.RequestOptions):
|
|
55
|
+
addMultple(userId: string, request: Courier.users.AddUserToMultipleTenantsParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
56
|
+
private __addMultple;
|
|
56
57
|
/**
|
|
57
58
|
* This endpoint is used to add a single tenant.
|
|
58
59
|
*
|
|
@@ -70,7 +71,8 @@ export declare class Tenants {
|
|
|
70
71
|
* profile: undefined
|
|
71
72
|
* })
|
|
72
73
|
*/
|
|
73
|
-
add(userId: string, tenantId: string, request?: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions):
|
|
74
|
+
add(userId: string, tenantId: string, request?: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
75
|
+
private __add;
|
|
74
76
|
/**
|
|
75
77
|
* Removes a user from any tenants they may have been associated with.
|
|
76
78
|
*
|
|
@@ -80,7 +82,8 @@ export declare class Tenants {
|
|
|
80
82
|
* @example
|
|
81
83
|
* await client.users.tenants.removeAll("user_id")
|
|
82
84
|
*/
|
|
83
|
-
removeAll(userId: string, requestOptions?: Tenants.RequestOptions):
|
|
85
|
+
removeAll(userId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
86
|
+
private __removeAll;
|
|
84
87
|
/**
|
|
85
88
|
* Removes a user from the supplied tenant.
|
|
86
89
|
*
|
|
@@ -91,7 +94,8 @@ export declare class Tenants {
|
|
|
91
94
|
* @example
|
|
92
95
|
* await client.users.tenants.remove("user_id", "tenant_id")
|
|
93
96
|
*/
|
|
94
|
-
remove(userId: string, tenantId: string, requestOptions?: Tenants.RequestOptions):
|
|
97
|
+
remove(userId: string, tenantId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
98
|
+
private __remove;
|
|
95
99
|
/**
|
|
96
100
|
* Returns a paginated list of user tenant associations.
|
|
97
101
|
*
|
|
@@ -102,6 +106,7 @@ export declare class Tenants {
|
|
|
102
106
|
* @example
|
|
103
107
|
* await client.users.tenants.list("user_id")
|
|
104
108
|
*/
|
|
105
|
-
list(userId: string, request?: Courier.users.ListTenantsForUserParams, requestOptions?: Tenants.RequestOptions):
|
|
109
|
+
list(userId: string, request?: Courier.users.ListTenantsForUserParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.users.ListTenantsForUserResponse>;
|
|
110
|
+
private __list;
|
|
106
111
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
107
112
|
}
|
|
@@ -84,12 +84,15 @@ class Tenants {
|
|
|
84
84
|
* })
|
|
85
85
|
*/
|
|
86
86
|
addMultple(userId, request, requestOptions) {
|
|
87
|
+
return core.HttpResponsePromise.fromPromise(this.__addMultple(userId, request, requestOptions));
|
|
88
|
+
}
|
|
89
|
+
__addMultple(userId, request, requestOptions) {
|
|
87
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
91
|
var _a, _b, _c;
|
|
89
92
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
90
93
|
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, `users/${encodeURIComponent(userId)}/tenants`),
|
|
91
94
|
method: "PUT",
|
|
92
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
95
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
93
96
|
contentType: "application/json",
|
|
94
97
|
requestType: "json",
|
|
95
98
|
body: request,
|
|
@@ -98,12 +101,13 @@ class Tenants {
|
|
|
98
101
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
99
102
|
});
|
|
100
103
|
if (_response.ok) {
|
|
101
|
-
return;
|
|
104
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
102
105
|
}
|
|
103
106
|
if (_response.error.reason === "status-code") {
|
|
104
107
|
throw new errors.CourierError({
|
|
105
108
|
statusCode: _response.error.statusCode,
|
|
106
109
|
body: _response.error.body,
|
|
110
|
+
rawResponse: _response.rawResponse,
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
113
|
switch (_response.error.reason) {
|
|
@@ -111,12 +115,14 @@ class Tenants {
|
|
|
111
115
|
throw new errors.CourierError({
|
|
112
116
|
statusCode: _response.error.statusCode,
|
|
113
117
|
body: _response.error.rawBody,
|
|
118
|
+
rawResponse: _response.rawResponse,
|
|
114
119
|
});
|
|
115
120
|
case "timeout":
|
|
116
121
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tenants.");
|
|
117
122
|
case "unknown":
|
|
118
123
|
throw new errors.CourierError({
|
|
119
124
|
message: _response.error.errorMessage,
|
|
125
|
+
rawResponse: _response.rawResponse,
|
|
120
126
|
});
|
|
121
127
|
}
|
|
122
128
|
});
|
|
@@ -138,13 +144,16 @@ class Tenants {
|
|
|
138
144
|
* profile: undefined
|
|
139
145
|
* })
|
|
140
146
|
*/
|
|
141
|
-
add(
|
|
147
|
+
add(userId, tenantId, request = {}, requestOptions) {
|
|
148
|
+
return core.HttpResponsePromise.fromPromise(this.__add(userId, tenantId, request, requestOptions));
|
|
149
|
+
}
|
|
150
|
+
__add(userId_1, tenantId_1) {
|
|
142
151
|
return __awaiter(this, arguments, void 0, function* (userId, tenantId, request = {}, requestOptions) {
|
|
143
152
|
var _a, _b, _c;
|
|
144
153
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
145
154
|
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, `users/${encodeURIComponent(userId)}/tenants/${encodeURIComponent(tenantId)}`),
|
|
146
155
|
method: "PUT",
|
|
147
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
156
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
148
157
|
contentType: "application/json",
|
|
149
158
|
requestType: "json",
|
|
150
159
|
body: request,
|
|
@@ -153,12 +162,13 @@ class Tenants {
|
|
|
153
162
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
154
163
|
});
|
|
155
164
|
if (_response.ok) {
|
|
156
|
-
return;
|
|
165
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
157
166
|
}
|
|
158
167
|
if (_response.error.reason === "status-code") {
|
|
159
168
|
throw new errors.CourierError({
|
|
160
169
|
statusCode: _response.error.statusCode,
|
|
161
170
|
body: _response.error.body,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
162
172
|
});
|
|
163
173
|
}
|
|
164
174
|
switch (_response.error.reason) {
|
|
@@ -166,12 +176,14 @@ class Tenants {
|
|
|
166
176
|
throw new errors.CourierError({
|
|
167
177
|
statusCode: _response.error.statusCode,
|
|
168
178
|
body: _response.error.rawBody,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
169
180
|
});
|
|
170
181
|
case "timeout":
|
|
171
182
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tenants/{tenant_id}.");
|
|
172
183
|
case "unknown":
|
|
173
184
|
throw new errors.CourierError({
|
|
174
185
|
message: _response.error.errorMessage,
|
|
186
|
+
rawResponse: _response.rawResponse,
|
|
175
187
|
});
|
|
176
188
|
}
|
|
177
189
|
});
|
|
@@ -186,12 +198,15 @@ class Tenants {
|
|
|
186
198
|
* await client.users.tenants.removeAll("user_id")
|
|
187
199
|
*/
|
|
188
200
|
removeAll(userId, requestOptions) {
|
|
201
|
+
return core.HttpResponsePromise.fromPromise(this.__removeAll(userId, requestOptions));
|
|
202
|
+
}
|
|
203
|
+
__removeAll(userId, requestOptions) {
|
|
189
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
190
205
|
var _a, _b, _c;
|
|
191
206
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
192
207
|
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, `users/${encodeURIComponent(userId)}/tenants`),
|
|
193
208
|
method: "DELETE",
|
|
194
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
209
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
195
210
|
contentType: "application/json",
|
|
196
211
|
requestType: "json",
|
|
197
212
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -199,12 +214,13 @@ class Tenants {
|
|
|
199
214
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
200
215
|
});
|
|
201
216
|
if (_response.ok) {
|
|
202
|
-
return;
|
|
217
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
203
218
|
}
|
|
204
219
|
if (_response.error.reason === "status-code") {
|
|
205
220
|
throw new errors.CourierError({
|
|
206
221
|
statusCode: _response.error.statusCode,
|
|
207
222
|
body: _response.error.body,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
208
224
|
});
|
|
209
225
|
}
|
|
210
226
|
switch (_response.error.reason) {
|
|
@@ -212,12 +228,14 @@ class Tenants {
|
|
|
212
228
|
throw new errors.CourierError({
|
|
213
229
|
statusCode: _response.error.statusCode,
|
|
214
230
|
body: _response.error.rawBody,
|
|
231
|
+
rawResponse: _response.rawResponse,
|
|
215
232
|
});
|
|
216
233
|
case "timeout":
|
|
217
234
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /users/{user_id}/tenants.");
|
|
218
235
|
case "unknown":
|
|
219
236
|
throw new errors.CourierError({
|
|
220
237
|
message: _response.error.errorMessage,
|
|
238
|
+
rawResponse: _response.rawResponse,
|
|
221
239
|
});
|
|
222
240
|
}
|
|
223
241
|
});
|
|
@@ -233,12 +251,15 @@ class Tenants {
|
|
|
233
251
|
* await client.users.tenants.remove("user_id", "tenant_id")
|
|
234
252
|
*/
|
|
235
253
|
remove(userId, tenantId, requestOptions) {
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__remove(userId, tenantId, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
__remove(userId, 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, `users/${encodeURIComponent(userId)}/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.1", "User-Agent": "@trycourier/courier/6.4.1", "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 /users/{user_id}/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.users.tenants.list("user_id")
|
|
281
305
|
*/
|
|
282
|
-
list(
|
|
306
|
+
list(userId, request = {}, requestOptions) {
|
|
307
|
+
return core.HttpResponsePromise.fromPromise(this.__list(userId, request, requestOptions));
|
|
308
|
+
}
|
|
309
|
+
__list(userId_1) {
|
|
283
310
|
return __awaiter(this, arguments, void 0, function* (userId, 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, `users/${encodeURIComponent(userId)}/tenants`),
|
|
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.1", "User-Agent": "@trycourier/courier/6.4.1", "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,12 +329,16 @@ class Tenants {
|
|
|
302
329
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
303
330
|
});
|
|
304
331
|
if (_response.ok) {
|
|
305
|
-
return
|
|
332
|
+
return {
|
|
333
|
+
data: _response.body,
|
|
334
|
+
rawResponse: _response.rawResponse,
|
|
335
|
+
};
|
|
306
336
|
}
|
|
307
337
|
if (_response.error.reason === "status-code") {
|
|
308
338
|
throw new errors.CourierError({
|
|
309
339
|
statusCode: _response.error.statusCode,
|
|
310
340
|
body: _response.error.body,
|
|
341
|
+
rawResponse: _response.rawResponse,
|
|
311
342
|
});
|
|
312
343
|
}
|
|
313
344
|
switch (_response.error.reason) {
|
|
@@ -315,12 +346,14 @@ class Tenants {
|
|
|
315
346
|
throw new errors.CourierError({
|
|
316
347
|
statusCode: _response.error.statusCode,
|
|
317
348
|
body: _response.error.rawBody,
|
|
349
|
+
rawResponse: _response.rawResponse,
|
|
318
350
|
});
|
|
319
351
|
case "timeout":
|
|
320
352
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/tenants.");
|
|
321
353
|
case "unknown":
|
|
322
354
|
throw new errors.CourierError({
|
|
323
355
|
message: _response.error.errorMessage,
|
|
356
|
+
rawResponse: _response.rawResponse,
|
|
324
357
|
});
|
|
325
358
|
}
|
|
326
359
|
});
|
|
@@ -37,7 +37,8 @@ export declare class Tokens {
|
|
|
37
37
|
* @example
|
|
38
38
|
* await client.users.tokens.addMultiple("user_id")
|
|
39
39
|
*/
|
|
40
|
-
addMultiple(userId: string, requestOptions?: Tokens.RequestOptions):
|
|
40
|
+
addMultiple(userId: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
41
|
+
private __addMultiple;
|
|
41
42
|
/**
|
|
42
43
|
* Adds a single token to a user and overwrites a matching existing token.
|
|
43
44
|
*
|
|
@@ -58,7 +59,8 @@ export declare class Tokens {
|
|
|
58
59
|
* tracking: undefined
|
|
59
60
|
* })
|
|
60
61
|
*/
|
|
61
|
-
add(userId: string, token: string, request: Courier.users.UserToken, requestOptions?: Tokens.RequestOptions):
|
|
62
|
+
add(userId: string, token: string, request: Courier.users.UserToken, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
63
|
+
private __add;
|
|
62
64
|
/**
|
|
63
65
|
* Apply a JSON Patch (RFC 6902) to the specified token.
|
|
64
66
|
*
|
|
@@ -82,7 +84,8 @@ export declare class Tokens {
|
|
|
82
84
|
* }]
|
|
83
85
|
* })
|
|
84
86
|
*/
|
|
85
|
-
update(userId: string, token: string, request: Courier.users.PatchUserTokenOpts, requestOptions?: Tokens.RequestOptions):
|
|
87
|
+
update(userId: string, token: string, request: Courier.users.PatchUserTokenOpts, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
88
|
+
private __update;
|
|
86
89
|
/**
|
|
87
90
|
* Get single token available for a `:token`
|
|
88
91
|
*
|
|
@@ -95,7 +98,8 @@ export declare class Tokens {
|
|
|
95
98
|
* @example
|
|
96
99
|
* await client.users.tokens.get("user_id", "token")
|
|
97
100
|
*/
|
|
98
|
-
get(userId: string, token: string, requestOptions?: Tokens.RequestOptions):
|
|
101
|
+
get(userId: string, token: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<Courier.users.GetUserTokenResponse>;
|
|
102
|
+
private __get;
|
|
99
103
|
/**
|
|
100
104
|
* Gets all tokens available for a :user_id
|
|
101
105
|
*
|
|
@@ -107,7 +111,8 @@ export declare class Tokens {
|
|
|
107
111
|
* @example
|
|
108
112
|
* await client.users.tokens.list("user_id")
|
|
109
113
|
*/
|
|
110
|
-
list(userId: string, requestOptions?: Tokens.RequestOptions):
|
|
114
|
+
list(userId: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<Courier.users.GetAllTokensResponse>;
|
|
115
|
+
private __list;
|
|
111
116
|
/**
|
|
112
117
|
* @param {string} userId - The user's ID. This can be any uniquely identifiable string.
|
|
113
118
|
* @param {string} token - The full token string.
|
|
@@ -116,6 +121,7 @@ export declare class Tokens {
|
|
|
116
121
|
* @example
|
|
117
122
|
* await client.users.tokens.delete("user_id", "token")
|
|
118
123
|
*/
|
|
119
|
-
delete(userId: string, token: string, requestOptions?: Tokens.RequestOptions):
|
|
124
|
+
delete(userId: string, token: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
125
|
+
private __delete;
|
|
120
126
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
121
127
|
}
|