@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
|
@@ -64,7 +64,10 @@ class Notifications {
|
|
|
64
64
|
* @example
|
|
65
65
|
* await client.notifications.list()
|
|
66
66
|
*/
|
|
67
|
-
list() {
|
|
67
|
+
list(request = {}, requestOptions) {
|
|
68
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
69
|
+
}
|
|
70
|
+
__list() {
|
|
68
71
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
69
72
|
var _a, _b, _c;
|
|
70
73
|
const { cursor, notes } = request;
|
|
@@ -78,7 +81,7 @@ class Notifications {
|
|
|
78
81
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
79
82
|
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, "/notifications"),
|
|
80
83
|
method: "GET",
|
|
81
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
84
|
+
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),
|
|
82
85
|
contentType: "application/json",
|
|
83
86
|
queryParameters: _queryParams,
|
|
84
87
|
requestType: "json",
|
|
@@ -87,12 +90,13 @@ class Notifications {
|
|
|
87
90
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
88
91
|
});
|
|
89
92
|
if (_response.ok) {
|
|
90
|
-
return _response.body;
|
|
93
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
91
94
|
}
|
|
92
95
|
if (_response.error.reason === "status-code") {
|
|
93
96
|
throw new errors.CourierError({
|
|
94
97
|
statusCode: _response.error.statusCode,
|
|
95
98
|
body: _response.error.body,
|
|
99
|
+
rawResponse: _response.rawResponse,
|
|
96
100
|
});
|
|
97
101
|
}
|
|
98
102
|
switch (_response.error.reason) {
|
|
@@ -100,12 +104,14 @@ class Notifications {
|
|
|
100
104
|
throw new errors.CourierError({
|
|
101
105
|
statusCode: _response.error.statusCode,
|
|
102
106
|
body: _response.error.rawBody,
|
|
107
|
+
rawResponse: _response.rawResponse,
|
|
103
108
|
});
|
|
104
109
|
case "timeout":
|
|
105
110
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /notifications.");
|
|
106
111
|
case "unknown":
|
|
107
112
|
throw new errors.CourierError({
|
|
108
113
|
message: _response.error.errorMessage,
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
109
115
|
});
|
|
110
116
|
}
|
|
111
117
|
});
|
|
@@ -118,12 +124,15 @@ class Notifications {
|
|
|
118
124
|
* await client.notifications.getContent("id")
|
|
119
125
|
*/
|
|
120
126
|
getContent(id, requestOptions) {
|
|
127
|
+
return core.HttpResponsePromise.fromPromise(this.__getContent(id, requestOptions));
|
|
128
|
+
}
|
|
129
|
+
__getContent(id, requestOptions) {
|
|
121
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
131
|
var _a, _b, _c;
|
|
123
132
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
124
133
|
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, `/notifications/${encodeURIComponent(id)}/content`),
|
|
125
134
|
method: "GET",
|
|
126
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
135
|
+
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),
|
|
127
136
|
contentType: "application/json",
|
|
128
137
|
requestType: "json",
|
|
129
138
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -131,12 +140,16 @@ class Notifications {
|
|
|
131
140
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
132
141
|
});
|
|
133
142
|
if (_response.ok) {
|
|
134
|
-
return
|
|
143
|
+
return {
|
|
144
|
+
data: _response.body,
|
|
145
|
+
rawResponse: _response.rawResponse,
|
|
146
|
+
};
|
|
135
147
|
}
|
|
136
148
|
if (_response.error.reason === "status-code") {
|
|
137
149
|
throw new errors.CourierError({
|
|
138
150
|
statusCode: _response.error.statusCode,
|
|
139
151
|
body: _response.error.body,
|
|
152
|
+
rawResponse: _response.rawResponse,
|
|
140
153
|
});
|
|
141
154
|
}
|
|
142
155
|
switch (_response.error.reason) {
|
|
@@ -144,12 +157,14 @@ class Notifications {
|
|
|
144
157
|
throw new errors.CourierError({
|
|
145
158
|
statusCode: _response.error.statusCode,
|
|
146
159
|
body: _response.error.rawBody,
|
|
160
|
+
rawResponse: _response.rawResponse,
|
|
147
161
|
});
|
|
148
162
|
case "timeout":
|
|
149
163
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /notifications/{id}/content.");
|
|
150
164
|
case "unknown":
|
|
151
165
|
throw new errors.CourierError({
|
|
152
166
|
message: _response.error.errorMessage,
|
|
167
|
+
rawResponse: _response.rawResponse,
|
|
153
168
|
});
|
|
154
169
|
}
|
|
155
170
|
});
|
|
@@ -162,12 +177,15 @@ class Notifications {
|
|
|
162
177
|
* await client.notifications.getDraftContent("id")
|
|
163
178
|
*/
|
|
164
179
|
getDraftContent(id, requestOptions) {
|
|
180
|
+
return core.HttpResponsePromise.fromPromise(this.__getDraftContent(id, requestOptions));
|
|
181
|
+
}
|
|
182
|
+
__getDraftContent(id, requestOptions) {
|
|
165
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
184
|
var _a, _b, _c;
|
|
167
185
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
168
186
|
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, `/notifications/${encodeURIComponent(id)}/draft/content`),
|
|
169
187
|
method: "GET",
|
|
170
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
188
|
+
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),
|
|
171
189
|
contentType: "application/json",
|
|
172
190
|
requestType: "json",
|
|
173
191
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -175,12 +193,16 @@ class Notifications {
|
|
|
175
193
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
176
194
|
});
|
|
177
195
|
if (_response.ok) {
|
|
178
|
-
return
|
|
196
|
+
return {
|
|
197
|
+
data: _response.body,
|
|
198
|
+
rawResponse: _response.rawResponse,
|
|
199
|
+
};
|
|
179
200
|
}
|
|
180
201
|
if (_response.error.reason === "status-code") {
|
|
181
202
|
throw new errors.CourierError({
|
|
182
203
|
statusCode: _response.error.statusCode,
|
|
183
204
|
body: _response.error.body,
|
|
205
|
+
rawResponse: _response.rawResponse,
|
|
184
206
|
});
|
|
185
207
|
}
|
|
186
208
|
switch (_response.error.reason) {
|
|
@@ -188,12 +210,14 @@ class Notifications {
|
|
|
188
210
|
throw new errors.CourierError({
|
|
189
211
|
statusCode: _response.error.statusCode,
|
|
190
212
|
body: _response.error.rawBody,
|
|
213
|
+
rawResponse: _response.rawResponse,
|
|
191
214
|
});
|
|
192
215
|
case "timeout":
|
|
193
216
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /notifications/{id}/draft/content.");
|
|
194
217
|
case "unknown":
|
|
195
218
|
throw new errors.CourierError({
|
|
196
219
|
message: _response.error.errorMessage,
|
|
220
|
+
rawResponse: _response.rawResponse,
|
|
197
221
|
});
|
|
198
222
|
}
|
|
199
223
|
});
|
|
@@ -207,12 +231,15 @@ class Notifications {
|
|
|
207
231
|
* await client.notifications.getSubmissionChecks("id", "submissionId")
|
|
208
232
|
*/
|
|
209
233
|
getSubmissionChecks(id, submissionId, requestOptions) {
|
|
234
|
+
return core.HttpResponsePromise.fromPromise(this.__getSubmissionChecks(id, submissionId, requestOptions));
|
|
235
|
+
}
|
|
236
|
+
__getSubmissionChecks(id, submissionId, requestOptions) {
|
|
210
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
211
238
|
var _a, _b, _c;
|
|
212
239
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
213
240
|
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, `/notifications/${encodeURIComponent(id)}/${encodeURIComponent(submissionId)}/checks`),
|
|
214
241
|
method: "GET",
|
|
215
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
242
|
+
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),
|
|
216
243
|
contentType: "application/json",
|
|
217
244
|
requestType: "json",
|
|
218
245
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -220,12 +247,13 @@ class Notifications {
|
|
|
220
247
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
221
248
|
});
|
|
222
249
|
if (_response.ok) {
|
|
223
|
-
return _response.body;
|
|
250
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
224
251
|
}
|
|
225
252
|
if (_response.error.reason === "status-code") {
|
|
226
253
|
throw new errors.CourierError({
|
|
227
254
|
statusCode: _response.error.statusCode,
|
|
228
255
|
body: _response.error.body,
|
|
256
|
+
rawResponse: _response.rawResponse,
|
|
229
257
|
});
|
|
230
258
|
}
|
|
231
259
|
switch (_response.error.reason) {
|
|
@@ -233,12 +261,14 @@ class Notifications {
|
|
|
233
261
|
throw new errors.CourierError({
|
|
234
262
|
statusCode: _response.error.statusCode,
|
|
235
263
|
body: _response.error.rawBody,
|
|
264
|
+
rawResponse: _response.rawResponse,
|
|
236
265
|
});
|
|
237
266
|
case "timeout":
|
|
238
267
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /notifications/{id}/{submissionId}/checks.");
|
|
239
268
|
case "unknown":
|
|
240
269
|
throw new errors.CourierError({
|
|
241
270
|
message: _response.error.errorMessage,
|
|
271
|
+
rawResponse: _response.rawResponse,
|
|
242
272
|
});
|
|
243
273
|
}
|
|
244
274
|
});
|
|
@@ -263,12 +293,15 @@ class Notifications {
|
|
|
263
293
|
* })
|
|
264
294
|
*/
|
|
265
295
|
replaceSubmissionChecks(id, submissionId, request, requestOptions) {
|
|
296
|
+
return core.HttpResponsePromise.fromPromise(this.__replaceSubmissionChecks(id, submissionId, request, requestOptions));
|
|
297
|
+
}
|
|
298
|
+
__replaceSubmissionChecks(id, submissionId, request, requestOptions) {
|
|
266
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
267
300
|
var _a, _b, _c;
|
|
268
301
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
269
302
|
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, `/notifications/${encodeURIComponent(id)}/${encodeURIComponent(submissionId)}/checks`),
|
|
270
303
|
method: "PUT",
|
|
271
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
304
|
+
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),
|
|
272
305
|
contentType: "application/json",
|
|
273
306
|
requestType: "json",
|
|
274
307
|
body: request,
|
|
@@ -277,12 +310,16 @@ class Notifications {
|
|
|
277
310
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
278
311
|
});
|
|
279
312
|
if (_response.ok) {
|
|
280
|
-
return
|
|
313
|
+
return {
|
|
314
|
+
data: _response.body,
|
|
315
|
+
rawResponse: _response.rawResponse,
|
|
316
|
+
};
|
|
281
317
|
}
|
|
282
318
|
if (_response.error.reason === "status-code") {
|
|
283
319
|
throw new errors.CourierError({
|
|
284
320
|
statusCode: _response.error.statusCode,
|
|
285
321
|
body: _response.error.body,
|
|
322
|
+
rawResponse: _response.rawResponse,
|
|
286
323
|
});
|
|
287
324
|
}
|
|
288
325
|
switch (_response.error.reason) {
|
|
@@ -290,12 +327,14 @@ class Notifications {
|
|
|
290
327
|
throw new errors.CourierError({
|
|
291
328
|
statusCode: _response.error.statusCode,
|
|
292
329
|
body: _response.error.rawBody,
|
|
330
|
+
rawResponse: _response.rawResponse,
|
|
293
331
|
});
|
|
294
332
|
case "timeout":
|
|
295
333
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /notifications/{id}/{submissionId}/checks.");
|
|
296
334
|
case "unknown":
|
|
297
335
|
throw new errors.CourierError({
|
|
298
336
|
message: _response.error.errorMessage,
|
|
337
|
+
rawResponse: _response.rawResponse,
|
|
299
338
|
});
|
|
300
339
|
}
|
|
301
340
|
});
|
|
@@ -309,12 +348,15 @@ class Notifications {
|
|
|
309
348
|
* await client.notifications.cancelSubmission("id", "submissionId")
|
|
310
349
|
*/
|
|
311
350
|
cancelSubmission(id, submissionId, requestOptions) {
|
|
351
|
+
return core.HttpResponsePromise.fromPromise(this.__cancelSubmission(id, submissionId, requestOptions));
|
|
352
|
+
}
|
|
353
|
+
__cancelSubmission(id, submissionId, requestOptions) {
|
|
312
354
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
355
|
var _a, _b, _c;
|
|
314
356
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
315
357
|
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, `/notifications/${encodeURIComponent(id)}/${encodeURIComponent(submissionId)}/checks`),
|
|
316
358
|
method: "DELETE",
|
|
317
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
359
|
+
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),
|
|
318
360
|
contentType: "application/json",
|
|
319
361
|
requestType: "json",
|
|
320
362
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -322,12 +364,13 @@ class Notifications {
|
|
|
322
364
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
323
365
|
});
|
|
324
366
|
if (_response.ok) {
|
|
325
|
-
return;
|
|
367
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
326
368
|
}
|
|
327
369
|
if (_response.error.reason === "status-code") {
|
|
328
370
|
throw new errors.CourierError({
|
|
329
371
|
statusCode: _response.error.statusCode,
|
|
330
372
|
body: _response.error.body,
|
|
373
|
+
rawResponse: _response.rawResponse,
|
|
331
374
|
});
|
|
332
375
|
}
|
|
333
376
|
switch (_response.error.reason) {
|
|
@@ -335,12 +378,14 @@ class Notifications {
|
|
|
335
378
|
throw new errors.CourierError({
|
|
336
379
|
statusCode: _response.error.statusCode,
|
|
337
380
|
body: _response.error.rawBody,
|
|
381
|
+
rawResponse: _response.rawResponse,
|
|
338
382
|
});
|
|
339
383
|
case "timeout":
|
|
340
384
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /notifications/{id}/{submissionId}/checks.");
|
|
341
385
|
case "unknown":
|
|
342
386
|
throw new errors.CourierError({
|
|
343
387
|
message: _response.error.errorMessage,
|
|
388
|
+
rawResponse: _response.rawResponse,
|
|
344
389
|
});
|
|
345
390
|
}
|
|
346
391
|
});
|
|
@@ -41,7 +41,8 @@ export declare class Profiles {
|
|
|
41
41
|
* @example
|
|
42
42
|
* await client.profiles.get("user_id")
|
|
43
43
|
*/
|
|
44
|
-
get(userId: string, requestOptions?: Profiles.RequestOptions):
|
|
44
|
+
get(userId: string, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<Courier.ProfileGetResponse>;
|
|
45
|
+
private __get;
|
|
45
46
|
/**
|
|
46
47
|
* Merge the supplied values with an existing profile or create a new profile if one doesn't already exist.
|
|
47
48
|
*
|
|
@@ -60,7 +61,8 @@ export declare class Profiles {
|
|
|
60
61
|
* }
|
|
61
62
|
* })
|
|
62
63
|
*/
|
|
63
|
-
create(userId: string, request: Courier.MergeProfileRequest, requestOptions?: Profiles.IdempotentRequestOptions):
|
|
64
|
+
create(userId: string, request: Courier.MergeProfileRequest, requestOptions?: Profiles.IdempotentRequestOptions): core.HttpResponsePromise<Courier.MergeProfileResponse>;
|
|
65
|
+
private __create;
|
|
64
66
|
/**
|
|
65
67
|
* When using `PUT`, be sure to include all the key-value pairs required by the recipient's profile.
|
|
66
68
|
* Any key-value pairs that exist in the profile but fail to be included in the `PUT` request will be
|
|
@@ -82,7 +84,8 @@ export declare class Profiles {
|
|
|
82
84
|
* }
|
|
83
85
|
* })
|
|
84
86
|
*/
|
|
85
|
-
replace(userId: string, request: Courier.ReplaceProfileRequest, requestOptions?: Profiles.RequestOptions):
|
|
87
|
+
replace(userId: string, request: Courier.ReplaceProfileRequest, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<Courier.ReplaceProfileResponse>;
|
|
88
|
+
private __replace;
|
|
86
89
|
/**
|
|
87
90
|
* @param {string} userId - A unique identifier representing the user associated with the requested profile.
|
|
88
91
|
* @param {Courier.ProfileUpdateRequest} request
|
|
@@ -101,7 +104,8 @@ export declare class Profiles {
|
|
|
101
104
|
* }]
|
|
102
105
|
* })
|
|
103
106
|
*/
|
|
104
|
-
mergeProfile(userId: string, request: Courier.ProfileUpdateRequest, requestOptions?: Profiles.RequestOptions):
|
|
107
|
+
mergeProfile(userId: string, request: Courier.ProfileUpdateRequest, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<void>;
|
|
108
|
+
private __mergeProfile;
|
|
105
109
|
/**
|
|
106
110
|
* Deletes the specified user profile.
|
|
107
111
|
*
|
|
@@ -113,7 +117,8 @@ export declare class Profiles {
|
|
|
113
117
|
* @example
|
|
114
118
|
* await client.profiles.delete("user_id")
|
|
115
119
|
*/
|
|
116
|
-
delete(userId: string, requestOptions?: Profiles.RequestOptions):
|
|
120
|
+
delete(userId: string, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<void>;
|
|
121
|
+
private __delete;
|
|
117
122
|
/**
|
|
118
123
|
* Returns the subscribed lists for a specified user.
|
|
119
124
|
*
|
|
@@ -126,7 +131,8 @@ export declare class Profiles {
|
|
|
126
131
|
* @example
|
|
127
132
|
* await client.profiles.getListSubscriptions("user_id")
|
|
128
133
|
*/
|
|
129
|
-
getListSubscriptions(userId: string, request?: Courier.GetListSubscriptionsRequest, requestOptions?: Profiles.RequestOptions):
|
|
134
|
+
getListSubscriptions(userId: string, request?: Courier.GetListSubscriptionsRequest, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<Courier.GetListSubscriptionsResponse>;
|
|
135
|
+
private __getListSubscriptions;
|
|
130
136
|
/**
|
|
131
137
|
* Subscribes the given user to one or more lists. If the list does not exist, it will be created.
|
|
132
138
|
*
|
|
@@ -147,7 +153,8 @@ export declare class Profiles {
|
|
|
147
153
|
* }]
|
|
148
154
|
* })
|
|
149
155
|
*/
|
|
150
|
-
subscribeToLists(userId: string, request: Courier.SubscribeToListsRequest, requestOptions?: Profiles.IdempotentRequestOptions):
|
|
156
|
+
subscribeToLists(userId: string, request: Courier.SubscribeToListsRequest, requestOptions?: Profiles.IdempotentRequestOptions): core.HttpResponsePromise<Courier.SubscribeToListsResponse>;
|
|
157
|
+
private __subscribeToLists;
|
|
151
158
|
/**
|
|
152
159
|
* Removes all list subscriptions for given user.
|
|
153
160
|
*
|
|
@@ -159,6 +166,7 @@ export declare class Profiles {
|
|
|
159
166
|
* @example
|
|
160
167
|
* await client.profiles.deleteListSubscription("user_id")
|
|
161
168
|
*/
|
|
162
|
-
deleteListSubscription(userId: string, requestOptions?: Profiles.RequestOptions):
|
|
169
|
+
deleteListSubscription(userId: string, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<Courier.DeleteListSubscriptionResponse>;
|
|
170
|
+
private __deleteListSubscription;
|
|
163
171
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
164
172
|
}
|