@trycourier/courier 7.7.1 → 7.9.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 +45 -0
- package/client.d.mts +19 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +19 -2
- package/client.d.ts.map +1 -1
- package/client.js +15 -5
- package/client.js.map +1 -1
- package/client.mjs +15 -5
- package/client.mjs.map +1 -1
- package/package.json +12 -1
- package/resources/index.d.mts +4 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/journeys.d.mts +143 -0
- package/resources/journeys.d.mts.map +1 -0
- package/resources/journeys.d.ts +143 -0
- package/resources/journeys.d.ts.map +1 -0
- package/resources/journeys.js +38 -0
- package/resources/journeys.js.map +1 -0
- package/resources/journeys.mjs +34 -0
- package/resources/journeys.mjs.map +1 -0
- package/resources/messages.d.mts +20 -20
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +20 -20
- package/resources/messages.d.ts.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/draft.d.mts +7 -0
- package/resources/notifications/draft.d.mts.map +1 -1
- package/resources/notifications/draft.d.ts +7 -0
- package/resources/notifications/draft.d.ts.map +1 -1
- package/resources/notifications/draft.js +7 -0
- package/resources/notifications/draft.js.map +1 -1
- package/resources/notifications/draft.mjs +7 -0
- package/resources/notifications/draft.mjs.map +1 -1
- package/resources/notifications/index.d.mts +1 -1
- package/resources/notifications/index.d.mts.map +1 -1
- package/resources/notifications/index.d.ts +1 -1
- package/resources/notifications/index.d.ts.map +1 -1
- package/resources/notifications/index.js.map +1 -1
- package/resources/notifications/index.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +369 -6
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +369 -6
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +122 -0
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +122 -0
- 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 +304 -0
- package/resources/routing-strategies.d.mts.map +1 -0
- package/resources/routing-strategies.d.ts +304 -0
- package/resources/routing-strategies.d.ts.map +1 -0
- package/resources/routing-strategies.js +94 -0
- package/resources/routing-strategies.js.map +1 -0
- package/resources/routing-strategies.mjs +90 -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 +111 -5
- package/src/resources/index.ts +44 -0
- package/src/resources/journeys.ts +174 -0
- package/src/resources/messages.ts +24 -24
- package/src/resources/notifications/checks.ts +35 -0
- package/src/resources/notifications/draft.ts +7 -0
- package/src/resources/notifications/index.ts +14 -0
- package/src/resources/notifications/notifications.ts +474 -5
- 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 +394 -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.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as NotificationsAPI from "./notifications.js";
|
|
2
3
|
import * as Shared from "../shared.js";
|
|
3
4
|
import * as ChecksAPI from "./checks.js";
|
|
4
5
|
import { CheckDeleteParams, CheckListParams, CheckListResponse, CheckUpdateParams, CheckUpdateResponse, Checks } from "./checks.js";
|
|
@@ -9,7 +10,109 @@ import { RequestOptions } from "../../internal/request-options.js";
|
|
|
9
10
|
export declare class Notifications extends APIResource {
|
|
10
11
|
draft: DraftAPI.Draft;
|
|
11
12
|
checks: ChecksAPI.Checks;
|
|
13
|
+
/**
|
|
14
|
+
* Create a notification template. Requires all fields in the notification object.
|
|
15
|
+
* Templates are created in draft state by default.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const notificationTemplateMutationResponse =
|
|
20
|
+
* await client.notifications.create({
|
|
21
|
+
* notification: {
|
|
22
|
+
* name: 'Welcome Email',
|
|
23
|
+
* tags: ['onboarding', 'welcome'],
|
|
24
|
+
* brand: { id: 'brand_abc' },
|
|
25
|
+
* subscription: { topic_id: 'marketing' },
|
|
26
|
+
* routing: { strategy_id: 'rs_123' },
|
|
27
|
+
* content: {
|
|
28
|
+
* version: '2022-01-01',
|
|
29
|
+
* elements: [{ type: 'channel' }],
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* state: 'DRAFT',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
create(body: NotificationCreateParams, options?: RequestOptions): APIPromise<NotificationTemplateMutationResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve a notification template by ID. Returns the published version by
|
|
39
|
+
* default. Pass version=draft to retrieve an unpublished template.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const notificationTemplateGetResponse =
|
|
44
|
+
* await client.notifications.retrieve('id');
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
retrieve(id: string, query?: NotificationRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<NotificationTemplateGetResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* List notification templates in your workspace.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const notifications = await client.notifications.list();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
12
56
|
list(query?: NotificationListParams | null | undefined, options?: RequestOptions): APIPromise<NotificationListResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Archive a notification template.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.notifications.archive('id');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
archive(id: string, options?: RequestOptions): APIPromise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* List versions of a notification template.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const notificationTemplateVersionListResponse =
|
|
72
|
+
* await client.notifications.listVersions('id');
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
listVersions(id: string, query?: NotificationListVersionsParams | null | undefined, options?: RequestOptions): APIPromise<NotificationTemplateVersionListResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Publish a notification template. Publishes the current draft by default. Pass a
|
|
78
|
+
* version in the request body to publish a specific historical version.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* await client.notifications.publish('id');
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
publish(id: string, body?: NotificationPublishParams | null | undefined, options?: RequestOptions): APIPromise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Replace a notification template. All fields are required.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const notificationTemplateMutationResponse =
|
|
92
|
+
* await client.notifications.replace('id', {
|
|
93
|
+
* notification: {
|
|
94
|
+
* name: 'Updated Name',
|
|
95
|
+
* tags: ['updated'],
|
|
96
|
+
* brand: null,
|
|
97
|
+
* subscription: null,
|
|
98
|
+
* routing: null,
|
|
99
|
+
* content: {
|
|
100
|
+
* version: '2022-01-01',
|
|
101
|
+
* elements: [{ type: 'channel' }],
|
|
102
|
+
* },
|
|
103
|
+
* },
|
|
104
|
+
* state: 'PUBLISHED',
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
replace(id: string, body: NotificationReplaceParams, options?: RequestOptions): APIPromise<NotificationTemplateMutationResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const notificationGetContent =
|
|
113
|
+
* await client.notifications.retrieveContent('id');
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
13
116
|
retrieveContent(id: string, options?: RequestOptions): APIPromise<NotificationGetContent>;
|
|
14
117
|
}
|
|
15
118
|
export interface BaseCheck {
|
|
@@ -67,12 +170,218 @@ export declare namespace NotificationGetContent {
|
|
|
67
170
|
}
|
|
68
171
|
}
|
|
69
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Request body for creating a notification template.
|
|
175
|
+
*/
|
|
176
|
+
export interface NotificationTemplateCreateRequest {
|
|
177
|
+
/**
|
|
178
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
179
|
+
* GET response envelope.
|
|
180
|
+
*/
|
|
181
|
+
notification: NotificationTemplatePayload;
|
|
182
|
+
/**
|
|
183
|
+
* Template state after creation. Case-insensitive input, normalized to uppercase
|
|
184
|
+
* in the response. Defaults to "DRAFT".
|
|
185
|
+
*/
|
|
186
|
+
state?: 'DRAFT' | 'PUBLISHED';
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Envelope response for GET /notifications/{id}. The notification object mirrors
|
|
190
|
+
* the POST/PUT input shape. Nullable fields return null when unset.
|
|
191
|
+
*/
|
|
192
|
+
export interface NotificationTemplateGetResponse {
|
|
193
|
+
/**
|
|
194
|
+
* Epoch milliseconds when the template was created.
|
|
195
|
+
*/
|
|
196
|
+
created: number;
|
|
197
|
+
/**
|
|
198
|
+
* User ID of the creator.
|
|
199
|
+
*/
|
|
200
|
+
creator: string;
|
|
201
|
+
/**
|
|
202
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
203
|
+
* GET response envelope.
|
|
204
|
+
*/
|
|
205
|
+
notification: NotificationTemplateGetResponse.Notification;
|
|
206
|
+
/**
|
|
207
|
+
* The template state. Always uppercase.
|
|
208
|
+
*/
|
|
209
|
+
state: 'DRAFT' | 'PUBLISHED';
|
|
210
|
+
/**
|
|
211
|
+
* Epoch milliseconds of last update.
|
|
212
|
+
*/
|
|
213
|
+
updated?: number;
|
|
214
|
+
/**
|
|
215
|
+
* User ID of the last updater.
|
|
216
|
+
*/
|
|
217
|
+
updater?: string;
|
|
218
|
+
}
|
|
219
|
+
export declare namespace NotificationTemplateGetResponse {
|
|
220
|
+
/**
|
|
221
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
222
|
+
* GET response envelope.
|
|
223
|
+
*/
|
|
224
|
+
interface Notification extends NotificationsAPI.NotificationTemplatePayload {
|
|
225
|
+
/**
|
|
226
|
+
* The template ID.
|
|
227
|
+
*/
|
|
228
|
+
id: string;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Response returned by POST and PUT operations.
|
|
233
|
+
*/
|
|
234
|
+
export interface NotificationTemplateMutationResponse {
|
|
235
|
+
notification: NotificationTemplateMutationResponse.Notification;
|
|
236
|
+
/**
|
|
237
|
+
* The template state after the operation. Always uppercase.
|
|
238
|
+
*/
|
|
239
|
+
state: 'DRAFT' | 'PUBLISHED';
|
|
240
|
+
}
|
|
241
|
+
export declare namespace NotificationTemplateMutationResponse {
|
|
242
|
+
interface Notification {
|
|
243
|
+
/**
|
|
244
|
+
* The ID of the created or updated template.
|
|
245
|
+
*/
|
|
246
|
+
id: string;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
251
|
+
* GET response envelope.
|
|
252
|
+
*/
|
|
253
|
+
export interface NotificationTemplatePayload {
|
|
254
|
+
/**
|
|
255
|
+
* Brand reference, or null for no brand.
|
|
256
|
+
*/
|
|
257
|
+
brand: NotificationTemplatePayload.Brand | null;
|
|
258
|
+
/**
|
|
259
|
+
* Elemental content definition.
|
|
260
|
+
*/
|
|
261
|
+
content: Shared.ElementalContent;
|
|
262
|
+
/**
|
|
263
|
+
* Display name for the template.
|
|
264
|
+
*/
|
|
265
|
+
name: string;
|
|
266
|
+
/**
|
|
267
|
+
* Routing strategy reference, or null for none.
|
|
268
|
+
*/
|
|
269
|
+
routing: NotificationTemplatePayload.Routing | null;
|
|
270
|
+
/**
|
|
271
|
+
* Subscription topic reference, or null for none.
|
|
272
|
+
*/
|
|
273
|
+
subscription: NotificationTemplatePayload.Subscription | null;
|
|
274
|
+
/**
|
|
275
|
+
* Tags for categorization. Send empty array for none.
|
|
276
|
+
*/
|
|
277
|
+
tags: Array<string>;
|
|
278
|
+
}
|
|
279
|
+
export declare namespace NotificationTemplatePayload {
|
|
280
|
+
/**
|
|
281
|
+
* Brand reference, or null for no brand.
|
|
282
|
+
*/
|
|
283
|
+
interface Brand {
|
|
284
|
+
id: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Routing strategy reference, or null for none.
|
|
288
|
+
*/
|
|
289
|
+
interface Routing {
|
|
290
|
+
strategy_id: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Subscription topic reference, or null for none.
|
|
294
|
+
*/
|
|
295
|
+
interface Subscription {
|
|
296
|
+
topic_id: string;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Optional request body for publishing a notification template. Omit or send an
|
|
301
|
+
* empty object to publish the current draft.
|
|
302
|
+
*/
|
|
303
|
+
export interface NotificationTemplatePublishRequest {
|
|
304
|
+
/**
|
|
305
|
+
* Historical version to publish (e.g. "v001"). Omit to publish the current draft.
|
|
306
|
+
*/
|
|
307
|
+
version?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* V2 (CDS) template summary returned in list responses.
|
|
311
|
+
*/
|
|
312
|
+
export interface NotificationTemplateSummary {
|
|
313
|
+
id: string;
|
|
314
|
+
/**
|
|
315
|
+
* Epoch milliseconds when the template was created.
|
|
316
|
+
*/
|
|
317
|
+
created: number;
|
|
318
|
+
/**
|
|
319
|
+
* User ID of the creator.
|
|
320
|
+
*/
|
|
321
|
+
creator: string;
|
|
322
|
+
name: string;
|
|
323
|
+
state: 'DRAFT' | 'PUBLISHED';
|
|
324
|
+
tags: Array<string>;
|
|
325
|
+
/**
|
|
326
|
+
* Epoch milliseconds of last update.
|
|
327
|
+
*/
|
|
328
|
+
updated?: number;
|
|
329
|
+
/**
|
|
330
|
+
* User ID of the last updater.
|
|
331
|
+
*/
|
|
332
|
+
updater?: string;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Request body for replacing a notification template. Same shape as create. All
|
|
336
|
+
* fields required (PUT = full replacement).
|
|
337
|
+
*/
|
|
338
|
+
export interface NotificationTemplateUpdateRequest {
|
|
339
|
+
/**
|
|
340
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
341
|
+
* GET response envelope.
|
|
342
|
+
*/
|
|
343
|
+
notification: NotificationTemplatePayload;
|
|
344
|
+
/**
|
|
345
|
+
* Template state after update. Case-insensitive input, normalized to uppercase in
|
|
346
|
+
* the response. Defaults to "DRAFT".
|
|
347
|
+
*/
|
|
348
|
+
state?: 'DRAFT' | 'PUBLISHED';
|
|
349
|
+
}
|
|
350
|
+
export interface NotificationTemplateVersionListResponse {
|
|
351
|
+
paging: Shared.Paging;
|
|
352
|
+
versions: Array<VersionNode>;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* A version entry for a notification template.
|
|
356
|
+
*/
|
|
357
|
+
export interface VersionNode {
|
|
358
|
+
/**
|
|
359
|
+
* Epoch milliseconds when this version was created.
|
|
360
|
+
*/
|
|
361
|
+
created: number;
|
|
362
|
+
/**
|
|
363
|
+
* User ID of the version creator.
|
|
364
|
+
*/
|
|
365
|
+
creator: string;
|
|
366
|
+
/**
|
|
367
|
+
* Version identifier. One of "draft", "published:vNNN" (current published
|
|
368
|
+
* version), or "vNNN" (historical version).
|
|
369
|
+
*/
|
|
370
|
+
version: string;
|
|
371
|
+
/**
|
|
372
|
+
* Whether the draft has unpublished changes. Only present on the draft version.
|
|
373
|
+
*/
|
|
374
|
+
has_changes?: boolean;
|
|
375
|
+
}
|
|
70
376
|
export interface NotificationListResponse {
|
|
71
377
|
paging: Shared.Paging;
|
|
72
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Notification templates in this workspace.
|
|
380
|
+
*/
|
|
381
|
+
results: Array<NotificationListResponse.Notification | NotificationTemplateSummary>;
|
|
73
382
|
}
|
|
74
383
|
export declare namespace NotificationListResponse {
|
|
75
|
-
interface
|
|
384
|
+
interface Notification {
|
|
76
385
|
id: string;
|
|
77
386
|
created_at: number;
|
|
78
387
|
/**
|
|
@@ -83,10 +392,10 @@ export declare namespace NotificationListResponse {
|
|
|
83
392
|
routing: Shared.MessageRouting;
|
|
84
393
|
topic_id: string;
|
|
85
394
|
updated_at: number;
|
|
86
|
-
tags?:
|
|
395
|
+
tags?: Notification.Tags | null;
|
|
87
396
|
title?: string | null;
|
|
88
397
|
}
|
|
89
|
-
namespace
|
|
398
|
+
namespace Notification {
|
|
90
399
|
interface Tags {
|
|
91
400
|
data: Array<Tags.Data>;
|
|
92
401
|
}
|
|
@@ -98,15 +407,69 @@ export declare namespace NotificationListResponse {
|
|
|
98
407
|
}
|
|
99
408
|
}
|
|
100
409
|
}
|
|
410
|
+
export interface NotificationCreateParams {
|
|
411
|
+
/**
|
|
412
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
413
|
+
* GET response envelope.
|
|
414
|
+
*/
|
|
415
|
+
notification: NotificationTemplatePayload;
|
|
416
|
+
/**
|
|
417
|
+
* Template state after creation. Case-insensitive input, normalized to uppercase
|
|
418
|
+
* in the response. Defaults to "DRAFT".
|
|
419
|
+
*/
|
|
420
|
+
state?: 'DRAFT' | 'PUBLISHED';
|
|
421
|
+
}
|
|
422
|
+
export interface NotificationRetrieveParams {
|
|
423
|
+
/**
|
|
424
|
+
* Version to retrieve. One of "draft", "published", or a version string like
|
|
425
|
+
* "v001". Defaults to "published".
|
|
426
|
+
*/
|
|
427
|
+
version?: string;
|
|
428
|
+
}
|
|
101
429
|
export interface NotificationListParams {
|
|
430
|
+
/**
|
|
431
|
+
* Opaque pagination cursor from a previous response. Omit for the first page.
|
|
432
|
+
*/
|
|
102
433
|
cursor?: string | null;
|
|
103
434
|
/**
|
|
104
|
-
*
|
|
435
|
+
* Filter to templates linked to this event map ID.
|
|
436
|
+
*/
|
|
437
|
+
event_id?: string;
|
|
438
|
+
/**
|
|
439
|
+
* Include template notes in the response. Only applies to legacy templates.
|
|
105
440
|
*/
|
|
106
441
|
notes?: boolean | null;
|
|
107
442
|
}
|
|
443
|
+
export interface NotificationListVersionsParams {
|
|
444
|
+
/**
|
|
445
|
+
* Opaque pagination cursor from a previous response. Omit for the first page.
|
|
446
|
+
*/
|
|
447
|
+
cursor?: string;
|
|
448
|
+
/**
|
|
449
|
+
* Maximum number of versions to return per page. Default 10, max 10.
|
|
450
|
+
*/
|
|
451
|
+
limit?: number;
|
|
452
|
+
}
|
|
453
|
+
export interface NotificationPublishParams {
|
|
454
|
+
/**
|
|
455
|
+
* Historical version to publish (e.g. "v001"). Omit to publish the current draft.
|
|
456
|
+
*/
|
|
457
|
+
version?: string;
|
|
458
|
+
}
|
|
459
|
+
export interface NotificationReplaceParams {
|
|
460
|
+
/**
|
|
461
|
+
* Full document shape used in POST and PUT request bodies, and returned inside the
|
|
462
|
+
* GET response envelope.
|
|
463
|
+
*/
|
|
464
|
+
notification: NotificationTemplatePayload;
|
|
465
|
+
/**
|
|
466
|
+
* Template state after update. Case-insensitive input, normalized to uppercase in
|
|
467
|
+
* the response. Defaults to "DRAFT".
|
|
468
|
+
*/
|
|
469
|
+
state?: 'DRAFT' | 'PUBLISHED';
|
|
470
|
+
}
|
|
108
471
|
export declare namespace Notifications {
|
|
109
|
-
export { type BaseCheck as BaseCheck, type Check as Check, type NotificationGetContent as NotificationGetContent, type NotificationListResponse as NotificationListResponse, type NotificationListParams as NotificationListParams, };
|
|
472
|
+
export { type BaseCheck as BaseCheck, type Check as Check, type NotificationGetContent as NotificationGetContent, type NotificationTemplateCreateRequest as NotificationTemplateCreateRequest, type NotificationTemplateGetResponse as NotificationTemplateGetResponse, type NotificationTemplateMutationResponse as NotificationTemplateMutationResponse, type NotificationTemplatePayload as NotificationTemplatePayload, type NotificationTemplatePublishRequest as NotificationTemplatePublishRequest, type NotificationTemplateSummary as NotificationTemplateSummary, type NotificationTemplateUpdateRequest as NotificationTemplateUpdateRequest, type NotificationTemplateVersionListResponse as NotificationTemplateVersionListResponse, type VersionNode as VersionNode, type NotificationListResponse as NotificationListResponse, type NotificationCreateParams as NotificationCreateParams, type NotificationRetrieveParams as NotificationRetrieveParams, type NotificationListParams as NotificationListParams, type NotificationListVersionsParams as NotificationListVersionsParams, type NotificationPublishParams as NotificationPublishParams, type NotificationReplaceParams as NotificationReplaceParams, };
|
|
110
473
|
export { Draft as Draft };
|
|
111
474
|
export { Checks as Checks, type CheckUpdateResponse as CheckUpdateResponse, type CheckListResponse as CheckListResponse, type CheckUpdateParams as CheckUpdateParams, type CheckListParams as CheckListParams, type CheckDeleteParams as CheckDeleteParams, };
|
|
112
475
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/resources/notifications/notifications.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,SAAS;OACd,EACL,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACP;OACM,KAAK,QAAQ;OACb,EAAE,KAAK,EAAE;OACT,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/resources/notifications/notifications.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,KAAK,MAAM;OACX,KAAK,SAAS;OACd,EACL,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACP;OACM,KAAK,QAAQ;OACb,EAAE,KAAK,EAAE;OACT,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;IACzD,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;IAE9D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CACJ,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oCAAoC,CAAC;IAInD;;;;;;;;;OASG;IACH,QAAQ,CACN,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,0BAA0B,GAAG,IAAI,GAAG,SAAc,EACzD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,+BAA+B,CAAC;IAI9C;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO/D;;;;;;;;OAQG;IACH,YAAY,CACV,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,8BAA8B,GAAG,IAAI,GAAG,SAAc,EAC7D,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,uCAAuC,CAAC;IAItD;;;;;;;;OAQG;IACH,OAAO,CACL,EAAE,EAAE,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iB,GAC5C,CAAC;CACH"}
|
|
@@ -8,6 +8,7 @@ const ChecksAPI = tslib_1.__importStar(require("./checks.js"));
|
|
|
8
8
|
const checks_1 = require("./checks.js");
|
|
9
9
|
const DraftAPI = tslib_1.__importStar(require("./draft.js"));
|
|
10
10
|
const draft_1 = require("./draft.js");
|
|
11
|
+
const headers_1 = require("../../internal/headers.js");
|
|
11
12
|
const path_1 = require("../../internal/utils/path.js");
|
|
12
13
|
class Notifications extends resource_1.APIResource {
|
|
13
14
|
constructor() {
|
|
@@ -15,9 +16,130 @@ class Notifications extends resource_1.APIResource {
|
|
|
15
16
|
this.draft = new DraftAPI.Draft(this._client);
|
|
16
17
|
this.checks = new ChecksAPI.Checks(this._client);
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a notification template. Requires all fields in the notification object.
|
|
21
|
+
* Templates are created in draft state by default.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const notificationTemplateMutationResponse =
|
|
26
|
+
* await client.notifications.create({
|
|
27
|
+
* notification: {
|
|
28
|
+
* name: 'Welcome Email',
|
|
29
|
+
* tags: ['onboarding', 'welcome'],
|
|
30
|
+
* brand: { id: 'brand_abc' },
|
|
31
|
+
* subscription: { topic_id: 'marketing' },
|
|
32
|
+
* routing: { strategy_id: 'rs_123' },
|
|
33
|
+
* content: {
|
|
34
|
+
* version: '2022-01-01',
|
|
35
|
+
* elements: [{ type: 'channel' }],
|
|
36
|
+
* },
|
|
37
|
+
* },
|
|
38
|
+
* state: 'DRAFT',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
create(body, options) {
|
|
43
|
+
return this._client.post('/notifications', { body, ...options });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Retrieve a notification template by ID. Returns the published version by
|
|
47
|
+
* default. Pass version=draft to retrieve an unpublished template.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const notificationTemplateGetResponse =
|
|
52
|
+
* await client.notifications.retrieve('id');
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
retrieve(id, query = {}, options) {
|
|
56
|
+
return this._client.get((0, path_1.path) `/notifications/${id}`, { query, ...options });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* List notification templates in your workspace.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const notifications = await client.notifications.list();
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
18
66
|
list(query = {}, options) {
|
|
19
67
|
return this._client.get('/notifications', { query, ...options });
|
|
20
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Archive a notification template.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* await client.notifications.archive('id');
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
archive(id, options) {
|
|
78
|
+
return this._client.delete((0, path_1.path) `/notifications/${id}`, {
|
|
79
|
+
...options,
|
|
80
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* List versions of a notification template.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const notificationTemplateVersionListResponse =
|
|
89
|
+
* await client.notifications.listVersions('id');
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
listVersions(id, query = {}, options) {
|
|
93
|
+
return this._client.get((0, path_1.path) `/notifications/${id}/versions`, { query, ...options });
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Publish a notification template. Publishes the current draft by default. Pass a
|
|
97
|
+
* version in the request body to publish a specific historical version.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* await client.notifications.publish('id');
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
publish(id, body = {}, options) {
|
|
105
|
+
return this._client.post((0, path_1.path) `/notifications/${id}/publish`, {
|
|
106
|
+
body,
|
|
107
|
+
...options,
|
|
108
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Replace a notification template. All fields are required.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const notificationTemplateMutationResponse =
|
|
117
|
+
* await client.notifications.replace('id', {
|
|
118
|
+
* notification: {
|
|
119
|
+
* name: 'Updated Name',
|
|
120
|
+
* tags: ['updated'],
|
|
121
|
+
* brand: null,
|
|
122
|
+
* subscription: null,
|
|
123
|
+
* routing: null,
|
|
124
|
+
* content: {
|
|
125
|
+
* version: '2022-01-01',
|
|
126
|
+
* elements: [{ type: 'channel' }],
|
|
127
|
+
* },
|
|
128
|
+
* },
|
|
129
|
+
* state: 'PUBLISHED',
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
replace(id, body, options) {
|
|
134
|
+
return this._client.put((0, path_1.path) `/notifications/${id}`, { body, ...options });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const notificationGetContent =
|
|
140
|
+
* await client.notifications.retrieveContent('id');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
21
143
|
retrieveContent(id, options) {
|
|
22
144
|
return this._client.get((0, path_1.path) `/notifications/${id}/content`, options);
|
|
23
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/resources/notifications/notifications.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/resources/notifications/notifications.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