@trycourier/courier 7.7.1 → 7.8.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.
@@ -0,0 +1,174 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
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
+ }
@@ -61,18 +61,6 @@ export interface MessageDetails {
61
61
  */
62
62
  id: string;
63
63
 
64
- /**
65
- * A UTC timestamp at which the recipient clicked on a tracked link for the first
66
- * time. Stored as a millisecond representation of the Unix epoch.
67
- */
68
- clicked: number;
69
-
70
- /**
71
- * A UTC timestamp at which the Integration provider delivered the message. Stored
72
- * as a millisecond representation of the Unix epoch.
73
- */
74
- delivered: number;
75
-
76
64
  /**
77
65
  * A UTC timestamp at which Courier received the message request. Stored as a
78
66
  * millisecond representation of the Unix epoch.
@@ -89,23 +77,11 @@ export interface MessageDetails {
89
77
  */
90
78
  notification: string;
91
79
 
92
- /**
93
- * A UTC timestamp at which the recipient opened a message for the first time.
94
- * Stored as a millisecond representation of the Unix epoch.
95
- */
96
- opened: number;
97
-
98
80
  /**
99
81
  * A unique identifier associated with the recipient of the delivered message.
100
82
  */
101
83
  recipient: string;
102
84
 
103
- /**
104
- * A UTC timestamp at which Courier passed the message to the Integration provider.
105
- * Stored as a millisecond representation of the Unix epoch.
106
- */
107
- sent: number;
108
-
109
85
  /**
110
86
  * The current status of the message.
111
87
  */
@@ -126,11 +102,29 @@ export interface MessageDetails {
126
102
  | 'UNMAPPED'
127
103
  | 'UNROUTABLE';
128
104
 
105
+ /**
106
+ * A UTC timestamp at which the recipient clicked on a tracked link for the first
107
+ * time. Stored as a millisecond representation of the Unix epoch.
108
+ */
109
+ clicked?: number;
110
+
111
+ /**
112
+ * A UTC timestamp at which the Integration provider delivered the message. Stored
113
+ * as a millisecond representation of the Unix epoch.
114
+ */
115
+ delivered?: number;
116
+
129
117
  /**
130
118
  * A message describing the error that occurred.
131
119
  */
132
120
  error?: string | null;
133
121
 
122
+ /**
123
+ * A UTC timestamp at which the recipient opened a message for the first time.
124
+ * Stored as a millisecond representation of the Unix epoch.
125
+ */
126
+ opened?: number;
127
+
134
128
  /**
135
129
  * The reason for the current status of the message.
136
130
  */
@@ -145,6 +139,12 @@ export interface MessageDetails {
145
139
  | 'UNPUBLISHED'
146
140
  | 'UNSUBSCRIBED'
147
141
  | null;
142
+
143
+ /**
144
+ * A UTC timestamp at which Courier passed the message to the Integration provider.
145
+ * Stored as a millisecond representation of the Unix epoch.
146
+ */
147
+ sent?: number;
148
148
  }
149
149
 
150
150
  export interface MessageRetrieveResponse extends MessageDetails {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.7.1'; // x-release-please-version
1
+ export const VERSION = '7.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.7.1";
1
+ export declare const VERSION = "7.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.7.1";
1
+ export declare const VERSION = "7.8.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.7.1'; // x-release-please-version
4
+ exports.VERSION = '7.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '7.7.1'; // x-release-please-version
1
+ export const VERSION = '7.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map