@trycourier/courier 7.11.0 → 7.19.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 +114 -0
- package/README.md +1 -0
- package/client.d.mts +10 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +10 -4
- package/client.d.ts.map +1 -1
- package/client.js +15 -1
- package/client.js.map +1 -1
- package/client.mjs +15 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audiences.d.mts +5 -2
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +5 -2
- package/resources/audiences.d.ts.map +1 -1
- package/resources/brands.d.mts +35 -2
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +35 -2
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js +34 -1
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs +34 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/digests/digests.d.mts +94 -0
- package/resources/digests/digests.d.mts.map +1 -0
- package/resources/digests/digests.d.ts +94 -0
- package/resources/digests/digests.d.ts.map +1 -0
- package/resources/digests/digests.js +17 -0
- package/resources/digests/digests.js.map +1 -0
- package/resources/digests/digests.mjs +12 -0
- package/resources/digests/digests.mjs.map +1 -0
- package/resources/digests/index.d.mts +3 -0
- package/resources/digests/index.d.mts.map +1 -0
- package/resources/digests/index.d.ts +3 -0
- package/resources/digests/index.d.ts.map +1 -0
- package/resources/digests/index.js +9 -0
- package/resources/digests/index.js.map +1 -0
- package/resources/digests/index.mjs +4 -0
- package/resources/digests/index.mjs.map +1 -0
- package/resources/digests/schedules.d.mts +32 -0
- package/resources/digests/schedules.d.mts.map +1 -0
- package/resources/digests/schedules.d.ts +32 -0
- package/resources/digests/schedules.d.ts.map +1 -0
- package/resources/digests/schedules.js +29 -0
- package/resources/digests/schedules.js.map +1 -0
- package/resources/digests/schedules.mjs +25 -0
- package/resources/digests/schedules.mjs.map +1 -0
- package/resources/digests.d.mts +2 -0
- package/resources/digests.d.mts.map +1 -0
- package/resources/digests.d.ts +2 -0
- package/resources/digests.d.ts.map +1 -0
- package/resources/digests.js +6 -0
- package/resources/digests.js.map +1 -0
- package/resources/digests.mjs +3 -0
- package/resources/digests.mjs.map +1 -0
- package/resources/index.d.mts +4 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/journeys/index.d.mts +2 -2
- package/resources/journeys/index.d.mts.map +1 -1
- package/resources/journeys/index.d.ts +2 -2
- package/resources/journeys/index.d.ts.map +1 -1
- package/resources/journeys/index.js.map +1 -1
- package/resources/journeys/index.mjs.map +1 -1
- package/resources/journeys/journeys.d.mts +198 -7
- package/resources/journeys/journeys.d.mts.map +1 -1
- package/resources/journeys/journeys.d.ts +198 -7
- package/resources/journeys/journeys.d.ts.map +1 -1
- package/resources/journeys/journeys.js +18 -0
- package/resources/journeys/journeys.js.map +1 -1
- package/resources/journeys/journeys.mjs +18 -0
- package/resources/journeys/journeys.mjs.map +1 -1
- package/resources/journeys/templates.d.mts +120 -1
- package/resources/journeys/templates.d.mts.map +1 -1
- package/resources/journeys/templates.d.ts +120 -1
- package/resources/journeys/templates.d.ts.map +1 -1
- package/resources/journeys/templates.js +71 -0
- package/resources/journeys/templates.js.map +1 -1
- package/resources/journeys/templates.mjs +71 -0
- package/resources/journeys/templates.mjs.map +1 -1
- package/resources/messages.d.mts +16 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +16 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +10 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +10 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +3 -3
- package/resources/notifications/checks.d.ts +3 -3
- package/resources/notifications/checks.js +3 -3
- package/resources/notifications/checks.mjs +3 -3
- package/resources/shared.d.mts +6 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +6 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/users/index.d.mts +1 -1
- package/resources/users/index.d.mts.map +1 -1
- package/resources/users/index.d.ts +1 -1
- package/resources/users/index.d.ts.map +1 -1
- package/resources/users/index.js.map +1 -1
- package/resources/users/index.mjs.map +1 -1
- package/resources/users/preferences.d.mts +211 -1
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts +211 -1
- package/resources/users/preferences.d.ts.map +1 -1
- package/resources/users/preferences.js +105 -0
- package/resources/users/preferences.js.map +1 -1
- package/resources/users/preferences.mjs +105 -0
- package/resources/users/preferences.mjs.map +1 -1
- package/resources/users/users.d.mts +2 -2
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +2 -2
- package/resources/users/users.d.ts.map +1 -1
- package/resources/users/users.js.map +1 -1
- package/resources/users/users.mjs.map +1 -1
- package/resources/workspace-preferences/index.d.mts +3 -0
- package/resources/workspace-preferences/index.d.mts.map +1 -0
- package/resources/workspace-preferences/index.d.ts +3 -0
- package/resources/workspace-preferences/index.d.ts.map +1 -0
- package/resources/workspace-preferences/index.js +9 -0
- package/resources/workspace-preferences/index.js.map +1 -0
- package/resources/workspace-preferences/index.mjs +4 -0
- package/resources/workspace-preferences/index.mjs.map +1 -0
- package/resources/workspace-preferences/topics.d.mts +168 -0
- package/resources/workspace-preferences/topics.d.mts.map +1 -0
- package/resources/workspace-preferences/topics.d.ts +168 -0
- package/resources/workspace-preferences/topics.d.ts.map +1 -0
- package/resources/workspace-preferences/topics.js +103 -0
- package/resources/workspace-preferences/topics.js.map +1 -0
- package/resources/workspace-preferences/topics.mjs +99 -0
- package/resources/workspace-preferences/topics.mjs.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.d.mts +410 -0
- package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.d.ts +410 -0
- package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.js +104 -0
- package/resources/workspace-preferences/workspace-preferences.js.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.mjs +99 -0
- package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -0
- package/resources/workspace-preferences.d.mts +2 -0
- package/resources/workspace-preferences.d.mts.map +1 -0
- package/resources/workspace-preferences.d.ts +2 -0
- package/resources/workspace-preferences.d.ts.map +1 -0
- package/resources/workspace-preferences.js +6 -0
- package/resources/workspace-preferences.js.map +1 -0
- package/resources/workspace-preferences.mjs +3 -0
- package/resources/workspace-preferences.mjs.map +1 -0
- package/src/client.ts +71 -1
- package/src/resources/audiences.ts +5 -2
- package/src/resources/brands.ts +36 -3
- package/src/resources/digests/digests.ts +120 -0
- package/src/resources/digests/index.ts +9 -0
- package/src/resources/digests/schedules.ts +51 -0
- package/src/resources/digests.ts +3 -0
- package/src/resources/index.ts +28 -0
- package/src/resources/journeys/index.ts +8 -0
- package/src/resources/journeys/journeys.ts +246 -4
- package/src/resources/journeys/templates.ts +168 -0
- package/src/resources/messages.ts +20 -0
- package/src/resources/notifications/checks.ts +3 -3
- package/src/resources/shared.ts +7 -0
- package/src/resources/users/index.ts +6 -0
- package/src/resources/users/preferences.ts +269 -0
- package/src/resources/users/users.ts +12 -0
- package/src/resources/workspace-preferences/index.ts +25 -0
- package/src/resources/workspace-preferences/topics.ts +229 -0
- package/src/resources/workspace-preferences/workspace-preferences.ts +534 -0
- package/src/resources/workspace-preferences.ts +3 -0
- 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,410 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as Shared from "../shared.js";
|
|
3
|
+
import * as TopicsAPI from "./topics.js";
|
|
4
|
+
import { TopicArchiveParams, TopicCreateParams, TopicReplaceParams, TopicRetrieveParams, Topics } from "./topics.js";
|
|
5
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
6
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
7
|
+
export declare class WorkspacePreferences extends APIResource {
|
|
8
|
+
topics: TopicsAPI.Topics;
|
|
9
|
+
/**
|
|
10
|
+
* Create a workspace preference. The workspace preference id is generated and
|
|
11
|
+
* returned. Topics are created inside a workspace preference via POST
|
|
12
|
+
* /preferences/sections/{section_id}/topics.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const workspacePreferenceGetResponse =
|
|
17
|
+
* await client.workspacePreferences.create({
|
|
18
|
+
* name: 'Account Notifications',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
create(body: WorkspacePreferenceCreateParams, options?: RequestOptions): APIPromise<WorkspacePreferenceGetResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve a workspace preference by id, including its topics.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const workspacePreferenceGetResponse =
|
|
29
|
+
* await client.workspacePreferences.retrieve('section_id');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
retrieve(sectionID: string, options?: RequestOptions): APIPromise<WorkspacePreferenceGetResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* List the workspace's preferences. Each workspace preference embeds its topics.
|
|
35
|
+
* Scoped to the workspace of the API key.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const workspacePreferenceListResponse =
|
|
40
|
+
* await client.workspacePreferences.list();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
list(options?: RequestOptions): APIPromise<WorkspacePreferenceListResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Archive a workspace preference. The workspace preference must be empty: delete
|
|
46
|
+
* its topics first, otherwise the request fails with 409.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* await client.workspacePreferences.archive('section_id');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
archive(sectionID: string, options?: RequestOptions): APIPromise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Publish the workspace's preferences page. Takes a snapshot of every workspace
|
|
56
|
+
* preference with its topics under a new published version, making the current
|
|
57
|
+
* state visible on the hosted preferences page (non-draft).
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const publishPreferencesResponse =
|
|
62
|
+
* await client.workspacePreferences.publish();
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
publish(body?: WorkspacePreferencePublishParams | null | undefined, options?: RequestOptions): APIPromise<PublishPreferencesResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Replace a workspace preference. Full document replacement; missing optional
|
|
68
|
+
* fields are cleared. Topics attached to the workspace preference are unaffected.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const workspacePreferenceGetResponse =
|
|
73
|
+
* await client.workspacePreferences.replace('section_id', {
|
|
74
|
+
* name: 'name',
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
replace(sectionID: string, body: WorkspacePreferenceReplaceParams, options?: RequestOptions): APIPromise<WorkspacePreferenceGetResponse>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Optional page metadata to apply when publishing the workspace's preferences
|
|
82
|
+
* page. All fields are optional; omitted fields fall back to the page defaults
|
|
83
|
+
* (and the workspace default brand).
|
|
84
|
+
*/
|
|
85
|
+
export interface PublishPreferencesRequest {
|
|
86
|
+
/**
|
|
87
|
+
* Brand for the hosted page - "default" (workspace default brand), "none" (no
|
|
88
|
+
* brand), or a specific brand id. Defaults to "default".
|
|
89
|
+
*/
|
|
90
|
+
brand_id?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Description shown under the heading on the hosted preferences page.
|
|
93
|
+
*/
|
|
94
|
+
description?: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Heading shown at the top of the hosted preferences page.
|
|
97
|
+
*/
|
|
98
|
+
heading?: string | null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Result of publishing the workspace's preferences page.
|
|
102
|
+
*/
|
|
103
|
+
export interface PublishPreferencesResponse {
|
|
104
|
+
/**
|
|
105
|
+
* Id of the published page snapshot.
|
|
106
|
+
*/
|
|
107
|
+
page_id: string;
|
|
108
|
+
/**
|
|
109
|
+
* ISO-8601 timestamp of the publish.
|
|
110
|
+
*/
|
|
111
|
+
published_at: string;
|
|
112
|
+
/**
|
|
113
|
+
* Monotonic published version (epoch milliseconds).
|
|
114
|
+
*/
|
|
115
|
+
published_version: number;
|
|
116
|
+
/**
|
|
117
|
+
* Draft-mode hosted preferences page URL for previewing.
|
|
118
|
+
*/
|
|
119
|
+
preview_url?: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Id of the publisher.
|
|
122
|
+
*/
|
|
123
|
+
published_by?: string | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Request body for creating a workspace preference.
|
|
127
|
+
*/
|
|
128
|
+
export interface WorkspacePreferenceCreateRequest {
|
|
129
|
+
/**
|
|
130
|
+
* Human-readable name for the workspace preference.
|
|
131
|
+
*/
|
|
132
|
+
name: string;
|
|
133
|
+
/**
|
|
134
|
+
* Optional description shown under the section on the hosted preferences page.
|
|
135
|
+
*/
|
|
136
|
+
description?: string | null;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the workspace preference defines custom routing for its topics.
|
|
139
|
+
*/
|
|
140
|
+
has_custom_routing?: boolean | null;
|
|
141
|
+
/**
|
|
142
|
+
* Default channels for the workspace preference. Defaults to empty if omitted.
|
|
143
|
+
*/
|
|
144
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A workspace preference in your workspace, including its topics.
|
|
148
|
+
*/
|
|
149
|
+
export interface WorkspacePreferenceGetResponse {
|
|
150
|
+
/**
|
|
151
|
+
* The workspace preference id.
|
|
152
|
+
*/
|
|
153
|
+
id: string;
|
|
154
|
+
/**
|
|
155
|
+
* ISO-8601 timestamp of when the workspace preference was created.
|
|
156
|
+
*/
|
|
157
|
+
created: string;
|
|
158
|
+
/**
|
|
159
|
+
* Whether the workspace preference defines custom routing for its topics.
|
|
160
|
+
*/
|
|
161
|
+
has_custom_routing: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Human-readable name.
|
|
164
|
+
*/
|
|
165
|
+
name: string;
|
|
166
|
+
/**
|
|
167
|
+
* Default channels for the workspace preference. May be empty.
|
|
168
|
+
*/
|
|
169
|
+
routing_options: Array<Shared.ChannelClassification>;
|
|
170
|
+
/**
|
|
171
|
+
* The topics contained in this workspace preference.
|
|
172
|
+
*/
|
|
173
|
+
topics: Array<WorkspacePreferenceTopicGetResponse>;
|
|
174
|
+
/**
|
|
175
|
+
* Id of the creator.
|
|
176
|
+
*/
|
|
177
|
+
creator?: string | null;
|
|
178
|
+
/**
|
|
179
|
+
* Optional description shown under the section on the hosted preferences page.
|
|
180
|
+
*/
|
|
181
|
+
description?: string | null;
|
|
182
|
+
/**
|
|
183
|
+
* ISO-8601 timestamp of the last update.
|
|
184
|
+
*/
|
|
185
|
+
updated?: string | null;
|
|
186
|
+
/**
|
|
187
|
+
* Id of the last updater.
|
|
188
|
+
*/
|
|
189
|
+
updater?: string | null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The workspace's preferences, each with its topics.
|
|
193
|
+
*/
|
|
194
|
+
export interface WorkspacePreferenceListResponse {
|
|
195
|
+
results: Array<WorkspacePreferenceGetResponse>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Request body for replacing a workspace preference. Full document replacement;
|
|
199
|
+
* missing optional fields are cleared.
|
|
200
|
+
*/
|
|
201
|
+
export interface WorkspacePreferenceReplaceRequest {
|
|
202
|
+
/**
|
|
203
|
+
* Human-readable name for the workspace preference.
|
|
204
|
+
*/
|
|
205
|
+
name: string;
|
|
206
|
+
/**
|
|
207
|
+
* Optional description shown under the section on the hosted preferences page.
|
|
208
|
+
* Omit to clear.
|
|
209
|
+
*/
|
|
210
|
+
description?: string | null;
|
|
211
|
+
/**
|
|
212
|
+
* Whether the workspace preference defines custom routing for its topics.
|
|
213
|
+
*/
|
|
214
|
+
has_custom_routing?: boolean | null;
|
|
215
|
+
/**
|
|
216
|
+
* Default channels for the workspace preference. Omit to clear.
|
|
217
|
+
*/
|
|
218
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Request body for creating a preference topic.
|
|
222
|
+
*/
|
|
223
|
+
export interface WorkspacePreferenceTopicCreateRequest {
|
|
224
|
+
/**
|
|
225
|
+
* The default subscription status applied when a recipient has not set their own.
|
|
226
|
+
*/
|
|
227
|
+
default_status: 'OPTED_OUT' | 'OPTED_IN' | 'REQUIRED';
|
|
228
|
+
/**
|
|
229
|
+
* Human-readable name for the preference topic.
|
|
230
|
+
*/
|
|
231
|
+
name: string;
|
|
232
|
+
/**
|
|
233
|
+
* Preference controls a recipient may customize for this topic. Defaults to empty
|
|
234
|
+
* if omitted.
|
|
235
|
+
*/
|
|
236
|
+
allowed_preferences?: Array<'snooze' | 'channel_preferences'> | null;
|
|
237
|
+
/**
|
|
238
|
+
* Optional description shown under the topic on the hosted preferences page.
|
|
239
|
+
*/
|
|
240
|
+
description?: string | null;
|
|
241
|
+
/**
|
|
242
|
+
* Whether to include a list-unsubscribe header on emails for this topic.
|
|
243
|
+
*/
|
|
244
|
+
include_unsubscribe_header?: boolean | null;
|
|
245
|
+
/**
|
|
246
|
+
* Default channels delivered for this topic. Defaults to empty if omitted.
|
|
247
|
+
*/
|
|
248
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
249
|
+
/**
|
|
250
|
+
* Arbitrary metadata associated with the topic.
|
|
251
|
+
*/
|
|
252
|
+
topic_data?: {
|
|
253
|
+
[key: string]: unknown;
|
|
254
|
+
} | null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* A subscription preference topic in your workspace.
|
|
258
|
+
*/
|
|
259
|
+
export interface WorkspacePreferenceTopicGetResponse {
|
|
260
|
+
/**
|
|
261
|
+
* The preference topic id.
|
|
262
|
+
*/
|
|
263
|
+
id: string;
|
|
264
|
+
/**
|
|
265
|
+
* Preference controls a recipient may customize. May be empty.
|
|
266
|
+
*/
|
|
267
|
+
allowed_preferences: Array<'snooze' | 'channel_preferences'>;
|
|
268
|
+
/**
|
|
269
|
+
* ISO-8601 timestamp of when the topic was created.
|
|
270
|
+
*/
|
|
271
|
+
created: string;
|
|
272
|
+
/**
|
|
273
|
+
* The default subscription status applied when a recipient has not set their own.
|
|
274
|
+
*/
|
|
275
|
+
default_status: 'OPTED_OUT' | 'OPTED_IN' | 'REQUIRED';
|
|
276
|
+
/**
|
|
277
|
+
* Whether a list-unsubscribe header is included on emails for this topic.
|
|
278
|
+
*/
|
|
279
|
+
include_unsubscribe_header: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Human-readable name.
|
|
282
|
+
*/
|
|
283
|
+
name: string;
|
|
284
|
+
/**
|
|
285
|
+
* Default channels delivered for this topic. May be empty.
|
|
286
|
+
*/
|
|
287
|
+
routing_options: Array<Shared.ChannelClassification>;
|
|
288
|
+
/**
|
|
289
|
+
* Arbitrary metadata associated with the topic.
|
|
290
|
+
*/
|
|
291
|
+
topic_data: {
|
|
292
|
+
[key: string]: unknown;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* ISO-8601 timestamp of the last update.
|
|
296
|
+
*/
|
|
297
|
+
updated: string;
|
|
298
|
+
/**
|
|
299
|
+
* Id of the creator.
|
|
300
|
+
*/
|
|
301
|
+
creator?: string | null;
|
|
302
|
+
/**
|
|
303
|
+
* Optional description shown under the topic on the hosted preferences page.
|
|
304
|
+
*/
|
|
305
|
+
description?: string | null;
|
|
306
|
+
/**
|
|
307
|
+
* Id of the last updater.
|
|
308
|
+
*/
|
|
309
|
+
updater?: string | null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Topics contained in a workspace preference.
|
|
313
|
+
*/
|
|
314
|
+
export interface WorkspacePreferenceTopicListResponse {
|
|
315
|
+
results: Array<WorkspacePreferenceTopicGetResponse>;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Request body for replacing a preference topic. Full document replacement;
|
|
319
|
+
* missing optional fields are cleared.
|
|
320
|
+
*/
|
|
321
|
+
export interface WorkspacePreferenceTopicReplaceRequest {
|
|
322
|
+
/**
|
|
323
|
+
* The default subscription status applied when a recipient has not set their own.
|
|
324
|
+
*/
|
|
325
|
+
default_status: 'OPTED_OUT' | 'OPTED_IN' | 'REQUIRED';
|
|
326
|
+
/**
|
|
327
|
+
* Human-readable name for the preference topic.
|
|
328
|
+
*/
|
|
329
|
+
name: string;
|
|
330
|
+
/**
|
|
331
|
+
* Preference controls a recipient may customize. Omit to clear.
|
|
332
|
+
*/
|
|
333
|
+
allowed_preferences?: Array<'snooze' | 'channel_preferences'> | null;
|
|
334
|
+
/**
|
|
335
|
+
* Optional description shown under the topic on the hosted preferences page. Omit
|
|
336
|
+
* to clear.
|
|
337
|
+
*/
|
|
338
|
+
description?: string | null;
|
|
339
|
+
/**
|
|
340
|
+
* Whether to include a list-unsubscribe header on emails for this topic.
|
|
341
|
+
*/
|
|
342
|
+
include_unsubscribe_header?: boolean | null;
|
|
343
|
+
/**
|
|
344
|
+
* Default channels delivered for this topic. Omit to clear.
|
|
345
|
+
*/
|
|
346
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
347
|
+
/**
|
|
348
|
+
* Arbitrary metadata associated with the topic. Omit to clear.
|
|
349
|
+
*/
|
|
350
|
+
topic_data?: {
|
|
351
|
+
[key: string]: unknown;
|
|
352
|
+
} | null;
|
|
353
|
+
}
|
|
354
|
+
export interface WorkspacePreferenceCreateParams {
|
|
355
|
+
/**
|
|
356
|
+
* Human-readable name for the workspace preference.
|
|
357
|
+
*/
|
|
358
|
+
name: string;
|
|
359
|
+
/**
|
|
360
|
+
* Optional description shown under the section on the hosted preferences page.
|
|
361
|
+
*/
|
|
362
|
+
description?: string | null;
|
|
363
|
+
/**
|
|
364
|
+
* Whether the workspace preference defines custom routing for its topics.
|
|
365
|
+
*/
|
|
366
|
+
has_custom_routing?: boolean | null;
|
|
367
|
+
/**
|
|
368
|
+
* Default channels for the workspace preference. Defaults to empty if omitted.
|
|
369
|
+
*/
|
|
370
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
371
|
+
}
|
|
372
|
+
export interface WorkspacePreferencePublishParams {
|
|
373
|
+
/**
|
|
374
|
+
* Brand for the hosted page - "default" (workspace default brand), "none" (no
|
|
375
|
+
* brand), or a specific brand id. Defaults to "default".
|
|
376
|
+
*/
|
|
377
|
+
brand_id?: string | null;
|
|
378
|
+
/**
|
|
379
|
+
* Description shown under the heading on the hosted preferences page.
|
|
380
|
+
*/
|
|
381
|
+
description?: string | null;
|
|
382
|
+
/**
|
|
383
|
+
* Heading shown at the top of the hosted preferences page.
|
|
384
|
+
*/
|
|
385
|
+
heading?: string | null;
|
|
386
|
+
}
|
|
387
|
+
export interface WorkspacePreferenceReplaceParams {
|
|
388
|
+
/**
|
|
389
|
+
* Human-readable name for the workspace preference.
|
|
390
|
+
*/
|
|
391
|
+
name: string;
|
|
392
|
+
/**
|
|
393
|
+
* Optional description shown under the section on the hosted preferences page.
|
|
394
|
+
* Omit to clear.
|
|
395
|
+
*/
|
|
396
|
+
description?: string | null;
|
|
397
|
+
/**
|
|
398
|
+
* Whether the workspace preference defines custom routing for its topics.
|
|
399
|
+
*/
|
|
400
|
+
has_custom_routing?: boolean | null;
|
|
401
|
+
/**
|
|
402
|
+
* Default channels for the workspace preference. Omit to clear.
|
|
403
|
+
*/
|
|
404
|
+
routing_options?: Array<Shared.ChannelClassification> | null;
|
|
405
|
+
}
|
|
406
|
+
export declare namespace WorkspacePreferences {
|
|
407
|
+
export { type PublishPreferencesRequest as PublishPreferencesRequest, type PublishPreferencesResponse as PublishPreferencesResponse, type WorkspacePreferenceCreateRequest as WorkspacePreferenceCreateRequest, type WorkspacePreferenceGetResponse as WorkspacePreferenceGetResponse, type WorkspacePreferenceListResponse as WorkspacePreferenceListResponse, type WorkspacePreferenceReplaceRequest as WorkspacePreferenceReplaceRequest, type WorkspacePreferenceTopicCreateRequest as WorkspacePreferenceTopicCreateRequest, type WorkspacePreferenceTopicGetResponse as WorkspacePreferenceTopicGetResponse, type WorkspacePreferenceTopicListResponse as WorkspacePreferenceTopicListResponse, type WorkspacePreferenceTopicReplaceRequest as WorkspacePreferenceTopicReplaceRequest, type WorkspacePreferenceCreateParams as WorkspacePreferenceCreateParams, type WorkspacePreferencePublishParams as WorkspacePreferencePublishParams, type WorkspacePreferenceReplaceParams as WorkspacePreferenceReplaceParams, };
|
|
408
|
+
export { Topics as Topics, type TopicCreateParams as TopicCreateParams, type TopicRetrieveParams as TopicRetrieveParams, type TopicArchiveParams as TopicArchiveParams, type TopicReplaceParams as TopicReplaceParams, };
|
|
409
|
+
}
|
|
410
|
+
//# sourceMappingURL=workspace-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.d.ts","sourceRoot":"","sources":["../../src/resources/workspace-preferences/workspace-preferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,MAAM,qBAAkB;AACpC,OAAO,KAAK,SAAS,oBAAiB;AACtC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACP,oBAAiB;AAClB,OAAO,EAAE,UAAU,EAAE,kCAA+B;AAEpD,OAAO,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AAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.WorkspacePreferences = void 0;
|
|
5
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../core/resource.js");
|
|
7
|
+
const TopicsAPI = tslib_1.__importStar(require("./topics.js"));
|
|
8
|
+
const topics_1 = require("./topics.js");
|
|
9
|
+
const headers_1 = require("../../internal/headers.js");
|
|
10
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
11
|
+
class WorkspacePreferences extends resource_1.APIResource {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.topics = new TopicsAPI.Topics(this._client);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a workspace preference. The workspace preference id is generated and
|
|
18
|
+
* returned. Topics are created inside a workspace preference via POST
|
|
19
|
+
* /preferences/sections/{section_id}/topics.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const workspacePreferenceGetResponse =
|
|
24
|
+
* await client.workspacePreferences.create({
|
|
25
|
+
* name: 'Account Notifications',
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
create(body, options) {
|
|
30
|
+
return this._client.post('/preferences/sections', { body, ...options });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve a workspace preference by id, including its topics.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const workspacePreferenceGetResponse =
|
|
38
|
+
* await client.workspacePreferences.retrieve('section_id');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
retrieve(sectionID, options) {
|
|
42
|
+
return this._client.get((0, path_1.path) `/preferences/sections/${sectionID}`, options);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* List the workspace's preferences. Each workspace preference embeds its topics.
|
|
46
|
+
* Scoped to the workspace of the API key.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const workspacePreferenceListResponse =
|
|
51
|
+
* await client.workspacePreferences.list();
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
list(options) {
|
|
55
|
+
return this._client.get('/preferences/sections', options);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Archive a workspace preference. The workspace preference must be empty: delete
|
|
59
|
+
* its topics first, otherwise the request fails with 409.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* await client.workspacePreferences.archive('section_id');
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
archive(sectionID, options) {
|
|
67
|
+
return this._client.delete((0, path_1.path) `/preferences/sections/${sectionID}`, {
|
|
68
|
+
...options,
|
|
69
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Publish the workspace's preferences page. Takes a snapshot of every workspace
|
|
74
|
+
* preference with its topics under a new published version, making the current
|
|
75
|
+
* state visible on the hosted preferences page (non-draft).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const publishPreferencesResponse =
|
|
80
|
+
* await client.workspacePreferences.publish();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
publish(body = {}, options) {
|
|
84
|
+
return this._client.post('/preferences/publish', { body, ...options });
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Replace a workspace preference. Full document replacement; missing optional
|
|
88
|
+
* fields are cleared. Topics attached to the workspace preference are unaffected.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const workspacePreferenceGetResponse =
|
|
93
|
+
* await client.workspacePreferences.replace('section_id', {
|
|
94
|
+
* name: 'name',
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
replace(sectionID, body, options) {
|
|
99
|
+
return this._client.put((0, path_1.path) `/preferences/sections/${sectionID}`, { body, ...options });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.WorkspacePreferences = WorkspacePreferences;
|
|
103
|
+
WorkspacePreferences.Topics = topics_1.Topics;
|
|
104
|
+
//# sourceMappingURL=workspace-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.js","sourceRoot":"","sources":["../../src/resources/workspace-preferences/workspace-preferences.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,+DAAsC;AACtC,wCAMkB;AAElB,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,oBAAqB,SAAQ,sBAAW;IAArD;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAsGhE,CAAC;IApGC;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,IAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,yBAAyB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,SAAiB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,yBAAyB,SAAS,EAAE,EAAE;YACnE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CACL,OAA4D,EAAE,EAC9D,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CACL,SAAiB,EACjB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,yBAAyB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;CACF;AAvGD,oDAuGC;AAmYD,oBAAoB,CAAC,MAAM,GAAG,eAAM,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import * as TopicsAPI from "./topics.mjs";
|
|
4
|
+
import { Topics, } from "./topics.mjs";
|
|
5
|
+
import { buildHeaders } from "../../internal/headers.mjs";
|
|
6
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
7
|
+
export class WorkspacePreferences extends APIResource {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.topics = new TopicsAPI.Topics(this._client);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a workspace preference. The workspace preference id is generated and
|
|
14
|
+
* returned. Topics are created inside a workspace preference via POST
|
|
15
|
+
* /preferences/sections/{section_id}/topics.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const workspacePreferenceGetResponse =
|
|
20
|
+
* await client.workspacePreferences.create({
|
|
21
|
+
* name: 'Account Notifications',
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
create(body, options) {
|
|
26
|
+
return this._client.post('/preferences/sections', { body, ...options });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve a workspace preference by id, including its topics.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const workspacePreferenceGetResponse =
|
|
34
|
+
* await client.workspacePreferences.retrieve('section_id');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
retrieve(sectionID, options) {
|
|
38
|
+
return this._client.get(path `/preferences/sections/${sectionID}`, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* List the workspace's preferences. Each workspace preference embeds its topics.
|
|
42
|
+
* Scoped to the workspace of the API key.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const workspacePreferenceListResponse =
|
|
47
|
+
* await client.workspacePreferences.list();
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
list(options) {
|
|
51
|
+
return this._client.get('/preferences/sections', options);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Archive a workspace preference. The workspace preference must be empty: delete
|
|
55
|
+
* its topics first, otherwise the request fails with 409.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.workspacePreferences.archive('section_id');
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
archive(sectionID, options) {
|
|
63
|
+
return this._client.delete(path `/preferences/sections/${sectionID}`, {
|
|
64
|
+
...options,
|
|
65
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Publish the workspace's preferences page. Takes a snapshot of every workspace
|
|
70
|
+
* preference with its topics under a new published version, making the current
|
|
71
|
+
* state visible on the hosted preferences page (non-draft).
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const publishPreferencesResponse =
|
|
76
|
+
* await client.workspacePreferences.publish();
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
publish(body = {}, options) {
|
|
80
|
+
return this._client.post('/preferences/publish', { body, ...options });
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Replace a workspace preference. Full document replacement; missing optional
|
|
84
|
+
* fields are cleared. Topics attached to the workspace preference are unaffected.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const workspacePreferenceGetResponse =
|
|
89
|
+
* await client.workspacePreferences.replace('section_id', {
|
|
90
|
+
* name: 'name',
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
replace(sectionID, body, options) {
|
|
95
|
+
return this._client.put(path `/preferences/sections/${sectionID}`, { body, ...options });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
WorkspacePreferences.Topics = Topics;
|
|
99
|
+
//# sourceMappingURL=workspace-preferences.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.mjs","sourceRoot":"","sources":["../../src/resources/workspace-preferences/workspace-preferences.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,KAAK,SAAS,qBAAiB;AACtC,OAAO,EAKL,MAAM,GACP,qBAAiB;AAElB,OAAO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B,EACjB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,yBAAyB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;CACF;AAmYD,oBAAoB,CAAC,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.d.mts","sourceRoot":"","sources":["../src/resources/workspace-preferences.ts"],"names":[],"mappings":"AAEA,kDAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.d.ts","sourceRoot":"","sources":["../src/resources/workspace-preferences.ts"],"names":[],"mappings":"AAEA,iDAA8C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./workspace-preferences/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=workspace-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.js","sourceRoot":"","sources":["../src/resources/workspace-preferences.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2EAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-preferences.mjs","sourceRoot":"","sources":["../src/resources/workspace-preferences.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,kDAA8C"}
|