@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
|
@@ -20,12 +20,16 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
20
20
|
import { RequestOptions } from '../../internal/request-options';
|
|
21
21
|
import { path } from '../../internal/utils/path';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Manage tenants — the organizations, teams, or accounts your users belong to — along with their users and default preferences.
|
|
25
|
+
*/
|
|
23
26
|
export class Tenants extends APIResource {
|
|
24
27
|
preferences: PreferencesAPI.Preferences = new PreferencesAPI.Preferences(this._client);
|
|
25
28
|
templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
31
|
+
* Returns one tenant with its name, parent tenant id, default preferences,
|
|
32
|
+
* properties, and the user profile applied to its members.
|
|
29
33
|
*
|
|
30
34
|
* @example
|
|
31
35
|
* ```ts
|
|
@@ -37,7 +41,8 @@ export class Tenants extends APIResource {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
44
|
+
* Creates or replaces a tenant from a name, parent, brand, properties, and default
|
|
45
|
+
* preferences supplied in the request body.
|
|
41
46
|
*
|
|
42
47
|
* @example
|
|
43
48
|
* ```ts
|
|
@@ -51,7 +56,8 @@ export class Tenants extends APIResource {
|
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
|
-
*
|
|
59
|
+
* Lists the workspace's tenants, each carrying a name, parent tenant, properties,
|
|
60
|
+
* and default preferences. Paged.
|
|
55
61
|
*
|
|
56
62
|
* @example
|
|
57
63
|
* ```ts
|
|
@@ -66,7 +72,8 @@ export class Tenants extends APIResource {
|
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
/**
|
|
69
|
-
*
|
|
75
|
+
* Deletes a tenant. Its members' workspace-level profiles and preferences live
|
|
76
|
+
* outside the tenant and are managed separately.
|
|
70
77
|
*
|
|
71
78
|
* @example
|
|
72
79
|
* ```ts
|
|
@@ -81,7 +88,8 @@ export class Tenants extends APIResource {
|
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
/**
|
|
84
|
-
*
|
|
91
|
+
* Returns the users belonging to a tenant with cursor paging. Use it to see who a
|
|
92
|
+
* tenant-scoped send will reach.
|
|
85
93
|
*
|
|
86
94
|
* @example
|
|
87
95
|
* ```ts
|
|
@@ -6,9 +6,13 @@ import { buildHeaders } from '../internal/headers';
|
|
|
6
6
|
import { RequestOptions } from '../internal/request-options';
|
|
7
7
|
import { path } from '../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Store and retrieve the translation strings Courier uses to render localized template content.
|
|
11
|
+
*/
|
|
9
12
|
export class Translations extends APIResource {
|
|
10
13
|
/**
|
|
11
|
-
*
|
|
14
|
+
* Returns the translation strings stored for one domain and locale, for use in
|
|
15
|
+
* localized notification content.
|
|
12
16
|
*/
|
|
13
17
|
retrieve(locale: string, params: TranslationRetrieveParams, options?: RequestOptions): APIPromise<string> {
|
|
14
18
|
const { domain } = params;
|
|
@@ -16,7 +20,8 @@ export class Translations extends APIResource {
|
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
23
|
+
* Uploads the translation strings for one domain and locale. Courier uses them to
|
|
24
|
+
* render localized content for recipients in that locale.
|
|
20
25
|
*/
|
|
21
26
|
update(locale: string, params: TranslationUpdateParams, options?: RequestOptions): APIPromise<void> {
|
|
22
27
|
const { domain, body } = params;
|
|
@@ -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
|
+
* Read and write a single user's notification preferences, per topic and per channel.
|
|
12
|
+
*/
|
|
10
13
|
export class Preferences extends APIResource {
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* Returns a user's preference overrides with paging, one entry per subscription
|
|
16
|
+
* topic they have set a choice for.
|
|
13
17
|
*
|
|
14
18
|
* @example
|
|
15
19
|
* ```ts
|
|
@@ -27,23 +31,8 @@ export class Preferences extends APIResource {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* listed topics are created or updated, and every existing override that is not
|
|
33
|
-
* included in the body is reset to its topic default. Submitting an empty `topics`
|
|
34
|
-
* array is a valid clear-all that resets every existing override.
|
|
35
|
-
*
|
|
36
|
-
* This operation is validation-atomic (all-or-nothing): structural validation
|
|
37
|
-
* fails fast with a single `400`, and if any topic is semantically invalid (an
|
|
38
|
-
* unknown topic, a `REQUIRED` topic that cannot be opted out, or a custom routing
|
|
39
|
-
* request that is not available on the workspace's plan) the request returns a
|
|
40
|
-
* single `400` aggregating every failure in `errors` and writes nothing. On
|
|
41
|
-
* success it returns `200` with `items` (the complete resulting override set) and
|
|
42
|
-
* `deleted` (the ids of the overrides that were reset to default).
|
|
43
|
-
*
|
|
44
|
-
* Every `topic_id` in the response — in `items`, `deleted`, and any `errors` — is
|
|
45
|
-
* returned in Courier's canonical topic id form, regardless of the form supplied
|
|
46
|
-
* in the request.
|
|
34
|
+
* Replaces a user's entire set of preference overrides. Any topic you leave out is
|
|
35
|
+
* reset to its default, so send the full set rather than a subset.
|
|
47
36
|
*
|
|
48
37
|
* @example
|
|
49
38
|
* ```ts
|
|
@@ -72,23 +61,8 @@ export class Preferences extends APIResource {
|
|
|
72
61
|
}
|
|
73
62
|
|
|
74
63
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* created or updated; any existing overrides for topics not listed are left
|
|
78
|
-
* untouched.
|
|
79
|
-
*
|
|
80
|
-
* Structural validation of the request body fails fast with a single `400`. Beyond
|
|
81
|
-
* that, each topic is processed independently (partial-success, not
|
|
82
|
-
* all-or-nothing): valid topics are written and returned in `items`, while topics
|
|
83
|
-
* that cannot be applied are collected in `errors` with a per-topic `reason` (for
|
|
84
|
-
* example an unknown topic, a `REQUIRED` topic that cannot be opted out, a custom
|
|
85
|
-
* routing request that is not available on the workspace's plan, or a write
|
|
86
|
-
* failure). The request therefore returns `200` with both lists whenever the body
|
|
87
|
-
* is structurally valid.
|
|
88
|
-
*
|
|
89
|
-
* Every `topic_id` in the response — in both `items` and `errors` — is returned in
|
|
90
|
-
* Courier's canonical topic id form, regardless of the form supplied in the
|
|
91
|
-
* request.
|
|
64
|
+
* Adds or updates a user's preferences for several subscription topics at once.
|
|
65
|
+
* Topics you leave out keep whatever they were set to before.
|
|
92
66
|
*
|
|
93
67
|
* @example
|
|
94
68
|
* ```ts
|
|
@@ -116,14 +90,31 @@ export class Preferences extends APIResource {
|
|
|
116
90
|
params: PreferenceBulkUpdateParams,
|
|
117
91
|
options?: RequestOptions,
|
|
118
92
|
): APIPromise<PreferenceBulkUpdateResponse> {
|
|
119
|
-
const {
|
|
120
|
-
|
|
93
|
+
const {
|
|
94
|
+
tenant_id,
|
|
95
|
+
'Idempotency-Key': idempotencyKey,
|
|
96
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
97
|
+
...body
|
|
98
|
+
} = params;
|
|
99
|
+
return this._client.post(path`/users/${userID}/preferences`, {
|
|
100
|
+
query: { tenant_id },
|
|
101
|
+
body,
|
|
102
|
+
...options,
|
|
103
|
+
headers: buildHeaders([
|
|
104
|
+
{
|
|
105
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
106
|
+
...(xIdempotencyExpiration != null ?
|
|
107
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
108
|
+
: undefined),
|
|
109
|
+
},
|
|
110
|
+
options?.headers,
|
|
111
|
+
]),
|
|
112
|
+
});
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* preference that does not exist succeeds with no error.
|
|
116
|
+
* Removes a user's override for one subscription topic, resetting it to the
|
|
117
|
+
* effective default from the tenant or workspace.
|
|
127
118
|
*
|
|
128
119
|
* @example
|
|
129
120
|
* ```ts
|
|
@@ -146,7 +137,8 @@ export class Preferences extends APIResource {
|
|
|
146
137
|
}
|
|
147
138
|
|
|
148
139
|
/**
|
|
149
|
-
*
|
|
140
|
+
* Returns a user's opt-in status and channel choices for one subscription topic,
|
|
141
|
+
* or the effective default if they have set no override.
|
|
150
142
|
*
|
|
151
143
|
* @example
|
|
152
144
|
* ```ts
|
|
@@ -166,7 +158,8 @@ export class Preferences extends APIResource {
|
|
|
166
158
|
}
|
|
167
159
|
|
|
168
160
|
/**
|
|
169
|
-
*
|
|
161
|
+
* Sets a user's opt-in status and channel choices for one subscription topic,
|
|
162
|
+
* overriding the tenant default for that topic only.
|
|
170
163
|
*
|
|
171
164
|
* @example
|
|
172
165
|
* ```ts
|
|
@@ -216,19 +209,40 @@ export interface BulkPreferenceTopic {
|
|
|
216
209
|
}
|
|
217
210
|
|
|
218
211
|
export interface TopicPreference {
|
|
212
|
+
/**
|
|
213
|
+
* The topic's default status, returned on reads. It applies whenever the user has
|
|
214
|
+
* no override of their own (status equals this value).
|
|
215
|
+
*/
|
|
219
216
|
default_status: Shared.PreferenceStatus;
|
|
220
217
|
|
|
218
|
+
/**
|
|
219
|
+
* The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the
|
|
220
|
+
* user's own choice; REQUIRED is a topic-level default set in the preferences
|
|
221
|
+
* editor, not a user choice.
|
|
222
|
+
*/
|
|
221
223
|
status: Shared.PreferenceStatus;
|
|
222
224
|
|
|
225
|
+
/**
|
|
226
|
+
* The unique identifier of the subscription topic this preference applies to.
|
|
227
|
+
*/
|
|
223
228
|
topic_id: string;
|
|
224
229
|
|
|
230
|
+
/**
|
|
231
|
+
* The display name of the subscription topic, returned on reads.
|
|
232
|
+
*/
|
|
225
233
|
topic_name: string;
|
|
226
234
|
|
|
227
235
|
/**
|
|
228
|
-
* The
|
|
236
|
+
* The channels the user has chosen to receive this topic on, present only when
|
|
237
|
+
* has_custom_routing is true. One or more of: direct_message, email, push, sms,
|
|
238
|
+
* webhook, inbox.
|
|
229
239
|
*/
|
|
230
240
|
custom_routing?: Array<Shared.ChannelClassification> | null;
|
|
231
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Whether the user has chosen specific delivery channels for this topic (listed in
|
|
244
|
+
* custom_routing) rather than the topic's default routing.
|
|
245
|
+
*/
|
|
232
246
|
has_custom_routing?: boolean | null;
|
|
233
247
|
}
|
|
234
248
|
|
|
@@ -346,6 +360,24 @@ export interface PreferenceBulkUpdateParams {
|
|
|
346
360
|
* Query param: Update the preferences of a user for this specific tenant context.
|
|
347
361
|
*/
|
|
348
362
|
tenant_id?: string | null;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
366
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
367
|
+
* response from the first request without performing the operation again
|
|
368
|
+
* (including the original status code and any error). Use it to safely retry
|
|
369
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
370
|
+
* is scoped to this endpoint.
|
|
371
|
+
*/
|
|
372
|
+
'Idempotency-Key'?: string;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
376
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
377
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
378
|
+
* maximum is 1 year.
|
|
379
|
+
*/
|
|
380
|
+
'x-idempotency-expiration'?: string;
|
|
349
381
|
}
|
|
350
382
|
|
|
351
383
|
export namespace PreferenceBulkUpdateParams {
|
|
@@ -418,13 +450,23 @@ export interface PreferenceUpdateOrCreateTopicParams {
|
|
|
418
450
|
|
|
419
451
|
export namespace PreferenceUpdateOrCreateTopicParams {
|
|
420
452
|
export interface Topic {
|
|
453
|
+
/**
|
|
454
|
+
* The subscription status to set: OPTED_IN or OPTED_OUT. REQUIRED is a topic-level
|
|
455
|
+
* default, not a user choice; the API rejects opting a user out of a REQUIRED
|
|
456
|
+
* topic.
|
|
457
|
+
*/
|
|
421
458
|
status: Shared.PreferenceStatus;
|
|
422
459
|
|
|
423
460
|
/**
|
|
424
|
-
* The
|
|
461
|
+
* The channels to deliver this topic on when has_custom_routing is true. One or
|
|
462
|
+
* more of: direct_message, email, push, sms, webhook, inbox.
|
|
425
463
|
*/
|
|
426
464
|
custom_routing?: Array<Shared.ChannelClassification> | null;
|
|
427
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Set to true to route this topic to the channels in custom_routing instead of the
|
|
468
|
+
* topic's default routing.
|
|
469
|
+
*/
|
|
428
470
|
has_custom_routing?: boolean | null;
|
|
429
471
|
}
|
|
430
472
|
}
|
|
@@ -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
|
+
* Associate a user with one or more tenants, and read or remove those associations.
|
|
12
|
+
*/
|
|
10
13
|
export class Tenants extends APIResource {
|
|
11
14
|
/**
|
|
12
|
-
* Returns a
|
|
15
|
+
* Returns the tenants a user belongs to, with cursor paging. A user can belong to
|
|
16
|
+
* many tenants, each with its own profile and preferences.
|
|
13
17
|
*
|
|
14
18
|
* @example
|
|
15
19
|
* ```ts
|
|
@@ -25,9 +29,8 @@ export class Tenants extends APIResource {
|
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
29
|
-
* profile
|
|
30
|
-
* the user's main profile when sending to the user with that tenant.
|
|
32
|
+
* Adds a user to several tenants in one call, each optionally with a per-tenant
|
|
33
|
+
* profile that overrides their workspace profile.
|
|
31
34
|
*
|
|
32
35
|
* @example
|
|
33
36
|
* ```ts
|
|
@@ -45,10 +48,8 @@ export class Tenants extends APIResource {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* A custom profile can also be supplied with the tenant. This profile will be
|
|
51
|
-
* merged with the user's main profile when sending to the user with that tenant.
|
|
51
|
+
* Adds a user to one tenant, optionally with a tenant-specific profile that
|
|
52
|
+
* overrides their workspace profile for sends in that tenant.
|
|
52
53
|
*
|
|
53
54
|
* @example
|
|
54
55
|
* ```ts
|
|
@@ -67,7 +68,8 @@ export class Tenants extends APIResource {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
|
-
* Removes a user from
|
|
71
|
+
* Removes a user from every tenant they belong to in one call. Their
|
|
72
|
+
* workspace-level profile is a separate resource.
|
|
71
73
|
*
|
|
72
74
|
* @example
|
|
73
75
|
* ```ts
|
|
@@ -82,7 +84,8 @@ export class Tenants extends APIResource {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
/**
|
|
85
|
-
* Removes a user from
|
|
87
|
+
* Removes a user from one tenant. Their other tenant memberships and workspace
|
|
88
|
+
* profile are managed through separate endpoints.
|
|
86
89
|
*
|
|
87
90
|
* @example
|
|
88
91
|
* ```ts
|
|
@@ -6,9 +6,13 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { path } from '../../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Register and manage the APNS and FCM device tokens Courier delivers push notifications to.
|
|
11
|
+
*/
|
|
9
12
|
export class Tokens extends APIResource {
|
|
10
13
|
/**
|
|
11
|
-
*
|
|
14
|
+
* Returns one device token with its provider key, status and status reason, expiry
|
|
15
|
+
* date, and any properties stored alongside it.
|
|
12
16
|
*
|
|
13
17
|
* @example
|
|
14
18
|
* ```ts
|
|
@@ -27,7 +31,8 @@ export class Tokens extends APIResource {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
34
|
+
* Applies a JSON Patch to a device token, changing its status, expiry, or
|
|
35
|
+
* properties without re-registering it.
|
|
31
36
|
*
|
|
32
37
|
* @example
|
|
33
38
|
* ```ts
|
|
@@ -47,7 +52,8 @@ export class Tokens extends APIResource {
|
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
/**
|
|
50
|
-
*
|
|
55
|
+
* Returns every device token registered for a user, each with its provider key,
|
|
56
|
+
* status, and expiry date.
|
|
51
57
|
*
|
|
52
58
|
* @example
|
|
53
59
|
* ```ts
|
|
@@ -59,7 +65,8 @@ export class Tokens extends APIResource {
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
|
-
*
|
|
68
|
+
* Deletes one device token for a user, addressed by the token value, so push sends
|
|
69
|
+
* no longer target that device.
|
|
63
70
|
*
|
|
64
71
|
* @example
|
|
65
72
|
* ```ts
|
|
@@ -77,7 +84,8 @@ export class Tokens extends APIResource {
|
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
/**
|
|
80
|
-
*
|
|
87
|
+
* Registers several device tokens for a user in one call, overwriting any stored
|
|
88
|
+
* token with a matching value.
|
|
81
89
|
*
|
|
82
90
|
* @example
|
|
83
91
|
* ```ts
|
|
@@ -92,7 +100,8 @@ export class Tokens extends APIResource {
|
|
|
92
100
|
}
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
|
-
*
|
|
103
|
+
* Registers one device token for a user against a provider key, overwriting the
|
|
104
|
+
* token if it already exists. Push sends resolve tokens per user.
|
|
96
105
|
*
|
|
97
106
|
* @example
|
|
98
107
|
* ```ts
|
|
@@ -8,11 +8,13 @@ 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 the workspace catalog of subscription topics, the sections that group them, and publishing the preference page.
|
|
13
|
+
*/
|
|
11
14
|
export class Topics extends APIResource {
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* returned.
|
|
16
|
+
* Creates a subscription topic inside a workspace preference. The default status
|
|
17
|
+
* sets whether users start opted in, opted out, or required.
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
18
20
|
* ```ts
|
|
@@ -25,16 +27,32 @@ export class Topics extends APIResource {
|
|
|
25
27
|
*/
|
|
26
28
|
create(
|
|
27
29
|
sectionID: string,
|
|
28
|
-
|
|
30
|
+
params: TopicCreateParams,
|
|
29
31
|
options?: RequestOptions,
|
|
30
32
|
): APIPromise<WorkspacePreferencesAPI.WorkspacePreferenceTopicGetResponse> {
|
|
31
|
-
|
|
33
|
+
const {
|
|
34
|
+
'Idempotency-Key': idempotencyKey,
|
|
35
|
+
'x-idempotency-expiration': xIdempotencyExpiration,
|
|
36
|
+
...body
|
|
37
|
+
} = params;
|
|
38
|
+
return this._client.post(path`/preferences/sections/${sectionID}/topics`, {
|
|
39
|
+
body,
|
|
40
|
+
...options,
|
|
41
|
+
headers: buildHeaders([
|
|
42
|
+
{
|
|
43
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
44
|
+
...(xIdempotencyExpiration != null ?
|
|
45
|
+
{ 'x-idempotency-expiration': xIdempotencyExpiration }
|
|
46
|
+
: undefined),
|
|
47
|
+
},
|
|
48
|
+
options?.headers,
|
|
49
|
+
]),
|
|
50
|
+
});
|
|
32
51
|
}
|
|
33
52
|
|
|
34
53
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* different workspace preference.
|
|
54
|
+
* Returns one subscription topic with its default status, routing options, allowed
|
|
55
|
+
* preferences, and unsubscribe header setting.
|
|
38
56
|
*
|
|
39
57
|
* @example
|
|
40
58
|
* ```ts
|
|
@@ -55,7 +73,8 @@ export class Topics extends APIResource {
|
|
|
55
73
|
}
|
|
56
74
|
|
|
57
75
|
/**
|
|
58
|
-
*
|
|
76
|
+
* Returns the subscription topics inside a workspace preference, each with its
|
|
77
|
+
* default status and routing options.
|
|
59
78
|
*
|
|
60
79
|
* @example
|
|
61
80
|
* ```ts
|
|
@@ -73,8 +92,8 @@ export class Topics extends APIResource {
|
|
|
73
92
|
}
|
|
74
93
|
|
|
75
94
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
95
|
+
* Archives a subscription topic and removes it from its workspace preference,
|
|
96
|
+
* addressed by section id and topic id.
|
|
78
97
|
*
|
|
79
98
|
* @example
|
|
80
99
|
* ```ts
|
|
@@ -124,40 +143,62 @@ export class Topics extends APIResource {
|
|
|
124
143
|
|
|
125
144
|
export interface TopicCreateParams {
|
|
126
145
|
/**
|
|
127
|
-
* The default subscription status applied when a recipient has not set
|
|
146
|
+
* Body param: The default subscription status applied when a recipient has not set
|
|
147
|
+
* their own.
|
|
128
148
|
*/
|
|
129
149
|
default_status: 'OPTED_OUT' | 'OPTED_IN' | 'REQUIRED';
|
|
130
150
|
|
|
131
151
|
/**
|
|
132
|
-
* Human-readable name for the preference topic.
|
|
152
|
+
* Body param: Human-readable name for the preference topic.
|
|
133
153
|
*/
|
|
134
154
|
name: string;
|
|
135
155
|
|
|
136
156
|
/**
|
|
137
|
-
* Preference controls a recipient may customize for this topic.
|
|
138
|
-
* if omitted.
|
|
157
|
+
* Body param: Preference controls a recipient may customize for this topic.
|
|
158
|
+
* Defaults to empty if omitted.
|
|
139
159
|
*/
|
|
140
160
|
allowed_preferences?: Array<'snooze' | 'channel_preferences'> | null;
|
|
141
161
|
|
|
142
162
|
/**
|
|
143
|
-
* Optional description shown under the topic on the hosted preferences
|
|
163
|
+
* Body param: Optional description shown under the topic on the hosted preferences
|
|
164
|
+
* page.
|
|
144
165
|
*/
|
|
145
166
|
description?: string | null;
|
|
146
167
|
|
|
147
168
|
/**
|
|
148
|
-
* Whether to include a list-unsubscribe header on emails for this
|
|
169
|
+
* Body param: Whether to include a list-unsubscribe header on emails for this
|
|
170
|
+
* topic.
|
|
149
171
|
*/
|
|
150
172
|
include_unsubscribe_header?: boolean | null;
|
|
151
173
|
|
|
152
174
|
/**
|
|
153
|
-
* Default channels delivered for this topic. Defaults to empty if
|
|
175
|
+
* Body param: Default channels delivered for this topic. Defaults to empty if
|
|
176
|
+
* omitted.
|
|
154
177
|
*/
|
|
155
178
|
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
156
179
|
|
|
157
180
|
/**
|
|
158
|
-
* Arbitrary metadata associated with the topic.
|
|
181
|
+
* Body param: Arbitrary metadata associated with the topic.
|
|
159
182
|
*/
|
|
160
183
|
topic_data?: { [key: string]: unknown } | null;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Header param: A unique key that makes this request idempotent. If Courier
|
|
187
|
+
* receives another request with the same `Idempotency-Key`, it returns the stored
|
|
188
|
+
* response from the first request without performing the operation again
|
|
189
|
+
* (including the original status code and any error). Use it to safely retry
|
|
190
|
+
* `POST` requests after network failures without risking duplicate sends. The key
|
|
191
|
+
* is scoped to this endpoint.
|
|
192
|
+
*/
|
|
193
|
+
'Idempotency-Key'?: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Header param: How long the idempotency key remains valid, as a Unix epoch
|
|
197
|
+
* timestamp in seconds or an ISO 8601 date string. Only applies when
|
|
198
|
+
* `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
|
|
199
|
+
* maximum is 1 year.
|
|
200
|
+
*/
|
|
201
|
+
'x-idempotency-expiration'?: string;
|
|
161
202
|
}
|
|
162
203
|
|
|
163
204
|
export interface TopicRetrieveParams {
|