@trycourier/courier 6.3.1 → 6.4.0

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 (390) hide show
  1. package/Client.d.ts +84 -109
  2. package/Client.js +118 -148
  3. package/api/client/requests/SendMessageRequest.d.ts +45 -78
  4. package/api/resources/audiences/client/Client.d.ts +16 -16
  5. package/api/resources/audiences/client/Client.js +63 -86
  6. package/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
  7. package/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
  8. package/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
  9. package/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
  10. package/api/resources/audiences/types/Filter.d.ts +1 -1
  11. package/api/resources/audiences/types/FilterConfig.d.ts +1 -1
  12. package/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
  13. package/api/resources/audiences/types/Operator.d.ts +1 -1
  14. package/api/resources/auditEvents/client/Client.d.ts +10 -4
  15. package/api/resources/auditEvents/client/Client.js +35 -37
  16. package/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
  17. package/api/resources/authTokens/client/Client.d.ts +11 -3
  18. package/api/resources/authTokens/client/Client.js +28 -25
  19. package/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
  20. package/api/resources/automations/client/Client.d.ts +15 -13
  21. package/api/resources/automations/client/Client.js +38 -48
  22. package/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
  23. package/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
  24. package/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
  25. package/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
  26. package/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  27. package/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
  28. package/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
  29. package/api/resources/automations/types/Profile.d.ts +1 -1
  30. package/api/resources/brands/client/Client.d.ts +22 -58
  31. package/api/resources/brands/client/Client.js +65 -126
  32. package/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
  33. package/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
  34. package/api/resources/bulk/client/Client.d.ts +30 -121
  35. package/api/resources/bulk/client/Client.js +73 -193
  36. package/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  37. package/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
  38. package/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  39. package/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  40. package/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  41. package/api/resources/commons/errors/AlreadyExistsError.js +17 -7
  42. package/api/resources/commons/errors/BadRequestError.js +17 -7
  43. package/api/resources/commons/errors/ConflictError.js +17 -7
  44. package/api/resources/commons/errors/MessageNotFoundError.js +17 -7
  45. package/api/resources/commons/errors/NotFoundError.js +17 -7
  46. package/api/resources/commons/errors/PaymentRequiredError.js +17 -7
  47. package/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  48. package/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  49. package/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  50. package/api/resources/inbound/client/Client.d.ts +9 -1
  51. package/api/resources/inbound/client/Client.js +26 -21
  52. package/api/resources/index.js +17 -7
  53. package/api/resources/lists/client/Client.d.ts +31 -34
  54. package/api/resources/lists/client/Client.js +108 -161
  55. package/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  56. package/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  57. package/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  58. package/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  59. package/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  60. package/api/resources/messages/client/Client.d.ts +15 -24
  61. package/api/resources/messages/client/Client.js +65 -104
  62. package/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  63. package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  64. package/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  65. package/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  66. package/api/resources/messages/types/MessageStatus.d.ts +25 -5
  67. package/api/resources/messages/types/MessageStatus.js +6 -1
  68. package/api/resources/messages/types/Reason.d.ts +1 -1
  69. package/api/resources/messages/types/index.d.ts +1 -0
  70. package/api/resources/messages/types/index.js +1 -0
  71. package/api/resources/notifications/client/Client.d.ts +20 -11
  72. package/api/resources/notifications/client/Client.js +69 -88
  73. package/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  74. package/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  75. package/api/resources/notifications/types/BlockType.d.ts +1 -1
  76. package/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  77. package/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  78. package/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  79. package/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  80. package/api/resources/profiles/client/Client.d.ts +35 -23
  81. package/api/resources/profiles/client/Client.js +95 -125
  82. package/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  83. package/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  84. package/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  85. package/api/resources/profiles/types/DeviceType.d.ts +1 -1
  86. package/api/resources/profiles/types/Discord.d.ts +1 -1
  87. package/api/resources/profiles/types/Expo.d.ts +1 -1
  88. package/api/resources/profiles/types/MsTeams.d.ts +1 -1
  89. package/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  90. package/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  91. package/api/resources/profiles/types/Slack.d.ts +1 -1
  92. package/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  93. package/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  94. package/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  95. package/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  96. package/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  97. package/api/resources/profiles/types/index.d.ts +1 -0
  98. package/api/resources/profiles/types/index.js +1 -0
  99. package/api/resources/send/types/Attachment.d.ts +1 -1
  100. package/api/resources/send/types/ChannelSource.d.ts +1 -1
  101. package/api/resources/send/types/Content.d.ts +1 -1
  102. package/api/resources/send/types/Criteria.d.ts +1 -1
  103. package/api/resources/send/types/ElementalNode.d.ts +1 -1
  104. package/api/resources/send/types/ExpiresInType.d.ts +1 -1
  105. package/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  106. package/api/resources/send/types/IAlignment.d.ts +1 -1
  107. package/api/resources/send/types/IPreferences.d.ts +1 -1
  108. package/api/resources/send/types/InAppPlacement.d.ts +1 -1
  109. package/api/resources/send/types/Locales.d.ts +1 -1
  110. package/api/resources/send/types/Message.d.ts +1 -1
  111. package/api/resources/send/types/MessageChannels.d.ts +1 -1
  112. package/api/resources/send/types/MessageData.d.ts +1 -1
  113. package/api/resources/send/types/MessageProviders.d.ts +1 -1
  114. package/api/resources/send/types/MessageRecipient.d.ts +1 -1
  115. package/api/resources/send/types/Recipient.d.ts +1 -1
  116. package/api/resources/send/types/RecipientData.d.ts +1 -1
  117. package/api/resources/send/types/RoutingChannel.d.ts +1 -1
  118. package/api/resources/send/types/RoutingMethod.d.ts +1 -1
  119. package/api/resources/send/types/RuleType.d.ts +1 -1
  120. package/api/resources/send/types/TextAlign.d.ts +1 -1
  121. package/api/resources/send/types/TextStyle.d.ts +1 -1
  122. package/api/resources/templates/client/Client.d.ts +9 -3
  123. package/api/resources/templates/client/Client.js +28 -25
  124. package/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  125. package/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  126. package/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  127. package/api/resources/tenants/client/Client.d.ts +23 -37
  128. package/api/resources/tenants/client/Client.js +80 -127
  129. package/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  130. package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  131. package/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  132. package/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  133. package/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  134. package/api/resources/translations/client/Client.d.ts +10 -2
  135. package/api/resources/translations/client/Client.js +33 -33
  136. package/api/resources/users/client/Client.d.ts +5 -7
  137. package/api/resources/users/resources/index.js +17 -7
  138. package/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
  139. package/api/resources/users/resources/preferences/client/Client.js +46 -55
  140. package/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  141. package/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  142. package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  143. package/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
  144. package/api/resources/users/resources/tenants/client/Client.js +68 -89
  145. package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  146. package/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  147. package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  148. package/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
  149. package/api/resources/users/resources/tokens/client/Client.js +74 -104
  150. package/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  151. package/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  152. package/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  153. package/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  154. package/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  155. package/core/auth/BearerToken.d.ts +1 -1
  156. package/core/fetcher/APIResponse.d.ts +1 -1
  157. package/core/fetcher/Fetcher.d.ts +7 -3
  158. package/core/fetcher/Fetcher.js +30 -135
  159. package/core/fetcher/Supplier.d.ts +1 -1
  160. package/core/fetcher/createRequestUrl.d.ts +1 -0
  161. package/core/fetcher/createRequestUrl.js +12 -0
  162. package/core/fetcher/getFetchFn.d.ts +4 -0
  163. package/core/fetcher/getFetchFn.js +68 -0
  164. package/core/fetcher/getHeader.js +1 -2
  165. package/core/fetcher/getRequestBody.d.ts +7 -0
  166. package/core/fetcher/getRequestBody.js +23 -0
  167. package/core/fetcher/getResponseBody.d.ts +1 -0
  168. package/core/fetcher/getResponseBody.js +54 -0
  169. package/core/fetcher/makeRequest.d.ts +1 -0
  170. package/core/fetcher/makeRequest.js +42 -0
  171. package/core/fetcher/requestWithRetries.d.ts +1 -0
  172. package/core/fetcher/requestWithRetries.js +40 -0
  173. package/core/fetcher/signals.d.ts +11 -0
  174. package/core/fetcher/signals.js +36 -0
  175. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  176. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  177. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  178. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  179. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  180. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  181. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  182. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  183. package/core/json.d.ts +15 -0
  184. package/core/json.js +24 -0
  185. package/core/runtime/runtime.d.ts +2 -1
  186. package/core/runtime/runtime.js +57 -36
  187. package/dist/Client.d.ts +84 -109
  188. package/dist/Client.js +118 -148
  189. package/dist/api/client/requests/SendMessageRequest.d.ts +45 -78
  190. package/dist/api/resources/audiences/client/Client.d.ts +16 -16
  191. package/dist/api/resources/audiences/client/Client.js +63 -86
  192. package/dist/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
  193. package/dist/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
  194. package/dist/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
  195. package/dist/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
  196. package/dist/api/resources/audiences/types/Filter.d.ts +1 -1
  197. package/dist/api/resources/audiences/types/FilterConfig.d.ts +1 -1
  198. package/dist/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
  199. package/dist/api/resources/audiences/types/Operator.d.ts +1 -1
  200. package/dist/api/resources/auditEvents/client/Client.d.ts +10 -4
  201. package/dist/api/resources/auditEvents/client/Client.js +35 -37
  202. package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
  203. package/dist/api/resources/authTokens/client/Client.d.ts +11 -3
  204. package/dist/api/resources/authTokens/client/Client.js +28 -25
  205. package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
  206. package/dist/api/resources/automations/client/Client.d.ts +15 -13
  207. package/dist/api/resources/automations/client/Client.js +38 -48
  208. package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
  209. package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
  210. package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
  211. package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
  212. package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  213. package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
  214. package/dist/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
  215. package/dist/api/resources/automations/types/Profile.d.ts +1 -1
  216. package/dist/api/resources/brands/client/Client.d.ts +22 -58
  217. package/dist/api/resources/brands/client/Client.js +65 -126
  218. package/dist/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
  219. package/dist/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
  220. package/dist/api/resources/bulk/client/Client.d.ts +30 -121
  221. package/dist/api/resources/bulk/client/Client.js +73 -193
  222. package/dist/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  223. package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
  224. package/dist/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  225. package/dist/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  226. package/dist/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  227. package/dist/api/resources/commons/errors/AlreadyExistsError.js +17 -7
  228. package/dist/api/resources/commons/errors/BadRequestError.js +17 -7
  229. package/dist/api/resources/commons/errors/ConflictError.js +17 -7
  230. package/dist/api/resources/commons/errors/MessageNotFoundError.js +17 -7
  231. package/dist/api/resources/commons/errors/NotFoundError.js +17 -7
  232. package/dist/api/resources/commons/errors/PaymentRequiredError.js +17 -7
  233. package/dist/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  234. package/dist/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  235. package/dist/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  236. package/dist/api/resources/inbound/client/Client.d.ts +9 -1
  237. package/dist/api/resources/inbound/client/Client.js +26 -21
  238. package/dist/api/resources/index.js +17 -7
  239. package/dist/api/resources/lists/client/Client.d.ts +31 -34
  240. package/dist/api/resources/lists/client/Client.js +108 -161
  241. package/dist/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  242. package/dist/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  243. package/dist/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  244. package/dist/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  245. package/dist/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  246. package/dist/api/resources/messages/client/Client.d.ts +15 -24
  247. package/dist/api/resources/messages/client/Client.js +65 -104
  248. package/dist/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  249. package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  250. package/dist/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  251. package/dist/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  252. package/dist/api/resources/messages/types/MessageStatus.d.ts +25 -5
  253. package/dist/api/resources/messages/types/MessageStatus.js +6 -1
  254. package/dist/api/resources/messages/types/Reason.d.ts +1 -1
  255. package/dist/api/resources/messages/types/index.d.ts +1 -0
  256. package/dist/api/resources/messages/types/index.js +1 -0
  257. package/dist/api/resources/notifications/client/Client.d.ts +20 -11
  258. package/dist/api/resources/notifications/client/Client.js +69 -88
  259. package/dist/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  260. package/dist/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  261. package/dist/api/resources/notifications/types/BlockType.d.ts +1 -1
  262. package/dist/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  263. package/dist/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  264. package/dist/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  265. package/dist/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  266. package/dist/api/resources/profiles/client/Client.d.ts +35 -23
  267. package/dist/api/resources/profiles/client/Client.js +95 -125
  268. package/dist/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  269. package/dist/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  270. package/dist/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  271. package/dist/api/resources/profiles/types/DeviceType.d.ts +1 -1
  272. package/dist/api/resources/profiles/types/Discord.d.ts +1 -1
  273. package/dist/api/resources/profiles/types/Expo.d.ts +1 -1
  274. package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
  275. package/dist/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  276. package/dist/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  277. package/dist/api/resources/profiles/types/Slack.d.ts +1 -1
  278. package/dist/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  279. package/dist/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  280. package/dist/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  281. package/dist/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  282. package/dist/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  283. package/dist/api/resources/profiles/types/index.d.ts +1 -0
  284. package/dist/api/resources/profiles/types/index.js +1 -0
  285. package/dist/api/resources/send/types/Attachment.d.ts +1 -1
  286. package/dist/api/resources/send/types/ChannelSource.d.ts +1 -1
  287. package/dist/api/resources/send/types/Content.d.ts +1 -1
  288. package/dist/api/resources/send/types/Criteria.d.ts +1 -1
  289. package/dist/api/resources/send/types/ElementalNode.d.ts +1 -1
  290. package/dist/api/resources/send/types/ExpiresInType.d.ts +1 -1
  291. package/dist/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  292. package/dist/api/resources/send/types/IAlignment.d.ts +1 -1
  293. package/dist/api/resources/send/types/IPreferences.d.ts +1 -1
  294. package/dist/api/resources/send/types/InAppPlacement.d.ts +1 -1
  295. package/dist/api/resources/send/types/Locales.d.ts +1 -1
  296. package/dist/api/resources/send/types/Message.d.ts +1 -1
  297. package/dist/api/resources/send/types/MessageChannels.d.ts +1 -1
  298. package/dist/api/resources/send/types/MessageData.d.ts +1 -1
  299. package/dist/api/resources/send/types/MessageProviders.d.ts +1 -1
  300. package/dist/api/resources/send/types/MessageRecipient.d.ts +1 -1
  301. package/dist/api/resources/send/types/Recipient.d.ts +1 -1
  302. package/dist/api/resources/send/types/RecipientData.d.ts +1 -1
  303. package/dist/api/resources/send/types/RoutingChannel.d.ts +1 -1
  304. package/dist/api/resources/send/types/RoutingMethod.d.ts +1 -1
  305. package/dist/api/resources/send/types/RuleType.d.ts +1 -1
  306. package/dist/api/resources/send/types/TextAlign.d.ts +1 -1
  307. package/dist/api/resources/send/types/TextStyle.d.ts +1 -1
  308. package/dist/api/resources/templates/client/Client.d.ts +9 -3
  309. package/dist/api/resources/templates/client/Client.js +28 -25
  310. package/dist/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  311. package/dist/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  312. package/dist/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  313. package/dist/api/resources/tenants/client/Client.d.ts +23 -37
  314. package/dist/api/resources/tenants/client/Client.js +80 -127
  315. package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  316. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  317. package/dist/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  318. package/dist/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  319. package/dist/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  320. package/dist/api/resources/translations/client/Client.d.ts +10 -2
  321. package/dist/api/resources/translations/client/Client.js +33 -33
  322. package/dist/api/resources/users/client/Client.d.ts +5 -7
  323. package/dist/api/resources/users/resources/index.js +17 -7
  324. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
  325. package/dist/api/resources/users/resources/preferences/client/Client.js +46 -55
  326. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  327. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  328. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  329. package/dist/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
  330. package/dist/api/resources/users/resources/tenants/client/Client.js +68 -89
  331. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  332. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  333. package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  334. package/dist/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
  335. package/dist/api/resources/users/resources/tokens/client/Client.js +74 -104
  336. package/dist/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  337. package/dist/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  338. package/dist/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  339. package/dist/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  340. package/dist/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  341. package/dist/core/auth/BearerToken.d.ts +1 -1
  342. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  343. package/dist/core/fetcher/Fetcher.d.ts +7 -3
  344. package/dist/core/fetcher/Fetcher.js +30 -135
  345. package/dist/core/fetcher/Supplier.d.ts +1 -1
  346. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  347. package/dist/core/fetcher/createRequestUrl.js +12 -0
  348. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  349. package/dist/core/fetcher/getFetchFn.js +68 -0
  350. package/dist/core/fetcher/getHeader.js +1 -2
  351. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  352. package/dist/core/fetcher/getRequestBody.js +23 -0
  353. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  354. package/dist/core/fetcher/getResponseBody.js +54 -0
  355. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  356. package/dist/core/fetcher/makeRequest.js +42 -0
  357. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  358. package/dist/core/fetcher/requestWithRetries.js +40 -0
  359. package/dist/core/fetcher/signals.d.ts +11 -0
  360. package/dist/core/fetcher/signals.js +36 -0
  361. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  362. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  363. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  364. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  365. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  366. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  367. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  368. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  369. package/dist/core/json.d.ts +15 -0
  370. package/dist/core/json.js +24 -0
  371. package/dist/core/runtime/runtime.d.ts +2 -1
  372. package/dist/core/runtime/runtime.js +57 -36
  373. package/dist/environments.d.ts +1 -1
  374. package/dist/errors/CourierError.js +2 -1
  375. package/dist/errors/CourierTimeoutError.d.ts +1 -1
  376. package/dist/errors/CourierTimeoutError.js +2 -2
  377. package/dist/index.js +17 -7
  378. package/dist/version.d.ts +1 -0
  379. package/dist/version.js +4 -0
  380. package/environments.d.ts +1 -1
  381. package/errors/CourierError.js +2 -1
  382. package/errors/CourierTimeoutError.d.ts +1 -1
  383. package/errors/CourierTimeoutError.js +2 -2
  384. package/index.js +17 -7
  385. package/{jest.config.js → jest.config.mjs} +4 -1
  386. package/package.json +23 -14
  387. package/reference.md +5180 -0
  388. package/scripts/rename-to-esm-files.js +115 -0
  389. package/version.d.ts +1 -0
  390. package/version.js +4 -0
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -56,48 +66,28 @@ class Tenants {
56
66
  * @throws {@link Courier.BadRequestError}
57
67
  *
58
68
  * @example
59
- * await courier.tenants.createOrReplace("string", {
60
- * name: "string",
61
- * parent_tenant_id: "string",
62
- * default_preferences: {
63
- * items: [{
64
- * id: "string",
65
- * status: Courier.SubscriptionTopicStatus.OptedOut,
66
- * has_custom_routing: undefined,
67
- * custom_routing: undefined
68
- * }]
69
- * },
70
- * properties: {
71
- * "string": {
72
- * "key": "value"
73
- * }
74
- * },
75
- * user_profile: {
76
- * "string": {
77
- * "key": "value"
78
- * }
79
- * },
80
- * brand_id: "string"
69
+ * await client.tenants.createOrReplace("tenant_id", {
70
+ * name: "name",
71
+ * parent_tenant_id: undefined,
72
+ * default_preferences: undefined,
73
+ * properties: undefined,
74
+ * user_profile: undefined,
75
+ * brand_id: undefined
81
76
  * })
82
77
  */
83
78
  createOrReplace(tenantId, request, requestOptions) {
84
- var _a, _b;
85
79
  return __awaiter(this, void 0, void 0, function* () {
80
+ var _a, _b, _c;
86
81
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
87
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}`),
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, `/tenants/${encodeURIComponent(tenantId)}`),
88
83
  method: "PUT",
89
- headers: {
90
- Authorization: yield this._getAuthorizationHeader(),
91
- "X-Fern-Language": "JavaScript",
92
- "X-Fern-SDK-Name": "@trycourier/courier",
93
- "X-Fern-SDK-Version": "v6.3.1",
94
- "X-Fern-Runtime": core.RUNTIME.type,
95
- "X-Fern-Runtime-Version": core.RUNTIME.version,
96
- },
84
+ 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),
97
85
  contentType: "application/json",
86
+ requestType: "json",
98
87
  body: request,
99
88
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
100
89
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
90
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
101
91
  });
102
92
  if (_response.ok) {
103
93
  return _response.body;
@@ -120,7 +110,7 @@ class Tenants {
120
110
  body: _response.error.rawBody,
121
111
  });
122
112
  case "timeout":
123
- throw new errors.CourierTimeoutError();
113
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}.");
124
114
  case "unknown":
125
115
  throw new errors.CourierError({
126
116
  message: _response.error.errorMessage,
@@ -135,25 +125,20 @@ class Tenants {
135
125
  * @throws {@link Courier.BadRequestError}
136
126
  *
137
127
  * @example
138
- * await courier.tenants.get("string")
128
+ * await client.tenants.get("tenant_id")
139
129
  */
140
130
  get(tenantId, requestOptions) {
141
- var _a, _b;
142
131
  return __awaiter(this, void 0, void 0, function* () {
132
+ var _a, _b, _c;
143
133
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
144
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}`),
134
+ 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, `/tenants/${encodeURIComponent(tenantId)}`),
145
135
  method: "GET",
146
- headers: {
147
- Authorization: yield this._getAuthorizationHeader(),
148
- "X-Fern-Language": "JavaScript",
149
- "X-Fern-SDK-Name": "@trycourier/courier",
150
- "X-Fern-SDK-Version": "v6.3.1",
151
- "X-Fern-Runtime": core.RUNTIME.type,
152
- "X-Fern-Runtime-Version": core.RUNTIME.version,
153
- },
136
+ 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),
154
137
  contentType: "application/json",
138
+ requestType: "json",
155
139
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
156
140
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
141
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
157
142
  });
158
143
  if (_response.ok) {
159
144
  return _response.body;
@@ -176,7 +161,7 @@ class Tenants {
176
161
  body: _response.error.rawBody,
177
162
  });
178
163
  case "timeout":
179
- throw new errors.CourierTimeoutError();
164
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}.");
180
165
  case "unknown":
181
166
  throw new errors.CourierError({
182
167
  message: _response.error.errorMessage,
@@ -189,15 +174,11 @@ class Tenants {
189
174
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
190
175
  *
191
176
  * @example
192
- * await courier.tenants.list({
193
- * parent_tenant_id: "string",
194
- * limit: 1,
195
- * cursor: "string"
196
- * })
177
+ * await client.tenants.list()
197
178
  */
198
- list(request = {}, requestOptions) {
199
- var _a, _b;
200
- return __awaiter(this, void 0, void 0, function* () {
179
+ list() {
180
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
181
+ var _a, _b, _c;
201
182
  const { parent_tenant_id: parentTenantId, limit, cursor } = request;
202
183
  const _queryParams = {};
203
184
  if (parentTenantId != null) {
@@ -210,20 +191,15 @@ class Tenants {
210
191
  _queryParams["cursor"] = cursor;
211
192
  }
212
193
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
213
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, "/tenants"),
194
+ 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, "/tenants"),
214
195
  method: "GET",
215
- headers: {
216
- Authorization: yield this._getAuthorizationHeader(),
217
- "X-Fern-Language": "JavaScript",
218
- "X-Fern-SDK-Name": "@trycourier/courier",
219
- "X-Fern-SDK-Version": "v6.3.1",
220
- "X-Fern-Runtime": core.RUNTIME.type,
221
- "X-Fern-Runtime-Version": core.RUNTIME.version,
222
- },
196
+ 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),
223
197
  contentType: "application/json",
224
198
  queryParameters: _queryParams,
199
+ requestType: "json",
225
200
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
226
201
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
202
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
227
203
  });
228
204
  if (_response.ok) {
229
205
  return _response.body;
@@ -241,7 +217,7 @@ class Tenants {
241
217
  body: _response.error.rawBody,
242
218
  });
243
219
  case "timeout":
244
- throw new errors.CourierTimeoutError();
220
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants.");
245
221
  case "unknown":
246
222
  throw new errors.CourierError({
247
223
  message: _response.error.errorMessage,
@@ -254,25 +230,20 @@ class Tenants {
254
230
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
255
231
  *
256
232
  * @example
257
- * await courier.tenants.delete("string")
233
+ * await client.tenants.delete("tenant_id")
258
234
  */
259
235
  delete(tenantId, requestOptions) {
260
- var _a, _b;
261
236
  return __awaiter(this, void 0, void 0, function* () {
237
+ var _a, _b, _c;
262
238
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
263
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}`),
239
+ 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, `/tenants/${encodeURIComponent(tenantId)}`),
264
240
  method: "DELETE",
265
- headers: {
266
- Authorization: yield this._getAuthorizationHeader(),
267
- "X-Fern-Language": "JavaScript",
268
- "X-Fern-SDK-Name": "@trycourier/courier",
269
- "X-Fern-SDK-Version": "v6.3.1",
270
- "X-Fern-Runtime": core.RUNTIME.type,
271
- "X-Fern-Runtime-Version": core.RUNTIME.version,
272
- },
241
+ 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),
273
242
  contentType: "application/json",
243
+ requestType: "json",
274
244
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
275
245
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
246
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
276
247
  });
277
248
  if (_response.ok) {
278
249
  return;
@@ -290,7 +261,7 @@ class Tenants {
290
261
  body: _response.error.rawBody,
291
262
  });
292
263
  case "timeout":
293
- throw new errors.CourierTimeoutError();
264
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}.");
294
265
  case "unknown":
295
266
  throw new errors.CourierError({
296
267
  message: _response.error.errorMessage,
@@ -306,14 +277,11 @@ class Tenants {
306
277
  * @throws {@link Courier.BadRequestError}
307
278
  *
308
279
  * @example
309
- * await courier.tenants.getUsersByTenant("string", {
310
- * limit: 1,
311
- * cursor: "string"
312
- * })
280
+ * await client.tenants.getUsersByTenant("tenant_id")
313
281
  */
314
- getUsersByTenant(tenantId, request = {}, requestOptions) {
315
- var _a, _b;
316
- return __awaiter(this, void 0, void 0, function* () {
282
+ getUsersByTenant(tenantId_1) {
283
+ return __awaiter(this, arguments, void 0, function* (tenantId, request = {}, requestOptions) {
284
+ var _a, _b, _c;
317
285
  const { limit, cursor } = request;
318
286
  const _queryParams = {};
319
287
  if (limit != null) {
@@ -323,20 +291,15 @@ class Tenants {
323
291
  _queryParams["cursor"] = cursor;
324
292
  }
325
293
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
326
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}/users`),
294
+ 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, `/tenants/${encodeURIComponent(tenantId)}/users`),
327
295
  method: "GET",
328
- headers: {
329
- Authorization: yield this._getAuthorizationHeader(),
330
- "X-Fern-Language": "JavaScript",
331
- "X-Fern-SDK-Name": "@trycourier/courier",
332
- "X-Fern-SDK-Version": "v6.3.1",
333
- "X-Fern-Runtime": core.RUNTIME.type,
334
- "X-Fern-Runtime-Version": core.RUNTIME.version,
335
- },
296
+ 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),
336
297
  contentType: "application/json",
337
298
  queryParameters: _queryParams,
299
+ requestType: "json",
338
300
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
339
301
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
302
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
340
303
  });
341
304
  if (_response.ok) {
342
305
  return _response.body;
@@ -359,7 +322,7 @@ class Tenants {
359
322
  body: _response.error.rawBody,
360
323
  });
361
324
  case "timeout":
362
- throw new errors.CourierTimeoutError();
325
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}/users.");
363
326
  case "unknown":
364
327
  throw new errors.CourierError({
365
328
  message: _response.error.errorMessage,
@@ -374,30 +337,25 @@ class Tenants {
374
337
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
375
338
  *
376
339
  * @example
377
- * await courier.tenants.createOrReplaceDefaultPreferencesForTopic("tenantABC", "HB529N49MD4D5PMX9WR5P4JH78NA", {
378
- * status: Courier.SubscriptionTopicStatus.OptedIn,
340
+ * await client.tenants.createOrReplaceDefaultPreferencesForTopic("tenantABC", "HB529N49MD4D5PMX9WR5P4JH78NA", {
341
+ * status: "OPTED_IN",
379
342
  * has_custom_routing: true,
380
- * custom_routing: [Courier.ChannelClassification.Inbox]
343
+ * custom_routing: ["inbox"]
381
344
  * })
382
345
  */
383
346
  createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions) {
384
- var _a, _b;
385
347
  return __awaiter(this, void 0, void 0, function* () {
348
+ var _a, _b, _c;
386
349
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
387
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
350
+ 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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
388
351
  method: "PUT",
389
- headers: {
390
- Authorization: yield this._getAuthorizationHeader(),
391
- "X-Fern-Language": "JavaScript",
392
- "X-Fern-SDK-Name": "@trycourier/courier",
393
- "X-Fern-SDK-Version": "v6.3.1",
394
- "X-Fern-Runtime": core.RUNTIME.type,
395
- "X-Fern-Runtime-Version": core.RUNTIME.version,
396
- },
352
+ 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),
397
353
  contentType: "application/json",
354
+ requestType: "json",
398
355
  body: request,
399
356
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
400
357
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
358
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
401
359
  });
402
360
  if (_response.ok) {
403
361
  return;
@@ -415,7 +373,7 @@ class Tenants {
415
373
  body: _response.error.rawBody,
416
374
  });
417
375
  case "timeout":
418
- throw new errors.CourierTimeoutError();
376
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
419
377
  case "unknown":
420
378
  throw new errors.CourierError({
421
379
  message: _response.error.errorMessage,
@@ -429,25 +387,20 @@ class Tenants {
429
387
  * @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
430
388
  *
431
389
  * @example
432
- * await courier.tenants.removeDefaultPreferencesForTopic("string", "string")
390
+ * await client.tenants.removeDefaultPreferencesForTopic("tenant_id", "topic_id")
433
391
  */
434
392
  removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions) {
435
- var _a, _b;
436
393
  return __awaiter(this, void 0, void 0, function* () {
394
+ var _a, _b, _c;
437
395
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
438
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
396
+ 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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
439
397
  method: "DELETE",
440
- headers: {
441
- Authorization: yield this._getAuthorizationHeader(),
442
- "X-Fern-Language": "JavaScript",
443
- "X-Fern-SDK-Name": "@trycourier/courier",
444
- "X-Fern-SDK-Version": "v6.3.1",
445
- "X-Fern-Runtime": core.RUNTIME.type,
446
- "X-Fern-Runtime-Version": core.RUNTIME.version,
447
- },
398
+ 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),
448
399
  contentType: "application/json",
400
+ requestType: "json",
449
401
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
450
402
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
403
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
451
404
  });
452
405
  if (_response.ok) {
453
406
  return;
@@ -465,7 +418,7 @@ class Tenants {
465
418
  body: _response.error.rawBody,
466
419
  });
467
420
  case "timeout":
468
- throw new errors.CourierTimeoutError();
421
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
469
422
  case "unknown":
470
423
  throw new errors.CourierError({
471
424
  message: _response.error.errorMessage,
@@ -474,12 +427,12 @@ class Tenants {
474
427
  });
475
428
  }
476
429
  _getAuthorizationHeader() {
477
- var _a;
478
430
  return __awaiter(this, void 0, void 0, function* () {
431
+ var _a;
479
432
  const bearer = (_a = (yield core.Supplier.get(this._options.authorizationToken))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["COURIER_AUTH_TOKEN"];
480
433
  if (bearer == null) {
481
434
  throw new errors.CourierError({
482
- message: "Please specify COURIER_AUTH_TOKEN when instantiating the client.",
435
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
483
436
  });
484
437
  }
485
438
  return `Bearer ${bearer}`;
@@ -3,11 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * parent_tenant_id: "string",
8
- * limit: 1,
9
- * cursor: "string"
10
- * }
6
+ * {}
11
7
  */
12
8
  export interface ListTenantParams {
13
9
  /**
@@ -3,10 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * limit: 1,
8
- * cursor: "string"
9
- * }
6
+ * {}
10
7
  */
11
8
  export interface ListUsersForTenantParams {
12
9
  /**
@@ -5,27 +5,12 @@ import * as Courier from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * name: "string",
9
- * parent_tenant_id: "string",
10
- * default_preferences: {
11
- * items: [{
12
- * id: "string",
13
- * status: Courier.SubscriptionTopicStatus.OptedOut,
14
- * has_custom_routing: undefined,
15
- * custom_routing: undefined
16
- * }]
17
- * },
18
- * properties: {
19
- * "string": {
20
- * "key": "value"
21
- * }
22
- * },
23
- * user_profile: {
24
- * "string": {
25
- * "key": "value"
26
- * }
27
- * },
28
- * brand_id: "string"
8
+ * name: "name",
9
+ * parent_tenant_id: undefined,
10
+ * default_preferences: undefined,
11
+ * properties: undefined,
12
+ * user_profile: undefined,
13
+ * brand_id: undefined
29
14
  * }
30
15
  */
31
16
  export interface TenantCreateOrReplaceParams {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type SubscriptionTopicStatus = "OPTED_OUT" | "OPTED_IN" | "REQUIRED";
4
+ export type SubscriptionTopicStatus = "OPTED_OUT" | "OPTED_IN" | "REQUIRED";
5
5
  export declare const SubscriptionTopicStatus: {
6
6
  readonly OptedOut: "OPTED_OUT";
7
7
  readonly OptedIn: "OPTED_IN";
@@ -4,4 +4,4 @@
4
4
  /**
5
5
  * Unused type for tenants
6
6
  */
7
- export declare type TemplateProperty = any;
7
+ export type TemplateProperty = any;
@@ -6,12 +6,20 @@ import * as core from "../../../../core";
6
6
  export declare namespace Translations {
7
7
  interface Options {
8
8
  environment?: core.Supplier<environments.CourierEnvironment | string>;
9
+ /** Specify a custom URL to connect the client to. */
10
+ baseUrl?: core.Supplier<string>;
9
11
  authorizationToken?: core.Supplier<core.BearerToken | undefined>;
10
12
  fetcher?: core.FetchFunction;
11
13
  }
12
14
  interface RequestOptions {
15
+ /** The maximum time to wait for a response in seconds. */
13
16
  timeoutInSeconds?: number;
17
+ /** The number of times to retry the request. Defaults to 2. */
14
18
  maxRetries?: number;
19
+ /** A hook to abort the request. */
20
+ abortSignal?: AbortSignal;
21
+ /** Additional headers to include in the request. */
22
+ headers?: Record<string, string>;
15
23
  }
16
24
  }
17
25
  export declare class Translations {
@@ -27,7 +35,7 @@ export declare class Translations {
27
35
  * @throws {@link Courier.NotFoundError}
28
36
  *
29
37
  * @example
30
- * await courier.translations.get("string", "string")
38
+ * await client.translations.get("domain", "locale")
31
39
  */
32
40
  get(domain: string, locale: string, requestOptions?: Translations.RequestOptions): Promise<string>;
33
41
  /**
@@ -41,7 +49,7 @@ export declare class Translations {
41
49
  * @throws {@link Courier.NotFoundError}
42
50
  *
43
51
  * @example
44
- * await courier.translations.update("string", "string", "string")
52
+ * await client.translations.update("domain", "locale", "string")
45
53
  */
46
54
  update(domain: string, locale: string, request: string, requestOptions?: Translations.RequestOptions): Promise<void>;
47
55
  protected _getAuthorizationHeader(): Promise<string>;
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -58,25 +68,20 @@ class Translations {
58
68
  * @throws {@link Courier.NotFoundError}
59
69
  *
60
70
  * @example
61
- * await courier.translations.get("string", "string")
71
+ * await client.translations.get("domain", "locale")
62
72
  */
63
73
  get(domain, locale, requestOptions) {
64
- var _a, _b;
65
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c;
66
76
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
67
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
77
+ 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, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
68
78
  method: "GET",
69
- headers: {
70
- Authorization: yield this._getAuthorizationHeader(),
71
- "X-Fern-Language": "JavaScript",
72
- "X-Fern-SDK-Name": "@trycourier/courier",
73
- "X-Fern-SDK-Version": "v6.3.1",
74
- "X-Fern-Runtime": core.RUNTIME.type,
75
- "X-Fern-Runtime-Version": core.RUNTIME.version,
76
- },
79
+ 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),
77
80
  contentType: "application/json",
81
+ requestType: "json",
78
82
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
79
83
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
84
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
80
85
  });
81
86
  if (_response.ok) {
82
87
  return _response.body;
@@ -99,7 +104,7 @@ class Translations {
99
104
  body: _response.error.rawBody,
100
105
  });
101
106
  case "timeout":
102
- throw new errors.CourierTimeoutError();
107
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /translations/{domain}/{locale}.");
103
108
  case "unknown":
104
109
  throw new errors.CourierError({
105
110
  message: _response.error.errorMessage,
@@ -118,26 +123,21 @@ class Translations {
118
123
  * @throws {@link Courier.NotFoundError}
119
124
  *
120
125
  * @example
121
- * await courier.translations.update("string", "string", "string")
126
+ * await client.translations.update("domain", "locale", "string")
122
127
  */
123
128
  update(domain, locale, request, requestOptions) {
124
- var _a, _b;
125
129
  return __awaiter(this, void 0, void 0, function* () {
130
+ var _a, _b, _c;
126
131
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
127
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
132
+ 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, `/translations/${encodeURIComponent(domain)}/${encodeURIComponent(locale)}`),
128
133
  method: "PUT",
129
- headers: {
130
- Authorization: yield this._getAuthorizationHeader(),
131
- "X-Fern-Language": "JavaScript",
132
- "X-Fern-SDK-Name": "@trycourier/courier",
133
- "X-Fern-SDK-Version": "v6.3.1",
134
- "X-Fern-Runtime": core.RUNTIME.type,
135
- "X-Fern-Runtime-Version": core.RUNTIME.version,
136
- },
134
+ 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),
137
135
  contentType: "application/json",
136
+ requestType: "json",
138
137
  body: request,
139
138
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
140
139
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
140
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
141
141
  });
142
142
  if (_response.ok) {
143
143
  return;
@@ -160,7 +160,7 @@ class Translations {
160
160
  body: _response.error.rawBody,
161
161
  });
162
162
  case "timeout":
163
- throw new errors.CourierTimeoutError();
163
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /translations/{domain}/{locale}.");
164
164
  case "unknown":
165
165
  throw new errors.CourierError({
166
166
  message: _response.error.errorMessage,
@@ -169,12 +169,12 @@ class Translations {
169
169
  });
170
170
  }
171
171
  _getAuthorizationHeader() {
172
- var _a;
173
172
  return __awaiter(this, void 0, void 0, function* () {
173
+ var _a;
174
174
  const bearer = (_a = (yield core.Supplier.get(this._options.authorizationToken))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["COURIER_AUTH_TOKEN"];
175
175
  if (bearer == null) {
176
176
  throw new errors.CourierError({
177
- message: "Please specify COURIER_AUTH_TOKEN when instantiating the client.",
177
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
178
178
  });
179
179
  }
180
180
  return `Bearer ${bearer}`;