@trycourier/courier 6.0.4 → 6.0.6

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 (141) hide show
  1. package/Client.js +1 -1
  2. package/api/resources/audiences/client/Client.d.ts +1 -1
  3. package/api/resources/audiences/client/Client.js +6 -6
  4. package/api/resources/auditEvents/client/Client.js +2 -2
  5. package/api/resources/authTokens/client/Client.js +1 -1
  6. package/api/resources/automations/client/Client.js +2 -2
  7. package/api/resources/brands/client/Client.js +5 -5
  8. package/api/resources/brands/types/BrandSettings.d.ts +1 -0
  9. package/api/resources/bulk/client/Client.js +6 -6
  10. package/api/resources/commons/types/ChannelClassification.d.ts +3 -1
  11. package/api/resources/commons/types/ChannelClassification.js +2 -0
  12. package/api/resources/{users/resources/tenants → commons}/types/UserTenantAssociation.d.ts +4 -1
  13. package/api/resources/commons/types/index.d.ts +1 -0
  14. package/api/resources/commons/types/index.js +1 -0
  15. package/api/resources/lists/client/Client.js +10 -10
  16. package/api/resources/messages/client/Client.js +7 -7
  17. package/api/resources/notifications/client/Client.js +8 -8
  18. package/api/resources/profiles/client/Client.js +7 -7
  19. package/api/resources/profiles/types/Intercom.d.ts +1 -1
  20. package/api/resources/profiles/types/{IntercomeRecipient.d.ts → IntercomRecipient.d.ts} +1 -1
  21. package/api/resources/profiles/types/MsTeams.d.ts +1 -1
  22. package/api/resources/profiles/types/{SendToMsTeamsUser.d.ts → MsTeamsBaseProperties.d.ts} +1 -2
  23. package/api/resources/profiles/types/SendToMsTeamsChannelId.d.ts +7 -0
  24. package/api/resources/profiles/types/SendToMsTeamsChannelName.d.ts +8 -0
  25. package/api/resources/profiles/types/SendToMsTeamsConversationId.d.ts +7 -0
  26. package/api/resources/profiles/types/SendToMsTeamsEmail.d.ts +7 -0
  27. package/api/resources/profiles/types/SendToMsTeamsUserId.d.ts +7 -0
  28. package/api/resources/profiles/types/SendToSlackChannel.d.ts +7 -0
  29. package/api/resources/profiles/types/SendToSlackChannel.js +5 -0
  30. package/api/resources/profiles/types/SendToSlackEmail.d.ts +7 -0
  31. package/api/resources/profiles/types/SendToSlackEmail.js +5 -0
  32. package/api/resources/profiles/types/SendToSlackUserId.d.ts +7 -0
  33. package/api/resources/profiles/types/SendToSlackUserId.js +5 -0
  34. package/api/resources/profiles/types/Slack.d.ts +5 -0
  35. package/api/resources/profiles/types/Slack.js +5 -0
  36. package/api/resources/profiles/types/SlackBaseProperties.d.ts +6 -0
  37. package/api/resources/profiles/types/SlackBaseProperties.js +5 -0
  38. package/api/resources/profiles/types/UserProfile.d.ts +1 -0
  39. package/api/resources/profiles/types/index.d.ts +12 -3
  40. package/api/resources/profiles/types/index.js +12 -3
  41. package/api/resources/send/types/Recipient.d.ts +1 -1
  42. package/api/resources/templates/client/Client.js +1 -1
  43. package/api/resources/tenants/client/Client.d.ts +4 -0
  44. package/api/resources/tenants/client/Client.js +52 -4
  45. package/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +23 -0
  46. package/api/resources/tenants/types/ListUsersForTenantResponse.js +5 -0
  47. package/api/resources/tenants/types/TenantListResponse.d.ts +2 -2
  48. package/api/resources/tenants/types/index.d.ts +1 -0
  49. package/api/resources/tenants/types/index.js +1 -0
  50. package/api/resources/translations/client/Client.js +2 -2
  51. package/api/resources/users/resources/preferences/client/Client.d.ts +1 -1
  52. package/api/resources/users/resources/preferences/client/Client.js +4 -4
  53. package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +1 -1
  54. package/api/resources/users/resources/preferences/types/TopicPreference.d.ts +1 -1
  55. package/api/resources/users/resources/tenants/client/Client.js +4 -4
  56. package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +1 -1
  57. package/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  58. package/api/resources/users/resources/tenants/types/index.d.ts +0 -1
  59. package/api/resources/users/resources/tenants/types/index.js +0 -1
  60. package/api/resources/users/resources/tokens/client/Client.js +5 -5
  61. package/core/fetcher/Fetcher.js +16 -13
  62. package/dist/Client.js +1 -1
  63. package/dist/api/resources/audiences/client/Client.d.ts +1 -1
  64. package/dist/api/resources/audiences/client/Client.js +6 -6
  65. package/dist/api/resources/auditEvents/client/Client.js +2 -2
  66. package/dist/api/resources/authTokens/client/Client.js +1 -1
  67. package/dist/api/resources/automations/client/Client.js +2 -2
  68. package/dist/api/resources/brands/client/Client.js +5 -5
  69. package/dist/api/resources/brands/types/BrandSettings.d.ts +1 -0
  70. package/dist/api/resources/bulk/client/Client.js +6 -6
  71. package/dist/api/resources/commons/types/ChannelClassification.d.ts +3 -1
  72. package/dist/api/resources/commons/types/ChannelClassification.js +2 -0
  73. package/dist/api/resources/{users/resources/tenants → commons}/types/UserTenantAssociation.d.ts +4 -1
  74. package/dist/api/resources/commons/types/UserTenantAssociation.js +5 -0
  75. package/dist/api/resources/commons/types/index.d.ts +1 -0
  76. package/dist/api/resources/commons/types/index.js +1 -0
  77. package/dist/api/resources/lists/client/Client.js +10 -10
  78. package/dist/api/resources/messages/client/Client.js +7 -7
  79. package/dist/api/resources/notifications/client/Client.js +8 -8
  80. package/dist/api/resources/profiles/client/Client.js +7 -7
  81. package/dist/api/resources/profiles/types/Intercom.d.ts +1 -1
  82. package/dist/api/resources/profiles/types/{IntercomeRecipient.d.ts → IntercomRecipient.d.ts} +1 -1
  83. package/dist/api/resources/profiles/types/IntercomRecipient.js +5 -0
  84. package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
  85. package/dist/api/resources/profiles/types/{SendToMsTeamsUser.d.ts → MsTeamsBaseProperties.d.ts} +1 -2
  86. package/dist/api/resources/profiles/types/MsTeamsBaseProperties.js +5 -0
  87. package/dist/api/resources/profiles/types/SendToMsTeamsChannelId.d.ts +7 -0
  88. package/dist/api/resources/profiles/types/SendToMsTeamsChannelId.js +5 -0
  89. package/dist/api/resources/profiles/types/SendToMsTeamsChannelName.d.ts +8 -0
  90. package/dist/api/resources/profiles/types/SendToMsTeamsChannelName.js +5 -0
  91. package/dist/api/resources/profiles/types/SendToMsTeamsConversationId.d.ts +7 -0
  92. package/dist/api/resources/profiles/types/SendToMsTeamsConversationId.js +5 -0
  93. package/dist/api/resources/profiles/types/SendToMsTeamsEmail.d.ts +7 -0
  94. package/dist/api/resources/profiles/types/SendToMsTeamsEmail.js +5 -0
  95. package/dist/api/resources/profiles/types/SendToMsTeamsUserId.d.ts +7 -0
  96. package/dist/api/resources/profiles/types/SendToMsTeamsUserId.js +5 -0
  97. package/dist/api/resources/profiles/types/SendToSlackChannel.d.ts +7 -0
  98. package/dist/api/resources/profiles/types/SendToSlackChannel.js +5 -0
  99. package/dist/api/resources/profiles/types/SendToSlackEmail.d.ts +7 -0
  100. package/dist/api/resources/profiles/types/SendToSlackEmail.js +5 -0
  101. package/dist/api/resources/profiles/types/SendToSlackUserId.d.ts +7 -0
  102. package/dist/api/resources/profiles/types/SendToSlackUserId.js +5 -0
  103. package/dist/api/resources/profiles/types/Slack.d.ts +5 -0
  104. package/dist/api/resources/profiles/types/Slack.js +5 -0
  105. package/dist/api/resources/profiles/types/SlackBaseProperties.d.ts +6 -0
  106. package/dist/api/resources/profiles/types/SlackBaseProperties.js +5 -0
  107. package/dist/api/resources/profiles/types/UserProfile.d.ts +1 -0
  108. package/dist/api/resources/profiles/types/index.d.ts +12 -3
  109. package/dist/api/resources/profiles/types/index.js +12 -3
  110. package/dist/api/resources/send/types/Recipient.d.ts +1 -1
  111. package/dist/api/resources/templates/client/Client.js +1 -1
  112. package/dist/api/resources/tenants/client/Client.d.ts +4 -0
  113. package/dist/api/resources/tenants/client/Client.js +52 -4
  114. package/dist/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +23 -0
  115. package/dist/api/resources/tenants/types/ListUsersForTenantResponse.js +5 -0
  116. package/dist/api/resources/tenants/types/TenantListResponse.d.ts +2 -2
  117. package/dist/api/resources/tenants/types/index.d.ts +1 -0
  118. package/dist/api/resources/tenants/types/index.js +1 -0
  119. package/dist/api/resources/translations/client/Client.js +2 -2
  120. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +1 -1
  121. package/dist/api/resources/users/resources/preferences/client/Client.js +4 -4
  122. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +1 -1
  123. package/dist/api/resources/users/resources/preferences/types/TopicPreference.d.ts +1 -1
  124. package/dist/api/resources/users/resources/tenants/client/Client.js +4 -4
  125. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +1 -1
  126. package/dist/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  127. package/dist/api/resources/users/resources/tenants/types/index.d.ts +0 -1
  128. package/dist/api/resources/users/resources/tenants/types/index.js +0 -1
  129. package/dist/api/resources/users/resources/tokens/client/Client.js +5 -5
  130. package/dist/core/fetcher/Fetcher.js +16 -13
  131. package/package.json +1 -1
  132. package/api/resources/profiles/types/SendToMsTeamsChannel.d.ts +0 -8
  133. package/dist/api/resources/profiles/types/SendToMsTeamsChannel.d.ts +0 -8
  134. /package/api/resources/{users/resources/tenants → commons}/types/UserTenantAssociation.js +0 -0
  135. /package/api/resources/profiles/types/{IntercomeRecipient.js → IntercomRecipient.js} +0 -0
  136. /package/api/resources/profiles/types/{SendToMsTeamsChannel.js → MsTeamsBaseProperties.js} +0 -0
  137. /package/api/resources/profiles/types/{SendToMsTeamsUser.js → SendToMsTeamsChannelId.js} +0 -0
  138. /package/{dist/api/resources/profiles/types/IntercomeRecipient.js → api/resources/profiles/types/SendToMsTeamsChannelName.js} +0 -0
  139. /package/{dist/api/resources/profiles/types/SendToMsTeamsChannel.js → api/resources/profiles/types/SendToMsTeamsConversationId.js} +0 -0
  140. /package/{dist/api/resources/profiles/types/SendToMsTeamsUser.js → api/resources/profiles/types/SendToMsTeamsEmail.js} +0 -0
  141. /package/{dist/api/resources/users/resources/tenants/types/UserTenantAssociation.js → api/resources/profiles/types/SendToMsTeamsUserId.js} +0 -0
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface SendToMsTeamsEmail extends Courier.MsTeamsBaseProperties {
6
+ email: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface SendToMsTeamsUserId extends Courier.MsTeamsBaseProperties {
6
+ user_id: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface SendToSlackChannel extends Courier.SlackBaseProperties {
6
+ channel: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface SendToSlackEmail extends Courier.SlackBaseProperties {
6
+ email: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface SendToSlackUserId extends Courier.SlackBaseProperties {
6
+ user_id: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export declare type Slack = Courier.SendToSlackChannel | Courier.SendToSlackEmail | Courier.SendToSlackUserId;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface SlackBaseProperties {
5
+ access_token: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -33,5 +33,6 @@ export interface UserProfile {
33
33
  facebookPSID: string;
34
34
  firebaseToken: string;
35
35
  intercom: Courier.Intercom;
36
+ slack: Courier.Slack;
36
37
  ms_teams: Courier.MsTeams;
37
38
  }
@@ -12,10 +12,19 @@ export * from "./Expo";
12
12
  export * from "./Token";
13
13
  export * from "./MultipleTokens";
14
14
  export * from "./Intercom";
15
- export * from "./IntercomeRecipient";
15
+ export * from "./IntercomRecipient";
16
+ export * from "./Slack";
17
+ export * from "./SlackBaseProperties";
18
+ export * from "./SendToSlackChannel";
19
+ export * from "./SendToSlackEmail";
20
+ export * from "./SendToSlackUserId";
16
21
  export * from "./MsTeams";
17
- export * from "./SendToMsTeamsUser";
18
- export * from "./SendToMsTeamsChannel";
22
+ export * from "./MsTeamsBaseProperties";
23
+ export * from "./SendToMsTeamsUserId";
24
+ export * from "./SendToMsTeamsEmail";
25
+ export * from "./SendToMsTeamsConversationId";
26
+ export * from "./SendToMsTeamsChannelId";
27
+ export * from "./SendToMsTeamsChannelName";
19
28
  export * from "./ProfileGetParameters";
20
29
  export * from "./ProfileGetResponse";
21
30
  export * from "./MergeProfileResponse";
@@ -28,10 +28,19 @@ __exportStar(require("./Expo"), exports);
28
28
  __exportStar(require("./Token"), exports);
29
29
  __exportStar(require("./MultipleTokens"), exports);
30
30
  __exportStar(require("./Intercom"), exports);
31
- __exportStar(require("./IntercomeRecipient"), exports);
31
+ __exportStar(require("./IntercomRecipient"), exports);
32
+ __exportStar(require("./Slack"), exports);
33
+ __exportStar(require("./SlackBaseProperties"), exports);
34
+ __exportStar(require("./SendToSlackChannel"), exports);
35
+ __exportStar(require("./SendToSlackEmail"), exports);
36
+ __exportStar(require("./SendToSlackUserId"), exports);
32
37
  __exportStar(require("./MsTeams"), exports);
33
- __exportStar(require("./SendToMsTeamsUser"), exports);
34
- __exportStar(require("./SendToMsTeamsChannel"), exports);
38
+ __exportStar(require("./MsTeamsBaseProperties"), exports);
39
+ __exportStar(require("./SendToMsTeamsUserId"), exports);
40
+ __exportStar(require("./SendToMsTeamsEmail"), exports);
41
+ __exportStar(require("./SendToMsTeamsConversationId"), exports);
42
+ __exportStar(require("./SendToMsTeamsChannelId"), exports);
43
+ __exportStar(require("./SendToMsTeamsChannelName"), exports);
35
44
  __exportStar(require("./ProfileGetParameters"), exports);
36
45
  __exportStar(require("./ProfileGetResponse"), exports);
37
46
  __exportStar(require("./MergeProfileResponse"), exports);
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Courier from "../../..";
5
- export declare type Recipient = Courier.AudienceRecipient | Courier.ListRecipient | Courier.ListPatternRecipient | Courier.UserRecipient;
5
+ export declare type Recipient = Courier.AudienceRecipient | Courier.ListRecipient | Courier.ListPatternRecipient | Courier.UserRecipient | Courier.Slack | Courier.MsTeams;
@@ -65,7 +65,7 @@ class Templates {
65
65
  Authorization: yield this._getAuthorizationHeader(),
66
66
  "X-Fern-Language": "JavaScript",
67
67
  "X-Fern-SDK-Name": "@trycourier/courier",
68
- "X-Fern-SDK-Version": "v6.0.4",
68
+ "X-Fern-SDK-Version": "v6.0.6",
69
69
  },
70
70
  contentType: "application/json",
71
71
  queryParameters: _queryParams,
@@ -27,5 +27,9 @@ export declare class Tenants {
27
27
  get(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise<Courier.Tenant>;
28
28
  list(requestOptions?: Tenants.RequestOptions): Promise<Courier.TenantListResponse>;
29
29
  delete(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise<void>;
30
+ /**
31
+ * @throws {@link Courier.BadRequestError}
32
+ */
33
+ getUsersByTenant(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise<Courier.ListUsersForTenantResponse>;
30
34
  protected _getAuthorizationHeader(): Promise<string>;
31
35
  }
@@ -61,7 +61,7 @@ class Tenants {
61
61
  Authorization: yield this._getAuthorizationHeader(),
62
62
  "X-Fern-Language": "JavaScript",
63
63
  "X-Fern-SDK-Name": "@trycourier/courier",
64
- "X-Fern-SDK-Version": "v6.0.4",
64
+ "X-Fern-SDK-Version": "v6.0.6",
65
65
  },
66
66
  contentType: "application/json",
67
67
  body: request,
@@ -110,7 +110,7 @@ class Tenants {
110
110
  Authorization: yield this._getAuthorizationHeader(),
111
111
  "X-Fern-Language": "JavaScript",
112
112
  "X-Fern-SDK-Name": "@trycourier/courier",
113
- "X-Fern-SDK-Version": "v6.0.4",
113
+ "X-Fern-SDK-Version": "v6.0.6",
114
114
  },
115
115
  contentType: "application/json",
116
116
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -155,7 +155,7 @@ class Tenants {
155
155
  Authorization: yield this._getAuthorizationHeader(),
156
156
  "X-Fern-Language": "JavaScript",
157
157
  "X-Fern-SDK-Name": "@trycourier/courier",
158
- "X-Fern-SDK-Version": "v6.0.4",
158
+ "X-Fern-SDK-Version": "v6.0.6",
159
159
  },
160
160
  contentType: "application/json",
161
161
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -195,7 +195,7 @@ class Tenants {
195
195
  Authorization: yield this._getAuthorizationHeader(),
196
196
  "X-Fern-Language": "JavaScript",
197
197
  "X-Fern-SDK-Name": "@trycourier/courier",
198
- "X-Fern-SDK-Version": "v6.0.4",
198
+ "X-Fern-SDK-Version": "v6.0.6",
199
199
  },
200
200
  contentType: "application/json",
201
201
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -225,6 +225,54 @@ class Tenants {
225
225
  }
226
226
  });
227
227
  }
228
+ /**
229
+ * @throws {@link Courier.BadRequestError}
230
+ */
231
+ getUsersByTenant(tenantId, requestOptions) {
232
+ var _a;
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ const _response = yield core.fetcher({
235
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.CourierEnvironment.Production, `/tenants/${tenantId}/users`),
236
+ method: "GET",
237
+ headers: {
238
+ Authorization: yield this._getAuthorizationHeader(),
239
+ "X-Fern-Language": "JavaScript",
240
+ "X-Fern-SDK-Name": "@trycourier/courier",
241
+ "X-Fern-SDK-Version": "v6.0.6",
242
+ },
243
+ contentType: "application/json",
244
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
245
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
246
+ });
247
+ if (_response.ok) {
248
+ return _response.body;
249
+ }
250
+ if (_response.error.reason === "status-code") {
251
+ switch (_response.error.statusCode) {
252
+ case 400:
253
+ throw new Courier.BadRequestError(_response.error.body);
254
+ default:
255
+ throw new errors.CourierError({
256
+ statusCode: _response.error.statusCode,
257
+ body: _response.error.body,
258
+ });
259
+ }
260
+ }
261
+ switch (_response.error.reason) {
262
+ case "non-json":
263
+ throw new errors.CourierError({
264
+ statusCode: _response.error.statusCode,
265
+ body: _response.error.rawBody,
266
+ });
267
+ case "timeout":
268
+ throw new errors.CourierTimeoutError();
269
+ case "unknown":
270
+ throw new errors.CourierError({
271
+ message: _response.error.errorMessage,
272
+ });
273
+ }
274
+ });
275
+ }
228
276
  _getAuthorizationHeader() {
229
277
  var _a;
230
278
  return __awaiter(this, void 0, void 0, function* () {
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../..";
5
+ export interface ListUsersForTenantResponse {
6
+ items?: Courier.UserTenantAssociation;
7
+ /** Set to true when there are more pages that can be retrieved. */
8
+ has_more: boolean;
9
+ /** A url that may be used to generate these results. */
10
+ url: string;
11
+ /**
12
+ * A url that may be used to generate fetch the next set of results.
13
+ * Defined only when `has_more` is set to true
14
+ */
15
+ next_url?: string;
16
+ /**
17
+ * A pointer to the next page of results. Defined
18
+ * only when `has_more` is set to true
19
+ */
20
+ cursor?: string;
21
+ /** Always set to `list`. Represents the type of this object. */
22
+ type: "list";
23
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Courier from "../../..";
5
5
  export interface TenantListResponse {
6
- /** A pointer to the next page of results. Defined only whenhas_more is set to true. */
6
+ /** A pointer to the next page of results. Defined only when has_more is set to true. */
7
7
  cursor?: string;
8
8
  /** Set to true when there are more pages that can be retrieved. */
9
9
  has_more: boolean;
@@ -11,7 +11,7 @@ export interface TenantListResponse {
11
11
  items: Courier.Tenant[];
12
12
  /**
13
13
  * A url that may be used to generate fetch the next set of results.
14
- * Defined only whenhas_more is set to true
14
+ * Defined only when has_more is set to true
15
15
  */
16
16
  next_url?: string;
17
17
  /** A url that may be used to generate these results. */
@@ -3,4 +3,5 @@ export * from "./SubscriptionTopic";
3
3
  export * from "./SubscriptionTopicStatus";
4
4
  export * from "./Tenant";
5
5
  export * from "./TenantListResponse";
6
+ export * from "./ListUsersForTenantResponse";
6
7
  export * from "./TemplateProperty";
@@ -19,4 +19,5 @@ __exportStar(require("./SubscriptionTopic"), exports);
19
19
  __exportStar(require("./SubscriptionTopicStatus"), exports);
20
20
  __exportStar(require("./Tenant"), exports);
21
21
  __exportStar(require("./TenantListResponse"), exports);
22
+ __exportStar(require("./ListUsersForTenantResponse"), exports);
22
23
  __exportStar(require("./TemplateProperty"), exports);
@@ -62,7 +62,7 @@ class Translations {
62
62
  Authorization: yield this._getAuthorizationHeader(),
63
63
  "X-Fern-Language": "JavaScript",
64
64
  "X-Fern-SDK-Name": "@trycourier/courier",
65
- "X-Fern-SDK-Version": "v6.0.4",
65
+ "X-Fern-SDK-Version": "v6.0.6",
66
66
  },
67
67
  contentType: "application/json",
68
68
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -111,7 +111,7 @@ class Translations {
111
111
  Authorization: yield this._getAuthorizationHeader(),
112
112
  "X-Fern-Language": "JavaScript",
113
113
  "X-Fern-SDK-Name": "@trycourier/courier",
114
- "X-Fern-SDK-Version": "v6.0.4",
114
+ "X-Fern-SDK-Version": "v6.0.6",
115
115
  },
116
116
  contentType: "application/json",
117
117
  body: request,
@@ -28,7 +28,7 @@ export declare class Preferences {
28
28
  */
29
29
  get(userId: string, topicId: string, requestOptions?: Preferences.RequestOptions): Promise<Courier.users.UserPreferencesGetResponse>;
30
30
  /**
31
- * Fetch user preferences for a specific subscription topic.
31
+ * Update or Create user preferences for a specific subscription topic.
32
32
  * @throws {@link Courier.BadRequestError}
33
33
  */
34
34
  update(userId: string, topicId: string, request: Courier.users.UserPreferencesUpdateParams, requestOptions?: Preferences.RequestOptions): Promise<Courier.users.UserPreferencesUpdateResponse>;
@@ -62,7 +62,7 @@ class Preferences {
62
62
  Authorization: yield this._getAuthorizationHeader(),
63
63
  "X-Fern-Language": "JavaScript",
64
64
  "X-Fern-SDK-Name": "@trycourier/courier",
65
- "X-Fern-SDK-Version": "v6.0.4",
65
+ "X-Fern-SDK-Version": "v6.0.6",
66
66
  },
67
67
  contentType: "application/json",
68
68
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -111,7 +111,7 @@ class Preferences {
111
111
  Authorization: yield this._getAuthorizationHeader(),
112
112
  "X-Fern-Language": "JavaScript",
113
113
  "X-Fern-SDK-Name": "@trycourier/courier",
114
- "X-Fern-SDK-Version": "v6.0.4",
114
+ "X-Fern-SDK-Version": "v6.0.6",
115
115
  },
116
116
  contentType: "application/json",
117
117
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -147,7 +147,7 @@ class Preferences {
147
147
  });
148
148
  }
149
149
  /**
150
- * Fetch user preferences for a specific subscription topic.
150
+ * Update or Create user preferences for a specific subscription topic.
151
151
  * @throws {@link Courier.BadRequestError}
152
152
  */
153
153
  update(userId, topicId, request, requestOptions) {
@@ -160,7 +160,7 @@ class Preferences {
160
160
  Authorization: yield this._getAuthorizationHeader(),
161
161
  "X-Fern-Language": "JavaScript",
162
162
  "X-Fern-SDK-Name": "@trycourier/courier",
163
- "X-Fern-SDK-Version": "v6.0.4",
163
+ "X-Fern-SDK-Version": "v6.0.6",
164
164
  },
165
165
  contentType: "application/json",
166
166
  body: request,
@@ -4,7 +4,7 @@
4
4
  import * as Courier from "../../../../../..";
5
5
  export interface UserPreferencesUpdateParams {
6
6
  status: Courier.PreferenceStatus;
7
- /** Should contain unique items. */
7
+ /** The Channels a user has chosen to receive notifications through for this topic */
8
8
  custom_routing?: Courier.ChannelClassification[];
9
9
  default_status: Courier.PreferenceStatus;
10
10
  has_custom_routing?: boolean;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Courier from "../../../../..";
5
5
  export interface TopicPreference {
6
- /** Should contain unique items. */
6
+ /** The Channels a user has chosen to receive notifications through for this topic */
7
7
  custom_routing?: Courier.ChannelClassification[];
8
8
  default_status: Courier.PreferenceStatus;
9
9
  has_custom_routing?: boolean;
@@ -64,7 +64,7 @@ class Tenants {
64
64
  Authorization: yield this._getAuthorizationHeader(),
65
65
  "X-Fern-Language": "JavaScript",
66
66
  "X-Fern-SDK-Name": "@trycourier/courier",
67
- "X-Fern-SDK-Version": "v6.0.4",
67
+ "X-Fern-SDK-Version": "v6.0.6",
68
68
  },
69
69
  contentType: "application/json",
70
70
  body: request,
@@ -112,7 +112,7 @@ class Tenants {
112
112
  Authorization: yield this._getAuthorizationHeader(),
113
113
  "X-Fern-Language": "JavaScript",
114
114
  "X-Fern-SDK-Name": "@trycourier/courier",
115
- "X-Fern-SDK-Version": "v6.0.4",
115
+ "X-Fern-SDK-Version": "v6.0.6",
116
116
  },
117
117
  contentType: "application/json",
118
118
  body: request,
@@ -156,7 +156,7 @@ class Tenants {
156
156
  Authorization: yield this._getAuthorizationHeader(),
157
157
  "X-Fern-Language": "JavaScript",
158
158
  "X-Fern-SDK-Name": "@trycourier/courier",
159
- "X-Fern-SDK-Version": "v6.0.4",
159
+ "X-Fern-SDK-Version": "v6.0.6",
160
160
  },
161
161
  contentType: "application/json",
162
162
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -207,7 +207,7 @@ class Tenants {
207
207
  Authorization: yield this._getAuthorizationHeader(),
208
208
  "X-Fern-Language": "JavaScript",
209
209
  "X-Fern-SDK-Name": "@trycourier/courier",
210
- "X-Fern-SDK-Version": "v6.0.4",
210
+ "X-Fern-SDK-Version": "v6.0.6",
211
211
  },
212
212
  contentType: "application/json",
213
213
  queryParameters: _queryParams,
@@ -3,5 +3,5 @@
3
3
  */
4
4
  import * as Courier from "../../../../../..";
5
5
  export interface AddUserToMultipleTenantsParams {
6
- tenants: Courier.users.UserTenantAssociation[];
6
+ tenants: Courier.UserTenantAssociation[];
7
7
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Courier from "../../../../..";
5
5
  export interface ListTenantsForUserResponse {
6
- items?: Courier.users.UserTenantAssociation;
6
+ items?: Courier.UserTenantAssociation;
7
7
  /** Set to true when there are more pages that can be retrieved. */
8
8
  has_more: boolean;
9
9
  /** A url that may be used to generate these results. */
@@ -1,3 +1,2 @@
1
1
  export * from "./AddUserToSingleTenantsParamsProfile";
2
- export * from "./UserTenantAssociation";
3
2
  export * from "./ListTenantsForUserResponse";
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AddUserToSingleTenantsParamsProfile"), exports);
18
- __exportStar(require("./UserTenantAssociation"), exports);
19
18
  __exportStar(require("./ListTenantsForUserResponse"), exports);
@@ -62,7 +62,7 @@ class Tokens {
62
62
  Authorization: yield this._getAuthorizationHeader(),
63
63
  "X-Fern-Language": "JavaScript",
64
64
  "X-Fern-SDK-Name": "@trycourier/courier",
65
- "X-Fern-SDK-Version": "v6.0.4",
65
+ "X-Fern-SDK-Version": "v6.0.6",
66
66
  },
67
67
  contentType: "application/json",
68
68
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -111,7 +111,7 @@ class Tokens {
111
111
  Authorization: yield this._getAuthorizationHeader(),
112
112
  "X-Fern-Language": "JavaScript",
113
113
  "X-Fern-SDK-Name": "@trycourier/courier",
114
- "X-Fern-SDK-Version": "v6.0.4",
114
+ "X-Fern-SDK-Version": "v6.0.6",
115
115
  },
116
116
  contentType: "application/json",
117
117
  body: request,
@@ -161,7 +161,7 @@ class Tokens {
161
161
  Authorization: yield this._getAuthorizationHeader(),
162
162
  "X-Fern-Language": "JavaScript",
163
163
  "X-Fern-SDK-Name": "@trycourier/courier",
164
- "X-Fern-SDK-Version": "v6.0.4",
164
+ "X-Fern-SDK-Version": "v6.0.6",
165
165
  },
166
166
  contentType: "application/json",
167
167
  body: request,
@@ -211,7 +211,7 @@ class Tokens {
211
211
  Authorization: yield this._getAuthorizationHeader(),
212
212
  "X-Fern-Language": "JavaScript",
213
213
  "X-Fern-SDK-Name": "@trycourier/courier",
214
- "X-Fern-SDK-Version": "v6.0.4",
214
+ "X-Fern-SDK-Version": "v6.0.6",
215
215
  },
216
216
  contentType: "application/json",
217
217
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -260,7 +260,7 @@ class Tokens {
260
260
  Authorization: yield this._getAuthorizationHeader(),
261
261
  "X-Fern-Language": "JavaScript",
262
262
  "X-Fern-SDK-Name": "@trycourier/courier",
263
- "X-Fern-SDK-Version": "v6.0.4",
263
+ "X-Fern-SDK-Version": "v6.0.6",
264
264
  },
265
265
  contentType: "application/json",
266
266
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -86,19 +86,22 @@ function fetcherImpl(args) {
86
86
  else if (response.body != null && args.responseType === "streaming") {
87
87
  body = response.body;
88
88
  }
89
- else if (response.body != null) {
90
- try {
91
- body = yield response.json();
92
- }
93
- catch (err) {
94
- return {
95
- ok: false,
96
- error: {
97
- reason: "non-json",
98
- statusCode: response.status,
99
- rawBody: yield response.text(),
100
- },
101
- };
89
+ else {
90
+ const text = yield response.text();
91
+ if (text.length > 0) {
92
+ try {
93
+ body = JSON.parse(text);
94
+ }
95
+ catch (err) {
96
+ return {
97
+ ok: false,
98
+ error: {
99
+ reason: "non-json",
100
+ statusCode: response.status,
101
+ rawBody: text,
102
+ },
103
+ };
104
+ }
102
105
  }
103
106
  }
104
107
  if (response.status >= 200 && response.status < 400) {
package/dist/Client.js CHANGED
@@ -74,7 +74,7 @@ class CourierClient {
74
74
  Authorization: yield this._getAuthorizationHeader(),
75
75
  "X-Fern-Language": "JavaScript",
76
76
  "X-Fern-SDK-Name": "@trycourier/courier",
77
- "X-Fern-SDK-Version": "v6.0.4",
77
+ "X-Fern-SDK-Version": "v6.0.6",
78
78
  "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
79
79
  "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null
80
80
  ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry.toString()
@@ -26,7 +26,7 @@ export declare class Audiences {
26
26
  */
27
27
  update(audienceId: string, request?: Courier.AudienceUpdateParams, requestOptions?: Audiences.RequestOptions): Promise<Courier.AudienceUpdateResponse>;
28
28
  /**
29
- * Deletes the specified recipient Profile.
29
+ * Deletes the specified audience.
30
30
  */
31
31
  delete(audienceId: string, requestOptions?: Audiences.RequestOptions): Promise<void>;
32
32
  /**