@trycourier/courier 7.9.0 → 7.10.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 (75) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/internal/utils/env.js +2 -2
  9. package/internal/utils/env.js.map +1 -1
  10. package/internal/utils/env.mjs +2 -2
  11. package/internal/utils/env.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/index.d.mts +2 -2
  14. package/resources/index.d.mts.map +1 -1
  15. package/resources/index.d.ts +2 -2
  16. package/resources/index.d.ts.map +1 -1
  17. package/resources/index.js.map +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/notifications/index.d.mts +1 -2
  20. package/resources/notifications/index.d.mts.map +1 -1
  21. package/resources/notifications/index.d.ts +1 -2
  22. package/resources/notifications/index.d.ts.map +1 -1
  23. package/resources/notifications/index.js +1 -3
  24. package/resources/notifications/index.js.map +1 -1
  25. package/resources/notifications/index.mjs +0 -1
  26. package/resources/notifications/index.mjs.map +1 -1
  27. package/resources/notifications/notifications.d.mts +305 -30
  28. package/resources/notifications/notifications.d.mts.map +1 -1
  29. package/resources/notifications/notifications.d.ts +305 -30
  30. package/resources/notifications/notifications.d.ts.map +1 -1
  31. package/resources/notifications/notifications.js +73 -10
  32. package/resources/notifications/notifications.js.map +1 -1
  33. package/resources/notifications/notifications.mjs +73 -10
  34. package/resources/notifications/notifications.mjs.map +1 -1
  35. package/resources/providers/providers.d.mts +7 -4
  36. package/resources/providers/providers.d.mts.map +1 -1
  37. package/resources/providers/providers.d.ts +7 -4
  38. package/resources/providers/providers.d.ts.map +1 -1
  39. package/resources/providers/providers.js +6 -4
  40. package/resources/providers/providers.js.map +1 -1
  41. package/resources/providers/providers.mjs +6 -4
  42. package/resources/providers/providers.mjs.map +1 -1
  43. package/resources/routing-strategies.d.mts +34 -14
  44. package/resources/routing-strategies.d.mts.map +1 -1
  45. package/resources/routing-strategies.d.ts +34 -14
  46. package/resources/routing-strategies.d.ts.map +1 -1
  47. package/resources/routing-strategies.js +15 -2
  48. package/resources/routing-strategies.js.map +1 -1
  49. package/resources/routing-strategies.mjs +15 -2
  50. package/resources/routing-strategies.mjs.map +1 -1
  51. package/src/client.ts +28 -4
  52. package/src/internal/utils/env.ts +2 -2
  53. package/src/resources/index.ts +14 -2
  54. package/src/resources/notifications/index.ts +12 -2
  55. package/src/resources/notifications/notifications.ts +390 -36
  56. package/src/resources/providers/providers.ts +8 -5
  57. package/src/resources/routing-strategies.ts +46 -15
  58. package/src/version.ts +1 -1
  59. package/version.d.mts +1 -1
  60. package/version.d.mts.map +1 -1
  61. package/version.d.ts +1 -1
  62. package/version.d.ts.map +1 -1
  63. package/version.js +1 -1
  64. package/version.js.map +1 -1
  65. package/version.mjs +1 -1
  66. package/version.mjs.map +1 -1
  67. package/resources/notifications/draft.d.mts +0 -15
  68. package/resources/notifications/draft.d.mts.map +0 -1
  69. package/resources/notifications/draft.d.ts +0 -15
  70. package/resources/notifications/draft.d.ts.map +0 -1
  71. package/resources/notifications/draft.js +0 -20
  72. package/resources/notifications/draft.js.map +0 -1
  73. package/resources/notifications/draft.mjs +0 -16
  74. package/resources/notifications/draft.mjs.map +0 -1
  75. package/src/resources/notifications/draft.ts +0 -20
@@ -12,15 +12,12 @@ import {
12
12
  CheckUpdateResponse,
13
13
  Checks,
14
14
  } from './checks';
15
- import * as DraftAPI from './draft';
16
- import { Draft } from './draft';
17
15
  import { APIPromise } from '../../core/api-promise';
18
16
  import { buildHeaders } from '../../internal/headers';
19
17
  import { RequestOptions } from '../../internal/request-options';
20
18
  import { path } from '../../internal/utils/path';
21
19
 
22
20
  export class Notifications extends APIResource {
23
- draft: DraftAPI.Draft = new DraftAPI.Draft(this._client);
24
21
  checks: ChecksAPI.Checks = new ChecksAPI.Checks(this._client);
25
22
 
26
23
  /**
@@ -29,7 +26,7 @@ export class Notifications extends APIResource {
29
26
  *
30
27
  * @example
31
28
  * ```ts
32
- * const notificationTemplateMutationResponse =
29
+ * const notificationTemplateGetResponse =
33
30
  * await client.notifications.create({
34
31
  * notification: {
35
32
  * name: 'Welcome Email',
@@ -49,7 +46,7 @@ export class Notifications extends APIResource {
49
46
  create(
50
47
  body: NotificationCreateParams,
51
48
  options?: RequestOptions,
52
- ): APIPromise<NotificationTemplateMutationResponse> {
49
+ ): APIPromise<NotificationTemplateGetResponse> {
53
50
  return this._client.post('/notifications', { body, ...options });
54
51
  }
55
52
 
@@ -139,12 +136,88 @@ export class Notifications extends APIResource {
139
136
  });
140
137
  }
141
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
+
142
215
  /**
143
216
  * Replace a notification template. All fields are required.
144
217
  *
145
218
  * @example
146
219
  * ```ts
147
- * const notificationTemplateMutationResponse =
220
+ * const notificationTemplateGetResponse =
148
221
  * await client.notifications.replace('id', {
149
222
  * notification: {
150
223
  * name: 'Updated Name',
@@ -165,19 +238,29 @@ export class Notifications extends APIResource {
165
238
  id: string,
166
239
  body: NotificationReplaceParams,
167
240
  options?: RequestOptions,
168
- ): APIPromise<NotificationTemplateMutationResponse> {
241
+ ): APIPromise<NotificationTemplateGetResponse> {
169
242
  return this._client.put(path`/notifications/${id}`, { body, ...options });
170
243
  }
171
244
 
172
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
+ *
173
251
  * @example
174
252
  * ```ts
175
- * const notificationGetContent =
176
- * await client.notifications.retrieveContent('id');
253
+ * const response = await client.notifications.retrieveContent(
254
+ * 'id',
255
+ * );
177
256
  * ```
178
257
  */
179
- retrieveContent(id: string, options?: RequestOptions): APIPromise<NotificationGetContent> {
180
- return this._client.get(path`/notifications/${id}/content`, options);
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 });
181
264
  }
182
265
  }
183
266
 
@@ -193,6 +276,145 @@ export interface Check extends BaseCheck {
193
276
  updated: number;
194
277
  }
195
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
+
196
418
  export interface NotificationGetContent {
197
419
  blocks?: Array<NotificationGetContent.Block> | null;
198
420
 
@@ -259,6 +481,33 @@ export namespace NotificationGetContent {
259
481
  }
260
482
  }
261
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
+
262
511
  /**
263
512
  * Request body for creating a notification template.
264
513
  */
@@ -326,27 +575,6 @@ export namespace NotificationTemplateGetResponse {
326
575
  }
327
576
  }
328
577
 
329
- /**
330
- * Response returned by POST and PUT operations.
331
- */
332
- export interface NotificationTemplateMutationResponse {
333
- notification: NotificationTemplateMutationResponse.Notification;
334
-
335
- /**
336
- * The template state after the operation. Always uppercase.
337
- */
338
- state: 'DRAFT' | 'PUBLISHED';
339
- }
340
-
341
- export namespace NotificationTemplateMutationResponse {
342
- export interface Notification {
343
- /**
344
- * The ID of the created or updated template.
345
- */
346
- id: string;
347
- }
348
- }
349
-
350
578
  /**
351
579
  * Full document shape used in POST and PUT request bodies, and returned inside the
352
580
  * GET response envelope.
@@ -417,6 +645,11 @@ export interface NotificationTemplatePublishRequest {
417
645
  version?: string;
418
646
  }
419
647
 
648
+ /**
649
+ * Template state. Defaults to `DRAFT`.
650
+ */
651
+ export type NotificationTemplateState = 'DRAFT' | 'PUBLISHED';
652
+
420
653
  /**
421
654
  * V2 (CDS) template summary returned in list responses.
422
655
  */
@@ -548,6 +781,12 @@ export namespace NotificationListResponse {
548
781
  }
549
782
  }
550
783
 
784
+ /**
785
+ * Elemental content response for V2 templates. Contains versioned elements with
786
+ * content checksums.
787
+ */
788
+ export type NotificationRetrieveContentResponse = NotificationContentGetResponse | NotificationGetContent;
789
+
551
790
  export interface NotificationCreateParams {
552
791
  /**
553
792
  * Full document shape used in POST and PUT request bodies, and returned inside the
@@ -606,6 +845,105 @@ export interface NotificationPublishParams {
606
845
  version?: string;
607
846
  }
608
847
 
848
+ export interface NotificationPutContentParams {
849
+ /**
850
+ * Elemental content payload. The server defaults `version` when omitted.
851
+ */
852
+ content: NotificationPutContentParams.Content;
853
+
854
+ /**
855
+ * Template state. Defaults to `DRAFT`.
856
+ */
857
+ state?: NotificationTemplateState;
858
+ }
859
+
860
+ export namespace NotificationPutContentParams {
861
+ /**
862
+ * Elemental content payload. The server defaults `version` when omitted.
863
+ */
864
+ export interface Content {
865
+ elements: Array<Shared.ElementalNode>;
866
+
867
+ /**
868
+ * Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
869
+ * omitted.
870
+ */
871
+ version?: string;
872
+ }
873
+ }
874
+
875
+ export interface NotificationPutElementParams {
876
+ /**
877
+ * Path param: Notification template ID (`nt_` prefix).
878
+ */
879
+ id: string;
880
+
881
+ /**
882
+ * Body param: Element type (text, meta, action, image, etc.).
883
+ */
884
+ type: string;
885
+
886
+ /**
887
+ * Body param
888
+ */
889
+ channels?: Array<string>;
890
+
891
+ /**
892
+ * Body param
893
+ */
894
+ data?: { [key: string]: unknown };
895
+
896
+ /**
897
+ * Body param
898
+ */
899
+ if?: string;
900
+
901
+ /**
902
+ * Body param
903
+ */
904
+ loop?: string;
905
+
906
+ /**
907
+ * Body param
908
+ */
909
+ ref?: string;
910
+
911
+ /**
912
+ * Body param: Template state. Defaults to `DRAFT`.
913
+ */
914
+ state?: NotificationTemplateState;
915
+
916
+ [k: string]: unknown;
917
+ }
918
+
919
+ export interface NotificationPutLocaleParams {
920
+ /**
921
+ * Path param: Notification template ID (`nt_` prefix).
922
+ */
923
+ id: string;
924
+
925
+ /**
926
+ * Body param: Elements with locale-specific content overrides.
927
+ */
928
+ elements: Array<NotificationPutLocaleParams.Element>;
929
+
930
+ /**
931
+ * Body param: Template state. Defaults to `DRAFT`.
932
+ */
933
+ state?: NotificationTemplateState;
934
+ }
935
+
936
+ export namespace NotificationPutLocaleParams {
937
+ export interface Element {
938
+ /**
939
+ * Target element ID.
940
+ */
941
+ id: string;
942
+
943
+ [k: string]: unknown;
944
+ }
945
+ }
946
+
609
947
  export interface NotificationReplaceParams {
610
948
  /**
611
949
  * Full document shape used in POST and PUT request bodies, and returned inside the
@@ -620,34 +958,50 @@ export interface NotificationReplaceParams {
620
958
  state?: 'DRAFT' | 'PUBLISHED';
621
959
  }
622
960
 
623
- Notifications.Draft = Draft;
961
+ export interface NotificationRetrieveContentParams {
962
+ /**
963
+ * Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to
964
+ * `published`.
965
+ */
966
+ version?: string;
967
+ }
968
+
624
969
  Notifications.Checks = Checks;
625
970
 
626
971
  export declare namespace Notifications {
627
972
  export {
628
973
  type BaseCheck as BaseCheck,
629
974
  type Check as Check,
975
+ type ElementWithChecksums as ElementWithChecksums,
976
+ type NotificationContentGetResponse as NotificationContentGetResponse,
977
+ type NotificationContentMutationResponse as NotificationContentMutationResponse,
978
+ type NotificationContentPutRequest as NotificationContentPutRequest,
979
+ type NotificationElementPutRequest as NotificationElementPutRequest,
630
980
  type NotificationGetContent as NotificationGetContent,
981
+ type NotificationLocalePutRequest as NotificationLocalePutRequest,
631
982
  type NotificationTemplateCreateRequest as NotificationTemplateCreateRequest,
632
983
  type NotificationTemplateGetResponse as NotificationTemplateGetResponse,
633
- type NotificationTemplateMutationResponse as NotificationTemplateMutationResponse,
634
984
  type NotificationTemplatePayload as NotificationTemplatePayload,
635
985
  type NotificationTemplatePublishRequest as NotificationTemplatePublishRequest,
986
+ type NotificationTemplateState as NotificationTemplateState,
636
987
  type NotificationTemplateSummary as NotificationTemplateSummary,
637
988
  type NotificationTemplateUpdateRequest as NotificationTemplateUpdateRequest,
638
989
  type NotificationTemplateVersionListResponse as NotificationTemplateVersionListResponse,
639
990
  type VersionNode as VersionNode,
640
991
  type NotificationListResponse as NotificationListResponse,
992
+ type NotificationRetrieveContentResponse as NotificationRetrieveContentResponse,
641
993
  type NotificationCreateParams as NotificationCreateParams,
642
994
  type NotificationRetrieveParams as NotificationRetrieveParams,
643
995
  type NotificationListParams as NotificationListParams,
644
996
  type NotificationListVersionsParams as NotificationListVersionsParams,
645
997
  type NotificationPublishParams as NotificationPublishParams,
998
+ type NotificationPutContentParams as NotificationPutContentParams,
999
+ type NotificationPutElementParams as NotificationPutElementParams,
1000
+ type NotificationPutLocaleParams as NotificationPutLocaleParams,
646
1001
  type NotificationReplaceParams as NotificationReplaceParams,
1002
+ type NotificationRetrieveContentParams as NotificationRetrieveContentParams,
647
1003
  };
648
1004
 
649
- export { Draft as Draft };
650
-
651
1005
  export {
652
1006
  Checks as Checks,
653
1007
  type CheckUpdateResponse as CheckUpdateResponse,
@@ -28,12 +28,14 @@ export class Providers extends APIResource {
28
28
  }
29
29
 
30
30
  /**
31
- * Update an existing provider configuration. The `provider` key is required. All
32
- * other fields are optional omitted fields are cleared from the stored
33
- * configuration (this is a full replacement, not a partial merge).
31
+ * Replace an existing provider configuration. The `provider` key is required and
32
+ * determines which provider-specific settings schema is applied. All other fields
33
+ * are optional omitted fields are cleared from the stored configuration (this is
34
+ * a full replacement, not a partial merge). Changing the provider type for an
35
+ * existing configuration is not supported.
34
36
  */
35
37
  update(id: string, body: ProviderUpdateParams, options?: RequestOptions): APIPromise<Provider> {
36
- return this._client.post(path`/providers/${id}`, { body, ...options });
38
+ return this._client.put(path`/providers/${id}`, { body, ...options });
37
39
  }
38
40
 
39
41
  /**
@@ -191,7 +193,8 @@ export interface ProviderCreateParams {
191
193
 
192
194
  export interface ProviderUpdateParams {
193
195
  /**
194
- * The provider key identifying the type.
196
+ * The provider key identifying the type. Required on every request because it
197
+ * selects the provider-specific settings schema for validation.
195
198
  */
196
199
  provider: string;
197
200
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as Shared from './shared';
5
+ import * as NotificationsAPI from './notifications/notifications';
5
6
  import { APIPromise } from '../core/api-promise';
6
7
  import { buildHeaders } from '../internal/headers';
7
8
  import { RequestOptions } from '../internal/request-options';
@@ -14,7 +15,7 @@ export class RoutingStrategies extends APIResource {
14
15
  *
15
16
  * @example
16
17
  * ```ts
17
- * const routingStrategyMutationResponse =
18
+ * const routingStrategyGetResponse =
18
19
  * await client.routingStrategies.create({
19
20
  * name: 'Email via SendGrid',
20
21
  * routing: { method: 'single', channels: ['email'] },
@@ -29,7 +30,7 @@ export class RoutingStrategies extends APIResource {
29
30
  create(
30
31
  body: RoutingStrategyCreateParams,
31
32
  options?: RequestOptions,
32
- ): APIPromise<RoutingStrategyMutationResponse> {
33
+ ): APIPromise<RoutingStrategyGetResponse> {
33
34
  return this._client.post('/routing-strategies', { body, ...options });
34
35
  }
35
36
 
@@ -81,13 +82,31 @@ export class RoutingStrategies extends APIResource {
81
82
  });
82
83
  }
83
84
 
85
+ /**
86
+ * List notification templates associated with a routing strategy. Includes
87
+ * template metadata only, not full content.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const associatedNotificationListResponse =
92
+ * await client.routingStrategies.listNotifications('id');
93
+ * ```
94
+ */
95
+ listNotifications(
96
+ id: string,
97
+ query: RoutingStrategyListNotificationsParams | null | undefined = {},
98
+ options?: RequestOptions,
99
+ ): APIPromise<AssociatedNotificationListResponse> {
100
+ return this._client.get(path`/routing-strategies/${id}/notifications`, { query, ...options });
101
+ }
102
+
84
103
  /**
85
104
  * Replace a routing strategy. Full document replacement; the caller must send the
86
105
  * complete desired state. Missing optional fields are cleared.
87
106
  *
88
107
  * @example
89
108
  * ```ts
90
- * const routingStrategyMutationResponse =
109
+ * const routingStrategyGetResponse =
91
110
  * await client.routingStrategies.replace('id', {
92
111
  * name: 'Email via SendGrid v2',
93
112
  * routing: { method: 'single', channels: ['email'] },
@@ -102,11 +121,20 @@ export class RoutingStrategies extends APIResource {
102
121
  id: string,
103
122
  body: RoutingStrategyReplaceParams,
104
123
  options?: RequestOptions,
105
- ): APIPromise<RoutingStrategyMutationResponse> {
124
+ ): APIPromise<RoutingStrategyGetResponse> {
106
125
  return this._client.put(path`/routing-strategies/${id}`, { body, ...options });
107
126
  }
108
127
  }
109
128
 
129
+ /**
130
+ * Paginated list of notification templates associated with a routing strategy.
131
+ */
132
+ export interface AssociatedNotificationListResponse {
133
+ paging: Shared.Paging;
134
+
135
+ results: Array<NotificationsAPI.NotificationTemplateSummary>;
136
+ }
137
+
110
138
  /**
111
139
  * Request body for creating a routing strategy.
112
140
  */
@@ -211,16 +239,6 @@ export interface RoutingStrategyListResponse {
211
239
  results: Array<RoutingStrategySummary>;
212
240
  }
213
241
 
214
- /**
215
- * Response returned by create and replace operations.
216
- */
217
- export interface RoutingStrategyMutationResponse {
218
- /**
219
- * The routing strategy ID (rs\_ prefix).
220
- */
221
- id: string;
222
- }
223
-
224
242
  /**
225
243
  * Request body for replacing a routing strategy. Full document replacement;
226
244
  * missing optional fields are cleared.
@@ -347,6 +365,18 @@ export interface RoutingStrategyListParams {
347
365
  limit?: number;
348
366
  }
349
367
 
368
+ export interface RoutingStrategyListNotificationsParams {
369
+ /**
370
+ * Opaque pagination cursor from a previous response. Omit for the first page.
371
+ */
372
+ cursor?: string | null;
373
+
374
+ /**
375
+ * Maximum number of results per page. Default 20, max 100.
376
+ */
377
+ limit?: number;
378
+ }
379
+
350
380
  export interface RoutingStrategyReplaceParams {
351
381
  /**
352
382
  * Human-readable name for the routing strategy.
@@ -381,14 +411,15 @@ export interface RoutingStrategyReplaceParams {
381
411
 
382
412
  export declare namespace RoutingStrategies {
383
413
  export {
414
+ type AssociatedNotificationListResponse as AssociatedNotificationListResponse,
384
415
  type RoutingStrategyCreateRequest as RoutingStrategyCreateRequest,
385
416
  type RoutingStrategyGetResponse as RoutingStrategyGetResponse,
386
417
  type RoutingStrategyListResponse as RoutingStrategyListResponse,
387
- type RoutingStrategyMutationResponse as RoutingStrategyMutationResponse,
388
418
  type RoutingStrategyReplaceRequest as RoutingStrategyReplaceRequest,
389
419
  type RoutingStrategySummary as RoutingStrategySummary,
390
420
  type RoutingStrategyCreateParams as RoutingStrategyCreateParams,
391
421
  type RoutingStrategyListParams as RoutingStrategyListParams,
422
+ type RoutingStrategyListNotificationsParams as RoutingStrategyListNotificationsParams,
392
423
  type RoutingStrategyReplaceParams as RoutingStrategyReplaceParams,
393
424
  };
394
425
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.9.0'; // x-release-please-version
1
+ export const VERSION = '7.10.1'; // x-release-please-version