@trycourier/courier 7.21.0 → 7.22.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 +16 -0
- package/client.d.mts +57 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +57 -0
- package/client.d.ts.map +1 -1
- package/client.js +57 -0
- package/client.js.map +1 -1
- package/client.mjs +57 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audiences.d.mts +13 -5
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +13 -5
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.js +13 -5
- package/resources/audiences.js.map +1 -1
- package/resources/audiences.mjs +13 -5
- package/resources/audiences.mjs.map +1 -1
- package/resources/audit-events.d.mts +7 -2
- package/resources/audit-events.d.mts.map +1 -1
- package/resources/audit-events.d.ts +7 -2
- package/resources/audit-events.d.ts.map +1 -1
- package/resources/audit-events.js +7 -2
- package/resources/audit-events.js.map +1 -1
- package/resources/audit-events.mjs +7 -2
- package/resources/audit-events.mjs.map +1 -1
- package/resources/auth.d.mts +5 -1
- package/resources/auth.d.mts.map +1 -1
- package/resources/auth.d.ts +5 -1
- package/resources/auth.d.ts.map +1 -1
- package/resources/auth.js +5 -1
- package/resources/auth.js.map +1 -1
- package/resources/auth.mjs +5 -1
- package/resources/auth.mjs.map +1 -1
- package/resources/automations/automations.d.mts +5 -1
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +5 -1
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +5 -1
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +5 -1
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/invoke.d.mts +74 -7
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts +74 -7
- package/resources/automations/invoke.d.ts.map +1 -1
- package/resources/automations/invoke.js +38 -9
- package/resources/automations/invoke.js.map +1 -1
- package/resources/automations/invoke.mjs +38 -9
- package/resources/automations/invoke.mjs.map +1 -1
- package/resources/brands.d.mts +42 -7
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +42 -7
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js +28 -8
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs +28 -8
- package/resources/brands.mjs.map +1 -1
- package/resources/digests/schedules.d.mts +5 -3
- package/resources/digests/schedules.d.mts.map +1 -1
- package/resources/digests/schedules.d.ts +5 -3
- package/resources/digests/schedules.d.ts.map +1 -1
- package/resources/digests/schedules.js +5 -3
- package/resources/digests/schedules.js.map +1 -1
- package/resources/digests/schedules.mjs +5 -3
- package/resources/digests/schedules.mjs.map +1 -1
- package/resources/inbound.d.mts +5 -1
- package/resources/inbound.d.mts.map +1 -1
- package/resources/inbound.d.ts +5 -1
- package/resources/inbound.d.ts.map +1 -1
- package/resources/inbound.js +5 -1
- package/resources/inbound.js.map +1 -1
- package/resources/inbound.mjs +5 -1
- package/resources/inbound.mjs.map +1 -1
- package/resources/inbox/inbox.d.mts +10 -0
- package/resources/inbox/inbox.d.mts.map +1 -0
- package/resources/inbox/inbox.d.ts +10 -0
- package/resources/inbox/inbox.d.ts.map +1 -0
- package/resources/inbox/inbox.js +17 -0
- package/resources/inbox/inbox.js.map +1 -0
- package/resources/inbox/inbox.mjs +12 -0
- package/resources/inbox/inbox.mjs.map +1 -0
- package/resources/inbox/index.d.mts +3 -0
- package/resources/inbox/index.d.mts.map +1 -0
- package/resources/inbox/index.d.ts +3 -0
- package/resources/inbox/index.d.ts.map +1 -0
- package/resources/inbox/index.js +9 -0
- package/resources/inbox/index.js.map +1 -0
- package/resources/inbox/index.mjs +4 -0
- package/resources/inbox/index.mjs.map +1 -0
- package/resources/inbox/messages.d.mts +23 -0
- package/resources/inbox/messages.d.mts.map +1 -0
- package/resources/inbox/messages.d.ts +23 -0
- package/resources/inbox/messages.d.ts.map +1 -0
- package/resources/inbox/messages.js +34 -0
- package/resources/inbox/messages.js.map +1 -0
- package/resources/inbox/messages.mjs +30 -0
- package/resources/inbox/messages.mjs.map +1 -0
- package/resources/inbox.d.mts +2 -0
- package/resources/inbox.d.mts.map +1 -0
- package/resources/inbox.d.ts +2 -0
- package/resources/inbox.d.ts.map +1 -0
- package/resources/inbox.js +6 -0
- package/resources/inbox.js.map +1 -0
- package/resources/inbox.mjs +3 -0
- package/resources/inbox.mjs.map +1 -0
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/journeys/journeys.d.mts +130 -39
- package/resources/journeys/journeys.d.mts.map +1 -1
- package/resources/journeys/journeys.d.ts +130 -39
- package/resources/journeys/journeys.d.ts.map +1 -1
- package/resources/journeys/journeys.js +79 -34
- package/resources/journeys/journeys.js.map +1 -1
- package/resources/journeys/journeys.mjs +79 -34
- package/resources/journeys/journeys.mjs.map +1 -1
- package/resources/journeys/templates.d.mts +60 -17
- package/resources/journeys/templates.d.mts.map +1 -1
- package/resources/journeys/templates.d.ts +60 -17
- package/resources/journeys/templates.d.ts.map +1 -1
- package/resources/journeys/templates.js +41 -20
- package/resources/journeys/templates.js.map +1 -1
- package/resources/journeys/templates.mjs +41 -20
- package/resources/journeys/templates.mjs.map +1 -1
- package/resources/lists/lists.d.mts +40 -5
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts +40 -5
- package/resources/lists/lists.d.ts.map +1 -1
- package/resources/lists/lists.js +40 -5
- package/resources/lists/lists.js.map +1 -1
- package/resources/lists/lists.mjs +40 -5
- package/resources/lists/lists.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts +65 -5
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts +65 -5
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/lists/subscriptions.js +57 -6
- package/resources/lists/subscriptions.js.map +1 -1
- package/resources/lists/subscriptions.mjs +57 -6
- package/resources/lists/subscriptions.mjs.map +1 -1
- package/resources/messages.d.mts +15 -14
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +15 -14
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +15 -14
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +15 -14
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +9 -3
- package/resources/notifications/checks.d.mts.map +1 -1
- package/resources/notifications/checks.d.ts +9 -3
- package/resources/notifications/checks.d.ts.map +1 -1
- package/resources/notifications/checks.js +9 -3
- package/resources/notifications/checks.js.map +1 -1
- package/resources/notifications/checks.mjs +9 -3
- package/resources/notifications/checks.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +62 -29
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +62 -29
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +49 -26
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +49 -26
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/profiles/lists.d.mts +49 -5
- package/resources/profiles/lists.d.mts.map +1 -1
- package/resources/profiles/lists.d.ts +49 -5
- package/resources/profiles/lists.d.ts.map +1 -1
- package/resources/profiles/lists.js +45 -6
- package/resources/profiles/lists.js.map +1 -1
- package/resources/profiles/lists.mjs +45 -6
- package/resources/profiles/lists.mjs.map +1 -1
- package/resources/profiles/profiles.d.mts +70 -11
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts +70 -11
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.js +65 -12
- package/resources/profiles/profiles.js.map +1 -1
- package/resources/profiles/profiles.mjs +65 -12
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/providers/catalog.d.mts +10 -4
- package/resources/providers/catalog.d.mts.map +1 -1
- package/resources/providers/catalog.d.ts +10 -4
- package/resources/providers/catalog.d.ts.map +1 -1
- package/resources/providers/catalog.js +10 -4
- package/resources/providers/catalog.js.map +1 -1
- package/resources/providers/catalog.mjs +10 -4
- package/resources/providers/catalog.mjs.map +1 -1
- package/resources/providers/providers.d.mts +68 -22
- package/resources/providers/providers.d.mts.map +1 -1
- package/resources/providers/providers.d.ts +68 -22
- package/resources/providers/providers.d.ts.map +1 -1
- package/resources/providers/providers.js +57 -14
- package/resources/providers/providers.js.map +1 -1
- package/resources/providers/providers.mjs +57 -14
- package/resources/providers/providers.mjs.map +1 -1
- package/resources/requests.d.mts +5 -1
- package/resources/requests.d.mts.map +1 -1
- package/resources/requests.d.ts +5 -1
- package/resources/requests.d.ts.map +1 -1
- package/resources/requests.js +5 -1
- package/resources/requests.js.map +1 -1
- package/resources/requests.mjs +5 -1
- package/resources/requests.mjs.map +1 -1
- package/resources/routing-strategies.d.mts +30 -11
- package/resources/routing-strategies.d.mts.map +1 -1
- package/resources/routing-strategies.d.ts +30 -11
- package/resources/routing-strategies.d.ts.map +1 -1
- package/resources/routing-strategies.js +22 -6
- package/resources/routing-strategies.js.map +1 -1
- package/resources/routing-strategies.mjs +22 -6
- package/resources/routing-strategies.mjs.map +1 -1
- package/resources/send.d.mts +24 -4
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +24 -4
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +21 -3
- package/resources/send.js.map +1 -1
- package/resources/send.mjs +21 -3
- package/resources/send.mjs.map +1 -1
- package/resources/tenants/preferences/items.d.mts +7 -2
- package/resources/tenants/preferences/items.d.mts.map +1 -1
- package/resources/tenants/preferences/items.d.ts +7 -2
- package/resources/tenants/preferences/items.d.ts.map +1 -1
- package/resources/tenants/preferences/items.js +7 -2
- package/resources/tenants/preferences/items.js.map +1 -1
- package/resources/tenants/preferences/items.mjs +7 -2
- package/resources/tenants/preferences/items.mjs.map +1 -1
- package/resources/tenants/templates/templates.d.mts +13 -19
- package/resources/tenants/templates/templates.d.mts.map +1 -1
- package/resources/tenants/templates/templates.d.ts +13 -19
- package/resources/tenants/templates/templates.d.ts.map +1 -1
- package/resources/tenants/templates/templates.js +13 -19
- package/resources/tenants/templates/templates.js.map +1 -1
- package/resources/tenants/templates/templates.mjs +13 -19
- package/resources/tenants/templates/templates.mjs.map +1 -1
- package/resources/tenants/templates/versions.d.mts +5 -7
- package/resources/tenants/templates/versions.d.mts.map +1 -1
- package/resources/tenants/templates/versions.d.ts +5 -7
- package/resources/tenants/templates/versions.d.ts.map +1 -1
- package/resources/tenants/templates/versions.js +5 -7
- package/resources/tenants/templates/versions.js.map +1 -1
- package/resources/tenants/templates/versions.mjs +5 -7
- package/resources/tenants/templates/versions.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +13 -5
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +13 -5
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +13 -5
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +13 -5
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/translations.d.mts +7 -2
- package/resources/translations.d.mts.map +1 -1
- package/resources/translations.d.ts +7 -2
- package/resources/translations.d.ts.map +1 -1
- package/resources/translations.js +7 -2
- package/resources/translations.js.map +1 -1
- package/resources/translations.mjs +7 -2
- package/resources/translations.mjs.map +1 -1
- package/resources/users/preferences.d.mts +64 -42
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts +64 -42
- package/resources/users/preferences.d.ts.map +1 -1
- package/resources/users/preferences.js +30 -42
- package/resources/users/preferences.js.map +1 -1
- package/resources/users/preferences.mjs +30 -42
- package/resources/users/preferences.mjs.map +1 -1
- package/resources/users/tenants.d.mts +13 -10
- package/resources/users/tenants.d.mts.map +1 -1
- package/resources/users/tenants.d.ts +13 -10
- package/resources/users/tenants.d.ts.map +1 -1
- package/resources/users/tenants.js +13 -10
- package/resources/users/tenants.js.map +1 -1
- package/resources/users/tenants.mjs +13 -10
- package/resources/users/tenants.mjs.map +1 -1
- package/resources/users/tokens.d.mts +15 -6
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +15 -6
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +15 -6
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +15 -6
- package/resources/users/tokens.mjs.map +1 -1
- package/resources/workspace-preferences/topics.d.mts +40 -18
- package/resources/workspace-preferences/topics.d.mts.map +1 -1
- package/resources/workspace-preferences/topics.d.ts +40 -18
- package/resources/workspace-preferences/topics.d.ts.map +1 -1
- package/resources/workspace-preferences/topics.js +26 -11
- package/resources/workspace-preferences/topics.js.map +1 -1
- package/resources/workspace-preferences/topics.mjs +26 -11
- package/resources/workspace-preferences/topics.mjs.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.d.mts +56 -19
- package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.d.ts +56 -19
- package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.js +41 -13
- package/resources/workspace-preferences/workspace-preferences.js.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.mjs +41 -13
- package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -1
- package/src/client.ts +59 -0
- package/src/resources/audiences.ts +13 -5
- package/src/resources/audit-events.ts +7 -2
- package/src/resources/auth.ts +5 -1
- package/src/resources/automations/automations.ts +5 -1
- package/src/resources/automations/invoke.ts +115 -9
- package/src/resources/brands.ts +62 -8
- package/src/resources/digests/schedules.ts +5 -3
- package/src/resources/inbound.ts +5 -1
- package/src/resources/inbox/inbox.ts +15 -0
- package/src/resources/inbox/index.ts +4 -0
- package/src/resources/inbox/messages.ts +40 -0
- package/src/resources/inbox.ts +3 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/journeys/journeys.ts +212 -43
- package/src/resources/journeys/templates.ts +98 -20
- package/src/resources/lists/lists.ts +40 -5
- package/src/resources/lists/subscriptions.ts +82 -6
- package/src/resources/messages.ts +15 -14
- package/src/resources/notifications/checks.ts +9 -3
- package/src/resources/notifications/notifications.ts +102 -31
- package/src/resources/profiles/lists.ts +70 -6
- package/src/resources/profiles/profiles.ts +90 -12
- package/src/resources/providers/catalog.ts +10 -4
- package/src/resources/providers/providers.ts +86 -21
- package/src/resources/requests.ts +5 -1
- package/src/resources/routing-strategies.ts +50 -12
- package/src/resources/send.ts +45 -5
- package/src/resources/tenants/preferences/items.ts +7 -2
- package/src/resources/tenants/templates/templates.ts +13 -19
- package/src/resources/tenants/templates/versions.ts +5 -7
- package/src/resources/tenants/tenants.ts +13 -5
- package/src/resources/translations.ts +7 -2
- package/src/resources/users/preferences.ts +86 -44
- package/src/resources/users/tenants.ts +13 -10
- package/src/resources/users/tokens.ts +15 -6
- package/src/resources/workspace-preferences/topics.ts +60 -19
- package/src/resources/workspace-preferences/workspace-preferences.ts +96 -21
- 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
|
@@ -22,16 +22,15 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
22
22
|
import { RequestOptions } from '../../internal/request-options';
|
|
23
23
|
import { path } from '../../internal/utils/path';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
|
|
27
|
+
*/
|
|
25
28
|
export class Journeys extends APIResource {
|
|
26
29
|
templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* create the journey shell here, add notification templates with
|
|
32
|
-
* `POST /journeys/{templateId}/templates`, then wire them into the journey with
|
|
33
|
-
* `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to
|
|
34
|
-
* publish a draft after the fact.
|
|
32
|
+
* Creates a journey from a set of nodes, in draft state unless you pass a
|
|
33
|
+
* published state. Send nodes cannot be included until their templates exist.
|
|
35
34
|
*
|
|
36
35
|
* @example
|
|
37
36
|
* ```ts
|
|
@@ -50,8 +49,25 @@ export class Journeys extends APIResource {
|
|
|
50
49
|
* });
|
|
51
50
|
* ```
|
|
52
51
|
*/
|
|
53
|
-
create(
|
|
54
|
-
|
|
52
|
+
create(params: JourneyCreateParams, options?: RequestOptions): APIPromise<JourneyResponse> {
|
|
53
|
+
const {
|
|
54
|
+
'Idempotency-Key': idempotencyKey,
|
|
55
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
56
|
+
...body
|
|
57
|
+
} = params;
|
|
58
|
+
return this._client.post('/journeys', {
|
|
59
|
+
body,
|
|
60
|
+
...options,
|
|
61
|
+
headers: buildHeaders([
|
|
62
|
+
{
|
|
63
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
64
|
+
...(xIdempotencyExpiration != null ?
|
|
65
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
66
|
+
: undefined),
|
|
67
|
+
},
|
|
68
|
+
options?.headers,
|
|
69
|
+
]),
|
|
70
|
+
});
|
|
55
71
|
}
|
|
56
72
|
|
|
57
73
|
/**
|
|
@@ -72,7 +88,8 @@ export class Journeys extends APIResource {
|
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
/**
|
|
75
|
-
*
|
|
91
|
+
* Lists the workspace's journeys, each carrying a name, state, and enabled flag.
|
|
92
|
+
* Paged by cursor.
|
|
76
93
|
*
|
|
77
94
|
* @example
|
|
78
95
|
* ```ts
|
|
@@ -87,8 +104,8 @@ export class Journeys extends APIResource {
|
|
|
87
104
|
}
|
|
88
105
|
|
|
89
106
|
/**
|
|
90
|
-
*
|
|
91
|
-
* continue to completion.
|
|
107
|
+
* Archives a journey so it can no longer be invoked. Runs already in flight
|
|
108
|
+
* continue to completion, so archiving never strands a user mid-sequence.
|
|
92
109
|
*
|
|
93
110
|
* @example
|
|
94
111
|
* ```ts
|
|
@@ -103,12 +120,8 @@ export class Journeys extends APIResource {
|
|
|
103
120
|
}
|
|
104
121
|
|
|
105
122
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
|
|
109
|
-
* A `run_id` that does not match a run for the tenant returns `404`. Cancelation
|
|
110
|
-
* is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
|
|
111
|
-
* already `CANCELED` is left unchanged and its current status is returned.
|
|
123
|
+
* Cancels in-flight journey runs, either every run sharing a cancelation token or
|
|
124
|
+
* one run by id. Use it to stop a sequence when the event resolves.
|
|
112
125
|
*
|
|
113
126
|
* @example
|
|
114
127
|
* ```ts
|
|
@@ -117,13 +130,30 @@ export class Journeys extends APIResource {
|
|
|
117
130
|
* });
|
|
118
131
|
* ```
|
|
119
132
|
*/
|
|
120
|
-
cancel(
|
|
121
|
-
|
|
133
|
+
cancel(params: JourneyCancelParams, options?: RequestOptions): APIPromise<CancelJourneyResponse> {
|
|
134
|
+
const {
|
|
135
|
+
'Idempotency-Key': idempotencyKey,
|
|
136
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
137
|
+
...body
|
|
138
|
+
} = params;
|
|
139
|
+
return this._client.post('/journeys/cancel', {
|
|
140
|
+
body,
|
|
141
|
+
...options,
|
|
142
|
+
headers: buildHeaders([
|
|
143
|
+
{
|
|
144
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
145
|
+
...(xIdempotencyExpiration != null ?
|
|
146
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
147
|
+
: undefined),
|
|
148
|
+
},
|
|
149
|
+
options?.headers,
|
|
150
|
+
]),
|
|
151
|
+
});
|
|
122
152
|
}
|
|
123
153
|
|
|
124
154
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
155
|
+
* Starts a journey run for one user and returns a runId. Runs execute
|
|
156
|
+
* asynchronously, so the response arrives before any message is sent.
|
|
127
157
|
*
|
|
128
158
|
* @example
|
|
129
159
|
* ```ts
|
|
@@ -138,14 +168,32 @@ export class Journeys extends APIResource {
|
|
|
138
168
|
*/
|
|
139
169
|
invoke(
|
|
140
170
|
templateID: string,
|
|
141
|
-
|
|
171
|
+
params: JourneyInvokeParams,
|
|
142
172
|
options?: RequestOptions,
|
|
143
173
|
): APIPromise<JourneysInvokeResponse> {
|
|
144
|
-
|
|
174
|
+
const {
|
|
175
|
+
'Idempotency-Key': idempotencyKey,
|
|
176
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
177
|
+
...body
|
|
178
|
+
} = params;
|
|
179
|
+
return this._client.post(path`/journeys/${templateID}/invoke`, {
|
|
180
|
+
body,
|
|
181
|
+
...options,
|
|
182
|
+
headers: buildHeaders([
|
|
183
|
+
{
|
|
184
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
185
|
+
...(xIdempotencyExpiration != null ?
|
|
186
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
187
|
+
: undefined),
|
|
188
|
+
},
|
|
189
|
+
options?.headers,
|
|
190
|
+
]),
|
|
191
|
+
});
|
|
145
192
|
}
|
|
146
193
|
|
|
147
194
|
/**
|
|
148
|
-
*
|
|
195
|
+
* Lists a journey's published versions, most recent first, so you have a version
|
|
196
|
+
* id to roll back to. Paged by cursor.
|
|
149
197
|
*
|
|
150
198
|
* @example
|
|
151
199
|
* ```ts
|
|
@@ -158,9 +206,8 @@ export class Journeys extends APIResource {
|
|
|
158
206
|
}
|
|
159
207
|
|
|
160
208
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* the journey has no draft to publish.
|
|
209
|
+
* Publishes a journey's current draft as a new version, making it live for new
|
|
210
|
+
* runs. Pass a version instead to roll back to an earlier one.
|
|
164
211
|
*
|
|
165
212
|
* @example
|
|
166
213
|
* ```ts
|
|
@@ -169,18 +216,32 @@ export class Journeys extends APIResource {
|
|
|
169
216
|
*/
|
|
170
217
|
publish(
|
|
171
218
|
templateID: string,
|
|
172
|
-
|
|
219
|
+
params: JourneyPublishParams | null | undefined = {},
|
|
173
220
|
options?: RequestOptions,
|
|
174
221
|
): APIPromise<JourneyResponse> {
|
|
175
|
-
|
|
222
|
+
const {
|
|
223
|
+
'Idempotency-Key': idempotencyKey,
|
|
224
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
225
|
+
...body
|
|
226
|
+
} = params ?? {};
|
|
227
|
+
return this._client.post(path`/journeys/${templateID}/publish`, {
|
|
228
|
+
body,
|
|
229
|
+
...options,
|
|
230
|
+
headers: buildHeaders([
|
|
231
|
+
{
|
|
232
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
233
|
+
...(xIdempotencyExpiration != null ?
|
|
234
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
235
|
+
: undefined),
|
|
236
|
+
},
|
|
237
|
+
options?.headers,
|
|
238
|
+
]),
|
|
239
|
+
});
|
|
176
240
|
}
|
|
177
241
|
|
|
178
242
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* `state: "PUBLISHED"` in this request to publish immediately. Send-node
|
|
182
|
-
* `template` ids must already exist and be scoped to this journey, and node ids
|
|
183
|
-
* must not be claimed by another journey.
|
|
243
|
+
* Replaces a journey's working draft, leaving the published version live until you
|
|
244
|
+
* publish. Reach for this when editing a journey already running.
|
|
184
245
|
*
|
|
185
246
|
* @example
|
|
186
247
|
* ```ts
|
|
@@ -1135,16 +1196,43 @@ export interface JourneysListResponse {
|
|
|
1135
1196
|
}
|
|
1136
1197
|
|
|
1137
1198
|
export interface JourneyCreateParams {
|
|
1199
|
+
/**
|
|
1200
|
+
* Body param
|
|
1201
|
+
*/
|
|
1138
1202
|
name: string;
|
|
1139
1203
|
|
|
1204
|
+
/**
|
|
1205
|
+
* Body param
|
|
1206
|
+
*/
|
|
1140
1207
|
nodes: Array<JourneyNode>;
|
|
1141
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* Body param
|
|
1211
|
+
*/
|
|
1142
1212
|
enabled?: boolean;
|
|
1143
1213
|
|
|
1144
1214
|
/**
|
|
1145
|
-
* Lifecycle state of a journey.
|
|
1215
|
+
* Body param: Lifecycle state of a journey.
|
|
1146
1216
|
*/
|
|
1147
1217
|
state?: JourneyState;
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
1221
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
1222
|
+
* response from the first request without performing the operation again
|
|
1223
|
+
* (including the original status code and any error). Use it to safely retry
|
|
1224
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
1225
|
+
* is scoped to this endpoint.
|
|
1226
|
+
*/
|
|
1227
|
+
'Idempotency-Key'?: string;
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
1231
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
1232
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
1233
|
+
* maximum is 1 year.
|
|
1234
|
+
*/
|
|
1235
|
+
'x-idempotency-expiration'?: string;
|
|
1148
1236
|
}
|
|
1149
1237
|
|
|
1150
1238
|
export interface JourneyRetrieveParams {
|
|
@@ -1172,26 +1260,68 @@ export type JourneyCancelParams = JourneyCancelParams.ByCancelationToken | Journ
|
|
|
1172
1260
|
|
|
1173
1261
|
export declare namespace JourneyCancelParams {
|
|
1174
1262
|
export interface ByCancelationToken {
|
|
1263
|
+
/**
|
|
1264
|
+
* Body param
|
|
1265
|
+
*/
|
|
1175
1266
|
cancelation_token: string;
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
1270
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
1271
|
+
* response from the first request without performing the operation again
|
|
1272
|
+
* (including the original status code and any error). Use it to safely retry
|
|
1273
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
1274
|
+
* is scoped to this endpoint.
|
|
1275
|
+
*/
|
|
1276
|
+
'Idempotency-Key'?: string;
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
1280
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
1281
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
1282
|
+
* maximum is 1 year.
|
|
1283
|
+
*/
|
|
1284
|
+
'x-idempotency-expiration'?: string;
|
|
1176
1285
|
}
|
|
1177
1286
|
|
|
1178
1287
|
export interface ByRunID {
|
|
1288
|
+
/**
|
|
1289
|
+
* Body param
|
|
1290
|
+
*/
|
|
1179
1291
|
run_id: string;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
1295
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
1296
|
+
* response from the first request without performing the operation again
|
|
1297
|
+
* (including the original status code and any error). Use it to safely retry
|
|
1298
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
1299
|
+
* is scoped to this endpoint.
|
|
1300
|
+
*/
|
|
1301
|
+
'Idempotency-Key'?: string;
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
1305
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
1306
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
1307
|
+
* maximum is 1 year.
|
|
1308
|
+
*/
|
|
1309
|
+
'x-idempotency-expiration'?: string;
|
|
1180
1310
|
}
|
|
1181
1311
|
}
|
|
1182
1312
|
|
|
1183
1313
|
export interface JourneyInvokeParams {
|
|
1184
1314
|
/**
|
|
1185
|
-
* Data payload passed to the journey. The expected shape can be
|
|
1186
|
-
* the schema builder in the journey editor. This data is
|
|
1187
|
-
* steps for condition evaluation and template variable
|
|
1188
|
-
* contain user identifiers (user_id, userId, anonymousId)
|
|
1189
|
-
* elsewhere.
|
|
1315
|
+
* Body param: Data payload passed to the journey. The expected shape can be
|
|
1316
|
+
* predefined using the schema builder in the journey editor. This data is
|
|
1317
|
+
* available in journey steps for condition evaluation and template variable
|
|
1318
|
+
* interpolation. Can also contain user identifiers (user_id, userId, anonymousId)
|
|
1319
|
+
* if not provided elsewhere.
|
|
1190
1320
|
*/
|
|
1191
1321
|
data?: { [key: string]: unknown };
|
|
1192
1322
|
|
|
1193
1323
|
/**
|
|
1194
|
-
* Profile data for the user. Can contain contact information (email,
|
|
1324
|
+
* Body param: Profile data for the user. Can contain contact information (email,
|
|
1195
1325
|
* phone_number), user identifiers (user_id, userId, anonymousId), or any custom
|
|
1196
1326
|
* profile fields. Profile fields are merged with any existing stored profile for
|
|
1197
1327
|
* the user. Include context.tenant_id to load a tenant-scoped profile for
|
|
@@ -1200,14 +1330,53 @@ export interface JourneyInvokeParams {
|
|
|
1200
1330
|
profile?: { [key: string]: unknown };
|
|
1201
1331
|
|
|
1202
1332
|
/**
|
|
1203
|
-
* A unique identifier for the user. If not provided, the system will
|
|
1204
|
-
* resolve the user identifier from profile or data objects.
|
|
1333
|
+
* Body param: A unique identifier for the user. If not provided, the system will
|
|
1334
|
+
* attempt to resolve the user identifier from profile or data objects.
|
|
1205
1335
|
*/
|
|
1206
1336
|
user_id?: string;
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
1340
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
1341
|
+
* response from the first request without performing the operation again
|
|
1342
|
+
* (including the original status code and any error). Use it to safely retry
|
|
1343
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
1344
|
+
* is scoped to this endpoint.
|
|
1345
|
+
*/
|
|
1346
|
+
'Idempotency-Key'?: string;
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
1350
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
1351
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
1352
|
+
* maximum is 1 year.
|
|
1353
|
+
*/
|
|
1354
|
+
'x-idempotency-expiration'?: string;
|
|
1207
1355
|
}
|
|
1208
1356
|
|
|
1209
1357
|
export interface JourneyPublishParams {
|
|
1358
|
+
/**
|
|
1359
|
+
* Body param
|
|
1360
|
+
*/
|
|
1210
1361
|
version?: string;
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
1365
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
1366
|
+
* response from the first request without performing the operation again
|
|
1367
|
+
* (including the original status code and any error). Use it to safely retry
|
|
1368
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
1369
|
+
* is scoped to this endpoint.
|
|
1370
|
+
*/
|
|
1371
|
+
'Idempotency-Key'?: string;
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
1375
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
1376
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
1377
|
+
* maximum is 1 year.
|
|
1378
|
+
*/
|
|
1379
|
+
'x-idempotency-expiration'?: string;
|
|
1211
1380
|
}
|
|
1212
1381
|
|
|
1213
1382
|
export interface JourneyReplaceParams {
|
|
@@ -9,6 +9,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
10
10
|
import { path } from '../../internal/utils/path';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
|
|
14
|
+
*/
|
|
12
15
|
export class Templates extends APIResource {
|
|
13
16
|
/**
|
|
14
17
|
* Create a notification template scoped to this journey. Defaults to `DRAFT`
|
|
@@ -34,16 +37,32 @@ export class Templates extends APIResource {
|
|
|
34
37
|
*/
|
|
35
38
|
create(
|
|
36
39
|
templateID: string,
|
|
37
|
-
|
|
40
|
+
params: TemplateCreateParams,
|
|
38
41
|
options?: RequestOptions,
|
|
39
42
|
): APIPromise<JourneysAPI.JourneyTemplateGetResponse> {
|
|
40
|
-
|
|
43
|
+
const {
|
|
44
|
+
'Idempotency-Key': idempotencyKey,
|
|
45
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
46
|
+
...body
|
|
47
|
+
} = params;
|
|
48
|
+
return this._client.post(path`/journeys/${templateID}/templates`, {
|
|
49
|
+
body,
|
|
50
|
+
...options,
|
|
51
|
+
headers: buildHeaders([
|
|
52
|
+
{
|
|
53
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
54
|
+
...(xIdempotencyExpiration != null ?
|
|
55
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
56
|
+
: undefined),
|
|
57
|
+
},
|
|
58
|
+
options?.headers,
|
|
59
|
+
]),
|
|
60
|
+
});
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* historical version.
|
|
64
|
+
* Returns a journey's own notification template with its name, brand, subscription
|
|
65
|
+
* topic, and content. Defaults to the published version.
|
|
47
66
|
*
|
|
48
67
|
* @example
|
|
49
68
|
* ```ts
|
|
@@ -81,8 +100,8 @@ export class Templates extends APIResource {
|
|
|
81
100
|
}
|
|
82
101
|
|
|
83
102
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
103
|
+
* Archives one journey's notification template, preventing further sends. Detach
|
|
104
|
+
* any send node referencing it beforehand.
|
|
86
105
|
*
|
|
87
106
|
* @example
|
|
88
107
|
* ```ts
|
|
@@ -100,8 +119,8 @@ export class Templates extends APIResource {
|
|
|
100
119
|
}
|
|
101
120
|
|
|
102
121
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
122
|
+
* Lists the published versions of a template that belongs to a journey, most
|
|
123
|
+
* recent first. Paged by cursor.
|
|
105
124
|
*
|
|
106
125
|
* @example
|
|
107
126
|
* ```ts
|
|
@@ -121,9 +140,8 @@ export class Templates extends APIResource {
|
|
|
121
140
|
}
|
|
122
141
|
|
|
123
142
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* `{ "version": "vN" }`.
|
|
143
|
+
* Publishes a journey-scoped template's draft as a new version. Pass a version
|
|
144
|
+
* instead to roll back the template to an earlier publish.
|
|
127
145
|
*
|
|
128
146
|
* @example
|
|
129
147
|
* ```ts
|
|
@@ -133,11 +151,25 @@ export class Templates extends APIResource {
|
|
|
133
151
|
* ```
|
|
134
152
|
*/
|
|
135
153
|
publish(notificationID: string, params: TemplatePublishParams, options?: RequestOptions): APIPromise<void> {
|
|
136
|
-
const {
|
|
154
|
+
const {
|
|
155
|
+
templateId,
|
|
156
|
+
'Idempotency-Key': idempotencyKey,
|
|
157
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
158
|
+
...body
|
|
159
|
+
} = params;
|
|
137
160
|
return this._client.post(path`/journeys/${templateId}/templates/${notificationID}/publish`, {
|
|
138
161
|
body,
|
|
139
162
|
...options,
|
|
140
|
-
headers: buildHeaders([
|
|
163
|
+
headers: buildHeaders([
|
|
164
|
+
{
|
|
165
|
+
Accept: '*/*',
|
|
166
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
167
|
+
...(xIdempotencyExpiration != null ?
|
|
168
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
169
|
+
: undefined),
|
|
170
|
+
},
|
|
171
|
+
options?.headers,
|
|
172
|
+
]),
|
|
141
173
|
});
|
|
142
174
|
}
|
|
143
175
|
|
|
@@ -201,7 +233,8 @@ export class Templates extends APIResource {
|
|
|
201
233
|
}
|
|
202
234
|
|
|
203
235
|
/**
|
|
204
|
-
*
|
|
236
|
+
* Replaces the draft content of one journey's notification template. Publish it
|
|
237
|
+
* before send nodes referencing it render the change.
|
|
205
238
|
*
|
|
206
239
|
* @example
|
|
207
240
|
* ```ts
|
|
@@ -228,11 +261,8 @@ export class Templates extends APIResource {
|
|
|
228
261
|
}
|
|
229
262
|
|
|
230
263
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* which can be used to detect changes between versions. Pass `?version=draft`
|
|
234
|
-
* (default `published`) to retrieve the working draft, or `?version=vN` for a
|
|
235
|
-
* historical version.
|
|
264
|
+
* Returns the Elemental elements and version of a journey-scoped template's
|
|
265
|
+
* content. Compare versions to see what changed between publishes.
|
|
236
266
|
*
|
|
237
267
|
* @example
|
|
238
268
|
* ```ts
|
|
@@ -256,13 +286,43 @@ export class Templates extends APIResource {
|
|
|
256
286
|
}
|
|
257
287
|
|
|
258
288
|
export interface TemplateCreateParams {
|
|
289
|
+
/**
|
|
290
|
+
* Body param
|
|
291
|
+
*/
|
|
259
292
|
channel: string;
|
|
260
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Body param
|
|
296
|
+
*/
|
|
261
297
|
notification: TemplateCreateParams.Notification;
|
|
262
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Body param
|
|
301
|
+
*/
|
|
263
302
|
providerKey?: string;
|
|
264
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Body param
|
|
306
|
+
*/
|
|
265
307
|
state?: string;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
311
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
312
|
+
* response from the first request without performing the operation again
|
|
313
|
+
* (including the original status code and any error). Use it to safely retry
|
|
314
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
315
|
+
* is scoped to this endpoint.
|
|
316
|
+
*/
|
|
317
|
+
'Idempotency-Key'?: string;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
321
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
322
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
323
|
+
* maximum is 1 year.
|
|
324
|
+
*/
|
|
325
|
+
'x-idempotency-expiration'?: string;
|
|
266
326
|
}
|
|
267
327
|
|
|
268
328
|
export namespace TemplateCreateParams {
|
|
@@ -340,6 +400,24 @@ export interface TemplatePublishParams {
|
|
|
340
400
|
* Body param
|
|
341
401
|
*/
|
|
342
402
|
version?: string;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
406
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
407
|
+
* response from the first request without performing the operation again
|
|
408
|
+
* (including the original status code and any error). Use it to safely retry
|
|
409
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
410
|
+
* is scoped to this endpoint.
|
|
411
|
+
*/
|
|
412
|
+
'Idempotency-Key'?: string;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
416
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
417
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
418
|
+
* maximum is 1 year.
|
|
419
|
+
*/
|
|
420
|
+
'x-idempotency-expiration'?: string;
|
|
343
421
|
}
|
|
344
422
|
|
|
345
423
|
export interface TemplatePutContentParams {
|
|
@@ -17,18 +17,35 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
17
17
|
import { RequestOptions } from '../../internal/request-options';
|
|
18
18
|
import { path } from '../../internal/utils/path';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Manage static groups of users that you subscribe explicitly, and send to them by list id or list pattern.
|
|
22
|
+
*/
|
|
20
23
|
export class Lists extends APIResource {
|
|
21
24
|
subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
|
-
* Returns
|
|
27
|
+
* Returns one list by id with its name and created and updated timestamps. Fetch
|
|
28
|
+
* its subscribers separately with the subscriptions endpoint.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const subscriptionList = await client.lists.retrieve(
|
|
33
|
+
* 'list_id',
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
25
36
|
*/
|
|
26
37
|
retrieve(listID: string, options?: RequestOptions): APIPromise<SubscriptionList> {
|
|
27
38
|
return this._client.get(path`/lists/${listID}`, options);
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
/**
|
|
31
|
-
*
|
|
42
|
+
* Creates or replaces a list from a name and preferences. Subscribers are managed
|
|
43
|
+
* through the separate subscriptions endpoints.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* await client.lists.update('list_id', { name: 'name' });
|
|
48
|
+
* ```
|
|
32
49
|
*/
|
|
33
50
|
update(listID: string, body: ListUpdateParams, options?: RequestOptions): APIPromise<void> {
|
|
34
51
|
return this._client.put(path`/lists/${listID}`, {
|
|
@@ -39,7 +56,13 @@ export class Lists extends APIResource {
|
|
|
39
56
|
}
|
|
40
57
|
|
|
41
58
|
/**
|
|
42
|
-
* Returns
|
|
59
|
+
* Returns the workspace's lists, filterable by a pattern to fetch a subset such as
|
|
60
|
+
* every regional list. Paged by cursor.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const lists = await client.lists.list();
|
|
65
|
+
* ```
|
|
43
66
|
*/
|
|
44
67
|
list(
|
|
45
68
|
query: ListListParams | null | undefined = {},
|
|
@@ -49,7 +72,13 @@ export class Lists extends APIResource {
|
|
|
49
72
|
}
|
|
50
73
|
|
|
51
74
|
/**
|
|
52
|
-
*
|
|
75
|
+
* Deletes a list, halting sends that target it. A previously deleted list can be
|
|
76
|
+
* brought back with the companion restore endpoint.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await client.lists.delete('list_id');
|
|
81
|
+
* ```
|
|
53
82
|
*/
|
|
54
83
|
delete(listID: string, options?: RequestOptions): APIPromise<void> {
|
|
55
84
|
return this._client.delete(path`/lists/${listID}`, {
|
|
@@ -59,7 +88,13 @@ export class Lists extends APIResource {
|
|
|
59
88
|
}
|
|
60
89
|
|
|
61
90
|
/**
|
|
62
|
-
*
|
|
91
|
+
* Restores a previously deleted list along with its subscribers, so a list removed
|
|
92
|
+
* by mistake can be brought back rather than rebuilt.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* await client.lists.restore('list_id');
|
|
97
|
+
* ```
|
|
63
98
|
*/
|
|
64
99
|
restore(listID: string, body: ListRestoreParams, options?: RequestOptions): APIPromise<void> {
|
|
65
100
|
return this._client.put(path`/lists/${listID}/restore`, {
|