@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
@@ -22,16 +22,15 @@ import { buildHeaders } from '../../internal/headers';
22
22
  import { RequestOptions } from '../../internal/request-options';
23
23
  import { path } from '../../internal/utils/path';
24
24
 
25
+ /**
26
+ * Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
27
+ */
25
28
  export class Journeys extends APIResource {
26
29
  templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
27
30
 
28
31
  /**
29
- * Create a journey. Defaults to `DRAFT` state; pass `state: "PUBLISHED"` to
30
- * publish on create. Send nodes are not allowed on `POST`. The standard flow is:
31
- * create the journey shell here, add notification templates with
32
- * `POST /journeys/{templateId}/templates`, then wire them into the journey with
33
- * `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to
34
- * publish a draft after the fact.
32
+ * Creates a journey from a set of nodes, in draft state unless you pass a
33
+ * published state. Send nodes cannot be included until their templates exist.
35
34
  *
36
35
  * @example
37
36
  * ```ts
@@ -50,8 +49,25 @@ export class Journeys extends APIResource {
50
49
  * });
51
50
  * ```
52
51
  */
53
- create(body: JourneyCreateParams, options?: RequestOptions): APIPromise<JourneyResponse> {
54
- return this._client.post('/journeys', { body, ...options });
52
+ create(params: JourneyCreateParams, options?: RequestOptions): APIPromise<JourneyResponse> {
53
+ const {
54
+ 'Idempotency-Key': idempotencyKey,
55
+ 'x-idempotency-expiration': xIdempotencyExpiration,
56
+ ...body
57
+ } = params;
58
+ return this._client.post('/journeys', {
59
+ body,
60
+ ...options,
61
+ headers: buildHeaders([
62
+ {
63
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
64
+ ...(xIdempotencyExpiration != null ?
65
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
66
+ : undefined),
67
+ },
68
+ options?.headers,
69
+ ]),
70
+ });
55
71
  }
56
72
 
57
73
  /**
@@ -72,7 +88,8 @@ export class Journeys extends APIResource {
72
88
  }
73
89
 
74
90
  /**
75
- * Get the list of journeys.
91
+ * Lists the workspace's journeys, each carrying a name, state, and enabled flag.
92
+ * Paged by cursor.
76
93
  *
77
94
  * @example
78
95
  * ```ts
@@ -87,8 +104,8 @@ export class Journeys extends APIResource {
87
104
  }
88
105
 
89
106
  /**
90
- * Archive a journey. Archived journeys cannot be invoked. Existing journey runs
91
- * continue to completion.
107
+ * Archives a journey so it can no longer be invoked. Runs already in flight
108
+ * continue to completion, so archiving never strands a user mid-sequence.
92
109
  *
93
110
  * @example
94
111
  * ```ts
@@ -103,12 +120,8 @@ export class Journeys extends APIResource {
103
120
  }
104
121
 
105
122
  /**
106
- * Cancel journey runs. The request body must include EXACTLY ONE of
107
- * `cancelation_token` (cancels every run associated with the token) or `run_id`
108
- * (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
109
- * A `run_id` that does not match a run for the tenant returns `404`. Cancelation
110
- * is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
111
- * already `CANCELED` is left unchanged and its current status is returned.
123
+ * Cancels in-flight journey runs, either every run sharing a cancelation token or
124
+ * one run by id. Use it to stop a sequence when the event resolves.
112
125
  *
113
126
  * @example
114
127
  * ```ts
@@ -117,13 +130,30 @@ export class Journeys extends APIResource {
117
130
  * });
118
131
  * ```
119
132
  */
120
- cancel(body: JourneyCancelParams, options?: RequestOptions): APIPromise<CancelJourneyResponse> {
121
- return this._client.post('/journeys/cancel', { body, ...options });
133
+ cancel(params: JourneyCancelParams, options?: RequestOptions): APIPromise<CancelJourneyResponse> {
134
+ const {
135
+ 'Idempotency-Key': idempotencyKey,
136
+ 'x-idempotency-expiration': xIdempotencyExpiration,
137
+ ...body
138
+ } = params;
139
+ return this._client.post('/journeys/cancel', {
140
+ body,
141
+ ...options,
142
+ headers: buildHeaders([
143
+ {
144
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
145
+ ...(xIdempotencyExpiration != null ?
146
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
147
+ : undefined),
148
+ },
149
+ options?.headers,
150
+ ]),
151
+ });
122
152
  }
123
153
 
124
154
  /**
125
- * Invoke a journey by id or alias to start a new run. The response includes a
126
- * `runId` identifying the run.
155
+ * Starts a journey run for one user and returns a runId. Runs execute
156
+ * asynchronously, so the response arrives before any message is sent.
127
157
  *
128
158
  * @example
129
159
  * ```ts
@@ -138,14 +168,32 @@ export class Journeys extends APIResource {
138
168
  */
139
169
  invoke(
140
170
  templateID: string,
141
- body: JourneyInvokeParams,
171
+ params: JourneyInvokeParams,
142
172
  options?: RequestOptions,
143
173
  ): APIPromise<JourneysInvokeResponse> {
144
- return this._client.post(path`/journeys/${templateID}/invoke`, { body, ...options });
174
+ const {
175
+ 'Idempotency-Key': idempotencyKey,
176
+ 'x-idempotency-expiration': xIdempotencyExpiration,
177
+ ...body
178
+ } = params;
179
+ return this._client.post(path`/journeys/${templateID}/invoke`, {
180
+ body,
181
+ ...options,
182
+ headers: buildHeaders([
183
+ {
184
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
185
+ ...(xIdempotencyExpiration != null ?
186
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
187
+ : undefined),
188
+ },
189
+ options?.headers,
190
+ ]),
191
+ });
145
192
  }
146
193
 
147
194
  /**
148
- * List published versions of a journey, ordered most recent first.
195
+ * Lists a journey's published versions, most recent first, so you have a version
196
+ * id to roll back to. Paged by cursor.
149
197
  *
150
198
  * @example
151
199
  * ```ts
@@ -158,9 +206,8 @@ export class Journeys extends APIResource {
158
206
  }
159
207
 
160
208
  /**
161
- * Publish the current draft as a new version. Body is optional; pass
162
- * `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
163
- * the journey has no draft to publish.
209
+ * Publishes a journey's current draft as a new version, making it live for new
210
+ * runs. Pass a version instead to roll back to an earlier one.
164
211
  *
165
212
  * @example
166
213
  * ```ts
@@ -169,18 +216,32 @@ export class Journeys extends APIResource {
169
216
  */
170
217
  publish(
171
218
  templateID: string,
172
- body: JourneyPublishParams | null | undefined = {},
219
+ params: JourneyPublishParams | null | undefined = {},
173
220
  options?: RequestOptions,
174
221
  ): APIPromise<JourneyResponse> {
175
- return this._client.post(path`/journeys/${templateID}/publish`, { body, ...options });
222
+ const {
223
+ 'Idempotency-Key': idempotencyKey,
224
+ 'x-idempotency-expiration': xIdempotencyExpiration,
225
+ ...body
226
+ } = params ?? {};
227
+ return this._client.post(path`/journeys/${templateID}/publish`, {
228
+ body,
229
+ ...options,
230
+ headers: buildHeaders([
231
+ {
232
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
233
+ ...(xIdempotencyExpiration != null ?
234
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
235
+ : undefined),
236
+ },
237
+ options?.headers,
238
+ ]),
239
+ });
176
240
  }
177
241
 
178
242
  /**
179
- * Replace the journey draft. Updates the working draft only; call
180
- * `POST /journeys/{templateId}/publish` to make it live, or pass
181
- * `state: "PUBLISHED"` in this request to publish immediately. Send-node
182
- * `template` ids must already exist and be scoped to this journey, and node ids
183
- * must not be claimed by another journey.
243
+ * Replaces a journey's working draft, leaving the published version live until you
244
+ * publish. Reach for this when editing a journey already running.
184
245
  *
185
246
  * @example
186
247
  * ```ts
@@ -1135,16 +1196,43 @@ export interface JourneysListResponse {
1135
1196
  }
1136
1197
 
1137
1198
  export interface JourneyCreateParams {
1199
+ /**
1200
+ * Body param
1201
+ */
1138
1202
  name: string;
1139
1203
 
1204
+ /**
1205
+ * Body param
1206
+ */
1140
1207
  nodes: Array<JourneyNode>;
1141
1208
 
1209
+ /**
1210
+ * Body param
1211
+ */
1142
1212
  enabled?: boolean;
1143
1213
 
1144
1214
  /**
1145
- * Lifecycle state of a journey.
1215
+ * Body param: Lifecycle state of a journey.
1146
1216
  */
1147
1217
  state?: JourneyState;
1218
+
1219
+ /**
1220
+ * Header param: A unique key that makes this request idempotent. If Courier
1221
+ * receives another request with the same `Idempotency-Key`, it returns the stored
1222
+ * response from the first request without performing the operation again
1223
+ * (including the original status code and any error). Use it to safely retry
1224
+ * `POST` requests after network failures without risking duplicate sends. The key
1225
+ * is scoped to this endpoint.
1226
+ */
1227
+ 'Idempotency-Key'?: string;
1228
+
1229
+ /**
1230
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
1231
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
1232
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
1233
+ * maximum is 1 year.
1234
+ */
1235
+ 'x-idempotency-expiration'?: string;
1148
1236
  }
1149
1237
 
1150
1238
  export interface JourneyRetrieveParams {
@@ -1172,26 +1260,68 @@ export type JourneyCancelParams = JourneyCancelParams.ByCancelationToken | Journ
1172
1260
 
1173
1261
  export declare namespace JourneyCancelParams {
1174
1262
  export interface ByCancelationToken {
1263
+ /**
1264
+ * Body param
1265
+ */
1175
1266
  cancelation_token: string;
1267
+
1268
+ /**
1269
+ * Header param: A unique key that makes this request idempotent. If Courier
1270
+ * receives another request with the same `Idempotency-Key`, it returns the stored
1271
+ * response from the first request without performing the operation again
1272
+ * (including the original status code and any error). Use it to safely retry
1273
+ * `POST` requests after network failures without risking duplicate sends. The key
1274
+ * is scoped to this endpoint.
1275
+ */
1276
+ 'Idempotency-Key'?: string;
1277
+
1278
+ /**
1279
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
1280
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
1281
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
1282
+ * maximum is 1 year.
1283
+ */
1284
+ 'x-idempotency-expiration'?: string;
1176
1285
  }
1177
1286
 
1178
1287
  export interface ByRunID {
1288
+ /**
1289
+ * Body param
1290
+ */
1179
1291
  run_id: string;
1292
+
1293
+ /**
1294
+ * Header param: A unique key that makes this request idempotent. If Courier
1295
+ * receives another request with the same `Idempotency-Key`, it returns the stored
1296
+ * response from the first request without performing the operation again
1297
+ * (including the original status code and any error). Use it to safely retry
1298
+ * `POST` requests after network failures without risking duplicate sends. The key
1299
+ * is scoped to this endpoint.
1300
+ */
1301
+ 'Idempotency-Key'?: string;
1302
+
1303
+ /**
1304
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
1305
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
1306
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
1307
+ * maximum is 1 year.
1308
+ */
1309
+ 'x-idempotency-expiration'?: string;
1180
1310
  }
1181
1311
  }
1182
1312
 
1183
1313
  export interface JourneyInvokeParams {
1184
1314
  /**
1185
- * Data payload passed to the journey. The expected shape can be predefined using
1186
- * the schema builder in the journey editor. This data is available in journey
1187
- * steps for condition evaluation and template variable interpolation. Can also
1188
- * contain user identifiers (user_id, userId, anonymousId) if not provided
1189
- * elsewhere.
1315
+ * Body param: Data payload passed to the journey. The expected shape can be
1316
+ * predefined using the schema builder in the journey editor. This data is
1317
+ * available in journey steps for condition evaluation and template variable
1318
+ * interpolation. Can also contain user identifiers (user_id, userId, anonymousId)
1319
+ * if not provided elsewhere.
1190
1320
  */
1191
1321
  data?: { [key: string]: unknown };
1192
1322
 
1193
1323
  /**
1194
- * Profile data for the user. Can contain contact information (email,
1324
+ * Body param: Profile data for the user. Can contain contact information (email,
1195
1325
  * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
1196
1326
  * profile fields. Profile fields are merged with any existing stored profile for
1197
1327
  * the user. Include context.tenant_id to load a tenant-scoped profile for
@@ -1200,14 +1330,53 @@ export interface JourneyInvokeParams {
1200
1330
  profile?: { [key: string]: unknown };
1201
1331
 
1202
1332
  /**
1203
- * A unique identifier for the user. If not provided, the system will attempt to
1204
- * resolve the user identifier from profile or data objects.
1333
+ * Body param: A unique identifier for the user. If not provided, the system will
1334
+ * attempt to resolve the user identifier from profile or data objects.
1205
1335
  */
1206
1336
  user_id?: string;
1337
+
1338
+ /**
1339
+ * Header param: A unique key that makes this request idempotent. If Courier
1340
+ * receives another request with the same `Idempotency-Key`, it returns the stored
1341
+ * response from the first request without performing the operation again
1342
+ * (including the original status code and any error). Use it to safely retry
1343
+ * `POST` requests after network failures without risking duplicate sends. The key
1344
+ * is scoped to this endpoint.
1345
+ */
1346
+ 'Idempotency-Key'?: string;
1347
+
1348
+ /**
1349
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
1350
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
1351
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
1352
+ * maximum is 1 year.
1353
+ */
1354
+ 'x-idempotency-expiration'?: string;
1207
1355
  }
1208
1356
 
1209
1357
  export interface JourneyPublishParams {
1358
+ /**
1359
+ * Body param
1360
+ */
1210
1361
  version?: string;
1362
+
1363
+ /**
1364
+ * Header param: A unique key that makes this request idempotent. If Courier
1365
+ * receives another request with the same `Idempotency-Key`, it returns the stored
1366
+ * response from the first request without performing the operation again
1367
+ * (including the original status code and any error). Use it to safely retry
1368
+ * `POST` requests after network failures without risking duplicate sends. The key
1369
+ * is scoped to this endpoint.
1370
+ */
1371
+ 'Idempotency-Key'?: string;
1372
+
1373
+ /**
1374
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
1375
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
1376
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
1377
+ * maximum is 1 year.
1378
+ */
1379
+ 'x-idempotency-expiration'?: string;
1211
1380
  }
1212
1381
 
1213
1382
  export interface JourneyReplaceParams {
@@ -9,6 +9,9 @@ import { buildHeaders } from '../../internal/headers';
9
9
  import { RequestOptions } from '../../internal/request-options';
10
10
  import { path } from '../../internal/utils/path';
11
11
 
12
+ /**
13
+ * Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
14
+ */
12
15
  export class Templates extends APIResource {
13
16
  /**
14
17
  * Create a notification template scoped to this journey. Defaults to `DRAFT`
@@ -34,16 +37,32 @@ export class Templates extends APIResource {
34
37
  */
35
38
  create(
36
39
  templateID: string,
37
- body: TemplateCreateParams,
40
+ params: TemplateCreateParams,
38
41
  options?: RequestOptions,
39
42
  ): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
40
- return this._client.post(path`/journeys/${templateID}/templates`, { body, ...options });
43
+ const {
44
+ 'Idempotency-Key': idempotencyKey,
45
+ 'x-idempotency-expiration': xIdempotencyExpiration,
46
+ ...body
47
+ } = params;
48
+ return this._client.post(path`/journeys/${templateID}/templates`, {
49
+ body,
50
+ ...options,
51
+ headers: buildHeaders([
52
+ {
53
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
54
+ ...(xIdempotencyExpiration != null ?
55
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
56
+ : undefined),
57
+ },
58
+ options?.headers,
59
+ ]),
60
+ });
41
61
  }
42
62
 
43
63
  /**
44
- * Fetch a journey-scoped notification template by id. Pass `?version=draft`
45
- * (default `published`) to retrieve the working draft, or `?version=vN` for a
46
- * historical version.
64
+ * Returns a journey's own notification template with its name, brand, subscription
65
+ * topic, and content. Defaults to the published version.
47
66
  *
48
67
  * @example
49
68
  * ```ts
@@ -81,8 +100,8 @@ export class Templates extends APIResource {
81
100
  }
82
101
 
83
102
  /**
84
- * Archive the journey-scoped notification template. Archived templates cannot be
85
- * sent.
103
+ * Archives one journey's notification template, preventing further sends. Detach
104
+ * any send node referencing it beforehand.
86
105
  *
87
106
  * @example
88
107
  * ```ts
@@ -100,8 +119,8 @@ export class Templates extends APIResource {
100
119
  }
101
120
 
102
121
  /**
103
- * List published versions of the journey-scoped notification template, ordered
104
- * most recent first.
122
+ * Lists the published versions of a template that belongs to a journey, most
123
+ * recent first. Paged by cursor.
105
124
  *
106
125
  * @example
107
126
  * ```ts
@@ -121,9 +140,8 @@ export class Templates extends APIResource {
121
140
  }
122
141
 
123
142
  /**
124
- * Publish the current draft of the journey-scoped notification template as a new
125
- * version. Optionally roll back to a prior version by passing
126
- * `{ "version": "vN" }`.
143
+ * Publishes a journey-scoped template's draft as a new version. Pass a version
144
+ * instead to roll back the template to an earlier publish.
127
145
  *
128
146
  * @example
129
147
  * ```ts
@@ -133,11 +151,25 @@ export class Templates extends APIResource {
133
151
  * ```
134
152
  */
135
153
  publish(notificationID: string, params: TemplatePublishParams, options?: RequestOptions): APIPromise<void> {
136
- const { templateId, ...body } = params;
154
+ const {
155
+ templateId,
156
+ 'Idempotency-Key': idempotencyKey,
157
+ 'x-idempotency-expiration': xIdempotencyExpiration,
158
+ ...body
159
+ } = params;
137
160
  return this._client.post(path`/journeys/${templateId}/templates/${notificationID}/publish`, {
138
161
  body,
139
162
  ...options,
140
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
163
+ headers: buildHeaders([
164
+ {
165
+ Accept: '*/*',
166
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
167
+ ...(xIdempotencyExpiration != null ?
168
+ { 'x-idempotency-expiration': xIdempotencyExpiration }
169
+ : undefined),
170
+ },
171
+ options?.headers,
172
+ ]),
141
173
  });
142
174
  }
143
175
 
@@ -201,7 +233,8 @@ export class Templates extends APIResource {
201
233
  }
202
234
 
203
235
  /**
204
- * Replace the journey-scoped notification template draft.
236
+ * Replaces the draft content of one journey's notification template. Publish it
237
+ * before send nodes referencing it render the change.
205
238
  *
206
239
  * @example
207
240
  * ```ts
@@ -228,11 +261,8 @@ export class Templates extends APIResource {
228
261
  }
229
262
 
230
263
  /**
231
- * Retrieve the elemental content of a journey-scoped notification template. The
232
- * response contains the versioned elements along with their content checksums,
233
- * which can be used to detect changes between versions. Pass `?version=draft`
234
- * (default `published`) to retrieve the working draft, or `?version=vN` for a
235
- * historical version.
264
+ * Returns the Elemental elements and version of a journey-scoped template's
265
+ * content. Compare versions to see what changed between publishes.
236
266
  *
237
267
  * @example
238
268
  * ```ts
@@ -256,13 +286,43 @@ export class Templates extends APIResource {
256
286
  }
257
287
 
258
288
  export interface TemplateCreateParams {
289
+ /**
290
+ * Body param
291
+ */
259
292
  channel: string;
260
293
 
294
+ /**
295
+ * Body param
296
+ */
261
297
  notification: TemplateCreateParams.Notification;
262
298
 
299
+ /**
300
+ * Body param
301
+ */
263
302
  providerKey?: string;
264
303
 
304
+ /**
305
+ * Body param
306
+ */
265
307
  state?: string;
308
+
309
+ /**
310
+ * Header param: A unique key that makes this request idempotent. If Courier
311
+ * receives another request with the same `Idempotency-Key`, it returns the stored
312
+ * response from the first request without performing the operation again
313
+ * (including the original status code and any error). Use it to safely retry
314
+ * `POST` requests after network failures without risking duplicate sends. The key
315
+ * is scoped to this endpoint.
316
+ */
317
+ 'Idempotency-Key'?: string;
318
+
319
+ /**
320
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
321
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
322
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
323
+ * maximum is 1 year.
324
+ */
325
+ 'x-idempotency-expiration'?: string;
266
326
  }
267
327
 
268
328
  export namespace TemplateCreateParams {
@@ -340,6 +400,24 @@ export interface TemplatePublishParams {
340
400
  * Body param
341
401
  */
342
402
  version?: string;
403
+
404
+ /**
405
+ * Header param: A unique key that makes this request idempotent. If Courier
406
+ * receives another request with the same `Idempotency-Key`, it returns the stored
407
+ * response from the first request without performing the operation again
408
+ * (including the original status code and any error). Use it to safely retry
409
+ * `POST` requests after network failures without risking duplicate sends. The key
410
+ * is scoped to this endpoint.
411
+ */
412
+ 'Idempotency-Key'?: string;
413
+
414
+ /**
415
+ * Header param: How long the idempotency key remains valid, as a Unix epoch
416
+ * timestamp in seconds or an ISO 8601 date string. Only applies when
417
+ * `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
418
+ * maximum is 1 year.
419
+ */
420
+ 'x-idempotency-expiration'?: string;
343
421
  }
344
422
 
345
423
  export interface TemplatePutContentParams {
@@ -17,18 +17,35 @@ import { buildHeaders } from '../../internal/headers';
17
17
  import { RequestOptions } from '../../internal/request-options';
18
18
  import { path } from '../../internal/utils/path';
19
19
 
20
+ /**
21
+ * Manage static groups of users that you subscribe explicitly, and send to them by list id or list pattern.
22
+ */
20
23
  export class Lists extends APIResource {
21
24
  subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
22
25
 
23
26
  /**
24
- * Returns a list based on the list ID provided.
27
+ * Returns one list by id with its name and created and updated timestamps. Fetch
28
+ * its subscribers separately with the subscriptions endpoint.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const subscriptionList = await client.lists.retrieve(
33
+ * 'list_id',
34
+ * );
35
+ * ```
25
36
  */
26
37
  retrieve(listID: string, options?: RequestOptions): APIPromise<SubscriptionList> {
27
38
  return this._client.get(path`/lists/${listID}`, options);
28
39
  }
29
40
 
30
41
  /**
31
- * Create or replace an existing list with the supplied values.
42
+ * Creates or replaces a list from a name and preferences. Subscribers are managed
43
+ * through the separate subscriptions endpoints.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * await client.lists.update('list_id', { name: 'name' });
48
+ * ```
32
49
  */
33
50
  update(listID: string, body: ListUpdateParams, options?: RequestOptions): APIPromise<void> {
34
51
  return this._client.put(path`/lists/${listID}`, {
@@ -39,7 +56,13 @@ export class Lists extends APIResource {
39
56
  }
40
57
 
41
58
  /**
42
- * Returns all of the lists, with the ability to filter based on a pattern.
59
+ * Returns the workspace's lists, filterable by a pattern to fetch a subset such as
60
+ * every regional list. Paged by cursor.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const lists = await client.lists.list();
65
+ * ```
43
66
  */
44
67
  list(
45
68
  query: ListListParams | null | undefined = {},
@@ -49,7 +72,13 @@ export class Lists extends APIResource {
49
72
  }
50
73
 
51
74
  /**
52
- * Delete a list by list ID.
75
+ * Deletes a list, halting sends that target it. A previously deleted list can be
76
+ * brought back with the companion restore endpoint.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * await client.lists.delete('list_id');
81
+ * ```
53
82
  */
54
83
  delete(listID: string, options?: RequestOptions): APIPromise<void> {
55
84
  return this._client.delete(path`/lists/${listID}`, {
@@ -59,7 +88,13 @@ export class Lists extends APIResource {
59
88
  }
60
89
 
61
90
  /**
62
- * Restore a previously deleted list.
91
+ * Restores a previously deleted list along with its subscribers, so a list removed
92
+ * by mistake can be brought back rather than rebuilt.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * await client.lists.restore('list_id');
97
+ * ```
63
98
  */
64
99
  restore(listID: string, body: ListRestoreParams, options?: RequestOptions): APIPromise<void> {
65
100
  return this._client.put(path`/lists/${listID}/restore`, {