@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.
- package/CHANGELOG.md +33 -0
- package/client.d.mts +16 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +16 -2
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +35 -0
- package/resources/notifications/checks.d.mts.map +1 -1
- package/resources/notifications/checks.d.ts +35 -0
- package/resources/notifications/checks.d.ts.map +1 -1
- package/resources/notifications/checks.js +35 -0
- package/resources/notifications/checks.js.map +1 -1
- package/resources/notifications/checks.mjs +35 -0
- package/resources/notifications/checks.mjs.map +1 -1
- package/resources/notifications/index.d.mts +1 -2
- package/resources/notifications/index.d.mts.map +1 -1
- package/resources/notifications/index.d.ts +1 -2
- package/resources/notifications/index.d.ts.map +1 -1
- package/resources/notifications/index.js +1 -3
- package/resources/notifications/index.js.map +1 -1
- package/resources/notifications/index.mjs +0 -1
- package/resources/notifications/index.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +667 -11
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +667 -11
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +191 -6
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +191 -6
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/providers/catalog.d.mts +40 -0
- package/resources/providers/catalog.d.mts.map +1 -0
- package/resources/providers/catalog.d.ts +40 -0
- package/resources/providers/catalog.d.ts.map +1 -0
- package/resources/providers/catalog.js +18 -0
- package/resources/providers/catalog.js.map +1 -0
- package/resources/providers/catalog.mjs +14 -0
- package/resources/providers/catalog.mjs.map +1 -0
- package/resources/providers/index.d.mts +3 -0
- package/resources/providers/index.d.mts.map +1 -0
- package/resources/providers/index.d.ts +3 -0
- package/resources/providers/index.d.ts.map +1 -0
- package/resources/providers/index.js +9 -0
- package/resources/providers/index.js.map +1 -0
- package/resources/providers/index.mjs +4 -0
- package/resources/providers/index.mjs.map +1 -0
- package/resources/providers/providers.d.mts +182 -0
- package/resources/providers/providers.d.mts.map +1 -0
- package/resources/providers/providers.d.ts +182 -0
- package/resources/providers/providers.d.ts.map +1 -0
- package/resources/providers/providers.js +57 -0
- package/resources/providers/providers.js.map +1 -0
- package/resources/providers/providers.mjs +52 -0
- package/resources/providers/providers.mjs.map +1 -0
- package/resources/providers.d.mts +2 -0
- package/resources/providers.d.mts.map +1 -0
- package/resources/providers.d.ts +2 -0
- package/resources/providers.d.ts.map +1 -0
- package/resources/providers.js +6 -0
- package/resources/providers.js.map +1 -0
- package/resources/providers.mjs +3 -0
- package/resources/providers.mjs.map +1 -0
- package/resources/routing-strategies.d.mts +333 -0
- package/resources/routing-strategies.d.mts.map +1 -0
- package/resources/routing-strategies.d.ts +333 -0
- package/resources/routing-strategies.d.ts.map +1 -0
- package/resources/routing-strategies.js +107 -0
- package/resources/routing-strategies.js.map +1 -0
- package/resources/routing-strategies.mjs +103 -0
- package/resources/routing-strategies.mjs.map +1 -0
- package/resources/send.d.mts +2 -60
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +2 -60
- package/resources/send.d.ts.map +1 -1
- package/resources/shared.d.mts +60 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +60 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/tenants.d.mts +2 -62
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +2 -62
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs.map +1 -1
- package/src/client.ts +112 -0
- package/src/resources/index.ts +49 -0
- package/src/resources/notifications/checks.ts +35 -0
- package/src/resources/notifications/index.ts +26 -1
- package/src/resources/notifications/notifications.ts +858 -13
- package/src/resources/providers/catalog.ts +53 -0
- package/src/resources/providers/index.ts +12 -0
- package/src/resources/providers/providers.ts +240 -0
- package/src/resources/providers.ts +3 -0
- package/src/resources/routing-strategies.ts +436 -0
- package/src/resources/send.ts +2 -67
- package/src/resources/shared.ts +71 -1
- package/src/resources/tenants/tenants.ts +2 -69
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/notifications/draft.d.mts +0 -8
- package/resources/notifications/draft.d.mts.map +0 -1
- package/resources/notifications/draft.d.ts +0 -8
- package/resources/notifications/draft.d.ts.map +0 -1
- package/resources/notifications/draft.js +0 -13
- package/resources/notifications/draft.js.map +0 -1
- package/resources/notifications/draft.mjs +0 -9
- package/resources/notifications/draft.mjs.map +0 -1
- package/src/resources/notifications/draft.ts +0 -13
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as Shared from './shared';
|
|
5
|
+
import * as NotificationsAPI from './notifications/notifications';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { buildHeaders } from '../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class RoutingStrategies extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Create a routing strategy. Requires a name and routing configuration at minimum.
|
|
14
|
+
* Channels and providers default to empty if omitted.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const routingStrategyMutationResponse =
|
|
19
|
+
* await client.routingStrategies.create({
|
|
20
|
+
* name: 'Email via SendGrid',
|
|
21
|
+
* routing: { method: 'single', channels: ['email'] },
|
|
22
|
+
* channels: { email: { providers: ['sendgrid', 'ses'] } },
|
|
23
|
+
* description:
|
|
24
|
+
* 'Routes email through sendgrid with SES failover',
|
|
25
|
+
* providers: { sendgrid: { override: {} } },
|
|
26
|
+
* tags: ['production', 'email'],
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
create(
|
|
31
|
+
body: RoutingStrategyCreateParams,
|
|
32
|
+
options?: RequestOptions,
|
|
33
|
+
): APIPromise<RoutingStrategyMutationResponse> {
|
|
34
|
+
return this._client.post('/routing-strategies', { body, ...options });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve a routing strategy by ID. Returns the full entity including routing
|
|
39
|
+
* content and metadata.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const routingStrategyGetResponse =
|
|
44
|
+
* await client.routingStrategies.retrieve('id');
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<RoutingStrategyGetResponse> {
|
|
48
|
+
return this._client.get(path`/routing-strategies/${id}`, options);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List routing strategies in your workspace. Returns metadata only (no
|
|
53
|
+
* routing/channels/providers content). Use GET /routing-strategies/{id} for full
|
|
54
|
+
* details.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const routingStrategyListResponse =
|
|
59
|
+
* await client.routingStrategies.list();
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
list(
|
|
63
|
+
query: RoutingStrategyListParams | null | undefined = {},
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): APIPromise<RoutingStrategyListResponse> {
|
|
66
|
+
return this._client.get('/routing-strategies', { query, ...options });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Archive a routing strategy. The strategy must not have associated notification
|
|
71
|
+
* templates. Unlink all templates before archiving.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* await client.routingStrategies.archive('id');
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
archive(id: string, options?: RequestOptions): APIPromise<void> {
|
|
79
|
+
return this._client.delete(path`/routing-strategies/${id}`, {
|
|
80
|
+
...options,
|
|
81
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
82
|
+
});
|
|
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
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Replace a routing strategy. Full document replacement; the caller must send the
|
|
105
|
+
* complete desired state. Missing optional fields are cleared.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* const routingStrategyMutationResponse =
|
|
110
|
+
* await client.routingStrategies.replace('id', {
|
|
111
|
+
* name: 'Email via SendGrid v2',
|
|
112
|
+
* routing: { method: 'single', channels: ['email'] },
|
|
113
|
+
* channels: { email: { providers: ['ses', 'sendgrid'] } },
|
|
114
|
+
* description: 'Updated routing with SES primary',
|
|
115
|
+
* providers: { ses: { override: {} } },
|
|
116
|
+
* tags: ['production', 'email', 'v2'],
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
replace(
|
|
121
|
+
id: string,
|
|
122
|
+
body: RoutingStrategyReplaceParams,
|
|
123
|
+
options?: RequestOptions,
|
|
124
|
+
): APIPromise<RoutingStrategyMutationResponse> {
|
|
125
|
+
return this._client.put(path`/routing-strategies/${id}`, { body, ...options });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
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
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Request body for creating a routing strategy.
|
|
140
|
+
*/
|
|
141
|
+
export interface RoutingStrategyCreateRequest {
|
|
142
|
+
/**
|
|
143
|
+
* Human-readable name for the routing strategy.
|
|
144
|
+
*/
|
|
145
|
+
name: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Routing tree defining channel selection method and order.
|
|
149
|
+
*/
|
|
150
|
+
routing: Shared.MessageRouting;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Per-channel delivery configuration. Defaults to empty if omitted.
|
|
154
|
+
*/
|
|
155
|
+
channels?: Shared.MessageChannels | null;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Optional description of the routing strategy.
|
|
159
|
+
*/
|
|
160
|
+
description?: string | null;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Per-provider delivery configuration. Defaults to empty if omitted.
|
|
164
|
+
*/
|
|
165
|
+
providers?: Shared.MessageProviders | null;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Optional tags for categorization.
|
|
169
|
+
*/
|
|
170
|
+
tags?: Array<string> | null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Full routing strategy entity returned by GET.
|
|
175
|
+
*/
|
|
176
|
+
export interface RoutingStrategyGetResponse {
|
|
177
|
+
/**
|
|
178
|
+
* The routing strategy ID (rs\_ prefix).
|
|
179
|
+
*/
|
|
180
|
+
id: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Per-channel delivery configuration. May be empty.
|
|
184
|
+
*/
|
|
185
|
+
channels: Shared.MessageChannels;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Epoch milliseconds when the strategy was created.
|
|
189
|
+
*/
|
|
190
|
+
created: number;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* User ID of the creator.
|
|
194
|
+
*/
|
|
195
|
+
creator: string;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Human-readable name.
|
|
199
|
+
*/
|
|
200
|
+
name: string;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Per-provider delivery configuration. May be empty.
|
|
204
|
+
*/
|
|
205
|
+
providers: Shared.MessageProviders;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Routing tree defining channel selection method and order.
|
|
209
|
+
*/
|
|
210
|
+
routing: Shared.MessageRouting;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Description of the routing strategy.
|
|
214
|
+
*/
|
|
215
|
+
description?: string | null;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Tags for categorization.
|
|
219
|
+
*/
|
|
220
|
+
tags?: Array<string> | null;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Epoch milliseconds of last update.
|
|
224
|
+
*/
|
|
225
|
+
updated?: number | null;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* User ID of the last updater.
|
|
229
|
+
*/
|
|
230
|
+
updater?: string | null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Paginated list of routing strategy summaries.
|
|
235
|
+
*/
|
|
236
|
+
export interface RoutingStrategyListResponse {
|
|
237
|
+
paging: Shared.Paging;
|
|
238
|
+
|
|
239
|
+
results: Array<RoutingStrategySummary>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Response returned by create and replace operations.
|
|
244
|
+
*/
|
|
245
|
+
export interface RoutingStrategyMutationResponse {
|
|
246
|
+
/**
|
|
247
|
+
* The routing strategy ID (rs\_ prefix).
|
|
248
|
+
*/
|
|
249
|
+
id: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Request body for replacing a routing strategy. Full document replacement;
|
|
254
|
+
* missing optional fields are cleared.
|
|
255
|
+
*/
|
|
256
|
+
export interface RoutingStrategyReplaceRequest {
|
|
257
|
+
/**
|
|
258
|
+
* Human-readable name for the routing strategy.
|
|
259
|
+
*/
|
|
260
|
+
name: string;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Routing tree defining channel selection method and order.
|
|
264
|
+
*/
|
|
265
|
+
routing: Shared.MessageRouting;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Per-channel delivery configuration. Omit to clear.
|
|
269
|
+
*/
|
|
270
|
+
channels?: Shared.MessageChannels | null;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Optional description. Omit or null to clear.
|
|
274
|
+
*/
|
|
275
|
+
description?: string | null;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Per-provider delivery configuration. Omit to clear.
|
|
279
|
+
*/
|
|
280
|
+
providers?: Shared.MessageProviders | null;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Optional tags. Omit or null to clear.
|
|
284
|
+
*/
|
|
285
|
+
tags?: Array<string> | null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Routing strategy metadata returned in list responses. Does not include
|
|
290
|
+
* routing/channels/providers content.
|
|
291
|
+
*/
|
|
292
|
+
export interface RoutingStrategySummary {
|
|
293
|
+
/**
|
|
294
|
+
* The routing strategy ID (rs\_ prefix).
|
|
295
|
+
*/
|
|
296
|
+
id: string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Epoch milliseconds when the strategy was created.
|
|
300
|
+
*/
|
|
301
|
+
created: number;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* User ID of the creator.
|
|
305
|
+
*/
|
|
306
|
+
creator: string;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Human-readable name.
|
|
310
|
+
*/
|
|
311
|
+
name: string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Description of the routing strategy.
|
|
315
|
+
*/
|
|
316
|
+
description?: string | null;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Tags for categorization.
|
|
320
|
+
*/
|
|
321
|
+
tags?: Array<string> | null;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Epoch milliseconds of last update.
|
|
325
|
+
*/
|
|
326
|
+
updated?: number | null;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* User ID of the last updater.
|
|
330
|
+
*/
|
|
331
|
+
updater?: string | null;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface RoutingStrategyCreateParams {
|
|
335
|
+
/**
|
|
336
|
+
* Human-readable name for the routing strategy.
|
|
337
|
+
*/
|
|
338
|
+
name: string;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Routing tree defining channel selection method and order.
|
|
342
|
+
*/
|
|
343
|
+
routing: Shared.MessageRouting;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Per-channel delivery configuration. Defaults to empty if omitted.
|
|
347
|
+
*/
|
|
348
|
+
channels?: Shared.MessageChannels | null;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Optional description of the routing strategy.
|
|
352
|
+
*/
|
|
353
|
+
description?: string | null;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Per-provider delivery configuration. Defaults to empty if omitted.
|
|
357
|
+
*/
|
|
358
|
+
providers?: Shared.MessageProviders | null;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Optional tags for categorization.
|
|
362
|
+
*/
|
|
363
|
+
tags?: Array<string> | null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface RoutingStrategyListParams {
|
|
367
|
+
/**
|
|
368
|
+
* Opaque pagination cursor from a previous response. Omit for the first page.
|
|
369
|
+
*/
|
|
370
|
+
cursor?: string | null;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Maximum number of results per page. Default 20, max 100.
|
|
374
|
+
*/
|
|
375
|
+
limit?: number;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface RoutingStrategyListNotificationsParams {
|
|
379
|
+
/**
|
|
380
|
+
* Opaque pagination cursor from a previous response. Omit for the first page.
|
|
381
|
+
*/
|
|
382
|
+
cursor?: string | null;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Maximum number of results per page. Default 20, max 100.
|
|
386
|
+
*/
|
|
387
|
+
limit?: number;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface RoutingStrategyReplaceParams {
|
|
391
|
+
/**
|
|
392
|
+
* Human-readable name for the routing strategy.
|
|
393
|
+
*/
|
|
394
|
+
name: string;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Routing tree defining channel selection method and order.
|
|
398
|
+
*/
|
|
399
|
+
routing: Shared.MessageRouting;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Per-channel delivery configuration. Omit to clear.
|
|
403
|
+
*/
|
|
404
|
+
channels?: Shared.MessageChannels | null;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Optional description. Omit or null to clear.
|
|
408
|
+
*/
|
|
409
|
+
description?: string | null;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Per-provider delivery configuration. Omit to clear.
|
|
413
|
+
*/
|
|
414
|
+
providers?: Shared.MessageProviders | null;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Optional tags. Omit or null to clear.
|
|
418
|
+
*/
|
|
419
|
+
tags?: Array<string> | null;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export declare namespace RoutingStrategies {
|
|
423
|
+
export {
|
|
424
|
+
type AssociatedNotificationListResponse as AssociatedNotificationListResponse,
|
|
425
|
+
type RoutingStrategyCreateRequest as RoutingStrategyCreateRequest,
|
|
426
|
+
type RoutingStrategyGetResponse as RoutingStrategyGetResponse,
|
|
427
|
+
type RoutingStrategyListResponse as RoutingStrategyListResponse,
|
|
428
|
+
type RoutingStrategyMutationResponse as RoutingStrategyMutationResponse,
|
|
429
|
+
type RoutingStrategyReplaceRequest as RoutingStrategyReplaceRequest,
|
|
430
|
+
type RoutingStrategySummary as RoutingStrategySummary,
|
|
431
|
+
type RoutingStrategyCreateParams as RoutingStrategyCreateParams,
|
|
432
|
+
type RoutingStrategyListParams as RoutingStrategyListParams,
|
|
433
|
+
type RoutingStrategyListNotificationsParams as RoutingStrategyListNotificationsParams,
|
|
434
|
+
type RoutingStrategyReplaceParams as RoutingStrategyReplaceParams,
|
|
435
|
+
};
|
|
436
|
+
}
|
package/src/resources/send.ts
CHANGED
|
@@ -55,7 +55,7 @@ export namespace SendMessageParams {
|
|
|
55
55
|
* Define run-time configuration for channels. Valid ChannelId's: email, sms, push,
|
|
56
56
|
* inbox, direct_message, banner, webhook.
|
|
57
57
|
*/
|
|
58
|
-
channels?:
|
|
58
|
+
channels?: Shared.MessageChannels | null;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Describes content that will work for email, inbox, push, chat, or any channel
|
|
@@ -75,7 +75,7 @@ export namespace SendMessageParams {
|
|
|
75
75
|
|
|
76
76
|
preferences?: Message.Preferences | null;
|
|
77
77
|
|
|
78
|
-
providers?:
|
|
78
|
+
providers?: Shared.MessageProviders | null;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Customize which channels/providers Courier may deliver the message through.
|
|
@@ -112,49 +112,6 @@ export namespace SendMessageParams {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export namespace Message {
|
|
115
|
-
export interface Channels {
|
|
116
|
-
/**
|
|
117
|
-
* Brand id used for rendering.
|
|
118
|
-
*/
|
|
119
|
-
brand_id?: string | null;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* JS conditional with access to data/profile.
|
|
123
|
-
*/
|
|
124
|
-
if?: string | null;
|
|
125
|
-
|
|
126
|
-
metadata?: Channels.Metadata | null;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Channel specific overrides.
|
|
130
|
-
*/
|
|
131
|
-
override?: { [key: string]: unknown } | null;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Providers enabled for this channel.
|
|
135
|
-
*/
|
|
136
|
-
providers?: Array<string> | null;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Defaults to `single`.
|
|
140
|
-
*/
|
|
141
|
-
routing_method?: 'all' | 'single' | null;
|
|
142
|
-
|
|
143
|
-
timeouts?: Channels.Timeouts | null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export namespace Channels {
|
|
147
|
-
export interface Metadata {
|
|
148
|
-
utm?: Shared.Utm | null;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface Timeouts {
|
|
152
|
-
channel?: number | null;
|
|
153
|
-
|
|
154
|
-
provider?: number | null;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
115
|
export interface Delay {
|
|
159
116
|
/**
|
|
160
117
|
* The duration of the delay in milliseconds.
|
|
@@ -203,28 +160,6 @@ export namespace SendMessageParams {
|
|
|
203
160
|
subscription_topic_id: string;
|
|
204
161
|
}
|
|
205
162
|
|
|
206
|
-
export interface Providers {
|
|
207
|
-
/**
|
|
208
|
-
* JS conditional with access to data/profile.
|
|
209
|
-
*/
|
|
210
|
-
if?: string | null;
|
|
211
|
-
|
|
212
|
-
metadata?: Providers.Metadata | null;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Provider-specific overrides.
|
|
216
|
-
*/
|
|
217
|
-
override?: { [key: string]: unknown } | null;
|
|
218
|
-
|
|
219
|
-
timeouts?: number | null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export namespace Providers {
|
|
223
|
-
export interface Metadata {
|
|
224
|
-
utm?: Shared.Utm | null;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
163
|
/**
|
|
229
164
|
* Customize which channels/providers Courier may deliver the message through.
|
|
230
165
|
*/
|
package/src/resources/shared.ts
CHANGED
|
@@ -50,8 +50,43 @@ export interface AudienceRecipient {
|
|
|
50
50
|
filters?: Array<AudienceFilter> | null;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
export interface Channel {
|
|
54
|
+
/**
|
|
55
|
+
* Brand id used for rendering.
|
|
56
|
+
*/
|
|
57
|
+
brand_id?: string | null;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* JS conditional with access to data/profile.
|
|
61
|
+
*/
|
|
62
|
+
if?: string | null;
|
|
63
|
+
|
|
64
|
+
metadata?: ChannelMetadata | null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Channel specific overrides.
|
|
68
|
+
*/
|
|
69
|
+
override?: { [key: string]: unknown } | null;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Providers enabled for this channel.
|
|
73
|
+
*/
|
|
74
|
+
providers?: Array<string> | null;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Defaults to `single`.
|
|
78
|
+
*/
|
|
79
|
+
routing_method?: 'all' | 'single' | null;
|
|
80
|
+
|
|
81
|
+
timeouts?: Timeouts | null;
|
|
82
|
+
}
|
|
83
|
+
|
|
53
84
|
export type ChannelClassification = 'direct_message' | 'email' | 'push' | 'sms' | 'webhook' | 'inbox';
|
|
54
85
|
|
|
86
|
+
export interface ChannelMetadata {
|
|
87
|
+
utm?: Utm | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
55
90
|
export interface ChannelPreference {
|
|
56
91
|
channel: ChannelClassification;
|
|
57
92
|
}
|
|
@@ -144,6 +179,10 @@ export interface ElementalDividerNodeWithType extends ElementalBaseNode {
|
|
|
144
179
|
type?: 'divider';
|
|
145
180
|
}
|
|
146
181
|
|
|
182
|
+
export interface ElementalHTMLNodeWithType extends ElementalBaseNode {
|
|
183
|
+
type?: 'html';
|
|
184
|
+
}
|
|
185
|
+
|
|
147
186
|
export interface ElementalImageNodeWithType extends ElementalBaseNode {
|
|
148
187
|
type?: 'image';
|
|
149
188
|
}
|
|
@@ -171,7 +210,8 @@ export type ElementalNode =
|
|
|
171
210
|
| ElementalImageNodeWithType
|
|
172
211
|
| ElementalActionNodeWithType
|
|
173
212
|
| ElementalDividerNodeWithType
|
|
174
|
-
| ElementalQuoteNodeWithType
|
|
213
|
+
| ElementalQuoteNodeWithType
|
|
214
|
+
| ElementalHTMLNodeWithType;
|
|
175
215
|
|
|
176
216
|
export interface ElementalQuoteNodeWithType extends ElementalBaseNode {
|
|
177
217
|
type?: 'quote';
|
|
@@ -256,6 +296,8 @@ export interface ListRecipient {
|
|
|
256
296
|
list_id?: string | null;
|
|
257
297
|
}
|
|
258
298
|
|
|
299
|
+
export type MessageChannels = { [key: string]: Channel };
|
|
300
|
+
|
|
259
301
|
export interface MessageContext {
|
|
260
302
|
/**
|
|
261
303
|
* Tenant id used to load brand/default preferences/context.
|
|
@@ -263,6 +305,24 @@ export interface MessageContext {
|
|
|
263
305
|
tenant_id?: string | null;
|
|
264
306
|
}
|
|
265
307
|
|
|
308
|
+
export type MessageProviders = { [key: string]: MessageProvidersType };
|
|
309
|
+
|
|
310
|
+
export interface MessageProvidersType {
|
|
311
|
+
/**
|
|
312
|
+
* JS conditional with access to data/profile.
|
|
313
|
+
*/
|
|
314
|
+
if?: string | null;
|
|
315
|
+
|
|
316
|
+
metadata?: Metadata | null;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Provider-specific overrides.
|
|
320
|
+
*/
|
|
321
|
+
override?: { [key: string]: unknown } | null;
|
|
322
|
+
|
|
323
|
+
timeouts?: number | null;
|
|
324
|
+
}
|
|
325
|
+
|
|
266
326
|
export interface MessageRouting {
|
|
267
327
|
channels: Array<MessageRoutingChannel>;
|
|
268
328
|
|
|
@@ -271,6 +331,10 @@ export interface MessageRouting {
|
|
|
271
331
|
|
|
272
332
|
export type MessageRoutingChannel = string | MessageRouting;
|
|
273
333
|
|
|
334
|
+
export interface Metadata {
|
|
335
|
+
utm?: Utm | null;
|
|
336
|
+
}
|
|
337
|
+
|
|
274
338
|
export type MsTeams =
|
|
275
339
|
| SendToMsTeamsUserID
|
|
276
340
|
| SendToMsTeamsEmail
|
|
@@ -433,6 +497,12 @@ export interface SlackRecipient {
|
|
|
433
497
|
|
|
434
498
|
export type TextStyle = 'text' | 'h1' | 'h2' | 'subtext';
|
|
435
499
|
|
|
500
|
+
export interface Timeouts {
|
|
501
|
+
channel?: number | null;
|
|
502
|
+
|
|
503
|
+
provider?: number | null;
|
|
504
|
+
}
|
|
505
|
+
|
|
436
506
|
export interface Token {
|
|
437
507
|
token: string;
|
|
438
508
|
}
|