@trycourier/courier 6.0.8 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/Client.js +1 -1
  2. package/README.md +5 -5
  3. package/api/resources/audiences/client/Client.js +5 -5
  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.d.ts +15 -0
  7. package/api/resources/automations/client/Client.js +17 -2
  8. package/{dist/api/resources/lists/types/ListGetSubscriptionsParams.d.ts → api/resources/automations/types/AccessorType.d.ts} +2 -2
  9. package/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +4 -0
  10. package/api/resources/automations/types/AutomationAddToBatchRetain.d.ts +34 -0
  11. package/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +10 -0
  12. package/api/resources/automations/types/AutomationAddToBatchRetainType.js +12 -0
  13. package/api/resources/automations/types/AutomationAddToBatchScope.d.ts +9 -0
  14. package/api/resources/automations/types/AutomationAddToBatchScope.js +11 -0
  15. package/api/resources/automations/types/AutomationAddToBatchStep.d.ts +39 -0
  16. package/api/resources/automations/types/AutomationAddToDigestStep.d.ts +16 -0
  17. package/api/resources/automations/types/AutomationDelayStep.d.ts +3 -0
  18. package/api/resources/automations/types/AutomationFetchDataStep.d.ts +31 -0
  19. package/api/resources/automations/types/AutomationFetchDataWebhook.d.ts +11 -0
  20. package/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +8 -0
  21. package/api/resources/automations/types/AutomationFetchDataWebhookMethod.js +10 -0
  22. package/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  23. package/api/resources/automations/types/AutomationThrottleOnThrottle.d.ts +7 -0
  24. package/api/resources/automations/types/AutomationThrottleScope.d.ts +9 -0
  25. package/api/resources/automations/types/AutomationThrottleScope.js +11 -0
  26. package/api/resources/automations/types/AutomationThrottleStep.d.ts +31 -0
  27. package/api/resources/automations/types/index.d.ts +13 -1
  28. package/api/resources/automations/types/index.js +13 -1
  29. package/api/resources/brands/client/Client.js +5 -5
  30. package/api/resources/bulk/client/Client.js +5 -5
  31. package/api/resources/lists/client/Client.d.ts +1 -1
  32. package/api/resources/lists/client/Client.js +11 -20
  33. package/api/resources/lists/client/requests/index.d.ts +0 -1
  34. package/api/resources/lists/types/index.d.ts +0 -5
  35. package/api/resources/lists/types/index.js +0 -5
  36. package/api/resources/messages/client/Client.js +42 -12
  37. package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +23 -3
  38. package/api/resources/messages/types/MessageStatus.d.ts +4 -0
  39. package/api/resources/messages/types/MessageStatus.js +1 -0
  40. package/api/resources/notifications/client/Client.js +8 -8
  41. package/api/resources/profiles/client/Client.js +7 -7
  42. package/api/resources/send/types/BaseMessageSendTo.d.ts +8 -0
  43. package/api/resources/send/types/ContentMessage.d.ts +1 -3
  44. package/api/resources/send/types/Recipient.d.ts +1 -1
  45. package/api/resources/{lists/types/ListFindByRecipientIdParams.d.ts → send/types/RecipientData.d.ts} +1 -3
  46. package/api/resources/send/types/TemplateMessage.d.ts +1 -3
  47. package/api/resources/send/types/index.d.ts +2 -0
  48. package/api/resources/send/types/index.js +2 -0
  49. package/api/resources/templates/client/Client.js +1 -1
  50. package/api/resources/tenants/client/Client.d.ts +2 -2
  51. package/api/resources/tenants/client/Client.js +25 -7
  52. package/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
  53. package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
  54. package/api/resources/tenants/client/requests/ListUsersForTenantParams.js +5 -0
  55. package/api/resources/tenants/client/requests/index.d.ts +2 -0
  56. package/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
  57. package/api/resources/translations/client/Client.js +2 -2
  58. package/api/resources/users/resources/preferences/client/Client.d.ts +9 -0
  59. package/api/resources/users/resources/preferences/client/Client.js +12 -3
  60. package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +11 -5
  61. package/api/resources/users/resources/preferences/types/TopicPreferenceUpdate.d.ts +10 -0
  62. package/api/resources/users/resources/preferences/types/TopicPreferenceUpdate.js +5 -0
  63. package/api/resources/users/resources/preferences/types/index.d.ts +1 -0
  64. package/api/resources/users/resources/preferences/types/index.js +1 -0
  65. package/api/resources/users/resources/tenants/client/Client.js +8 -8
  66. package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
  67. package/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  68. package/api/resources/users/resources/tokens/client/Client.js +5 -5
  69. package/core/fetcher/Fetcher.js +3 -5
  70. package/dist/Client.js +1 -1
  71. package/dist/api/resources/audiences/client/Client.js +5 -5
  72. package/dist/api/resources/auditEvents/client/Client.js +2 -2
  73. package/dist/api/resources/authTokens/client/Client.js +1 -1
  74. package/dist/api/resources/automations/client/Client.d.ts +15 -0
  75. package/dist/api/resources/automations/client/Client.js +17 -2
  76. package/{api/resources/lists/types/ListGetSubscriptionsParams.d.ts → dist/api/resources/automations/types/AccessorType.d.ts} +2 -2
  77. package/dist/api/resources/automations/types/AccessorType.js +5 -0
  78. package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +4 -0
  79. package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.js +5 -0
  80. package/dist/api/resources/automations/types/AutomationAddToBatchRetain.d.ts +34 -0
  81. package/dist/api/resources/automations/types/AutomationAddToBatchRetain.js +5 -0
  82. package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +10 -0
  83. package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.js +12 -0
  84. package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +9 -0
  85. package/dist/api/resources/automations/types/AutomationAddToBatchScope.js +11 -0
  86. package/dist/api/resources/automations/types/AutomationAddToBatchStep.d.ts +39 -0
  87. package/dist/api/resources/automations/types/AutomationAddToBatchStep.js +5 -0
  88. package/dist/api/resources/automations/types/AutomationAddToDigestStep.d.ts +16 -0
  89. package/dist/api/resources/automations/types/AutomationAddToDigestStep.js +5 -0
  90. package/dist/api/resources/automations/types/AutomationDelayStep.d.ts +3 -0
  91. package/dist/api/resources/automations/types/AutomationFetchDataStep.d.ts +31 -0
  92. package/dist/api/resources/automations/types/AutomationFetchDataStep.js +5 -0
  93. package/dist/api/resources/automations/types/AutomationFetchDataWebhook.d.ts +11 -0
  94. package/dist/api/resources/automations/types/AutomationFetchDataWebhook.js +5 -0
  95. package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +8 -0
  96. package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.js +10 -0
  97. package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  98. package/dist/api/resources/automations/types/AutomationThrottleOnThrottle.d.ts +7 -0
  99. package/dist/api/resources/automations/types/AutomationThrottleOnThrottle.js +5 -0
  100. package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +9 -0
  101. package/dist/api/resources/automations/types/AutomationThrottleScope.js +11 -0
  102. package/dist/api/resources/automations/types/AutomationThrottleStep.d.ts +31 -0
  103. package/dist/api/resources/automations/types/AutomationThrottleStep.js +5 -0
  104. package/dist/api/resources/automations/types/index.d.ts +13 -1
  105. package/dist/api/resources/automations/types/index.js +13 -1
  106. package/dist/api/resources/brands/client/Client.js +5 -5
  107. package/dist/api/resources/bulk/client/Client.js +5 -5
  108. package/dist/api/resources/lists/client/Client.d.ts +1 -1
  109. package/dist/api/resources/lists/client/Client.js +11 -20
  110. package/dist/api/resources/lists/client/requests/index.d.ts +0 -1
  111. package/dist/api/resources/lists/types/index.d.ts +0 -5
  112. package/dist/api/resources/lists/types/index.js +0 -5
  113. package/dist/api/resources/messages/client/Client.js +42 -12
  114. package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +23 -3
  115. package/dist/api/resources/messages/types/MessageStatus.d.ts +4 -0
  116. package/dist/api/resources/messages/types/MessageStatus.js +1 -0
  117. package/dist/api/resources/notifications/client/Client.js +8 -8
  118. package/dist/api/resources/profiles/client/Client.js +7 -7
  119. package/dist/api/resources/send/types/BaseMessageSendTo.d.ts +8 -0
  120. package/dist/api/resources/send/types/BaseMessageSendTo.js +5 -0
  121. package/dist/api/resources/send/types/ContentMessage.d.ts +1 -3
  122. package/dist/api/resources/send/types/Recipient.d.ts +1 -1
  123. package/dist/api/resources/{lists/types/ListFindByRecipientIdParams.d.ts → send/types/RecipientData.d.ts} +1 -3
  124. package/dist/api/resources/send/types/RecipientData.js +5 -0
  125. package/dist/api/resources/send/types/TemplateMessage.d.ts +1 -3
  126. package/dist/api/resources/send/types/index.d.ts +2 -0
  127. package/dist/api/resources/send/types/index.js +2 -0
  128. package/dist/api/resources/templates/client/Client.js +1 -1
  129. package/dist/api/resources/tenants/client/Client.d.ts +2 -2
  130. package/dist/api/resources/tenants/client/Client.js +25 -7
  131. package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +14 -0
  132. package/dist/api/resources/tenants/client/requests/ListTenantParams.js +5 -0
  133. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +14 -0
  134. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.js +5 -0
  135. package/dist/api/resources/tenants/client/requests/index.d.ts +2 -0
  136. package/dist/api/resources/tenants/types/ListUsersForTenantResponse.d.ts +1 -1
  137. package/dist/api/resources/translations/client/Client.js +2 -2
  138. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +9 -0
  139. package/dist/api/resources/users/resources/preferences/client/Client.js +12 -3
  140. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +11 -5
  141. package/dist/api/resources/users/resources/preferences/types/TopicPreferenceUpdate.d.ts +10 -0
  142. package/dist/api/resources/users/resources/preferences/types/TopicPreferenceUpdate.js +5 -0
  143. package/dist/api/resources/users/resources/preferences/types/index.d.ts +1 -0
  144. package/dist/api/resources/users/resources/preferences/types/index.js +1 -0
  145. package/dist/api/resources/users/resources/tenants/client/Client.js +8 -8
  146. package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +2 -2
  147. package/dist/api/resources/users/resources/tenants/types/ListTenantsForUserResponse.d.ts +1 -1
  148. package/dist/api/resources/users/resources/tokens/client/Client.js +5 -5
  149. package/dist/core/fetcher/Fetcher.js +3 -5
  150. package/jest.config.js +5 -0
  151. package/package.json +6 -2
  152. package/tests/client.test.ts +11 -0
  153. package/api/resources/automations/types/AutomationStepAction.d.ts +0 -12
  154. package/api/resources/automations/types/AutomationStepAction.js +0 -14
  155. package/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
  156. package/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
  157. package/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
  158. package/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
  159. package/dist/api/resources/automations/types/AutomationStepAction.d.ts +0 -12
  160. package/dist/api/resources/automations/types/AutomationStepAction.js +0 -14
  161. package/dist/api/resources/lists/client/requests/GetListRequest.d.ts +0 -13
  162. package/dist/api/resources/lists/types/ListFindByRecipientIdResponse.d.ts +0 -8
  163. package/dist/api/resources/lists/types/ListGetAllParams.d.ts +0 -7
  164. package/dist/api/resources/lists/types/RecipientSubscriptionsResponse.d.ts +0 -8
  165. /package/api/resources/{lists/client/requests/GetListRequest.js → automations/types/AccessorType.js} +0 -0
  166. /package/api/resources/{lists/types/ListFindByRecipientIdParams.js → automations/types/AutomationAddToBatchMaxItemsType.js} +0 -0
  167. /package/api/resources/{lists/types/ListFindByRecipientIdResponse.js → automations/types/AutomationAddToBatchRetain.js} +0 -0
  168. /package/api/resources/{lists/types/ListGetAllParams.js → automations/types/AutomationAddToBatchStep.js} +0 -0
  169. /package/api/resources/{lists/types/ListGetSubscriptionsParams.js → automations/types/AutomationAddToDigestStep.js} +0 -0
  170. /package/api/resources/{lists/types/RecipientSubscriptionsResponse.js → automations/types/AutomationFetchDataStep.js} +0 -0
  171. /package/{dist/api/resources/lists/client/requests/GetListRequest.js → api/resources/automations/types/AutomationFetchDataWebhook.js} +0 -0
  172. /package/{dist/api/resources/lists/types/ListFindByRecipientIdParams.js → api/resources/automations/types/AutomationThrottleOnThrottle.js} +0 -0
  173. /package/{dist/api/resources/lists/types/ListFindByRecipientIdResponse.js → api/resources/automations/types/AutomationThrottleStep.js} +0 -0
  174. /package/{dist/api/resources/lists/types/ListGetAllParams.js → api/resources/send/types/BaseMessageSendTo.js} +0 -0
  175. /package/{dist/api/resources/lists/types/ListGetSubscriptionsParams.js → api/resources/send/types/RecipientData.js} +0 -0
  176. /package/{dist/api/resources/lists/types/RecipientSubscriptionsResponse.js → api/resources/tenants/client/requests/ListTenantParams.js} +0 -0
@@ -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.8",
65
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
114
+ "X-Fern-SDK-Version": "v6.1.1",
115
115
  },
116
116
  contentType: "application/json",
117
117
  body: request,
@@ -31,6 +31,15 @@ export declare class Preferences {
31
31
  /**
32
32
  * Update or Create user preferences for a specific subscription topic.
33
33
  * @throws {@link Courier.BadRequestError}
34
+ *
35
+ * @example
36
+ * await courier.users.preferences.update("abc-123", "74Q4QGFBEX481DP6JRPMV751H4XT", {
37
+ * topic: {
38
+ * status: Courier.PreferenceStatus.OptedIn,
39
+ * has_custom_routing: true,
40
+ * custom_routing: [Courier.ChannelClassification.Inbox, Courier.ChannelClassification.Email]
41
+ * }
42
+ * })
34
43
  */
35
44
  update(userId: string, topicId: string, request: Courier.users.UserPreferencesUpdateParams, requestOptions?: Preferences.RequestOptions): Promise<Courier.users.UserPreferencesUpdateResponse>;
36
45
  protected _getAuthorizationHeader(): Promise<string>;
@@ -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.8",
65
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
114
+ "X-Fern-SDK-Version": "v6.1.1",
115
115
  },
116
116
  contentType: "application/json",
117
117
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -149,6 +149,15 @@ class Preferences {
149
149
  /**
150
150
  * Update or Create user preferences for a specific subscription topic.
151
151
  * @throws {@link Courier.BadRequestError}
152
+ *
153
+ * @example
154
+ * await courier.users.preferences.update("abc-123", "74Q4QGFBEX481DP6JRPMV751H4XT", {
155
+ * topic: {
156
+ * status: Courier.PreferenceStatus.OptedIn,
157
+ * has_custom_routing: true,
158
+ * custom_routing: [Courier.ChannelClassification.Inbox, Courier.ChannelClassification.Email]
159
+ * }
160
+ * })
152
161
  */
153
162
  update(userId, topicId, request, requestOptions) {
154
163
  var _a, _b;
@@ -160,7 +169,7 @@ class Preferences {
160
169
  Authorization: yield this._getAuthorizationHeader(),
161
170
  "X-Fern-Language": "JavaScript",
162
171
  "X-Fern-SDK-Name": "@trycourier/courier",
163
- "X-Fern-SDK-Version": "v6.0.8",
172
+ "X-Fern-SDK-Version": "v6.1.1",
164
173
  },
165
174
  contentType: "application/json",
166
175
  body: request,
@@ -2,10 +2,16 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Courier from "../../../../../..";
5
+ /**
6
+ * @example
7
+ * {
8
+ * topic: {
9
+ * status: Courier.PreferenceStatus.OptedIn,
10
+ * has_custom_routing: true,
11
+ * custom_routing: [Courier.ChannelClassification.Inbox, Courier.ChannelClassification.Email]
12
+ * }
13
+ * }
14
+ */
5
15
  export interface UserPreferencesUpdateParams {
6
- status: Courier.PreferenceStatus;
7
- /** The Channels a user has chosen to receive notifications through for this topic */
8
- custom_routing?: Courier.ChannelClassification[];
9
- default_status: Courier.PreferenceStatus;
10
- has_custom_routing?: boolean;
16
+ topic: Courier.users.TopicPreferenceUpdate;
11
17
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Courier from "../../../../..";
5
+ export interface TopicPreferenceUpdate {
6
+ status: Courier.PreferenceStatus;
7
+ /** The Channels a user has chosen to receive notifications through for this topic */
8
+ custom_routing?: Courier.ChannelClassification[];
9
+ has_custom_routing?: boolean;
10
+ }
@@ -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 });
@@ -1,4 +1,5 @@
1
1
  export * from "./UserPreferencesListResponse";
2
2
  export * from "./UserPreferencesGetResponse";
3
3
  export * from "./TopicPreference";
4
+ export * from "./TopicPreferenceUpdate";
4
5
  export * from "./UserPreferencesUpdateResponse";
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./UserPreferencesListResponse"), exports);
18
18
  __exportStar(require("./UserPreferencesGetResponse"), exports);
19
19
  __exportStar(require("./TopicPreference"), exports);
20
+ __exportStar(require("./TopicPreferenceUpdate"), exports);
20
21
  __exportStar(require("./UserPreferencesUpdateResponse"), exports);
@@ -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.8",
67
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
115
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
159
+ "X-Fern-SDK-Version": "v6.1.1",
160
160
  },
161
161
  contentType: "application/json",
162
162
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -199,7 +199,7 @@ class Tenants {
199
199
  Authorization: yield this._getAuthorizationHeader(),
200
200
  "X-Fern-Language": "JavaScript",
201
201
  "X-Fern-SDK-Name": "@trycourier/courier",
202
- "X-Fern-SDK-Version": "v6.0.8",
202
+ "X-Fern-SDK-Version": "v6.1.1",
203
203
  },
204
204
  contentType: "application/json",
205
205
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -235,13 +235,13 @@ class Tenants {
235
235
  list(userId, request = {}, requestOptions) {
236
236
  var _a, _b;
237
237
  return __awaiter(this, void 0, void 0, function* () {
238
- const { limit, starting_after: startingAfter } = request;
238
+ const { limit, cursor } = request;
239
239
  const _queryParams = {};
240
240
  if (limit != null) {
241
241
  _queryParams["limit"] = limit.toString();
242
242
  }
243
- if (startingAfter != null) {
244
- _queryParams["starting_after"] = startingAfter.toString();
243
+ if (cursor != null) {
244
+ _queryParams["cursor"] = cursor;
245
245
  }
246
246
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
247
247
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `users/${userId}/tenants`),
@@ -250,7 +250,7 @@ class Tenants {
250
250
  Authorization: yield this._getAuthorizationHeader(),
251
251
  "X-Fern-Language": "JavaScript",
252
252
  "X-Fern-SDK-Name": "@trycourier/courier",
253
- "X-Fern-SDK-Version": "v6.0.8",
253
+ "X-Fern-SDK-Version": "v6.1.1",
254
254
  },
255
255
  contentType: "application/json",
256
256
  queryParameters: _queryParams,
@@ -8,7 +8,7 @@ export interface ListTenantsForUserParams {
8
8
  */
9
9
  limit?: number;
10
10
  /**
11
- * Value of next_page from previous response
11
+ * Continue the pagination with the next cursor
12
12
  */
13
- starting_after?: number;
13
+ cursor?: string;
14
14
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Courier from "../../../../..";
5
5
  export interface ListTenantsForUserResponse {
6
- items?: Courier.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. */
@@ -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.8",
65
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
114
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
164
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
214
+ "X-Fern-SDK-Version": "v6.1.1",
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.8",
263
+ "X-Fern-SDK-Version": "v6.1.1",
264
264
  },
265
265
  contentType: "application/json",
266
266
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.fetcher = void 0;
16
16
  const form_data_1 = __importDefault(require("form-data"));
17
17
  const qs_1 = __importDefault(require("qs"));
18
- if (typeof window === "undefined") {
19
- global.fetch = require("node-fetch");
20
- }
21
18
  const INITIAL_RETRY_DELAY = 1;
22
19
  const MAX_RETRY_DELAY = 60;
23
20
  const DEFAULT_MAX_RETRIES = 2;
@@ -46,18 +43,19 @@ function fetcherImpl(args) {
46
43
  else {
47
44
  body = JSON.stringify(args.body);
48
45
  }
46
+ const fetchFn = typeof fetch == "function" ? fetch : require("node-fetch");
49
47
  const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
50
48
  const controller = new AbortController();
51
49
  let abortId = undefined;
52
50
  if (args.timeoutMs != null) {
53
51
  abortId = setTimeout(() => controller.abort(), args.timeoutMs);
54
52
  }
55
- const response = yield fetch(url, {
53
+ const response = yield fetchFn(url, {
56
54
  method: args.method,
57
55
  headers,
58
56
  body,
59
57
  signal: controller.signal,
60
- credentials: args.withCredentials ? "same-origin" : undefined,
58
+ credentials: args.withCredentials ? "include" : undefined,
61
59
  });
62
60
  if (abortId != null) {
63
61
  clearTimeout(abortId);
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: "ts-jest",
4
+ testEnvironment: "node",
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier",
3
- "version": "v6.0.8",
3
+ "version": "v6.1.1",
4
4
  "private": false,
5
5
  "repository": "https://github.com/trycourier/courier-node",
6
6
  "main": "./index.js",
@@ -8,7 +8,8 @@
8
8
  "scripts": {
9
9
  "format": "prettier --write 'src/**/*.ts'",
10
10
  "build": "tsc",
11
- "prepack": "cp -rv dist/. ."
11
+ "prepack": "cp -rv dist/. .",
12
+ "test": "jest"
12
13
  },
13
14
  "dependencies": {
14
15
  "url-join": "4.0.1",
@@ -21,6 +22,9 @@
21
22
  "@types/url-join": "4.0.1",
22
23
  "@types/qs": "6.9.8",
23
24
  "@types/node-fetch": "2.6.9",
25
+ "jest": "^29.7.0",
26
+ "@types/jest": "^29.5.5",
27
+ "ts-jest": "^29.1.1",
24
28
  "@types/node": "17.0.33",
25
29
  "prettier": "2.7.1",
26
30
  "typescript": "4.6.4"
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a test file for the SDK.
3
+ *
4
+ * Add any tests here and make sure to mark this file
5
+ * in `.fernignore`.
6
+ */
7
+ describe("test", () => {
8
+ it("default", () => {
9
+ expect(true).toBe(true);
10
+ });
11
+ });
@@ -1,12 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export declare type AutomationStepAction = "cancel" | "delay" | "invoke" | "send" | "send-list" | "update-profile";
5
- export declare const AutomationStepAction: {
6
- readonly Cancel: "cancel";
7
- readonly Delay: "delay";
8
- readonly Invoke: "invoke";
9
- readonly Send: "send";
10
- readonly SendList: "send-list";
11
- readonly UpdateProfile: "update-profile";
12
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AutomationStepAction = void 0;
7
- exports.AutomationStepAction = {
8
- Cancel: "cancel",
9
- Delay: "delay",
10
- Invoke: "invoke",
11
- Send: "send",
12
- SendList: "send-list",
13
- UpdateProfile: "update-profile",
14
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface GetListRequest {
5
- /**
6
- * A unique identifier that allows for fetching the next page of lists.
7
- */
8
- cursor?: string;
9
- /**
10
- * "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match."
11
- */
12
- pattern?: string;
13
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface ListFindByRecipientIdResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetAllParams {
5
- cursor?: string;
6
- pattern?: string;
7
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface RecipientSubscriptionsResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export declare type AutomationStepAction = "cancel" | "delay" | "invoke" | "send" | "send-list" | "update-profile";
5
- export declare const AutomationStepAction: {
6
- readonly Cancel: "cancel";
7
- readonly Delay: "delay";
8
- readonly Invoke: "invoke";
9
- readonly Send: "send";
10
- readonly SendList: "send-list";
11
- readonly UpdateProfile: "update-profile";
12
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AutomationStepAction = void 0;
7
- exports.AutomationStepAction = {
8
- Cancel: "cancel",
9
- Delay: "delay",
10
- Invoke: "invoke",
11
- Send: "send",
12
- SendList: "send-list",
13
- UpdateProfile: "update-profile",
14
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface GetListRequest {
5
- /**
6
- * A unique identifier that allows for fetching the next page of lists.
7
- */
8
- cursor?: string;
9
- /**
10
- * "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match."
11
- */
12
- pattern?: string;
13
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface ListFindByRecipientIdResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface ListGetAllParams {
5
- cursor?: string;
6
- pattern?: string;
7
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as Courier from "../../..";
5
- export interface RecipientSubscriptionsResponse {
6
- paging: Courier.Paging;
7
- results: Courier.List[];
8
- }