@solytude/listmonk 1.0.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/LICENSE +21 -0
- package/README.md +542 -0
- package/dist/chunk-saezhne8.js +14 -0
- package/dist/chunk-saezhne8.js.map +9 -0
- package/dist/client.d.ts +430 -0
- package/dist/errors/api.d.ts +178 -0
- package/dist/errors/base.d.ts +47 -0
- package/dist/errors/configuration.d.ts +49 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/network.d.ts +69 -0
- package/dist/errors/validation.d.ts +57 -0
- package/dist/http/auth.d.ts +39 -0
- package/dist/http/client.d.ts +149 -0
- package/dist/http/hooks.d.ts +90 -0
- package/dist/http/index.d.ts +10 -0
- package/dist/http/resource.d.ts +100 -0
- package/dist/http/sse.d.ts +36 -0
- package/dist/http/url.d.ts +51 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +16039 -0
- package/dist/index.js.map +120 -0
- package/dist/resources/admin/admin.d.ts +92 -0
- package/dist/resources/admin/index.d.ts +10 -0
- package/dist/resources/admin/schemas.d.ts +23 -0
- package/dist/resources/admin/types.d.ts +29 -0
- package/dist/resources/bounces/bounces.d.ts +262 -0
- package/dist/resources/bounces/index.d.ts +10 -0
- package/dist/resources/bounces/schemas.d.ts +86 -0
- package/dist/resources/bounces/types.d.ts +37 -0
- package/dist/resources/campaigns/campaigns.d.ts +339 -0
- package/dist/resources/campaigns/index.d.ts +10 -0
- package/dist/resources/campaigns/schemas.d.ts +374 -0
- package/dist/resources/campaigns/types.d.ts +111 -0
- package/dist/resources/dashboard/dashboard.d.ts +73 -0
- package/dist/resources/dashboard/index.d.ts +10 -0
- package/dist/resources/dashboard/schemas.d.ts +55 -0
- package/dist/resources/dashboard/types.d.ts +22 -0
- package/dist/resources/import/import.d.ts +215 -0
- package/dist/resources/import/index.d.ts +10 -0
- package/dist/resources/import/schemas.d.ts +109 -0
- package/dist/resources/import/types.d.ts +72 -0
- package/dist/resources/lists/index.d.ts +10 -0
- package/dist/resources/lists/lists.d.ts +180 -0
- package/dist/resources/lists/schemas.d.ts +176 -0
- package/dist/resources/lists/types.d.ts +56 -0
- package/dist/resources/maintenance/index.d.ts +10 -0
- package/dist/resources/maintenance/maintenance.d.ts +92 -0
- package/dist/resources/maintenance/schemas.d.ts +36 -0
- package/dist/resources/maintenance/types.d.ts +31 -0
- package/dist/resources/media/index.d.ts +10 -0
- package/dist/resources/media/media.d.ts +198 -0
- package/dist/resources/media/schemas.d.ts +48 -0
- package/dist/resources/media/types.d.ts +48 -0
- package/dist/resources/public/index.d.ts +10 -0
- package/dist/resources/public/public.d.ts +111 -0
- package/dist/resources/public/schemas.d.ts +52 -0
- package/dist/resources/public/types.d.ts +30 -0
- package/dist/resources/settings/index.d.ts +10 -0
- package/dist/resources/settings/schemas.d.ts +374 -0
- package/dist/resources/settings/settings.d.ts +106 -0
- package/dist/resources/settings/types.d.ts +78 -0
- package/dist/resources/subscribers/index.d.ts +10 -0
- package/dist/resources/subscribers/schemas.d.ts +360 -0
- package/dist/resources/subscribers/subscribers.d.ts +308 -0
- package/dist/resources/subscribers/types.d.ts +113 -0
- package/dist/resources/templates/index.d.ts +10 -0
- package/dist/resources/templates/schemas.d.ts +110 -0
- package/dist/resources/templates/templates.d.ts +225 -0
- package/dist/resources/templates/types.d.ts +45 -0
- package/dist/resources/tx/index.d.ts +10 -0
- package/dist/resources/tx/schemas.d.ts +67 -0
- package/dist/resources/tx/tx.d.ts +167 -0
- package/dist/resources/tx/types.d.ts +88 -0
- package/dist/schemas/common.d.ts +48 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/testing/errors.d.ts +25 -0
- package/dist/testing/factories/bounce.d.ts +43 -0
- package/dist/testing/factories/campaign.d.ts +43 -0
- package/dist/testing/factories/common.d.ts +54 -0
- package/dist/testing/factories/index.d.ts +12 -0
- package/dist/testing/factories/list.d.ts +43 -0
- package/dist/testing/factories/media.d.ts +40 -0
- package/dist/testing/factories/subscriber.d.ts +43 -0
- package/dist/testing/factories/template.d.ts +40 -0
- package/dist/testing/index.d.ts +39 -0
- package/dist/testing/index.js +573 -0
- package/dist/testing/index.js.map +32 -0
- package/dist/testing/mock-client.d.ts +119 -0
- package/dist/testing/mock-function.d.ts +28 -0
- package/dist/testing/resources/admin.d.ts +20 -0
- package/dist/testing/resources/bounces.d.ts +22 -0
- package/dist/testing/resources/campaigns.d.ts +31 -0
- package/dist/testing/resources/dashboard.d.ts +17 -0
- package/dist/testing/resources/import.d.ts +19 -0
- package/dist/testing/resources/index.d.ts +18 -0
- package/dist/testing/resources/lists.d.ts +24 -0
- package/dist/testing/resources/maintenance.d.ts +18 -0
- package/dist/testing/resources/media.d.ts +21 -0
- package/dist/testing/resources/public.d.ts +18 -0
- package/dist/testing/resources/settings.d.ts +19 -0
- package/dist/testing/resources/subscribers.d.ts +33 -0
- package/dist/testing/resources/templates.d.ts +24 -0
- package/dist/testing/resources/tx.d.ts +16 -0
- package/dist/testing/types.d.ts +138 -0
- package/dist/types/config.d.ts +59 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/pagination.d.ts +37 -0
- package/package.json +97 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subscribers resource for managing subscriber lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* @module resources/subscribers
|
|
5
|
+
*/
|
|
6
|
+
import { APIResource } from "../../http/resource";
|
|
7
|
+
import type { Subscriber, CreateSubscriberRequest, UpdateSubscriberRequest, ListSubscribersOptions, ListSubscribersResponse, ModifyListsRequest, ModifyListsForListRequest, ModifyListsByQueryRequest, BounceRecord, SubscriberExportResponse } from "./types";
|
|
8
|
+
import type { PagedAsyncIterableIterator } from "../../types/pagination";
|
|
9
|
+
/**
|
|
10
|
+
* Resource for managing subscribers in listmonk.
|
|
11
|
+
*
|
|
12
|
+
* Provides methods for CRUD operations, bulk operations,
|
|
13
|
+
* list membership management, and more.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Access via client
|
|
18
|
+
* const subscriber = await client.subscribers.create({
|
|
19
|
+
* email: 'john@example.com',
|
|
20
|
+
* name: 'John Doe',
|
|
21
|
+
* status: 'enabled',
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class SubscribersResource extends APIResource {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new subscriber.
|
|
28
|
+
*
|
|
29
|
+
* @param data - Subscriber data
|
|
30
|
+
* @returns The created subscriber
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const subscriber = await client.subscribers.create({
|
|
35
|
+
* email: 'john@example.com',
|
|
36
|
+
* name: 'John Doe',
|
|
37
|
+
* status: 'enabled',
|
|
38
|
+
* lists: [1, 2],
|
|
39
|
+
* attribs: { city: 'New York' },
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
create(data: CreateSubscriberRequest): Promise<Subscriber>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves a subscriber by ID.
|
|
46
|
+
*
|
|
47
|
+
* @param id - Subscriber ID
|
|
48
|
+
* @returns The subscriber
|
|
49
|
+
* @throws {ListmonkNotFoundError} If subscriber not found
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const subscriber = await client.subscribers.retrieve(123);
|
|
54
|
+
* console.log(subscriber.email);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
retrieve(id: number): Promise<Subscriber>;
|
|
58
|
+
/**
|
|
59
|
+
* Updates an existing subscriber.
|
|
60
|
+
*
|
|
61
|
+
* Note: The `lists` array replaces all existing list memberships.
|
|
62
|
+
* To modify lists without replacing, use `modifyLists()` instead.
|
|
63
|
+
*
|
|
64
|
+
* @param id - Subscriber ID
|
|
65
|
+
* @param data - Updated subscriber data
|
|
66
|
+
* @returns The updated subscriber
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const updated = await client.subscribers.update(123, {
|
|
71
|
+
* email: 'john@example.com',
|
|
72
|
+
* name: 'John Doe Updated',
|
|
73
|
+
* status: 'enabled',
|
|
74
|
+
* lists: [1, 2, 3],
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
update(id: number, data: UpdateSubscriberRequest): Promise<Subscriber>;
|
|
79
|
+
/**
|
|
80
|
+
* Deletes a subscriber by ID.
|
|
81
|
+
*
|
|
82
|
+
* @param id - Subscriber ID
|
|
83
|
+
* @throws {ListmonkNotFoundError} If subscriber not found
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* await client.subscribers.remove(123);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
remove(id: number): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Lists subscribers with pagination and filtering.
|
|
93
|
+
*
|
|
94
|
+
* @param options - Query options
|
|
95
|
+
* @returns Paginated subscriber list
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const page = await client.subscribers.list({
|
|
100
|
+
* page: 1,
|
|
101
|
+
* per_page: 50,
|
|
102
|
+
* list_id: [1],
|
|
103
|
+
* subscription_status: 'confirmed',
|
|
104
|
+
* order_by: 'created_at',
|
|
105
|
+
* order: 'DESC',
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
list(options?: ListSubscribersOptions): Promise<ListSubscribersResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns an async iterator over all subscribers matching the options.
|
|
112
|
+
*
|
|
113
|
+
* Pages are fetched on-demand as you iterate. The iterator also
|
|
114
|
+
* provides a `byPage()` method for page-level iteration.
|
|
115
|
+
*
|
|
116
|
+
* @param options - Query options (page is ignored, starts from 1)
|
|
117
|
+
* @returns Async iterator over subscribers
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* // Iterate over all subscribers
|
|
122
|
+
* for await (const subscriber of client.subscribers.listAll()) {
|
|
123
|
+
* console.log(subscriber.email);
|
|
124
|
+
* }
|
|
125
|
+
*
|
|
126
|
+
* // Iterate over pages
|
|
127
|
+
* for await (const page of client.subscribers.listAll().byPage()) {
|
|
128
|
+
* console.log(`Page ${page.page} has ${page.results.length} items`);
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
listAll(options?: Omit<ListSubscribersOptions, "page">): PagedAsyncIterableIterator<Subscriber, ListSubscribersResponse>;
|
|
133
|
+
/**
|
|
134
|
+
* Modifies list memberships for multiple subscribers.
|
|
135
|
+
*
|
|
136
|
+
* @param request - Modification request with subscriber IDs, action, and target lists
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* // Add subscribers to lists
|
|
141
|
+
* await client.subscribers.modifyLists({
|
|
142
|
+
* ids: [1, 2, 3],
|
|
143
|
+
* action: 'add',
|
|
144
|
+
* target_list_ids: [10, 20],
|
|
145
|
+
* status: 'confirmed', // Required for 'add' action
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* // Remove subscribers from lists
|
|
149
|
+
* await client.subscribers.modifyLists({
|
|
150
|
+
* ids: [1, 2],
|
|
151
|
+
* action: 'remove',
|
|
152
|
+
* target_list_ids: [10],
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
modifyLists(request: ModifyListsRequest): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Modifies list membership for a specific list.
|
|
159
|
+
*
|
|
160
|
+
* @param listId - Target list ID
|
|
161
|
+
* @param request - Modification request with subscriber IDs and action
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* await client.subscribers.modifyListsForList(10, {
|
|
166
|
+
* ids: [1, 2, 3],
|
|
167
|
+
* action: 'add',
|
|
168
|
+
* status: 'confirmed',
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
modifyListsForList(listId: number, request: ModifyListsForListRequest): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Blocklists a single subscriber.
|
|
175
|
+
*
|
|
176
|
+
* @param id - Subscriber ID
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* await client.subscribers.blocklist(123);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
blocklist(id: number): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Blocklists multiple subscribers by ID.
|
|
186
|
+
*
|
|
187
|
+
* @param ids - Subscriber IDs
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* await client.subscribers.blocklistMany([1, 2, 3]);
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
blocklistMany(ids: number[]): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Blocklists subscribers matching a SQL-style query.
|
|
197
|
+
*
|
|
198
|
+
* @param query - SQL-style query expression
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* await client.subscribers.blocklistByQuery(
|
|
203
|
+
* "subscribers.attribs->>'source' = 'spam'"
|
|
204
|
+
* );
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
blocklistByQuery(query: string): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Deletes multiple subscribers by ID.
|
|
210
|
+
*
|
|
211
|
+
* Note: This uses query parameters (?id=1&id=2), not a JSON body.
|
|
212
|
+
*
|
|
213
|
+
* @param ids - Subscriber IDs to delete
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* await client.subscribers.deleteMany([1, 2, 3]);
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
deleteMany(ids: number[]): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Deletes subscribers matching a SQL-style query.
|
|
223
|
+
*
|
|
224
|
+
* @param query - SQL-style query expression
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* await client.subscribers.deleteByQuery(
|
|
229
|
+
* "subscribers.status = 'disabled' AND subscribers.updated_at < '2023-01-01'"
|
|
230
|
+
* );
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
deleteByQuery(query: string): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* Retrieves bounce records for a subscriber.
|
|
236
|
+
*
|
|
237
|
+
* @param id - Subscriber ID
|
|
238
|
+
* @returns Array of bounce records
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const bounces = await client.subscribers.getBounces(123);
|
|
243
|
+
* for (const bounce of bounces) {
|
|
244
|
+
* console.log(bounce.type, bounce.source);
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
getBounces(id: number): Promise<BounceRecord[]>;
|
|
249
|
+
/**
|
|
250
|
+
* Deletes all bounce records for a subscriber.
|
|
251
|
+
*
|
|
252
|
+
* @param id - Subscriber ID
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* await client.subscribers.deleteBounces(123);
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
deleteBounces(id: number): Promise<void>;
|
|
260
|
+
/**
|
|
261
|
+
* Exports complete subscriber data for GDPR/CCPA compliance.
|
|
262
|
+
*
|
|
263
|
+
* Includes profile, subscriptions, campaign views, and link clicks.
|
|
264
|
+
* Private list names are masked as "Private list".
|
|
265
|
+
*
|
|
266
|
+
* @param id - Subscriber ID
|
|
267
|
+
* @returns Complete subscriber export data
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const data = await client.subscribers.export(123);
|
|
272
|
+
* console.log(data.profile);
|
|
273
|
+
* console.log(data.subscriptions);
|
|
274
|
+
* console.log(data.campaign_views);
|
|
275
|
+
* console.log(data.link_clicks);
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
export(id: number): Promise<SubscriberExportResponse>;
|
|
279
|
+
/**
|
|
280
|
+
* Sends an opt-in confirmation email to the subscriber.
|
|
281
|
+
*
|
|
282
|
+
* Used for double opt-in confirmation flows.
|
|
283
|
+
*
|
|
284
|
+
* @param id - Subscriber ID
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* await client.subscribers.sendOptin(123);
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
sendOptin(id: number): Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* Modifies list memberships for subscribers matching a query.
|
|
294
|
+
*
|
|
295
|
+
* @param request - Modification request with query, action, and target lists
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* await client.subscribers.modifyListsByQuery({
|
|
300
|
+
* query: "subscribers.attribs->>'segment' = 'vip'",
|
|
301
|
+
* action: 'add',
|
|
302
|
+
* target_list_ids: [10],
|
|
303
|
+
* status: 'confirmed',
|
|
304
|
+
* });
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
modifyListsByQuery(request: ModifyListsByQueryRequest): Promise<void>;
|
|
308
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types for subscribers module.
|
|
3
|
+
*
|
|
4
|
+
* All types are inferred from Zod schemas to ensure runtime
|
|
5
|
+
* validation matches compile-time types.
|
|
6
|
+
*
|
|
7
|
+
* @module resources/subscribers/types
|
|
8
|
+
*/
|
|
9
|
+
import type { z } from "zod";
|
|
10
|
+
import type { SubscriberSchema, SubscriberStatusSchema, SubscriptionStatusSchema, ListSubscriptionSchema, BounceRecordSchema, BounceTypeSchema, BounceCampaignSchema, SubscriberAttribsSchema, CreateSubscriberRequestSchema, UpdateSubscriberRequestSchema, ListSubscribersOptionsSchema, ListSubscribersResponseSchema, ModifyListsRequestSchema, ModifyListsForListRequestSchema, ModifyListsByQueryRequestSchema, QueryOperationRequestSchema, BulkOperationResponseSchema, SubscriberExportResponseSchema, SubscriberProfileSchema, ExportSubscriptionSchema, CampaignViewSchema, LinkClickSchema, ListActionSchema } from "./schemas";
|
|
11
|
+
/**
|
|
12
|
+
* Subscriber account-level status.
|
|
13
|
+
* - `enabled`: Active subscriber, can receive emails
|
|
14
|
+
* - `disabled`: Temporarily disabled, no emails sent
|
|
15
|
+
* - `blocklisted`: Permanently blocked from receiving emails
|
|
16
|
+
*/
|
|
17
|
+
export type SubscriberStatus = z.infer<typeof SubscriberStatusSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Subscription status for a specific list.
|
|
20
|
+
* - `confirmed`: Subscription is active and confirmed
|
|
21
|
+
* - `unconfirmed`: Pending confirmation (double opt-in)
|
|
22
|
+
* - `unsubscribed`: User has unsubscribed from this list
|
|
23
|
+
*/
|
|
24
|
+
export type SubscriptionStatus = z.infer<typeof SubscriptionStatusSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Actions for list membership modification.
|
|
27
|
+
* - `add`: Add subscribers to lists (requires status parameter)
|
|
28
|
+
* - `remove`: Remove subscribers from lists entirely
|
|
29
|
+
* - `unsubscribe`: Mark as unsubscribed (soft removal, keeps record)
|
|
30
|
+
*/
|
|
31
|
+
export type ListAction = z.infer<typeof ListActionSchema>;
|
|
32
|
+
/**
|
|
33
|
+
* Bounce type classification.
|
|
34
|
+
* - `hard`: Permanent delivery failure
|
|
35
|
+
* - `soft`: Temporary delivery failure
|
|
36
|
+
*/
|
|
37
|
+
export type BounceType = z.infer<typeof BounceTypeSchema>;
|
|
38
|
+
/**
|
|
39
|
+
* Custom subscriber attributes (flexible JSON object).
|
|
40
|
+
*/
|
|
41
|
+
export type SubscriberAttribs = z.infer<typeof SubscriberAttribsSchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Campaign info attached to a bounce record.
|
|
44
|
+
*/
|
|
45
|
+
export type BounceCampaign = z.infer<typeof BounceCampaignSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* List subscription details within a subscriber.
|
|
48
|
+
*/
|
|
49
|
+
export type ListSubscription = z.infer<typeof ListSubscriptionSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Complete subscriber entity.
|
|
52
|
+
*/
|
|
53
|
+
export type Subscriber = z.infer<typeof SubscriberSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* Bounce record for email delivery failures.
|
|
56
|
+
*/
|
|
57
|
+
export type BounceRecord = z.infer<typeof BounceRecordSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* Request to create a new subscriber (input type).
|
|
60
|
+
*/
|
|
61
|
+
export type CreateSubscriberRequest = z.input<typeof CreateSubscriberRequestSchema>;
|
|
62
|
+
/**
|
|
63
|
+
* Request to update an existing subscriber (input type).
|
|
64
|
+
*/
|
|
65
|
+
export type UpdateSubscriberRequest = z.input<typeof UpdateSubscriberRequestSchema>;
|
|
66
|
+
/**
|
|
67
|
+
* Options for listing subscribers (input type).
|
|
68
|
+
*/
|
|
69
|
+
export type ListSubscribersOptions = z.input<typeof ListSubscribersOptionsSchema>;
|
|
70
|
+
/**
|
|
71
|
+
* Request to modify list memberships for subscribers by ID (input type).
|
|
72
|
+
*/
|
|
73
|
+
export type ModifyListsRequest = z.input<typeof ModifyListsRequestSchema>;
|
|
74
|
+
/**
|
|
75
|
+
* Request to modify list memberships for a specific list (input type).
|
|
76
|
+
*/
|
|
77
|
+
export type ModifyListsForListRequest = z.input<typeof ModifyListsForListRequestSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* Request to modify list memberships by SQL-style query (input type).
|
|
80
|
+
*/
|
|
81
|
+
export type ModifyListsByQueryRequest = z.input<typeof ModifyListsByQueryRequestSchema>;
|
|
82
|
+
/**
|
|
83
|
+
* Request for query-based operations (delete, blocklist).
|
|
84
|
+
*/
|
|
85
|
+
export type QueryOperationRequest = z.input<typeof QueryOperationRequestSchema>;
|
|
86
|
+
/**
|
|
87
|
+
* Paginated list of subscribers response.
|
|
88
|
+
*/
|
|
89
|
+
export type ListSubscribersResponse = z.infer<typeof ListSubscribersResponseSchema>;
|
|
90
|
+
/**
|
|
91
|
+
* Response for bulk operations.
|
|
92
|
+
*/
|
|
93
|
+
export type BulkOperationResponse = z.infer<typeof BulkOperationResponseSchema>;
|
|
94
|
+
/**
|
|
95
|
+
* Subscriber profile in export.
|
|
96
|
+
*/
|
|
97
|
+
export type SubscriberProfile = z.infer<typeof SubscriberProfileSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* Subscription in export (private list names masked).
|
|
100
|
+
*/
|
|
101
|
+
export type ExportSubscription = z.infer<typeof ExportSubscriptionSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Campaign view in export.
|
|
104
|
+
*/
|
|
105
|
+
export type CampaignView = z.infer<typeof CampaignViewSchema>;
|
|
106
|
+
/**
|
|
107
|
+
* Link click in export.
|
|
108
|
+
*/
|
|
109
|
+
export type LinkClick = z.infer<typeof LinkClickSchema>;
|
|
110
|
+
/**
|
|
111
|
+
* Complete subscriber export response.
|
|
112
|
+
*/
|
|
113
|
+
export type SubscriberExportResponse = z.infer<typeof SubscriberExportResponseSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Templates resource module.
|
|
3
|
+
*
|
|
4
|
+
* Provides complete template management for the listmonk API.
|
|
5
|
+
*
|
|
6
|
+
* @module resources/templates
|
|
7
|
+
*/
|
|
8
|
+
export { TemplatesResource } from "./templates";
|
|
9
|
+
export type { Template, TemplateType, TemplatePreview, CreateTemplateRequest, UpdateTemplateRequest, ListTemplatesOptions, LivePreviewRequest, ListTemplatesResponse, } from "./types";
|
|
10
|
+
export { TemplateTypeSchema, TemplateSchema, TemplatePreviewSchema, CreateTemplateRequestSchema, UpdateTemplateRequestSchema, ListTemplatesOptionsSchema, LivePreviewRequestSchema, ListTemplatesResponseSchema, } from "./schemas";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for template-related requests and responses.
|
|
3
|
+
*
|
|
4
|
+
* @module resources/templates/schemas
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
/**
|
|
8
|
+
* Template type.
|
|
9
|
+
* - `campaign`: Standard campaign email templates
|
|
10
|
+
* - `campaign_visual`: Visual drag-and-drop editor templates
|
|
11
|
+
* - `tx`: Transactional email templates
|
|
12
|
+
*/
|
|
13
|
+
export declare const TemplateTypeSchema: z.ZodEnum<{
|
|
14
|
+
campaign: "campaign";
|
|
15
|
+
campaign_visual: "campaign_visual";
|
|
16
|
+
tx: "tx";
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Complete template entity returned from API.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TemplateSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodNumber;
|
|
23
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
body: z.ZodString;
|
|
26
|
+
body_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
campaign: "campaign";
|
|
29
|
+
campaign_visual: "campaign_visual";
|
|
30
|
+
tx: "tx";
|
|
31
|
+
}>;
|
|
32
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
is_default: z.ZodBoolean;
|
|
34
|
+
created_at: z.ZodString;
|
|
35
|
+
updated_at: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
/**
|
|
38
|
+
* Template preview response.
|
|
39
|
+
*/
|
|
40
|
+
export declare const TemplatePreviewSchema: z.ZodObject<{
|
|
41
|
+
body: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
/**
|
|
44
|
+
* Request to create a new template.
|
|
45
|
+
*/
|
|
46
|
+
export declare const CreateTemplateRequestSchema: z.ZodObject<{
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
body: z.ZodString;
|
|
49
|
+
type: z.ZodEnum<{
|
|
50
|
+
campaign: "campaign";
|
|
51
|
+
campaign_visual: "campaign_visual";
|
|
52
|
+
tx: "tx";
|
|
53
|
+
}>;
|
|
54
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
55
|
+
body_source: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
/**
|
|
58
|
+
* Request to update an existing template.
|
|
59
|
+
* All fields are optional for partial updates.
|
|
60
|
+
*/
|
|
61
|
+
export declare const UpdateTemplateRequestSchema: z.ZodObject<{
|
|
62
|
+
name: z.ZodOptional<z.ZodString>;
|
|
63
|
+
body: z.ZodOptional<z.ZodString>;
|
|
64
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
campaign: "campaign";
|
|
66
|
+
campaign_visual: "campaign_visual";
|
|
67
|
+
tx: "tx";
|
|
68
|
+
}>>;
|
|
69
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
70
|
+
body_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
/**
|
|
73
|
+
* Options for listing templates.
|
|
74
|
+
*/
|
|
75
|
+
export declare const ListTemplatesOptionsSchema: z.ZodObject<{
|
|
76
|
+
no_body: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
/**
|
|
79
|
+
* Request for live template preview (POST /api/templates/preview).
|
|
80
|
+
*/
|
|
81
|
+
export declare const LivePreviewRequestSchema: z.ZodObject<{
|
|
82
|
+
template_type: z.ZodEnum<{
|
|
83
|
+
campaign: "campaign";
|
|
84
|
+
campaign_visual: "campaign_visual";
|
|
85
|
+
tx: "tx";
|
|
86
|
+
}>;
|
|
87
|
+
body: z.ZodString;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Response for listing all templates.
|
|
91
|
+
* Note: Unlike paginated endpoints, templates returns a simple array wrapped in { data: [] }.
|
|
92
|
+
*/
|
|
93
|
+
export declare const ListTemplatesResponseSchema: z.ZodObject<{
|
|
94
|
+
data: z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodNumber;
|
|
96
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
body: z.ZodString;
|
|
99
|
+
body_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
type: z.ZodEnum<{
|
|
101
|
+
campaign: "campaign";
|
|
102
|
+
campaign_visual: "campaign_visual";
|
|
103
|
+
tx: "tx";
|
|
104
|
+
}>;
|
|
105
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
is_default: z.ZodBoolean;
|
|
107
|
+
created_at: z.ZodString;
|
|
108
|
+
updated_at: z.ZodString;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
}, z.core.$strip>;
|