@trycourier/courier 7.10.2 → 7.11.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 (313) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +2 -2
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +2 -2
  11. package/client.d.ts.map +1 -1
  12. package/client.js +12 -1
  13. package/client.js.map +1 -1
  14. package/client.mjs +12 -1
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/uploads.d.mts.map +1 -1
  23. package/core/uploads.d.ts.map +1 -1
  24. package/core/uploads.mjs.map +1 -1
  25. package/error.d.mts +1 -0
  26. package/error.d.mts.map +1 -1
  27. package/error.d.ts +1 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.mjs +1 -0
  30. package/error.mjs.map +1 -1
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.mjs.map +1 -1
  34. package/internal/detect-platform.mjs.map +1 -1
  35. package/internal/headers.mjs.map +1 -1
  36. package/internal/parse.d.mts.map +1 -1
  37. package/internal/parse.d.ts.map +1 -1
  38. package/internal/parse.mjs.map +1 -1
  39. package/internal/qs/formats.d.mts.map +1 -1
  40. package/internal/qs/formats.d.ts.map +1 -1
  41. package/internal/qs/index.d.mts +2 -2
  42. package/internal/qs/index.d.mts.map +1 -1
  43. package/internal/qs/index.d.ts +2 -2
  44. package/internal/qs/index.d.ts.map +1 -1
  45. package/internal/qs/index.mjs.map +1 -1
  46. package/internal/qs/stringify.d.mts.map +1 -1
  47. package/internal/qs/stringify.d.ts.map +1 -1
  48. package/internal/qs/stringify.mjs.map +1 -1
  49. package/internal/qs/utils.d.mts.map +1 -1
  50. package/internal/qs/utils.d.ts.map +1 -1
  51. package/internal/qs/utils.mjs.map +1 -1
  52. package/internal/request-options.d.mts.map +1 -1
  53. package/internal/request-options.d.ts.map +1 -1
  54. package/internal/shims.d.mts +6 -0
  55. package/internal/shims.d.mts.map +1 -1
  56. package/internal/shims.d.ts +6 -0
  57. package/internal/shims.d.ts.map +1 -1
  58. package/internal/to-file.d.mts.map +1 -1
  59. package/internal/to-file.d.ts.map +1 -1
  60. package/internal/to-file.mjs.map +1 -1
  61. package/internal/types.d.mts +10 -10
  62. package/internal/types.d.mts.map +1 -1
  63. package/internal/types.d.ts +10 -10
  64. package/internal/types.d.ts.map +1 -1
  65. package/internal/uploads.d.mts.map +1 -1
  66. package/internal/uploads.d.ts.map +1 -1
  67. package/internal/uploads.mjs.map +1 -1
  68. package/internal/utils/base64.mjs.map +1 -1
  69. package/internal/utils/log.d.mts.map +1 -1
  70. package/internal/utils/log.d.ts.map +1 -1
  71. package/internal/utils/log.js +2 -0
  72. package/internal/utils/log.js.map +1 -1
  73. package/internal/utils/log.mjs +2 -0
  74. package/internal/utils/log.mjs.map +1 -1
  75. package/internal/utils/path.mjs.map +1 -1
  76. package/internal/utils/query.mjs.map +1 -1
  77. package/internal/utils/values.mjs.map +1 -1
  78. package/internal/utils.d.mts.map +1 -1
  79. package/internal/utils.d.ts.map +1 -1
  80. package/internal/utils.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/resource.d.mts +1 -0
  83. package/resource.d.mts.map +1 -1
  84. package/resource.d.ts +1 -0
  85. package/resource.d.ts.map +1 -1
  86. package/resource.mjs +1 -0
  87. package/resource.mjs.map +1 -1
  88. package/resources/audiences.d.mts.map +1 -1
  89. package/resources/audiences.d.ts.map +1 -1
  90. package/resources/audiences.mjs.map +1 -1
  91. package/resources/audit-events.d.mts.map +1 -1
  92. package/resources/audit-events.d.ts.map +1 -1
  93. package/resources/audit-events.mjs.map +1 -1
  94. package/resources/auth.d.mts.map +1 -1
  95. package/resources/auth.d.ts.map +1 -1
  96. package/resources/auth.mjs.map +1 -1
  97. package/resources/automations/automations.d.mts.map +1 -1
  98. package/resources/automations/automations.d.ts.map +1 -1
  99. package/resources/automations/automations.mjs.map +1 -1
  100. package/resources/automations/index.d.mts.map +1 -1
  101. package/resources/automations/index.d.ts.map +1 -1
  102. package/resources/automations/index.mjs.map +1 -1
  103. package/resources/automations/invoke.d.mts.map +1 -1
  104. package/resources/automations/invoke.d.ts.map +1 -1
  105. package/resources/automations/invoke.mjs.map +1 -1
  106. package/resources/automations.d.mts.map +1 -1
  107. package/resources/automations.d.ts.map +1 -1
  108. package/resources/automations.mjs.map +1 -1
  109. package/resources/brands.d.mts.map +1 -1
  110. package/resources/brands.d.ts.map +1 -1
  111. package/resources/brands.mjs.map +1 -1
  112. package/resources/bulk.d.mts.map +1 -1
  113. package/resources/bulk.d.ts.map +1 -1
  114. package/resources/bulk.mjs.map +1 -1
  115. package/resources/inbound.d.mts.map +1 -1
  116. package/resources/inbound.d.ts.map +1 -1
  117. package/resources/inbound.mjs.map +1 -1
  118. package/resources/index.d.mts +1 -1
  119. package/resources/index.d.mts.map +1 -1
  120. package/resources/index.d.ts +1 -1
  121. package/resources/index.d.ts.map +1 -1
  122. package/resources/index.js +1 -1
  123. package/resources/index.js.map +1 -1
  124. package/resources/index.mjs +1 -1
  125. package/resources/index.mjs.map +1 -1
  126. package/resources/journeys/index.d.mts +3 -0
  127. package/resources/journeys/index.d.mts.map +1 -0
  128. package/resources/journeys/index.d.ts +3 -0
  129. package/resources/journeys/index.d.ts.map +1 -0
  130. package/resources/journeys/index.js +9 -0
  131. package/resources/journeys/index.js.map +1 -0
  132. package/resources/journeys/index.mjs +4 -0
  133. package/resources/journeys/index.mjs.map +1 -0
  134. package/resources/journeys/journeys.d.mts +752 -0
  135. package/resources/journeys/journeys.d.mts.map +1 -0
  136. package/resources/journeys/journeys.d.ts +752 -0
  137. package/resources/journeys/journeys.d.ts.map +1 -0
  138. package/resources/journeys/journeys.js +148 -0
  139. package/resources/journeys/journeys.js.map +1 -0
  140. package/resources/journeys/journeys.mjs +143 -0
  141. package/resources/journeys/journeys.mjs.map +1 -0
  142. package/resources/journeys/templates.d.mts +219 -0
  143. package/resources/journeys/templates.d.mts.map +1 -0
  144. package/resources/journeys/templates.d.ts +219 -0
  145. package/resources/journeys/templates.d.ts.map +1 -0
  146. package/resources/journeys/templates.js +142 -0
  147. package/resources/journeys/templates.js.map +1 -0
  148. package/resources/journeys/templates.mjs +138 -0
  149. package/resources/journeys/templates.mjs.map +1 -0
  150. package/resources/journeys.d.mts +1 -142
  151. package/resources/journeys.d.mts.map +1 -1
  152. package/resources/journeys.d.ts +1 -142
  153. package/resources/journeys.d.ts.map +1 -1
  154. package/resources/journeys.js +2 -34
  155. package/resources/journeys.js.map +1 -1
  156. package/resources/journeys.mjs +1 -32
  157. package/resources/journeys.mjs.map +1 -1
  158. package/resources/lists/index.d.mts.map +1 -1
  159. package/resources/lists/index.d.ts.map +1 -1
  160. package/resources/lists/index.mjs.map +1 -1
  161. package/resources/lists/lists.d.mts.map +1 -1
  162. package/resources/lists/lists.d.ts.map +1 -1
  163. package/resources/lists/lists.mjs.map +1 -1
  164. package/resources/lists/subscriptions.d.mts.map +1 -1
  165. package/resources/lists/subscriptions.d.ts.map +1 -1
  166. package/resources/lists/subscriptions.mjs.map +1 -1
  167. package/resources/lists.d.mts.map +1 -1
  168. package/resources/lists.d.ts.map +1 -1
  169. package/resources/lists.mjs.map +1 -1
  170. package/resources/messages.d.mts.map +1 -1
  171. package/resources/messages.d.ts.map +1 -1
  172. package/resources/messages.mjs.map +1 -1
  173. package/resources/notifications/checks.d.mts.map +1 -1
  174. package/resources/notifications/checks.d.ts.map +1 -1
  175. package/resources/notifications/checks.mjs.map +1 -1
  176. package/resources/notifications/index.d.mts.map +1 -1
  177. package/resources/notifications/index.d.ts.map +1 -1
  178. package/resources/notifications/index.mjs.map +1 -1
  179. package/resources/notifications/notifications.d.mts.map +1 -1
  180. package/resources/notifications/notifications.d.ts.map +1 -1
  181. package/resources/notifications/notifications.mjs.map +1 -1
  182. package/resources/notifications.d.mts.map +1 -1
  183. package/resources/notifications.d.ts.map +1 -1
  184. package/resources/notifications.mjs.map +1 -1
  185. package/resources/profiles/index.d.mts.map +1 -1
  186. package/resources/profiles/index.d.ts.map +1 -1
  187. package/resources/profiles/index.mjs.map +1 -1
  188. package/resources/profiles/lists.d.mts.map +1 -1
  189. package/resources/profiles/lists.d.ts.map +1 -1
  190. package/resources/profiles/lists.mjs.map +1 -1
  191. package/resources/profiles/profiles.d.mts.map +1 -1
  192. package/resources/profiles/profiles.d.ts.map +1 -1
  193. package/resources/profiles/profiles.mjs.map +1 -1
  194. package/resources/profiles.d.mts.map +1 -1
  195. package/resources/profiles.d.ts.map +1 -1
  196. package/resources/profiles.mjs.map +1 -1
  197. package/resources/providers/catalog.d.mts.map +1 -1
  198. package/resources/providers/catalog.d.ts.map +1 -1
  199. package/resources/providers/catalog.mjs.map +1 -1
  200. package/resources/providers/index.d.mts.map +1 -1
  201. package/resources/providers/index.d.ts.map +1 -1
  202. package/resources/providers/index.mjs.map +1 -1
  203. package/resources/providers/providers.d.mts.map +1 -1
  204. package/resources/providers/providers.d.ts.map +1 -1
  205. package/resources/providers/providers.mjs.map +1 -1
  206. package/resources/providers.d.mts.map +1 -1
  207. package/resources/providers.d.ts.map +1 -1
  208. package/resources/providers.mjs.map +1 -1
  209. package/resources/requests.d.mts.map +1 -1
  210. package/resources/requests.d.ts.map +1 -1
  211. package/resources/requests.mjs.map +1 -1
  212. package/resources/routing-strategies.d.mts.map +1 -1
  213. package/resources/routing-strategies.d.ts.map +1 -1
  214. package/resources/routing-strategies.mjs.map +1 -1
  215. package/resources/send.d.mts.map +1 -1
  216. package/resources/send.d.ts.map +1 -1
  217. package/resources/send.mjs.map +1 -1
  218. package/resources/shared.d.mts.map +1 -1
  219. package/resources/shared.d.ts.map +1 -1
  220. package/resources/tenants/index.d.mts +1 -1
  221. package/resources/tenants/index.d.mts.map +1 -1
  222. package/resources/tenants/index.d.ts +1 -1
  223. package/resources/tenants/index.d.ts.map +1 -1
  224. package/resources/tenants/index.js.map +1 -1
  225. package/resources/tenants/index.mjs.map +1 -1
  226. package/resources/tenants/preferences/index.d.mts.map +1 -1
  227. package/resources/tenants/preferences/index.d.ts.map +1 -1
  228. package/resources/tenants/preferences/index.mjs.map +1 -1
  229. package/resources/tenants/preferences/items.d.mts.map +1 -1
  230. package/resources/tenants/preferences/items.d.ts.map +1 -1
  231. package/resources/tenants/preferences/items.mjs.map +1 -1
  232. package/resources/tenants/preferences/preferences.d.mts.map +1 -1
  233. package/resources/tenants/preferences/preferences.d.ts.map +1 -1
  234. package/resources/tenants/preferences/preferences.mjs.map +1 -1
  235. package/resources/tenants/preferences.d.mts.map +1 -1
  236. package/resources/tenants/preferences.d.ts.map +1 -1
  237. package/resources/tenants/preferences.mjs.map +1 -1
  238. package/resources/tenants/templates/index.d.mts +1 -1
  239. package/resources/tenants/templates/index.d.mts.map +1 -1
  240. package/resources/tenants/templates/index.d.ts +1 -1
  241. package/resources/tenants/templates/index.d.ts.map +1 -1
  242. package/resources/tenants/templates/index.js.map +1 -1
  243. package/resources/tenants/templates/index.mjs.map +1 -1
  244. package/resources/tenants/templates/templates.d.mts +23 -1
  245. package/resources/tenants/templates/templates.d.mts.map +1 -1
  246. package/resources/tenants/templates/templates.d.ts +23 -1
  247. package/resources/tenants/templates/templates.d.ts.map +1 -1
  248. package/resources/tenants/templates/templates.js +23 -0
  249. package/resources/tenants/templates/templates.js.map +1 -1
  250. package/resources/tenants/templates/templates.mjs +23 -0
  251. package/resources/tenants/templates/templates.mjs.map +1 -1
  252. package/resources/tenants/templates/versions.d.mts.map +1 -1
  253. package/resources/tenants/templates/versions.d.ts.map +1 -1
  254. package/resources/tenants/templates/versions.mjs.map +1 -1
  255. package/resources/tenants/templates.d.mts.map +1 -1
  256. package/resources/tenants/templates.d.ts.map +1 -1
  257. package/resources/tenants/templates.mjs.map +1 -1
  258. package/resources/tenants/tenants.d.mts +2 -2
  259. package/resources/tenants/tenants.d.mts.map +1 -1
  260. package/resources/tenants/tenants.d.ts +2 -2
  261. package/resources/tenants/tenants.d.ts.map +1 -1
  262. package/resources/tenants/tenants.js.map +1 -1
  263. package/resources/tenants/tenants.mjs.map +1 -1
  264. package/resources/tenants.d.mts.map +1 -1
  265. package/resources/tenants.d.ts.map +1 -1
  266. package/resources/tenants.mjs.map +1 -1
  267. package/resources/translations.d.mts.map +1 -1
  268. package/resources/translations.d.ts.map +1 -1
  269. package/resources/translations.mjs.map +1 -1
  270. package/resources/users/index.d.mts.map +1 -1
  271. package/resources/users/index.d.ts.map +1 -1
  272. package/resources/users/index.mjs.map +1 -1
  273. package/resources/users/preferences.d.mts.map +1 -1
  274. package/resources/users/preferences.d.ts.map +1 -1
  275. package/resources/users/preferences.mjs.map +1 -1
  276. package/resources/users/tenants.d.mts.map +1 -1
  277. package/resources/users/tenants.d.ts.map +1 -1
  278. package/resources/users/tenants.mjs.map +1 -1
  279. package/resources/users/tokens.d.mts.map +1 -1
  280. package/resources/users/tokens.d.ts.map +1 -1
  281. package/resources/users/tokens.mjs.map +1 -1
  282. package/resources/users/users.d.mts.map +1 -1
  283. package/resources/users/users.d.ts.map +1 -1
  284. package/resources/users/users.mjs.map +1 -1
  285. package/resources/users.d.mts.map +1 -1
  286. package/resources/users.d.ts.map +1 -1
  287. package/resources/users.mjs.map +1 -1
  288. package/resources.d.mts.map +1 -1
  289. package/resources.d.ts.map +1 -1
  290. package/resources.mjs.map +1 -1
  291. package/src/client.ts +87 -9
  292. package/src/internal/types.ts +6 -8
  293. package/src/internal/utils/log.ts +2 -0
  294. package/src/resources/index.ts +34 -1
  295. package/src/resources/journeys/index.ts +54 -0
  296. package/src/resources/journeys/journeys.ts +1047 -0
  297. package/src/resources/journeys/templates.ts +318 -0
  298. package/src/resources/journeys.ts +1 -172
  299. package/src/resources/tenants/index.ts +1 -0
  300. package/src/resources/tenants/templates/index.ts +1 -0
  301. package/src/resources/tenants/templates/templates.ts +32 -0
  302. package/src/resources/tenants/tenants.ts +2 -0
  303. package/src/version.ts +1 -1
  304. package/uploads.d.mts +1 -0
  305. package/uploads.d.mts.map +1 -1
  306. package/uploads.d.ts +1 -0
  307. package/uploads.d.ts.map +1 -1
  308. package/uploads.mjs +1 -0
  309. package/uploads.mjs.map +1 -1
  310. package/version.d.mts +1 -1
  311. package/version.d.ts +1 -1
  312. package/version.js +1 -1
  313. package/version.mjs +1 -1
@@ -0,0 +1,318 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as JourneysAPI from './journeys';
6
+ import * as NotificationsAPI from '../notifications/notifications';
7
+ import { APIPromise } from '../../core/api-promise';
8
+ import { buildHeaders } from '../../internal/headers';
9
+ import { RequestOptions } from '../../internal/request-options';
10
+ import { path } from '../../internal/utils/path';
11
+
12
+ export class Templates extends APIResource {
13
+ /**
14
+ * Create a notification template scoped to this journey. Defaults to `DRAFT`
15
+ * state; pass `state: "PUBLISHED"` to publish on create.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const journeyTemplateGetResponse =
20
+ * await client.journeys.templates.create('x', {
21
+ * channel: 'email',
22
+ * notification: {
23
+ * name: 'Welcome email',
24
+ * tags: [],
25
+ * brand: null,
26
+ * subscription: null,
27
+ * content: {
28
+ * version: '2022-01-01',
29
+ * elements: [{ type: 'text' }],
30
+ * },
31
+ * },
32
+ * });
33
+ * ```
34
+ */
35
+ create(
36
+ templateID: string,
37
+ body: TemplateCreateParams,
38
+ options?: RequestOptions,
39
+ ): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
40
+ return this._client.post(path`/journeys/${templateID}/templates`, { body, ...options });
41
+ }
42
+
43
+ /**
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.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const journeyTemplateGetResponse =
51
+ * await client.journeys.templates.retrieve('x', {
52
+ * templateId: 'x',
53
+ * });
54
+ * ```
55
+ */
56
+ retrieve(
57
+ notificationID: string,
58
+ params: TemplateRetrieveParams,
59
+ options?: RequestOptions,
60
+ ): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
61
+ const { templateId } = params;
62
+ return this._client.get(path`/journeys/${templateId}/templates/${notificationID}`, options);
63
+ }
64
+
65
+ /**
66
+ * List notification templates scoped to this journey. Journey-scoped notification
67
+ * templates can only be referenced from `send` nodes within the same journey.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const journeyTemplateListResponse =
72
+ * await client.journeys.templates.list('x');
73
+ * ```
74
+ */
75
+ list(
76
+ templateID: string,
77
+ query: TemplateListParams | null | undefined = {},
78
+ options?: RequestOptions,
79
+ ): APIPromise<JourneysAPI.JourneyTemplateListResponse> {
80
+ return this._client.get(path`/journeys/${templateID}/templates`, { query, ...options });
81
+ }
82
+
83
+ /**
84
+ * Archive the journey-scoped notification template. Archived templates cannot be
85
+ * sent.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * await client.journeys.templates.archive('x', {
90
+ * templateId: 'x',
91
+ * });
92
+ * ```
93
+ */
94
+ archive(notificationID: string, params: TemplateArchiveParams, options?: RequestOptions): APIPromise<void> {
95
+ const { templateId } = params;
96
+ return this._client.delete(path`/journeys/${templateId}/templates/${notificationID}`, {
97
+ ...options,
98
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
99
+ });
100
+ }
101
+
102
+ /**
103
+ * List published versions of the journey-scoped notification template, ordered
104
+ * most recent first.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const notificationTemplateVersionListResponse =
109
+ * await client.journeys.templates.listVersions('x', {
110
+ * templateId: 'x',
111
+ * });
112
+ * ```
113
+ */
114
+ listVersions(
115
+ notificationID: string,
116
+ params: TemplateListVersionsParams,
117
+ options?: RequestOptions,
118
+ ): APIPromise<NotificationsAPI.NotificationTemplateVersionListResponse> {
119
+ const { templateId } = params;
120
+ return this._client.get(path`/journeys/${templateId}/templates/${notificationID}/versions`, options);
121
+ }
122
+
123
+ /**
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" }`.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * await client.journeys.templates.publish('x', {
131
+ * templateId: 'x',
132
+ * });
133
+ * ```
134
+ */
135
+ publish(notificationID: string, params: TemplatePublishParams, options?: RequestOptions): APIPromise<void> {
136
+ const { templateId, ...body } = params;
137
+ return this._client.post(path`/journeys/${templateId}/templates/${notificationID}/publish`, {
138
+ body,
139
+ ...options,
140
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
141
+ });
142
+ }
143
+
144
+ /**
145
+ * Replace the journey-scoped notification template draft.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * const journeyTemplateGetResponse =
150
+ * await client.journeys.templates.replace('x', {
151
+ * templateId: 'x',
152
+ * notification: {
153
+ * brand: { id: 'id' },
154
+ * content: { elements: [{}], version: '2022-01-01' },
155
+ * name: 'name',
156
+ * subscription: { topic_id: 'topic_id' },
157
+ * tags: ['string'],
158
+ * },
159
+ * });
160
+ * ```
161
+ */
162
+ replace(
163
+ notificationID: string,
164
+ params: TemplateReplaceParams,
165
+ options?: RequestOptions,
166
+ ): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
167
+ const { templateId, ...body } = params;
168
+ return this._client.put(path`/journeys/${templateId}/templates/${notificationID}`, { body, ...options });
169
+ }
170
+ }
171
+
172
+ export interface TemplateCreateParams {
173
+ channel: string;
174
+
175
+ notification: TemplateCreateParams.Notification;
176
+
177
+ providerKey?: string;
178
+
179
+ state?: string;
180
+ }
181
+
182
+ export namespace TemplateCreateParams {
183
+ export interface Notification {
184
+ brand: Notification.Brand | null;
185
+
186
+ content: Notification.Content;
187
+
188
+ name: string;
189
+
190
+ subscription: Notification.Subscription | null;
191
+
192
+ tags: Array<string>;
193
+ }
194
+
195
+ export namespace Notification {
196
+ export interface Brand {
197
+ id: string;
198
+ }
199
+
200
+ export interface Content {
201
+ elements: Array<Shared.ElementalNode>;
202
+
203
+ version: '2022-01-01';
204
+
205
+ scope?: 'default' | 'strict';
206
+ }
207
+
208
+ export interface Subscription {
209
+ topic_id: string;
210
+ }
211
+ }
212
+ }
213
+
214
+ export interface TemplateRetrieveParams {
215
+ /**
216
+ * Journey id
217
+ */
218
+ templateId: string;
219
+ }
220
+
221
+ export interface TemplateListParams {
222
+ /**
223
+ * Pagination cursor from a prior response.
224
+ */
225
+ cursor?: string;
226
+
227
+ /**
228
+ * Page size. Minimum 1, maximum 100.
229
+ */
230
+ limit?: number;
231
+ }
232
+
233
+ export interface TemplateArchiveParams {
234
+ /**
235
+ * Journey id
236
+ */
237
+ templateId: string;
238
+ }
239
+
240
+ export interface TemplateListVersionsParams {
241
+ /**
242
+ * Journey id
243
+ */
244
+ templateId: string;
245
+ }
246
+
247
+ export interface TemplatePublishParams {
248
+ /**
249
+ * Path param: Journey id
250
+ */
251
+ templateId: string;
252
+
253
+ /**
254
+ * Body param
255
+ */
256
+ version?: string;
257
+ }
258
+
259
+ export interface TemplateReplaceParams {
260
+ /**
261
+ * Path param: Journey id
262
+ */
263
+ templateId: string;
264
+
265
+ /**
266
+ * Body param
267
+ */
268
+ notification: TemplateReplaceParams.Notification;
269
+
270
+ /**
271
+ * Body param
272
+ */
273
+ state?: string;
274
+ }
275
+
276
+ export namespace TemplateReplaceParams {
277
+ export interface Notification {
278
+ brand: Notification.Brand | null;
279
+
280
+ content: Notification.Content;
281
+
282
+ name: string;
283
+
284
+ subscription: Notification.Subscription | null;
285
+
286
+ tags: Array<string>;
287
+ }
288
+
289
+ export namespace Notification {
290
+ export interface Brand {
291
+ id: string;
292
+ }
293
+
294
+ export interface Content {
295
+ elements: Array<Shared.ElementalNode>;
296
+
297
+ version: '2022-01-01';
298
+
299
+ scope?: 'default' | 'strict';
300
+ }
301
+
302
+ export interface Subscription {
303
+ topic_id: string;
304
+ }
305
+ }
306
+ }
307
+
308
+ export declare namespace Templates {
309
+ export {
310
+ type TemplateCreateParams as TemplateCreateParams,
311
+ type TemplateRetrieveParams as TemplateRetrieveParams,
312
+ type TemplateListParams as TemplateListParams,
313
+ type TemplateArchiveParams as TemplateArchiveParams,
314
+ type TemplateListVersionsParams as TemplateListVersionsParams,
315
+ type TemplatePublishParams as TemplatePublishParams,
316
+ type TemplateReplaceParams as TemplateReplaceParams,
317
+ };
318
+ }
@@ -1,174 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../core/resource';
4
- import { APIPromise } from '../core/api-promise';
5
- import { RequestOptions } from '../internal/request-options';
6
- import { path } from '../internal/utils/path';
7
-
8
- export class Journeys extends APIResource {
9
- /**
10
- * Get the list of journeys.
11
- *
12
- * @example
13
- * ```ts
14
- * const journeysListResponse = await client.journeys.list();
15
- * ```
16
- */
17
- list(
18
- query: JourneyListParams | null | undefined = {},
19
- options?: RequestOptions,
20
- ): APIPromise<JourneysListResponse> {
21
- return this._client.get('/journeys', { query, ...options });
22
- }
23
-
24
- /**
25
- * Invoke a journey run from a journey template.
26
- *
27
- * @example
28
- * ```ts
29
- * const journeysInvokeResponse = await client.journeys.invoke(
30
- * 'templateId',
31
- * {
32
- * data: { order_id: 'order-456', amount: 99.99 },
33
- * user_id: 'user-123',
34
- * },
35
- * );
36
- * ```
37
- */
38
- invoke(
39
- templateID: string,
40
- body: JourneyInvokeParams,
41
- options?: RequestOptions,
42
- ): APIPromise<JourneysInvokeResponse> {
43
- return this._client.post(path`/journeys/${templateID}/invoke`, { body, ...options });
44
- }
45
- }
46
-
47
- /**
48
- * A journey template representing an automation workflow.
49
- */
50
- export interface Journey {
51
- /**
52
- * The unique identifier of the journey.
53
- */
54
- id: string;
55
-
56
- /**
57
- * The name of the journey.
58
- */
59
- name: string;
60
-
61
- /**
62
- * The version of the journey (published or draft).
63
- */
64
- version: 'published' | 'draft';
65
-
66
- /**
67
- * ISO 8601 timestamp when the journey was created.
68
- */
69
- createdAt?: string;
70
-
71
- /**
72
- * ISO 8601 timestamp when the journey was last updated.
73
- */
74
- updatedAt?: string;
75
- }
76
-
77
- /**
78
- * Request body for invoking a journey. Requires either a user identifier or a
79
- * profile with contact information. User identifiers can be provided via user_id
80
- * field, or resolved from profile/data objects (user_id, userId, or anonymousId
81
- * fields).
82
- */
83
- export interface JourneysInvokeRequest {
84
- /**
85
- * Data payload passed to the journey. The expected shape can be predefined using
86
- * the schema builder in the journey editor. This data is available in journey
87
- * steps for condition evaluation and template variable interpolation. Can also
88
- * contain user identifiers (user_id, userId, anonymousId) if not provided
89
- * elsewhere.
90
- */
91
- data?: { [key: string]: unknown };
92
-
93
- /**
94
- * Profile data for the user. Can contain contact information (email,
95
- * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
96
- * profile fields. Profile fields are merged with any existing stored profile for
97
- * the user. Include context.tenant_id to load a tenant-scoped profile for
98
- * multi-tenant scenarios.
99
- */
100
- profile?: { [key: string]: unknown };
101
-
102
- /**
103
- * A unique identifier for the user. If not provided, the system will attempt to
104
- * resolve the user identifier from profile or data objects.
105
- */
106
- user_id?: string;
107
- }
108
-
109
- export interface JourneysInvokeResponse {
110
- /**
111
- * A unique identifier for the journey run that was created.
112
- */
113
- runId: string;
114
- }
115
-
116
- export interface JourneysListResponse {
117
- /**
118
- * A cursor token for pagination. Present when there are more results available.
119
- */
120
- cursor?: string;
121
-
122
- templates?: Array<Journey>;
123
- }
124
-
125
- export interface JourneyListParams {
126
- /**
127
- * A cursor token for pagination. Use the cursor from the previous response to
128
- * fetch the next page of results.
129
- */
130
- cursor?: string;
131
-
132
- /**
133
- * The version of journeys to retrieve. Accepted values are published (for
134
- * published journeys) or draft (for draft journeys). Defaults to published.
135
- */
136
- version?: 'published' | 'draft';
137
- }
138
-
139
- export interface JourneyInvokeParams {
140
- /**
141
- * Data payload passed to the journey. The expected shape can be predefined using
142
- * the schema builder in the journey editor. This data is available in journey
143
- * steps for condition evaluation and template variable interpolation. Can also
144
- * contain user identifiers (user_id, userId, anonymousId) if not provided
145
- * elsewhere.
146
- */
147
- data?: { [key: string]: unknown };
148
-
149
- /**
150
- * Profile data for the user. Can contain contact information (email,
151
- * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
152
- * profile fields. Profile fields are merged with any existing stored profile for
153
- * the user. Include context.tenant_id to load a tenant-scoped profile for
154
- * multi-tenant scenarios.
155
- */
156
- profile?: { [key: string]: unknown };
157
-
158
- /**
159
- * A unique identifier for the user. If not provided, the system will attempt to
160
- * resolve the user identifier from profile or data objects.
161
- */
162
- user_id?: string;
163
- }
164
-
165
- export declare namespace Journeys {
166
- export {
167
- type Journey as Journey,
168
- type JourneysInvokeRequest as JourneysInvokeRequest,
169
- type JourneysInvokeResponse as JourneysInvokeResponse,
170
- type JourneysListResponse as JourneysListResponse,
171
- type JourneyListParams as JourneyListParams,
172
- type JourneyInvokeParams as JourneyInvokeParams,
173
- };
174
- }
3
+ export * from './journeys/index';
@@ -6,6 +6,7 @@ export {
6
6
  type TemplateListResponse,
7
7
  type TemplateRetrieveParams,
8
8
  type TemplateListParams,
9
+ type TemplateDeleteParams,
9
10
  type TemplatePublishParams,
10
11
  type TemplateReplaceParams,
11
12
  } from './templates/index';
@@ -5,6 +5,7 @@ export {
5
5
  type TemplateListResponse,
6
6
  type TemplateRetrieveParams,
7
7
  type TemplateListParams,
8
+ type TemplateDeleteParams,
8
9
  type TemplatePublishParams,
9
10
  type TemplateReplaceParams,
10
11
  } from './templates';
@@ -6,6 +6,7 @@ import * as TenantsAPI from '../tenants';
6
6
  import * as VersionsAPI from './versions';
7
7
  import { VersionRetrieveParams, Versions } from './versions';
8
8
  import { APIPromise } from '../../../core/api-promise';
9
+ import { buildHeaders } from '../../../internal/headers';
9
10
  import { RequestOptions } from '../../../internal/request-options';
10
11
  import { path } from '../../../internal/utils/path';
11
12
 
@@ -50,6 +51,29 @@ export class Templates extends APIResource {
50
51
  return this._client.get(path`/tenants/${tenantID}/templates`, { query, ...options });
51
52
  }
52
53
 
54
+ /**
55
+ * Deletes the tenant's notification template with the given `template_id`.
56
+ *
57
+ * Returns **204 No Content** with an empty body on success.
58
+ *
59
+ * Returns **404** if there is no template with this ID for the tenant, including a
60
+ * second `DELETE` after a successful removal.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * await client.tenants.templates.delete('template_id', {
65
+ * tenant_id: 'tenant_id',
66
+ * });
67
+ * ```
68
+ */
69
+ delete(templateID: string, params: TemplateDeleteParams, options?: RequestOptions): APIPromise<void> {
70
+ const { tenant_id } = params;
71
+ return this._client.delete(path`/tenants/${tenant_id}/templates/${templateID}`, {
72
+ ...options,
73
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
74
+ });
75
+ }
76
+
53
77
  /**
54
78
  * Publishes a specific version of a notification template for a tenant.
55
79
  *
@@ -174,6 +198,13 @@ export interface TemplateListParams {
174
198
  limit?: number | null;
175
199
  }
176
200
 
201
+ export interface TemplateDeleteParams {
202
+ /**
203
+ * Id of the tenant that owns the template.
204
+ */
205
+ tenant_id: string;
206
+ }
207
+
177
208
  export interface TemplatePublishParams {
178
209
  /**
179
210
  * Path param: Id of the tenant that owns the template.
@@ -214,6 +245,7 @@ export declare namespace Templates {
214
245
  type TemplateListResponse as TemplateListResponse,
215
246
  type TemplateRetrieveParams as TemplateRetrieveParams,
216
247
  type TemplateListParams as TemplateListParams,
248
+ type TemplateDeleteParams as TemplateDeleteParams,
217
249
  type TemplatePublishParams as TemplatePublishParams,
218
250
  type TemplateReplaceParams as TemplateReplaceParams,
219
251
  };
@@ -7,6 +7,7 @@ import * as PreferencesAPI from './preferences/preferences';
7
7
  import { Preferences } from './preferences/preferences';
8
8
  import * as TemplatesAPI from './templates/templates';
9
9
  import {
10
+ TemplateDeleteParams,
10
11
  TemplateListParams,
11
12
  TemplateListResponse,
12
13
  TemplatePublishParams,
@@ -463,6 +464,7 @@ export declare namespace Tenants {
463
464
  type TemplateListResponse as TemplateListResponse,
464
465
  type TemplateRetrieveParams as TemplateRetrieveParams,
465
466
  type TemplateListParams as TemplateListParams,
467
+ type TemplateDeleteParams as TemplateDeleteParams,
466
468
  type TemplatePublishParams as TemplatePublishParams,
467
469
  type TemplateReplaceParams as TemplateReplaceParams,
468
470
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.10.2'; // x-release-please-version
1
+ export const VERSION = '7.11.0'; // x-release-please-version
package/uploads.d.mts CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.mjs";
2
3
  //# sourceMappingURL=uploads.d.mts.map
package/uploads.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
package/uploads.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.js";
2
3
  //# sourceMappingURL=uploads.d.ts.map
package/uploads.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kCAA+B"}
package/uploads.mjs CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.mjs";
2
3
  //# sourceMappingURL=uploads.mjs.map
package/uploads.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.10.2";
1
+ export declare const VERSION = "7.11.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.10.2";
1
+ export declare const VERSION = "7.11.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '7.10.2'; // x-release-please-version
4
+ exports.VERSION = '7.11.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '7.10.2'; // x-release-please-version
1
+ export const VERSION = '7.11.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map