@trycourier/courier 9.4.4 → 9.6.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 (85) hide show
  1. package/CHANGELOG.md +20 -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/package.json +1 -1
  9. package/resources/brands.d.mts +39 -1
  10. package/resources/brands.d.mts.map +1 -1
  11. package/resources/brands.d.ts +39 -1
  12. package/resources/brands.d.ts.map +1 -1
  13. package/resources/broadcasts.d.mts +1 -1
  14. package/resources/broadcasts.d.ts +1 -1
  15. package/resources/broadcasts.js +1 -1
  16. package/resources/broadcasts.mjs +1 -1
  17. package/resources/digests/digests.d.mts +59 -1
  18. package/resources/digests/digests.d.mts.map +1 -1
  19. package/resources/digests/digests.d.ts +59 -1
  20. package/resources/digests/digests.d.ts.map +1 -1
  21. package/resources/digests/digests.js.map +1 -1
  22. package/resources/digests/digests.mjs.map +1 -1
  23. package/resources/digests/index.d.mts +1 -1
  24. package/resources/digests/index.d.mts.map +1 -1
  25. package/resources/digests/index.d.ts +1 -1
  26. package/resources/digests/index.d.ts.map +1 -1
  27. package/resources/digests/index.js.map +1 -1
  28. package/resources/digests/index.mjs.map +1 -1
  29. package/resources/index.d.mts +2 -2
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +2 -2
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/journeys/journeys.d.mts +21 -2
  36. package/resources/journeys/journeys.d.mts.map +1 -1
  37. package/resources/journeys/journeys.d.ts +21 -2
  38. package/resources/journeys/journeys.d.ts.map +1 -1
  39. package/resources/journeys/journeys.js.map +1 -1
  40. package/resources/journeys/journeys.mjs.map +1 -1
  41. package/resources/users/preferences.d.mts +15 -0
  42. package/resources/users/preferences.d.mts.map +1 -1
  43. package/resources/users/preferences.d.ts +15 -0
  44. package/resources/users/preferences.d.ts.map +1 -1
  45. package/resources/users/tokens.d.mts +18 -6
  46. package/resources/users/tokens.d.mts.map +1 -1
  47. package/resources/users/tokens.d.ts +18 -6
  48. package/resources/users/tokens.d.ts.map +1 -1
  49. package/resources/workspace-preferences/index.d.mts +2 -2
  50. package/resources/workspace-preferences/index.d.mts.map +1 -1
  51. package/resources/workspace-preferences/index.d.ts +2 -2
  52. package/resources/workspace-preferences/index.d.ts.map +1 -1
  53. package/resources/workspace-preferences/index.js.map +1 -1
  54. package/resources/workspace-preferences/index.mjs.map +1 -1
  55. package/resources/workspace-preferences/topics.d.mts +82 -4
  56. package/resources/workspace-preferences/topics.d.mts.map +1 -1
  57. package/resources/workspace-preferences/topics.d.ts +82 -4
  58. package/resources/workspace-preferences/topics.d.ts.map +1 -1
  59. package/resources/workspace-preferences/topics.js +48 -3
  60. package/resources/workspace-preferences/topics.js.map +1 -1
  61. package/resources/workspace-preferences/topics.mjs +48 -3
  62. package/resources/workspace-preferences/topics.mjs.map +1 -1
  63. package/resources/workspace-preferences/workspace-preferences.d.mts +193 -3
  64. package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -1
  65. package/resources/workspace-preferences/workspace-preferences.d.ts +193 -3
  66. package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -1
  67. package/resources/workspace-preferences/workspace-preferences.js.map +1 -1
  68. package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -1
  69. package/src/client.ts +16 -0
  70. package/src/resources/brands.ts +51 -2
  71. package/src/resources/broadcasts.ts +1 -1
  72. package/src/resources/digests/digests.ts +81 -0
  73. package/src/resources/digests/index.ts +3 -0
  74. package/src/resources/index.ts +8 -0
  75. package/src/resources/journeys/journeys.ts +21 -2
  76. package/src/resources/users/preferences.ts +17 -0
  77. package/src/resources/users/tokens.ts +16 -6
  78. package/src/resources/workspace-preferences/index.ts +7 -0
  79. package/src/resources/workspace-preferences/topics.ts +108 -3
  80. package/src/resources/workspace-preferences/workspace-preferences.ts +229 -0
  81. package/src/version.ts +1 -1
  82. package/version.d.mts +1 -1
  83. package/version.d.ts +1 -1
  84. package/version.js +1 -1
  85. package/version.mjs +1 -1
@@ -2,10 +2,13 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as Shared from '../shared';
5
+ import * as DigestsAPI from '../digests/digests';
5
6
  import * as TopicsAPI from './topics';
6
7
  import {
7
8
  TopicArchiveParams,
8
9
  TopicCreateParams,
10
+ TopicDeleteDigestParams,
11
+ TopicReleaseDigestParams,
9
12
  TopicReplaceParams,
10
13
  TopicRetrieveParams,
11
14
  Topics,
@@ -215,6 +218,198 @@ export interface PublishPreferencesResponse {
215
218
  published_by?: string | null;
216
219
  }
217
220
 
221
+ /**
222
+ * How events collected under a category key are retained when a digest holds more
223
+ * than it will render.
224
+ */
225
+ export interface TopicDigestCategory {
226
+ /**
227
+ * The key that identifies the category within the digest.
228
+ */
229
+ category_key: string;
230
+
231
+ /**
232
+ * How many collected events are carried into the rendered digest. Defaults to 10.
233
+ *
234
+ * Events beyond the limit are discarded, not held back for the next digest: the
235
+ * release consumes everything collected so far and only `limit` of them appear.
236
+ * `retain` decides which ones those are.
237
+ */
238
+ limit?: number;
239
+
240
+ /**
241
+ * Which collected events survive the `limit`. `FIRST` and `LOWEST` keep the
242
+ * earliest or smallest; `LAST` and `HIGHEST` keep the latest or largest. Accepted
243
+ * case-insensitively, returned uppercase.
244
+ */
245
+ retain?: 'FIRST' | 'LAST' | 'HIGHEST' | 'LOWEST' | 'NONE';
246
+
247
+ /**
248
+ * The data key used to rank events. Required when `retain` is `HIGHEST` or
249
+ * `LOWEST`.
250
+ */
251
+ sort_key?: string;
252
+ }
253
+
254
+ /**
255
+ * Which recipient's held digest to release.
256
+ */
257
+ export interface TopicDigestReleaseRequest {
258
+ /**
259
+ * The recipient whose digest to release. Required: there is no "release everyone
260
+ * on this topic" form, because a whole-schedule flush already has its own endpoint
261
+ * and a body-shaped difference between one recipient and all of them is too easy
262
+ * to get wrong.
263
+ */
264
+ user_id: string;
265
+
266
+ /**
267
+ * The recipient's tenant, when they were sent to as part of one -- the same value
268
+ * returned as `tenant_id` on a digest instance and sent as
269
+ * `message.context.tenant_id`. It is part of the held digest's key, so a tenanted
270
+ * recipient cannot be found without it. Omit for an ordinary recipient.
271
+ */
272
+ tenant_id?: string;
273
+ }
274
+
275
+ /**
276
+ * A topic's digest configuration: the template that renders it, the cadences it
277
+ * delivers on, and how collected events are retained.
278
+ *
279
+ * Send `null` for the whole object to turn a digest off, which unlinks the
280
+ * template and removes its schedules. There is no `enabled` flag, and
281
+ * `schedules: []` is rejected, because both states are un-deliverable rather than
282
+ * merely off.
283
+ */
284
+ export interface TopicDigestRequest {
285
+ /**
286
+ * The cadences this digest delivers on. At least one is required: a digest with no
287
+ * schedule collects events into an instance that can never fire. Omitting the key
288
+ * on a replace leaves stored schedules untouched; sending `[]` is a `400`.
289
+ */
290
+ schedules: Array<TopicDigestScheduleRequest>;
291
+
292
+ /**
293
+ * The notification template that renders the digest. A digest with no template
294
+ * collects nothing, so this is required.
295
+ */
296
+ template_id: string;
297
+
298
+ /**
299
+ * Optional audience the digest is scoped to.
300
+ */
301
+ audience_id?: string;
302
+
303
+ /**
304
+ * Retention rules per category key. Defaults to a single `digest` category
305
+ * retaining `FIRST`.
306
+ */
307
+ categories?: Array<TopicDigestCategory>;
308
+
309
+ /**
310
+ * Whether to deliver the digest even when nothing was collected.
311
+ */
312
+ trigger_empty?: boolean;
313
+ }
314
+
315
+ /**
316
+ * A topic's digest configuration.
317
+ */
318
+ export interface TopicDigestResponse {
319
+ /**
320
+ * Retention rules per category key.
321
+ */
322
+ categories: Array<TopicDigestCategory>;
323
+
324
+ /**
325
+ * The digest's delivery cadences, each with its server-assigned `schedule_id`.
326
+ */
327
+ schedules: Array<DigestsAPI.TopicDigestScheduleResponse>;
328
+
329
+ /**
330
+ * The notification template that renders the digest.
331
+ */
332
+ template_id: string;
333
+
334
+ /**
335
+ * The audience the digest is scoped to, when set.
336
+ */
337
+ audience_id?: string;
338
+
339
+ /**
340
+ * ISO-8601 timestamp of when the digest was configured.
341
+ */
342
+ created?: string;
343
+
344
+ /**
345
+ * Whether the digest is delivered even when nothing was collected.
346
+ */
347
+ trigger_empty?: boolean;
348
+
349
+ /**
350
+ * ISO-8601 timestamp of the last update.
351
+ */
352
+ updated?: string;
353
+ }
354
+
355
+ /**
356
+ * One delivery cadence for a topic's digest. Supply `schedule_id` to update an
357
+ * existing schedule in place; omit it and one is assigned and returned. The
358
+ * `schedules` array is a full replacement, so a stored schedule absent from it is
359
+ * deleted along with its delivery rule.
360
+ */
361
+ export interface TopicDigestScheduleRequest {
362
+ /**
363
+ * How often a digest is delivered. `instant` delivers immediately without
364
+ * batching, and is the one value that takes no `time`.
365
+ */
366
+ frequency: DigestsAPI.DigestFrequency;
367
+
368
+ /**
369
+ * Required when `frequency` is `monthly`.
370
+ */
371
+ day_of_month?: number;
372
+
373
+ /**
374
+ * Required when `frequency` is `weekly`.
375
+ */
376
+ day_of_week?: DigestsAPI.DigestDayOfWeek;
377
+
378
+ /**
379
+ * Required when `frequency` is `custom_days`.
380
+ */
381
+ days_of_week?: Array<DigestsAPI.DigestDayOfWeek>;
382
+
383
+ /**
384
+ * Whether the schedule is disabled.
385
+ */
386
+ disabled?: boolean;
387
+
388
+ /**
389
+ * The schedule recipients are placed on when they have not chosen one. Set this
390
+ * explicitly rather than relying on array position.
391
+ */
392
+ is_default?: boolean;
393
+
394
+ /**
395
+ * Identifier of an existing schedule to update. Omit when creating a new one.
396
+ */
397
+ schedule_id?: string;
398
+
399
+ /**
400
+ * 24-hour local delivery time, `HH:MM`. Required for every frequency except
401
+ * `instant`.
402
+ */
403
+ time?: string;
404
+
405
+ /**
406
+ * IANA timezone the `time` and day fields are expressed in, e.g.
407
+ * `America/New_York`. Absent means UTC. Delivery follows the same local wall-clock
408
+ * across daylight-saving changes.
409
+ */
410
+ timezone?: string;
411
+ }
412
+
218
413
  /**
219
414
  * Request body for creating a workspace preference.
220
415
  */
@@ -354,6 +549,17 @@ export interface WorkspacePreferenceTopicCreateRequest {
354
549
  */
355
550
  description?: string | null;
356
551
 
552
+ /**
553
+ * A topic's digest configuration: the template that renders it, the cadences it
554
+ * delivers on, and how collected events are retained.
555
+ *
556
+ * Send `null` for the whole object to turn a digest off, which unlinks the
557
+ * template and removes its schedules. There is no `enabled` flag, and
558
+ * `schedules: []` is rejected, because both states are un-deliverable rather than
559
+ * merely off.
560
+ */
561
+ digest?: TopicDigestRequest | null;
562
+
357
563
  /**
358
564
  * Whether to include a list-unsubscribe header on emails for this topic.
359
565
  */
@@ -429,6 +635,11 @@ export interface WorkspacePreferenceTopicGetResponse {
429
635
  */
430
636
  description?: string | null;
431
637
 
638
+ /**
639
+ * A topic's digest configuration.
640
+ */
641
+ digest?: TopicDigestResponse | null;
642
+
432
643
  /**
433
644
  * Id of the last updater.
434
645
  */
@@ -468,6 +679,17 @@ export interface WorkspacePreferenceTopicReplaceRequest {
468
679
  */
469
680
  description?: string | null;
470
681
 
682
+ /**
683
+ * A topic's digest configuration: the template that renders it, the cadences it
684
+ * delivers on, and how collected events are retained.
685
+ *
686
+ * Send `null` for the whole object to turn a digest off, which unlinks the
687
+ * template and removes its schedules. There is no `enabled` flag, and
688
+ * `schedules: []` is rejected, because both states are un-deliverable rather than
689
+ * merely off.
690
+ */
691
+ digest?: TopicDigestRequest | null;
692
+
471
693
  /**
472
694
  * Whether to include a list-unsubscribe header on emails for this topic.
473
695
  */
@@ -592,6 +814,11 @@ export declare namespace WorkspacePreferences {
592
814
  export {
593
815
  type PublishPreferencesRequest as PublishPreferencesRequest,
594
816
  type PublishPreferencesResponse as PublishPreferencesResponse,
817
+ type TopicDigestCategory as TopicDigestCategory,
818
+ type TopicDigestReleaseRequest as TopicDigestReleaseRequest,
819
+ type TopicDigestRequest as TopicDigestRequest,
820
+ type TopicDigestResponse as TopicDigestResponse,
821
+ type TopicDigestScheduleRequest as TopicDigestScheduleRequest,
595
822
  type WorkspacePreferenceCreateRequest as WorkspacePreferenceCreateRequest,
596
823
  type WorkspacePreferenceGetResponse as WorkspacePreferenceGetResponse,
597
824
  type WorkspacePreferenceListResponse as WorkspacePreferenceListResponse,
@@ -610,6 +837,8 @@ export declare namespace WorkspacePreferences {
610
837
  type TopicCreateParams as TopicCreateParams,
611
838
  type TopicRetrieveParams as TopicRetrieveParams,
612
839
  type TopicArchiveParams as TopicArchiveParams,
840
+ type TopicDeleteDigestParams as TopicDeleteDigestParams,
841
+ type TopicReleaseDigestParams as TopicReleaseDigestParams,
613
842
  type TopicReplaceParams as TopicReplaceParams,
614
843
  };
615
844
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '9.4.4'; // x-release-please-version
1
+ export const VERSION = '9.6.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.4.4";
1
+ export declare const VERSION = "9.6.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.4.4";
1
+ export declare const VERSION = "9.6.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 = '9.4.4'; // x-release-please-version
4
+ exports.VERSION = '9.6.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '9.4.4'; // x-release-please-version
1
+ export const VERSION = '9.6.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map