@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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +542 -0
  3. package/dist/chunk-saezhne8.js +14 -0
  4. package/dist/chunk-saezhne8.js.map +9 -0
  5. package/dist/client.d.ts +430 -0
  6. package/dist/errors/api.d.ts +178 -0
  7. package/dist/errors/base.d.ts +47 -0
  8. package/dist/errors/configuration.d.ts +49 -0
  9. package/dist/errors/index.d.ts +13 -0
  10. package/dist/errors/network.d.ts +69 -0
  11. package/dist/errors/validation.d.ts +57 -0
  12. package/dist/http/auth.d.ts +39 -0
  13. package/dist/http/client.d.ts +149 -0
  14. package/dist/http/hooks.d.ts +90 -0
  15. package/dist/http/index.d.ts +10 -0
  16. package/dist/http/resource.d.ts +100 -0
  17. package/dist/http/sse.d.ts +36 -0
  18. package/dist/http/url.d.ts +51 -0
  19. package/dist/index.d.ts +64 -0
  20. package/dist/index.js +16039 -0
  21. package/dist/index.js.map +120 -0
  22. package/dist/resources/admin/admin.d.ts +92 -0
  23. package/dist/resources/admin/index.d.ts +10 -0
  24. package/dist/resources/admin/schemas.d.ts +23 -0
  25. package/dist/resources/admin/types.d.ts +29 -0
  26. package/dist/resources/bounces/bounces.d.ts +262 -0
  27. package/dist/resources/bounces/index.d.ts +10 -0
  28. package/dist/resources/bounces/schemas.d.ts +86 -0
  29. package/dist/resources/bounces/types.d.ts +37 -0
  30. package/dist/resources/campaigns/campaigns.d.ts +339 -0
  31. package/dist/resources/campaigns/index.d.ts +10 -0
  32. package/dist/resources/campaigns/schemas.d.ts +374 -0
  33. package/dist/resources/campaigns/types.d.ts +111 -0
  34. package/dist/resources/dashboard/dashboard.d.ts +73 -0
  35. package/dist/resources/dashboard/index.d.ts +10 -0
  36. package/dist/resources/dashboard/schemas.d.ts +55 -0
  37. package/dist/resources/dashboard/types.d.ts +22 -0
  38. package/dist/resources/import/import.d.ts +215 -0
  39. package/dist/resources/import/index.d.ts +10 -0
  40. package/dist/resources/import/schemas.d.ts +109 -0
  41. package/dist/resources/import/types.d.ts +72 -0
  42. package/dist/resources/lists/index.d.ts +10 -0
  43. package/dist/resources/lists/lists.d.ts +180 -0
  44. package/dist/resources/lists/schemas.d.ts +176 -0
  45. package/dist/resources/lists/types.d.ts +56 -0
  46. package/dist/resources/maintenance/index.d.ts +10 -0
  47. package/dist/resources/maintenance/maintenance.d.ts +92 -0
  48. package/dist/resources/maintenance/schemas.d.ts +36 -0
  49. package/dist/resources/maintenance/types.d.ts +31 -0
  50. package/dist/resources/media/index.d.ts +10 -0
  51. package/dist/resources/media/media.d.ts +198 -0
  52. package/dist/resources/media/schemas.d.ts +48 -0
  53. package/dist/resources/media/types.d.ts +48 -0
  54. package/dist/resources/public/index.d.ts +10 -0
  55. package/dist/resources/public/public.d.ts +111 -0
  56. package/dist/resources/public/schemas.d.ts +52 -0
  57. package/dist/resources/public/types.d.ts +30 -0
  58. package/dist/resources/settings/index.d.ts +10 -0
  59. package/dist/resources/settings/schemas.d.ts +374 -0
  60. package/dist/resources/settings/settings.d.ts +106 -0
  61. package/dist/resources/settings/types.d.ts +78 -0
  62. package/dist/resources/subscribers/index.d.ts +10 -0
  63. package/dist/resources/subscribers/schemas.d.ts +360 -0
  64. package/dist/resources/subscribers/subscribers.d.ts +308 -0
  65. package/dist/resources/subscribers/types.d.ts +113 -0
  66. package/dist/resources/templates/index.d.ts +10 -0
  67. package/dist/resources/templates/schemas.d.ts +110 -0
  68. package/dist/resources/templates/templates.d.ts +225 -0
  69. package/dist/resources/templates/types.d.ts +45 -0
  70. package/dist/resources/tx/index.d.ts +10 -0
  71. package/dist/resources/tx/schemas.d.ts +67 -0
  72. package/dist/resources/tx/tx.d.ts +167 -0
  73. package/dist/resources/tx/types.d.ts +88 -0
  74. package/dist/schemas/common.d.ts +48 -0
  75. package/dist/schemas/index.d.ts +6 -0
  76. package/dist/testing/errors.d.ts +25 -0
  77. package/dist/testing/factories/bounce.d.ts +43 -0
  78. package/dist/testing/factories/campaign.d.ts +43 -0
  79. package/dist/testing/factories/common.d.ts +54 -0
  80. package/dist/testing/factories/index.d.ts +12 -0
  81. package/dist/testing/factories/list.d.ts +43 -0
  82. package/dist/testing/factories/media.d.ts +40 -0
  83. package/dist/testing/factories/subscriber.d.ts +43 -0
  84. package/dist/testing/factories/template.d.ts +40 -0
  85. package/dist/testing/index.d.ts +39 -0
  86. package/dist/testing/index.js +573 -0
  87. package/dist/testing/index.js.map +32 -0
  88. package/dist/testing/mock-client.d.ts +119 -0
  89. package/dist/testing/mock-function.d.ts +28 -0
  90. package/dist/testing/resources/admin.d.ts +20 -0
  91. package/dist/testing/resources/bounces.d.ts +22 -0
  92. package/dist/testing/resources/campaigns.d.ts +31 -0
  93. package/dist/testing/resources/dashboard.d.ts +17 -0
  94. package/dist/testing/resources/import.d.ts +19 -0
  95. package/dist/testing/resources/index.d.ts +18 -0
  96. package/dist/testing/resources/lists.d.ts +24 -0
  97. package/dist/testing/resources/maintenance.d.ts +18 -0
  98. package/dist/testing/resources/media.d.ts +21 -0
  99. package/dist/testing/resources/public.d.ts +18 -0
  100. package/dist/testing/resources/settings.d.ts +19 -0
  101. package/dist/testing/resources/subscribers.d.ts +33 -0
  102. package/dist/testing/resources/templates.d.ts +24 -0
  103. package/dist/testing/resources/tx.d.ts +16 -0
  104. package/dist/testing/types.d.ts +138 -0
  105. package/dist/types/config.d.ts +59 -0
  106. package/dist/types/index.d.ts +7 -0
  107. package/dist/types/pagination.d.ts +37 -0
  108. package/package.json +97 -0
@@ -0,0 +1,374 @@
1
+ /**
2
+ * Zod schemas for campaign-related requests and responses.
3
+ *
4
+ * @module resources/campaigns/schemas
5
+ */
6
+ import { z } from "zod";
7
+ /**
8
+ * Campaign lifecycle status.
9
+ * - `draft`: Initial state, fully editable
10
+ * - `scheduled`: Queued for future sending
11
+ * - `running`: Currently sending
12
+ * - `paused`: Sending suspended
13
+ * - `cancelled`: Permanently stopped
14
+ * - `finished`: All messages sent (automatic, read-only)
15
+ */
16
+ export declare const CampaignStatusSchema: z.ZodEnum<{
17
+ draft: "draft";
18
+ scheduled: "scheduled";
19
+ running: "running";
20
+ paused: "paused";
21
+ cancelled: "cancelled";
22
+ finished: "finished";
23
+ }>;
24
+ /**
25
+ * API-settable campaign statuses (excludes 'finished' which is automatic).
26
+ */
27
+ export declare const SettableCampaignStatusSchema: z.ZodEnum<{
28
+ draft: "draft";
29
+ scheduled: "scheduled";
30
+ running: "running";
31
+ paused: "paused";
32
+ cancelled: "cancelled";
33
+ }>;
34
+ /**
35
+ * Campaign type.
36
+ * - `regular`: Standard broadcast campaign
37
+ * - `optin`: Opt-in confirmation campaign
38
+ */
39
+ export declare const CampaignTypeSchema: z.ZodEnum<{
40
+ optin: "optin";
41
+ regular: "regular";
42
+ }>;
43
+ /**
44
+ * Content format type for campaigns.
45
+ * - `richtext`: WYSIWYG editor content
46
+ * - `html`: Raw HTML
47
+ * - `markdown`: Markdown syntax
48
+ * - `plain`: Plain text only
49
+ * - `visual`: Drag-and-drop visual builder (v5.0.0+)
50
+ */
51
+ export declare const CampaignContentTypeSchema: z.ZodEnum<{
52
+ richtext: "richtext";
53
+ html: "html";
54
+ markdown: "markdown";
55
+ plain: "plain";
56
+ visual: "visual";
57
+ }>;
58
+ /**
59
+ * Analytics data types.
60
+ * - `views`: Email open counts
61
+ * - `clicks`: Link click counts
62
+ * - `links`: Per-URL click breakdown
63
+ * - `bounces`: Bounce counts
64
+ */
65
+ export declare const AnalyticsTypeSchema: z.ZodEnum<{
66
+ views: "views";
67
+ clicks: "clicks";
68
+ links: "links";
69
+ bounces: "bounces";
70
+ }>;
71
+ /**
72
+ * Custom email header.
73
+ */
74
+ export declare const HeaderSchema: z.ZodObject<{
75
+ key: z.ZodString;
76
+ value: z.ZodString;
77
+ }, z.core.$strip>;
78
+ /**
79
+ * Embedded list reference within a campaign.
80
+ */
81
+ export declare const CampaignListSchema: z.ZodObject<{
82
+ id: z.ZodNumber;
83
+ name: z.ZodString;
84
+ }, z.core.$strip>;
85
+ /**
86
+ * Complete campaign entity returned from API.
87
+ */
88
+ export declare const CampaignSchema: z.ZodObject<{
89
+ id: z.ZodNumber;
90
+ uuid: z.ZodString;
91
+ name: z.ZodString;
92
+ subject: z.ZodString;
93
+ from_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ body: z.ZodString;
95
+ body_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ altbody: z.ZodOptional<z.ZodNullable<z.ZodString>>;
97
+ content_type: z.ZodEnum<{
98
+ richtext: "richtext";
99
+ html: "html";
100
+ markdown: "markdown";
101
+ plain: "plain";
102
+ visual: "visual";
103
+ }>;
104
+ type: z.ZodEnum<{
105
+ optin: "optin";
106
+ regular: "regular";
107
+ }>;
108
+ status: z.ZodEnum<{
109
+ draft: "draft";
110
+ scheduled: "scheduled";
111
+ running: "running";
112
+ paused: "paused";
113
+ cancelled: "cancelled";
114
+ finished: "finished";
115
+ }>;
116
+ send_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ lists: z.ZodArray<z.ZodObject<{
119
+ id: z.ZodNumber;
120
+ name: z.ZodString;
121
+ }, z.core.$strip>>;
122
+ tags: z.ZodArray<z.ZodString>;
123
+ template_id: z.ZodNumber;
124
+ messenger: z.ZodString;
125
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
+ key: z.ZodString;
127
+ value: z.ZodString;
128
+ }, z.core.$strip>>>;
129
+ views: z.ZodNumber;
130
+ clicks: z.ZodNumber;
131
+ bounces: z.ZodOptional<z.ZodNumber>;
132
+ to_send: z.ZodNumber;
133
+ sent: z.ZodNumber;
134
+ archive: z.ZodOptional<z.ZodBoolean>;
135
+ archive_slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ archive_template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
137
+ archive_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
138
+ created_at: z.ZodString;
139
+ updated_at: z.ZodString;
140
+ }, z.core.$strip>;
141
+ /**
142
+ * Running campaign statistics.
143
+ */
144
+ export declare const CampaignStatsSchema: z.ZodObject<{
145
+ id: z.ZodNumber;
146
+ name: z.ZodString;
147
+ status: z.ZodEnum<{
148
+ draft: "draft";
149
+ scheduled: "scheduled";
150
+ running: "running";
151
+ paused: "paused";
152
+ cancelled: "cancelled";
153
+ finished: "finished";
154
+ }>;
155
+ sent: z.ZodNumber;
156
+ to_send: z.ZodNumber;
157
+ rate: z.ZodOptional<z.ZodNumber>;
158
+ net_rate: z.ZodOptional<z.ZodNumber>;
159
+ }, z.core.$strip>;
160
+ /**
161
+ * Time-series analytics data point.
162
+ */
163
+ export declare const AnalyticsDataSchema: z.ZodObject<{
164
+ timestamp: z.ZodString;
165
+ count: z.ZodNumber;
166
+ }, z.core.$strip>;
167
+ /**
168
+ * Per-URL click analytics.
169
+ */
170
+ export declare const LinkAnalyticsSchema: z.ZodObject<{
171
+ url: z.ZodString;
172
+ count: z.ZodNumber;
173
+ }, z.core.$strip>;
174
+ /**
175
+ * Request to create a new campaign.
176
+ */
177
+ export declare const CreateCampaignRequestSchema: z.ZodObject<{
178
+ name: z.ZodString;
179
+ subject: z.ZodString;
180
+ lists: z.ZodArray<z.ZodNumber>;
181
+ body: z.ZodString;
182
+ content_type: z.ZodEnum<{
183
+ richtext: "richtext";
184
+ html: "html";
185
+ markdown: "markdown";
186
+ plain: "plain";
187
+ visual: "visual";
188
+ }>;
189
+ type: z.ZodOptional<z.ZodEnum<{
190
+ optin: "optin";
191
+ regular: "regular";
192
+ }>>;
193
+ from_email: z.ZodOptional<z.ZodString>;
194
+ altbody: z.ZodOptional<z.ZodString>;
195
+ send_at: z.ZodOptional<z.ZodString>;
196
+ messenger: z.ZodOptional<z.ZodString>;
197
+ template_id: z.ZodOptional<z.ZodNumber>;
198
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
200
+ key: z.ZodString;
201
+ value: z.ZodString;
202
+ }, z.core.$strip>>>;
203
+ }, z.core.$strip>;
204
+ /**
205
+ * Request to update an existing campaign.
206
+ * All fields are optional for partial updates.
207
+ */
208
+ export declare const UpdateCampaignRequestSchema: z.ZodObject<{
209
+ name: z.ZodOptional<z.ZodString>;
210
+ subject: z.ZodOptional<z.ZodString>;
211
+ lists: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
212
+ body: z.ZodOptional<z.ZodString>;
213
+ content_type: z.ZodOptional<z.ZodEnum<{
214
+ richtext: "richtext";
215
+ html: "html";
216
+ markdown: "markdown";
217
+ plain: "plain";
218
+ visual: "visual";
219
+ }>>;
220
+ from_email: z.ZodOptional<z.ZodString>;
221
+ altbody: z.ZodOptional<z.ZodString>;
222
+ send_at: z.ZodOptional<z.ZodString>;
223
+ template_id: z.ZodOptional<z.ZodNumber>;
224
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
225
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
226
+ key: z.ZodString;
227
+ value: z.ZodString;
228
+ }, z.core.$strip>>>;
229
+ }, z.core.$strip>;
230
+ /**
231
+ * Options for listing and filtering campaigns.
232
+ */
233
+ export declare const ListCampaignsOptionsSchema: z.ZodObject<{
234
+ query: z.ZodOptional<z.ZodString>;
235
+ status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
236
+ draft: "draft";
237
+ scheduled: "scheduled";
238
+ running: "running";
239
+ paused: "paused";
240
+ cancelled: "cancelled";
241
+ finished: "finished";
242
+ }>>>;
243
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
+ order_by: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
245
+ name: "name";
246
+ created_at: "created_at";
247
+ updated_at: "updated_at";
248
+ status: "status";
249
+ }>>>;
250
+ order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
251
+ ASC: "ASC";
252
+ DESC: "DESC";
253
+ }>>>;
254
+ no_body: z.ZodOptional<z.ZodBoolean>;
255
+ page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
256
+ per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
257
+ }, z.core.$strip>;
258
+ /**
259
+ * Request to change campaign status.
260
+ */
261
+ export declare const UpdateStatusRequestSchema: z.ZodObject<{
262
+ status: z.ZodEnum<{
263
+ draft: "draft";
264
+ scheduled: "scheduled";
265
+ running: "running";
266
+ paused: "paused";
267
+ cancelled: "cancelled";
268
+ }>;
269
+ send_at: z.ZodOptional<z.ZodString>;
270
+ }, z.core.$strip>;
271
+ /**
272
+ * Request to send test campaign.
273
+ */
274
+ export declare const SendTestRequestSchema: z.ZodObject<{
275
+ subscribers: z.ZodArray<z.ZodString>;
276
+ }, z.core.$strip>;
277
+ /**
278
+ * Request to archive/unarchive campaign.
279
+ */
280
+ export declare const ArchiveRequestSchema: z.ZodObject<{
281
+ archive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
282
+ archive_slug: z.ZodOptional<z.ZodString>;
283
+ archive_template_id: z.ZodOptional<z.ZodNumber>;
284
+ archive_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
285
+ }, z.core.$strip>;
286
+ /**
287
+ * Options for retrieving analytics.
288
+ */
289
+ export declare const GetAnalyticsOptionsSchema: z.ZodObject<{
290
+ id: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
291
+ from: z.ZodOptional<z.ZodString>;
292
+ to: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strip>;
294
+ /**
295
+ * Options for preview generation.
296
+ */
297
+ export declare const PreviewOptionsSchema: z.ZodObject<{
298
+ subscriber_id: z.ZodOptional<z.ZodNumber>;
299
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
300
+ }, z.core.$strip>;
301
+ /**
302
+ * Paginated campaign list response.
303
+ */
304
+ export declare const ListCampaignsResponseSchema: z.ZodObject<{
305
+ results: z.ZodArray<z.ZodObject<{
306
+ id: z.ZodNumber;
307
+ uuid: z.ZodString;
308
+ name: z.ZodString;
309
+ subject: z.ZodString;
310
+ from_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ body: z.ZodString;
312
+ body_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
313
+ altbody: z.ZodOptional<z.ZodNullable<z.ZodString>>;
314
+ content_type: z.ZodEnum<{
315
+ richtext: "richtext";
316
+ html: "html";
317
+ markdown: "markdown";
318
+ plain: "plain";
319
+ visual: "visual";
320
+ }>;
321
+ type: z.ZodEnum<{
322
+ optin: "optin";
323
+ regular: "regular";
324
+ }>;
325
+ status: z.ZodEnum<{
326
+ draft: "draft";
327
+ scheduled: "scheduled";
328
+ running: "running";
329
+ paused: "paused";
330
+ cancelled: "cancelled";
331
+ finished: "finished";
332
+ }>;
333
+ send_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ lists: z.ZodArray<z.ZodObject<{
336
+ id: z.ZodNumber;
337
+ name: z.ZodString;
338
+ }, z.core.$strip>>;
339
+ tags: z.ZodArray<z.ZodString>;
340
+ template_id: z.ZodNumber;
341
+ messenger: z.ZodString;
342
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
343
+ key: z.ZodString;
344
+ value: z.ZodString;
345
+ }, z.core.$strip>>>;
346
+ views: z.ZodNumber;
347
+ clicks: z.ZodNumber;
348
+ bounces: z.ZodOptional<z.ZodNumber>;
349
+ to_send: z.ZodNumber;
350
+ sent: z.ZodNumber;
351
+ archive: z.ZodOptional<z.ZodBoolean>;
352
+ archive_slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
+ archive_template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
354
+ archive_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
355
+ created_at: z.ZodString;
356
+ updated_at: z.ZodString;
357
+ }, z.core.$strip>>;
358
+ total: z.ZodNumber;
359
+ per_page: z.ZodNumber;
360
+ page: z.ZodNumber;
361
+ }, z.core.$strip>;
362
+ /**
363
+ * Preview response.
364
+ */
365
+ export declare const PreviewResponseSchema: z.ZodObject<{
366
+ body: z.ZodString;
367
+ }, z.core.$strip>;
368
+ export { BulkDeleteIdsSchema } from "../../schemas";
369
+ /**
370
+ * Request to delete campaigns by SQL-style query.
371
+ */
372
+ export declare const BulkDeleteByQueryRequestSchema: z.ZodObject<{
373
+ query: z.ZodString;
374
+ }, z.core.$strip>;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * TypeScript types for campaigns module.
3
+ *
4
+ * All types are inferred from Zod schemas to ensure runtime
5
+ * validation matches compile-time types.
6
+ *
7
+ * @module resources/campaigns/types
8
+ */
9
+ import type { z } from "zod";
10
+ import type { CampaignStatusSchema, CampaignTypeSchema, CampaignContentTypeSchema, AnalyticsTypeSchema, HeaderSchema, CampaignListSchema, CampaignSchema, CampaignStatsSchema, AnalyticsDataSchema, LinkAnalyticsSchema, CreateCampaignRequestSchema, UpdateCampaignRequestSchema, ListCampaignsOptionsSchema, ListCampaignsResponseSchema, UpdateStatusRequestSchema, SendTestRequestSchema, ArchiveRequestSchema, GetAnalyticsOptionsSchema, PreviewResponseSchema, PreviewOptionsSchema, BulkDeleteByQueryRequestSchema } from "./schemas";
11
+ /**
12
+ * Campaign lifecycle status.
13
+ * - `draft`: Initial state, fully editable
14
+ * - `scheduled`: Queued for future sending
15
+ * - `running`: Currently sending
16
+ * - `paused`: Sending suspended
17
+ * - `cancelled`: Permanently stopped
18
+ * - `finished`: All messages sent (automatic, read-only)
19
+ */
20
+ export type CampaignStatus = z.infer<typeof CampaignStatusSchema>;
21
+ /**
22
+ * Campaign type.
23
+ * - `regular`: Standard broadcast campaign
24
+ * - `optin`: Opt-in confirmation campaign
25
+ */
26
+ export type CampaignType = z.infer<typeof CampaignTypeSchema>;
27
+ /**
28
+ * Content format type for campaigns.
29
+ * - `richtext`: WYSIWYG editor content
30
+ * - `html`: Raw HTML
31
+ * - `markdown`: Markdown syntax
32
+ * - `plain`: Plain text only
33
+ * - `visual`: Drag-and-drop visual builder (v5.0.0+)
34
+ */
35
+ export type CampaignContentType = z.infer<typeof CampaignContentTypeSchema>;
36
+ /**
37
+ * Analytics data types.
38
+ * - `views`: Email open counts
39
+ * - `clicks`: Link click counts
40
+ * - `links`: Per-URL click breakdown
41
+ * - `bounces`: Bounce counts
42
+ */
43
+ export type AnalyticsType = z.infer<typeof AnalyticsTypeSchema>;
44
+ /**
45
+ * Custom email header.
46
+ */
47
+ export type Header = z.infer<typeof HeaderSchema>;
48
+ /**
49
+ * Embedded list reference within a campaign.
50
+ */
51
+ export type CampaignList = z.infer<typeof CampaignListSchema>;
52
+ /**
53
+ * Complete campaign entity.
54
+ */
55
+ export type Campaign = z.infer<typeof CampaignSchema>;
56
+ /**
57
+ * Running campaign statistics.
58
+ */
59
+ export type CampaignStats = z.infer<typeof CampaignStatsSchema>;
60
+ /**
61
+ * Time-series analytics data point.
62
+ */
63
+ export type AnalyticsData = z.infer<typeof AnalyticsDataSchema>;
64
+ /**
65
+ * Per-URL click analytics.
66
+ */
67
+ export type LinkAnalytics = z.infer<typeof LinkAnalyticsSchema>;
68
+ /**
69
+ * Request to create a new campaign (input type).
70
+ */
71
+ export type CreateCampaignRequest = z.input<typeof CreateCampaignRequestSchema>;
72
+ /**
73
+ * Request to update an existing campaign (input type).
74
+ */
75
+ export type UpdateCampaignRequest = z.input<typeof UpdateCampaignRequestSchema>;
76
+ /**
77
+ * Options for listing campaigns (input type).
78
+ */
79
+ export type ListCampaignsOptions = z.input<typeof ListCampaignsOptionsSchema>;
80
+ /**
81
+ * Request to change campaign status (input type).
82
+ */
83
+ export type UpdateStatusRequest = z.input<typeof UpdateStatusRequestSchema>;
84
+ /**
85
+ * Request to send test campaign (input type).
86
+ */
87
+ export type SendTestRequest = z.input<typeof SendTestRequestSchema>;
88
+ /**
89
+ * Request to archive/unarchive campaign (input type).
90
+ */
91
+ export type ArchiveRequest = z.input<typeof ArchiveRequestSchema>;
92
+ /**
93
+ * Options for retrieving analytics (input type).
94
+ */
95
+ export type GetAnalyticsOptions = z.input<typeof GetAnalyticsOptionsSchema>;
96
+ /**
97
+ * Options for preview generation (input type).
98
+ */
99
+ export type PreviewOptions = z.input<typeof PreviewOptionsSchema>;
100
+ /**
101
+ * Paginated campaign list response.
102
+ */
103
+ export type ListCampaignsResponse = z.infer<typeof ListCampaignsResponseSchema>;
104
+ /**
105
+ * Preview response.
106
+ */
107
+ export type PreviewResponse = z.infer<typeof PreviewResponseSchema>;
108
+ /**
109
+ * Request to delete campaigns by SQL-style query.
110
+ */
111
+ export type BulkDeleteByQueryRequest = z.input<typeof BulkDeleteByQueryRequestSchema>;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Dashboard resource for retrieving statistics.
3
+ *
4
+ * @module resources/dashboard
5
+ */
6
+ import { APIResource } from "../../http/resource";
7
+ import type { DashboardCounts, DashboardCharts } from "./types";
8
+ /**
9
+ * Resource for retrieving dashboard statistics from listmonk.
10
+ *
11
+ * Provides methods for getting subscriber/campaign counts and
12
+ * time-series chart data for analytics.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const counts = await client.dashboard.getCounts();
17
+ * console.log(`Total subscribers: ${counts.subscribers.total}`);
18
+ * ```
19
+ */
20
+ export declare class DashboardResource extends APIResource {
21
+ /**
22
+ * Retrieves dashboard statistics.
23
+ *
24
+ * Returns counts for subscribers, lists, campaigns, and total messages.
25
+ * Data is retrieved from a materialized view for performance.
26
+ *
27
+ * @returns Dashboard statistics object
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const counts = await client.dashboard.getCounts();
32
+ *
33
+ * console.log('=== Subscribers ===');
34
+ * console.log(`Total: ${counts.subscribers.total}`);
35
+ * console.log(`Blocklisted: ${counts.subscribers.blocklisted}`);
36
+ * console.log(`Orphans: ${counts.subscribers.orphans}`);
37
+ *
38
+ * console.log('=== Lists ===');
39
+ * console.log(`Total: ${counts.lists.total}`);
40
+ * console.log(`Public: ${counts.lists.public}`);
41
+ *
42
+ * console.log('=== Campaigns ===');
43
+ * console.log(`Running: ${counts.campaigns.by_status.running}`);
44
+ * console.log(`Finished: ${counts.campaigns.by_status.finished}`);
45
+ *
46
+ * console.log(`Total messages sent: ${counts.messages}`);
47
+ * ```
48
+ */
49
+ getCounts(): Promise<DashboardCounts>;
50
+ /**
51
+ * Retrieves dashboard chart data.
52
+ *
53
+ * Returns 30-day time series data for link clicks and campaign views.
54
+ *
55
+ * @returns Dashboard chart data object
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const charts = await client.dashboard.getCharts();
60
+ *
61
+ * console.log('=== Link Clicks (last 30 days) ===');
62
+ * for (const point of charts.link_clicks) {
63
+ * console.log(`${point.date}: ${point.count} clicks`);
64
+ * }
65
+ *
66
+ * console.log('=== Campaign Views (last 30 days) ===');
67
+ * for (const point of charts.campaign_views) {
68
+ * console.log(`${point.date}: ${point.count} views`);
69
+ * }
70
+ * ```
71
+ */
72
+ getCharts(): Promise<DashboardCharts>;
73
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Dashboard resource module.
3
+ *
4
+ * Provides dashboard statistics access for the listmonk API.
5
+ *
6
+ * @module resources/dashboard
7
+ */
8
+ export { DashboardResource } from "./dashboard";
9
+ export type { DashboardCounts, DashboardCharts, ChartDataPoint } from "./types";
10
+ export { DashboardCountsSchema, DashboardChartsSchema, ChartDataPointSchema, } from "./schemas";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Zod schemas for dashboard-related requests and responses.
3
+ *
4
+ * @module resources/dashboard/schemas
5
+ */
6
+ import { z } from "zod";
7
+ /**
8
+ * Dashboard statistics from materialized view.
9
+ */
10
+ export declare const DashboardCountsSchema: z.ZodObject<{
11
+ subscribers: z.ZodObject<{
12
+ total: z.ZodNumber;
13
+ blocklisted: z.ZodNumber;
14
+ orphans: z.ZodNumber;
15
+ }, z.core.$strip>;
16
+ lists: z.ZodObject<{
17
+ total: z.ZodNumber;
18
+ private: z.ZodNumber;
19
+ public: z.ZodNumber;
20
+ optin_single: z.ZodNumber;
21
+ optin_double: z.ZodNumber;
22
+ }, z.core.$strip>;
23
+ campaigns: z.ZodObject<{
24
+ total: z.ZodNumber;
25
+ by_status: z.ZodObject<{
26
+ draft: z.ZodNumber;
27
+ running: z.ZodNumber;
28
+ scheduled: z.ZodNumber;
29
+ paused: z.ZodNumber;
30
+ cancelled: z.ZodNumber;
31
+ finished: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ }, z.core.$strip>;
34
+ messages: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ /**
37
+ * Single data point for chart time series.
38
+ */
39
+ export declare const ChartDataPointSchema: z.ZodObject<{
40
+ date: z.ZodString;
41
+ count: z.ZodNumber;
42
+ }, z.core.$strip>;
43
+ /**
44
+ * Dashboard chart data (30-day time series).
45
+ */
46
+ export declare const DashboardChartsSchema: z.ZodObject<{
47
+ link_clicks: z.ZodArray<z.ZodObject<{
48
+ date: z.ZodString;
49
+ count: z.ZodNumber;
50
+ }, z.core.$strip>>;
51
+ campaign_views: z.ZodArray<z.ZodObject<{
52
+ date: z.ZodString;
53
+ count: z.ZodNumber;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * TypeScript types for dashboard module.
3
+ *
4
+ * All types are inferred from Zod schemas to ensure runtime
5
+ * validation matches compile-time types.
6
+ *
7
+ * @module resources/dashboard/types
8
+ */
9
+ import type { z } from "zod";
10
+ import type { DashboardCountsSchema, DashboardChartsSchema, ChartDataPointSchema } from "./schemas";
11
+ /**
12
+ * Dashboard statistics from materialized view.
13
+ */
14
+ export type DashboardCounts = z.infer<typeof DashboardCountsSchema>;
15
+ /**
16
+ * Dashboard chart data (30-day time series).
17
+ */
18
+ export type DashboardCharts = z.infer<typeof DashboardChartsSchema>;
19
+ /**
20
+ * Single data point for chart time series.
21
+ */
22
+ export type ChartDataPoint = z.infer<typeof ChartDataPointSchema>;