@trycourier/courier 8.0.0 → 9.1.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 (94) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +5 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -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/automations/automations.d.mts +82 -1
  10. package/resources/automations/automations.d.mts.map +1 -1
  11. package/resources/automations/automations.d.ts +82 -1
  12. package/resources/automations/automations.d.ts.map +1 -1
  13. package/resources/automations/automations.js +4 -0
  14. package/resources/automations/automations.js.map +1 -1
  15. package/resources/automations/automations.mjs +4 -0
  16. package/resources/automations/automations.mjs.map +1 -1
  17. package/resources/automations/index.d.mts +2 -1
  18. package/resources/automations/index.d.mts.map +1 -1
  19. package/resources/automations/index.d.ts +2 -1
  20. package/resources/automations/index.d.ts.map +1 -1
  21. package/resources/automations/index.js +3 -1
  22. package/resources/automations/index.js.map +1 -1
  23. package/resources/automations/index.mjs +1 -0
  24. package/resources/automations/index.mjs.map +1 -1
  25. package/resources/automations/runs.d.mts +69 -0
  26. package/resources/automations/runs.d.mts.map +1 -0
  27. package/resources/automations/runs.d.ts +69 -0
  28. package/resources/automations/runs.d.ts.map +1 -0
  29. package/resources/automations/runs.js +43 -0
  30. package/resources/automations/runs.js.map +1 -0
  31. package/resources/automations/runs.mjs +39 -0
  32. package/resources/automations/runs.mjs.map +1 -0
  33. package/resources/index.d.mts +2 -2
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +2 -2
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js.map +1 -1
  38. package/resources/index.mjs.map +1 -1
  39. package/resources/journeys/index.d.mts +2 -1
  40. package/resources/journeys/index.d.mts.map +1 -1
  41. package/resources/journeys/index.d.ts +2 -1
  42. package/resources/journeys/index.d.ts.map +1 -1
  43. package/resources/journeys/index.js +3 -1
  44. package/resources/journeys/index.js.map +1 -1
  45. package/resources/journeys/index.mjs +1 -0
  46. package/resources/journeys/index.mjs.map +1 -1
  47. package/resources/journeys/journeys.d.mts +183 -4
  48. package/resources/journeys/journeys.d.mts.map +1 -1
  49. package/resources/journeys/journeys.d.ts +183 -4
  50. package/resources/journeys/journeys.d.ts.map +1 -1
  51. package/resources/journeys/journeys.js +4 -0
  52. package/resources/journeys/journeys.js.map +1 -1
  53. package/resources/journeys/journeys.mjs +4 -0
  54. package/resources/journeys/journeys.mjs.map +1 -1
  55. package/resources/journeys/runs.d.mts +83 -0
  56. package/resources/journeys/runs.d.mts.map +1 -0
  57. package/resources/journeys/runs.d.ts +83 -0
  58. package/resources/journeys/runs.d.ts.map +1 -0
  59. package/resources/journeys/runs.js +59 -0
  60. package/resources/journeys/runs.js.map +1 -0
  61. package/resources/journeys/runs.mjs +55 -0
  62. package/resources/journeys/runs.mjs.map +1 -0
  63. package/resources/notifications/notifications.d.mts +0 -12
  64. package/resources/notifications/notifications.d.mts.map +1 -1
  65. package/resources/notifications/notifications.d.ts +0 -12
  66. package/resources/notifications/notifications.d.ts.map +1 -1
  67. package/resources/notifications/notifications.js +0 -14
  68. package/resources/notifications/notifications.js.map +1 -1
  69. package/resources/notifications/notifications.mjs +0 -14
  70. package/resources/notifications/notifications.mjs.map +1 -1
  71. package/resources/shared.d.mts +23 -2
  72. package/resources/shared.d.mts.map +1 -1
  73. package/resources/shared.d.ts +23 -2
  74. package/resources/shared.d.ts.map +1 -1
  75. package/resources/users/preferences.d.mts +12 -0
  76. package/resources/users/preferences.d.mts.map +1 -1
  77. package/resources/users/preferences.d.ts +12 -0
  78. package/resources/users/preferences.d.ts.map +1 -1
  79. package/src/client.ts +25 -0
  80. package/src/resources/automations/automations.ts +101 -0
  81. package/src/resources/automations/index.ts +5 -0
  82. package/src/resources/automations/runs.ts +87 -0
  83. package/src/resources/index.ts +12 -0
  84. package/src/resources/journeys/index.ts +9 -0
  85. package/src/resources/journeys/journeys.ts +226 -2
  86. package/src/resources/journeys/runs.ts +104 -0
  87. package/src/resources/notifications/notifications.ts +0 -15
  88. package/src/resources/shared.ts +24 -2
  89. package/src/resources/users/preferences.ts +14 -0
  90. package/src/version.ts +1 -1
  91. package/version.d.mts +1 -1
  92. package/version.d.ts +1 -1
  93. package/version.js +1 -1
  94. package/version.mjs +1 -1
@@ -0,0 +1,104 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as JourneysAPI from './journeys';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+
9
+ /**
10
+ * Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
11
+ */
12
+ export class Runs extends APIResource {
13
+ /**
14
+ * Fetch one Journey run by id. Returns `404` for an unknown run, a run belonging
15
+ * to another workspace, a run past the 95-day retention window, or an Automation
16
+ * run id — the same body in every case, so the response never reveals whether a
17
+ * run exists elsewhere.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const journeyRunResponse =
22
+ * await client.journeys.runs.retrieve('x');
23
+ * ```
24
+ */
25
+ retrieve(runID: string, options?: RequestOptions): APIPromise<JourneysAPI.JourneyRunResponse> {
26
+ return this._client.get(path`/journeys/runs/${runID}`, options);
27
+ }
28
+
29
+ /**
30
+ * List runs of the workspace's Journeys, newest first, filtered by status,
31
+ * Journey, or date range and paged by cursor. Runs of v2 Automations are listed by
32
+ * `GET /automations/runs` instead — the two surfaces never return each other's
33
+ * runs. Runs are retained for 95 days.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const journeyRunListResponse =
38
+ * await client.journeys.runs.list();
39
+ * ```
40
+ */
41
+ list(
42
+ query: RunListParams | null | undefined = {},
43
+ options?: RequestOptions,
44
+ ): APIPromise<JourneysAPI.JourneyRunListResponse> {
45
+ return this._client.get('/journeys/runs', { query, ...options });
46
+ }
47
+
48
+ /**
49
+ * List the per-node state of one Journey run, in full — this endpoint is not
50
+ * paginated. Each step's `node_id` is the id of the node in the published Journey,
51
+ * so a step maps directly onto the Journey graph. `message_id` is present on send
52
+ * steps that produced a message; follow it to `GET /messages/{message_id}` for
53
+ * delivery status.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const journeyRunStepsResponse =
58
+ * await client.journeys.runs.listSteps('x');
59
+ * ```
60
+ */
61
+ listSteps(runID: string, options?: RequestOptions): APIPromise<JourneysAPI.JourneyRunStepsResponse> {
62
+ return this._client.get(path`/journeys/runs/${runID}/steps`, options);
63
+ }
64
+ }
65
+
66
+ export interface RunListParams {
67
+ /**
68
+ * A cursor token for pagination. Use the `next_cursor` from the previous response
69
+ * to fetch the next page of results. Treat it as opaque.
70
+ */
71
+ cursor?: string;
72
+
73
+ /**
74
+ * An inclusive upper bound on `created_at`, in the same format as `start_date`.
75
+ */
76
+ end_date?: string;
77
+
78
+ /**
79
+ * The number of runs to return per page, between `1` and `50`. Defaults to `20`.
80
+ * Values outside the range are clamped, and a non-numeric value falls back to
81
+ * `20`.
82
+ */
83
+ limit?: string;
84
+
85
+ /**
86
+ * An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
87
+ * `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
88
+ */
89
+ start_date?: string;
90
+
91
+ /**
92
+ * A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
93
+ */
94
+ status?: string;
95
+
96
+ /**
97
+ * A comma-separated list of Journey ids to filter on.
98
+ */
99
+ template_id?: string;
100
+ }
101
+
102
+ export declare namespace Runs {
103
+ export { type RunListParams as RunListParams };
104
+ }
@@ -124,21 +124,6 @@ export class Notifications extends APIResource {
124
124
  });
125
125
  }
126
126
 
127
- /**
128
- * Copies a notification template within the same workspace and environment,
129
- * appending " COPY" to the title. The copy is standalone and independently
130
- * editable.
131
- *
132
- * @example
133
- * ```ts
134
- * const notificationTemplateResponse =
135
- * await client.notifications.duplicate('id');
136
- * ```
137
- */
138
- duplicate(id: string, options?: RequestOptions): APIPromise<NotificationTemplateResponse> {
139
- return this._client.post(path`/notifications/${id}/duplicate`, options);
140
- }
141
-
142
127
  /**
143
128
  * Returns a notification template's published versions, most recent first, for
144
129
  * comparison or rollback. Paged.
@@ -14,6 +14,13 @@ export interface AirshipProfileAudience {
14
14
 
15
15
  export type Alignment = 'center' | 'left' | 'right' | 'full';
16
16
 
17
+ /**
18
+ * Apple Push Notification device tokens. Supply either a single `token` or a
19
+ * `tokens` value. A bare string is rejected by the provider — the token must be
20
+ * wrapped in this object.
21
+ */
22
+ export type Apn = Token | MultipleTokens;
23
+
17
24
  export interface AudienceFilter {
18
25
  /**
19
26
  * Send to users only if they are member of the account
@@ -259,6 +266,9 @@ export interface ElementalTextNodeWithType extends ElementalBaseNode {
259
266
  type?: 'text';
260
267
  }
261
268
 
269
+ /**
270
+ * Expo push tokens. Supply either a single `token` or a `tokens` value.
271
+ */
262
272
  export type Expo = Token | MultipleTokens;
263
273
 
264
274
  /**
@@ -394,7 +404,11 @@ export interface MsTeamsRecipient {
394
404
  }
395
405
 
396
406
  export interface MultipleTokens {
397
- tokens: Array<Token>;
407
+ /**
408
+ * One device token, or an array of them. The values are the token strings
409
+ * themselves — not objects.
410
+ */
411
+ tokens: string | Array<string>;
398
412
  }
399
413
 
400
414
  export interface NotificationPreferenceDetails {
@@ -550,7 +564,12 @@ export interface UserProfile {
550
564
 
551
565
  airship?: AirshipProfile | null;
552
566
 
553
- apn?: string | null;
567
+ /**
568
+ * Apple Push Notification device tokens. Supply either a single `token` or a
569
+ * `tokens` value. A bare string is rejected by the provider — the token must be
570
+ * wrapped in this object.
571
+ */
572
+ apn?: Apn | null;
554
573
 
555
574
  /**
556
575
  * Routes a push notification through the AWS SNS provider. The target ARN must be
@@ -573,6 +592,9 @@ export interface UserProfile {
573
592
 
574
593
  email_verified?: boolean | null;
575
594
 
595
+ /**
596
+ * Expo push tokens. Supply either a single `token` or a `tokens` value.
597
+ */
576
598
  expo?: Expo | null;
577
599
 
578
600
  facebookPSID?: string | null;
@@ -244,6 +244,20 @@ export interface TopicPreference {
244
244
  * custom_routing) rather than the topic's default routing.
245
245
  */
246
246
  has_custom_routing?: boolean | null;
247
+
248
+ /**
249
+ * The unique identifier of the section this topic belongs to. Always present when
250
+ * listing a user's preferences; omitted by the single-topic read when the topic
251
+ * has no resolvable section.
252
+ */
253
+ section_id?: string;
254
+
255
+ /**
256
+ * The display name of the section this topic belongs to. Always present when
257
+ * listing a user's preferences; omitted by the single-topic read when the topic
258
+ * has no resolvable section.
259
+ */
260
+ section_name?: string;
247
261
  }
248
262
 
249
263
  export interface PreferenceRetrieveResponse {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '8.0.0'; // x-release-please-version
1
+ export const VERSION = '9.1.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "8.0.0";
1
+ export declare const VERSION = "9.1.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "8.0.0";
1
+ export declare const VERSION = "9.1.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 = '8.0.0'; // x-release-please-version
4
+ exports.VERSION = '9.1.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '8.0.0'; // x-release-please-version
1
+ export const VERSION = '9.1.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map