@trycourier/courier 7.8.0 → 7.10.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 (127) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client.d.mts +16 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +3 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +3 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +5 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +2 -0
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/notifications/checks.d.mts +35 -0
  20. package/resources/notifications/checks.d.mts.map +1 -1
  21. package/resources/notifications/checks.d.ts +35 -0
  22. package/resources/notifications/checks.d.ts.map +1 -1
  23. package/resources/notifications/checks.js +35 -0
  24. package/resources/notifications/checks.js.map +1 -1
  25. package/resources/notifications/checks.mjs +35 -0
  26. package/resources/notifications/checks.mjs.map +1 -1
  27. package/resources/notifications/index.d.mts +1 -2
  28. package/resources/notifications/index.d.mts.map +1 -1
  29. package/resources/notifications/index.d.ts +1 -2
  30. package/resources/notifications/index.d.ts.map +1 -1
  31. package/resources/notifications/index.js +1 -3
  32. package/resources/notifications/index.js.map +1 -1
  33. package/resources/notifications/index.mjs +0 -1
  34. package/resources/notifications/index.mjs.map +1 -1
  35. package/resources/notifications/notifications.d.mts +667 -11
  36. package/resources/notifications/notifications.d.mts.map +1 -1
  37. package/resources/notifications/notifications.d.ts +667 -11
  38. package/resources/notifications/notifications.d.ts.map +1 -1
  39. package/resources/notifications/notifications.js +191 -6
  40. package/resources/notifications/notifications.js.map +1 -1
  41. package/resources/notifications/notifications.mjs +191 -6
  42. package/resources/notifications/notifications.mjs.map +1 -1
  43. package/resources/providers/catalog.d.mts +40 -0
  44. package/resources/providers/catalog.d.mts.map +1 -0
  45. package/resources/providers/catalog.d.ts +40 -0
  46. package/resources/providers/catalog.d.ts.map +1 -0
  47. package/resources/providers/catalog.js +18 -0
  48. package/resources/providers/catalog.js.map +1 -0
  49. package/resources/providers/catalog.mjs +14 -0
  50. package/resources/providers/catalog.mjs.map +1 -0
  51. package/resources/providers/index.d.mts +3 -0
  52. package/resources/providers/index.d.mts.map +1 -0
  53. package/resources/providers/index.d.ts +3 -0
  54. package/resources/providers/index.d.ts.map +1 -0
  55. package/resources/providers/index.js +9 -0
  56. package/resources/providers/index.js.map +1 -0
  57. package/resources/providers/index.mjs +4 -0
  58. package/resources/providers/index.mjs.map +1 -0
  59. package/resources/providers/providers.d.mts +182 -0
  60. package/resources/providers/providers.d.mts.map +1 -0
  61. package/resources/providers/providers.d.ts +182 -0
  62. package/resources/providers/providers.d.ts.map +1 -0
  63. package/resources/providers/providers.js +57 -0
  64. package/resources/providers/providers.js.map +1 -0
  65. package/resources/providers/providers.mjs +52 -0
  66. package/resources/providers/providers.mjs.map +1 -0
  67. package/resources/providers.d.mts +2 -0
  68. package/resources/providers.d.mts.map +1 -0
  69. package/resources/providers.d.ts +2 -0
  70. package/resources/providers.d.ts.map +1 -0
  71. package/resources/providers.js +6 -0
  72. package/resources/providers.js.map +1 -0
  73. package/resources/providers.mjs +3 -0
  74. package/resources/providers.mjs.map +1 -0
  75. package/resources/routing-strategies.d.mts +333 -0
  76. package/resources/routing-strategies.d.mts.map +1 -0
  77. package/resources/routing-strategies.d.ts +333 -0
  78. package/resources/routing-strategies.d.ts.map +1 -0
  79. package/resources/routing-strategies.js +107 -0
  80. package/resources/routing-strategies.js.map +1 -0
  81. package/resources/routing-strategies.mjs +103 -0
  82. package/resources/routing-strategies.mjs.map +1 -0
  83. package/resources/send.d.mts +2 -60
  84. package/resources/send.d.mts.map +1 -1
  85. package/resources/send.d.ts +2 -60
  86. package/resources/send.d.ts.map +1 -1
  87. package/resources/shared.d.mts +60 -1
  88. package/resources/shared.d.mts.map +1 -1
  89. package/resources/shared.d.ts +60 -1
  90. package/resources/shared.d.ts.map +1 -1
  91. package/resources/tenants/tenants.d.mts +2 -62
  92. package/resources/tenants/tenants.d.mts.map +1 -1
  93. package/resources/tenants/tenants.d.ts +2 -62
  94. package/resources/tenants/tenants.d.ts.map +1 -1
  95. package/resources/tenants/tenants.js.map +1 -1
  96. package/resources/tenants/tenants.mjs.map +1 -1
  97. package/src/client.ts +112 -0
  98. package/src/resources/index.ts +49 -0
  99. package/src/resources/notifications/checks.ts +35 -0
  100. package/src/resources/notifications/index.ts +26 -1
  101. package/src/resources/notifications/notifications.ts +858 -13
  102. package/src/resources/providers/catalog.ts +53 -0
  103. package/src/resources/providers/index.ts +12 -0
  104. package/src/resources/providers/providers.ts +240 -0
  105. package/src/resources/providers.ts +3 -0
  106. package/src/resources/routing-strategies.ts +436 -0
  107. package/src/resources/send.ts +2 -67
  108. package/src/resources/shared.ts +71 -1
  109. package/src/resources/tenants/tenants.ts +2 -69
  110. package/src/version.ts +1 -1
  111. package/version.d.mts +1 -1
  112. package/version.d.mts.map +1 -1
  113. package/version.d.ts +1 -1
  114. package/version.d.ts.map +1 -1
  115. package/version.js +1 -1
  116. package/version.js.map +1 -1
  117. package/version.mjs +1 -1
  118. package/version.mjs.map +1 -1
  119. package/resources/notifications/draft.d.mts +0 -8
  120. package/resources/notifications/draft.d.mts.map +0 -1
  121. package/resources/notifications/draft.d.ts +0 -8
  122. package/resources/notifications/draft.d.ts.map +0 -1
  123. package/resources/notifications/draft.js +0 -13
  124. package/resources/notifications/draft.js.map +0 -1
  125. package/resources/notifications/draft.mjs +0 -9
  126. package/resources/notifications/draft.mjs.map +0 -1
  127. package/src/resources/notifications/draft.ts +0 -13
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as NotificationsAPI from './notifications';
4
5
  import * as Shared from '../shared';
5
6
  import * as ChecksAPI from './checks';
6
7
  import {
@@ -11,16 +12,70 @@ import {
11
12
  CheckUpdateResponse,
12
13
  Checks,
13
14
  } from './checks';
14
- import * as DraftAPI from './draft';
15
- import { Draft } from './draft';
16
15
  import { APIPromise } from '../../core/api-promise';
16
+ import { buildHeaders } from '../../internal/headers';
17
17
  import { RequestOptions } from '../../internal/request-options';
18
18
  import { path } from '../../internal/utils/path';
19
19
 
20
20
  export class Notifications extends APIResource {
21
- draft: DraftAPI.Draft = new DraftAPI.Draft(this._client);
22
21
  checks: ChecksAPI.Checks = new ChecksAPI.Checks(this._client);
23
22
 
23
+ /**
24
+ * Create a notification template. Requires all fields in the notification object.
25
+ * Templates are created in draft state by default.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const notificationTemplateMutationResponse =
30
+ * await client.notifications.create({
31
+ * notification: {
32
+ * name: 'Welcome Email',
33
+ * tags: ['onboarding', 'welcome'],
34
+ * brand: { id: 'brand_abc' },
35
+ * subscription: { topic_id: 'marketing' },
36
+ * routing: { strategy_id: 'rs_123' },
37
+ * content: {
38
+ * version: '2022-01-01',
39
+ * elements: [{ type: 'channel' }],
40
+ * },
41
+ * },
42
+ * state: 'DRAFT',
43
+ * });
44
+ * ```
45
+ */
46
+ create(
47
+ body: NotificationCreateParams,
48
+ options?: RequestOptions,
49
+ ): APIPromise<NotificationTemplateMutationResponse> {
50
+ return this._client.post('/notifications', { body, ...options });
51
+ }
52
+
53
+ /**
54
+ * Retrieve a notification template by ID. Returns the published version by
55
+ * default. Pass version=draft to retrieve an unpublished template.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const notificationTemplateGetResponse =
60
+ * await client.notifications.retrieve('id');
61
+ * ```
62
+ */
63
+ retrieve(
64
+ id: string,
65
+ query: NotificationRetrieveParams | null | undefined = {},
66
+ options?: RequestOptions,
67
+ ): APIPromise<NotificationTemplateGetResponse> {
68
+ return this._client.get(path`/notifications/${id}`, { query, ...options });
69
+ }
70
+
71
+ /**
72
+ * List notification templates in your workspace.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const notifications = await client.notifications.list();
77
+ * ```
78
+ */
24
79
  list(
25
80
  query: NotificationListParams | null | undefined = {},
26
81
  options?: RequestOptions,
@@ -28,8 +83,184 @@ export class Notifications extends APIResource {
28
83
  return this._client.get('/notifications', { query, ...options });
29
84
  }
30
85
 
31
- retrieveContent(id: string, options?: RequestOptions): APIPromise<NotificationGetContent> {
32
- return this._client.get(path`/notifications/${id}/content`, options);
86
+ /**
87
+ * Archive a notification template.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * await client.notifications.archive('id');
92
+ * ```
93
+ */
94
+ archive(id: string, options?: RequestOptions): APIPromise<void> {
95
+ return this._client.delete(path`/notifications/${id}`, {
96
+ ...options,
97
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
98
+ });
99
+ }
100
+
101
+ /**
102
+ * List versions of a notification template.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const notificationTemplateVersionListResponse =
107
+ * await client.notifications.listVersions('id');
108
+ * ```
109
+ */
110
+ listVersions(
111
+ id: string,
112
+ query: NotificationListVersionsParams | null | undefined = {},
113
+ options?: RequestOptions,
114
+ ): APIPromise<NotificationTemplateVersionListResponse> {
115
+ return this._client.get(path`/notifications/${id}/versions`, { query, ...options });
116
+ }
117
+
118
+ /**
119
+ * Publish a notification template. Publishes the current draft by default. Pass a
120
+ * version in the request body to publish a specific historical version.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * await client.notifications.publish('id');
125
+ * ```
126
+ */
127
+ publish(
128
+ id: string,
129
+ body: NotificationPublishParams | null | undefined = {},
130
+ options?: RequestOptions,
131
+ ): APIPromise<void> {
132
+ return this._client.post(path`/notifications/${id}/publish`, {
133
+ body,
134
+ ...options,
135
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
136
+ });
137
+ }
138
+
139
+ /**
140
+ * Replace the elemental content of a notification template. Overwrites all
141
+ * elements in the template with the provided content. Only supported for V2
142
+ * (elemental) templates.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * const notificationContentMutationResponse =
147
+ * await client.notifications.putContent('id', {
148
+ * content: {
149
+ * version: '2022-01-01',
150
+ * elements: [{ type: 'channel' }],
151
+ * },
152
+ * state: 'DRAFT',
153
+ * });
154
+ * ```
155
+ */
156
+ putContent(
157
+ id: string,
158
+ body: NotificationPutContentParams,
159
+ options?: RequestOptions,
160
+ ): APIPromise<NotificationContentMutationResponse> {
161
+ return this._client.put(path`/notifications/${id}/content`, { body, ...options });
162
+ }
163
+
164
+ /**
165
+ * Update a single element within a notification template. Only supported for V2
166
+ * (elemental) templates.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * const notificationContentMutationResponse =
171
+ * await client.notifications.putElement('elementId', {
172
+ * id: 'id',
173
+ * type: 'text',
174
+ * data: { content: 'Updated text content' },
175
+ * state: 'DRAFT',
176
+ * });
177
+ * ```
178
+ */
179
+ putElement(
180
+ elementID: string,
181
+ params: NotificationPutElementParams,
182
+ options?: RequestOptions,
183
+ ): APIPromise<NotificationContentMutationResponse> {
184
+ const { id, ...body } = params;
185
+ return this._client.put(path`/notifications/${id}/elements/${elementID}`, { body, ...options });
186
+ }
187
+
188
+ /**
189
+ * Set locale-specific content overrides for a notification template. Each element
190
+ * override must reference an existing element by ID. Only supported for V2
191
+ * (elemental) templates.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * const notificationContentMutationResponse =
196
+ * await client.notifications.putLocale('localeId', {
197
+ * id: 'id',
198
+ * elements: [
199
+ * { id: 'elem_1', content: 'Hola {{data.name}}.' },
200
+ * { id: 'elem_2', title: 'Bienvenido!' },
201
+ * ],
202
+ * state: 'DRAFT',
203
+ * });
204
+ * ```
205
+ */
206
+ putLocale(
207
+ localeID: string,
208
+ params: NotificationPutLocaleParams,
209
+ options?: RequestOptions,
210
+ ): APIPromise<NotificationContentMutationResponse> {
211
+ const { id, ...body } = params;
212
+ return this._client.put(path`/notifications/${id}/locales/${localeID}`, { body, ...options });
213
+ }
214
+
215
+ /**
216
+ * Replace a notification template. All fields are required.
217
+ *
218
+ * @example
219
+ * ```ts
220
+ * const notificationTemplateMutationResponse =
221
+ * await client.notifications.replace('id', {
222
+ * notification: {
223
+ * name: 'Updated Name',
224
+ * tags: ['updated'],
225
+ * brand: null,
226
+ * subscription: null,
227
+ * routing: null,
228
+ * content: {
229
+ * version: '2022-01-01',
230
+ * elements: [{ type: 'channel' }],
231
+ * },
232
+ * },
233
+ * state: 'PUBLISHED',
234
+ * });
235
+ * ```
236
+ */
237
+ replace(
238
+ id: string,
239
+ body: NotificationReplaceParams,
240
+ options?: RequestOptions,
241
+ ): APIPromise<NotificationTemplateMutationResponse> {
242
+ return this._client.put(path`/notifications/${id}`, { body, ...options });
243
+ }
244
+
245
+ /**
246
+ * Retrieve the content of a notification template. The response shape depends on
247
+ * whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
248
+ * the `version` query parameter to select draft, published, or a specific
249
+ * historical version.
250
+ *
251
+ * @example
252
+ * ```ts
253
+ * const response = await client.notifications.retrieveContent(
254
+ * 'id',
255
+ * );
256
+ * ```
257
+ */
258
+ retrieveContent(
259
+ id: string,
260
+ query: NotificationRetrieveContentParams | null | undefined = {},
261
+ options?: RequestOptions,
262
+ ): APIPromise<NotificationRetrieveContentResponse> {
263
+ return this._client.get(path`/notifications/${id}/content`, { query, ...options });
33
264
  }
34
265
  }
35
266
 
@@ -45,6 +276,145 @@ export interface Check extends BaseCheck {
45
276
  updated: number;
46
277
  }
47
278
 
279
+ /**
280
+ * An element with its content checksum and optional nested elements and locale
281
+ * checksums.
282
+ */
283
+ export interface ElementWithChecksums {
284
+ /**
285
+ * MD5 hash of translatable content.
286
+ */
287
+ checksum: string;
288
+
289
+ /**
290
+ * Element type (text, meta, action, etc.).
291
+ */
292
+ type: string;
293
+
294
+ id?: string;
295
+
296
+ /**
297
+ * Nested child elements (for group-type elements).
298
+ */
299
+ elements?: Array<ElementWithChecksums>;
300
+
301
+ /**
302
+ * Locale-specific content with checksums.
303
+ */
304
+ locales?: { [key: string]: ElementWithChecksums.Locales };
305
+
306
+ [k: string]: unknown;
307
+ }
308
+
309
+ export namespace ElementWithChecksums {
310
+ export interface Locales {
311
+ checksum: string;
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Elemental content response for V2 templates. Contains versioned elements with
317
+ * content checksums.
318
+ */
319
+ export interface NotificationContentGetResponse {
320
+ elements: Array<ElementWithChecksums>;
321
+
322
+ /**
323
+ * Content version identifier.
324
+ */
325
+ version: string;
326
+ }
327
+
328
+ /**
329
+ * Shared mutation response for `PUT` content, `PUT` element, and `PUT` locale
330
+ * operations. Contains the template ID, content version, per-element checksums,
331
+ * and resulting state.
332
+ */
333
+ export interface NotificationContentMutationResponse {
334
+ /**
335
+ * Template ID.
336
+ */
337
+ id: string;
338
+
339
+ elements: Array<NotificationContentMutationResponse.Element>;
340
+
341
+ /**
342
+ * Template state. Defaults to `DRAFT`.
343
+ */
344
+ state: NotificationTemplateState;
345
+
346
+ /**
347
+ * Content version identifier.
348
+ */
349
+ version: string;
350
+ }
351
+
352
+ export namespace NotificationContentMutationResponse {
353
+ export interface Element {
354
+ id: string;
355
+
356
+ checksum: string;
357
+ }
358
+ }
359
+
360
+ /**
361
+ * Request body for replacing the elemental content of a notification template.
362
+ */
363
+ export interface NotificationContentPutRequest {
364
+ /**
365
+ * Elemental content payload. The server defaults `version` when omitted.
366
+ */
367
+ content: NotificationContentPutRequest.Content;
368
+
369
+ /**
370
+ * Template state. Defaults to `DRAFT`.
371
+ */
372
+ state?: NotificationTemplateState;
373
+ }
374
+
375
+ export namespace NotificationContentPutRequest {
376
+ /**
377
+ * Elemental content payload. The server defaults `version` when omitted.
378
+ */
379
+ export interface Content {
380
+ elements: Array<Shared.ElementalNode>;
381
+
382
+ /**
383
+ * Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
384
+ * omitted.
385
+ */
386
+ version?: string;
387
+ }
388
+ }
389
+
390
+ /**
391
+ * Request body for updating a single element. Additional type-specific fields are
392
+ * allowed.
393
+ */
394
+ export interface NotificationElementPutRequest {
395
+ /**
396
+ * Element type (text, meta, action, image, etc.).
397
+ */
398
+ type: string;
399
+
400
+ channels?: Array<string>;
401
+
402
+ data?: { [key: string]: unknown };
403
+
404
+ if?: string;
405
+
406
+ loop?: string;
407
+
408
+ ref?: string;
409
+
410
+ /**
411
+ * Template state. Defaults to `DRAFT`.
412
+ */
413
+ state?: NotificationTemplateState;
414
+
415
+ [k: string]: unknown;
416
+ }
417
+
48
418
  export interface NotificationGetContent {
49
419
  blocks?: Array<NotificationGetContent.Block> | null;
50
420
 
@@ -111,14 +481,290 @@ export namespace NotificationGetContent {
111
481
  }
112
482
  }
113
483
 
484
+ /**
485
+ * Request body for setting locale-specific content overrides. Each element
486
+ * override must include the target element ID.
487
+ */
488
+ export interface NotificationLocalePutRequest {
489
+ /**
490
+ * Elements with locale-specific content overrides.
491
+ */
492
+ elements: Array<NotificationLocalePutRequest.Element>;
493
+
494
+ /**
495
+ * Template state. Defaults to `DRAFT`.
496
+ */
497
+ state?: NotificationTemplateState;
498
+ }
499
+
500
+ export namespace NotificationLocalePutRequest {
501
+ export interface Element {
502
+ /**
503
+ * Target element ID.
504
+ */
505
+ id: string;
506
+
507
+ [k: string]: unknown;
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Request body for creating a notification template.
513
+ */
514
+ export interface NotificationTemplateCreateRequest {
515
+ /**
516
+ * Full document shape used in POST and PUT request bodies, and returned inside the
517
+ * GET response envelope.
518
+ */
519
+ notification: NotificationTemplatePayload;
520
+
521
+ /**
522
+ * Template state after creation. Case-insensitive input, normalized to uppercase
523
+ * in the response. Defaults to "DRAFT".
524
+ */
525
+ state?: 'DRAFT' | 'PUBLISHED';
526
+ }
527
+
528
+ /**
529
+ * Envelope response for GET /notifications/{id}. The notification object mirrors
530
+ * the POST/PUT input shape. Nullable fields return null when unset.
531
+ */
532
+ export interface NotificationTemplateGetResponse {
533
+ /**
534
+ * Epoch milliseconds when the template was created.
535
+ */
536
+ created: number;
537
+
538
+ /**
539
+ * User ID of the creator.
540
+ */
541
+ creator: string;
542
+
543
+ /**
544
+ * Full document shape used in POST and PUT request bodies, and returned inside the
545
+ * GET response envelope.
546
+ */
547
+ notification: NotificationTemplateGetResponse.Notification;
548
+
549
+ /**
550
+ * The template state. Always uppercase.
551
+ */
552
+ state: 'DRAFT' | 'PUBLISHED';
553
+
554
+ /**
555
+ * Epoch milliseconds of last update.
556
+ */
557
+ updated?: number;
558
+
559
+ /**
560
+ * User ID of the last updater.
561
+ */
562
+ updater?: string;
563
+ }
564
+
565
+ export namespace NotificationTemplateGetResponse {
566
+ /**
567
+ * Full document shape used in POST and PUT request bodies, and returned inside the
568
+ * GET response envelope.
569
+ */
570
+ export interface Notification extends NotificationsAPI.NotificationTemplatePayload {
571
+ /**
572
+ * The template ID.
573
+ */
574
+ id: string;
575
+ }
576
+ }
577
+
578
+ /**
579
+ * Response returned by POST and PUT operations.
580
+ */
581
+ export interface NotificationTemplateMutationResponse {
582
+ notification: NotificationTemplateMutationResponse.Notification;
583
+
584
+ /**
585
+ * The template state after the operation. Always uppercase.
586
+ */
587
+ state: 'DRAFT' | 'PUBLISHED';
588
+ }
589
+
590
+ export namespace NotificationTemplateMutationResponse {
591
+ export interface Notification {
592
+ /**
593
+ * The ID of the created or updated template.
594
+ */
595
+ id: string;
596
+ }
597
+ }
598
+
599
+ /**
600
+ * Full document shape used in POST and PUT request bodies, and returned inside the
601
+ * GET response envelope.
602
+ */
603
+ export interface NotificationTemplatePayload {
604
+ /**
605
+ * Brand reference, or null for no brand.
606
+ */
607
+ brand: NotificationTemplatePayload.Brand | null;
608
+
609
+ /**
610
+ * Elemental content definition.
611
+ */
612
+ content: Shared.ElementalContent;
613
+
614
+ /**
615
+ * Display name for the template.
616
+ */
617
+ name: string;
618
+
619
+ /**
620
+ * Routing strategy reference, or null for none.
621
+ */
622
+ routing: NotificationTemplatePayload.Routing | null;
623
+
624
+ /**
625
+ * Subscription topic reference, or null for none.
626
+ */
627
+ subscription: NotificationTemplatePayload.Subscription | null;
628
+
629
+ /**
630
+ * Tags for categorization. Send empty array for none.
631
+ */
632
+ tags: Array<string>;
633
+ }
634
+
635
+ export namespace NotificationTemplatePayload {
636
+ /**
637
+ * Brand reference, or null for no brand.
638
+ */
639
+ export interface Brand {
640
+ id: string;
641
+ }
642
+
643
+ /**
644
+ * Routing strategy reference, or null for none.
645
+ */
646
+ export interface Routing {
647
+ strategy_id: string;
648
+ }
649
+
650
+ /**
651
+ * Subscription topic reference, or null for none.
652
+ */
653
+ export interface Subscription {
654
+ topic_id: string;
655
+ }
656
+ }
657
+
658
+ /**
659
+ * Optional request body for publishing a notification template. Omit or send an
660
+ * empty object to publish the current draft.
661
+ */
662
+ export interface NotificationTemplatePublishRequest {
663
+ /**
664
+ * Historical version to publish (e.g. "v001"). Omit to publish the current draft.
665
+ */
666
+ version?: string;
667
+ }
668
+
669
+ /**
670
+ * Template state. Defaults to `DRAFT`.
671
+ */
672
+ export type NotificationTemplateState = 'DRAFT' | 'PUBLISHED';
673
+
674
+ /**
675
+ * V2 (CDS) template summary returned in list responses.
676
+ */
677
+ export interface NotificationTemplateSummary {
678
+ id: string;
679
+
680
+ /**
681
+ * Epoch milliseconds when the template was created.
682
+ */
683
+ created: number;
684
+
685
+ /**
686
+ * User ID of the creator.
687
+ */
688
+ creator: string;
689
+
690
+ name: string;
691
+
692
+ state: 'DRAFT' | 'PUBLISHED';
693
+
694
+ tags: Array<string>;
695
+
696
+ /**
697
+ * Epoch milliseconds of last update.
698
+ */
699
+ updated?: number;
700
+
701
+ /**
702
+ * User ID of the last updater.
703
+ */
704
+ updater?: string;
705
+ }
706
+
707
+ /**
708
+ * Request body for replacing a notification template. Same shape as create. All
709
+ * fields required (PUT = full replacement).
710
+ */
711
+ export interface NotificationTemplateUpdateRequest {
712
+ /**
713
+ * Full document shape used in POST and PUT request bodies, and returned inside the
714
+ * GET response envelope.
715
+ */
716
+ notification: NotificationTemplatePayload;
717
+
718
+ /**
719
+ * Template state after update. Case-insensitive input, normalized to uppercase in
720
+ * the response. Defaults to "DRAFT".
721
+ */
722
+ state?: 'DRAFT' | 'PUBLISHED';
723
+ }
724
+
725
+ export interface NotificationTemplateVersionListResponse {
726
+ paging: Shared.Paging;
727
+
728
+ versions: Array<VersionNode>;
729
+ }
730
+
731
+ /**
732
+ * A version entry for a notification template.
733
+ */
734
+ export interface VersionNode {
735
+ /**
736
+ * Epoch milliseconds when this version was created.
737
+ */
738
+ created: number;
739
+
740
+ /**
741
+ * User ID of the version creator.
742
+ */
743
+ creator: string;
744
+
745
+ /**
746
+ * Version identifier. One of "draft", "published:vNNN" (current published
747
+ * version), or "vNNN" (historical version).
748
+ */
749
+ version: string;
750
+
751
+ /**
752
+ * Whether the draft has unpublished changes. Only present on the draft version.
753
+ */
754
+ has_changes?: boolean;
755
+ }
756
+
114
757
  export interface NotificationListResponse {
115
758
  paging: Shared.Paging;
116
759
 
117
- results: Array<NotificationListResponse.Result>;
760
+ /**
761
+ * Notification templates in this workspace.
762
+ */
763
+ results: Array<NotificationListResponse.Notification | NotificationTemplateSummary>;
118
764
  }
119
765
 
120
766
  export namespace NotificationListResponse {
121
- export interface Result {
767
+ export interface Notification {
122
768
  id: string;
123
769
 
124
770
  created_at: number;
@@ -136,12 +782,12 @@ export namespace NotificationListResponse {
136
782
 
137
783
  updated_at: number;
138
784
 
139
- tags?: Result.Tags | null;
785
+ tags?: Notification.Tags | null;
140
786
 
141
787
  title?: string | null;
142
788
  }
143
789
 
144
- export namespace Result {
790
+ export namespace Notification {
145
791
  export interface Tags {
146
792
  data: Array<Tags.Data>;
147
793
  }
@@ -156,29 +802,228 @@ export namespace NotificationListResponse {
156
802
  }
157
803
  }
158
804
 
805
+ /**
806
+ * Elemental content response for V2 templates. Contains versioned elements with
807
+ * content checksums.
808
+ */
809
+ export type NotificationRetrieveContentResponse = NotificationContentGetResponse | NotificationGetContent;
810
+
811
+ export interface NotificationCreateParams {
812
+ /**
813
+ * Full document shape used in POST and PUT request bodies, and returned inside the
814
+ * GET response envelope.
815
+ */
816
+ notification: NotificationTemplatePayload;
817
+
818
+ /**
819
+ * Template state after creation. Case-insensitive input, normalized to uppercase
820
+ * in the response. Defaults to "DRAFT".
821
+ */
822
+ state?: 'DRAFT' | 'PUBLISHED';
823
+ }
824
+
825
+ export interface NotificationRetrieveParams {
826
+ /**
827
+ * Version to retrieve. One of "draft", "published", or a version string like
828
+ * "v001". Defaults to "published".
829
+ */
830
+ version?: string;
831
+ }
832
+
159
833
  export interface NotificationListParams {
834
+ /**
835
+ * Opaque pagination cursor from a previous response. Omit for the first page.
836
+ */
160
837
  cursor?: string | null;
161
838
 
162
839
  /**
163
- * Retrieve the notes from the Notification template settings.
840
+ * Filter to templates linked to this event map ID.
841
+ */
842
+ event_id?: string;
843
+
844
+ /**
845
+ * Include template notes in the response. Only applies to legacy templates.
164
846
  */
165
847
  notes?: boolean | null;
166
848
  }
167
849
 
168
- Notifications.Draft = Draft;
850
+ export interface NotificationListVersionsParams {
851
+ /**
852
+ * Opaque pagination cursor from a previous response. Omit for the first page.
853
+ */
854
+ cursor?: string;
855
+
856
+ /**
857
+ * Maximum number of versions to return per page. Default 10, max 10.
858
+ */
859
+ limit?: number;
860
+ }
861
+
862
+ export interface NotificationPublishParams {
863
+ /**
864
+ * Historical version to publish (e.g. "v001"). Omit to publish the current draft.
865
+ */
866
+ version?: string;
867
+ }
868
+
869
+ export interface NotificationPutContentParams {
870
+ /**
871
+ * Elemental content payload. The server defaults `version` when omitted.
872
+ */
873
+ content: NotificationPutContentParams.Content;
874
+
875
+ /**
876
+ * Template state. Defaults to `DRAFT`.
877
+ */
878
+ state?: NotificationTemplateState;
879
+ }
880
+
881
+ export namespace NotificationPutContentParams {
882
+ /**
883
+ * Elemental content payload. The server defaults `version` when omitted.
884
+ */
885
+ export interface Content {
886
+ elements: Array<Shared.ElementalNode>;
887
+
888
+ /**
889
+ * Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
890
+ * omitted.
891
+ */
892
+ version?: string;
893
+ }
894
+ }
895
+
896
+ export interface NotificationPutElementParams {
897
+ /**
898
+ * Path param: Notification template ID (`nt_` prefix).
899
+ */
900
+ id: string;
901
+
902
+ /**
903
+ * Body param: Element type (text, meta, action, image, etc.).
904
+ */
905
+ type: string;
906
+
907
+ /**
908
+ * Body param
909
+ */
910
+ channels?: Array<string>;
911
+
912
+ /**
913
+ * Body param
914
+ */
915
+ data?: { [key: string]: unknown };
916
+
917
+ /**
918
+ * Body param
919
+ */
920
+ if?: string;
921
+
922
+ /**
923
+ * Body param
924
+ */
925
+ loop?: string;
926
+
927
+ /**
928
+ * Body param
929
+ */
930
+ ref?: string;
931
+
932
+ /**
933
+ * Body param: Template state. Defaults to `DRAFT`.
934
+ */
935
+ state?: NotificationTemplateState;
936
+
937
+ [k: string]: unknown;
938
+ }
939
+
940
+ export interface NotificationPutLocaleParams {
941
+ /**
942
+ * Path param: Notification template ID (`nt_` prefix).
943
+ */
944
+ id: string;
945
+
946
+ /**
947
+ * Body param: Elements with locale-specific content overrides.
948
+ */
949
+ elements: Array<NotificationPutLocaleParams.Element>;
950
+
951
+ /**
952
+ * Body param: Template state. Defaults to `DRAFT`.
953
+ */
954
+ state?: NotificationTemplateState;
955
+ }
956
+
957
+ export namespace NotificationPutLocaleParams {
958
+ export interface Element {
959
+ /**
960
+ * Target element ID.
961
+ */
962
+ id: string;
963
+
964
+ [k: string]: unknown;
965
+ }
966
+ }
967
+
968
+ export interface NotificationReplaceParams {
969
+ /**
970
+ * Full document shape used in POST and PUT request bodies, and returned inside the
971
+ * GET response envelope.
972
+ */
973
+ notification: NotificationTemplatePayload;
974
+
975
+ /**
976
+ * Template state after update. Case-insensitive input, normalized to uppercase in
977
+ * the response. Defaults to "DRAFT".
978
+ */
979
+ state?: 'DRAFT' | 'PUBLISHED';
980
+ }
981
+
982
+ export interface NotificationRetrieveContentParams {
983
+ /**
984
+ * Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to
985
+ * `published`.
986
+ */
987
+ version?: string;
988
+ }
989
+
169
990
  Notifications.Checks = Checks;
170
991
 
171
992
  export declare namespace Notifications {
172
993
  export {
173
994
  type BaseCheck as BaseCheck,
174
995
  type Check as Check,
996
+ type ElementWithChecksums as ElementWithChecksums,
997
+ type NotificationContentGetResponse as NotificationContentGetResponse,
998
+ type NotificationContentMutationResponse as NotificationContentMutationResponse,
999
+ type NotificationContentPutRequest as NotificationContentPutRequest,
1000
+ type NotificationElementPutRequest as NotificationElementPutRequest,
175
1001
  type NotificationGetContent as NotificationGetContent,
1002
+ type NotificationLocalePutRequest as NotificationLocalePutRequest,
1003
+ type NotificationTemplateCreateRequest as NotificationTemplateCreateRequest,
1004
+ type NotificationTemplateGetResponse as NotificationTemplateGetResponse,
1005
+ type NotificationTemplateMutationResponse as NotificationTemplateMutationResponse,
1006
+ type NotificationTemplatePayload as NotificationTemplatePayload,
1007
+ type NotificationTemplatePublishRequest as NotificationTemplatePublishRequest,
1008
+ type NotificationTemplateState as NotificationTemplateState,
1009
+ type NotificationTemplateSummary as NotificationTemplateSummary,
1010
+ type NotificationTemplateUpdateRequest as NotificationTemplateUpdateRequest,
1011
+ type NotificationTemplateVersionListResponse as NotificationTemplateVersionListResponse,
1012
+ type VersionNode as VersionNode,
176
1013
  type NotificationListResponse as NotificationListResponse,
1014
+ type NotificationRetrieveContentResponse as NotificationRetrieveContentResponse,
1015
+ type NotificationCreateParams as NotificationCreateParams,
1016
+ type NotificationRetrieveParams as NotificationRetrieveParams,
177
1017
  type NotificationListParams as NotificationListParams,
1018
+ type NotificationListVersionsParams as NotificationListVersionsParams,
1019
+ type NotificationPublishParams as NotificationPublishParams,
1020
+ type NotificationPutContentParams as NotificationPutContentParams,
1021
+ type NotificationPutElementParams as NotificationPutElementParams,
1022
+ type NotificationPutLocaleParams as NotificationPutLocaleParams,
1023
+ type NotificationReplaceParams as NotificationReplaceParams,
1024
+ type NotificationRetrieveContentParams as NotificationRetrieveContentParams,
178
1025
  };
179
1026
 
180
- export { Draft as Draft };
181
-
182
1027
  export {
183
1028
  Checks as Checks,
184
1029
  type CheckUpdateResponse as CheckUpdateResponse,