@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.
Files changed (133) hide show
  1. package/Client.d.ts +14 -48
  2. package/Client.js +20 -49
  3. package/README.md +113 -808
  4. package/api/client/requests/SendMessageRequest.d.ts +12 -47
  5. package/api/resources/audiences/client/Client.d.ts +10 -5
  6. package/api/resources/audiences/client/Client.js +45 -15
  7. package/api/resources/auditEvents/client/Client.d.ts +4 -2
  8. package/api/resources/auditEvents/client/Client.js +17 -5
  9. package/api/resources/authTokens/client/Client.d.ts +2 -1
  10. package/api/resources/authTokens/client/Client.js +8 -2
  11. package/api/resources/automations/client/Client.d.ts +4 -2
  12. package/api/resources/automations/client/Client.js +16 -4
  13. package/api/resources/brands/client/Client.d.ts +10 -5
  14. package/api/resources/brands/client/Client.js +45 -15
  15. package/api/resources/bulk/client/Client.d.ts +10 -5
  16. package/api/resources/bulk/client/Client.js +45 -15
  17. package/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
  18. package/api/resources/commons/errors/AlreadyExistsError.js +2 -1
  19. package/api/resources/commons/errors/BadRequestError.d.ts +2 -1
  20. package/api/resources/commons/errors/BadRequestError.js +2 -1
  21. package/api/resources/commons/errors/ConflictError.d.ts +2 -1
  22. package/api/resources/commons/errors/ConflictError.js +2 -1
  23. package/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
  24. package/api/resources/commons/errors/MessageNotFoundError.js +2 -1
  25. package/api/resources/commons/errors/NotFoundError.d.ts +2 -1
  26. package/api/resources/commons/errors/NotFoundError.js +2 -1
  27. package/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
  28. package/api/resources/commons/errors/PaymentRequiredError.js +2 -1
  29. package/api/resources/inbound/client/Client.d.ts +2 -1
  30. package/api/resources/inbound/client/Client.js +10 -4
  31. package/api/resources/lists/client/Client.d.ts +20 -10
  32. package/api/resources/lists/client/Client.js +89 -29
  33. package/api/resources/messages/client/Client.d.ts +12 -6
  34. package/api/resources/messages/client/Client.js +56 -20
  35. package/api/resources/notifications/client/Client.d.ts +12 -6
  36. package/api/resources/notifications/client/Client.js +58 -13
  37. package/api/resources/profiles/client/Client.d.ts +16 -8
  38. package/api/resources/profiles/client/Client.js +75 -24
  39. package/api/resources/templates/client/Client.d.ts +2 -1
  40. package/api/resources/templates/client/Client.js +9 -3
  41. package/api/resources/tenants/client/Client.d.ts +14 -7
  42. package/api/resources/tenants/client/Client.js +61 -19
  43. package/api/resources/translations/client/Client.d.ts +4 -2
  44. package/api/resources/translations/client/Client.js +18 -6
  45. package/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
  46. package/api/resources/users/resources/preferences/client/Client.js +38 -11
  47. package/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
  48. package/api/resources/users/resources/tenants/client/Client.js +45 -12
  49. package/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
  50. package/api/resources/users/resources/tokens/client/Client.js +53 -17
  51. package/core/fetcher/APIResponse.d.ts +10 -0
  52. package/core/fetcher/Fetcher.js +7 -0
  53. package/core/fetcher/Headers.d.ts +2 -0
  54. package/core/fetcher/Headers.js +84 -0
  55. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  56. package/core/fetcher/HttpResponsePromise.js +103 -0
  57. package/core/fetcher/RawResponse.d.ts +29 -0
  58. package/core/fetcher/RawResponse.js +44 -0
  59. package/core/fetcher/index.d.ts +3 -0
  60. package/core/fetcher/index.js +7 -1
  61. package/core/index.d.ts +1 -1
  62. package/core/index.js +1 -1
  63. package/dist/Client.d.ts +14 -48
  64. package/dist/Client.js +20 -49
  65. package/dist/api/client/requests/SendMessageRequest.d.ts +12 -47
  66. package/dist/api/resources/audiences/client/Client.d.ts +10 -5
  67. package/dist/api/resources/audiences/client/Client.js +45 -15
  68. package/dist/api/resources/auditEvents/client/Client.d.ts +4 -2
  69. package/dist/api/resources/auditEvents/client/Client.js +17 -5
  70. package/dist/api/resources/authTokens/client/Client.d.ts +2 -1
  71. package/dist/api/resources/authTokens/client/Client.js +8 -2
  72. package/dist/api/resources/automations/client/Client.d.ts +4 -2
  73. package/dist/api/resources/automations/client/Client.js +16 -4
  74. package/dist/api/resources/brands/client/Client.d.ts +10 -5
  75. package/dist/api/resources/brands/client/Client.js +45 -15
  76. package/dist/api/resources/bulk/client/Client.d.ts +10 -5
  77. package/dist/api/resources/bulk/client/Client.js +45 -15
  78. package/dist/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
  79. package/dist/api/resources/commons/errors/AlreadyExistsError.js +2 -1
  80. package/dist/api/resources/commons/errors/BadRequestError.d.ts +2 -1
  81. package/dist/api/resources/commons/errors/BadRequestError.js +2 -1
  82. package/dist/api/resources/commons/errors/ConflictError.d.ts +2 -1
  83. package/dist/api/resources/commons/errors/ConflictError.js +2 -1
  84. package/dist/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
  85. package/dist/api/resources/commons/errors/MessageNotFoundError.js +2 -1
  86. package/dist/api/resources/commons/errors/NotFoundError.d.ts +2 -1
  87. package/dist/api/resources/commons/errors/NotFoundError.js +2 -1
  88. package/dist/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
  89. package/dist/api/resources/commons/errors/PaymentRequiredError.js +2 -1
  90. package/dist/api/resources/inbound/client/Client.d.ts +2 -1
  91. package/dist/api/resources/inbound/client/Client.js +10 -4
  92. package/dist/api/resources/lists/client/Client.d.ts +20 -10
  93. package/dist/api/resources/lists/client/Client.js +89 -29
  94. package/dist/api/resources/messages/client/Client.d.ts +12 -6
  95. package/dist/api/resources/messages/client/Client.js +56 -20
  96. package/dist/api/resources/notifications/client/Client.d.ts +12 -6
  97. package/dist/api/resources/notifications/client/Client.js +58 -13
  98. package/dist/api/resources/profiles/client/Client.d.ts +16 -8
  99. package/dist/api/resources/profiles/client/Client.js +75 -24
  100. package/dist/api/resources/templates/client/Client.d.ts +2 -1
  101. package/dist/api/resources/templates/client/Client.js +9 -3
  102. package/dist/api/resources/tenants/client/Client.d.ts +14 -7
  103. package/dist/api/resources/tenants/client/Client.js +61 -19
  104. package/dist/api/resources/translations/client/Client.d.ts +4 -2
  105. package/dist/api/resources/translations/client/Client.js +18 -6
  106. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
  107. package/dist/api/resources/users/resources/preferences/client/Client.js +38 -11
  108. package/dist/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
  109. package/dist/api/resources/users/resources/tenants/client/Client.js +45 -12
  110. package/dist/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
  111. package/dist/api/resources/users/resources/tokens/client/Client.js +53 -17
  112. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  113. package/dist/core/fetcher/Fetcher.js +7 -0
  114. package/dist/core/fetcher/Headers.d.ts +2 -0
  115. package/dist/core/fetcher/Headers.js +84 -0
  116. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  117. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  118. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  119. package/dist/core/fetcher/RawResponse.js +44 -0
  120. package/dist/core/fetcher/index.d.ts +3 -0
  121. package/dist/core/fetcher/index.js +7 -1
  122. package/dist/core/index.d.ts +1 -1
  123. package/dist/core/index.js +1 -1
  124. package/dist/errors/CourierError.d.ts +4 -1
  125. package/dist/errors/CourierError.js +4 -7
  126. package/dist/version.d.ts +1 -1
  127. package/dist/version.js +1 -1
  128. package/errors/CourierError.d.ts +4 -1
  129. package/errors/CourierError.js +4 -7
  130. package/package.json +3 -2
  131. package/reference.md +12 -50
  132. package/version.d.ts +1 -1
  133. package/version.js +1 -1
@@ -70,12 +70,15 @@ class Profiles {
70
70
  * await client.profiles.get("user_id")
71
71
  */
72
72
  get(userId, requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__get(userId, requestOptions));
74
+ }
75
+ __get(userId, requestOptions) {
73
76
  return __awaiter(this, void 0, void 0, function* () {
74
77
  var _a, _b, _c;
75
78
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
76
79
  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, `/profiles/${encodeURIComponent(userId)}`),
77
80
  method: "GET",
78
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
81
+ 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),
79
82
  contentType: "application/json",
80
83
  requestType: "json",
81
84
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -83,16 +86,17 @@ class Profiles {
83
86
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
84
87
  });
85
88
  if (_response.ok) {
86
- return _response.body;
89
+ return { data: _response.body, rawResponse: _response.rawResponse };
87
90
  }
88
91
  if (_response.error.reason === "status-code") {
89
92
  switch (_response.error.statusCode) {
90
93
  case 400:
91
- throw new Courier.BadRequestError(_response.error.body);
94
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
92
95
  default:
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
  }
@@ -101,12 +105,14 @@ class Profiles {
101
105
  throw new errors.CourierError({
102
106
  statusCode: _response.error.statusCode,
103
107
  body: _response.error.rawBody,
108
+ rawResponse: _response.rawResponse,
104
109
  });
105
110
  case "timeout":
106
111
  throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /profiles/{user_id}.");
107
112
  case "unknown":
108
113
  throw new errors.CourierError({
109
114
  message: _response.error.errorMessage,
115
+ rawResponse: _response.rawResponse,
110
116
  });
111
117
  }
112
118
  });
@@ -130,12 +136,15 @@ class Profiles {
130
136
  * })
131
137
  */
132
138
  create(userId, request, requestOptions) {
139
+ return core.HttpResponsePromise.fromPromise(this.__create(userId, request, requestOptions));
140
+ }
141
+ __create(userId, request, requestOptions) {
133
142
  return __awaiter(this, void 0, void 0, function* () {
134
143
  var _a, _b, _c;
135
144
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
136
145
  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, `/profiles/${encodeURIComponent(userId)}`),
137
146
  method: "POST",
138
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
147
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
139
148
  contentType: "application/json",
140
149
  requestType: "json",
141
150
  body: request,
@@ -144,16 +153,17 @@ class Profiles {
144
153
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
145
154
  });
146
155
  if (_response.ok) {
147
- return _response.body;
156
+ return { data: _response.body, rawResponse: _response.rawResponse };
148
157
  }
149
158
  if (_response.error.reason === "status-code") {
150
159
  switch (_response.error.statusCode) {
151
160
  case 400:
152
- throw new Courier.BadRequestError(_response.error.body);
161
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
153
162
  default:
154
163
  throw new errors.CourierError({
155
164
  statusCode: _response.error.statusCode,
156
165
  body: _response.error.body,
166
+ rawResponse: _response.rawResponse,
157
167
  });
158
168
  }
159
169
  }
@@ -162,12 +172,14 @@ class Profiles {
162
172
  throw new errors.CourierError({
163
173
  statusCode: _response.error.statusCode,
164
174
  body: _response.error.rawBody,
175
+ rawResponse: _response.rawResponse,
165
176
  });
166
177
  case "timeout":
167
178
  throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /profiles/{user_id}.");
168
179
  case "unknown":
169
180
  throw new errors.CourierError({
170
181
  message: _response.error.errorMessage,
182
+ rawResponse: _response.rawResponse,
171
183
  });
172
184
  }
173
185
  });
@@ -194,12 +206,15 @@ class Profiles {
194
206
  * })
195
207
  */
196
208
  replace(userId, request, requestOptions) {
209
+ return core.HttpResponsePromise.fromPromise(this.__replace(userId, request, requestOptions));
210
+ }
211
+ __replace(userId, request, requestOptions) {
197
212
  return __awaiter(this, void 0, void 0, function* () {
198
213
  var _a, _b, _c;
199
214
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
200
215
  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, `/profiles/${encodeURIComponent(userId)}`),
201
216
  method: "PUT",
202
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
217
+ 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),
203
218
  contentType: "application/json",
204
219
  requestType: "json",
205
220
  body: request,
@@ -208,16 +223,17 @@ class Profiles {
208
223
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
209
224
  });
210
225
  if (_response.ok) {
211
- return _response.body;
226
+ return { data: _response.body, rawResponse: _response.rawResponse };
212
227
  }
213
228
  if (_response.error.reason === "status-code") {
214
229
  switch (_response.error.statusCode) {
215
230
  case 400:
216
- throw new Courier.BadRequestError(_response.error.body);
231
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
217
232
  default:
218
233
  throw new errors.CourierError({
219
234
  statusCode: _response.error.statusCode,
220
235
  body: _response.error.body,
236
+ rawResponse: _response.rawResponse,
221
237
  });
222
238
  }
223
239
  }
@@ -226,12 +242,14 @@ class Profiles {
226
242
  throw new errors.CourierError({
227
243
  statusCode: _response.error.statusCode,
228
244
  body: _response.error.rawBody,
245
+ rawResponse: _response.rawResponse,
229
246
  });
230
247
  case "timeout":
231
248
  throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /profiles/{user_id}.");
232
249
  case "unknown":
233
250
  throw new errors.CourierError({
234
251
  message: _response.error.errorMessage,
252
+ rawResponse: _response.rawResponse,
235
253
  });
236
254
  }
237
255
  });
@@ -255,12 +273,15 @@ class Profiles {
255
273
  * })
256
274
  */
257
275
  mergeProfile(userId, request, requestOptions) {
276
+ return core.HttpResponsePromise.fromPromise(this.__mergeProfile(userId, request, requestOptions));
277
+ }
278
+ __mergeProfile(userId, request, requestOptions) {
258
279
  return __awaiter(this, void 0, void 0, function* () {
259
280
  var _a, _b, _c;
260
281
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
261
282
  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, `/profiles/${encodeURIComponent(userId)}`),
262
283
  method: "PATCH",
263
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
284
+ 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),
264
285
  contentType: "application/json",
265
286
  requestType: "json",
266
287
  body: request,
@@ -269,12 +290,13 @@ class Profiles {
269
290
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
270
291
  });
271
292
  if (_response.ok) {
272
- return;
293
+ return { data: undefined, rawResponse: _response.rawResponse };
273
294
  }
274
295
  if (_response.error.reason === "status-code") {
275
296
  throw new errors.CourierError({
276
297
  statusCode: _response.error.statusCode,
277
298
  body: _response.error.body,
299
+ rawResponse: _response.rawResponse,
278
300
  });
279
301
  }
280
302
  switch (_response.error.reason) {
@@ -282,12 +304,14 @@ class Profiles {
282
304
  throw new errors.CourierError({
283
305
  statusCode: _response.error.statusCode,
284
306
  body: _response.error.rawBody,
307
+ rawResponse: _response.rawResponse,
285
308
  });
286
309
  case "timeout":
287
310
  throw new errors.CourierTimeoutError("Timeout exceeded when calling PATCH /profiles/{user_id}.");
288
311
  case "unknown":
289
312
  throw new errors.CourierError({
290
313
  message: _response.error.errorMessage,
314
+ rawResponse: _response.rawResponse,
291
315
  });
292
316
  }
293
317
  });
@@ -304,12 +328,15 @@ class Profiles {
304
328
  * await client.profiles.delete("user_id")
305
329
  */
306
330
  delete(userId, requestOptions) {
331
+ return core.HttpResponsePromise.fromPromise(this.__delete(userId, requestOptions));
332
+ }
333
+ __delete(userId, requestOptions) {
307
334
  return __awaiter(this, void 0, void 0, function* () {
308
335
  var _a, _b, _c;
309
336
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
310
337
  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, `/profiles/${encodeURIComponent(userId)}`),
311
338
  method: "DELETE",
312
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
339
+ 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),
313
340
  contentType: "application/json",
314
341
  requestType: "json",
315
342
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -317,16 +344,17 @@ class Profiles {
317
344
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
318
345
  });
319
346
  if (_response.ok) {
320
- return;
347
+ return { data: undefined, rawResponse: _response.rawResponse };
321
348
  }
322
349
  if (_response.error.reason === "status-code") {
323
350
  switch (_response.error.statusCode) {
324
351
  case 400:
325
- throw new Courier.BadRequestError(_response.error.body);
352
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
326
353
  default:
327
354
  throw new errors.CourierError({
328
355
  statusCode: _response.error.statusCode,
329
356
  body: _response.error.body,
357
+ rawResponse: _response.rawResponse,
330
358
  });
331
359
  }
332
360
  }
@@ -335,12 +363,14 @@ class Profiles {
335
363
  throw new errors.CourierError({
336
364
  statusCode: _response.error.statusCode,
337
365
  body: _response.error.rawBody,
366
+ rawResponse: _response.rawResponse,
338
367
  });
339
368
  case "timeout":
340
369
  throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /profiles/{user_id}.");
341
370
  case "unknown":
342
371
  throw new errors.CourierError({
343
372
  message: _response.error.errorMessage,
373
+ rawResponse: _response.rawResponse,
344
374
  });
345
375
  }
346
376
  });
@@ -357,7 +387,10 @@ class Profiles {
357
387
  * @example
358
388
  * await client.profiles.getListSubscriptions("user_id")
359
389
  */
360
- getListSubscriptions(userId_1) {
390
+ getListSubscriptions(userId, request = {}, requestOptions) {
391
+ return core.HttpResponsePromise.fromPromise(this.__getListSubscriptions(userId, request, requestOptions));
392
+ }
393
+ __getListSubscriptions(userId_1) {
361
394
  return __awaiter(this, arguments, void 0, function* (userId, request = {}, requestOptions) {
362
395
  var _a, _b, _c;
363
396
  const { cursor } = request;
@@ -368,7 +401,7 @@ class Profiles {
368
401
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
369
402
  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, `/profiles/${encodeURIComponent(userId)}/lists`),
370
403
  method: "GET",
371
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
404
+ 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),
372
405
  contentType: "application/json",
373
406
  queryParameters: _queryParams,
374
407
  requestType: "json",
@@ -377,16 +410,17 @@ class Profiles {
377
410
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
378
411
  });
379
412
  if (_response.ok) {
380
- return _response.body;
413
+ return { data: _response.body, rawResponse: _response.rawResponse };
381
414
  }
382
415
  if (_response.error.reason === "status-code") {
383
416
  switch (_response.error.statusCode) {
384
417
  case 400:
385
- throw new Courier.BadRequestError(_response.error.body);
418
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
386
419
  default:
387
420
  throw new errors.CourierError({
388
421
  statusCode: _response.error.statusCode,
389
422
  body: _response.error.body,
423
+ rawResponse: _response.rawResponse,
390
424
  });
391
425
  }
392
426
  }
@@ -395,12 +429,14 @@ class Profiles {
395
429
  throw new errors.CourierError({
396
430
  statusCode: _response.error.statusCode,
397
431
  body: _response.error.rawBody,
432
+ rawResponse: _response.rawResponse,
398
433
  });
399
434
  case "timeout":
400
435
  throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /profiles/{user_id}/lists.");
401
436
  case "unknown":
402
437
  throw new errors.CourierError({
403
438
  message: _response.error.errorMessage,
439
+ rawResponse: _response.rawResponse,
404
440
  });
405
441
  }
406
442
  });
@@ -426,12 +462,15 @@ class Profiles {
426
462
  * })
427
463
  */
428
464
  subscribeToLists(userId, request, requestOptions) {
465
+ return core.HttpResponsePromise.fromPromise(this.__subscribeToLists(userId, request, requestOptions));
466
+ }
467
+ __subscribeToLists(userId, request, requestOptions) {
429
468
  return __awaiter(this, void 0, void 0, function* () {
430
469
  var _a, _b, _c;
431
470
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
432
471
  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, `/profiles/${encodeURIComponent(userId)}/lists`),
433
472
  method: "POST",
434
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
473
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
435
474
  contentType: "application/json",
436
475
  requestType: "json",
437
476
  body: request,
@@ -440,16 +479,17 @@ class Profiles {
440
479
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
441
480
  });
442
481
  if (_response.ok) {
443
- return _response.body;
482
+ return { data: _response.body, rawResponse: _response.rawResponse };
444
483
  }
445
484
  if (_response.error.reason === "status-code") {
446
485
  switch (_response.error.statusCode) {
447
486
  case 400:
448
- throw new Courier.BadRequestError(_response.error.body);
487
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
449
488
  default:
450
489
  throw new errors.CourierError({
451
490
  statusCode: _response.error.statusCode,
452
491
  body: _response.error.body,
492
+ rawResponse: _response.rawResponse,
453
493
  });
454
494
  }
455
495
  }
@@ -458,12 +498,14 @@ class Profiles {
458
498
  throw new errors.CourierError({
459
499
  statusCode: _response.error.statusCode,
460
500
  body: _response.error.rawBody,
501
+ rawResponse: _response.rawResponse,
461
502
  });
462
503
  case "timeout":
463
504
  throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /profiles/{user_id}/lists.");
464
505
  case "unknown":
465
506
  throw new errors.CourierError({
466
507
  message: _response.error.errorMessage,
508
+ rawResponse: _response.rawResponse,
467
509
  });
468
510
  }
469
511
  });
@@ -480,12 +522,15 @@ class Profiles {
480
522
  * await client.profiles.deleteListSubscription("user_id")
481
523
  */
482
524
  deleteListSubscription(userId, requestOptions) {
525
+ return core.HttpResponsePromise.fromPromise(this.__deleteListSubscription(userId, requestOptions));
526
+ }
527
+ __deleteListSubscription(userId, requestOptions) {
483
528
  return __awaiter(this, void 0, void 0, function* () {
484
529
  var _a, _b, _c;
485
530
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
486
531
  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, `/profiles/${encodeURIComponent(userId)}/lists`),
487
532
  method: "DELETE",
488
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
533
+ 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),
489
534
  contentType: "application/json",
490
535
  requestType: "json",
491
536
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -493,16 +538,20 @@ class Profiles {
493
538
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
494
539
  });
495
540
  if (_response.ok) {
496
- return _response.body;
541
+ return {
542
+ data: _response.body,
543
+ rawResponse: _response.rawResponse,
544
+ };
497
545
  }
498
546
  if (_response.error.reason === "status-code") {
499
547
  switch (_response.error.statusCode) {
500
548
  case 400:
501
- throw new Courier.BadRequestError(_response.error.body);
549
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
502
550
  default:
503
551
  throw new errors.CourierError({
504
552
  statusCode: _response.error.statusCode,
505
553
  body: _response.error.body,
554
+ rawResponse: _response.rawResponse,
506
555
  });
507
556
  }
508
557
  }
@@ -511,12 +560,14 @@ class Profiles {
511
560
  throw new errors.CourierError({
512
561
  statusCode: _response.error.statusCode,
513
562
  body: _response.error.rawBody,
563
+ rawResponse: _response.rawResponse,
514
564
  });
515
565
  case "timeout":
516
566
  throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /profiles/{user_id}/lists.");
517
567
  case "unknown":
518
568
  throw new errors.CourierError({
519
569
  message: _response.error.errorMessage,
570
+ rawResponse: _response.rawResponse,
520
571
  });
521
572
  }
522
573
  });
@@ -35,6 +35,7 @@ export declare class Templates {
35
35
  * @example
36
36
  * await client.templates.list()
37
37
  */
38
- list(request?: Courier.ListTemplatesRequest, requestOptions?: Templates.RequestOptions): Promise<Courier.ListTemplatesResponse>;
38
+ list(request?: Courier.ListTemplatesRequest, requestOptions?: Templates.RequestOptions): core.HttpResponsePromise<Courier.ListTemplatesResponse>;
39
+ private __list;
39
40
  protected _getAuthorizationHeader(): Promise<string>;
40
41
  }
@@ -66,7 +66,10 @@ class Templates {
66
66
  * @example
67
67
  * await client.templates.list()
68
68
  */
69
- list() {
69
+ list(request = {}, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
71
+ }
72
+ __list() {
70
73
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
71
74
  var _a, _b, _c;
72
75
  const { cursor } = request;
@@ -77,7 +80,7 @@ class Templates {
77
80
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
78
81
  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"),
79
82
  method: "GET",
80
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
83
+ 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),
81
84
  contentType: "application/json",
82
85
  queryParameters: _queryParams,
83
86
  requestType: "json",
@@ -86,12 +89,13 @@ class Templates {
86
89
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
87
90
  });
88
91
  if (_response.ok) {
89
- return _response.body;
92
+ return { data: _response.body, rawResponse: _response.rawResponse };
90
93
  }
91
94
  if (_response.error.reason === "status-code") {
92
95
  throw new errors.CourierError({
93
96
  statusCode: _response.error.statusCode,
94
97
  body: _response.error.body,
98
+ rawResponse: _response.rawResponse,
95
99
  });
96
100
  }
97
101
  switch (_response.error.reason) {
@@ -99,12 +103,14 @@ class Templates {
99
103
  throw new errors.CourierError({
100
104
  statusCode: _response.error.statusCode,
101
105
  body: _response.error.rawBody,
106
+ rawResponse: _response.rawResponse,
102
107
  });
103
108
  case "timeout":
104
109
  throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /notifications.");
105
110
  case "unknown":
106
111
  throw new errors.CourierError({
107
112
  message: _response.error.errorMessage,
113
+ rawResponse: _response.rawResponse,
108
114
  });
109
115
  }
110
116
  });
@@ -43,7 +43,8 @@ export declare class Tenants {
43
43
  * brand_id: undefined
44
44
  * })
45
45
  */
46
- createOrReplace(tenantId: string, request: Courier.TenantCreateOrReplaceParams, requestOptions?: Tenants.RequestOptions): Promise<Courier.Tenant>;
46
+ createOrReplace(tenantId: string, request: Courier.TenantCreateOrReplaceParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.Tenant>;
47
+ private __createOrReplace;
47
48
  /**
48
49
  * @param {string} tenantId - A unique identifier representing the tenant to be returned.
49
50
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
@@ -53,7 +54,8 @@ export declare class Tenants {
53
54
  * @example
54
55
  * await client.tenants.get("tenant_id")
55
56
  */
56
- get(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise<Courier.Tenant>;
57
+ get(tenantId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.Tenant>;
58
+ private __get;
57
59
  /**
58
60
  * @param {Courier.ListTenantParams} request
59
61
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
@@ -61,7 +63,8 @@ export declare class Tenants {
61
63
  * @example
62
64
  * await client.tenants.list()
63
65
  */
64
- list(request?: Courier.ListTenantParams, requestOptions?: Tenants.RequestOptions): Promise<Courier.TenantListResponse>;
66
+ list(request?: Courier.ListTenantParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.TenantListResponse>;
67
+ private __list;
65
68
  /**
66
69
  * @param {string} tenantId - Id of the tenant to be deleted.
67
70
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
@@ -69,7 +72,8 @@ export declare class Tenants {
69
72
  * @example
70
73
  * await client.tenants.delete("tenant_id")
71
74
  */
72
- delete(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise<void>;
75
+ delete(tenantId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
76
+ private __delete;
73
77
  /**
74
78
  * @param {string} tenantId - Id of the tenant for user membership.
75
79
  * @param {Courier.ListUsersForTenantParams} request
@@ -80,7 +84,8 @@ export declare class Tenants {
80
84
  * @example
81
85
  * await client.tenants.getUsersByTenant("tenant_id")
82
86
  */
83
- getUsersByTenant(tenantId: string, request?: Courier.ListUsersForTenantParams, requestOptions?: Tenants.RequestOptions): Promise<Courier.ListUsersForTenantResponse>;
87
+ getUsersByTenant(tenantId: string, request?: Courier.ListUsersForTenantParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.ListUsersForTenantResponse>;
88
+ private __getUsersByTenant;
84
89
  /**
85
90
  * @param {string} tenantId - Id of the tenant to update the default preferences for.
86
91
  * @param {string} topicId - Id fo the susbcription topic you want to have a default preference for.
@@ -94,7 +99,8 @@ export declare class Tenants {
94
99
  * custom_routing: ["inbox"]
95
100
  * })
96
101
  */
97
- createOrReplaceDefaultPreferencesForTopic(tenantId: string, topicId: string, request: Courier.SubscriptionTopicNew, requestOptions?: Tenants.RequestOptions): Promise<void>;
102
+ createOrReplaceDefaultPreferencesForTopic(tenantId: string, topicId: string, request: Courier.SubscriptionTopicNew, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
103
+ private __createOrReplaceDefaultPreferencesForTopic;
98
104
  /**
99
105
  * @param {string} tenantId - Id of the tenant to update the default preferences for.
100
106
  * @param {string} topicId - Id fo the susbcription topic you want to have a default preference for.
@@ -103,6 +109,7 @@ export declare class Tenants {
103
109
  * @example
104
110
  * await client.tenants.removeDefaultPreferencesForTopic("tenant_id", "topic_id")
105
111
  */
106
- removeDefaultPreferencesForTopic(tenantId: string, topicId: string, requestOptions?: Tenants.RequestOptions): Promise<void>;
112
+ removeDefaultPreferencesForTopic(tenantId: string, topicId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
113
+ private __removeDefaultPreferencesForTopic;
107
114
  protected _getAuthorizationHeader(): Promise<string>;
108
115
  }