@trycourier/courier 7.10.1 → 7.11.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 +35 -0
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +1 -0
- package/api-promise.d.ts.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts +4 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -4
- package/client.d.ts.map +1 -1
- package/client.js +12 -1
- package/client.js.map +1 -1
- package/client.mjs +12 -1
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +2 -2
- package/internal/qs/index.d.mts.map +1 -1
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +6 -0
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +10 -10
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +10 -10
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +1 -0
- package/resource.d.ts.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.mjs.map +1 -1
- package/resources/audit-events.d.mts.map +1 -1
- package/resources/audit-events.d.ts.map +1 -1
- package/resources/audit-events.mjs.map +1 -1
- package/resources/auth.d.mts.map +1 -1
- package/resources/auth.d.ts.map +1 -1
- package/resources/auth.mjs.map +1 -1
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts.map +1 -1
- package/resources/automations/index.mjs.map +1 -1
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts.map +1 -1
- package/resources/automations/invoke.mjs.map +1 -1
- package/resources/automations.d.mts.map +1 -1
- package/resources/automations.d.ts.map +1 -1
- package/resources/automations.mjs.map +1 -1
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts.map +1 -1
- package/resources/bulk.mjs.map +1 -1
- package/resources/inbound.d.mts.map +1 -1
- package/resources/inbound.d.ts.map +1 -1
- package/resources/inbound.mjs.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/journeys/index.d.mts +3 -0
- package/resources/journeys/index.d.mts.map +1 -0
- package/resources/journeys/index.d.ts +3 -0
- package/resources/journeys/index.d.ts.map +1 -0
- package/resources/journeys/index.js +9 -0
- package/resources/journeys/index.js.map +1 -0
- package/resources/journeys/index.mjs +4 -0
- package/resources/journeys/index.mjs.map +1 -0
- package/resources/journeys/journeys.d.mts +752 -0
- package/resources/journeys/journeys.d.mts.map +1 -0
- package/resources/journeys/journeys.d.ts +752 -0
- package/resources/journeys/journeys.d.ts.map +1 -0
- package/resources/journeys/journeys.js +148 -0
- package/resources/journeys/journeys.js.map +1 -0
- package/resources/journeys/journeys.mjs +143 -0
- package/resources/journeys/journeys.mjs.map +1 -0
- package/resources/journeys/templates.d.mts +219 -0
- package/resources/journeys/templates.d.mts.map +1 -0
- package/resources/journeys/templates.d.ts +219 -0
- package/resources/journeys/templates.d.ts.map +1 -0
- package/resources/journeys/templates.js +142 -0
- package/resources/journeys/templates.js.map +1 -0
- package/resources/journeys/templates.mjs +138 -0
- package/resources/journeys/templates.mjs.map +1 -0
- package/resources/journeys.d.mts +1 -142
- package/resources/journeys.d.mts.map +1 -1
- package/resources/journeys.d.ts +1 -142
- package/resources/journeys.d.ts.map +1 -1
- package/resources/journeys.js +2 -34
- package/resources/journeys.js.map +1 -1
- package/resources/journeys.mjs +1 -32
- package/resources/journeys.mjs.map +1 -1
- package/resources/lists/index.d.mts.map +1 -1
- package/resources/lists/index.d.ts.map +1 -1
- package/resources/lists/index.mjs.map +1 -1
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts.map +1 -1
- package/resources/lists/lists.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/lists/subscriptions.mjs.map +1 -1
- package/resources/lists.d.mts.map +1 -1
- package/resources/lists.d.ts.map +1 -1
- package/resources/lists.mjs.map +1 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +13 -1
- package/resources/notifications/checks.d.mts.map +1 -1
- package/resources/notifications/checks.d.ts +13 -1
- package/resources/notifications/checks.d.ts.map +1 -1
- package/resources/notifications/checks.js +6 -0
- package/resources/notifications/checks.js.map +1 -1
- package/resources/notifications/checks.mjs +6 -0
- package/resources/notifications/checks.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.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +48 -62
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +48 -62
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +3 -3
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +3 -3
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/notifications.d.mts.map +1 -1
- package/resources/notifications.d.ts.map +1 -1
- package/resources/notifications.mjs.map +1 -1
- package/resources/profiles/index.d.mts.map +1 -1
- package/resources/profiles/index.d.ts.map +1 -1
- package/resources/profiles/index.mjs.map +1 -1
- package/resources/profiles/lists.d.mts.map +1 -1
- package/resources/profiles/lists.d.ts.map +1 -1
- package/resources/profiles/lists.mjs.map +1 -1
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/profiles.d.mts.map +1 -1
- package/resources/profiles.d.ts.map +1 -1
- package/resources/profiles.mjs.map +1 -1
- package/resources/providers/catalog.d.mts.map +1 -1
- package/resources/providers/catalog.d.ts.map +1 -1
- package/resources/providers/catalog.mjs.map +1 -1
- package/resources/providers/index.d.mts.map +1 -1
- package/resources/providers/index.d.ts.map +1 -1
- package/resources/providers/index.mjs.map +1 -1
- package/resources/providers/providers.d.mts.map +1 -1
- package/resources/providers/providers.d.ts.map +1 -1
- package/resources/providers/providers.mjs.map +1 -1
- package/resources/providers.d.mts.map +1 -1
- package/resources/providers.d.ts.map +1 -1
- package/resources/providers.mjs.map +1 -1
- package/resources/requests.d.mts.map +1 -1
- package/resources/requests.d.ts.map +1 -1
- package/resources/requests.mjs.map +1 -1
- package/resources/routing-strategies.d.mts.map +1 -1
- package/resources/routing-strategies.d.ts.map +1 -1
- package/resources/routing-strategies.mjs.map +1 -1
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts.map +1 -1
- package/resources/send.mjs.map +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/index.d.mts +1 -1
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +1 -1
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/preferences/index.d.mts.map +1 -1
- package/resources/tenants/preferences/index.d.ts.map +1 -1
- package/resources/tenants/preferences/index.mjs.map +1 -1
- package/resources/tenants/preferences/items.d.mts.map +1 -1
- package/resources/tenants/preferences/items.d.ts.map +1 -1
- package/resources/tenants/preferences/items.mjs.map +1 -1
- package/resources/tenants/preferences/preferences.d.mts.map +1 -1
- package/resources/tenants/preferences/preferences.d.ts.map +1 -1
- package/resources/tenants/preferences/preferences.mjs.map +1 -1
- package/resources/tenants/preferences.d.mts.map +1 -1
- package/resources/tenants/preferences.d.ts.map +1 -1
- package/resources/tenants/preferences.mjs.map +1 -1
- package/resources/tenants/templates/index.d.mts +1 -1
- package/resources/tenants/templates/index.d.mts.map +1 -1
- package/resources/tenants/templates/index.d.ts +1 -1
- package/resources/tenants/templates/index.d.ts.map +1 -1
- package/resources/tenants/templates/index.js.map +1 -1
- package/resources/tenants/templates/index.mjs.map +1 -1
- package/resources/tenants/templates/templates.d.mts +23 -1
- package/resources/tenants/templates/templates.d.mts.map +1 -1
- package/resources/tenants/templates/templates.d.ts +23 -1
- package/resources/tenants/templates/templates.d.ts.map +1 -1
- package/resources/tenants/templates/templates.js +23 -0
- package/resources/tenants/templates/templates.js.map +1 -1
- package/resources/tenants/templates/templates.mjs +23 -0
- package/resources/tenants/templates/templates.mjs.map +1 -1
- package/resources/tenants/templates/versions.d.mts.map +1 -1
- package/resources/tenants/templates/versions.d.ts.map +1 -1
- package/resources/tenants/templates/versions.mjs.map +1 -1
- package/resources/tenants/templates.d.mts.map +1 -1
- package/resources/tenants/templates.d.ts.map +1 -1
- package/resources/tenants/templates.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +2 -2
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +2 -2
- 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/resources/tenants.d.mts.map +1 -1
- package/resources/tenants.d.ts.map +1 -1
- package/resources/tenants.mjs.map +1 -1
- package/resources/translations.d.mts.map +1 -1
- package/resources/translations.d.ts.map +1 -1
- package/resources/translations.mjs.map +1 -1
- package/resources/users/index.d.mts.map +1 -1
- package/resources/users/index.d.ts.map +1 -1
- package/resources/users/index.mjs.map +1 -1
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts.map +1 -1
- package/resources/users/preferences.mjs.map +1 -1
- package/resources/users/tenants.d.mts.map +1 -1
- package/resources/users/tenants.d.ts.map +1 -1
- package/resources/users/tenants.mjs.map +1 -1
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.mjs.map +1 -1
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts.map +1 -1
- package/resources/users/users.mjs.map +1 -1
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts.map +1 -1
- package/resources/users.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/client.ts +89 -11
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/index.ts +35 -2
- package/src/resources/journeys/index.ts +54 -0
- package/src/resources/journeys/journeys.ts +1047 -0
- package/src/resources/journeys/templates.ts +318 -0
- package/src/resources/journeys.ts +1 -172
- package/src/resources/notifications/checks.ts +13 -1
- package/src/resources/notifications/index.ts +1 -1
- package/src/resources/notifications/notifications.ts +55 -73
- package/src/resources/tenants/index.ts +1 -0
- package/src/resources/tenants/templates/index.ts +1 -0
- package/src/resources/tenants/templates/templates.ts +32 -0
- package/src/resources/tenants/tenants.ts +2 -0
- package/src/version.ts +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +1 -0
- package/uploads.d.ts.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,318 @@
|
|
|
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 JourneysAPI from './journeys';
|
|
6
|
+
import * as NotificationsAPI from '../notifications/notifications';
|
|
7
|
+
import { APIPromise } from '../../core/api-promise';
|
|
8
|
+
import { buildHeaders } from '../../internal/headers';
|
|
9
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
10
|
+
import { path } from '../../internal/utils/path';
|
|
11
|
+
|
|
12
|
+
export class Templates extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Create a notification template scoped to this journey. Defaults to `DRAFT`
|
|
15
|
+
* state; pass `state: "PUBLISHED"` to publish on create.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const journeyTemplateGetResponse =
|
|
20
|
+
* await client.journeys.templates.create('x', {
|
|
21
|
+
* channel: 'email',
|
|
22
|
+
* notification: {
|
|
23
|
+
* name: 'Welcome email',
|
|
24
|
+
* tags: [],
|
|
25
|
+
* brand: null,
|
|
26
|
+
* subscription: null,
|
|
27
|
+
* content: {
|
|
28
|
+
* version: '2022-01-01',
|
|
29
|
+
* elements: [{ type: 'text' }],
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
create(
|
|
36
|
+
templateID: string,
|
|
37
|
+
body: TemplateCreateParams,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
|
|
40
|
+
return this._client.post(path`/journeys/${templateID}/templates`, { body, ...options });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Fetch a journey-scoped notification template by id. Pass `?version=draft`
|
|
45
|
+
* (default `published`) to retrieve the working draft, or `?version=vN` for a
|
|
46
|
+
* historical version.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const journeyTemplateGetResponse =
|
|
51
|
+
* await client.journeys.templates.retrieve('x', {
|
|
52
|
+
* templateId: 'x',
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
retrieve(
|
|
57
|
+
notificationID: string,
|
|
58
|
+
params: TemplateRetrieveParams,
|
|
59
|
+
options?: RequestOptions,
|
|
60
|
+
): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
|
|
61
|
+
const { templateId } = params;
|
|
62
|
+
return this._client.get(path`/journeys/${templateId}/templates/${notificationID}`, options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* List notification templates scoped to this journey. Journey-scoped notification
|
|
67
|
+
* templates can only be referenced from `send` nodes within the same journey.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const journeyTemplateListResponse =
|
|
72
|
+
* await client.journeys.templates.list('x');
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
list(
|
|
76
|
+
templateID: string,
|
|
77
|
+
query: TemplateListParams | null | undefined = {},
|
|
78
|
+
options?: RequestOptions,
|
|
79
|
+
): APIPromise<JourneysAPI.JourneyTemplateListResponse> {
|
|
80
|
+
return this._client.get(path`/journeys/${templateID}/templates`, { query, ...options });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Archive the journey-scoped notification template. Archived templates cannot be
|
|
85
|
+
* sent.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* await client.journeys.templates.archive('x', {
|
|
90
|
+
* templateId: 'x',
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
archive(notificationID: string, params: TemplateArchiveParams, options?: RequestOptions): APIPromise<void> {
|
|
95
|
+
const { templateId } = params;
|
|
96
|
+
return this._client.delete(path`/journeys/${templateId}/templates/${notificationID}`, {
|
|
97
|
+
...options,
|
|
98
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List published versions of the journey-scoped notification template, ordered
|
|
104
|
+
* most recent first.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const notificationTemplateVersionListResponse =
|
|
109
|
+
* await client.journeys.templates.listVersions('x', {
|
|
110
|
+
* templateId: 'x',
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
listVersions(
|
|
115
|
+
notificationID: string,
|
|
116
|
+
params: TemplateListVersionsParams,
|
|
117
|
+
options?: RequestOptions,
|
|
118
|
+
): APIPromise<NotificationsAPI.NotificationTemplateVersionListResponse> {
|
|
119
|
+
const { templateId } = params;
|
|
120
|
+
return this._client.get(path`/journeys/${templateId}/templates/${notificationID}/versions`, options);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Publish the current draft of the journey-scoped notification template as a new
|
|
125
|
+
* version. Optionally roll back to a prior version by passing
|
|
126
|
+
* `{ "version": "vN" }`.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* await client.journeys.templates.publish('x', {
|
|
131
|
+
* templateId: 'x',
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
publish(notificationID: string, params: TemplatePublishParams, options?: RequestOptions): APIPromise<void> {
|
|
136
|
+
const { templateId, ...body } = params;
|
|
137
|
+
return this._client.post(path`/journeys/${templateId}/templates/${notificationID}/publish`, {
|
|
138
|
+
body,
|
|
139
|
+
...options,
|
|
140
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Replace the journey-scoped notification template draft.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const journeyTemplateGetResponse =
|
|
150
|
+
* await client.journeys.templates.replace('x', {
|
|
151
|
+
* templateId: 'x',
|
|
152
|
+
* notification: {
|
|
153
|
+
* brand: { id: 'id' },
|
|
154
|
+
* content: { elements: [{}], version: '2022-01-01' },
|
|
155
|
+
* name: 'name',
|
|
156
|
+
* subscription: { topic_id: 'topic_id' },
|
|
157
|
+
* tags: ['string'],
|
|
158
|
+
* },
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
replace(
|
|
163
|
+
notificationID: string,
|
|
164
|
+
params: TemplateReplaceParams,
|
|
165
|
+
options?: RequestOptions,
|
|
166
|
+
): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
|
|
167
|
+
const { templateId, ...body } = params;
|
|
168
|
+
return this._client.put(path`/journeys/${templateId}/templates/${notificationID}`, { body, ...options });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface TemplateCreateParams {
|
|
173
|
+
channel: string;
|
|
174
|
+
|
|
175
|
+
notification: TemplateCreateParams.Notification;
|
|
176
|
+
|
|
177
|
+
providerKey?: string;
|
|
178
|
+
|
|
179
|
+
state?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export namespace TemplateCreateParams {
|
|
183
|
+
export interface Notification {
|
|
184
|
+
brand: Notification.Brand | null;
|
|
185
|
+
|
|
186
|
+
content: Notification.Content;
|
|
187
|
+
|
|
188
|
+
name: string;
|
|
189
|
+
|
|
190
|
+
subscription: Notification.Subscription | null;
|
|
191
|
+
|
|
192
|
+
tags: Array<string>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export namespace Notification {
|
|
196
|
+
export interface Brand {
|
|
197
|
+
id: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface Content {
|
|
201
|
+
elements: Array<Shared.ElementalNode>;
|
|
202
|
+
|
|
203
|
+
version: '2022-01-01';
|
|
204
|
+
|
|
205
|
+
scope?: 'default' | 'strict';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface Subscription {
|
|
209
|
+
topic_id: string;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface TemplateRetrieveParams {
|
|
215
|
+
/**
|
|
216
|
+
* Journey id
|
|
217
|
+
*/
|
|
218
|
+
templateId: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface TemplateListParams {
|
|
222
|
+
/**
|
|
223
|
+
* Pagination cursor from a prior response.
|
|
224
|
+
*/
|
|
225
|
+
cursor?: string;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Page size. Minimum 1, maximum 100.
|
|
229
|
+
*/
|
|
230
|
+
limit?: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface TemplateArchiveParams {
|
|
234
|
+
/**
|
|
235
|
+
* Journey id
|
|
236
|
+
*/
|
|
237
|
+
templateId: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface TemplateListVersionsParams {
|
|
241
|
+
/**
|
|
242
|
+
* Journey id
|
|
243
|
+
*/
|
|
244
|
+
templateId: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface TemplatePublishParams {
|
|
248
|
+
/**
|
|
249
|
+
* Path param: Journey id
|
|
250
|
+
*/
|
|
251
|
+
templateId: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Body param
|
|
255
|
+
*/
|
|
256
|
+
version?: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface TemplateReplaceParams {
|
|
260
|
+
/**
|
|
261
|
+
* Path param: Journey id
|
|
262
|
+
*/
|
|
263
|
+
templateId: string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Body param
|
|
267
|
+
*/
|
|
268
|
+
notification: TemplateReplaceParams.Notification;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Body param
|
|
272
|
+
*/
|
|
273
|
+
state?: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export namespace TemplateReplaceParams {
|
|
277
|
+
export interface Notification {
|
|
278
|
+
brand: Notification.Brand | null;
|
|
279
|
+
|
|
280
|
+
content: Notification.Content;
|
|
281
|
+
|
|
282
|
+
name: string;
|
|
283
|
+
|
|
284
|
+
subscription: Notification.Subscription | null;
|
|
285
|
+
|
|
286
|
+
tags: Array<string>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export namespace Notification {
|
|
290
|
+
export interface Brand {
|
|
291
|
+
id: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface Content {
|
|
295
|
+
elements: Array<Shared.ElementalNode>;
|
|
296
|
+
|
|
297
|
+
version: '2022-01-01';
|
|
298
|
+
|
|
299
|
+
scope?: 'default' | 'strict';
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface Subscription {
|
|
303
|
+
topic_id: string;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export declare namespace Templates {
|
|
309
|
+
export {
|
|
310
|
+
type TemplateCreateParams as TemplateCreateParams,
|
|
311
|
+
type TemplateRetrieveParams as TemplateRetrieveParams,
|
|
312
|
+
type TemplateListParams as TemplateListParams,
|
|
313
|
+
type TemplateArchiveParams as TemplateArchiveParams,
|
|
314
|
+
type TemplateListVersionsParams as TemplateListVersionsParams,
|
|
315
|
+
type TemplatePublishParams as TemplatePublishParams,
|
|
316
|
+
type TemplateReplaceParams as TemplateReplaceParams,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
@@ -1,174 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
}
|
|
3
|
+
export * from './journeys/index';
|
|
@@ -9,6 +9,8 @@ import { path } from '../../internal/utils/path';
|
|
|
9
9
|
|
|
10
10
|
export class Checks extends APIResource {
|
|
11
11
|
/**
|
|
12
|
+
* Replace the checks for a notification template submission.
|
|
13
|
+
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```ts
|
|
14
16
|
* const check = await client.notifications.checks.update(
|
|
@@ -36,6 +38,8 @@ export class Checks extends APIResource {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
41
|
+
* Retrieve the checks for a notification template submission.
|
|
42
|
+
*
|
|
39
43
|
* @example
|
|
40
44
|
* ```ts
|
|
41
45
|
* const checks = await client.notifications.checks.list(
|
|
@@ -54,6 +58,8 @@ export class Checks extends APIResource {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
61
|
+
* Cancel a notification template submission.
|
|
62
|
+
*
|
|
57
63
|
* @example
|
|
58
64
|
* ```ts
|
|
59
65
|
* await client.notifications.checks.delete('submissionId', {
|
|
@@ -80,7 +86,7 @@ export interface CheckListResponse {
|
|
|
80
86
|
|
|
81
87
|
export interface CheckUpdateParams {
|
|
82
88
|
/**
|
|
83
|
-
* Path param
|
|
89
|
+
* Path param: Notification template ID.
|
|
84
90
|
*/
|
|
85
91
|
id: string;
|
|
86
92
|
|
|
@@ -91,10 +97,16 @@ export interface CheckUpdateParams {
|
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
export interface CheckListParams {
|
|
100
|
+
/**
|
|
101
|
+
* Notification template ID.
|
|
102
|
+
*/
|
|
94
103
|
id: string;
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
export interface CheckDeleteParams {
|
|
107
|
+
/**
|
|
108
|
+
* Notification template ID.
|
|
109
|
+
*/
|
|
98
110
|
id: string;
|
|
99
111
|
}
|
|
100
112
|
|
|
@@ -20,9 +20,9 @@ export {
|
|
|
20
20
|
type NotificationGetContent,
|
|
21
21
|
type NotificationLocalePutRequest,
|
|
22
22
|
type NotificationTemplateCreateRequest,
|
|
23
|
-
type NotificationTemplateGetResponse,
|
|
24
23
|
type NotificationTemplatePayload,
|
|
25
24
|
type NotificationTemplatePublishRequest,
|
|
25
|
+
type NotificationTemplateResponse,
|
|
26
26
|
type NotificationTemplateState,
|
|
27
27
|
type NotificationTemplateSummary,
|
|
28
28
|
type NotificationTemplateUpdateRequest,
|