@trycourier/courier 7.3.0 → 7.7.1
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 +115 -0
- package/LICENSE +1 -1
- package/README.md +34 -345
- package/client.d.mts +50 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +50 -8
- package/client.d.ts.map +1 -1
- package/client.js +17 -4
- package/client.js.map +1 -1
- package/client.mjs +18 -5
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +1 -1
- package/resources/audiences.d.mts +11 -33
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +11 -33
- package/resources/audiences.d.ts.map +1 -1
- package/resources/automations/automations.d.mts +54 -1
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +54 -1
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +12 -0
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +12 -0
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts +1 -1
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts +1 -1
- package/resources/automations/index.d.ts.map +1 -1
- package/resources/automations/index.js.map +1 -1
- package/resources/automations/index.mjs +1 -1
- package/resources/automations/index.mjs.map +1 -1
- package/resources/bulk.d.mts +80 -39
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts +80 -39
- package/resources/bulk.d.ts.map +1 -1
- package/resources/bulk.js +12 -2
- package/resources/bulk.js.map +1 -1
- package/resources/bulk.mjs +12 -2
- package/resources/bulk.mjs.map +1 -1
- package/resources/inbound.d.mts +1 -1
- package/resources/inbound.d.ts +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts +1 -1
- package/resources/lists/subscriptions.d.ts +1 -1
- package/resources/notifications/checks.d.mts +2 -2
- package/resources/notifications/checks.d.ts +2 -2
- package/resources/send.d.mts +8 -2
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +8 -2
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +1 -1
- package/resources/send.mjs +1 -1
- package/resources/shared.d.mts +290 -52
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +290 -52
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/index.d.mts +2 -2
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +2 -2
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js +2 -2
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs +1 -1
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/preferences/items.d.mts +2 -2
- package/resources/tenants/preferences/items.d.ts +2 -2
- package/resources/tenants/templates/index.d.mts +3 -0
- package/resources/tenants/templates/index.d.mts.map +1 -0
- package/resources/tenants/templates/index.d.ts +3 -0
- package/resources/tenants/templates/index.d.ts.map +1 -0
- package/resources/tenants/templates/index.js +9 -0
- package/resources/tenants/templates/index.js.map +1 -0
- package/resources/tenants/templates/index.mjs +4 -0
- package/resources/tenants/templates/index.mjs.map +1 -0
- package/resources/tenants/templates/templates.d.mts +159 -0
- package/resources/tenants/templates/templates.d.mts.map +1 -0
- package/resources/tenants/templates/templates.d.ts +159 -0
- package/resources/tenants/templates/templates.d.ts.map +1 -0
- package/resources/tenants/templates/templates.js +91 -0
- package/resources/tenants/templates/templates.js.map +1 -0
- package/resources/tenants/templates/templates.mjs +86 -0
- package/resources/tenants/templates/templates.mjs.map +1 -0
- package/resources/tenants/templates/versions.d.mts +39 -0
- package/resources/tenants/templates/versions.d.mts.map +1 -0
- package/resources/tenants/templates/versions.d.ts +39 -0
- package/resources/tenants/templates/versions.d.ts.map +1 -0
- package/resources/tenants/templates/versions.js +32 -0
- package/resources/tenants/templates/versions.js.map +1 -0
- package/resources/tenants/templates/versions.mjs +28 -0
- package/resources/tenants/templates/versions.mjs.map +1 -0
- package/resources/tenants/templates.d.mts +1 -90
- package/resources/tenants/templates.d.mts.map +1 -1
- package/resources/tenants/templates.d.ts +1 -90
- package/resources/tenants/templates.d.ts.map +1 -1
- package/resources/tenants/templates.js +2 -34
- package/resources/tenants/templates.js.map +1 -1
- package/resources/tenants/templates.mjs +1 -32
- package/resources/tenants/templates.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +147 -5
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +147 -5
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +2 -2
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +2 -2
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/translations.d.mts +1 -1
- package/resources/translations.d.ts +1 -1
- package/resources/users/preferences.d.mts +1 -1
- package/resources/users/preferences.d.ts +1 -1
- package/resources/users/tenants.d.mts +1 -1
- package/resources/users/tenants.d.ts +1 -1
- package/resources/users/tokens.d.mts +3 -8
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +3 -8
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +2 -3
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +2 -3
- package/resources/users/tokens.mjs.map +1 -1
- package/src/client.ts +88 -14
- package/src/internal/parse.ts +6 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/audiences.ts +11 -69
- package/src/resources/automations/automations.ts +74 -1
- package/src/resources/automations/index.ts +7 -1
- package/src/resources/bulk.ts +71 -32
- package/src/resources/inbound.ts +1 -1
- package/src/resources/index.ts +12 -3
- package/src/resources/lists/subscriptions.ts +1 -1
- package/src/resources/notifications/checks.ts +2 -2
- package/src/resources/send.ts +28 -2
- package/src/resources/shared.ts +391 -49
- package/src/resources/tenants/index.ts +8 -1
- package/src/resources/tenants/preferences/items.ts +2 -2
- package/src/resources/tenants/templates/index.ts +11 -0
- package/src/resources/tenants/templates/templates.ts +222 -0
- package/src/resources/tenants/templates/versions.ts +55 -0
- package/src/resources/tenants/templates.ts +1 -122
- package/src/resources/tenants/tenants.ts +179 -3
- package/src/resources/translations.ts +1 -1
- package/src/resources/users/preferences.ts +1 -1
- package/src/resources/users/tenants.ts +1 -1
- package/src/resources/users/tokens.ts +4 -10
- 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
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as Shared from '../../shared';
|
|
5
|
+
import * as TenantsAPI from '../tenants';
|
|
6
|
+
import * as VersionsAPI from './versions';
|
|
7
|
+
import { VersionRetrieveParams, Versions } from './versions';
|
|
8
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
9
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
10
|
+
import { path } from '../../../internal/utils/path';
|
|
11
|
+
|
|
12
|
+
export class Templates extends APIResource {
|
|
13
|
+
versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get a Template in Tenant
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const baseTemplateTenantAssociation =
|
|
21
|
+
* await client.tenants.templates.retrieve('template_id', {
|
|
22
|
+
* tenant_id: 'tenant_id',
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
retrieve(
|
|
27
|
+
templateID: string,
|
|
28
|
+
params: TemplateRetrieveParams,
|
|
29
|
+
options?: RequestOptions,
|
|
30
|
+
): APIPromise<TenantsAPI.BaseTemplateTenantAssociation> {
|
|
31
|
+
const { tenant_id } = params;
|
|
32
|
+
return this._client.get(path`/tenants/${tenant_id}/templates/${templateID}`, options);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* List Templates in Tenant
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const templates = await client.tenants.templates.list(
|
|
41
|
+
* 'tenant_id',
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
list(
|
|
46
|
+
tenantID: string,
|
|
47
|
+
query: TemplateListParams | null | undefined = {},
|
|
48
|
+
options?: RequestOptions,
|
|
49
|
+
): APIPromise<TemplateListResponse> {
|
|
50
|
+
return this._client.get(path`/tenants/${tenantID}/templates`, { query, ...options });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Publishes a specific version of a notification template for a tenant.
|
|
55
|
+
*
|
|
56
|
+
* The template must already exist in the tenant's notification map. If no version
|
|
57
|
+
* is specified, defaults to publishing the "latest" version.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const postTenantTemplatePublishResponse =
|
|
62
|
+
* await client.tenants.templates.publish('template_id', {
|
|
63
|
+
* tenant_id: 'tenant_id',
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
publish(
|
|
68
|
+
templateID: string,
|
|
69
|
+
params: TemplatePublishParams,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): APIPromise<TenantsAPI.PostTenantTemplatePublishResponse> {
|
|
72
|
+
const { tenant_id, ...body } = params;
|
|
73
|
+
return this._client.post(path`/tenants/${tenant_id}/templates/${templateID}/publish`, {
|
|
74
|
+
body,
|
|
75
|
+
...options,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Creates or updates a notification template for a tenant.
|
|
81
|
+
*
|
|
82
|
+
* If the template already exists for the tenant, it will be updated (200).
|
|
83
|
+
* Otherwise, a new template is created (201).
|
|
84
|
+
*
|
|
85
|
+
* Optionally publishes the template immediately if the `published` flag is set to
|
|
86
|
+
* true.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const putTenantTemplateResponse =
|
|
91
|
+
* await client.tenants.templates.replace('template_id', {
|
|
92
|
+
* tenant_id: 'tenant_id',
|
|
93
|
+
* template: {
|
|
94
|
+
* content: { elements: [{}], version: 'version' },
|
|
95
|
+
* },
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
replace(
|
|
100
|
+
templateID: string,
|
|
101
|
+
params: TemplateReplaceParams,
|
|
102
|
+
options?: RequestOptions,
|
|
103
|
+
): APIPromise<TenantsAPI.PutTenantTemplateResponse> {
|
|
104
|
+
const { tenant_id, ...body } = params;
|
|
105
|
+
return this._client.put(path`/tenants/${tenant_id}/templates/${templateID}`, { body, ...options });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface TemplateListResponse {
|
|
110
|
+
/**
|
|
111
|
+
* Set to true when there are more pages that can be retrieved.
|
|
112
|
+
*/
|
|
113
|
+
has_more: boolean;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Always set to `list`. Represents the type of this object.
|
|
117
|
+
*/
|
|
118
|
+
type: 'list';
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A url that may be used to generate these results.
|
|
122
|
+
*/
|
|
123
|
+
url: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A pointer to the next page of results. Defined only when `has_more` is set to
|
|
127
|
+
* true
|
|
128
|
+
*/
|
|
129
|
+
cursor?: string | null;
|
|
130
|
+
|
|
131
|
+
items?: Array<TemplateListResponse.Item> | null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A url that may be used to generate fetch the next set of results. Defined only
|
|
135
|
+
* when `has_more` is set to true
|
|
136
|
+
*/
|
|
137
|
+
next_url?: string | null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export namespace TemplateListResponse {
|
|
141
|
+
export interface Item extends TenantsAPI.BaseTemplateTenantAssociation {
|
|
142
|
+
/**
|
|
143
|
+
* The template's data containing it's routing configs
|
|
144
|
+
*/
|
|
145
|
+
data: Item.Data;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export namespace Item {
|
|
149
|
+
/**
|
|
150
|
+
* The template's data containing it's routing configs
|
|
151
|
+
*/
|
|
152
|
+
export interface Data {
|
|
153
|
+
routing: Shared.MessageRouting;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface TemplateRetrieveParams {
|
|
159
|
+
/**
|
|
160
|
+
* Id of the tenant for which to retrieve the template.
|
|
161
|
+
*/
|
|
162
|
+
tenant_id: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface TemplateListParams {
|
|
166
|
+
/**
|
|
167
|
+
* Continue the pagination with the next cursor
|
|
168
|
+
*/
|
|
169
|
+
cursor?: string | null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The number of templates to return (defaults to 20, maximum value of 100)
|
|
173
|
+
*/
|
|
174
|
+
limit?: number | null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface TemplatePublishParams {
|
|
178
|
+
/**
|
|
179
|
+
* Path param: Id of the tenant that owns the template.
|
|
180
|
+
*/
|
|
181
|
+
tenant_id: string;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Body param: The version of the template to publish (e.g., "v1", "v2", "latest").
|
|
185
|
+
* If not provided, defaults to "latest".
|
|
186
|
+
*/
|
|
187
|
+
version?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface TemplateReplaceParams {
|
|
191
|
+
/**
|
|
192
|
+
* Path param: Id of the tenant for which to create or update the template.
|
|
193
|
+
*/
|
|
194
|
+
tenant_id: string;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Body param: Template configuration for creating or updating a tenant
|
|
198
|
+
* notification template
|
|
199
|
+
*/
|
|
200
|
+
template: TenantsAPI.TenantTemplateInput;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Body param: Whether to publish the template immediately after saving. When true,
|
|
204
|
+
* the template becomes the active/published version. When false (default), the
|
|
205
|
+
* template is saved as a draft.
|
|
206
|
+
*/
|
|
207
|
+
published?: boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Templates.Versions = Versions;
|
|
211
|
+
|
|
212
|
+
export declare namespace Templates {
|
|
213
|
+
export {
|
|
214
|
+
type TemplateListResponse as TemplateListResponse,
|
|
215
|
+
type TemplateRetrieveParams as TemplateRetrieveParams,
|
|
216
|
+
type TemplateListParams as TemplateListParams,
|
|
217
|
+
type TemplatePublishParams as TemplatePublishParams,
|
|
218
|
+
type TemplateReplaceParams as TemplateReplaceParams,
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export { Versions as Versions, type VersionRetrieveParams as VersionRetrieveParams };
|
|
222
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as TenantsAPI from '../tenants';
|
|
5
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
7
|
+
import { path } from '../../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Versions extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Fetches a specific version of a tenant template.
|
|
12
|
+
*
|
|
13
|
+
* Supports the following version formats:
|
|
14
|
+
*
|
|
15
|
+
* - `latest` - The most recent version of the template
|
|
16
|
+
* - `published` - The currently published version
|
|
17
|
+
* - `v{version}` - A specific version (e.g., "v1", "v2", "v1.0.0")
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const baseTemplateTenantAssociation =
|
|
22
|
+
* await client.tenants.templates.versions.retrieve(
|
|
23
|
+
* 'version',
|
|
24
|
+
* { tenant_id: 'tenant_id', template_id: 'template_id' },
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
retrieve(
|
|
29
|
+
version: string,
|
|
30
|
+
params: VersionRetrieveParams,
|
|
31
|
+
options?: RequestOptions,
|
|
32
|
+
): APIPromise<TenantsAPI.BaseTemplateTenantAssociation> {
|
|
33
|
+
const { tenant_id, template_id } = params;
|
|
34
|
+
return this._client.get(
|
|
35
|
+
path`/tenants/${tenant_id}/templates/${template_id}/versions/${version}`,
|
|
36
|
+
options,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface VersionRetrieveParams {
|
|
42
|
+
/**
|
|
43
|
+
* Id of the tenant for which to retrieve the template.
|
|
44
|
+
*/
|
|
45
|
+
tenant_id: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Id of the template to be retrieved.
|
|
49
|
+
*/
|
|
50
|
+
template_id: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare namespace Versions {
|
|
54
|
+
export { type VersionRetrieveParams as VersionRetrieveParams };
|
|
55
|
+
}
|
|
@@ -1,124 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import * as Shared from '../shared';
|
|
5
|
-
import * as TenantsAPI from './tenants';
|
|
6
|
-
import { APIPromise } from '../../core/api-promise';
|
|
7
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
8
|
-
import { path } from '../../internal/utils/path';
|
|
9
|
-
|
|
10
|
-
export class Templates extends APIResource {
|
|
11
|
-
/**
|
|
12
|
-
* Get a Template in Tenant
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const baseTemplateTenantAssociation =
|
|
17
|
-
* await client.tenants.templates.retrieve('template_id', {
|
|
18
|
-
* tenant_id: 'tenant_id',
|
|
19
|
-
* });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
retrieve(
|
|
23
|
-
templateID: string,
|
|
24
|
-
params: TemplateRetrieveParams,
|
|
25
|
-
options?: RequestOptions,
|
|
26
|
-
): APIPromise<TenantsAPI.BaseTemplateTenantAssociation> {
|
|
27
|
-
const { tenant_id } = params;
|
|
28
|
-
return this._client.get(path`/tenants/${tenant_id}/templates/${templateID}`, options);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* List Templates in Tenant
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* const templates = await client.tenants.templates.list(
|
|
37
|
-
* 'tenant_id',
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
list(
|
|
42
|
-
tenantID: string,
|
|
43
|
-
query: TemplateListParams | null | undefined = {},
|
|
44
|
-
options?: RequestOptions,
|
|
45
|
-
): APIPromise<TemplateListResponse> {
|
|
46
|
-
return this._client.get(path`/tenants/${tenantID}/templates`, { query, ...options });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface TemplateListResponse {
|
|
51
|
-
/**
|
|
52
|
-
* Set to true when there are more pages that can be retrieved.
|
|
53
|
-
*/
|
|
54
|
-
has_more: boolean;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Always set to `list`. Represents the type of this object.
|
|
58
|
-
*/
|
|
59
|
-
type: 'list';
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* A url that may be used to generate these results.
|
|
63
|
-
*/
|
|
64
|
-
url: string;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* A pointer to the next page of results. Defined only when `has_more` is set to
|
|
68
|
-
* true
|
|
69
|
-
*/
|
|
70
|
-
cursor?: string | null;
|
|
71
|
-
|
|
72
|
-
items?: Array<TemplateListResponse.Item> | null;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A url that may be used to generate fetch the next set of results. Defined only
|
|
76
|
-
* when `has_more` is set to true
|
|
77
|
-
*/
|
|
78
|
-
next_url?: string | null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export namespace TemplateListResponse {
|
|
82
|
-
export interface Item extends TenantsAPI.BaseTemplateTenantAssociation {
|
|
83
|
-
/**
|
|
84
|
-
* The template's data containing it's routing configs
|
|
85
|
-
*/
|
|
86
|
-
data: Item.Data;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export namespace Item {
|
|
90
|
-
/**
|
|
91
|
-
* The template's data containing it's routing configs
|
|
92
|
-
*/
|
|
93
|
-
export interface Data {
|
|
94
|
-
routing: Shared.MessageRouting;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface TemplateRetrieveParams {
|
|
100
|
-
/**
|
|
101
|
-
* Id of the tenant for which to retrieve the template.
|
|
102
|
-
*/
|
|
103
|
-
tenant_id: string;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface TemplateListParams {
|
|
107
|
-
/**
|
|
108
|
-
* Continue the pagination with the next cursor
|
|
109
|
-
*/
|
|
110
|
-
cursor?: string | null;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* The number of templates to return (defaults to 20, maximum value of 100)
|
|
114
|
-
*/
|
|
115
|
-
limit?: number | null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export declare namespace Templates {
|
|
119
|
-
export {
|
|
120
|
-
type TemplateListResponse as TemplateListResponse,
|
|
121
|
-
type TemplateRetrieveParams as TemplateRetrieveParams,
|
|
122
|
-
type TemplateListParams as TemplateListParams,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
3
|
+
export * from './templates/index';
|
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as TenantsAPI from './tenants';
|
|
5
5
|
import * as Shared from '../shared';
|
|
6
|
-
import * as TemplatesAPI from './templates';
|
|
7
|
-
import { TemplateListParams, TemplateListResponse, TemplateRetrieveParams, Templates } from './templates';
|
|
8
6
|
import * as PreferencesAPI from './preferences/preferences';
|
|
9
7
|
import { Preferences } from './preferences/preferences';
|
|
8
|
+
import * as TemplatesAPI from './templates/templates';
|
|
9
|
+
import {
|
|
10
|
+
TemplateListParams,
|
|
11
|
+
TemplateListResponse,
|
|
12
|
+
TemplatePublishParams,
|
|
13
|
+
TemplateReplaceParams,
|
|
14
|
+
TemplateRetrieveParams,
|
|
15
|
+
Templates,
|
|
16
|
+
} from './templates/templates';
|
|
10
17
|
import { APIPromise } from '../../core/api-promise';
|
|
11
18
|
import { buildHeaders } from '../../internal/headers';
|
|
12
19
|
import { RequestOptions } from '../../internal/request-options';
|
|
@@ -131,6 +138,75 @@ export namespace DefaultPreferences {
|
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Request body for publishing a tenant template version
|
|
143
|
+
*/
|
|
144
|
+
export interface PostTenantTemplatePublishRequest {
|
|
145
|
+
/**
|
|
146
|
+
* The version of the template to publish (e.g., "v1", "v2", "latest"). If not
|
|
147
|
+
* provided, defaults to "latest".
|
|
148
|
+
*/
|
|
149
|
+
version?: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Response from publishing a tenant template
|
|
154
|
+
*/
|
|
155
|
+
export interface PostTenantTemplatePublishResponse {
|
|
156
|
+
/**
|
|
157
|
+
* The template ID
|
|
158
|
+
*/
|
|
159
|
+
id: string;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The timestamp when the template was published
|
|
163
|
+
*/
|
|
164
|
+
published_at: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The published version of the template
|
|
168
|
+
*/
|
|
169
|
+
version: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Request body for creating or updating a tenant notification template
|
|
174
|
+
*/
|
|
175
|
+
export interface PutTenantTemplateRequest {
|
|
176
|
+
/**
|
|
177
|
+
* Template configuration for creating or updating a tenant notification template
|
|
178
|
+
*/
|
|
179
|
+
template: TenantTemplateInput;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Whether to publish the template immediately after saving. When true, the
|
|
183
|
+
* template becomes the active/published version. When false (default), the
|
|
184
|
+
* template is saved as a draft.
|
|
185
|
+
*/
|
|
186
|
+
published?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Response from creating or updating a tenant notification template
|
|
191
|
+
*/
|
|
192
|
+
export interface PutTenantTemplateResponse {
|
|
193
|
+
/**
|
|
194
|
+
* The template ID
|
|
195
|
+
*/
|
|
196
|
+
id: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The version of the saved template
|
|
200
|
+
*/
|
|
201
|
+
version: string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The timestamp when the template was published. Only present if the template was
|
|
205
|
+
* published as part of this request.
|
|
206
|
+
*/
|
|
207
|
+
published_at?: string | null;
|
|
208
|
+
}
|
|
209
|
+
|
|
134
210
|
export interface SubscriptionTopicNew {
|
|
135
211
|
status: 'OPTED_OUT' | 'OPTED_IN' | 'REQUIRED';
|
|
136
212
|
|
|
@@ -141,7 +217,7 @@ export interface SubscriptionTopicNew {
|
|
|
141
217
|
|
|
142
218
|
/**
|
|
143
219
|
* Override channel routing with custom preferences. This will override any
|
|
144
|
-
* template
|
|
220
|
+
* template preferences that are set, but a user can still customize their
|
|
145
221
|
* preferences
|
|
146
222
|
*/
|
|
147
223
|
has_custom_routing?: boolean | null;
|
|
@@ -205,6 +281,99 @@ export interface TenantAssociation {
|
|
|
205
281
|
user_id?: string | null;
|
|
206
282
|
}
|
|
207
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Template configuration for creating or updating a tenant notification template
|
|
286
|
+
*/
|
|
287
|
+
export interface TenantTemplateInput {
|
|
288
|
+
/**
|
|
289
|
+
* Template content configuration including blocks, elements, and message structure
|
|
290
|
+
*/
|
|
291
|
+
content: Shared.ElementalContent;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Channel-specific delivery configuration (email, SMS, push, etc.)
|
|
295
|
+
*/
|
|
296
|
+
channels?: { [key: string]: TenantTemplateInput.Channels };
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Provider-specific delivery configuration for routing to specific email/SMS
|
|
300
|
+
* providers
|
|
301
|
+
*/
|
|
302
|
+
providers?: { [key: string]: TenantTemplateInput.Providers };
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Message routing configuration for multi-channel delivery strategies
|
|
306
|
+
*/
|
|
307
|
+
routing?: Shared.MessageRouting;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export namespace TenantTemplateInput {
|
|
311
|
+
export interface Channels {
|
|
312
|
+
/**
|
|
313
|
+
* Brand id used for rendering.
|
|
314
|
+
*/
|
|
315
|
+
brand_id?: string | null;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* JS conditional with access to data/profile.
|
|
319
|
+
*/
|
|
320
|
+
if?: string | null;
|
|
321
|
+
|
|
322
|
+
metadata?: Channels.Metadata | null;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Channel specific overrides.
|
|
326
|
+
*/
|
|
327
|
+
override?: { [key: string]: unknown } | null;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Providers enabled for this channel.
|
|
331
|
+
*/
|
|
332
|
+
providers?: Array<string> | null;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Defaults to `single`.
|
|
336
|
+
*/
|
|
337
|
+
routing_method?: 'all' | 'single' | null;
|
|
338
|
+
|
|
339
|
+
timeouts?: Channels.Timeouts | null;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export namespace Channels {
|
|
343
|
+
export interface Metadata {
|
|
344
|
+
utm?: Shared.Utm | null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface Timeouts {
|
|
348
|
+
channel?: number | null;
|
|
349
|
+
|
|
350
|
+
provider?: number | null;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface Providers {
|
|
355
|
+
/**
|
|
356
|
+
* JS conditional with access to data/profile.
|
|
357
|
+
*/
|
|
358
|
+
if?: string | null;
|
|
359
|
+
|
|
360
|
+
metadata?: Providers.Metadata | null;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Provider-specific overrides.
|
|
364
|
+
*/
|
|
365
|
+
override?: { [key: string]: unknown } | null;
|
|
366
|
+
|
|
367
|
+
timeouts?: number | null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export namespace Providers {
|
|
371
|
+
export interface Metadata {
|
|
372
|
+
utm?: Shared.Utm | null;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
208
377
|
export interface TenantListResponse {
|
|
209
378
|
/**
|
|
210
379
|
* Set to true when there are more pages that can be retrieved.
|
|
@@ -339,9 +508,14 @@ export declare namespace Tenants {
|
|
|
339
508
|
export {
|
|
340
509
|
type BaseTemplateTenantAssociation as BaseTemplateTenantAssociation,
|
|
341
510
|
type DefaultPreferences as DefaultPreferences,
|
|
511
|
+
type PostTenantTemplatePublishRequest as PostTenantTemplatePublishRequest,
|
|
512
|
+
type PostTenantTemplatePublishResponse as PostTenantTemplatePublishResponse,
|
|
513
|
+
type PutTenantTemplateRequest as PutTenantTemplateRequest,
|
|
514
|
+
type PutTenantTemplateResponse as PutTenantTemplateResponse,
|
|
342
515
|
type SubscriptionTopicNew as SubscriptionTopicNew,
|
|
343
516
|
type Tenant as Tenant,
|
|
344
517
|
type TenantAssociation as TenantAssociation,
|
|
518
|
+
type TenantTemplateInput as TenantTemplateInput,
|
|
345
519
|
type TenantListResponse as TenantListResponse,
|
|
346
520
|
type TenantListUsersResponse as TenantListUsersResponse,
|
|
347
521
|
type TenantUpdateParams as TenantUpdateParams,
|
|
@@ -356,5 +530,7 @@ export declare namespace Tenants {
|
|
|
356
530
|
type TemplateListResponse as TemplateListResponse,
|
|
357
531
|
type TemplateRetrieveParams as TemplateRetrieveParams,
|
|
358
532
|
type TemplateListParams as TemplateListParams,
|
|
533
|
+
type TemplatePublishParams as TemplatePublishParams,
|
|
534
|
+
type TemplateReplaceParams as TemplateReplaceParams,
|
|
359
535
|
};
|
|
360
536
|
}
|
|
@@ -98,14 +98,13 @@ export class Tokens extends APIResource {
|
|
|
98
98
|
* ```ts
|
|
99
99
|
* await client.users.tokens.addSingle('token', {
|
|
100
100
|
* user_id: 'user_id',
|
|
101
|
-
* body_token: 'token',
|
|
102
101
|
* provider_key: 'firebase-fcm',
|
|
103
102
|
* });
|
|
104
103
|
* ```
|
|
105
104
|
*/
|
|
106
|
-
addSingle(
|
|
105
|
+
addSingle(token: string, params: TokenAddSingleParams, options?: RequestOptions): APIPromise<void> {
|
|
107
106
|
const { user_id, ...body } = params;
|
|
108
|
-
return this._client.put(path`/users/${user_id}/tokens/${
|
|
107
|
+
return this._client.put(path`/users/${user_id}/tokens/${token}`, {
|
|
109
108
|
body,
|
|
110
109
|
...options,
|
|
111
110
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
@@ -235,7 +234,7 @@ export interface TokenUpdateParams {
|
|
|
235
234
|
user_id: string;
|
|
236
235
|
|
|
237
236
|
/**
|
|
238
|
-
* Body param
|
|
237
|
+
* Body param
|
|
239
238
|
*/
|
|
240
239
|
patch: Array<TokenUpdateParams.Patch>;
|
|
241
240
|
}
|
|
@@ -273,12 +272,7 @@ export interface TokenAddSingleParams {
|
|
|
273
272
|
user_id: string;
|
|
274
273
|
|
|
275
274
|
/**
|
|
276
|
-
* Body param
|
|
277
|
-
*/
|
|
278
|
-
body_token: string;
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Body param:
|
|
275
|
+
* Body param
|
|
282
276
|
*/
|
|
283
277
|
provider_key: 'firebase-fcm' | 'apn' | 'expo' | 'onesignal';
|
|
284
278
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.
|
|
1
|
+
export const VERSION = '7.7.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "7.
|
|
1
|
+
export declare const VERSION = "7.7.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|