@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
|
@@ -8,9 +8,20 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
8
8
|
import { RequestOptions } from '../../internal/request-options';
|
|
9
9
|
import { path } from '../../internal/utils/path';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Manage static groups of users that you subscribe explicitly, and send to them by list id or list pattern.
|
|
13
|
+
*/
|
|
11
14
|
export class Subscriptions extends APIResource {
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* Returns the users subscribed to a list with paging, each with the preferences
|
|
17
|
+
* recorded for that subscription.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const subscriptions = await client.lists.subscriptions.list(
|
|
22
|
+
* 'list_id',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
14
25
|
*/
|
|
15
26
|
list(
|
|
16
27
|
listID: string,
|
|
@@ -23,18 +34,46 @@ export class Subscriptions extends APIResource {
|
|
|
23
34
|
/**
|
|
24
35
|
* Subscribes additional users to the list, without modifying existing
|
|
25
36
|
* subscriptions. If the list does not exist, it will be automatically created.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* await client.lists.subscriptions.add('list_id', {
|
|
41
|
+
* recipients: [{ recipientId: 'recipientId' }],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
26
44
|
*/
|
|
27
|
-
add(listID: string,
|
|
45
|
+
add(listID: string, params: SubscriptionAddParams, options?: RequestOptions): APIPromise<void> {
|
|
46
|
+
const {
|
|
47
|
+
'Idempotency-Key': idempotencyKey,
|
|
48
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
49
|
+
...body
|
|
50
|
+
} = params;
|
|
28
51
|
return this._client.post(path`/lists/${listID}/subscriptions`, {
|
|
29
52
|
body,
|
|
30
53
|
...options,
|
|
31
|
-
headers: buildHeaders([
|
|
54
|
+
headers: buildHeaders([
|
|
55
|
+
{
|
|
56
|
+
Accept: '*/*',
|
|
57
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
58
|
+
...(xIdempotencyExpiration != null ?
|
|
59
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
60
|
+
: undefined),
|
|
61
|
+
},
|
|
62
|
+
options?.headers,
|
|
63
|
+
]),
|
|
32
64
|
});
|
|
33
65
|
}
|
|
34
66
|
|
|
35
67
|
/**
|
|
36
68
|
* Subscribes the users to the list, overwriting existing subscriptions. If the
|
|
37
69
|
* list does not exist, it will be automatically created.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* await client.lists.subscriptions.subscribe('list_id', {
|
|
74
|
+
* recipients: [{ recipientId: 'recipientId' }],
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
38
77
|
*/
|
|
39
78
|
subscribe(listID: string, body: SubscriptionSubscribeParams, options?: RequestOptions): APIPromise<void> {
|
|
40
79
|
return this._client.put(path`/lists/${listID}/subscriptions`, {
|
|
@@ -45,8 +84,15 @@ export class Subscriptions extends APIResource {
|
|
|
45
84
|
}
|
|
46
85
|
|
|
47
86
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
87
|
+
* Subscribes one user to a list, creating the list if it does not yet exist.
|
|
88
|
+
* Optional preferences apply to this subscription only.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* await client.lists.subscriptions.subscribeUser('user_id', {
|
|
93
|
+
* list_id: 'list_id',
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
50
96
|
*/
|
|
51
97
|
subscribeUser(
|
|
52
98
|
userID: string,
|
|
@@ -62,7 +108,16 @@ export class Subscriptions extends APIResource {
|
|
|
62
108
|
}
|
|
63
109
|
|
|
64
110
|
/**
|
|
65
|
-
*
|
|
111
|
+
* Removes one user's subscription to a list, addressed by list id and user id. The
|
|
112
|
+
* user's profile and other subscriptions are separate resources.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* await client.lists.subscriptions.unsubscribeUser(
|
|
117
|
+
* 'user_id',
|
|
118
|
+
* { list_id: 'list_id' },
|
|
119
|
+
* );
|
|
120
|
+
* ```
|
|
66
121
|
*/
|
|
67
122
|
unsubscribeUser(
|
|
68
123
|
userID: string,
|
|
@@ -101,7 +156,28 @@ export interface SubscriptionListParams {
|
|
|
101
156
|
}
|
|
102
157
|
|
|
103
158
|
export interface SubscriptionAddParams {
|
|
159
|
+
/**
|
|
160
|
+
* Body param
|
|
161
|
+
*/
|
|
104
162
|
recipients: Array<ListsAPI.PutSubscriptionsRecipient>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
166
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
167
|
+
* response from the first request without performing the operation again
|
|
168
|
+
* (including the original status code and any error). Use it to safely retry
|
|
169
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
170
|
+
* is scoped to this endpoint.
|
|
171
|
+
*/
|
|
172
|
+
'Idempotency-Key'?: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
176
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
177
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
178
|
+
* maximum is 1 year.
|
|
179
|
+
*/
|
|
180
|
+
'x-idempotency-expiration'?: string;
|
|
105
181
|
}
|
|
106
182
|
|
|
107
183
|
export interface SubscriptionSubscribeParams {
|
|
@@ -6,16 +6,21 @@ import { APIPromise } from '../core/api-promise';
|
|
|
6
6
|
import { RequestOptions } from '../internal/request-options';
|
|
7
7
|
import { path } from '../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Look up the messages Courier has accepted, inspect their delivery history and rendered output, and cancel, resend, or archive them.
|
|
11
|
+
*/
|
|
9
12
|
export class Messages extends APIResource {
|
|
10
13
|
/**
|
|
11
|
-
*
|
|
14
|
+
* Returns a sent message's status, recipient, event, and per-provider delivery
|
|
15
|
+
* detail, with timestamps for enqueued, sent, delivered, opened, and clicked.
|
|
12
16
|
*/
|
|
13
17
|
retrieve(messageID: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse> {
|
|
14
18
|
return this._client.get(path`/messages/${messageID}`, options);
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Returns previously sent messages, most recent first, each carrying its status,
|
|
23
|
+
* recipient, channel, and provider. Paged by cursor.
|
|
19
24
|
*/
|
|
20
25
|
list(
|
|
21
26
|
query: MessageListParams | null | undefined = {},
|
|
@@ -25,25 +30,24 @@ export class Messages extends APIResource {
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* status code for a successful cancellation or `409` status code for an
|
|
31
|
-
* unsuccessful cancellation. Both cases will include the actual message record in
|
|
32
|
-
* the response body (see details below).
|
|
33
|
+
* Cancels a message that is still in the delivery pipeline and returns the message
|
|
34
|
+
* record with its resulting canceled or failed status.
|
|
33
35
|
*/
|
|
34
36
|
cancel(messageID: string, options?: RequestOptions): APIPromise<MessageDetails> {
|
|
35
37
|
return this._client.post(path`/messages/${messageID}/cancel`, options);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Returns the rendered content Courier delivered for a message, broken out per
|
|
42
|
+
* channel, to confirm what the recipient received.
|
|
40
43
|
*/
|
|
41
44
|
content(messageID: string, options?: RequestOptions): APIPromise<MessageContentResponse> {
|
|
42
45
|
return this._client.get(path`/messages/${messageID}/output`, options);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Returns the ordered event history for a sent message, one entry per status
|
|
50
|
+
* transition with its timestamp.
|
|
47
51
|
*/
|
|
48
52
|
history(
|
|
49
53
|
messageID: string,
|
|
@@ -54,11 +58,8 @@ export class Messages extends APIResource {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* producing a **new** `messageId` — the original message is not modified.
|
|
60
|
-
* Throttled by a per-message rate limit; a repeat inside the limit window returns
|
|
61
|
-
* `429 Too Many Requests`.
|
|
61
|
+
* Resends a previously sent message to the same recipient and content, returning a
|
|
62
|
+
* new messageId. The original send request is not modified.
|
|
62
63
|
*/
|
|
63
64
|
resend(messageID: string, options?: RequestOptions): APIPromise<MessageResendResponse> {
|
|
64
65
|
return this._client.post(path`/messages/${messageID}/resend`, options);
|
|
@@ -7,9 +7,13 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
7
7
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
8
|
import { path } from '../../internal/utils/path';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Create, update, version, publish, and localize notification templates and their content.
|
|
12
|
+
*/
|
|
10
13
|
export class Checks extends APIResource {
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* Replaces the approval checks on a template submission with the complete set
|
|
16
|
+
* supplied in the request body.
|
|
13
17
|
*
|
|
14
18
|
* @example
|
|
15
19
|
* ```ts
|
|
@@ -38,7 +42,8 @@ export class Checks extends APIResource {
|
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
|
-
*
|
|
45
|
+
* Returns the approval checks recorded for a template submission, each with its
|
|
46
|
+
* pass or fail result.
|
|
42
47
|
*
|
|
43
48
|
* @example
|
|
44
49
|
* ```ts
|
|
@@ -58,7 +63,8 @@ export class Checks extends APIResource {
|
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/**
|
|
61
|
-
*
|
|
66
|
+
* Cancels a pending template submission, withdrawing it from the approval
|
|
67
|
+
* workflow. The template stays in draft and can be resubmitted later.
|
|
62
68
|
*
|
|
63
69
|
* @example
|
|
64
70
|
* ```ts
|
|
@@ -16,6 +16,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
16
16
|
import { RequestOptions } from '../../internal/request-options';
|
|
17
17
|
import { path } from '../../internal/utils/path';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Create, update, version, publish, and localize notification templates and their content.
|
|
21
|
+
*/
|
|
19
22
|
export class Notifications extends APIResource {
|
|
20
23
|
checks: ChecksAPI.Checks = new ChecksAPI.Checks(this._client);
|
|
21
24
|
|
|
@@ -46,8 +49,28 @@ export class Notifications extends APIResource {
|
|
|
46
49
|
* });
|
|
47
50
|
* ```
|
|
48
51
|
*/
|
|
49
|
-
create(
|
|
50
|
-
|
|
52
|
+
create(
|
|
53
|
+
params: NotificationCreateParams,
|
|
54
|
+
options?: RequestOptions,
|
|
55
|
+
): APIPromise<NotificationTemplateResponse> {
|
|
56
|
+
const {
|
|
57
|
+
'Idempotency-Key': idempotencyKey,
|
|
58
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
59
|
+
...body
|
|
60
|
+
} = params;
|
|
61
|
+
return this._client.post('/notifications', {
|
|
62
|
+
body,
|
|
63
|
+
...options,
|
|
64
|
+
headers: buildHeaders([
|
|
65
|
+
{
|
|
66
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
67
|
+
...(xIdempotencyExpiration != null ?
|
|
68
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
69
|
+
: undefined),
|
|
70
|
+
},
|
|
71
|
+
options?.headers,
|
|
72
|
+
]),
|
|
73
|
+
});
|
|
51
74
|
}
|
|
52
75
|
|
|
53
76
|
/**
|
|
@@ -69,7 +92,8 @@ export class Notifications extends APIResource {
|
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
/**
|
|
72
|
-
*
|
|
95
|
+
* Lists the workspace's notification templates. Each carries a name, tags, brand,
|
|
96
|
+
* routing, and its draft or published state.
|
|
73
97
|
*
|
|
74
98
|
* @example
|
|
75
99
|
* ```ts
|
|
@@ -84,7 +108,8 @@ export class Notifications extends APIResource {
|
|
|
84
108
|
}
|
|
85
109
|
|
|
86
110
|
/**
|
|
87
|
-
*
|
|
111
|
+
* Archives a notification template, preventing new sends from referencing it. The
|
|
112
|
+
* template stays retrievable for its version history.
|
|
88
113
|
*
|
|
89
114
|
* @example
|
|
90
115
|
* ```ts
|
|
@@ -99,12 +124,9 @@ export class Notifications extends APIResource {
|
|
|
99
124
|
}
|
|
100
125
|
|
|
101
126
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* and content, and is always created as a standalone template (it is not linked to
|
|
106
|
-
* any journey or broadcast, even if the source was). Templates that are scoped to
|
|
107
|
-
* a journey or a broadcast cannot be duplicated through this endpoint.
|
|
127
|
+
* Copies a notification template within the same workspace and environment,
|
|
128
|
+
* appending " COPY" to the title. The copy is standalone and independently
|
|
129
|
+
* editable.
|
|
108
130
|
*
|
|
109
131
|
* @example
|
|
110
132
|
* ```ts
|
|
@@ -117,7 +139,8 @@ export class Notifications extends APIResource {
|
|
|
117
139
|
}
|
|
118
140
|
|
|
119
141
|
/**
|
|
120
|
-
*
|
|
142
|
+
* Returns a notification template's published versions, most recent first, for
|
|
143
|
+
* comparison or rollback. Paged.
|
|
121
144
|
*
|
|
122
145
|
* @example
|
|
123
146
|
* ```ts
|
|
@@ -144,20 +167,33 @@ export class Notifications extends APIResource {
|
|
|
144
167
|
*/
|
|
145
168
|
publish(
|
|
146
169
|
id: string,
|
|
147
|
-
|
|
170
|
+
params: NotificationPublishParams | null | undefined = {},
|
|
148
171
|
options?: RequestOptions,
|
|
149
172
|
): APIPromise<void> {
|
|
173
|
+
const {
|
|
174
|
+
'Idempotency-Key': idempotencyKey,
|
|
175
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
176
|
+
...body
|
|
177
|
+
} = params ?? {};
|
|
150
178
|
return this._client.post(path`/notifications/${id}/publish`, {
|
|
151
179
|
body,
|
|
152
180
|
...options,
|
|
153
|
-
headers: buildHeaders([
|
|
181
|
+
headers: buildHeaders([
|
|
182
|
+
{
|
|
183
|
+
Accept: '*/*',
|
|
184
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
185
|
+
...(xIdempotencyExpiration != null ?
|
|
186
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
187
|
+
: undefined),
|
|
188
|
+
},
|
|
189
|
+
options?.headers,
|
|
190
|
+
]),
|
|
154
191
|
});
|
|
155
192
|
}
|
|
156
193
|
|
|
157
194
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* (elemental) templates.
|
|
195
|
+
* Replaces all Elemental content in a template, overwriting every existing
|
|
196
|
+
* element. Supported for V2 templates only, not V1 blocks and channels.
|
|
161
197
|
*
|
|
162
198
|
* @example
|
|
163
199
|
* ```ts
|
|
@@ -180,8 +216,8 @@ export class Notifications extends APIResource {
|
|
|
180
216
|
}
|
|
181
217
|
|
|
182
218
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
219
|
+
* Replaces one Elemental element in a template, addressed by its element id.
|
|
220
|
+
* Supported for V2 templates only, not V1 blocks and channels.
|
|
185
221
|
*
|
|
186
222
|
* @example
|
|
187
223
|
* ```ts
|
|
@@ -204,9 +240,8 @@ export class Notifications extends APIResource {
|
|
|
204
240
|
}
|
|
205
241
|
|
|
206
242
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* (elemental) templates.
|
|
243
|
+
* Sets locale-specific content overrides for a template. Each override must
|
|
244
|
+
* reference an element that already exists in the default content.
|
|
210
245
|
*
|
|
211
246
|
* @example
|
|
212
247
|
* ```ts
|
|
@@ -231,7 +266,8 @@ export class Notifications extends APIResource {
|
|
|
231
266
|
}
|
|
232
267
|
|
|
233
268
|
/**
|
|
234
|
-
*
|
|
269
|
+
* Replaces a notification template in full, so send every field rather than only
|
|
270
|
+
* the ones you want changed. Publish separately to make it live.
|
|
235
271
|
*
|
|
236
272
|
* @example
|
|
237
273
|
* ```ts
|
|
@@ -261,10 +297,8 @@ export class Notifications extends APIResource {
|
|
|
261
297
|
}
|
|
262
298
|
|
|
263
299
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* the `version` query parameter to select draft, published, or a specific
|
|
267
|
-
* historical version.
|
|
300
|
+
* Returns a template's content and checksum. V2 templates return Elemental
|
|
301
|
+
* elements, while V1 templates return blocks and channels instead.
|
|
268
302
|
*
|
|
269
303
|
* @example
|
|
270
304
|
* ```ts
|
|
@@ -805,16 +839,34 @@ export type NotificationRetrieveContentResponse = NotificationContentGetResponse
|
|
|
805
839
|
|
|
806
840
|
export interface NotificationCreateParams {
|
|
807
841
|
/**
|
|
808
|
-
* Core template fields used in POST and PUT request bodies (nested
|
|
809
|
-
* `notification` key) and returned at the top level in responses.
|
|
842
|
+
* Body param: Core template fields used in POST and PUT request bodies (nested
|
|
843
|
+
* under a `notification` key) and returned at the top level in responses.
|
|
810
844
|
*/
|
|
811
845
|
notification: NotificationTemplatePayload;
|
|
812
846
|
|
|
813
847
|
/**
|
|
814
|
-
* Template state after creation. Case-insensitive input, normalized to
|
|
815
|
-
* in the response. Defaults to "DRAFT".
|
|
848
|
+
* Body param: Template state after creation. Case-insensitive input, normalized to
|
|
849
|
+
* uppercase in the response. Defaults to "DRAFT".
|
|
816
850
|
*/
|
|
817
851
|
state?: 'DRAFT' | 'PUBLISHED';
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
855
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
856
|
+
* response from the first request without performing the operation again
|
|
857
|
+
* (including the original status code and any error). Use it to safely retry
|
|
858
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
859
|
+
* is scoped to this endpoint.
|
|
860
|
+
*/
|
|
861
|
+
'Idempotency-Key'?: string;
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
865
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
866
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
867
|
+
* maximum is 1 year.
|
|
868
|
+
*/
|
|
869
|
+
'x-idempotency-expiration'?: string;
|
|
818
870
|
}
|
|
819
871
|
|
|
820
872
|
export interface NotificationRetrieveParams {
|
|
@@ -856,9 +908,28 @@ export interface NotificationListVersionsParams {
|
|
|
856
908
|
|
|
857
909
|
export interface NotificationPublishParams {
|
|
858
910
|
/**
|
|
859
|
-
* Historical version to publish (e.g. "v001"). Omit to publish the
|
|
911
|
+
* Body param: Historical version to publish (e.g. "v001"). Omit to publish the
|
|
912
|
+
* current draft.
|
|
860
913
|
*/
|
|
861
914
|
version?: string;
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
918
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
919
|
+
* response from the first request without performing the operation again
|
|
920
|
+
* (including the original status code and any error). Use it to safely retry
|
|
921
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
922
|
+
* is scoped to this endpoint.
|
|
923
|
+
*/
|
|
924
|
+
'Idempotency-Key'?: string;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
928
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
929
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
930
|
+
* maximum is 1 year.
|
|
931
|
+
*/
|
|
932
|
+
'x-idempotency-expiration'?: string;
|
|
862
933
|
}
|
|
863
934
|
|
|
864
935
|
export interface NotificationPutContentParams {
|
|
@@ -4,12 +4,24 @@ import { APIResource } from '../../core/resource';
|
|
|
4
4
|
import * as Shared from '../shared';
|
|
5
5
|
import * as ProfilesAPI from './profiles';
|
|
6
6
|
import { APIPromise } from '../../core/api-promise';
|
|
7
|
+
import { buildHeaders } from '../../internal/headers';
|
|
7
8
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
9
|
import { path } from '../../internal/utils/path';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Store the contact information Courier delivers to for each user — email, phone number, push tokens, and any custom data you send to.
|
|
13
|
+
*/
|
|
10
14
|
export class Lists extends APIResource {
|
|
11
15
|
/**
|
|
12
|
-
* Returns the subscribed
|
|
16
|
+
* Returns the lists a user is subscribed to, with paging. Use it to check what a
|
|
17
|
+
* recipient will receive before sending to a list.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const list = await client.profiles.lists.retrieve(
|
|
22
|
+
* 'user_id',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
13
25
|
*/
|
|
14
26
|
retrieve(
|
|
15
27
|
userID: string,
|
|
@@ -20,22 +32,53 @@ export class Lists extends APIResource {
|
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
/**
|
|
23
|
-
* Removes
|
|
35
|
+
* Removes every list subscription for a user at once. Their profile and
|
|
36
|
+
* preferences are untouched, so this only affects list-targeted sends.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const list = await client.profiles.lists.delete('user_id');
|
|
41
|
+
* ```
|
|
24
42
|
*/
|
|
25
43
|
delete(userID: string, options?: RequestOptions): APIPromise<ListDeleteResponse> {
|
|
26
44
|
return this._client.delete(path`/profiles/${userID}/lists`, options);
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
/**
|
|
30
|
-
* Subscribes
|
|
31
|
-
*
|
|
48
|
+
* Subscribes a user to one or more lists, creating any list that does not yet
|
|
49
|
+
* exist. Optional preferences apply to each subscription.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const response = await client.profiles.lists.subscribe(
|
|
54
|
+
* 'user_id',
|
|
55
|
+
* { lists: [{ listId: 'listId' }] },
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
32
58
|
*/
|
|
33
59
|
subscribe(
|
|
34
60
|
userID: string,
|
|
35
|
-
|
|
61
|
+
params: ListSubscribeParams,
|
|
36
62
|
options?: RequestOptions,
|
|
37
63
|
): APIPromise<ListSubscribeResponse> {
|
|
38
|
-
|
|
64
|
+
const {
|
|
65
|
+
'Idempotency-Key': idempotencyKey,
|
|
66
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
67
|
+
...body
|
|
68
|
+
} = params;
|
|
69
|
+
return this._client.post(path`/profiles/${userID}/lists`, {
|
|
70
|
+
body,
|
|
71
|
+
...options,
|
|
72
|
+
headers: buildHeaders([
|
|
73
|
+
{
|
|
74
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
75
|
+
...(xIdempotencyExpiration != null ?
|
|
76
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
77
|
+
: undefined),
|
|
78
|
+
},
|
|
79
|
+
options?.headers,
|
|
80
|
+
]),
|
|
81
|
+
});
|
|
39
82
|
}
|
|
40
83
|
}
|
|
41
84
|
|
|
@@ -89,7 +132,28 @@ export interface ListRetrieveParams {
|
|
|
89
132
|
}
|
|
90
133
|
|
|
91
134
|
export interface ListSubscribeParams {
|
|
135
|
+
/**
|
|
136
|
+
* Body param
|
|
137
|
+
*/
|
|
92
138
|
lists: Array<ProfilesAPI.SubscribeToListsRequestItem>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
142
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
143
|
+
* response from the first request without performing the operation again
|
|
144
|
+
* (including the original status code and any error). Use it to safely retry
|
|
145
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
146
|
+
* is scoped to this endpoint.
|
|
147
|
+
*/
|
|
148
|
+
'Idempotency-Key'?: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
152
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
153
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
154
|
+
* maximum is 1 year.
|
|
155
|
+
*/
|
|
156
|
+
'x-idempotency-expiration'?: string;
|
|
93
157
|
}
|
|
94
158
|
|
|
95
159
|
export declare namespace Lists {
|