@trycourier/courier 6.3.1 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/Client.d.ts +49 -108
  2. package/Client.js +89 -148
  3. package/README.md +113 -808
  4. package/api/client/requests/SendMessageRequest.d.ts +8 -76
  5. package/api/resources/audiences/client/Client.d.ts +26 -21
  6. package/api/resources/audiences/client/Client.js +97 -90
  7. package/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
  8. package/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
  9. package/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
  10. package/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
  11. package/api/resources/audiences/types/Filter.d.ts +1 -1
  12. package/api/resources/audiences/types/FilterConfig.d.ts +1 -1
  13. package/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
  14. package/api/resources/audiences/types/Operator.d.ts +1 -1
  15. package/api/resources/auditEvents/client/Client.d.ts +14 -6
  16. package/api/resources/auditEvents/client/Client.js +48 -38
  17. package/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
  18. package/api/resources/authTokens/client/Client.d.ts +13 -4
  19. package/api/resources/authTokens/client/Client.js +35 -26
  20. package/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
  21. package/api/resources/automations/client/Client.d.ts +19 -15
  22. package/api/resources/automations/client/Client.js +52 -50
  23. package/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
  24. package/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
  25. package/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
  26. package/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
  27. package/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  28. package/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
  29. package/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
  30. package/api/resources/automations/types/Profile.d.ts +1 -1
  31. package/api/resources/brands/client/Client.d.ts +32 -63
  32. package/api/resources/brands/client/Client.js +103 -134
  33. package/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
  34. package/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
  35. package/api/resources/bulk/client/Client.d.ts +40 -126
  36. package/api/resources/bulk/client/Client.js +111 -201
  37. package/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  38. package/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
  39. package/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  40. package/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  41. package/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  42. package/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
  43. package/api/resources/commons/errors/AlreadyExistsError.js +19 -8
  44. package/api/resources/commons/errors/BadRequestError.d.ts +2 -1
  45. package/api/resources/commons/errors/BadRequestError.js +19 -8
  46. package/api/resources/commons/errors/ConflictError.d.ts +2 -1
  47. package/api/resources/commons/errors/ConflictError.js +19 -8
  48. package/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
  49. package/api/resources/commons/errors/MessageNotFoundError.js +19 -8
  50. package/api/resources/commons/errors/NotFoundError.d.ts +2 -1
  51. package/api/resources/commons/errors/NotFoundError.js +19 -8
  52. package/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
  53. package/api/resources/commons/errors/PaymentRequiredError.js +19 -8
  54. package/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  55. package/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  56. package/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  57. package/api/resources/inbound/client/Client.d.ts +11 -2
  58. package/api/resources/inbound/client/Client.js +35 -24
  59. package/api/resources/index.js +17 -7
  60. package/api/resources/lists/client/Client.d.ts +51 -44
  61. package/api/resources/lists/client/Client.js +181 -174
  62. package/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  63. package/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  64. package/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  65. package/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  66. package/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  67. package/api/resources/messages/client/Client.d.ts +26 -29
  68. package/api/resources/messages/client/Client.js +111 -114
  69. package/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  70. package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  71. package/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  72. package/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  73. package/api/resources/messages/types/MessageStatus.d.ts +25 -5
  74. package/api/resources/messages/types/MessageStatus.js +6 -1
  75. package/api/resources/messages/types/Reason.d.ts +1 -1
  76. package/api/resources/messages/types/index.d.ts +1 -0
  77. package/api/resources/messages/types/index.js +1 -0
  78. package/api/resources/notifications/client/Client.d.ts +32 -17
  79. package/api/resources/notifications/client/Client.js +119 -93
  80. package/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  81. package/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  82. package/api/resources/notifications/types/BlockType.d.ts +1 -1
  83. package/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  84. package/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  85. package/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  86. package/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  87. package/api/resources/profiles/client/Client.d.ts +50 -30
  88. package/api/resources/profiles/client/Client.js +160 -139
  89. package/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  90. package/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  91. package/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  92. package/api/resources/profiles/types/DeviceType.d.ts +1 -1
  93. package/api/resources/profiles/types/Discord.d.ts +1 -1
  94. package/api/resources/profiles/types/Expo.d.ts +1 -1
  95. package/api/resources/profiles/types/MsTeams.d.ts +1 -1
  96. package/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  97. package/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  98. package/api/resources/profiles/types/Slack.d.ts +1 -1
  99. package/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  100. package/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  101. package/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  102. package/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  103. package/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  104. package/api/resources/profiles/types/index.d.ts +1 -0
  105. package/api/resources/profiles/types/index.js +1 -0
  106. package/api/resources/send/types/Attachment.d.ts +1 -1
  107. package/api/resources/send/types/ChannelSource.d.ts +1 -1
  108. package/api/resources/send/types/Content.d.ts +1 -1
  109. package/api/resources/send/types/Criteria.d.ts +1 -1
  110. package/api/resources/send/types/ElementalNode.d.ts +1 -1
  111. package/api/resources/send/types/ExpiresInType.d.ts +1 -1
  112. package/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  113. package/api/resources/send/types/IAlignment.d.ts +1 -1
  114. package/api/resources/send/types/IPreferences.d.ts +1 -1
  115. package/api/resources/send/types/InAppPlacement.d.ts +1 -1
  116. package/api/resources/send/types/Locales.d.ts +1 -1
  117. package/api/resources/send/types/Message.d.ts +1 -1
  118. package/api/resources/send/types/MessageChannels.d.ts +1 -1
  119. package/api/resources/send/types/MessageData.d.ts +1 -1
  120. package/api/resources/send/types/MessageProviders.d.ts +1 -1
  121. package/api/resources/send/types/MessageRecipient.d.ts +1 -1
  122. package/api/resources/send/types/Recipient.d.ts +1 -1
  123. package/api/resources/send/types/RecipientData.d.ts +1 -1
  124. package/api/resources/send/types/RoutingChannel.d.ts +1 -1
  125. package/api/resources/send/types/RoutingMethod.d.ts +1 -1
  126. package/api/resources/send/types/RuleType.d.ts +1 -1
  127. package/api/resources/send/types/TextAlign.d.ts +1 -1
  128. package/api/resources/send/types/TextStyle.d.ts +1 -1
  129. package/api/resources/templates/client/Client.d.ts +11 -4
  130. package/api/resources/templates/client/Client.js +34 -25
  131. package/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  132. package/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  133. package/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  134. package/api/resources/tenants/client/Client.d.ts +37 -44
  135. package/api/resources/tenants/client/Client.js +130 -135
  136. package/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  137. package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  138. package/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  139. package/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  140. package/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  141. package/api/resources/translations/client/Client.d.ts +14 -4
  142. package/api/resources/translations/client/Client.js +49 -37
  143. package/api/resources/users/client/Client.d.ts +5 -7
  144. package/api/resources/users/resources/index.js +17 -7
  145. package/api/resources/users/resources/preferences/client/Client.d.ts +19 -12
  146. package/api/resources/users/resources/preferences/client/Client.js +77 -59
  147. package/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  148. package/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  149. package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  150. package/api/resources/users/resources/tenants/client/Client.d.ts +33 -26
  151. package/api/resources/users/resources/tenants/client/Client.js +104 -92
  152. package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  153. package/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  154. package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  155. package/api/resources/users/resources/tokens/client/Client.d.ts +39 -35
  156. package/api/resources/users/resources/tokens/client/Client.js +121 -115
  157. package/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  158. package/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  159. package/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  160. package/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  161. package/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  162. package/core/auth/BearerToken.d.ts +1 -1
  163. package/core/fetcher/APIResponse.d.ts +11 -1
  164. package/core/fetcher/Fetcher.d.ts +7 -3
  165. package/core/fetcher/Fetcher.js +37 -135
  166. package/core/fetcher/Headers.d.ts +2 -0
  167. package/core/fetcher/Headers.js +84 -0
  168. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  169. package/core/fetcher/HttpResponsePromise.js +103 -0
  170. package/core/fetcher/RawResponse.d.ts +29 -0
  171. package/core/fetcher/RawResponse.js +44 -0
  172. package/core/fetcher/Supplier.d.ts +1 -1
  173. package/core/fetcher/createRequestUrl.d.ts +1 -0
  174. package/core/fetcher/createRequestUrl.js +12 -0
  175. package/core/fetcher/getFetchFn.d.ts +4 -0
  176. package/core/fetcher/getFetchFn.js +68 -0
  177. package/core/fetcher/getHeader.js +1 -2
  178. package/core/fetcher/getRequestBody.d.ts +7 -0
  179. package/core/fetcher/getRequestBody.js +23 -0
  180. package/core/fetcher/getResponseBody.d.ts +1 -0
  181. package/core/fetcher/getResponseBody.js +54 -0
  182. package/core/fetcher/index.d.ts +3 -0
  183. package/core/fetcher/index.js +7 -1
  184. package/core/fetcher/makeRequest.d.ts +1 -0
  185. package/core/fetcher/makeRequest.js +42 -0
  186. package/core/fetcher/requestWithRetries.d.ts +1 -0
  187. package/core/fetcher/requestWithRetries.js +40 -0
  188. package/core/fetcher/signals.d.ts +11 -0
  189. package/core/fetcher/signals.js +36 -0
  190. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  191. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  192. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  193. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  194. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  195. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  196. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  197. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  198. package/core/index.d.ts +1 -1
  199. package/core/index.js +1 -1
  200. package/core/json.d.ts +15 -0
  201. package/core/json.js +24 -0
  202. package/core/runtime/runtime.d.ts +2 -1
  203. package/core/runtime/runtime.js +57 -36
  204. package/dist/Client.d.ts +49 -108
  205. package/dist/Client.js +89 -148
  206. package/dist/api/client/requests/SendMessageRequest.d.ts +8 -76
  207. package/dist/api/resources/audiences/client/Client.d.ts +26 -21
  208. package/dist/api/resources/audiences/client/Client.js +97 -90
  209. package/dist/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
  210. package/dist/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
  211. package/dist/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
  212. package/dist/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
  213. package/dist/api/resources/audiences/types/Filter.d.ts +1 -1
  214. package/dist/api/resources/audiences/types/FilterConfig.d.ts +1 -1
  215. package/dist/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
  216. package/dist/api/resources/audiences/types/Operator.d.ts +1 -1
  217. package/dist/api/resources/auditEvents/client/Client.d.ts +14 -6
  218. package/dist/api/resources/auditEvents/client/Client.js +48 -38
  219. package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
  220. package/dist/api/resources/authTokens/client/Client.d.ts +13 -4
  221. package/dist/api/resources/authTokens/client/Client.js +35 -26
  222. package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
  223. package/dist/api/resources/automations/client/Client.d.ts +19 -15
  224. package/dist/api/resources/automations/client/Client.js +52 -50
  225. package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
  226. package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
  227. package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
  228. package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
  229. package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
  230. package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
  231. package/dist/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
  232. package/dist/api/resources/automations/types/Profile.d.ts +1 -1
  233. package/dist/api/resources/brands/client/Client.d.ts +32 -63
  234. package/dist/api/resources/brands/client/Client.js +103 -134
  235. package/dist/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
  236. package/dist/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
  237. package/dist/api/resources/bulk/client/Client.d.ts +40 -126
  238. package/dist/api/resources/bulk/client/Client.js +111 -201
  239. package/dist/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
  240. package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
  241. package/dist/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
  242. package/dist/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
  243. package/dist/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
  244. package/dist/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
  245. package/dist/api/resources/commons/errors/AlreadyExistsError.js +19 -8
  246. package/dist/api/resources/commons/errors/BadRequestError.d.ts +2 -1
  247. package/dist/api/resources/commons/errors/BadRequestError.js +19 -8
  248. package/dist/api/resources/commons/errors/ConflictError.d.ts +2 -1
  249. package/dist/api/resources/commons/errors/ConflictError.js +19 -8
  250. package/dist/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
  251. package/dist/api/resources/commons/errors/MessageNotFoundError.js +19 -8
  252. package/dist/api/resources/commons/errors/NotFoundError.d.ts +2 -1
  253. package/dist/api/resources/commons/errors/NotFoundError.js +19 -8
  254. package/dist/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
  255. package/dist/api/resources/commons/errors/PaymentRequiredError.js +19 -8
  256. package/dist/api/resources/commons/types/ChannelClassification.d.ts +1 -1
  257. package/dist/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
  258. package/dist/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
  259. package/dist/api/resources/inbound/client/Client.d.ts +11 -2
  260. package/dist/api/resources/inbound/client/Client.js +35 -24
  261. package/dist/api/resources/index.js +17 -7
  262. package/dist/api/resources/lists/client/Client.d.ts +51 -44
  263. package/dist/api/resources/lists/client/Client.js +181 -174
  264. package/dist/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
  265. package/dist/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
  266. package/dist/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
  267. package/dist/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
  268. package/dist/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
  269. package/dist/api/resources/messages/client/Client.d.ts +26 -29
  270. package/dist/api/resources/messages/client/Client.js +111 -114
  271. package/dist/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
  272. package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
  273. package/dist/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
  274. package/dist/api/resources/messages/types/MessageDetailsExtended.js +5 -0
  275. package/dist/api/resources/messages/types/MessageStatus.d.ts +25 -5
  276. package/dist/api/resources/messages/types/MessageStatus.js +6 -1
  277. package/dist/api/resources/messages/types/Reason.d.ts +1 -1
  278. package/dist/api/resources/messages/types/index.d.ts +1 -0
  279. package/dist/api/resources/messages/types/index.js +1 -0
  280. package/dist/api/resources/notifications/client/Client.d.ts +32 -17
  281. package/dist/api/resources/notifications/client/Client.js +119 -93
  282. package/dist/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
  283. package/dist/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
  284. package/dist/api/resources/notifications/types/BlockType.d.ts +1 -1
  285. package/dist/api/resources/notifications/types/CheckStatus.d.ts +1 -1
  286. package/dist/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
  287. package/dist/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
  288. package/dist/api/resources/notifications/types/NotificationContent.d.ts +1 -1
  289. package/dist/api/resources/profiles/client/Client.d.ts +50 -30
  290. package/dist/api/resources/profiles/client/Client.js +160 -139
  291. package/dist/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
  292. package/dist/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
  293. package/dist/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
  294. package/dist/api/resources/profiles/types/DeviceType.d.ts +1 -1
  295. package/dist/api/resources/profiles/types/Discord.d.ts +1 -1
  296. package/dist/api/resources/profiles/types/Expo.d.ts +1 -1
  297. package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
  298. package/dist/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
  299. package/dist/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
  300. package/dist/api/resources/profiles/types/Slack.d.ts +1 -1
  301. package/dist/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
  302. package/dist/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
  303. package/dist/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
  304. package/dist/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
  305. package/dist/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
  306. package/dist/api/resources/profiles/types/index.d.ts +1 -0
  307. package/dist/api/resources/profiles/types/index.js +1 -0
  308. package/dist/api/resources/send/types/Attachment.d.ts +1 -1
  309. package/dist/api/resources/send/types/ChannelSource.d.ts +1 -1
  310. package/dist/api/resources/send/types/Content.d.ts +1 -1
  311. package/dist/api/resources/send/types/Criteria.d.ts +1 -1
  312. package/dist/api/resources/send/types/ElementalNode.d.ts +1 -1
  313. package/dist/api/resources/send/types/ExpiresInType.d.ts +1 -1
  314. package/dist/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
  315. package/dist/api/resources/send/types/IAlignment.d.ts +1 -1
  316. package/dist/api/resources/send/types/IPreferences.d.ts +1 -1
  317. package/dist/api/resources/send/types/InAppPlacement.d.ts +1 -1
  318. package/dist/api/resources/send/types/Locales.d.ts +1 -1
  319. package/dist/api/resources/send/types/Message.d.ts +1 -1
  320. package/dist/api/resources/send/types/MessageChannels.d.ts +1 -1
  321. package/dist/api/resources/send/types/MessageData.d.ts +1 -1
  322. package/dist/api/resources/send/types/MessageProviders.d.ts +1 -1
  323. package/dist/api/resources/send/types/MessageRecipient.d.ts +1 -1
  324. package/dist/api/resources/send/types/Recipient.d.ts +1 -1
  325. package/dist/api/resources/send/types/RecipientData.d.ts +1 -1
  326. package/dist/api/resources/send/types/RoutingChannel.d.ts +1 -1
  327. package/dist/api/resources/send/types/RoutingMethod.d.ts +1 -1
  328. package/dist/api/resources/send/types/RuleType.d.ts +1 -1
  329. package/dist/api/resources/send/types/TextAlign.d.ts +1 -1
  330. package/dist/api/resources/send/types/TextStyle.d.ts +1 -1
  331. package/dist/api/resources/templates/client/Client.d.ts +11 -4
  332. package/dist/api/resources/templates/client/Client.js +34 -25
  333. package/dist/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
  334. package/dist/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
  335. package/dist/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
  336. package/dist/api/resources/tenants/client/Client.d.ts +37 -44
  337. package/dist/api/resources/tenants/client/Client.js +130 -135
  338. package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
  339. package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
  340. package/dist/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
  341. package/dist/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
  342. package/dist/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
  343. package/dist/api/resources/translations/client/Client.d.ts +14 -4
  344. package/dist/api/resources/translations/client/Client.js +49 -37
  345. package/dist/api/resources/users/client/Client.d.ts +5 -7
  346. package/dist/api/resources/users/resources/index.js +17 -7
  347. package/dist/api/resources/users/resources/preferences/client/Client.d.ts +19 -12
  348. package/dist/api/resources/users/resources/preferences/client/Client.js +77 -59
  349. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
  350. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
  351. package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
  352. package/dist/api/resources/users/resources/tenants/client/Client.d.ts +33 -26
  353. package/dist/api/resources/users/resources/tenants/client/Client.js +104 -92
  354. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
  355. package/dist/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
  356. package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
  357. package/dist/api/resources/users/resources/tokens/client/Client.d.ts +39 -35
  358. package/dist/api/resources/users/resources/tokens/client/Client.js +121 -115
  359. package/dist/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
  360. package/dist/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
  361. package/dist/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
  362. package/dist/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
  363. package/dist/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
  364. package/dist/core/auth/BearerToken.d.ts +1 -1
  365. package/dist/core/fetcher/APIResponse.d.ts +11 -1
  366. package/dist/core/fetcher/Fetcher.d.ts +7 -3
  367. package/dist/core/fetcher/Fetcher.js +37 -135
  368. package/dist/core/fetcher/Headers.d.ts +2 -0
  369. package/dist/core/fetcher/Headers.js +84 -0
  370. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  371. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  372. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  373. package/dist/core/fetcher/RawResponse.js +44 -0
  374. package/dist/core/fetcher/Supplier.d.ts +1 -1
  375. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  376. package/dist/core/fetcher/createRequestUrl.js +12 -0
  377. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  378. package/dist/core/fetcher/getFetchFn.js +68 -0
  379. package/dist/core/fetcher/getHeader.js +1 -2
  380. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  381. package/dist/core/fetcher/getRequestBody.js +23 -0
  382. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  383. package/dist/core/fetcher/getResponseBody.js +54 -0
  384. package/dist/core/fetcher/index.d.ts +3 -0
  385. package/dist/core/fetcher/index.js +7 -1
  386. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  387. package/dist/core/fetcher/makeRequest.js +42 -0
  388. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  389. package/dist/core/fetcher/requestWithRetries.js +40 -0
  390. package/dist/core/fetcher/signals.d.ts +11 -0
  391. package/dist/core/fetcher/signals.js +36 -0
  392. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  393. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  394. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  395. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  396. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  397. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  398. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  399. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  400. package/dist/core/index.d.ts +1 -1
  401. package/dist/core/index.js +1 -1
  402. package/dist/core/json.d.ts +15 -0
  403. package/dist/core/json.js +24 -0
  404. package/dist/core/runtime/runtime.d.ts +2 -1
  405. package/dist/core/runtime/runtime.js +57 -36
  406. package/dist/environments.d.ts +1 -1
  407. package/dist/errors/CourierError.d.ts +4 -1
  408. package/dist/errors/CourierError.js +6 -8
  409. package/dist/errors/CourierTimeoutError.d.ts +1 -1
  410. package/dist/errors/CourierTimeoutError.js +2 -2
  411. package/dist/index.js +17 -7
  412. package/dist/version.d.ts +1 -0
  413. package/dist/version.js +4 -0
  414. package/environments.d.ts +1 -1
  415. package/errors/CourierError.d.ts +4 -1
  416. package/errors/CourierError.js +6 -8
  417. package/errors/CourierTimeoutError.d.ts +1 -1
  418. package/errors/CourierTimeoutError.js +2 -2
  419. package/index.js +17 -7
  420. package/{jest.config.js → jest.config.mjs} +4 -1
  421. package/package.json +25 -15
  422. package/reference.md +5142 -0
  423. package/scripts/rename-to-esm-files.js +115 -0
  424. package/version.d.ts +1 -0
  425. package/version.js +4 -0
@@ -6,87 +6,19 @@ import * as Courier from "../../index";
6
6
  * @example
7
7
  * {
8
8
  * message: {
9
+ * to: {
10
+ * email: "email@example.com"
11
+ * },
9
12
  * content: {
10
- * version: "string",
11
- * brand: {
12
- * "key": "value"
13
- * },
14
- * elements: [{
15
- * type: "text"
16
- * }]
13
+ * title: "Welcome!",
14
+ * body: "Thanks for signing up, {{name}}"
17
15
  * },
18
16
  * data: {
19
- * "string": {
20
- * "key": "value"
21
- * }
22
- * },
23
- * brand_id: "string",
24
- * channels: {
25
- * "string": {
26
- * brand_id: undefined,
27
- * providers: undefined,
28
- * routing_method: undefined,
29
- * if: undefined,
30
- * timeouts: undefined,
31
- * override: undefined,
32
- * metadata: undefined
33
- * }
34
- * },
35
- * context: {
36
- * tenant_id: "string"
37
- * },
38
- * metadata: {
39
- * event: "string",
40
- * tags: [],
41
- * utm: {
42
- * source: undefined,
43
- * medium: undefined,
44
- * campaign: undefined,
45
- * term: undefined,
46
- * content: undefined
47
- * },
48
- * trace_id: "string"
49
- * },
50
- * preferences: {
51
- * subscription_topic_id: "string"
52
- * },
53
- * providers: {
54
- * "string": {
55
- * override: undefined,
56
- * if: undefined,
57
- * timeouts: undefined,
58
- * metadata: undefined
59
- * }
17
+ * "name": "Peter Parker"
60
18
  * },
61
19
  * routing: {
62
- * method: Courier.RoutingMethod.All,
63
- * channels: [{
64
- * channel: "string",
65
- * config: undefined,
66
- * method: undefined,
67
- * providers: undefined,
68
- * if: undefined
69
- * }]
70
- * },
71
- * timeout: {
72
- * provider: {},
73
- * channel: {},
74
- * message: 1,
75
- * escalation: 1,
76
- * criteria: Courier.Criteria.NoEscalation
77
- * },
78
- * delay: {
79
- * duration: 1,
80
- * until: "string"
81
- * },
82
- * expiry: {
83
- * expires_at: "string",
84
- * expires_in: "string"
85
- * },
86
- * to: {
87
- * audience_id: "string",
88
- * data: {},
89
- * filters: []
20
+ * method: "single",
21
+ * channels: ["email"]
90
22
  * }
91
23
  * }
92
24
  * }
@@ -7,12 +7,20 @@ import * as Courier from "../../../index";
7
7
  export declare namespace Audiences {
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
  }
18
26
  export declare class Audiences {
@@ -25,9 +33,10 @@ export declare class Audiences {
25
33
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
26
34
  *
27
35
  * @example
28
- * await courier.audiences.get("string")
36
+ * await client.audiences.get("audience_id")
29
37
  */
30
- get(audienceId: string, requestOptions?: Audiences.RequestOptions): Promise<Courier.Audience>;
38
+ get(audienceId: string, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Courier.Audience>;
39
+ private __get;
31
40
  /**
32
41
  * Creates or updates audience.
33
42
  *
@@ -36,17 +45,14 @@ export declare class Audiences {
36
45
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
37
46
  *
38
47
  * @example
39
- * await courier.audiences.update("string", {
40
- * name: "string",
41
- * description: "string",
42
- * filter: {
43
- * value: "string",
44
- * path: "string",
45
- * operator: Courier.ComparisonOperator.EndsWith
46
- * }
48
+ * await client.audiences.update("audience_id", {
49
+ * name: undefined,
50
+ * description: undefined,
51
+ * filter: undefined
47
52
  * })
48
53
  */
49
- update(audienceId: string, request?: Courier.AudienceUpdateParams, requestOptions?: Audiences.RequestOptions): Promise<Courier.AudienceUpdateResponse>;
54
+ update(audienceId: string, request?: Courier.AudienceUpdateParams, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Courier.AudienceUpdateResponse>;
55
+ private __update;
50
56
  /**
51
57
  * Deletes the specified audience.
52
58
  *
@@ -54,9 +60,10 @@ export declare class Audiences {
54
60
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
55
61
  *
56
62
  * @example
57
- * await courier.audiences.delete("string")
63
+ * await client.audiences.delete("audience_id")
58
64
  */
59
- delete(audienceId: string, requestOptions?: Audiences.RequestOptions): Promise<void>;
65
+ delete(audienceId: string, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<void>;
66
+ private __delete;
60
67
  /**
61
68
  * Get list of members of an audience.
62
69
  *
@@ -67,11 +74,10 @@ export declare class Audiences {
67
74
  * @throws {@link Courier.BadRequestError}
68
75
  *
69
76
  * @example
70
- * await courier.audiences.listMembers("string", {
71
- * cursor: "string"
72
- * })
77
+ * await client.audiences.listMembers("audience_id")
73
78
  */
74
- listMembers(audienceId: string, request?: Courier.AudienceMembersListParams, requestOptions?: Audiences.RequestOptions): Promise<Courier.AudienceMemberListResponse>;
79
+ listMembers(audienceId: string, request?: Courier.AudienceMembersListParams, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Courier.AudienceMemberListResponse>;
80
+ private __listMembers;
75
81
  /**
76
82
  * Get the audiences associated with the authorization token.
77
83
  *
@@ -81,10 +87,9 @@ export declare class Audiences {
81
87
  * @throws {@link Courier.BadRequestError}
82
88
  *
83
89
  * @example
84
- * await courier.audiences.listAudiences({
85
- * cursor: "string"
86
- * })
90
+ * await client.audiences.listAudiences()
87
91
  */
88
- listAudiences(request?: Courier.AudiencesListParams, requestOptions?: Audiences.RequestOptions): Promise<Courier.AudienceListResponse>;
92
+ listAudiences(request?: Courier.AudiencesListParams, requestOptions?: Audiences.RequestOptions): core.HttpResponsePromise<Courier.AudienceListResponse>;
93
+ private __listAudiences;
89
94
  protected _getAuthorizationHeader(): Promise<string>;
90
95
  }
@@ -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) {
@@ -55,33 +65,32 @@ class Audiences {
55
65
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
56
66
  *
57
67
  * @example
58
- * await courier.audiences.get("string")
68
+ * await client.audiences.get("audience_id")
59
69
  */
60
70
  get(audienceId, requestOptions) {
61
- var _a, _b;
71
+ return core.HttpResponsePromise.fromPromise(this.__get(audienceId, requestOptions));
72
+ }
73
+ __get(audienceId, requestOptions) {
62
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c;
63
76
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
64
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/audiences/${encodeURIComponent(audienceId)}`),
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, `/audiences/${encodeURIComponent(audienceId)}`),
65
78
  method: "GET",
66
- headers: {
67
- Authorization: yield this._getAuthorizationHeader(),
68
- "X-Fern-Language": "JavaScript",
69
- "X-Fern-SDK-Name": "@trycourier/courier",
70
- "X-Fern-SDK-Version": "v6.3.1",
71
- "X-Fern-Runtime": core.RUNTIME.type,
72
- "X-Fern-Runtime-Version": core.RUNTIME.version,
73
- },
79
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
74
80
  contentType: "application/json",
81
+ requestType: "json",
75
82
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
76
83
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
84
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
77
85
  });
78
86
  if (_response.ok) {
79
- return _response.body;
87
+ return { data: _response.body, rawResponse: _response.rawResponse };
80
88
  }
81
89
  if (_response.error.reason === "status-code") {
82
90
  throw new errors.CourierError({
83
91
  statusCode: _response.error.statusCode,
84
92
  body: _response.error.body,
93
+ rawResponse: _response.rawResponse,
85
94
  });
86
95
  }
87
96
  switch (_response.error.reason) {
@@ -89,12 +98,14 @@ class Audiences {
89
98
  throw new errors.CourierError({
90
99
  statusCode: _response.error.statusCode,
91
100
  body: _response.error.rawBody,
101
+ rawResponse: _response.rawResponse,
92
102
  });
93
103
  case "timeout":
94
- throw new errors.CourierTimeoutError();
104
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /audiences/{audience_id}.");
95
105
  case "unknown":
96
106
  throw new errors.CourierError({
97
107
  message: _response.error.errorMessage,
108
+ rawResponse: _response.rawResponse,
98
109
  });
99
110
  }
100
111
  });
@@ -107,42 +118,37 @@ class Audiences {
107
118
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
108
119
  *
109
120
  * @example
110
- * await courier.audiences.update("string", {
111
- * name: "string",
112
- * description: "string",
113
- * filter: {
114
- * value: "string",
115
- * path: "string",
116
- * operator: Courier.ComparisonOperator.EndsWith
117
- * }
121
+ * await client.audiences.update("audience_id", {
122
+ * name: undefined,
123
+ * description: undefined,
124
+ * filter: undefined
118
125
  * })
119
126
  */
120
127
  update(audienceId, request = {}, requestOptions) {
121
- var _a, _b;
122
- return __awaiter(this, void 0, void 0, function* () {
128
+ return core.HttpResponsePromise.fromPromise(this.__update(audienceId, request, requestOptions));
129
+ }
130
+ __update(audienceId_1) {
131
+ return __awaiter(this, arguments, void 0, function* (audienceId, request = {}, requestOptions) {
132
+ var _a, _b, _c;
123
133
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
124
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/audiences/${encodeURIComponent(audienceId)}`),
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, `/audiences/${encodeURIComponent(audienceId)}`),
125
135
  method: "PUT",
126
- headers: {
127
- Authorization: yield this._getAuthorizationHeader(),
128
- "X-Fern-Language": "JavaScript",
129
- "X-Fern-SDK-Name": "@trycourier/courier",
130
- "X-Fern-SDK-Version": "v6.3.1",
131
- "X-Fern-Runtime": core.RUNTIME.type,
132
- "X-Fern-Runtime-Version": core.RUNTIME.version,
133
- },
136
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
134
137
  contentType: "application/json",
138
+ requestType: "json",
135
139
  body: request,
136
140
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
137
141
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
142
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
138
143
  });
139
144
  if (_response.ok) {
140
- return _response.body;
145
+ return { data: _response.body, rawResponse: _response.rawResponse };
141
146
  }
142
147
  if (_response.error.reason === "status-code") {
143
148
  throw new errors.CourierError({
144
149
  statusCode: _response.error.statusCode,
145
150
  body: _response.error.body,
151
+ rawResponse: _response.rawResponse,
146
152
  });
147
153
  }
148
154
  switch (_response.error.reason) {
@@ -150,12 +156,14 @@ class Audiences {
150
156
  throw new errors.CourierError({
151
157
  statusCode: _response.error.statusCode,
152
158
  body: _response.error.rawBody,
159
+ rawResponse: _response.rawResponse,
153
160
  });
154
161
  case "timeout":
155
- throw new errors.CourierTimeoutError();
162
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /audiences/{audience_id}.");
156
163
  case "unknown":
157
164
  throw new errors.CourierError({
158
165
  message: _response.error.errorMessage,
166
+ rawResponse: _response.rawResponse,
159
167
  });
160
168
  }
161
169
  });
@@ -167,33 +175,32 @@ class Audiences {
167
175
  * @param {Audiences.RequestOptions} requestOptions - Request-specific configuration.
168
176
  *
169
177
  * @example
170
- * await courier.audiences.delete("string")
178
+ * await client.audiences.delete("audience_id")
171
179
  */
172
180
  delete(audienceId, requestOptions) {
173
- var _a, _b;
181
+ return core.HttpResponsePromise.fromPromise(this.__delete(audienceId, requestOptions));
182
+ }
183
+ __delete(audienceId, requestOptions) {
174
184
  return __awaiter(this, void 0, void 0, function* () {
185
+ var _a, _b, _c;
175
186
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
176
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/audiences/${encodeURIComponent(audienceId)}`),
187
+ 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, `/audiences/${encodeURIComponent(audienceId)}`),
177
188
  method: "DELETE",
178
- headers: {
179
- Authorization: yield this._getAuthorizationHeader(),
180
- "X-Fern-Language": "JavaScript",
181
- "X-Fern-SDK-Name": "@trycourier/courier",
182
- "X-Fern-SDK-Version": "v6.3.1",
183
- "X-Fern-Runtime": core.RUNTIME.type,
184
- "X-Fern-Runtime-Version": core.RUNTIME.version,
185
- },
189
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
186
190
  contentType: "application/json",
191
+ requestType: "json",
187
192
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
188
193
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
194
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
189
195
  });
190
196
  if (_response.ok) {
191
- return;
197
+ return { data: undefined, rawResponse: _response.rawResponse };
192
198
  }
193
199
  if (_response.error.reason === "status-code") {
194
200
  throw new errors.CourierError({
195
201
  statusCode: _response.error.statusCode,
196
202
  body: _response.error.body,
203
+ rawResponse: _response.rawResponse,
197
204
  });
198
205
  }
199
206
  switch (_response.error.reason) {
@@ -201,12 +208,14 @@ class Audiences {
201
208
  throw new errors.CourierError({
202
209
  statusCode: _response.error.statusCode,
203
210
  body: _response.error.rawBody,
211
+ rawResponse: _response.rawResponse,
204
212
  });
205
213
  case "timeout":
206
- throw new errors.CourierTimeoutError();
214
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /audiences/{audience_id}.");
207
215
  case "unknown":
208
216
  throw new errors.CourierError({
209
217
  message: _response.error.errorMessage,
218
+ rawResponse: _response.rawResponse,
210
219
  });
211
220
  }
212
221
  });
@@ -221,45 +230,42 @@ class Audiences {
221
230
  * @throws {@link Courier.BadRequestError}
222
231
  *
223
232
  * @example
224
- * await courier.audiences.listMembers("string", {
225
- * cursor: "string"
226
- * })
233
+ * await client.audiences.listMembers("audience_id")
227
234
  */
228
235
  listMembers(audienceId, request = {}, requestOptions) {
229
- var _a, _b;
230
- return __awaiter(this, void 0, void 0, function* () {
236
+ return core.HttpResponsePromise.fromPromise(this.__listMembers(audienceId, request, requestOptions));
237
+ }
238
+ __listMembers(audienceId_1) {
239
+ return __awaiter(this, arguments, void 0, function* (audienceId, request = {}, requestOptions) {
240
+ var _a, _b, _c;
231
241
  const { cursor } = request;
232
242
  const _queryParams = {};
233
243
  if (cursor != null) {
234
244
  _queryParams["cursor"] = cursor;
235
245
  }
236
246
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
237
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, `/audiences/${encodeURIComponent(audienceId)}/members`),
247
+ 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, `/audiences/${encodeURIComponent(audienceId)}/members`),
238
248
  method: "GET",
239
- headers: {
240
- Authorization: yield this._getAuthorizationHeader(),
241
- "X-Fern-Language": "JavaScript",
242
- "X-Fern-SDK-Name": "@trycourier/courier",
243
- "X-Fern-SDK-Version": "v6.3.1",
244
- "X-Fern-Runtime": core.RUNTIME.type,
245
- "X-Fern-Runtime-Version": core.RUNTIME.version,
246
- },
249
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
247
250
  contentType: "application/json",
248
251
  queryParameters: _queryParams,
252
+ requestType: "json",
249
253
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
250
254
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
255
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
251
256
  });
252
257
  if (_response.ok) {
253
- return _response.body;
258
+ return { data: _response.body, rawResponse: _response.rawResponse };
254
259
  }
255
260
  if (_response.error.reason === "status-code") {
256
261
  switch (_response.error.statusCode) {
257
262
  case 400:
258
- throw new Courier.BadRequestError(_response.error.body);
263
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
259
264
  default:
260
265
  throw new errors.CourierError({
261
266
  statusCode: _response.error.statusCode,
262
267
  body: _response.error.body,
268
+ rawResponse: _response.rawResponse,
263
269
  });
264
270
  }
265
271
  }
@@ -268,12 +274,14 @@ class Audiences {
268
274
  throw new errors.CourierError({
269
275
  statusCode: _response.error.statusCode,
270
276
  body: _response.error.rawBody,
277
+ rawResponse: _response.rawResponse,
271
278
  });
272
279
  case "timeout":
273
- throw new errors.CourierTimeoutError();
280
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /audiences/{audience_id}/members.");
274
281
  case "unknown":
275
282
  throw new errors.CourierError({
276
283
  message: _response.error.errorMessage,
284
+ rawResponse: _response.rawResponse,
277
285
  });
278
286
  }
279
287
  });
@@ -287,45 +295,42 @@ class Audiences {
287
295
  * @throws {@link Courier.BadRequestError}
288
296
  *
289
297
  * @example
290
- * await courier.audiences.listAudiences({
291
- * cursor: "string"
292
- * })
298
+ * await client.audiences.listAudiences()
293
299
  */
294
300
  listAudiences(request = {}, requestOptions) {
295
- var _a, _b;
296
- return __awaiter(this, void 0, void 0, function* () {
301
+ return core.HttpResponsePromise.fromPromise(this.__listAudiences(request, requestOptions));
302
+ }
303
+ __listAudiences() {
304
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
305
+ var _a, _b, _c;
297
306
  const { cursor } = request;
298
307
  const _queryParams = {};
299
308
  if (cursor != null) {
300
309
  _queryParams["cursor"] = cursor;
301
310
  }
302
311
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
303
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CourierEnvironment.Production, "/audiences"),
312
+ 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, "/audiences"),
304
313
  method: "GET",
305
- headers: {
306
- Authorization: yield this._getAuthorizationHeader(),
307
- "X-Fern-Language": "JavaScript",
308
- "X-Fern-SDK-Name": "@trycourier/courier",
309
- "X-Fern-SDK-Version": "v6.3.1",
310
- "X-Fern-Runtime": core.RUNTIME.type,
311
- "X-Fern-Runtime-Version": core.RUNTIME.version,
312
- },
314
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
313
315
  contentType: "application/json",
314
316
  queryParameters: _queryParams,
317
+ requestType: "json",
315
318
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
316
319
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
320
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
317
321
  });
318
322
  if (_response.ok) {
319
- return _response.body;
323
+ return { data: _response.body, rawResponse: _response.rawResponse };
320
324
  }
321
325
  if (_response.error.reason === "status-code") {
322
326
  switch (_response.error.statusCode) {
323
327
  case 400:
324
- throw new Courier.BadRequestError(_response.error.body);
328
+ throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
325
329
  default:
326
330
  throw new errors.CourierError({
327
331
  statusCode: _response.error.statusCode,
328
332
  body: _response.error.body,
333
+ rawResponse: _response.rawResponse,
329
334
  });
330
335
  }
331
336
  }
@@ -334,23 +339,25 @@ class Audiences {
334
339
  throw new errors.CourierError({
335
340
  statusCode: _response.error.statusCode,
336
341
  body: _response.error.rawBody,
342
+ rawResponse: _response.rawResponse,
337
343
  });
338
344
  case "timeout":
339
- throw new errors.CourierTimeoutError();
345
+ throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /audiences.");
340
346
  case "unknown":
341
347
  throw new errors.CourierError({
342
348
  message: _response.error.errorMessage,
349
+ rawResponse: _response.rawResponse,
343
350
  });
344
351
  }
345
352
  });
346
353
  }
347
354
  _getAuthorizationHeader() {
348
- var _a;
349
355
  return __awaiter(this, void 0, void 0, function* () {
356
+ var _a;
350
357
  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"];
351
358
  if (bearer == null) {
352
359
  throw new errors.CourierError({
353
- message: "Please specify COURIER_AUTH_TOKEN when instantiating the client.",
360
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
354
361
  });
355
362
  }
356
363
  return `Bearer ${bearer}`;
@@ -3,9 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * cursor: "string"
8
- * }
6
+ * {}
9
7
  */
10
8
  export interface AudienceMembersListParams {
11
9
  /**
@@ -5,13 +5,9 @@ import * as Courier from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * name: "string",
9
- * description: "string",
10
- * filter: {
11
- * value: "string",
12
- * path: "string",
13
- * operator: Courier.ComparisonOperator.EndsWith
14
- * }
8
+ * name: undefined,
9
+ * description: undefined,
10
+ * filter: undefined
15
11
  * }
16
12
  */
17
13
  export interface AudienceUpdateParams {
@@ -3,9 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * cursor: "string"
8
- * }
6
+ * {}
9
7
  */
10
8
  export interface AudiencesListParams {
11
9
  /**
@@ -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 ComparisonOperator = "ENDS_WITH" | "EQ" | "EXISTS" | "GT" | "GTE" | "INCLUDES" | "IS_AFTER" | "IS_BEFORE" | "LT" | "LTE" | "NEQ" | "OMIT" | "STARTS_WITH";
4
+ export type ComparisonOperator = "ENDS_WITH" | "EQ" | "EXISTS" | "GT" | "GTE" | "INCLUDES" | "IS_AFTER" | "IS_BEFORE" | "LT" | "LTE" | "NEQ" | "OMIT" | "STARTS_WITH";
5
5
  export declare const ComparisonOperator: {
6
6
  readonly EndsWith: "ENDS_WITH";
7
7
  readonly Eq: "EQ";
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Courier from "../../../index";
5
- export declare type Filter = Courier.SingleFilterConfig | Courier.NestedFilterConfig;
5
+ export type Filter = Courier.SingleFilterConfig | Courier.NestedFilterConfig;
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Courier from "../../../index";
5
- export declare type FilterConfig = Courier.SingleFilterConfig | Courier.NestedFilterConfig;
5
+ export type FilterConfig = Courier.SingleFilterConfig | Courier.NestedFilterConfig;