@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
@@ -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.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),
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.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),
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 _response.body;
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.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),
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 _response.body;
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.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),
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.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),
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 _response.body;
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.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),
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): Promise<Courier.ProfileGetResponse>;
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): Promise<Courier.MergeProfileResponse>;
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): Promise<Courier.ReplaceProfileResponse>;
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): Promise<void>;
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): Promise<void>;
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): Promise<Courier.GetListSubscriptionsResponse>;
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): Promise<Courier.SubscribeToListsResponse>;
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): Promise<Courier.DeleteListSubscriptionResponse>;
169
+ deleteListSubscription(userId: string, requestOptions?: Profiles.RequestOptions): core.HttpResponsePromise<Courier.DeleteListSubscriptionResponse>;
170
+ private __deleteListSubscription;
163
171
  protected _getAuthorizationHeader(): Promise<string>;
164
172
  }