@trycourier/courier 6.3.0 → 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 (394) 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 +32 -120
  35. package/api/resources/bulk/client/Client.js +80 -191
  36. package/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  37. package/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +13 -0
  38. package/api/resources/bulk/client/requests/BulkGetUsersParams.js +5 -0
  39. package/api/resources/bulk/client/requests/index.d.ts +1 -0
  40. package/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  41. package/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  42. package/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  43. package/api/resources/commons/errors/AlreadyExistsError.js +17 -7
  44. package/api/resources/commons/errors/BadRequestError.js +17 -7
  45. package/api/resources/commons/errors/ConflictError.js +17 -7
  46. package/api/resources/commons/errors/MessageNotFoundError.js +17 -7
  47. package/api/resources/commons/errors/NotFoundError.js +17 -7
  48. package/api/resources/commons/errors/PaymentRequiredError.js +17 -7
  49. package/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  50. package/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  51. package/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  52. package/api/resources/inbound/client/Client.d.ts +9 -1
  53. package/api/resources/inbound/client/Client.js +26 -21
  54. package/api/resources/index.js +17 -7
  55. package/api/resources/lists/client/Client.d.ts +31 -34
  56. package/api/resources/lists/client/Client.js +108 -161
  57. package/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  58. package/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  59. package/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  60. package/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  61. package/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  62. package/api/resources/messages/client/Client.d.ts +15 -24
  63. package/api/resources/messages/client/Client.js +65 -104
  64. package/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  65. package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  66. package/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  67. package/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  68. package/api/resources/messages/types/MessageStatus.d.ts +25 -5
  69. package/api/resources/messages/types/MessageStatus.js +6 -1
  70. package/api/resources/messages/types/Reason.d.ts +1 -1
  71. package/api/resources/messages/types/index.d.ts +1 -0
  72. package/api/resources/messages/types/index.js +1 -0
  73. package/api/resources/notifications/client/Client.d.ts +20 -11
  74. package/api/resources/notifications/client/Client.js +69 -88
  75. package/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  76. package/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  77. package/api/resources/notifications/types/BlockType.d.ts +1 -1
  78. package/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  79. package/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  80. package/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  81. package/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  82. package/api/resources/profiles/client/Client.d.ts +35 -23
  83. package/api/resources/profiles/client/Client.js +95 -125
  84. package/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  85. package/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  86. package/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  87. package/api/resources/profiles/types/DeviceType.d.ts +1 -1
  88. package/api/resources/profiles/types/Discord.d.ts +1 -1
  89. package/api/resources/profiles/types/Expo.d.ts +1 -1
  90. package/api/resources/profiles/types/MsTeams.d.ts +1 -1
  91. package/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  92. package/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  93. package/api/resources/profiles/types/Slack.d.ts +1 -1
  94. package/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  95. package/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  96. package/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  97. package/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  98. package/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  99. package/api/resources/profiles/types/index.d.ts +1 -0
  100. package/api/resources/profiles/types/index.js +1 -0
  101. package/api/resources/send/types/Attachment.d.ts +1 -1
  102. package/api/resources/send/types/ChannelSource.d.ts +1 -1
  103. package/api/resources/send/types/Content.d.ts +1 -1
  104. package/api/resources/send/types/Criteria.d.ts +1 -1
  105. package/api/resources/send/types/ElementalNode.d.ts +1 -1
  106. package/api/resources/send/types/ExpiresInType.d.ts +1 -1
  107. package/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  108. package/api/resources/send/types/IAlignment.d.ts +1 -1
  109. package/api/resources/send/types/IPreferences.d.ts +1 -1
  110. package/api/resources/send/types/InAppPlacement.d.ts +1 -1
  111. package/api/resources/send/types/Locales.d.ts +1 -1
  112. package/api/resources/send/types/Message.d.ts +1 -1
  113. package/api/resources/send/types/MessageChannels.d.ts +1 -1
  114. package/api/resources/send/types/MessageData.d.ts +1 -1
  115. package/api/resources/send/types/MessageProviders.d.ts +1 -1
  116. package/api/resources/send/types/MessageRecipient.d.ts +1 -1
  117. package/api/resources/send/types/Recipient.d.ts +1 -1
  118. package/api/resources/send/types/RecipientData.d.ts +1 -1
  119. package/api/resources/send/types/RoutingChannel.d.ts +1 -1
  120. package/api/resources/send/types/RoutingMethod.d.ts +1 -1
  121. package/api/resources/send/types/RuleType.d.ts +1 -1
  122. package/api/resources/send/types/TextAlign.d.ts +1 -1
  123. package/api/resources/send/types/TextStyle.d.ts +1 -1
  124. package/api/resources/templates/client/Client.d.ts +9 -3
  125. package/api/resources/templates/client/Client.js +28 -25
  126. package/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  127. package/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  128. package/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  129. package/api/resources/tenants/client/Client.d.ts +23 -37
  130. package/api/resources/tenants/client/Client.js +80 -127
  131. package/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  132. package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  133. package/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  134. package/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  135. package/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  136. package/api/resources/translations/client/Client.d.ts +10 -2
  137. package/api/resources/translations/client/Client.js +33 -33
  138. package/api/resources/users/client/Client.d.ts +5 -7
  139. package/api/resources/users/resources/index.js +17 -7
  140. package/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
  141. package/api/resources/users/resources/preferences/client/Client.js +46 -55
  142. package/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  143. package/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  144. package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  145. package/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
  146. package/api/resources/users/resources/tenants/client/Client.js +68 -89
  147. package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  148. package/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  149. package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  150. package/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
  151. package/api/resources/users/resources/tokens/client/Client.js +74 -104
  152. package/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  153. package/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  154. package/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  155. package/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  156. package/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  157. package/core/auth/BearerToken.d.ts +1 -1
  158. package/core/fetcher/APIResponse.d.ts +1 -1
  159. package/core/fetcher/Fetcher.d.ts +7 -3
  160. package/core/fetcher/Fetcher.js +30 -135
  161. package/core/fetcher/Supplier.d.ts +1 -1
  162. package/core/fetcher/createRequestUrl.d.ts +1 -0
  163. package/core/fetcher/createRequestUrl.js +12 -0
  164. package/core/fetcher/getFetchFn.d.ts +4 -0
  165. package/core/fetcher/getFetchFn.js +68 -0
  166. package/core/fetcher/getHeader.js +1 -2
  167. package/core/fetcher/getRequestBody.d.ts +7 -0
  168. package/core/fetcher/getRequestBody.js +23 -0
  169. package/core/fetcher/getResponseBody.d.ts +1 -0
  170. package/core/fetcher/getResponseBody.js +54 -0
  171. package/core/fetcher/makeRequest.d.ts +1 -0
  172. package/core/fetcher/makeRequest.js +42 -0
  173. package/core/fetcher/requestWithRetries.d.ts +1 -0
  174. package/core/fetcher/requestWithRetries.js +40 -0
  175. package/core/fetcher/signals.d.ts +11 -0
  176. package/core/fetcher/signals.js +36 -0
  177. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  178. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  179. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  180. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  181. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  182. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  183. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  184. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  185. package/core/json.d.ts +15 -0
  186. package/core/json.js +24 -0
  187. package/core/runtime/runtime.d.ts +2 -1
  188. package/core/runtime/runtime.js +57 -36
  189. package/dist/Client.d.ts +84 -109
  190. package/dist/Client.js +118 -148
  191. package/dist/api/client/requests/SendMessageRequest.d.ts +45 -78
  192. package/dist/api/resources/audiences/client/Client.d.ts +16 -16
  193. package/dist/api/resources/audiences/client/Client.js +63 -86
  194. package/dist/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
  195. package/dist/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
  196. package/dist/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
  197. package/dist/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
  198. package/dist/api/resources/audiences/types/Filter.d.ts +1 -1
  199. package/dist/api/resources/audiences/types/FilterConfig.d.ts +1 -1
  200. package/dist/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
  201. package/dist/api/resources/audiences/types/Operator.d.ts +1 -1
  202. package/dist/api/resources/auditEvents/client/Client.d.ts +10 -4
  203. package/dist/api/resources/auditEvents/client/Client.js +35 -37
  204. package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
  205. package/dist/api/resources/authTokens/client/Client.d.ts +11 -3
  206. package/dist/api/resources/authTokens/client/Client.js +28 -25
  207. package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
  208. package/dist/api/resources/automations/client/Client.d.ts +15 -13
  209. package/dist/api/resources/automations/client/Client.js +38 -48
  210. package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
  211. package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
  212. package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
  213. package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
  214. package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  215. package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
  216. package/dist/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
  217. package/dist/api/resources/automations/types/Profile.d.ts +1 -1
  218. package/dist/api/resources/brands/client/Client.d.ts +22 -58
  219. package/dist/api/resources/brands/client/Client.js +65 -126
  220. package/dist/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
  221. package/dist/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
  222. package/dist/api/resources/bulk/client/Client.d.ts +32 -120
  223. package/dist/api/resources/bulk/client/Client.js +80 -191
  224. package/dist/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  225. package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +13 -0
  226. package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.js +5 -0
  227. package/dist/api/resources/bulk/client/requests/index.d.ts +1 -0
  228. package/dist/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  229. package/dist/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  230. package/dist/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  231. package/dist/api/resources/commons/errors/AlreadyExistsError.js +17 -7
  232. package/dist/api/resources/commons/errors/BadRequestError.js +17 -7
  233. package/dist/api/resources/commons/errors/ConflictError.js +17 -7
  234. package/dist/api/resources/commons/errors/MessageNotFoundError.js +17 -7
  235. package/dist/api/resources/commons/errors/NotFoundError.js +17 -7
  236. package/dist/api/resources/commons/errors/PaymentRequiredError.js +17 -7
  237. package/dist/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  238. package/dist/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  239. package/dist/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  240. package/dist/api/resources/inbound/client/Client.d.ts +9 -1
  241. package/dist/api/resources/inbound/client/Client.js +26 -21
  242. package/dist/api/resources/index.js +17 -7
  243. package/dist/api/resources/lists/client/Client.d.ts +31 -34
  244. package/dist/api/resources/lists/client/Client.js +108 -161
  245. package/dist/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  246. package/dist/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  247. package/dist/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  248. package/dist/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  249. package/dist/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  250. package/dist/api/resources/messages/client/Client.d.ts +15 -24
  251. package/dist/api/resources/messages/client/Client.js +65 -104
  252. package/dist/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  253. package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  254. package/dist/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  255. package/dist/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  256. package/dist/api/resources/messages/types/MessageStatus.d.ts +25 -5
  257. package/dist/api/resources/messages/types/MessageStatus.js +6 -1
  258. package/dist/api/resources/messages/types/Reason.d.ts +1 -1
  259. package/dist/api/resources/messages/types/index.d.ts +1 -0
  260. package/dist/api/resources/messages/types/index.js +1 -0
  261. package/dist/api/resources/notifications/client/Client.d.ts +20 -11
  262. package/dist/api/resources/notifications/client/Client.js +69 -88
  263. package/dist/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  264. package/dist/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  265. package/dist/api/resources/notifications/types/BlockType.d.ts +1 -1
  266. package/dist/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  267. package/dist/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  268. package/dist/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  269. package/dist/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  270. package/dist/api/resources/profiles/client/Client.d.ts +35 -23
  271. package/dist/api/resources/profiles/client/Client.js +95 -125
  272. package/dist/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  273. package/dist/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  274. package/dist/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  275. package/dist/api/resources/profiles/types/DeviceType.d.ts +1 -1
  276. package/dist/api/resources/profiles/types/Discord.d.ts +1 -1
  277. package/dist/api/resources/profiles/types/Expo.d.ts +1 -1
  278. package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
  279. package/dist/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  280. package/dist/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  281. package/dist/api/resources/profiles/types/Slack.d.ts +1 -1
  282. package/dist/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  283. package/dist/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  284. package/dist/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  285. package/dist/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  286. package/dist/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  287. package/dist/api/resources/profiles/types/index.d.ts +1 -0
  288. package/dist/api/resources/profiles/types/index.js +1 -0
  289. package/dist/api/resources/send/types/Attachment.d.ts +1 -1
  290. package/dist/api/resources/send/types/ChannelSource.d.ts +1 -1
  291. package/dist/api/resources/send/types/Content.d.ts +1 -1
  292. package/dist/api/resources/send/types/Criteria.d.ts +1 -1
  293. package/dist/api/resources/send/types/ElementalNode.d.ts +1 -1
  294. package/dist/api/resources/send/types/ExpiresInType.d.ts +1 -1
  295. package/dist/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  296. package/dist/api/resources/send/types/IAlignment.d.ts +1 -1
  297. package/dist/api/resources/send/types/IPreferences.d.ts +1 -1
  298. package/dist/api/resources/send/types/InAppPlacement.d.ts +1 -1
  299. package/dist/api/resources/send/types/Locales.d.ts +1 -1
  300. package/dist/api/resources/send/types/Message.d.ts +1 -1
  301. package/dist/api/resources/send/types/MessageChannels.d.ts +1 -1
  302. package/dist/api/resources/send/types/MessageData.d.ts +1 -1
  303. package/dist/api/resources/send/types/MessageProviders.d.ts +1 -1
  304. package/dist/api/resources/send/types/MessageRecipient.d.ts +1 -1
  305. package/dist/api/resources/send/types/Recipient.d.ts +1 -1
  306. package/dist/api/resources/send/types/RecipientData.d.ts +1 -1
  307. package/dist/api/resources/send/types/RoutingChannel.d.ts +1 -1
  308. package/dist/api/resources/send/types/RoutingMethod.d.ts +1 -1
  309. package/dist/api/resources/send/types/RuleType.d.ts +1 -1
  310. package/dist/api/resources/send/types/TextAlign.d.ts +1 -1
  311. package/dist/api/resources/send/types/TextStyle.d.ts +1 -1
  312. package/dist/api/resources/templates/client/Client.d.ts +9 -3
  313. package/dist/api/resources/templates/client/Client.js +28 -25
  314. package/dist/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  315. package/dist/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  316. package/dist/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  317. package/dist/api/resources/tenants/client/Client.d.ts +23 -37
  318. package/dist/api/resources/tenants/client/Client.js +80 -127
  319. package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  320. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  321. package/dist/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  322. package/dist/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  323. package/dist/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  324. package/dist/api/resources/translations/client/Client.d.ts +10 -2
  325. package/dist/api/resources/translations/client/Client.js +33 -33
  326. package/dist/api/resources/users/client/Client.d.ts +5 -7
  327. package/dist/api/resources/users/resources/index.js +17 -7
  328. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
  329. package/dist/api/resources/users/resources/preferences/client/Client.js +46 -55
  330. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  331. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  332. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  333. package/dist/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
  334. package/dist/api/resources/users/resources/tenants/client/Client.js +68 -89
  335. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  336. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  337. package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  338. package/dist/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
  339. package/dist/api/resources/users/resources/tokens/client/Client.js +74 -104
  340. package/dist/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  341. package/dist/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  342. package/dist/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  343. package/dist/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  344. package/dist/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  345. package/dist/core/auth/BearerToken.d.ts +1 -1
  346. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  347. package/dist/core/fetcher/Fetcher.d.ts +7 -3
  348. package/dist/core/fetcher/Fetcher.js +30 -135
  349. package/dist/core/fetcher/Supplier.d.ts +1 -1
  350. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  351. package/dist/core/fetcher/createRequestUrl.js +12 -0
  352. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  353. package/dist/core/fetcher/getFetchFn.js +68 -0
  354. package/dist/core/fetcher/getHeader.js +1 -2
  355. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  356. package/dist/core/fetcher/getRequestBody.js +23 -0
  357. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  358. package/dist/core/fetcher/getResponseBody.js +54 -0
  359. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  360. package/dist/core/fetcher/makeRequest.js +42 -0
  361. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  362. package/dist/core/fetcher/requestWithRetries.js +40 -0
  363. package/dist/core/fetcher/signals.d.ts +11 -0
  364. package/dist/core/fetcher/signals.js +36 -0
  365. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  366. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  367. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  368. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  369. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  370. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  371. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  372. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  373. package/dist/core/json.d.ts +15 -0
  374. package/dist/core/json.js +24 -0
  375. package/dist/core/runtime/runtime.d.ts +2 -1
  376. package/dist/core/runtime/runtime.js +57 -36
  377. package/dist/environments.d.ts +1 -1
  378. package/dist/errors/CourierError.js +2 -1
  379. package/dist/errors/CourierTimeoutError.d.ts +1 -1
  380. package/dist/errors/CourierTimeoutError.js +2 -2
  381. package/dist/index.js +17 -7
  382. package/dist/version.d.ts +1 -0
  383. package/dist/version.js +4 -0
  384. package/environments.d.ts +1 -1
  385. package/errors/CourierError.js +2 -1
  386. package/errors/CourierTimeoutError.d.ts +1 -1
  387. package/errors/CourierTimeoutError.js +2 -2
  388. package/index.js +17 -7
  389. package/{jest.config.js → jest.config.mjs} +4 -1
  390. package/package.json +23 -14
  391. package/reference.md +5180 -0
  392. package/scripts/rename-to-esm-files.js +115 -0
  393. package/version.d.ts +1 -0
  394. 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) {
@@ -57,56 +67,30 @@ class Brands {
57
67
  * @throws {@link Courier.AlreadyExistsError}
58
68
  *
59
69
  * @example
60
- * await courier.brands.create({
61
- * id: "string",
62
- * name: "string",
70
+ * await client.brands.create({
71
+ * id: undefined,
72
+ * name: "name",
63
73
  * settings: {
64
- * colors: {
65
- * primary: "string",
66
- * secondary: "string",
67
- * tertiary: "string"
68
- * },
69
- * inapp: {
70
- * "key": "value"
71
- * },
72
- * email: {
73
- * footer: {
74
- * "key": "value"
75
- * },
76
- * header: {
77
- * "key": "value"
78
- * }
79
- * }
74
+ * colors: undefined,
75
+ * inapp: undefined,
76
+ * email: undefined
80
77
  * },
81
- * snippets: {
82
- * items: [{
83
- * format: "handlebars",
84
- * name: "string",
85
- * value: "string"
86
- * }]
87
- * }
78
+ * snippets: undefined
88
79
  * })
89
80
  */
90
81
  create(request, requestOptions) {
91
- var _a, _b;
92
82
  return __awaiter(this, void 0, void 0, function* () {
83
+ var _a, _b, _c;
93
84
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
94
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, "/brands"),
85
+ 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, "/brands"),
95
86
  method: "POST",
96
- headers: {
97
- Authorization: yield this._getAuthorizationHeader(),
98
- "X-Fern-Language": "JavaScript",
99
- "X-Fern-SDK-Name": "@trycourier/courier",
100
- "X-Fern-SDK-Version": "v6.3.0",
101
- "X-Fern-Runtime": core.RUNTIME.type,
102
- "X-Fern-Runtime-Version": core.RUNTIME.version,
103
- "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
104
- "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
105
- },
87
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
106
88
  contentType: "application/json",
89
+ requestType: "json",
107
90
  body: request,
108
91
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
109
92
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
93
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
110
94
  });
111
95
  if (_response.ok) {
112
96
  return _response.body;
@@ -133,7 +117,7 @@ class Brands {
133
117
  body: _response.error.rawBody,
134
118
  });
135
119
  case "timeout":
136
- throw new errors.CourierTimeoutError();
120
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /brands.");
137
121
  case "unknown":
138
122
  throw new errors.CourierError({
139
123
  message: _response.error.errorMessage,
@@ -148,25 +132,20 @@ class Brands {
148
132
  * @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
149
133
  *
150
134
  * @example
151
- * await courier.brands.get("string")
135
+ * await client.brands.get("brand_id")
152
136
  */
153
137
  get(brandId, requestOptions) {
154
- var _a, _b;
155
138
  return __awaiter(this, void 0, void 0, function* () {
139
+ var _a, _b, _c;
156
140
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
157
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
141
+ 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, `/brands/${encodeURIComponent(brandId)}`),
158
142
  method: "GET",
159
- headers: {
160
- Authorization: yield this._getAuthorizationHeader(),
161
- "X-Fern-Language": "JavaScript",
162
- "X-Fern-SDK-Name": "@trycourier/courier",
163
- "X-Fern-SDK-Version": "v6.3.0",
164
- "X-Fern-Runtime": core.RUNTIME.type,
165
- "X-Fern-Runtime-Version": core.RUNTIME.version,
166
- },
143
+ 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),
167
144
  contentType: "application/json",
145
+ requestType: "json",
168
146
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
169
147
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
170
149
  });
171
150
  if (_response.ok) {
172
151
  return _response.body;
@@ -184,7 +163,7 @@ class Brands {
184
163
  body: _response.error.rawBody,
185
164
  });
186
165
  case "timeout":
187
- throw new errors.CourierTimeoutError();
166
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands/{brand_id}.");
188
167
  case "unknown":
189
168
  throw new errors.CourierError({
190
169
  message: _response.error.errorMessage,
@@ -199,33 +178,26 @@ class Brands {
199
178
  * @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
200
179
  *
201
180
  * @example
202
- * await courier.brands.list({
203
- * cursor: "string"
204
- * })
181
+ * await client.brands.list()
205
182
  */
206
- list(request = {}, requestOptions) {
207
- var _a, _b;
208
- return __awaiter(this, void 0, void 0, function* () {
183
+ list() {
184
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
185
+ var _a, _b, _c;
209
186
  const { cursor } = request;
210
187
  const _queryParams = {};
211
188
  if (cursor != null) {
212
189
  _queryParams["cursor"] = cursor;
213
190
  }
214
191
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
215
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, "/brands"),
192
+ 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, "/brands"),
216
193
  method: "GET",
217
- headers: {
218
- Authorization: yield this._getAuthorizationHeader(),
219
- "X-Fern-Language": "JavaScript",
220
- "X-Fern-SDK-Name": "@trycourier/courier",
221
- "X-Fern-SDK-Version": "v6.3.0",
222
- "X-Fern-Runtime": core.RUNTIME.type,
223
- "X-Fern-Runtime-Version": core.RUNTIME.version,
224
- },
194
+ 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),
225
195
  contentType: "application/json",
226
196
  queryParameters: _queryParams,
197
+ requestType: "json",
227
198
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
228
199
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
200
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
229
201
  });
230
202
  if (_response.ok) {
231
203
  return _response.body;
@@ -243,7 +215,7 @@ class Brands {
243
215
  body: _response.error.rawBody,
244
216
  });
245
217
  case "timeout":
246
- throw new errors.CourierTimeoutError();
218
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands.");
247
219
  case "unknown":
248
220
  throw new errors.CourierError({
249
221
  message: _response.error.errorMessage,
@@ -260,25 +232,20 @@ class Brands {
260
232
  * @throws {@link Courier.ConflictError}
261
233
  *
262
234
  * @example
263
- * await courier.brands.delete("string")
235
+ * await client.brands.delete("brand_id")
264
236
  */
265
237
  delete(brandId, requestOptions) {
266
- var _a, _b;
267
238
  return __awaiter(this, void 0, void 0, function* () {
239
+ var _a, _b, _c;
268
240
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
269
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
241
+ 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, `/brands/${encodeURIComponent(brandId)}`),
270
242
  method: "DELETE",
271
- headers: {
272
- Authorization: yield this._getAuthorizationHeader(),
273
- "X-Fern-Language": "JavaScript",
274
- "X-Fern-SDK-Name": "@trycourier/courier",
275
- "X-Fern-SDK-Version": "v6.3.0",
276
- "X-Fern-Runtime": core.RUNTIME.type,
277
- "X-Fern-Runtime-Version": core.RUNTIME.version,
278
- },
243
+ 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),
279
244
  contentType: "application/json",
245
+ requestType: "json",
280
246
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
281
247
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
248
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
282
249
  });
283
250
  if (_response.ok) {
284
251
  return;
@@ -301,7 +268,7 @@ class Brands {
301
268
  body: _response.error.rawBody,
302
269
  });
303
270
  case "timeout":
304
- throw new errors.CourierTimeoutError();
271
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /brands/{brand_id}.");
305
272
  case "unknown":
306
273
  throw new errors.CourierError({
307
274
  message: _response.error.errorMessage,
@@ -317,53 +284,25 @@ class Brands {
317
284
  * @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
318
285
  *
319
286
  * @example
320
- * await courier.brands.replace("string", {
321
- * name: "string",
322
- * settings: {
323
- * colors: {
324
- * primary: "string",
325
- * secondary: "string",
326
- * tertiary: "string"
327
- * },
328
- * inapp: {
329
- * "key": "value"
330
- * },
331
- * email: {
332
- * footer: {
333
- * "key": "value"
334
- * },
335
- * header: {
336
- * "key": "value"
337
- * }
338
- * }
339
- * },
340
- * snippets: {
341
- * items: [{
342
- * format: "handlebars",
343
- * name: "string",
344
- * value: "string"
345
- * }]
346
- * }
287
+ * await client.brands.replace("brand_id", {
288
+ * name: "name",
289
+ * settings: undefined,
290
+ * snippets: undefined
347
291
  * })
348
292
  */
349
293
  replace(brandId, request, requestOptions) {
350
- var _a, _b;
351
294
  return __awaiter(this, void 0, void 0, function* () {
295
+ var _a, _b, _c;
352
296
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
353
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
297
+ 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, `/brands/${encodeURIComponent(brandId)}`),
354
298
  method: "PUT",
355
- headers: {
356
- Authorization: yield this._getAuthorizationHeader(),
357
- "X-Fern-Language": "JavaScript",
358
- "X-Fern-SDK-Name": "@trycourier/courier",
359
- "X-Fern-SDK-Version": "v6.3.0",
360
- "X-Fern-Runtime": core.RUNTIME.type,
361
- "X-Fern-Runtime-Version": core.RUNTIME.version,
362
- },
299
+ 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),
363
300
  contentType: "application/json",
301
+ requestType: "json",
364
302
  body: request,
365
303
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
366
304
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
305
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
367
306
  });
368
307
  if (_response.ok) {
369
308
  return _response.body;
@@ -381,7 +320,7 @@ class Brands {
381
320
  body: _response.error.rawBody,
382
321
  });
383
322
  case "timeout":
384
- throw new errors.CourierTimeoutError();
323
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /brands/{brand_id}.");
385
324
  case "unknown":
386
325
  throw new errors.CourierError({
387
326
  message: _response.error.errorMessage,
@@ -390,12 +329,12 @@ class Brands {
390
329
  });
391
330
  }
392
331
  _getAuthorizationHeader() {
393
- var _a;
394
332
  return __awaiter(this, void 0, void 0, function* () {
333
+ var _a;
395
334
  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"];
396
335
  if (bearer == null) {
397
336
  throw new errors.CourierError({
398
- message: "Please specify COURIER_AUTH_TOKEN when instantiating the client.",
337
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
399
338
  });
400
339
  }
401
340
  return `Bearer ${bearer}`;
@@ -5,32 +5,9 @@ import * as Courier from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * name: "string",
9
- * settings: {
10
- * colors: {
11
- * primary: "string",
12
- * secondary: "string",
13
- * tertiary: "string"
14
- * },
15
- * inapp: {
16
- * "key": "value"
17
- * },
18
- * email: {
19
- * footer: {
20
- * "key": "value"
21
- * },
22
- * header: {
23
- * "key": "value"
24
- * }
25
- * }
26
- * },
27
- * snippets: {
28
- * items: [{
29
- * format: "handlebars",
30
- * name: "string",
31
- * value: "string"
32
- * }]
33
- * }
8
+ * name: "name",
9
+ * settings: undefined,
10
+ * snippets: undefined
34
11
  * }
35
12
  */
36
13
  export interface BrandUpdateParameters {
@@ -3,9 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * cursor: "string"
8
- * }
6
+ * {}
9
7
  */
10
8
  export interface ListBrandsRequest {
11
9
  /**
@@ -7,12 +7,20 @@ import * as Courier from "../../../index";
7
7
  export declare namespace Bulk {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CourierEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  authorizationToken?: core.Supplier<core.BearerToken | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
13
15
  interface RequestOptions {
16
+ /** The maximum time to wait for a response in seconds. */
14
17
  timeoutInSeconds?: number;
18
+ /** The number of times to retry the request. Defaults to 2. */
15
19
  maxRetries?: number;
20
+ /** A hook to abort the request. */
21
+ abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
16
24
  }
17
25
  interface IdempotentRequestOptions extends RequestOptions {
18
26
  idempotencyKey?: string | undefined;
@@ -29,94 +37,14 @@ export declare class Bulk {
29
37
  * @throws {@link Courier.BadRequestError}
30
38
  *
31
39
  * @example
32
- * await courier.bulk.createJob({
40
+ * await client.bulk.createJob({
33
41
  * message: {
34
- * message: {
35
- * template: "string",
36
- * data: {
37
- * "string": {
38
- * "key": "value"
39
- * }
40
- * },
41
- * brand_id: "string",
42
- * channels: {
43
- * "string": {
44
- * brand_id: undefined,
45
- * providers: undefined,
46
- * routing_method: undefined,
47
- * if: undefined,
48
- * timeouts: undefined,
49
- * override: undefined,
50
- * metadata: undefined
51
- * }
52
- * },
53
- * context: {
54
- * tenant_id: "string"
55
- * },
56
- * metadata: {
57
- * event: "string",
58
- * tags: [],
59
- * utm: {
60
- * source: undefined,
61
- * medium: undefined,
62
- * campaign: undefined,
63
- * term: undefined,
64
- * content: undefined
65
- * },
66
- * trace_id: "string"
67
- * },
68
- * preferences: {
69
- * subscription_topic_id: "string"
70
- * },
71
- * providers: {
72
- * "string": {
73
- * override: undefined,
74
- * if: undefined,
75
- * timeouts: undefined,
76
- * metadata: undefined
77
- * }
78
- * },
79
- * routing: {
80
- * method: Courier.RoutingMethod.All,
81
- * channels: [{
82
- * channel: "string",
83
- * config: undefined,
84
- * method: undefined,
85
- * providers: undefined,
86
- * if: undefined
87
- * }]
88
- * },
89
- * timeout: {
90
- * provider: {},
91
- * channel: {},
92
- * message: 1,
93
- * escalation: 1,
94
- * criteria: Courier.Criteria.NoEscalation
95
- * },
96
- * delay: {
97
- * duration: 1,
98
- * until: "string"
99
- * },
100
- * expiry: {
101
- * expires_at: "string",
102
- * expires_in: "string"
103
- * }
104
- * },
105
- * brand: "string",
106
- * data: {
107
- * "string": {
108
- * "key": "value"
109
- * }
110
- * },
111
- * event: "string",
112
- * locale: {
113
- * "string": {
114
- * "key": "value"
115
- * }
116
- * },
117
- * override: {
118
- * "key": "value"
119
- * }
42
+ * brand: undefined,
43
+ * data: undefined,
44
+ * event: undefined,
45
+ * locale: undefined,
46
+ * override: undefined,
47
+ * message: undefined
120
48
  * }
121
49
  * })
122
50
  */
@@ -129,36 +57,19 @@ export declare class Bulk {
129
57
  * @param {Bulk.IdempotentRequestOptions} requestOptions - Request-specific configuration.
130
58
  *
131
59
  * @example
132
- * await courier.bulk.ingestUsers("string", {
60
+ * await client.bulk.ingestUsers("job_id", {
133
61
  * users: [{
134
- * preferences: {
135
- * categories: {},
136
- * notifications: {}
137
- * },
138
- * profile: {
139
- * "key": "value"
140
- * },
141
- * recipient: "string",
142
- * data: {
143
- * "key": "value"
144
- * },
145
- * to: {
146
- * account_id: "string",
147
- * context: {
148
- * tenant_id: "string"
149
- * },
150
- * data: {},
151
- * email: "string",
152
- * locale: "string",
153
- * user_id: "string",
154
- * phone_number: "string",
155
- * preferences: {
156
- * categories: undefined,
157
- * notifications: {},
158
- * templateId: undefined
159
- * },
160
- * tenant_id: "string"
161
- * }
62
+ * preferences: undefined,
63
+ * profile: undefined,
64
+ * recipient: undefined,
65
+ * data: undefined,
66
+ * to: undefined
67
+ * }, {
68
+ * preferences: undefined,
69
+ * profile: undefined,
70
+ * recipient: undefined,
71
+ * data: undefined,
72
+ * to: undefined
162
73
  * }]
163
74
  * })
164
75
  */
@@ -172,7 +83,7 @@ export declare class Bulk {
172
83
  * @throws {@link Courier.BadRequestError}
173
84
  *
174
85
  * @example
175
- * await courier.bulk.runJob("string")
86
+ * await client.bulk.runJob("job_id")
176
87
  */
177
88
  runJob(jobId: string, requestOptions?: Bulk.IdempotentRequestOptions): Promise<void>;
178
89
  /**
@@ -184,20 +95,21 @@ export declare class Bulk {
184
95
  * @throws {@link Courier.BadRequestError}
185
96
  *
186
97
  * @example
187
- * await courier.bulk.getJob("string")
98
+ * await client.bulk.getJob("job_id")
188
99
  */
189
100
  getJob(jobId: string, requestOptions?: Bulk.RequestOptions): Promise<Courier.BulkGetJobResponse>;
190
101
  /**
191
102
  * Get Bulk Job Users
192
103
  *
193
104
  * @param {string} jobId - A unique identifier representing the bulk job
105
+ * @param {Courier.BulkGetUsersParams} request
194
106
  * @param {Bulk.RequestOptions} requestOptions - Request-specific configuration.
195
107
  *
196
108
  * @throws {@link Courier.BadRequestError}
197
109
  *
198
110
  * @example
199
- * await courier.bulk.getUsers("string")
111
+ * await client.bulk.getUsers("job_id")
200
112
  */
201
- getUsers(jobId: string, requestOptions?: Bulk.RequestOptions): Promise<Courier.BulkGetJobUsersResponse>;
113
+ getUsers(jobId: string, request?: Courier.BulkGetUsersParams, requestOptions?: Bulk.RequestOptions): Promise<Courier.BulkGetJobUsersResponse>;
202
114
  protected _getAuthorizationHeader(): Promise<string>;
203
115
  }