@trycourier/courier 7.21.0 → 7.22.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 (349) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +57 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +57 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +57 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +57 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/audiences.d.mts +13 -5
  12. package/resources/audiences.d.mts.map +1 -1
  13. package/resources/audiences.d.ts +13 -5
  14. package/resources/audiences.d.ts.map +1 -1
  15. package/resources/audiences.js +13 -5
  16. package/resources/audiences.js.map +1 -1
  17. package/resources/audiences.mjs +13 -5
  18. package/resources/audiences.mjs.map +1 -1
  19. package/resources/audit-events.d.mts +7 -2
  20. package/resources/audit-events.d.mts.map +1 -1
  21. package/resources/audit-events.d.ts +7 -2
  22. package/resources/audit-events.d.ts.map +1 -1
  23. package/resources/audit-events.js +7 -2
  24. package/resources/audit-events.js.map +1 -1
  25. package/resources/audit-events.mjs +7 -2
  26. package/resources/audit-events.mjs.map +1 -1
  27. package/resources/auth.d.mts +5 -1
  28. package/resources/auth.d.mts.map +1 -1
  29. package/resources/auth.d.ts +5 -1
  30. package/resources/auth.d.ts.map +1 -1
  31. package/resources/auth.js +5 -1
  32. package/resources/auth.js.map +1 -1
  33. package/resources/auth.mjs +5 -1
  34. package/resources/auth.mjs.map +1 -1
  35. package/resources/automations/automations.d.mts +5 -1
  36. package/resources/automations/automations.d.mts.map +1 -1
  37. package/resources/automations/automations.d.ts +5 -1
  38. package/resources/automations/automations.d.ts.map +1 -1
  39. package/resources/automations/automations.js +5 -1
  40. package/resources/automations/automations.js.map +1 -1
  41. package/resources/automations/automations.mjs +5 -1
  42. package/resources/automations/automations.mjs.map +1 -1
  43. package/resources/automations/invoke.d.mts +74 -7
  44. package/resources/automations/invoke.d.mts.map +1 -1
  45. package/resources/automations/invoke.d.ts +74 -7
  46. package/resources/automations/invoke.d.ts.map +1 -1
  47. package/resources/automations/invoke.js +38 -9
  48. package/resources/automations/invoke.js.map +1 -1
  49. package/resources/automations/invoke.mjs +38 -9
  50. package/resources/automations/invoke.mjs.map +1 -1
  51. package/resources/brands.d.mts +42 -7
  52. package/resources/brands.d.mts.map +1 -1
  53. package/resources/brands.d.ts +42 -7
  54. package/resources/brands.d.ts.map +1 -1
  55. package/resources/brands.js +28 -8
  56. package/resources/brands.js.map +1 -1
  57. package/resources/brands.mjs +28 -8
  58. package/resources/brands.mjs.map +1 -1
  59. package/resources/digests/schedules.d.mts +5 -3
  60. package/resources/digests/schedules.d.mts.map +1 -1
  61. package/resources/digests/schedules.d.ts +5 -3
  62. package/resources/digests/schedules.d.ts.map +1 -1
  63. package/resources/digests/schedules.js +5 -3
  64. package/resources/digests/schedules.js.map +1 -1
  65. package/resources/digests/schedules.mjs +5 -3
  66. package/resources/digests/schedules.mjs.map +1 -1
  67. package/resources/inbound.d.mts +5 -1
  68. package/resources/inbound.d.mts.map +1 -1
  69. package/resources/inbound.d.ts +5 -1
  70. package/resources/inbound.d.ts.map +1 -1
  71. package/resources/inbound.js +5 -1
  72. package/resources/inbound.js.map +1 -1
  73. package/resources/inbound.mjs +5 -1
  74. package/resources/inbound.mjs.map +1 -1
  75. package/resources/inbox/inbox.d.mts +10 -0
  76. package/resources/inbox/inbox.d.mts.map +1 -0
  77. package/resources/inbox/inbox.d.ts +10 -0
  78. package/resources/inbox/inbox.d.ts.map +1 -0
  79. package/resources/inbox/inbox.js +17 -0
  80. package/resources/inbox/inbox.js.map +1 -0
  81. package/resources/inbox/inbox.mjs +12 -0
  82. package/resources/inbox/inbox.mjs.map +1 -0
  83. package/resources/inbox/index.d.mts +3 -0
  84. package/resources/inbox/index.d.mts.map +1 -0
  85. package/resources/inbox/index.d.ts +3 -0
  86. package/resources/inbox/index.d.ts.map +1 -0
  87. package/resources/inbox/index.js +9 -0
  88. package/resources/inbox/index.js.map +1 -0
  89. package/resources/inbox/index.mjs +4 -0
  90. package/resources/inbox/index.mjs.map +1 -0
  91. package/resources/inbox/messages.d.mts +23 -0
  92. package/resources/inbox/messages.d.mts.map +1 -0
  93. package/resources/inbox/messages.d.ts +23 -0
  94. package/resources/inbox/messages.d.ts.map +1 -0
  95. package/resources/inbox/messages.js +34 -0
  96. package/resources/inbox/messages.js.map +1 -0
  97. package/resources/inbox/messages.mjs +30 -0
  98. package/resources/inbox/messages.mjs.map +1 -0
  99. package/resources/inbox.d.mts +2 -0
  100. package/resources/inbox.d.mts.map +1 -0
  101. package/resources/inbox.d.ts +2 -0
  102. package/resources/inbox.d.ts.map +1 -0
  103. package/resources/inbox.js +6 -0
  104. package/resources/inbox.js.map +1 -0
  105. package/resources/inbox.mjs +3 -0
  106. package/resources/inbox.mjs.map +1 -0
  107. package/resources/index.d.mts +1 -0
  108. package/resources/index.d.mts.map +1 -1
  109. package/resources/index.d.ts +1 -0
  110. package/resources/index.d.ts.map +1 -1
  111. package/resources/index.js +3 -1
  112. package/resources/index.js.map +1 -1
  113. package/resources/index.mjs +1 -0
  114. package/resources/index.mjs.map +1 -1
  115. package/resources/journeys/journeys.d.mts +130 -39
  116. package/resources/journeys/journeys.d.mts.map +1 -1
  117. package/resources/journeys/journeys.d.ts +130 -39
  118. package/resources/journeys/journeys.d.ts.map +1 -1
  119. package/resources/journeys/journeys.js +79 -34
  120. package/resources/journeys/journeys.js.map +1 -1
  121. package/resources/journeys/journeys.mjs +79 -34
  122. package/resources/journeys/journeys.mjs.map +1 -1
  123. package/resources/journeys/templates.d.mts +60 -17
  124. package/resources/journeys/templates.d.mts.map +1 -1
  125. package/resources/journeys/templates.d.ts +60 -17
  126. package/resources/journeys/templates.d.ts.map +1 -1
  127. package/resources/journeys/templates.js +41 -20
  128. package/resources/journeys/templates.js.map +1 -1
  129. package/resources/journeys/templates.mjs +41 -20
  130. package/resources/journeys/templates.mjs.map +1 -1
  131. package/resources/lists/lists.d.mts +40 -5
  132. package/resources/lists/lists.d.mts.map +1 -1
  133. package/resources/lists/lists.d.ts +40 -5
  134. package/resources/lists/lists.d.ts.map +1 -1
  135. package/resources/lists/lists.js +40 -5
  136. package/resources/lists/lists.js.map +1 -1
  137. package/resources/lists/lists.mjs +40 -5
  138. package/resources/lists/lists.mjs.map +1 -1
  139. package/resources/lists/subscriptions.d.mts +65 -5
  140. package/resources/lists/subscriptions.d.mts.map +1 -1
  141. package/resources/lists/subscriptions.d.ts +65 -5
  142. package/resources/lists/subscriptions.d.ts.map +1 -1
  143. package/resources/lists/subscriptions.js +57 -6
  144. package/resources/lists/subscriptions.js.map +1 -1
  145. package/resources/lists/subscriptions.mjs +57 -6
  146. package/resources/lists/subscriptions.mjs.map +1 -1
  147. package/resources/messages.d.mts +15 -14
  148. package/resources/messages.d.mts.map +1 -1
  149. package/resources/messages.d.ts +15 -14
  150. package/resources/messages.d.ts.map +1 -1
  151. package/resources/messages.js +15 -14
  152. package/resources/messages.js.map +1 -1
  153. package/resources/messages.mjs +15 -14
  154. package/resources/messages.mjs.map +1 -1
  155. package/resources/notifications/checks.d.mts +9 -3
  156. package/resources/notifications/checks.d.mts.map +1 -1
  157. package/resources/notifications/checks.d.ts +9 -3
  158. package/resources/notifications/checks.d.ts.map +1 -1
  159. package/resources/notifications/checks.js +9 -3
  160. package/resources/notifications/checks.js.map +1 -1
  161. package/resources/notifications/checks.mjs +9 -3
  162. package/resources/notifications/checks.mjs.map +1 -1
  163. package/resources/notifications/notifications.d.mts +62 -29
  164. package/resources/notifications/notifications.d.mts.map +1 -1
  165. package/resources/notifications/notifications.d.ts +62 -29
  166. package/resources/notifications/notifications.d.ts.map +1 -1
  167. package/resources/notifications/notifications.js +49 -26
  168. package/resources/notifications/notifications.js.map +1 -1
  169. package/resources/notifications/notifications.mjs +49 -26
  170. package/resources/notifications/notifications.mjs.map +1 -1
  171. package/resources/profiles/lists.d.mts +49 -5
  172. package/resources/profiles/lists.d.mts.map +1 -1
  173. package/resources/profiles/lists.d.ts +49 -5
  174. package/resources/profiles/lists.d.ts.map +1 -1
  175. package/resources/profiles/lists.js +45 -6
  176. package/resources/profiles/lists.js.map +1 -1
  177. package/resources/profiles/lists.mjs +45 -6
  178. package/resources/profiles/lists.mjs.map +1 -1
  179. package/resources/profiles/profiles.d.mts +70 -11
  180. package/resources/profiles/profiles.d.mts.map +1 -1
  181. package/resources/profiles/profiles.d.ts +70 -11
  182. package/resources/profiles/profiles.d.ts.map +1 -1
  183. package/resources/profiles/profiles.js +65 -12
  184. package/resources/profiles/profiles.js.map +1 -1
  185. package/resources/profiles/profiles.mjs +65 -12
  186. package/resources/profiles/profiles.mjs.map +1 -1
  187. package/resources/providers/catalog.d.mts +10 -4
  188. package/resources/providers/catalog.d.mts.map +1 -1
  189. package/resources/providers/catalog.d.ts +10 -4
  190. package/resources/providers/catalog.d.ts.map +1 -1
  191. package/resources/providers/catalog.js +10 -4
  192. package/resources/providers/catalog.js.map +1 -1
  193. package/resources/providers/catalog.mjs +10 -4
  194. package/resources/providers/catalog.mjs.map +1 -1
  195. package/resources/providers/providers.d.mts +68 -22
  196. package/resources/providers/providers.d.mts.map +1 -1
  197. package/resources/providers/providers.d.ts +68 -22
  198. package/resources/providers/providers.d.ts.map +1 -1
  199. package/resources/providers/providers.js +57 -14
  200. package/resources/providers/providers.js.map +1 -1
  201. package/resources/providers/providers.mjs +57 -14
  202. package/resources/providers/providers.mjs.map +1 -1
  203. package/resources/requests.d.mts +5 -1
  204. package/resources/requests.d.mts.map +1 -1
  205. package/resources/requests.d.ts +5 -1
  206. package/resources/requests.d.ts.map +1 -1
  207. package/resources/requests.js +5 -1
  208. package/resources/requests.js.map +1 -1
  209. package/resources/requests.mjs +5 -1
  210. package/resources/requests.mjs.map +1 -1
  211. package/resources/routing-strategies.d.mts +30 -11
  212. package/resources/routing-strategies.d.mts.map +1 -1
  213. package/resources/routing-strategies.d.ts +30 -11
  214. package/resources/routing-strategies.d.ts.map +1 -1
  215. package/resources/routing-strategies.js +22 -6
  216. package/resources/routing-strategies.js.map +1 -1
  217. package/resources/routing-strategies.mjs +22 -6
  218. package/resources/routing-strategies.mjs.map +1 -1
  219. package/resources/send.d.mts +24 -4
  220. package/resources/send.d.mts.map +1 -1
  221. package/resources/send.d.ts +24 -4
  222. package/resources/send.d.ts.map +1 -1
  223. package/resources/send.js +21 -3
  224. package/resources/send.js.map +1 -1
  225. package/resources/send.mjs +21 -3
  226. package/resources/send.mjs.map +1 -1
  227. package/resources/tenants/preferences/items.d.mts +7 -2
  228. package/resources/tenants/preferences/items.d.mts.map +1 -1
  229. package/resources/tenants/preferences/items.d.ts +7 -2
  230. package/resources/tenants/preferences/items.d.ts.map +1 -1
  231. package/resources/tenants/preferences/items.js +7 -2
  232. package/resources/tenants/preferences/items.js.map +1 -1
  233. package/resources/tenants/preferences/items.mjs +7 -2
  234. package/resources/tenants/preferences/items.mjs.map +1 -1
  235. package/resources/tenants/templates/templates.d.mts +13 -19
  236. package/resources/tenants/templates/templates.d.mts.map +1 -1
  237. package/resources/tenants/templates/templates.d.ts +13 -19
  238. package/resources/tenants/templates/templates.d.ts.map +1 -1
  239. package/resources/tenants/templates/templates.js +13 -19
  240. package/resources/tenants/templates/templates.js.map +1 -1
  241. package/resources/tenants/templates/templates.mjs +13 -19
  242. package/resources/tenants/templates/templates.mjs.map +1 -1
  243. package/resources/tenants/templates/versions.d.mts +5 -7
  244. package/resources/tenants/templates/versions.d.mts.map +1 -1
  245. package/resources/tenants/templates/versions.d.ts +5 -7
  246. package/resources/tenants/templates/versions.d.ts.map +1 -1
  247. package/resources/tenants/templates/versions.js +5 -7
  248. package/resources/tenants/templates/versions.js.map +1 -1
  249. package/resources/tenants/templates/versions.mjs +5 -7
  250. package/resources/tenants/templates/versions.mjs.map +1 -1
  251. package/resources/tenants/tenants.d.mts +13 -5
  252. package/resources/tenants/tenants.d.mts.map +1 -1
  253. package/resources/tenants/tenants.d.ts +13 -5
  254. package/resources/tenants/tenants.d.ts.map +1 -1
  255. package/resources/tenants/tenants.js +13 -5
  256. package/resources/tenants/tenants.js.map +1 -1
  257. package/resources/tenants/tenants.mjs +13 -5
  258. package/resources/tenants/tenants.mjs.map +1 -1
  259. package/resources/translations.d.mts +7 -2
  260. package/resources/translations.d.mts.map +1 -1
  261. package/resources/translations.d.ts +7 -2
  262. package/resources/translations.d.ts.map +1 -1
  263. package/resources/translations.js +7 -2
  264. package/resources/translations.js.map +1 -1
  265. package/resources/translations.mjs +7 -2
  266. package/resources/translations.mjs.map +1 -1
  267. package/resources/users/preferences.d.mts +64 -42
  268. package/resources/users/preferences.d.mts.map +1 -1
  269. package/resources/users/preferences.d.ts +64 -42
  270. package/resources/users/preferences.d.ts.map +1 -1
  271. package/resources/users/preferences.js +30 -42
  272. package/resources/users/preferences.js.map +1 -1
  273. package/resources/users/preferences.mjs +30 -42
  274. package/resources/users/preferences.mjs.map +1 -1
  275. package/resources/users/tenants.d.mts +13 -10
  276. package/resources/users/tenants.d.mts.map +1 -1
  277. package/resources/users/tenants.d.ts +13 -10
  278. package/resources/users/tenants.d.ts.map +1 -1
  279. package/resources/users/tenants.js +13 -10
  280. package/resources/users/tenants.js.map +1 -1
  281. package/resources/users/tenants.mjs +13 -10
  282. package/resources/users/tenants.mjs.map +1 -1
  283. package/resources/users/tokens.d.mts +15 -6
  284. package/resources/users/tokens.d.mts.map +1 -1
  285. package/resources/users/tokens.d.ts +15 -6
  286. package/resources/users/tokens.d.ts.map +1 -1
  287. package/resources/users/tokens.js +15 -6
  288. package/resources/users/tokens.js.map +1 -1
  289. package/resources/users/tokens.mjs +15 -6
  290. package/resources/users/tokens.mjs.map +1 -1
  291. package/resources/workspace-preferences/topics.d.mts +40 -18
  292. package/resources/workspace-preferences/topics.d.mts.map +1 -1
  293. package/resources/workspace-preferences/topics.d.ts +40 -18
  294. package/resources/workspace-preferences/topics.d.ts.map +1 -1
  295. package/resources/workspace-preferences/topics.js +26 -11
  296. package/resources/workspace-preferences/topics.js.map +1 -1
  297. package/resources/workspace-preferences/topics.mjs +26 -11
  298. package/resources/workspace-preferences/topics.mjs.map +1 -1
  299. package/resources/workspace-preferences/workspace-preferences.d.mts +56 -19
  300. package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -1
  301. package/resources/workspace-preferences/workspace-preferences.d.ts +56 -19
  302. package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -1
  303. package/resources/workspace-preferences/workspace-preferences.js +41 -13
  304. package/resources/workspace-preferences/workspace-preferences.js.map +1 -1
  305. package/resources/workspace-preferences/workspace-preferences.mjs +41 -13
  306. package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -1
  307. package/src/client.ts +59 -0
  308. package/src/resources/audiences.ts +13 -5
  309. package/src/resources/audit-events.ts +7 -2
  310. package/src/resources/auth.ts +5 -1
  311. package/src/resources/automations/automations.ts +5 -1
  312. package/src/resources/automations/invoke.ts +115 -9
  313. package/src/resources/brands.ts +62 -8
  314. package/src/resources/digests/schedules.ts +5 -3
  315. package/src/resources/inbound.ts +5 -1
  316. package/src/resources/inbox/inbox.ts +15 -0
  317. package/src/resources/inbox/index.ts +4 -0
  318. package/src/resources/inbox/messages.ts +40 -0
  319. package/src/resources/inbox.ts +3 -0
  320. package/src/resources/index.ts +1 -0
  321. package/src/resources/journeys/journeys.ts +212 -43
  322. package/src/resources/journeys/templates.ts +98 -20
  323. package/src/resources/lists/lists.ts +40 -5
  324. package/src/resources/lists/subscriptions.ts +82 -6
  325. package/src/resources/messages.ts +15 -14
  326. package/src/resources/notifications/checks.ts +9 -3
  327. package/src/resources/notifications/notifications.ts +102 -31
  328. package/src/resources/profiles/lists.ts +70 -6
  329. package/src/resources/profiles/profiles.ts +90 -12
  330. package/src/resources/providers/catalog.ts +10 -4
  331. package/src/resources/providers/providers.ts +86 -21
  332. package/src/resources/requests.ts +5 -1
  333. package/src/resources/routing-strategies.ts +50 -12
  334. package/src/resources/send.ts +45 -5
  335. package/src/resources/tenants/preferences/items.ts +7 -2
  336. package/src/resources/tenants/templates/templates.ts +13 -19
  337. package/src/resources/tenants/templates/versions.ts +5 -7
  338. package/src/resources/tenants/tenants.ts +13 -5
  339. package/src/resources/translations.ts +7 -2
  340. package/src/resources/users/preferences.ts +86 -44
  341. package/src/resources/users/tenants.ts +13 -10
  342. package/src/resources/users/tokens.ts +15 -6
  343. package/src/resources/workspace-preferences/topics.ts +60 -19
  344. package/src/resources/workspace-preferences/workspace-preferences.ts +96 -21
  345. package/src/version.ts +1 -1
  346. package/version.d.mts +1 -1
  347. package/version.d.ts +1 -1
  348. package/version.js +1 -1
  349. package/version.mjs +1 -1
@@ -8,9 +8,20 @@ import { buildHeaders } from '../../internal/headers';
8
8
  import { RequestOptions } from '../../internal/request-options';
9
9
  import { path } from '../../internal/utils/path';
10
10
 
11
+ /**
12
+ * Manage static groups of users that you subscribe explicitly, and send to them by list id or list pattern.
13
+ */
11
14
  export class Subscriptions extends APIResource {
12
15
  /**
13
- * Get the list's subscriptions.
16
+ * Returns the users subscribed to a list with paging, each with the preferences
17
+ * recorded for that subscription.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const subscriptions = await client.lists.subscriptions.list(
22
+ * 'list_id',
23
+ * );
24
+ * ```
14
25
  */
15
26
  list(
16
27
  listID: string,
@@ -23,18 +34,46 @@ export class Subscriptions extends APIResource {
23
34
  /**
24
35
  * Subscribes additional users to the list, without modifying existing
25
36
  * subscriptions. If the list does not exist, it will be automatically created.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * await client.lists.subscriptions.add('list_id', {
41
+ * recipients: [{ recipientId: 'recipientId' }],
42
+ * });
43
+ * ```
26
44
  */
27
- add(listID: string, body: SubscriptionAddParams, options?: RequestOptions): APIPromise<void> {
45
+ add(listID: string, params: SubscriptionAddParams, options?: RequestOptions): APIPromise<void> {
46
+ const {
47
+ 'Idempotency-Key': idempotencyKey,
48
+ 'x-idempotency-expiration': xIdempotencyExpiration,
49
+ ...body
50
+ } = params;
28
51
  return this._client.post(path`/lists/${listID}/subscriptions`, {
29
52
  body,
30
53
  ...options,
31
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
54
+ headers: buildHeaders([
55
+ {
56
+ Accept: '*/*',
57
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
58
+ ...(xIdempotencyExpiration != null ?
59
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
60
+ : undefined),
61
+ },
62
+ options?.headers,
63
+ ]),
32
64
  });
33
65
  }
34
66
 
35
67
  /**
36
68
  * Subscribes the users to the list, overwriting existing subscriptions. If the
37
69
  * list does not exist, it will be automatically created.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * await client.lists.subscriptions.subscribe('list_id', {
74
+ * recipients: [{ recipientId: 'recipientId' }],
75
+ * });
76
+ * ```
38
77
  */
39
78
  subscribe(listID: string, body: SubscriptionSubscribeParams, options?: RequestOptions): APIPromise<void> {
40
79
  return this._client.put(path`/lists/${listID}/subscriptions`, {
@@ -45,8 +84,15 @@ export class Subscriptions extends APIResource {
45
84
  }
46
85
 
47
86
  /**
48
- * Subscribe a user to an existing list (note: if the List does not exist, it will
49
- * be automatically created).
87
+ * Subscribes one user to a list, creating the list if it does not yet exist.
88
+ * Optional preferences apply to this subscription only.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * await client.lists.subscriptions.subscribeUser('user_id', {
93
+ * list_id: 'list_id',
94
+ * });
95
+ * ```
50
96
  */
51
97
  subscribeUser(
52
98
  userID: string,
@@ -62,7 +108,16 @@ export class Subscriptions extends APIResource {
62
108
  }
63
109
 
64
110
  /**
65
- * Delete a subscription to a list by list ID and user ID.
111
+ * Removes one user's subscription to a list, addressed by list id and user id. The
112
+ * user's profile and other subscriptions are separate resources.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * await client.lists.subscriptions.unsubscribeUser(
117
+ * 'user_id',
118
+ * { list_id: 'list_id' },
119
+ * );
120
+ * ```
66
121
  */
67
122
  unsubscribeUser(
68
123
  userID: string,
@@ -101,7 +156,28 @@ export interface SubscriptionListParams {
101
156
  }
102
157
 
103
158
  export interface SubscriptionAddParams {
159
+ /**
160
+ * Body param
161
+ */
104
162
  recipients: Array<ListsAPI.PutSubscriptionsRecipient>;
163
+
164
+ /**
165
+ * Header param: A unique key that makes this request idempotent. If Courier
166
+ * receives another request with the same `Idempotency-Key`, it returns the stored
167
+ * response from the first request without performing the operation again
168
+ * (including the original status code and any error). Use it to safely retry
169
+ * `POST` requests after network failures without risking duplicate sends. The key
170
+ * is scoped to this endpoint.
171
+ */
172
+ 'Idempotency-Key'?: string;
173
+
174
+ /**
175
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
176
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
177
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
178
+ * maximum is 1 year.
179
+ */
180
+ 'x-idempotency-expiration'?: string;
105
181
  }
106
182
 
107
183
  export interface SubscriptionSubscribeParams {
@@ -6,16 +6,21 @@ import { APIPromise } from '../core/api-promise';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { path } from '../internal/utils/path';
8
8
 
9
+ /**
10
+ * Look up the messages Courier has accepted, inspect their delivery history and rendered output, and cancel, resend, or archive them.
11
+ */
9
12
  export class Messages extends APIResource {
10
13
  /**
11
- * Fetch the status of a message you've previously sent.
14
+ * Returns a sent message's status, recipient, event, and per-provider delivery
15
+ * detail, with timestamps for enqueued, sent, delivered, opened, and clicked.
12
16
  */
13
17
  retrieve(messageID: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse> {
14
18
  return this._client.get(path`/messages/${messageID}`, options);
15
19
  }
16
20
 
17
21
  /**
18
- * Fetch the statuses of messages you've previously sent.
22
+ * Returns previously sent messages, most recent first, each carrying its status,
23
+ * recipient, channel, and provider. Paged by cursor.
19
24
  */
20
25
  list(
21
26
  query: MessageListParams | null | undefined = {},
@@ -25,25 +30,24 @@ export class Messages extends APIResource {
25
30
  }
26
31
 
27
32
  /**
28
- * Cancel a message that is currently in the process of being delivered. A
29
- * well-formatted API call to the cancel message API will return either `200`
30
- * status code for a successful cancellation or `409` status code for an
31
- * unsuccessful cancellation. Both cases will include the actual message record in
32
- * the response body (see details below).
33
+ * Cancels a message that is still in the delivery pipeline and returns the message
34
+ * record with its resulting canceled or failed status.
33
35
  */
34
36
  cancel(messageID: string, options?: RequestOptions): APIPromise<MessageDetails> {
35
37
  return this._client.post(path`/messages/${messageID}/cancel`, options);
36
38
  }
37
39
 
38
40
  /**
39
- * Get message content
41
+ * Returns the rendered content Courier delivered for a message, broken out per
42
+ * channel, to confirm what the recipient received.
40
43
  */
41
44
  content(messageID: string, options?: RequestOptions): APIPromise<MessageContentResponse> {
42
45
  return this._client.get(path`/messages/${messageID}/output`, options);
43
46
  }
44
47
 
45
48
  /**
46
- * Fetch the array of events of a message you've previously sent.
49
+ * Returns the ordered event history for a sent message, one entry per status
50
+ * transition with its timestamp.
47
51
  */
48
52
  history(
49
53
  messageID: string,
@@ -54,11 +58,8 @@ export class Messages extends APIResource {
54
58
  }
55
59
 
56
60
  /**
57
- * Resend a previously sent message. The original send request is loaded from
58
- * storage and a brand-new send is enqueued for the same recipient and content,
59
- * producing a **new** `messageId` — the original message is not modified.
60
- * Throttled by a per-message rate limit; a repeat inside the limit window returns
61
- * `429 Too Many Requests`.
61
+ * Resends a previously sent message to the same recipient and content, returning a
62
+ * new messageId. The original send request is not modified.
62
63
  */
63
64
  resend(messageID: string, options?: RequestOptions): APIPromise<MessageResendResponse> {
64
65
  return this._client.post(path`/messages/${messageID}/resend`, options);
@@ -7,9 +7,13 @@ import { buildHeaders } from '../../internal/headers';
7
7
  import { RequestOptions } from '../../internal/request-options';
8
8
  import { path } from '../../internal/utils/path';
9
9
 
10
+ /**
11
+ * Create, update, version, publish, and localize notification templates and their content.
12
+ */
10
13
  export class Checks extends APIResource {
11
14
  /**
12
- * Replace the submission checks for a notification template.
15
+ * Replaces the approval checks on a template submission with the complete set
16
+ * supplied in the request body.
13
17
  *
14
18
  * @example
15
19
  * ```ts
@@ -38,7 +42,8 @@ export class Checks extends APIResource {
38
42
  }
39
43
 
40
44
  /**
41
- * Retrieve the submission checks for a notification template.
45
+ * Returns the approval checks recorded for a template submission, each with its
46
+ * pass or fail result.
42
47
  *
43
48
  * @example
44
49
  * ```ts
@@ -58,7 +63,8 @@ export class Checks extends APIResource {
58
63
  }
59
64
 
60
65
  /**
61
- * Cancel a submission for a notification template.
66
+ * Cancels a pending template submission, withdrawing it from the approval
67
+ * workflow. The template stays in draft and can be resubmitted later.
62
68
  *
63
69
  * @example
64
70
  * ```ts
@@ -16,6 +16,9 @@ import { buildHeaders } from '../../internal/headers';
16
16
  import { RequestOptions } from '../../internal/request-options';
17
17
  import { path } from '../../internal/utils/path';
18
18
 
19
+ /**
20
+ * Create, update, version, publish, and localize notification templates and their content.
21
+ */
19
22
  export class Notifications extends APIResource {
20
23
  checks: ChecksAPI.Checks = new ChecksAPI.Checks(this._client);
21
24
 
@@ -46,8 +49,28 @@ export class Notifications extends APIResource {
46
49
  * });
47
50
  * ```
48
51
  */
49
- create(body: NotificationCreateParams, options?: RequestOptions): APIPromise<NotificationTemplateResponse> {
50
- return this._client.post('/notifications', { body, ...options });
52
+ create(
53
+ params: NotificationCreateParams,
54
+ options?: RequestOptions,
55
+ ): APIPromise<NotificationTemplateResponse> {
56
+ const {
57
+ 'Idempotency-Key': idempotencyKey,
58
+ 'x-idempotency-expiration': xIdempotencyExpiration,
59
+ ...body
60
+ } = params;
61
+ return this._client.post('/notifications', {
62
+ body,
63
+ ...options,
64
+ headers: buildHeaders([
65
+ {
66
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
67
+ ...(xIdempotencyExpiration != null ?
68
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
69
+ : undefined),
70
+ },
71
+ options?.headers,
72
+ ]),
73
+ });
51
74
  }
52
75
 
53
76
  /**
@@ -69,7 +92,8 @@ export class Notifications extends APIResource {
69
92
  }
70
93
 
71
94
  /**
72
- * List notification templates in your workspace.
95
+ * Lists the workspace's notification templates. Each carries a name, tags, brand,
96
+ * routing, and its draft or published state.
73
97
  *
74
98
  * @example
75
99
  * ```ts
@@ -84,7 +108,8 @@ export class Notifications extends APIResource {
84
108
  }
85
109
 
86
110
  /**
87
- * Archive a notification template.
111
+ * Archives a notification template, preventing new sends from referencing it. The
112
+ * template stays retrievable for its version history.
88
113
  *
89
114
  * @example
90
115
  * ```ts
@@ -99,12 +124,9 @@ export class Notifications extends APIResource {
99
124
  }
100
125
 
101
126
  /**
102
- * Duplicate a notification template. Creates a standalone copy within the same
103
- * workspace and environment, with " COPY" appended to the title. The copy clones
104
- * the source draft's tags, brand, subscription topic, routing strategy, channels,
105
- * and content, and is always created as a standalone template (it is not linked to
106
- * any journey or broadcast, even if the source was). Templates that are scoped to
107
- * a journey or a broadcast cannot be duplicated through this endpoint.
127
+ * Copies a notification template within the same workspace and environment,
128
+ * appending " COPY" to the title. The copy is standalone and independently
129
+ * editable.
108
130
  *
109
131
  * @example
110
132
  * ```ts
@@ -117,7 +139,8 @@ export class Notifications extends APIResource {
117
139
  }
118
140
 
119
141
  /**
120
- * List versions of a notification template.
142
+ * Returns a notification template's published versions, most recent first, for
143
+ * comparison or rollback. Paged.
121
144
  *
122
145
  * @example
123
146
  * ```ts
@@ -144,20 +167,33 @@ export class Notifications extends APIResource {
144
167
  */
145
168
  publish(
146
169
  id: string,
147
- body: NotificationPublishParams | null | undefined = {},
170
+ params: NotificationPublishParams | null | undefined = {},
148
171
  options?: RequestOptions,
149
172
  ): APIPromise<void> {
173
+ const {
174
+ 'Idempotency-Key': idempotencyKey,
175
+ 'x-idempotency-expiration': xIdempotencyExpiration,
176
+ ...body
177
+ } = params ?? {};
150
178
  return this._client.post(path`/notifications/${id}/publish`, {
151
179
  body,
152
180
  ...options,
153
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
181
+ headers: buildHeaders([
182
+ {
183
+ Accept: '*/*',
184
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
185
+ ...(xIdempotencyExpiration != null ?
186
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
187
+ : undefined),
188
+ },
189
+ options?.headers,
190
+ ]),
154
191
  });
155
192
  }
156
193
 
157
194
  /**
158
- * Replace the elemental content of a notification template. Overwrites all
159
- * elements in the template with the provided content. Only supported for V2
160
- * (elemental) templates.
195
+ * Replaces all Elemental content in a template, overwriting every existing
196
+ * element. Supported for V2 templates only, not V1 blocks and channels.
161
197
  *
162
198
  * @example
163
199
  * ```ts
@@ -180,8 +216,8 @@ export class Notifications extends APIResource {
180
216
  }
181
217
 
182
218
  /**
183
- * Update a single element within a notification template. Only supported for V2
184
- * (elemental) templates.
219
+ * Replaces one Elemental element in a template, addressed by its element id.
220
+ * Supported for V2 templates only, not V1 blocks and channels.
185
221
  *
186
222
  * @example
187
223
  * ```ts
@@ -204,9 +240,8 @@ export class Notifications extends APIResource {
204
240
  }
205
241
 
206
242
  /**
207
- * Set locale-specific content overrides for a notification template. Each element
208
- * override must reference an existing element by ID. Only supported for V2
209
- * (elemental) templates.
243
+ * Sets locale-specific content overrides for a template. Each override must
244
+ * reference an element that already exists in the default content.
210
245
  *
211
246
  * @example
212
247
  * ```ts
@@ -231,7 +266,8 @@ export class Notifications extends APIResource {
231
266
  }
232
267
 
233
268
  /**
234
- * Replace a notification template. All fields are required.
269
+ * Replaces a notification template in full, so send every field rather than only
270
+ * the ones you want changed. Publish separately to make it live.
235
271
  *
236
272
  * @example
237
273
  * ```ts
@@ -261,10 +297,8 @@ export class Notifications extends APIResource {
261
297
  }
262
298
 
263
299
  /**
264
- * Retrieve the content of a notification template. The response shape depends on
265
- * whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
266
- * the `version` query parameter to select draft, published, or a specific
267
- * historical version.
300
+ * Returns a template's content and checksum. V2 templates return Elemental
301
+ * elements, while V1 templates return blocks and channels instead.
268
302
  *
269
303
  * @example
270
304
  * ```ts
@@ -805,16 +839,34 @@ export type NotificationRetrieveContentResponse = NotificationContentGetResponse
805
839
 
806
840
  export interface NotificationCreateParams {
807
841
  /**
808
- * Core template fields used in POST and PUT request bodies (nested under a
809
- * `notification` key) and returned at the top level in responses.
842
+ * Body param: Core template fields used in POST and PUT request bodies (nested
843
+ * under a `notification` key) and returned at the top level in responses.
810
844
  */
811
845
  notification: NotificationTemplatePayload;
812
846
 
813
847
  /**
814
- * Template state after creation. Case-insensitive input, normalized to uppercase
815
- * in the response. Defaults to "DRAFT".
848
+ * Body param: Template state after creation. Case-insensitive input, normalized to
849
+ * uppercase in the response. Defaults to "DRAFT".
816
850
  */
817
851
  state?: 'DRAFT' | 'PUBLISHED';
852
+
853
+ /**
854
+ * Header param: A unique key that makes this request idempotent. If Courier
855
+ * receives another request with the same `Idempotency-Key`, it returns the stored
856
+ * response from the first request without performing the operation again
857
+ * (including the original status code and any error). Use it to safely retry
858
+ * `POST` requests after network failures without risking duplicate sends. The key
859
+ * is scoped to this endpoint.
860
+ */
861
+ 'Idempotency-Key'?: string;
862
+
863
+ /**
864
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
865
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
866
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
867
+ * maximum is 1 year.
868
+ */
869
+ 'x-idempotency-expiration'?: string;
818
870
  }
819
871
 
820
872
  export interface NotificationRetrieveParams {
@@ -856,9 +908,28 @@ export interface NotificationListVersionsParams {
856
908
 
857
909
  export interface NotificationPublishParams {
858
910
  /**
859
- * Historical version to publish (e.g. "v001"). Omit to publish the current draft.
911
+ * Body param: Historical version to publish (e.g. "v001"). Omit to publish the
912
+ * current draft.
860
913
  */
861
914
  version?: string;
915
+
916
+ /**
917
+ * Header param: A unique key that makes this request idempotent. If Courier
918
+ * receives another request with the same `Idempotency-Key`, it returns the stored
919
+ * response from the first request without performing the operation again
920
+ * (including the original status code and any error). Use it to safely retry
921
+ * `POST` requests after network failures without risking duplicate sends. The key
922
+ * is scoped to this endpoint.
923
+ */
924
+ 'Idempotency-Key'?: string;
925
+
926
+ /**
927
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
928
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
929
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
930
+ * maximum is 1 year.
931
+ */
932
+ 'x-idempotency-expiration'?: string;
862
933
  }
863
934
 
864
935
  export interface NotificationPutContentParams {
@@ -4,12 +4,24 @@ import { APIResource } from '../../core/resource';
4
4
  import * as Shared from '../shared';
5
5
  import * as ProfilesAPI from './profiles';
6
6
  import { APIPromise } from '../../core/api-promise';
7
+ import { buildHeaders } from '../../internal/headers';
7
8
  import { RequestOptions } from '../../internal/request-options';
8
9
  import { path } from '../../internal/utils/path';
9
10
 
11
+ /**
12
+ * Store the contact information Courier delivers to for each user — email, phone number, push tokens, and any custom data you send to.
13
+ */
10
14
  export class Lists extends APIResource {
11
15
  /**
12
- * Returns the subscribed lists for a specified user.
16
+ * Returns the lists a user is subscribed to, with paging. Use it to check what a
17
+ * recipient will receive before sending to a list.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const list = await client.profiles.lists.retrieve(
22
+ * 'user_id',
23
+ * );
24
+ * ```
13
25
  */
14
26
  retrieve(
15
27
  userID: string,
@@ -20,22 +32,53 @@ export class Lists extends APIResource {
20
32
  }
21
33
 
22
34
  /**
23
- * Removes all list subscriptions for given user.
35
+ * Removes every list subscription for a user at once. Their profile and
36
+ * preferences are untouched, so this only affects list-targeted sends.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const list = await client.profiles.lists.delete('user_id');
41
+ * ```
24
42
  */
25
43
  delete(userID: string, options?: RequestOptions): APIPromise<ListDeleteResponse> {
26
44
  return this._client.delete(path`/profiles/${userID}/lists`, options);
27
45
  }
28
46
 
29
47
  /**
30
- * Subscribes the given user to one or more lists. If the list does not exist, it
31
- * will be created.
48
+ * Subscribes a user to one or more lists, creating any list that does not yet
49
+ * exist. Optional preferences apply to each subscription.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const response = await client.profiles.lists.subscribe(
54
+ * 'user_id',
55
+ * { lists: [{ listId: 'listId' }] },
56
+ * );
57
+ * ```
32
58
  */
33
59
  subscribe(
34
60
  userID: string,
35
- body: ListSubscribeParams,
61
+ params: ListSubscribeParams,
36
62
  options?: RequestOptions,
37
63
  ): APIPromise<ListSubscribeResponse> {
38
- return this._client.post(path`/profiles/${userID}/lists`, { body, ...options });
64
+ const {
65
+ 'Idempotency-Key': idempotencyKey,
66
+ 'x-idempotency-expiration': xIdempotencyExpiration,
67
+ ...body
68
+ } = params;
69
+ return this._client.post(path`/profiles/${userID}/lists`, {
70
+ body,
71
+ ...options,
72
+ headers: buildHeaders([
73
+ {
74
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
75
+ ...(xIdempotencyExpiration != null ?
76
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
77
+ : undefined),
78
+ },
79
+ options?.headers,
80
+ ]),
81
+ });
39
82
  }
40
83
  }
41
84
 
@@ -89,7 +132,28 @@ export interface ListRetrieveParams {
89
132
  }
90
133
 
91
134
  export interface ListSubscribeParams {
135
+ /**
136
+ * Body param
137
+ */
92
138
  lists: Array<ProfilesAPI.SubscribeToListsRequestItem>;
139
+
140
+ /**
141
+ * Header param: A unique key that makes this request idempotent. If Courier
142
+ * receives another request with the same `Idempotency-Key`, it returns the stored
143
+ * response from the first request without performing the operation again
144
+ * (including the original status code and any error). Use it to safely retry
145
+ * `POST` requests after network failures without risking duplicate sends. The key
146
+ * is scoped to this endpoint.
147
+ */
148
+ 'Idempotency-Key'?: string;
149
+
150
+ /**
151
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
152
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
153
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
154
+ * maximum is 1 year.
155
+ */
156
+ 'x-idempotency-expiration'?: string;
93
157
  }
94
158
 
95
159
  export declare namespace Lists {