@trycourier/courier 7.10.2 → 7.19.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 (423) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +1 -0
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/client.d.mts +10 -4
  10. package/client.d.mts.map +1 -1
  11. package/client.d.ts +10 -4
  12. package/client.d.ts.map +1 -1
  13. package/client.js +27 -2
  14. package/client.js.map +1 -1
  15. package/client.mjs +27 -2
  16. package/client.mjs.map +1 -1
  17. package/core/api-promise.d.mts.map +1 -1
  18. package/core/api-promise.d.ts.map +1 -1
  19. package/core/api-promise.mjs.map +1 -1
  20. package/core/error.mjs.map +1 -1
  21. package/core/resource.d.mts.map +1 -1
  22. package/core/resource.d.ts.map +1 -1
  23. package/core/uploads.d.mts.map +1 -1
  24. package/core/uploads.d.ts.map +1 -1
  25. package/core/uploads.mjs.map +1 -1
  26. package/error.d.mts +1 -0
  27. package/error.d.mts.map +1 -1
  28. package/error.d.ts +1 -0
  29. package/error.d.ts.map +1 -1
  30. package/error.mjs +1 -0
  31. package/error.mjs.map +1 -1
  32. package/index.d.mts.map +1 -1
  33. package/index.d.ts.map +1 -1
  34. package/index.mjs.map +1 -1
  35. package/internal/detect-platform.mjs.map +1 -1
  36. package/internal/headers.mjs.map +1 -1
  37. package/internal/parse.d.mts.map +1 -1
  38. package/internal/parse.d.ts.map +1 -1
  39. package/internal/parse.mjs.map +1 -1
  40. package/internal/qs/formats.d.mts.map +1 -1
  41. package/internal/qs/formats.d.ts.map +1 -1
  42. package/internal/qs/index.d.mts +2 -2
  43. package/internal/qs/index.d.mts.map +1 -1
  44. package/internal/qs/index.d.ts +2 -2
  45. package/internal/qs/index.d.ts.map +1 -1
  46. package/internal/qs/index.mjs.map +1 -1
  47. package/internal/qs/stringify.d.mts.map +1 -1
  48. package/internal/qs/stringify.d.ts.map +1 -1
  49. package/internal/qs/stringify.mjs.map +1 -1
  50. package/internal/qs/utils.d.mts.map +1 -1
  51. package/internal/qs/utils.d.ts.map +1 -1
  52. package/internal/qs/utils.mjs.map +1 -1
  53. package/internal/request-options.d.mts.map +1 -1
  54. package/internal/request-options.d.ts.map +1 -1
  55. package/internal/shims.d.mts +6 -0
  56. package/internal/shims.d.mts.map +1 -1
  57. package/internal/shims.d.ts +6 -0
  58. package/internal/shims.d.ts.map +1 -1
  59. package/internal/to-file.d.mts.map +1 -1
  60. package/internal/to-file.d.ts.map +1 -1
  61. package/internal/to-file.mjs.map +1 -1
  62. package/internal/types.d.mts +10 -10
  63. package/internal/types.d.mts.map +1 -1
  64. package/internal/types.d.ts +10 -10
  65. package/internal/types.d.ts.map +1 -1
  66. package/internal/uploads.d.mts.map +1 -1
  67. package/internal/uploads.d.ts.map +1 -1
  68. package/internal/uploads.mjs.map +1 -1
  69. package/internal/utils/base64.mjs.map +1 -1
  70. package/internal/utils/log.d.mts.map +1 -1
  71. package/internal/utils/log.d.ts.map +1 -1
  72. package/internal/utils/log.js +2 -0
  73. package/internal/utils/log.js.map +1 -1
  74. package/internal/utils/log.mjs +2 -0
  75. package/internal/utils/log.mjs.map +1 -1
  76. package/internal/utils/path.mjs.map +1 -1
  77. package/internal/utils/query.mjs.map +1 -1
  78. package/internal/utils/values.mjs.map +1 -1
  79. package/internal/utils.d.mts.map +1 -1
  80. package/internal/utils.d.ts.map +1 -1
  81. package/internal/utils.mjs.map +1 -1
  82. package/package.json +1 -1
  83. package/resource.d.mts +1 -0
  84. package/resource.d.mts.map +1 -1
  85. package/resource.d.ts +1 -0
  86. package/resource.d.ts.map +1 -1
  87. package/resource.mjs +1 -0
  88. package/resource.mjs.map +1 -1
  89. package/resources/audiences.d.mts +5 -2
  90. package/resources/audiences.d.mts.map +1 -1
  91. package/resources/audiences.d.ts +5 -2
  92. package/resources/audiences.d.ts.map +1 -1
  93. package/resources/audiences.mjs.map +1 -1
  94. package/resources/audit-events.d.mts.map +1 -1
  95. package/resources/audit-events.d.ts.map +1 -1
  96. package/resources/audit-events.mjs.map +1 -1
  97. package/resources/auth.d.mts.map +1 -1
  98. package/resources/auth.d.ts.map +1 -1
  99. package/resources/auth.mjs.map +1 -1
  100. package/resources/automations/automations.d.mts.map +1 -1
  101. package/resources/automations/automations.d.ts.map +1 -1
  102. package/resources/automations/automations.mjs.map +1 -1
  103. package/resources/automations/index.d.mts.map +1 -1
  104. package/resources/automations/index.d.ts.map +1 -1
  105. package/resources/automations/index.mjs.map +1 -1
  106. package/resources/automations/invoke.d.mts.map +1 -1
  107. package/resources/automations/invoke.d.ts.map +1 -1
  108. package/resources/automations/invoke.mjs.map +1 -1
  109. package/resources/automations.d.mts.map +1 -1
  110. package/resources/automations.d.ts.map +1 -1
  111. package/resources/automations.mjs.map +1 -1
  112. package/resources/brands.d.mts +35 -2
  113. package/resources/brands.d.mts.map +1 -1
  114. package/resources/brands.d.ts +35 -2
  115. package/resources/brands.d.ts.map +1 -1
  116. package/resources/brands.js +34 -1
  117. package/resources/brands.js.map +1 -1
  118. package/resources/brands.mjs +34 -1
  119. package/resources/brands.mjs.map +1 -1
  120. package/resources/bulk.d.mts.map +1 -1
  121. package/resources/bulk.d.ts.map +1 -1
  122. package/resources/bulk.mjs.map +1 -1
  123. package/resources/digests/digests.d.mts +94 -0
  124. package/resources/digests/digests.d.mts.map +1 -0
  125. package/resources/digests/digests.d.ts +94 -0
  126. package/resources/digests/digests.d.ts.map +1 -0
  127. package/resources/digests/digests.js +17 -0
  128. package/resources/digests/digests.js.map +1 -0
  129. package/resources/digests/digests.mjs +12 -0
  130. package/resources/digests/digests.mjs.map +1 -0
  131. package/resources/digests/index.d.mts +3 -0
  132. package/resources/digests/index.d.mts.map +1 -0
  133. package/resources/digests/index.d.ts +3 -0
  134. package/resources/digests/index.d.ts.map +1 -0
  135. package/resources/digests/index.js +9 -0
  136. package/resources/digests/index.js.map +1 -0
  137. package/resources/digests/index.mjs +4 -0
  138. package/resources/digests/index.mjs.map +1 -0
  139. package/resources/digests/schedules.d.mts +32 -0
  140. package/resources/digests/schedules.d.mts.map +1 -0
  141. package/resources/digests/schedules.d.ts +32 -0
  142. package/resources/digests/schedules.d.ts.map +1 -0
  143. package/resources/digests/schedules.js +29 -0
  144. package/resources/digests/schedules.js.map +1 -0
  145. package/resources/digests/schedules.mjs +25 -0
  146. package/resources/digests/schedules.mjs.map +1 -0
  147. package/resources/digests.d.mts +2 -0
  148. package/resources/digests.d.mts.map +1 -0
  149. package/resources/digests.d.ts +2 -0
  150. package/resources/digests.d.ts.map +1 -0
  151. package/resources/digests.js +6 -0
  152. package/resources/digests.js.map +1 -0
  153. package/resources/digests.mjs +3 -0
  154. package/resources/digests.mjs.map +1 -0
  155. package/resources/inbound.d.mts.map +1 -1
  156. package/resources/inbound.d.ts.map +1 -1
  157. package/resources/inbound.mjs.map +1 -1
  158. package/resources/index.d.mts +4 -2
  159. package/resources/index.d.mts.map +1 -1
  160. package/resources/index.d.ts +4 -2
  161. package/resources/index.d.ts.map +1 -1
  162. package/resources/index.js +6 -2
  163. package/resources/index.js.map +1 -1
  164. package/resources/index.mjs +3 -1
  165. package/resources/index.mjs.map +1 -1
  166. package/resources/journeys/index.d.mts +3 -0
  167. package/resources/journeys/index.d.mts.map +1 -0
  168. package/resources/journeys/index.d.ts +3 -0
  169. package/resources/journeys/index.d.ts.map +1 -0
  170. package/resources/journeys/index.js +9 -0
  171. package/resources/journeys/index.js.map +1 -0
  172. package/resources/journeys/index.mjs +4 -0
  173. package/resources/journeys/index.mjs.map +1 -0
  174. package/resources/journeys/journeys.d.mts +943 -0
  175. package/resources/journeys/journeys.d.mts.map +1 -0
  176. package/resources/journeys/journeys.d.ts +943 -0
  177. package/resources/journeys/journeys.d.ts.map +1 -0
  178. package/resources/journeys/journeys.js +166 -0
  179. package/resources/journeys/journeys.js.map +1 -0
  180. package/resources/journeys/journeys.mjs +161 -0
  181. package/resources/journeys/journeys.mjs.map +1 -0
  182. package/resources/journeys/templates.d.mts +338 -0
  183. package/resources/journeys/templates.d.mts.map +1 -0
  184. package/resources/journeys/templates.d.ts +338 -0
  185. package/resources/journeys/templates.d.ts.map +1 -0
  186. package/resources/journeys/templates.js +213 -0
  187. package/resources/journeys/templates.js.map +1 -0
  188. package/resources/journeys/templates.mjs +209 -0
  189. package/resources/journeys/templates.mjs.map +1 -0
  190. package/resources/journeys.d.mts +1 -142
  191. package/resources/journeys.d.mts.map +1 -1
  192. package/resources/journeys.d.ts +1 -142
  193. package/resources/journeys.d.ts.map +1 -1
  194. package/resources/journeys.js +2 -34
  195. package/resources/journeys.js.map +1 -1
  196. package/resources/journeys.mjs +1 -32
  197. package/resources/journeys.mjs.map +1 -1
  198. package/resources/lists/index.d.mts.map +1 -1
  199. package/resources/lists/index.d.ts.map +1 -1
  200. package/resources/lists/index.mjs.map +1 -1
  201. package/resources/lists/lists.d.mts.map +1 -1
  202. package/resources/lists/lists.d.ts.map +1 -1
  203. package/resources/lists/lists.mjs.map +1 -1
  204. package/resources/lists/subscriptions.d.mts.map +1 -1
  205. package/resources/lists/subscriptions.d.ts.map +1 -1
  206. package/resources/lists/subscriptions.mjs.map +1 -1
  207. package/resources/lists.d.mts.map +1 -1
  208. package/resources/lists.d.ts.map +1 -1
  209. package/resources/lists.mjs.map +1 -1
  210. package/resources/messages.d.mts +16 -1
  211. package/resources/messages.d.mts.map +1 -1
  212. package/resources/messages.d.ts +16 -1
  213. package/resources/messages.d.ts.map +1 -1
  214. package/resources/messages.js +10 -0
  215. package/resources/messages.js.map +1 -1
  216. package/resources/messages.mjs +10 -0
  217. package/resources/messages.mjs.map +1 -1
  218. package/resources/notifications/checks.d.mts +3 -3
  219. package/resources/notifications/checks.d.mts.map +1 -1
  220. package/resources/notifications/checks.d.ts +3 -3
  221. package/resources/notifications/checks.d.ts.map +1 -1
  222. package/resources/notifications/checks.js +3 -3
  223. package/resources/notifications/checks.mjs +3 -3
  224. package/resources/notifications/checks.mjs.map +1 -1
  225. package/resources/notifications/index.d.mts.map +1 -1
  226. package/resources/notifications/index.d.ts.map +1 -1
  227. package/resources/notifications/index.mjs.map +1 -1
  228. package/resources/notifications/notifications.d.mts.map +1 -1
  229. package/resources/notifications/notifications.d.ts.map +1 -1
  230. package/resources/notifications/notifications.mjs.map +1 -1
  231. package/resources/notifications.d.mts.map +1 -1
  232. package/resources/notifications.d.ts.map +1 -1
  233. package/resources/notifications.mjs.map +1 -1
  234. package/resources/profiles/index.d.mts.map +1 -1
  235. package/resources/profiles/index.d.ts.map +1 -1
  236. package/resources/profiles/index.mjs.map +1 -1
  237. package/resources/profiles/lists.d.mts.map +1 -1
  238. package/resources/profiles/lists.d.ts.map +1 -1
  239. package/resources/profiles/lists.mjs.map +1 -1
  240. package/resources/profiles/profiles.d.mts.map +1 -1
  241. package/resources/profiles/profiles.d.ts.map +1 -1
  242. package/resources/profiles/profiles.mjs.map +1 -1
  243. package/resources/profiles.d.mts.map +1 -1
  244. package/resources/profiles.d.ts.map +1 -1
  245. package/resources/profiles.mjs.map +1 -1
  246. package/resources/providers/catalog.d.mts.map +1 -1
  247. package/resources/providers/catalog.d.ts.map +1 -1
  248. package/resources/providers/catalog.mjs.map +1 -1
  249. package/resources/providers/index.d.mts.map +1 -1
  250. package/resources/providers/index.d.ts.map +1 -1
  251. package/resources/providers/index.mjs.map +1 -1
  252. package/resources/providers/providers.d.mts.map +1 -1
  253. package/resources/providers/providers.d.ts.map +1 -1
  254. package/resources/providers/providers.mjs.map +1 -1
  255. package/resources/providers.d.mts.map +1 -1
  256. package/resources/providers.d.ts.map +1 -1
  257. package/resources/providers.mjs.map +1 -1
  258. package/resources/requests.d.mts.map +1 -1
  259. package/resources/requests.d.ts.map +1 -1
  260. package/resources/requests.mjs.map +1 -1
  261. package/resources/routing-strategies.d.mts.map +1 -1
  262. package/resources/routing-strategies.d.ts.map +1 -1
  263. package/resources/routing-strategies.mjs.map +1 -1
  264. package/resources/send.d.mts.map +1 -1
  265. package/resources/send.d.ts.map +1 -1
  266. package/resources/send.mjs.map +1 -1
  267. package/resources/shared.d.mts +6 -0
  268. package/resources/shared.d.mts.map +1 -1
  269. package/resources/shared.d.ts +6 -0
  270. package/resources/shared.d.ts.map +1 -1
  271. package/resources/tenants/index.d.mts +1 -1
  272. package/resources/tenants/index.d.mts.map +1 -1
  273. package/resources/tenants/index.d.ts +1 -1
  274. package/resources/tenants/index.d.ts.map +1 -1
  275. package/resources/tenants/index.js.map +1 -1
  276. package/resources/tenants/index.mjs.map +1 -1
  277. package/resources/tenants/preferences/index.d.mts.map +1 -1
  278. package/resources/tenants/preferences/index.d.ts.map +1 -1
  279. package/resources/tenants/preferences/index.mjs.map +1 -1
  280. package/resources/tenants/preferences/items.d.mts.map +1 -1
  281. package/resources/tenants/preferences/items.d.ts.map +1 -1
  282. package/resources/tenants/preferences/items.mjs.map +1 -1
  283. package/resources/tenants/preferences/preferences.d.mts.map +1 -1
  284. package/resources/tenants/preferences/preferences.d.ts.map +1 -1
  285. package/resources/tenants/preferences/preferences.mjs.map +1 -1
  286. package/resources/tenants/preferences.d.mts.map +1 -1
  287. package/resources/tenants/preferences.d.ts.map +1 -1
  288. package/resources/tenants/preferences.mjs.map +1 -1
  289. package/resources/tenants/templates/index.d.mts +1 -1
  290. package/resources/tenants/templates/index.d.mts.map +1 -1
  291. package/resources/tenants/templates/index.d.ts +1 -1
  292. package/resources/tenants/templates/index.d.ts.map +1 -1
  293. package/resources/tenants/templates/index.js.map +1 -1
  294. package/resources/tenants/templates/index.mjs.map +1 -1
  295. package/resources/tenants/templates/templates.d.mts +23 -1
  296. package/resources/tenants/templates/templates.d.mts.map +1 -1
  297. package/resources/tenants/templates/templates.d.ts +23 -1
  298. package/resources/tenants/templates/templates.d.ts.map +1 -1
  299. package/resources/tenants/templates/templates.js +23 -0
  300. package/resources/tenants/templates/templates.js.map +1 -1
  301. package/resources/tenants/templates/templates.mjs +23 -0
  302. package/resources/tenants/templates/templates.mjs.map +1 -1
  303. package/resources/tenants/templates/versions.d.mts.map +1 -1
  304. package/resources/tenants/templates/versions.d.ts.map +1 -1
  305. package/resources/tenants/templates/versions.mjs.map +1 -1
  306. package/resources/tenants/templates.d.mts.map +1 -1
  307. package/resources/tenants/templates.d.ts.map +1 -1
  308. package/resources/tenants/templates.mjs.map +1 -1
  309. package/resources/tenants/tenants.d.mts +2 -2
  310. package/resources/tenants/tenants.d.mts.map +1 -1
  311. package/resources/tenants/tenants.d.ts +2 -2
  312. package/resources/tenants/tenants.d.ts.map +1 -1
  313. package/resources/tenants/tenants.js.map +1 -1
  314. package/resources/tenants/tenants.mjs.map +1 -1
  315. package/resources/tenants.d.mts.map +1 -1
  316. package/resources/tenants.d.ts.map +1 -1
  317. package/resources/tenants.mjs.map +1 -1
  318. package/resources/translations.d.mts.map +1 -1
  319. package/resources/translations.d.ts.map +1 -1
  320. package/resources/translations.mjs.map +1 -1
  321. package/resources/users/index.d.mts +1 -1
  322. package/resources/users/index.d.mts.map +1 -1
  323. package/resources/users/index.d.ts +1 -1
  324. package/resources/users/index.d.ts.map +1 -1
  325. package/resources/users/index.js.map +1 -1
  326. package/resources/users/index.mjs.map +1 -1
  327. package/resources/users/preferences.d.mts +211 -1
  328. package/resources/users/preferences.d.mts.map +1 -1
  329. package/resources/users/preferences.d.ts +211 -1
  330. package/resources/users/preferences.d.ts.map +1 -1
  331. package/resources/users/preferences.js +105 -0
  332. package/resources/users/preferences.js.map +1 -1
  333. package/resources/users/preferences.mjs +105 -0
  334. package/resources/users/preferences.mjs.map +1 -1
  335. package/resources/users/tenants.d.mts.map +1 -1
  336. package/resources/users/tenants.d.ts.map +1 -1
  337. package/resources/users/tenants.mjs.map +1 -1
  338. package/resources/users/tokens.d.mts.map +1 -1
  339. package/resources/users/tokens.d.ts.map +1 -1
  340. package/resources/users/tokens.mjs.map +1 -1
  341. package/resources/users/users.d.mts +2 -2
  342. package/resources/users/users.d.mts.map +1 -1
  343. package/resources/users/users.d.ts +2 -2
  344. package/resources/users/users.d.ts.map +1 -1
  345. package/resources/users/users.js.map +1 -1
  346. package/resources/users/users.mjs.map +1 -1
  347. package/resources/users.d.mts.map +1 -1
  348. package/resources/users.d.ts.map +1 -1
  349. package/resources/users.mjs.map +1 -1
  350. package/resources/workspace-preferences/index.d.mts +3 -0
  351. package/resources/workspace-preferences/index.d.mts.map +1 -0
  352. package/resources/workspace-preferences/index.d.ts +3 -0
  353. package/resources/workspace-preferences/index.d.ts.map +1 -0
  354. package/resources/workspace-preferences/index.js +9 -0
  355. package/resources/workspace-preferences/index.js.map +1 -0
  356. package/resources/workspace-preferences/index.mjs +4 -0
  357. package/resources/workspace-preferences/index.mjs.map +1 -0
  358. package/resources/workspace-preferences/topics.d.mts +168 -0
  359. package/resources/workspace-preferences/topics.d.mts.map +1 -0
  360. package/resources/workspace-preferences/topics.d.ts +168 -0
  361. package/resources/workspace-preferences/topics.d.ts.map +1 -0
  362. package/resources/workspace-preferences/topics.js +103 -0
  363. package/resources/workspace-preferences/topics.js.map +1 -0
  364. package/resources/workspace-preferences/topics.mjs +99 -0
  365. package/resources/workspace-preferences/topics.mjs.map +1 -0
  366. package/resources/workspace-preferences/workspace-preferences.d.mts +410 -0
  367. package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -0
  368. package/resources/workspace-preferences/workspace-preferences.d.ts +410 -0
  369. package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -0
  370. package/resources/workspace-preferences/workspace-preferences.js +104 -0
  371. package/resources/workspace-preferences/workspace-preferences.js.map +1 -0
  372. package/resources/workspace-preferences/workspace-preferences.mjs +99 -0
  373. package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -0
  374. package/resources/workspace-preferences.d.mts +2 -0
  375. package/resources/workspace-preferences.d.mts.map +1 -0
  376. package/resources/workspace-preferences.d.ts +2 -0
  377. package/resources/workspace-preferences.d.ts.map +1 -0
  378. package/resources/workspace-preferences.js +6 -0
  379. package/resources/workspace-preferences.js.map +1 -0
  380. package/resources/workspace-preferences.mjs +3 -0
  381. package/resources/workspace-preferences.mjs.map +1 -0
  382. package/resources.d.mts.map +1 -1
  383. package/resources.d.ts.map +1 -1
  384. package/resources.mjs.map +1 -1
  385. package/src/client.ts +158 -10
  386. package/src/internal/types.ts +6 -8
  387. package/src/internal/utils/log.ts +2 -0
  388. package/src/resources/audiences.ts +5 -2
  389. package/src/resources/brands.ts +36 -3
  390. package/src/resources/digests/digests.ts +120 -0
  391. package/src/resources/digests/index.ts +9 -0
  392. package/src/resources/digests/schedules.ts +51 -0
  393. package/src/resources/digests.ts +3 -0
  394. package/src/resources/index.ts +62 -1
  395. package/src/resources/journeys/index.ts +62 -0
  396. package/src/resources/journeys/journeys.ts +1289 -0
  397. package/src/resources/journeys/templates.ts +486 -0
  398. package/src/resources/journeys.ts +1 -172
  399. package/src/resources/messages.ts +20 -0
  400. package/src/resources/notifications/checks.ts +3 -3
  401. package/src/resources/shared.ts +7 -0
  402. package/src/resources/tenants/index.ts +1 -0
  403. package/src/resources/tenants/templates/index.ts +1 -0
  404. package/src/resources/tenants/templates/templates.ts +32 -0
  405. package/src/resources/tenants/tenants.ts +2 -0
  406. package/src/resources/users/index.ts +6 -0
  407. package/src/resources/users/preferences.ts +269 -0
  408. package/src/resources/users/users.ts +12 -0
  409. package/src/resources/workspace-preferences/index.ts +25 -0
  410. package/src/resources/workspace-preferences/topics.ts +229 -0
  411. package/src/resources/workspace-preferences/workspace-preferences.ts +534 -0
  412. package/src/resources/workspace-preferences.ts +3 -0
  413. package/src/version.ts +1 -1
  414. package/uploads.d.mts +1 -0
  415. package/uploads.d.mts.map +1 -1
  416. package/uploads.d.ts +1 -0
  417. package/uploads.d.ts.map +1 -1
  418. package/uploads.mjs +1 -0
  419. package/uploads.mjs.map +1 -1
  420. package/version.d.mts +1 -1
  421. package/version.d.ts +1 -1
  422. package/version.js +1 -1
  423. package/version.mjs +1 -1
@@ -0,0 +1,1289 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as JourneysAPI from './journeys';
5
+ import * as Shared from '../shared';
6
+ import * as TemplatesAPI from './templates';
7
+ import {
8
+ TemplateArchiveParams,
9
+ TemplateCreateParams,
10
+ TemplateListParams,
11
+ TemplateListVersionsParams,
12
+ TemplatePublishParams,
13
+ TemplatePutContentParams,
14
+ TemplatePutLocaleParams,
15
+ TemplateReplaceParams,
16
+ TemplateRetrieveContentParams,
17
+ TemplateRetrieveParams,
18
+ Templates,
19
+ } from './templates';
20
+ import { APIPromise } from '../../core/api-promise';
21
+ import { buildHeaders } from '../../internal/headers';
22
+ import { RequestOptions } from '../../internal/request-options';
23
+ import { path } from '../../internal/utils/path';
24
+
25
+ export class Journeys extends APIResource {
26
+ templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
27
+
28
+ /**
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.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const journeyResponse = await client.journeys.create({
39
+ * name: 'Welcome Journey',
40
+ * nodes: [
41
+ * {
42
+ * id: 'trigger-1',
43
+ * type: 'trigger',
44
+ * trigger_type: 'api',
45
+ * },
46
+ * { id: 'send-1', type: 'send' },
47
+ * ],
48
+ * enabled: true,
49
+ * state: 'DRAFT',
50
+ * });
51
+ * ```
52
+ */
53
+ create(body: JourneyCreateParams, options?: RequestOptions): APIPromise<JourneyResponse> {
54
+ return this._client.post('/journeys', { body, ...options });
55
+ }
56
+
57
+ /**
58
+ * Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve
59
+ * the working draft, or `?version=vN` to retrieve a historical version.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const journeyResponse = await client.journeys.retrieve('x');
64
+ * ```
65
+ */
66
+ retrieve(
67
+ templateID: string,
68
+ query: JourneyRetrieveParams | null | undefined = {},
69
+ options?: RequestOptions,
70
+ ): APIPromise<JourneyResponse> {
71
+ return this._client.get(path`/journeys/${templateID}`, { query, ...options });
72
+ }
73
+
74
+ /**
75
+ * Get the list of journeys.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const journeysListResponse = await client.journeys.list();
80
+ * ```
81
+ */
82
+ list(
83
+ query: JourneyListParams | null | undefined = {},
84
+ options?: RequestOptions,
85
+ ): APIPromise<JourneysListResponse> {
86
+ return this._client.get('/journeys', { query, ...options });
87
+ }
88
+
89
+ /**
90
+ * Archive a journey. Archived journeys cannot be invoked. Existing journey runs
91
+ * continue to completion.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * await client.journeys.archive('x');
96
+ * ```
97
+ */
98
+ archive(templateID: string, options?: RequestOptions): APIPromise<void> {
99
+ return this._client.delete(path`/journeys/${templateID}`, {
100
+ ...options,
101
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
102
+ });
103
+ }
104
+
105
+ /**
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.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const cancelJourneyResponse = await client.journeys.cancel({
116
+ * cancelation_token: 'order-1234',
117
+ * });
118
+ * ```
119
+ */
120
+ cancel(body: JourneyCancelParams, options?: RequestOptions): APIPromise<CancelJourneyResponse> {
121
+ return this._client.post('/journeys/cancel', { body, ...options });
122
+ }
123
+
124
+ /**
125
+ * Invoke a journey by id or alias to start a new run. The response includes a
126
+ * `runId` identifying the run.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * const journeysInvokeResponse = await client.journeys.invoke(
131
+ * 'templateId',
132
+ * {
133
+ * data: { order_id: 'order-456', amount: 99.99 },
134
+ * user_id: 'user-123',
135
+ * },
136
+ * );
137
+ * ```
138
+ */
139
+ invoke(
140
+ templateID: string,
141
+ body: JourneyInvokeParams,
142
+ options?: RequestOptions,
143
+ ): APIPromise<JourneysInvokeResponse> {
144
+ return this._client.post(path`/journeys/${templateID}/invoke`, { body, ...options });
145
+ }
146
+
147
+ /**
148
+ * List published versions of a journey, ordered most recent first.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const journeyVersionsListResponse =
153
+ * await client.journeys.listVersions('x');
154
+ * ```
155
+ */
156
+ listVersions(templateID: string, options?: RequestOptions): APIPromise<JourneyVersionsListResponse> {
157
+ return this._client.get(path`/journeys/${templateID}/versions`, options);
158
+ }
159
+
160
+ /**
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.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * const journeyResponse = await client.journeys.publish('x');
168
+ * ```
169
+ */
170
+ publish(
171
+ templateID: string,
172
+ body: JourneyPublishParams | null | undefined = {},
173
+ options?: RequestOptions,
174
+ ): APIPromise<JourneyResponse> {
175
+ return this._client.post(path`/journeys/${templateID}/publish`, { body, ...options });
176
+ }
177
+
178
+ /**
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.
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * const journeyResponse = await client.journeys.replace('x', {
188
+ * name: 'Welcome Journey v2',
189
+ * nodes: [],
190
+ * enabled: true,
191
+ * state: 'DRAFT',
192
+ * });
193
+ * ```
194
+ */
195
+ replace(
196
+ templateID: string,
197
+ body: JourneyReplaceParams,
198
+ options?: RequestOptions,
199
+ ): APIPromise<JourneyResponse> {
200
+ return this._client.put(path`/journeys/${templateID}`, { body, ...options });
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of
206
+ * `cancelation_token` (cancels every run associated with the token) or `run_id`
207
+ * (cancels a single tenant-scoped run).
208
+ */
209
+ export type CancelJourneyRequest = CancelJourneyRequest.ByCancelationToken | CancelJourneyRequest.ByRunID;
210
+
211
+ export namespace CancelJourneyRequest {
212
+ export interface ByCancelationToken {
213
+ cancelation_token: string;
214
+ }
215
+
216
+ export interface ByRunID {
217
+ run_id: string;
218
+ }
219
+ }
220
+
221
+ /**
222
+ * `202 Accepted` body for `POST /journeys/cancel`, returning the submitted
223
+ * identifier. When called with `cancelation_token`, returns
224
+ * `{ cancelation_token }`; when called with `run_id`, returns
225
+ * `{ run_id, status }`.
226
+ */
227
+ export type CancelJourneyResponse = CancelJourneyResponse.TokenBranch | CancelJourneyResponse.RunIDBranch;
228
+
229
+ export namespace CancelJourneyResponse {
230
+ export interface TokenBranch {
231
+ cancelation_token: string;
232
+ }
233
+
234
+ export interface RunIDBranch {
235
+ run_id: string;
236
+
237
+ /**
238
+ * The run's resulting status. `CANCELED` when the run was active and has been
239
+ * canceled; `PROCESSED` or `ERROR` when the run had already finished and was left
240
+ * unchanged; `CANCELED` for an already-canceled run.
241
+ */
242
+ status: string;
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Request body for creating a journey.
248
+ */
249
+ export interface CreateJourneyRequest {
250
+ name: string;
251
+
252
+ nodes: Array<JourneyNode>;
253
+
254
+ enabled?: boolean;
255
+
256
+ /**
257
+ * Lifecycle state of a journey.
258
+ */
259
+ state?: JourneyState;
260
+ }
261
+
262
+ /**
263
+ * A journey template representing an automation workflow.
264
+ */
265
+ export interface Journey {
266
+ /**
267
+ * The unique identifier of the journey.
268
+ */
269
+ id: string;
270
+
271
+ /**
272
+ * The name of the journey.
273
+ */
274
+ name: string;
275
+
276
+ /**
277
+ * The version of the journey (published or draft).
278
+ */
279
+ version: 'published' | 'draft';
280
+
281
+ /**
282
+ * ISO 8601 timestamp when the journey was created.
283
+ */
284
+ createdAt?: string;
285
+
286
+ /**
287
+ * ISO 8601 timestamp when the journey was last updated.
288
+ */
289
+ updatedAt?: string;
290
+ }
291
+
292
+ /**
293
+ * Invoke an AI step with `user_prompt` and optional `web_search`. Returns a
294
+ * structured response conforming to `output_schema`.
295
+ */
296
+ export interface JourneyAINode {
297
+ /**
298
+ * A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
299
+ */
300
+ output_schema: { [key: string]: unknown };
301
+
302
+ type: 'ai';
303
+
304
+ id?: string;
305
+
306
+ /**
307
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
308
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
309
+ * express "no conditions".
310
+ */
311
+ conditions?: JourneyConditionsField;
312
+
313
+ model?: string;
314
+
315
+ user_prompt?: string;
316
+
317
+ web_search?: boolean;
318
+ }
319
+
320
+ /**
321
+ * Trigger fired when the journey is invoked via the API. The optional `schema`
322
+ * field is a JSON Schema that validates the invocation payload.
323
+ */
324
+ export interface JourneyAPIInvokeTriggerNode {
325
+ trigger_type: 'api-invoke';
326
+
327
+ type: 'trigger';
328
+
329
+ id?: string;
330
+
331
+ /**
332
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
333
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
334
+ * express "no conditions".
335
+ */
336
+ conditions?: JourneyConditionsField;
337
+
338
+ /**
339
+ * A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
340
+ */
341
+ schema?: { [key: string]: unknown };
342
+ }
343
+
344
+ /**
345
+ * A single condition expressed as a positional tuple of strings.
346
+ *
347
+ * - Binary form (3 elements): `[path, operator, value]` where `operator` is one of
348
+ * `is equal`, `is not equal`, `contains`, `does not contain`, `starts with`,
349
+ * `ends with`, `greater than`, `greater than or equal`, `less than`,
350
+ * `less than or equal`.
351
+ *
352
+ * Example: `["user.tier", "is equal", "gold"]`.
353
+ *
354
+ * - Unary form (2 elements): `[path, operator]` where `operator` is one of
355
+ * `exists`, `does not exist`.
356
+ *
357
+ * Example: `["user.email", "exists"]`.
358
+ *
359
+ * The first element is a non-empty dot-path. The second element is the operator
360
+ * (must come from one of the two operator sets above). For the binary form, the
361
+ * third element is the comparison value (string). Runtime validation of the
362
+ * operator value and arity is performed by the backend; SDKs surface this as a
363
+ * string list.
364
+ */
365
+ export type JourneyConditionAtom = Array<string>;
366
+
367
+ /**
368
+ * A leaf condition group. Exactly one of `AND` or `OR` must be present at runtime;
369
+ * each is a list of `JourneyConditionAtom` tuples.
370
+ */
371
+ export interface JourneyConditionGroup {
372
+ AND?: Array<JourneyConditionAtom>;
373
+
374
+ OR?: Array<JourneyConditionAtom>;
375
+ }
376
+
377
+ /**
378
+ * A nested condition group. Exactly one of `AND` or `OR` must be present at
379
+ * runtime; each is a list of `JourneyConditionGroup` items.
380
+ */
381
+ export interface JourneyConditionNestedGroup {
382
+ AND?: Array<JourneyConditionGroup>;
383
+
384
+ OR?: Array<JourneyConditionGroup>;
385
+ }
386
+
387
+ /**
388
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
389
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
390
+ * express "no conditions".
391
+ */
392
+ export type JourneyConditionsField =
393
+ | JourneyConditionAtom
394
+ | JourneyConditionGroup
395
+ | JourneyConditionNestedGroup;
396
+
397
+ /**
398
+ * Pause the journey run for a fixed `duration`.
399
+ */
400
+ export interface JourneyDelayDurationNode {
401
+ duration: string;
402
+
403
+ mode: 'duration';
404
+
405
+ type: 'delay';
406
+
407
+ id?: string;
408
+
409
+ /**
410
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
411
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
412
+ * express "no conditions".
413
+ */
414
+ conditions?: JourneyConditionsField;
415
+ }
416
+
417
+ /**
418
+ * Pause the journey run `until` a specific time.
419
+ */
420
+ export interface JourneyDelayUntilNode {
421
+ mode: 'until';
422
+
423
+ type: 'delay';
424
+
425
+ until: string;
426
+
427
+ id?: string;
428
+
429
+ /**
430
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
431
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
432
+ * express "no conditions".
433
+ */
434
+ conditions?: JourneyConditionsField;
435
+ }
436
+
437
+ /**
438
+ * Terminate the journey run.
439
+ */
440
+ export interface JourneyExitNode {
441
+ type: 'exit';
442
+
443
+ id?: string;
444
+ }
445
+
446
+ /**
447
+ * A/B experiment config for a send node. The recipient is deterministically
448
+ * bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
449
+ * its `weight`. Present on a send node INSTEAD OF `message.template`.
450
+ */
451
+ export interface JourneyExperiment {
452
+ /**
453
+ * The value used to deterministically assign a recipient to a variant. Must be
454
+ * non-empty with no leading or trailing whitespace.
455
+ */
456
+ bucketingKey: string;
457
+
458
+ /**
459
+ * Between 2 and 10 weighted template variants.
460
+ */
461
+ variants: Array<JourneyExperimentVariant>;
462
+
463
+ /**
464
+ * Unique experiment id (prefixed `exp_`). Omit to have one generated
465
+ * automatically; when supplied it must be a valid `exp_` id.
466
+ */
467
+ id?: string;
468
+
469
+ /**
470
+ * Optional display name for the experiment.
471
+ */
472
+ name?: string;
473
+ }
474
+
475
+ /**
476
+ * A single weighted variant of an experiment. Variant ids must be unique within
477
+ * the experiment and the sum of all variant weights must be greater than 0.
478
+ * Weights are relative (no sum-to-100 requirement) — routing normalizes them
479
+ * proportionally.
480
+ */
481
+ export interface JourneyExperimentVariant {
482
+ id: string;
483
+
484
+ /**
485
+ * The notification template sent for this variant.
486
+ */
487
+ templateId: string;
488
+
489
+ /**
490
+ * Relative routing weight. Must be non-negative.
491
+ */
492
+ weight: number;
493
+
494
+ /**
495
+ * Optional display name for the variant.
496
+ */
497
+ name?: string;
498
+ }
499
+
500
+ /**
501
+ * Issue an HTTP GET or DELETE request and merge the response into the journey
502
+ * state per `merge_strategy`.
503
+ */
504
+ export interface JourneyFetchGetDeleteNode {
505
+ /**
506
+ * Strategy for merging a fetch response into the journey run state.
507
+ */
508
+ merge_strategy: JourneyMergeStrategy;
509
+
510
+ method: 'get' | 'delete';
511
+
512
+ type: 'fetch';
513
+
514
+ url: string;
515
+
516
+ id?: string;
517
+
518
+ /**
519
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
520
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
521
+ * express "no conditions".
522
+ */
523
+ conditions?: JourneyConditionsField;
524
+
525
+ headers?: { [key: string]: string };
526
+
527
+ query_params?: { [key: string]: string };
528
+
529
+ /**
530
+ * A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
531
+ */
532
+ response_schema?: { [key: string]: unknown };
533
+ }
534
+
535
+ /**
536
+ * Issue an HTTP POST or PUT request with a `body` and merge the response into the
537
+ * journey state per `merge_strategy`.
538
+ */
539
+ export interface JourneyFetchPostPutNode {
540
+ /**
541
+ * Strategy for merging a fetch response into the journey run state.
542
+ */
543
+ merge_strategy: JourneyMergeStrategy;
544
+
545
+ method: 'post' | 'put';
546
+
547
+ type: 'fetch';
548
+
549
+ url: string;
550
+
551
+ id?: string;
552
+
553
+ body?: string;
554
+
555
+ /**
556
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
557
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
558
+ * express "no conditions".
559
+ */
560
+ conditions?: JourneyConditionsField;
561
+
562
+ headers?: { [key: string]: string };
563
+
564
+ query_params?: { [key: string]: string };
565
+
566
+ /**
567
+ * A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
568
+ */
569
+ response_schema?: { [key: string]: unknown };
570
+ }
571
+
572
+ /**
573
+ * Strategy for merging a fetch response into the journey run state.
574
+ */
575
+ export type JourneyMergeStrategy = 'overwrite' | 'soft-merge' | 'replace' | 'none';
576
+
577
+ /**
578
+ * A single node in a journey DAG. Discriminated by `type`, with a secondary
579
+ * discriminator on some variants (`trigger_type` for trigger, `mode` for delay,
580
+ * `method` for fetch, `scope` for throttle).
581
+ */
582
+ export type JourneyNode =
583
+ | JourneyAPIInvokeTriggerNode
584
+ | JourneySegmentTriggerNode
585
+ | JourneySendNode
586
+ | JourneyDelayDurationNode
587
+ | JourneyDelayUntilNode
588
+ | JourneyFetchGetDeleteNode
589
+ | JourneyFetchPostPutNode
590
+ | JourneyAINode
591
+ | JourneyThrottleStaticNode
592
+ | JourneyThrottleDynamicNode
593
+ | JourneyNode.JourneyBatchNode
594
+ | JourneyNode.JourneyAddToDigestNode
595
+ | JourneyExitNode
596
+ | JourneyNode.JourneyBranchNode;
597
+
598
+ export namespace JourneyNode {
599
+ /**
600
+ * Collect events arriving at the node into a single batch and fire one downstream
601
+ * step with the aggregated payload. The first event into a batch owns the run;
602
+ * later contributing events terminate at the batch step. The batch releases when
603
+ * any of `max_items` is reached, a quiet window of `wait_period` elapses, or the
604
+ * `max_wait_period` ceiling hits.
605
+ */
606
+ export interface JourneyBatchNode {
607
+ /**
608
+ * ISO 8601 duration. Hard ceiling from the first event into the batch; releases
609
+ * the batch unconditionally when it elapses.
610
+ */
611
+ max_wait_period: string;
612
+
613
+ /**
614
+ * How to select which collected events to retain in the aggregated payload when
615
+ * the batch releases.
616
+ */
617
+ retain: JourneyBatchNode.Retain;
618
+
619
+ scope: 'user';
620
+
621
+ type: 'batch';
622
+
623
+ /**
624
+ * ISO 8601 duration. Quiet window that releases the batch when it elapses with no
625
+ * new contributing events. Must be less than `max_wait_period`.
626
+ */
627
+ wait_period: string;
628
+
629
+ id?: string;
630
+
631
+ /**
632
+ * Optional partition key. Events with the same `category_key` are batched
633
+ * together; events with different values are batched separately.
634
+ */
635
+ category_key?: string;
636
+
637
+ /**
638
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
639
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
640
+ * express "no conditions".
641
+ */
642
+ conditions?: JourneysAPI.JourneyConditionsField;
643
+
644
+ /**
645
+ * Releases the batch once this many events have been collected.
646
+ */
647
+ max_items?: number;
648
+ }
649
+
650
+ export namespace JourneyBatchNode {
651
+ /**
652
+ * How to select which collected events to retain in the aggregated payload when
653
+ * the batch releases.
654
+ */
655
+ export interface Retain {
656
+ count: number;
657
+
658
+ type: 'first' | 'last' | 'highest' | 'lowest';
659
+
660
+ /**
661
+ * Dot-path into the event payload (e.g. `data.priority`). Required when `type` is
662
+ * `highest` or `lowest`.
663
+ */
664
+ sort_key?: string;
665
+ }
666
+ }
667
+
668
+ /**
669
+ * Add the current event to a digest keyed by the given subscription topic. The
670
+ * digest accumulates events and releases them on the schedule configured for the
671
+ * topic.
672
+ */
673
+ export interface JourneyAddToDigestNode {
674
+ /**
675
+ * The subscription topic that owns the digest the event is added to.
676
+ */
677
+ subscription_topic_id: string;
678
+
679
+ type: 'add-to-digest';
680
+
681
+ id?: string;
682
+
683
+ /**
684
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
685
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
686
+ * express "no conditions".
687
+ */
688
+ conditions?: JourneysAPI.JourneyConditionsField;
689
+ }
690
+
691
+ /**
692
+ * Branch node. Routes to the first entry in `paths[]` whose `conditions` match,
693
+ * else falls through to `default.nodes`.
694
+ */
695
+ export interface JourneyBranchNode {
696
+ default: JourneyBranchNode.Default;
697
+
698
+ paths: Array<JourneyBranchNode.Path>;
699
+
700
+ type: 'branch';
701
+
702
+ id?: string;
703
+ }
704
+
705
+ export namespace JourneyBranchNode {
706
+ export interface Default {
707
+ nodes: Array<JourneysAPI.JourneyNode>;
708
+
709
+ label?: string;
710
+ }
711
+
712
+ export interface Path {
713
+ /**
714
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
715
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
716
+ * express "no conditions".
717
+ */
718
+ conditions: JourneysAPI.JourneyConditionsField;
719
+
720
+ nodes: Array<JourneysAPI.JourneyNode>;
721
+
722
+ label?: string;
723
+ }
724
+ }
725
+ }
726
+
727
+ /**
728
+ * Request body for publishing a journey. Pass `version` to roll back to a prior
729
+ * version; omit to publish the current draft.
730
+ */
731
+ export interface JourneyPublishRequest {
732
+ version?: string;
733
+ }
734
+
735
+ /**
736
+ * A journey, with its current draft or published nodes and metadata.
737
+ */
738
+ export interface JourneyResponse {
739
+ id: string;
740
+
741
+ created: number | null;
742
+
743
+ creator: string | null;
744
+
745
+ enabled: boolean;
746
+
747
+ name: string;
748
+
749
+ nodes: Array<JourneyNode>;
750
+
751
+ published: number | null;
752
+
753
+ /**
754
+ * Lifecycle state of a journey.
755
+ */
756
+ state: JourneyState;
757
+
758
+ updated: number | null;
759
+
760
+ updater: string | null;
761
+ }
762
+
763
+ /**
764
+ * Trigger fired by a segment event (`identify`, `group`, or `track`).
765
+ */
766
+ export interface JourneySegmentTriggerNode {
767
+ request_type: 'identify' | 'group' | 'track';
768
+
769
+ trigger_type: 'segment';
770
+
771
+ type: 'trigger';
772
+
773
+ id?: string;
774
+
775
+ /**
776
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
777
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
778
+ * express "no conditions".
779
+ */
780
+ conditions?: JourneyConditionsField;
781
+
782
+ event_id?: string;
783
+ }
784
+
785
+ /**
786
+ * Send to the recipient. A send node sources its content from EXACTLY ONE of
787
+ * `message.template` (a single notification template) or `experiment` (an A/B
788
+ * split across weighted template variants) — supplying both, or neither, is
789
+ * rejected. Optionally override the recipient address, delay the send, or attach
790
+ * `data`.
791
+ */
792
+ export interface JourneySendNode {
793
+ message: JourneySendNode.Message;
794
+
795
+ type: 'send';
796
+
797
+ id?: string;
798
+
799
+ /**
800
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
801
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
802
+ * express "no conditions".
803
+ */
804
+ conditions?: JourneyConditionsField;
805
+
806
+ /**
807
+ * A/B experiment config for a send node. The recipient is deterministically
808
+ * bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
809
+ * its `weight`. Present on a send node INSTEAD OF `message.template`.
810
+ */
811
+ experiment?: JourneyExperiment;
812
+ }
813
+
814
+ export namespace JourneySendNode {
815
+ export interface Message {
816
+ data?: { [key: string]: unknown };
817
+
818
+ delay?: Message.Delay;
819
+
820
+ template?: string;
821
+
822
+ to?: Message.To;
823
+ }
824
+
825
+ export namespace Message {
826
+ export interface Delay {
827
+ until: string;
828
+
829
+ timezone?: string;
830
+ }
831
+
832
+ export interface To {
833
+ email_override?: string;
834
+
835
+ phone_number_override?: string;
836
+
837
+ user_id_override?: string;
838
+ }
839
+ }
840
+ }
841
+
842
+ /**
843
+ * Lifecycle state of a journey.
844
+ */
845
+ export type JourneyState = 'DRAFT' | 'PUBLISHED';
846
+
847
+ /**
848
+ * Request body for creating a notification template scoped to a journey.
849
+ */
850
+ export interface JourneyTemplateCreateRequest {
851
+ channel: string;
852
+
853
+ notification: JourneyTemplateCreateRequest.Notification;
854
+
855
+ providerKey?: string;
856
+
857
+ state?: string;
858
+ }
859
+
860
+ export namespace JourneyTemplateCreateRequest {
861
+ export interface Notification {
862
+ brand: Notification.Brand | null;
863
+
864
+ content: Notification.Content;
865
+
866
+ name: string;
867
+
868
+ subscription: Notification.Subscription | null;
869
+
870
+ tags: Array<string>;
871
+ }
872
+
873
+ export namespace Notification {
874
+ export interface Brand {
875
+ id: string;
876
+ }
877
+
878
+ export interface Content {
879
+ elements: Array<Shared.ElementalNode>;
880
+
881
+ version: '2022-01-01';
882
+
883
+ scope?: 'default' | 'strict';
884
+ }
885
+
886
+ export interface Subscription {
887
+ topic_id: string;
888
+ }
889
+ }
890
+ }
891
+
892
+ /**
893
+ * A journey-scoped notification template.
894
+ */
895
+ export interface JourneyTemplateGetResponse {
896
+ id: string;
897
+
898
+ brand: JourneyTemplateGetResponse.Brand | null;
899
+
900
+ content: JourneyTemplateGetResponse.Content;
901
+
902
+ created: number;
903
+
904
+ creator: string;
905
+
906
+ name: string;
907
+
908
+ state: 'DRAFT' | 'PUBLISHED';
909
+
910
+ subscription: JourneyTemplateGetResponse.Subscription | null;
911
+
912
+ tags: Array<string>;
913
+
914
+ updated?: number;
915
+
916
+ updater?: string;
917
+ }
918
+
919
+ export namespace JourneyTemplateGetResponse {
920
+ export interface Brand {
921
+ id: string;
922
+ }
923
+
924
+ export interface Content {
925
+ elements: Array<Shared.ElementalNode>;
926
+
927
+ version: '2022-01-01';
928
+
929
+ scope?: 'default' | 'strict';
930
+ }
931
+
932
+ export interface Subscription {
933
+ topic_id: string;
934
+ }
935
+ }
936
+
937
+ /**
938
+ * Paged list of journey-scoped notification templates.
939
+ */
940
+ export interface JourneyTemplateListResponse {
941
+ paging: Shared.Paging;
942
+
943
+ results: Array<JourneyTemplateSummary>;
944
+ }
945
+
946
+ /**
947
+ * Request body for publishing a journey-scoped notification template. Pass
948
+ * `version` to roll back to a prior version; omit to publish the current draft.
949
+ */
950
+ export interface JourneyTemplatePublishRequest {
951
+ version?: string;
952
+ }
953
+
954
+ /**
955
+ * Request body for replacing a journey-scoped notification template draft.
956
+ */
957
+ export interface JourneyTemplateReplaceRequest {
958
+ notification: JourneyTemplateReplaceRequest.Notification;
959
+
960
+ state?: string;
961
+ }
962
+
963
+ export namespace JourneyTemplateReplaceRequest {
964
+ export interface Notification {
965
+ brand: Notification.Brand | null;
966
+
967
+ content: Notification.Content;
968
+
969
+ name: string;
970
+
971
+ subscription: Notification.Subscription | null;
972
+
973
+ tags: Array<string>;
974
+ }
975
+
976
+ export namespace Notification {
977
+ export interface Brand {
978
+ id: string;
979
+ }
980
+
981
+ export interface Content {
982
+ elements: Array<Shared.ElementalNode>;
983
+
984
+ version: '2022-01-01';
985
+
986
+ scope?: 'default' | 'strict';
987
+ }
988
+
989
+ export interface Subscription {
990
+ topic_id: string;
991
+ }
992
+ }
993
+ }
994
+
995
+ /**
996
+ * Summary fields of a journey-scoped notification template returned in list
997
+ * responses.
998
+ */
999
+ export interface JourneyTemplateSummary {
1000
+ id: string;
1001
+
1002
+ created: number;
1003
+
1004
+ creator: string;
1005
+
1006
+ name: string;
1007
+
1008
+ state: string;
1009
+
1010
+ tags: Array<string>;
1011
+
1012
+ updated?: number;
1013
+
1014
+ updater?: string;
1015
+ }
1016
+
1017
+ /**
1018
+ * Throttle the journey by a dynamic `throttle_key`, allowing at most `max_allowed`
1019
+ * invocations per `period`.
1020
+ */
1021
+ export interface JourneyThrottleDynamicNode {
1022
+ max_allowed: number;
1023
+
1024
+ period: string;
1025
+
1026
+ scope: 'dynamic';
1027
+
1028
+ throttle_key: string;
1029
+
1030
+ type: 'throttle';
1031
+
1032
+ id?: string;
1033
+
1034
+ /**
1035
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
1036
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
1037
+ * express "no conditions".
1038
+ */
1039
+ conditions?: JourneyConditionsField;
1040
+ }
1041
+
1042
+ /**
1043
+ * Throttle the journey by a static `scope` (`user` or `global`), allowing at most
1044
+ * `max_allowed` invocations per `period`.
1045
+ */
1046
+ export interface JourneyThrottleStaticNode {
1047
+ max_allowed: number;
1048
+
1049
+ period: string;
1050
+
1051
+ scope: 'user' | 'global';
1052
+
1053
+ type: 'throttle';
1054
+
1055
+ id?: string;
1056
+
1057
+ /**
1058
+ * Condition spec for a journey node. Accepts a single condition atom, an AND/OR
1059
+ * group, or an AND/OR nested group. Omit the `conditions` property entirely to
1060
+ * express "no conditions".
1061
+ */
1062
+ conditions?: JourneyConditionsField;
1063
+ }
1064
+
1065
+ /**
1066
+ * A published version of a journey.
1067
+ */
1068
+ export interface JourneyVersionItem {
1069
+ created: number | null;
1070
+
1071
+ creator: string | null;
1072
+
1073
+ name: string;
1074
+
1075
+ published: number | null;
1076
+
1077
+ version: string;
1078
+ }
1079
+
1080
+ /**
1081
+ * Paged list of published journey versions, most recent first.
1082
+ */
1083
+ export interface JourneyVersionsListResponse {
1084
+ paging: Shared.Paging;
1085
+
1086
+ results: Array<JourneyVersionItem>;
1087
+ }
1088
+
1089
+ /**
1090
+ * Request body for invoking a journey. Requires either a user identifier or a
1091
+ * profile with contact information. User identifiers can be provided via user_id
1092
+ * field, or resolved from profile/data objects (user_id, userId, or anonymousId
1093
+ * fields).
1094
+ */
1095
+ export interface JourneysInvokeRequest {
1096
+ /**
1097
+ * Data payload passed to the journey. The expected shape can be predefined using
1098
+ * the schema builder in the journey editor. This data is available in journey
1099
+ * steps for condition evaluation and template variable interpolation. Can also
1100
+ * contain user identifiers (user_id, userId, anonymousId) if not provided
1101
+ * elsewhere.
1102
+ */
1103
+ data?: { [key: string]: unknown };
1104
+
1105
+ /**
1106
+ * Profile data for the user. Can contain contact information (email,
1107
+ * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
1108
+ * profile fields. Profile fields are merged with any existing stored profile for
1109
+ * the user. Include context.tenant_id to load a tenant-scoped profile for
1110
+ * multi-tenant scenarios.
1111
+ */
1112
+ profile?: { [key: string]: unknown };
1113
+
1114
+ /**
1115
+ * A unique identifier for the user. If not provided, the system will attempt to
1116
+ * resolve the user identifier from profile or data objects.
1117
+ */
1118
+ user_id?: string;
1119
+ }
1120
+
1121
+ export interface JourneysInvokeResponse {
1122
+ /**
1123
+ * A unique identifier for the journey run that was created.
1124
+ */
1125
+ runId: string;
1126
+ }
1127
+
1128
+ export interface JourneysListResponse {
1129
+ /**
1130
+ * A cursor token for pagination. Present when there are more results available.
1131
+ */
1132
+ cursor?: string;
1133
+
1134
+ templates?: Array<Journey>;
1135
+ }
1136
+
1137
+ export interface JourneyCreateParams {
1138
+ name: string;
1139
+
1140
+ nodes: Array<JourneyNode>;
1141
+
1142
+ enabled?: boolean;
1143
+
1144
+ /**
1145
+ * Lifecycle state of a journey.
1146
+ */
1147
+ state?: JourneyState;
1148
+ }
1149
+
1150
+ export interface JourneyRetrieveParams {
1151
+ /**
1152
+ * Version selector: `draft`, `published` (default), or `vN`.
1153
+ */
1154
+ version?: string;
1155
+ }
1156
+
1157
+ export interface JourneyListParams {
1158
+ /**
1159
+ * A cursor token for pagination. Use the cursor from the previous response to
1160
+ * fetch the next page of results.
1161
+ */
1162
+ cursor?: string;
1163
+
1164
+ /**
1165
+ * The version of journeys to retrieve. Accepted values are published (for
1166
+ * published journeys) or draft (for draft journeys). Defaults to published.
1167
+ */
1168
+ version?: 'published' | 'draft';
1169
+ }
1170
+
1171
+ export type JourneyCancelParams = JourneyCancelParams.ByCancelationToken | JourneyCancelParams.ByRunID;
1172
+
1173
+ export declare namespace JourneyCancelParams {
1174
+ export interface ByCancelationToken {
1175
+ cancelation_token: string;
1176
+ }
1177
+
1178
+ export interface ByRunID {
1179
+ run_id: string;
1180
+ }
1181
+ }
1182
+
1183
+ export interface JourneyInvokeParams {
1184
+ /**
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.
1190
+ */
1191
+ data?: { [key: string]: unknown };
1192
+
1193
+ /**
1194
+ * Profile data for the user. Can contain contact information (email,
1195
+ * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
1196
+ * profile fields. Profile fields are merged with any existing stored profile for
1197
+ * the user. Include context.tenant_id to load a tenant-scoped profile for
1198
+ * multi-tenant scenarios.
1199
+ */
1200
+ profile?: { [key: string]: unknown };
1201
+
1202
+ /**
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.
1205
+ */
1206
+ user_id?: string;
1207
+ }
1208
+
1209
+ export interface JourneyPublishParams {
1210
+ version?: string;
1211
+ }
1212
+
1213
+ export interface JourneyReplaceParams {
1214
+ name: string;
1215
+
1216
+ nodes: Array<JourneyNode>;
1217
+
1218
+ enabled?: boolean;
1219
+
1220
+ /**
1221
+ * Lifecycle state of a journey.
1222
+ */
1223
+ state?: JourneyState;
1224
+ }
1225
+
1226
+ Journeys.Templates = Templates;
1227
+
1228
+ export declare namespace Journeys {
1229
+ export {
1230
+ type CancelJourneyRequest as CancelJourneyRequest,
1231
+ type CancelJourneyResponse as CancelJourneyResponse,
1232
+ type CreateJourneyRequest as CreateJourneyRequest,
1233
+ type Journey as Journey,
1234
+ type JourneyAINode as JourneyAINode,
1235
+ type JourneyAPIInvokeTriggerNode as JourneyAPIInvokeTriggerNode,
1236
+ type JourneyConditionAtom as JourneyConditionAtom,
1237
+ type JourneyConditionGroup as JourneyConditionGroup,
1238
+ type JourneyConditionNestedGroup as JourneyConditionNestedGroup,
1239
+ type JourneyConditionsField as JourneyConditionsField,
1240
+ type JourneyDelayDurationNode as JourneyDelayDurationNode,
1241
+ type JourneyDelayUntilNode as JourneyDelayUntilNode,
1242
+ type JourneyExitNode as JourneyExitNode,
1243
+ type JourneyExperiment as JourneyExperiment,
1244
+ type JourneyExperimentVariant as JourneyExperimentVariant,
1245
+ type JourneyFetchGetDeleteNode as JourneyFetchGetDeleteNode,
1246
+ type JourneyFetchPostPutNode as JourneyFetchPostPutNode,
1247
+ type JourneyMergeStrategy as JourneyMergeStrategy,
1248
+ type JourneyNode as JourneyNode,
1249
+ type JourneyPublishRequest as JourneyPublishRequest,
1250
+ type JourneyResponse as JourneyResponse,
1251
+ type JourneySegmentTriggerNode as JourneySegmentTriggerNode,
1252
+ type JourneySendNode as JourneySendNode,
1253
+ type JourneyState as JourneyState,
1254
+ type JourneyTemplateCreateRequest as JourneyTemplateCreateRequest,
1255
+ type JourneyTemplateGetResponse as JourneyTemplateGetResponse,
1256
+ type JourneyTemplateListResponse as JourneyTemplateListResponse,
1257
+ type JourneyTemplatePublishRequest as JourneyTemplatePublishRequest,
1258
+ type JourneyTemplateReplaceRequest as JourneyTemplateReplaceRequest,
1259
+ type JourneyTemplateSummary as JourneyTemplateSummary,
1260
+ type JourneyThrottleDynamicNode as JourneyThrottleDynamicNode,
1261
+ type JourneyThrottleStaticNode as JourneyThrottleStaticNode,
1262
+ type JourneyVersionItem as JourneyVersionItem,
1263
+ type JourneyVersionsListResponse as JourneyVersionsListResponse,
1264
+ type JourneysInvokeRequest as JourneysInvokeRequest,
1265
+ type JourneysInvokeResponse as JourneysInvokeResponse,
1266
+ type JourneysListResponse as JourneysListResponse,
1267
+ type JourneyCreateParams as JourneyCreateParams,
1268
+ type JourneyRetrieveParams as JourneyRetrieveParams,
1269
+ type JourneyListParams as JourneyListParams,
1270
+ type JourneyCancelParams as JourneyCancelParams,
1271
+ type JourneyInvokeParams as JourneyInvokeParams,
1272
+ type JourneyPublishParams as JourneyPublishParams,
1273
+ type JourneyReplaceParams as JourneyReplaceParams,
1274
+ };
1275
+
1276
+ export {
1277
+ Templates as Templates,
1278
+ type TemplateCreateParams as TemplateCreateParams,
1279
+ type TemplateRetrieveParams as TemplateRetrieveParams,
1280
+ type TemplateListParams as TemplateListParams,
1281
+ type TemplateArchiveParams as TemplateArchiveParams,
1282
+ type TemplateListVersionsParams as TemplateListVersionsParams,
1283
+ type TemplatePublishParams as TemplatePublishParams,
1284
+ type TemplatePutContentParams as TemplatePutContentParams,
1285
+ type TemplatePutLocaleParams as TemplatePutLocaleParams,
1286
+ type TemplateReplaceParams as TemplateReplaceParams,
1287
+ type TemplateRetrieveContentParams as TemplateRetrieveContentParams,
1288
+ };
1289
+ }