@djangocfg/ext-newsletter 1.0.1 → 1.0.3

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.
@@ -0,0 +1,2090 @@
1
+ import { ConsolaInstance } from 'consola';
2
+ import * as _djangocfg_ext_base from '@djangocfg/ext-base';
3
+ import { z, ZodError } from 'zod';
4
+
5
+ /**
6
+ * Simple serializer for bulk email.
7
+ *
8
+ * Request model (no read-only fields).
9
+ */
10
+ interface BulkEmailRequest$1 {
11
+ recipients: Array<string>;
12
+ subject: string;
13
+ email_title: string;
14
+ main_text: string;
15
+ main_html_content?: string;
16
+ button_text?: string;
17
+ button_url?: string;
18
+ secondary_text?: string;
19
+ }
20
+ /**
21
+ * Response for bulk email sending.
22
+ *
23
+ * Response model (includes read-only fields).
24
+ */
25
+ interface BulkEmailResponse$2 {
26
+ success: boolean;
27
+ sent_count: number;
28
+ failed_count: number;
29
+ total_recipients: number;
30
+ error?: string;
31
+ }
32
+
33
+ declare namespace models$6 {
34
+ export type { BulkEmailRequest$1 as BulkEmailRequest, BulkEmailResponse$2 as BulkEmailResponse };
35
+ }
36
+
37
+ /**
38
+ * API endpoints for Bulk Email.
39
+ */
40
+ declare class ExtNewsletterBulkEmail {
41
+ private client;
42
+ constructor(client: any);
43
+ /**
44
+ * Send Bulk Email
45
+ *
46
+ * Send bulk emails to multiple recipients using base email template.
47
+ */
48
+ newsletterBulkCreate(data: BulkEmailRequest$1): Promise<BulkEmailResponse$2>;
49
+ }
50
+
51
+ /**
52
+ * * `pending` - Pending
53
+ * * `sent` - Sent
54
+ * * `failed` - Failed
55
+ */
56
+ declare enum EmailLogStatus {
57
+ PENDING = "pending",
58
+ SENT = "sent",
59
+ FAILED = "failed"
60
+ }
61
+ /**
62
+ * * `draft` - Draft
63
+ * * `sending` - Sending
64
+ * * `sent` - Sent
65
+ * * `failed` - Failed
66
+ */
67
+ declare enum NewsletterCampaignStatus {
68
+ DRAFT = "draft",
69
+ SENDING = "sending",
70
+ SENT = "sent",
71
+ FAILED = "failed"
72
+ }
73
+
74
+ type enums_EmailLogStatus = EmailLogStatus;
75
+ declare const enums_EmailLogStatus: typeof EmailLogStatus;
76
+ type enums_NewsletterCampaignStatus = NewsletterCampaignStatus;
77
+ declare const enums_NewsletterCampaignStatus: typeof NewsletterCampaignStatus;
78
+ declare namespace enums {
79
+ export { enums_EmailLogStatus as EmailLogStatus, enums_NewsletterCampaignStatus as NewsletterCampaignStatus };
80
+ }
81
+
82
+ /**
83
+ *
84
+ * Response model (includes read-only fields).
85
+ */
86
+ interface PaginatedNewsletterCampaignList$1 {
87
+ /** Total number of items across all pages */
88
+ count: number;
89
+ /** Current page number (1-based) */
90
+ page: number;
91
+ /** Total number of pages */
92
+ pages: number;
93
+ /** Number of items per page */
94
+ page_size: number;
95
+ /** Whether there is a next page */
96
+ has_next: boolean;
97
+ /** Whether there is a previous page */
98
+ has_previous: boolean;
99
+ /** Next page number (null if no next page) */
100
+ next_page?: number | null;
101
+ /** Previous page number (null if no previous page) */
102
+ previous_page?: number | null;
103
+ /** Array of items for current page */
104
+ results: Array<NewsletterCampaign$2>;
105
+ }
106
+ /**
107
+ * Serializer for NewsletterCampaign model.
108
+ *
109
+ * Request model (no read-only fields).
110
+ */
111
+ interface NewsletterCampaignRequest$1 {
112
+ newsletter: number;
113
+ subject: string;
114
+ email_title: string;
115
+ main_text: string;
116
+ main_html_content?: string;
117
+ button_text?: string;
118
+ button_url?: string;
119
+ secondary_text?: string;
120
+ }
121
+ /**
122
+ * Serializer for NewsletterCampaign model.
123
+ *
124
+ * Response model (includes read-only fields).
125
+ */
126
+ interface NewsletterCampaign$2 {
127
+ id: number;
128
+ newsletter: number;
129
+ newsletter_title: string;
130
+ subject: string;
131
+ email_title: string;
132
+ main_text: string;
133
+ main_html_content?: string;
134
+ button_text?: string;
135
+ button_url?: string;
136
+ secondary_text?: string;
137
+ /** * `draft` - Draft
138
+ * `sending` - Sending
139
+ * `sent` - Sent
140
+ * `failed` - Failed */
141
+ status: NewsletterCampaignStatus;
142
+ created_at: string;
143
+ sent_at?: string | null;
144
+ recipient_count: number;
145
+ }
146
+ /**
147
+ * Simple serializer for sending campaign.
148
+ *
149
+ * Request model (no read-only fields).
150
+ */
151
+ interface SendCampaignRequest$1 {
152
+ campaign_id: number;
153
+ }
154
+ /**
155
+ * Response for sending campaign.
156
+ *
157
+ * Response model (includes read-only fields).
158
+ */
159
+ interface SendCampaignResponse$1 {
160
+ success: boolean;
161
+ message?: string;
162
+ sent_count?: number;
163
+ error?: string;
164
+ }
165
+ /**
166
+ * Generic error response.
167
+ *
168
+ * Response model (includes read-only fields).
169
+ */
170
+ interface ErrorResponse$2 {
171
+ success?: boolean;
172
+ message: string;
173
+ }
174
+
175
+ declare namespace models$5 {
176
+ export type { ErrorResponse$2 as ErrorResponse, NewsletterCampaign$2 as NewsletterCampaign, NewsletterCampaignRequest$1 as NewsletterCampaignRequest, PaginatedNewsletterCampaignList$1 as PaginatedNewsletterCampaignList, SendCampaignRequest$1 as SendCampaignRequest, SendCampaignResponse$1 as SendCampaignResponse };
177
+ }
178
+
179
+ /**
180
+ * API endpoints for Campaigns.
181
+ */
182
+ declare class ExtNewsletterCampaigns {
183
+ private client;
184
+ constructor(client: any);
185
+ newsletterCampaignsList(page?: number, page_size?: number): Promise<PaginatedNewsletterCampaignList$1>;
186
+ newsletterCampaignsList(params?: {
187
+ page?: number;
188
+ page_size?: number;
189
+ }): Promise<PaginatedNewsletterCampaignList$1>;
190
+ /**
191
+ * Create Newsletter Campaign
192
+ *
193
+ * Create a new newsletter campaign.
194
+ */
195
+ newsletterCampaignsCreate(data: NewsletterCampaignRequest$1): Promise<NewsletterCampaign$2>;
196
+ /**
197
+ * Get Campaign Details
198
+ *
199
+ * Retrieve details of a specific newsletter campaign.
200
+ */
201
+ newsletterCampaignsRetrieve(id: number): Promise<NewsletterCampaign$2>;
202
+ /**
203
+ * Update Campaign
204
+ *
205
+ * Update a newsletter campaign.
206
+ */
207
+ newsletterCampaignsUpdate(id: number, data: NewsletterCampaignRequest$1): Promise<NewsletterCampaign$2>;
208
+ /**
209
+ * Delete Campaign
210
+ *
211
+ * Delete a newsletter campaign.
212
+ */
213
+ newsletterCampaignsDestroy(id: number): Promise<void>;
214
+ /**
215
+ * Send Newsletter Campaign
216
+ *
217
+ * Send a newsletter campaign to all subscribers.
218
+ */
219
+ newsletterCampaignsSendCreate(data: SendCampaignRequest$1): Promise<SendCampaignResponse$1>;
220
+ }
221
+
222
+ /**
223
+ *
224
+ * Response model (includes read-only fields).
225
+ */
226
+ interface PaginatedEmailLogList$1 {
227
+ /** Total number of items across all pages */
228
+ count: number;
229
+ /** Current page number (1-based) */
230
+ page: number;
231
+ /** Total number of pages */
232
+ pages: number;
233
+ /** Number of items per page */
234
+ page_size: number;
235
+ /** Whether there is a next page */
236
+ has_next: boolean;
237
+ /** Whether there is a previous page */
238
+ has_previous: boolean;
239
+ /** Next page number (null if no next page) */
240
+ next_page?: number | null;
241
+ /** Previous page number (null if no previous page) */
242
+ previous_page?: number | null;
243
+ /** Array of items for current page */
244
+ results: Array<EmailLog$1>;
245
+ }
246
+ /**
247
+ * Serializer for EmailLog model.
248
+ *
249
+ * Response model (includes read-only fields).
250
+ */
251
+ interface EmailLog$1 {
252
+ id: string;
253
+ user?: number | null;
254
+ user_email: string;
255
+ newsletter?: number | null;
256
+ newsletter_title: string;
257
+ /** Comma-separated email addresses */
258
+ recipient: string;
259
+ subject: string;
260
+ body: string;
261
+ /** * `pending` - Pending
262
+ * `sent` - Sent
263
+ * `failed` - Failed */
264
+ status: EmailLogStatus;
265
+ created_at: string;
266
+ sent_at?: string | null;
267
+ error_message?: string | null;
268
+ }
269
+
270
+ declare namespace models$4 {
271
+ export type { EmailLog$1 as EmailLog, PaginatedEmailLogList$1 as PaginatedEmailLogList };
272
+ }
273
+
274
+ /**
275
+ * API endpoints for Logs.
276
+ */
277
+ declare class ExtNewsletterLogs {
278
+ private client;
279
+ constructor(client: any);
280
+ newsletterLogsList(page?: number, page_size?: number): Promise<PaginatedEmailLogList$1>;
281
+ newsletterLogsList(params?: {
282
+ page?: number;
283
+ page_size?: number;
284
+ }): Promise<PaginatedEmailLogList$1>;
285
+ }
286
+
287
+ /**
288
+ *
289
+ * Response model (includes read-only fields).
290
+ */
291
+ interface PaginatedNewsletterList$1 {
292
+ /** Total number of items across all pages */
293
+ count: number;
294
+ /** Current page number (1-based) */
295
+ page: number;
296
+ /** Total number of pages */
297
+ pages: number;
298
+ /** Number of items per page */
299
+ page_size: number;
300
+ /** Whether there is a next page */
301
+ has_next: boolean;
302
+ /** Whether there is a previous page */
303
+ has_previous: boolean;
304
+ /** Next page number (null if no next page) */
305
+ next_page?: number | null;
306
+ /** Previous page number (null if no previous page) */
307
+ previous_page?: number | null;
308
+ /** Array of items for current page */
309
+ results: Array<Newsletter$1>;
310
+ }
311
+ /**
312
+ * Serializer for Newsletter model.
313
+ *
314
+ * Response model (includes read-only fields).
315
+ */
316
+ interface Newsletter$1 {
317
+ id: number;
318
+ title: string;
319
+ description?: string;
320
+ is_active?: boolean;
321
+ /** Automatically subscribe new users to this newsletter */
322
+ auto_subscribe?: boolean;
323
+ created_at: string;
324
+ updated_at: string;
325
+ subscribers_count: number;
326
+ }
327
+
328
+ declare namespace models$3 {
329
+ export type { Newsletter$1 as Newsletter, PaginatedNewsletterList$1 as PaginatedNewsletterList };
330
+ }
331
+
332
+ /**
333
+ * API endpoints for Newsletters.
334
+ */
335
+ declare class ExtNewsletterNewsletters {
336
+ private client;
337
+ constructor(client: any);
338
+ newsletterNewslettersList(page?: number, page_size?: number): Promise<PaginatedNewsletterList$1>;
339
+ newsletterNewslettersList(params?: {
340
+ page?: number;
341
+ page_size?: number;
342
+ }): Promise<PaginatedNewsletterList$1>;
343
+ /**
344
+ * Get Newsletter Details
345
+ *
346
+ * Retrieve details of a specific newsletter.
347
+ */
348
+ newsletterNewslettersRetrieve(id: number): Promise<Newsletter$1>;
349
+ }
350
+
351
+ /**
352
+ * Simple serializer for newsletter subscription.
353
+ *
354
+ * Request model (no read-only fields).
355
+ */
356
+ interface SubscribeRequest$1 {
357
+ newsletter_id: number;
358
+ email: string;
359
+ }
360
+ /**
361
+ * Response for subscription.
362
+ *
363
+ * Response model (includes read-only fields).
364
+ */
365
+ interface SubscribeResponse$1 {
366
+ success: boolean;
367
+ message: string;
368
+ subscription_id?: number;
369
+ }
370
+ /**
371
+ * Generic error response.
372
+ *
373
+ * Response model (includes read-only fields).
374
+ */
375
+ interface ErrorResponse$1 {
376
+ success?: boolean;
377
+ message: string;
378
+ }
379
+ /**
380
+ *
381
+ * Response model (includes read-only fields).
382
+ */
383
+ interface PaginatedNewsletterSubscriptionList$1 {
384
+ /** Total number of items across all pages */
385
+ count: number;
386
+ /** Current page number (1-based) */
387
+ page: number;
388
+ /** Total number of pages */
389
+ pages: number;
390
+ /** Number of items per page */
391
+ page_size: number;
392
+ /** Whether there is a next page */
393
+ has_next: boolean;
394
+ /** Whether there is a previous page */
395
+ has_previous: boolean;
396
+ /** Next page number (null if no next page) */
397
+ next_page?: number | null;
398
+ /** Previous page number (null if no previous page) */
399
+ previous_page?: number | null;
400
+ /** Array of items for current page */
401
+ results: Array<NewsletterSubscription$1>;
402
+ }
403
+ /**
404
+ * Simple serializer for unsubscribe.
405
+ *
406
+ * Request model (no read-only fields).
407
+ */
408
+ interface UnsubscribeRequest$2 {
409
+ subscription_id: number;
410
+ }
411
+ /**
412
+ * Generic success response.
413
+ *
414
+ * Response model (includes read-only fields).
415
+ */
416
+ interface SuccessResponse$1 {
417
+ success: boolean;
418
+ message: string;
419
+ }
420
+ /**
421
+ * Serializer for NewsletterSubscription model.
422
+ *
423
+ * Response model (includes read-only fields).
424
+ */
425
+ interface NewsletterSubscription$1 {
426
+ id: number;
427
+ newsletter: number;
428
+ newsletter_title: string;
429
+ user?: number | null;
430
+ user_email: string;
431
+ email: string;
432
+ is_active?: boolean;
433
+ subscribed_at: string;
434
+ unsubscribed_at?: string | null;
435
+ }
436
+
437
+ declare namespace models$2 {
438
+ export type { ErrorResponse$1 as ErrorResponse, NewsletterSubscription$1 as NewsletterSubscription, PaginatedNewsletterSubscriptionList$1 as PaginatedNewsletterSubscriptionList, SubscribeRequest$1 as SubscribeRequest, SubscribeResponse$1 as SubscribeResponse, SuccessResponse$1 as SuccessResponse, UnsubscribeRequest$2 as UnsubscribeRequest };
439
+ }
440
+
441
+ /**
442
+ * API endpoints for Subscriptions.
443
+ */
444
+ declare class ExtNewsletterSubscriptions {
445
+ private client;
446
+ constructor(client: any);
447
+ /**
448
+ * Subscribe to Newsletter
449
+ *
450
+ * Subscribe an email address to a newsletter.
451
+ */
452
+ newsletterSubscribeCreate(data: SubscribeRequest$1): Promise<SubscribeResponse$1>;
453
+ newsletterSubscriptionsList(page?: number, page_size?: number): Promise<PaginatedNewsletterSubscriptionList$1>;
454
+ newsletterSubscriptionsList(params?: {
455
+ page?: number;
456
+ page_size?: number;
457
+ }): Promise<PaginatedNewsletterSubscriptionList$1>;
458
+ /**
459
+ * Unsubscribe from Newsletter
460
+ *
461
+ * Unsubscribe from a newsletter using subscription ID.
462
+ */
463
+ newsletterUnsubscribeCreate(data: UnsubscribeRequest$2): Promise<SuccessResponse$1>;
464
+ }
465
+
466
+ /**
467
+ * Simple serializer for test email.
468
+ *
469
+ * Request model (no read-only fields).
470
+ */
471
+ interface TestEmailRequest$1 {
472
+ email: string;
473
+ subject?: string;
474
+ message?: string;
475
+ }
476
+ /**
477
+ * Response for bulk email sending.
478
+ *
479
+ * Response model (includes read-only fields).
480
+ */
481
+ interface BulkEmailResponse$1 {
482
+ success: boolean;
483
+ sent_count: number;
484
+ failed_count: number;
485
+ total_recipients: number;
486
+ error?: string;
487
+ }
488
+
489
+ declare namespace models$1 {
490
+ export type { BulkEmailResponse$1 as BulkEmailResponse, TestEmailRequest$1 as TestEmailRequest };
491
+ }
492
+
493
+ /**
494
+ * API endpoints for Testing.
495
+ */
496
+ declare class ExtNewsletterTesting {
497
+ private client;
498
+ constructor(client: any);
499
+ /**
500
+ * Test Email Sending
501
+ *
502
+ * Send a test email to verify mailer configuration.
503
+ */
504
+ newsletterTestCreate(data: TestEmailRequest$1): Promise<BulkEmailResponse$1>;
505
+ }
506
+
507
+ /**
508
+ * Serializer for NewsletterCampaign model.
509
+ *
510
+ * Request model (no read-only fields).
511
+ */
512
+ interface PatchedNewsletterCampaignRequest$1 {
513
+ newsletter?: number;
514
+ subject?: string;
515
+ email_title?: string;
516
+ main_text?: string;
517
+ main_html_content?: string;
518
+ button_text?: string;
519
+ button_url?: string;
520
+ secondary_text?: string;
521
+ }
522
+ /**
523
+ * Serializer for NewsletterCampaign model.
524
+ *
525
+ * Response model (includes read-only fields).
526
+ */
527
+ interface NewsletterCampaign$1 {
528
+ id: number;
529
+ newsletter: number;
530
+ newsletter_title: string;
531
+ subject: string;
532
+ email_title: string;
533
+ main_text: string;
534
+ main_html_content?: string;
535
+ button_text?: string;
536
+ button_url?: string;
537
+ secondary_text?: string;
538
+ /** * `draft` - Draft
539
+ * `sending` - Sending
540
+ * `sent` - Sent
541
+ * `failed` - Failed */
542
+ status: NewsletterCampaignStatus;
543
+ created_at: string;
544
+ sent_at?: string | null;
545
+ recipient_count: number;
546
+ }
547
+ /**
548
+ * Simple serializer for unsubscribe.
549
+ *
550
+ * Request model (no read-only fields).
551
+ */
552
+ interface UnsubscribeRequest$1 {
553
+ subscription_id: number;
554
+ }
555
+ /**
556
+ * Simple serializer for unsubscribe.
557
+ *
558
+ * Response model (includes read-only fields).
559
+ */
560
+ interface Unsubscribe$1 {
561
+ subscription_id: number;
562
+ }
563
+ /**
564
+ * Simple serializer for unsubscribe.
565
+ *
566
+ * Request model (no read-only fields).
567
+ */
568
+ interface PatchedUnsubscribeRequest$1 {
569
+ subscription_id?: number;
570
+ }
571
+
572
+ declare namespace models {
573
+ export type { NewsletterCampaign$1 as NewsletterCampaign, PatchedNewsletterCampaignRequest$1 as PatchedNewsletterCampaignRequest, PatchedUnsubscribeRequest$1 as PatchedUnsubscribeRequest, Unsubscribe$1 as Unsubscribe, UnsubscribeRequest$1 as UnsubscribeRequest };
574
+ }
575
+
576
+ /**
577
+ * API endpoints for Newsletter.
578
+ */
579
+ declare class ExtNewsletterNewsletter {
580
+ private client;
581
+ constructor(client: any);
582
+ /**
583
+ * Retrieve, update, or delete a newsletter campaign.
584
+ */
585
+ campaignsPartialUpdate(id: number, data?: PatchedNewsletterCampaignRequest$1): Promise<NewsletterCampaign$1>;
586
+ /**
587
+ * Handle newsletter unsubscriptions.
588
+ */
589
+ unsubscribeUpdate(data: UnsubscribeRequest$1): Promise<Unsubscribe$1>;
590
+ /**
591
+ * Handle newsletter unsubscriptions.
592
+ */
593
+ unsubscribePartialUpdate(data?: PatchedUnsubscribeRequest$1): Promise<Unsubscribe$1>;
594
+ }
595
+
596
+ /**
597
+ * HTTP Client Adapter Pattern
598
+ *
599
+ * Allows switching between fetch/axios/httpx without changing generated code.
600
+ * Provides unified interface for making HTTP requests.
601
+ */
602
+ interface HttpRequest {
603
+ method: string;
604
+ url: string;
605
+ headers?: Record<string, string>;
606
+ body?: any;
607
+ params?: Record<string, any>;
608
+ /** FormData for file uploads (multipart/form-data) */
609
+ formData?: FormData;
610
+ }
611
+ interface HttpResponse<T = any> {
612
+ data: T;
613
+ status: number;
614
+ statusText: string;
615
+ headers: Record<string, string>;
616
+ }
617
+ /**
618
+ * HTTP Client Adapter Interface.
619
+ * Implement this to use custom HTTP clients (axios, httpx, etc.)
620
+ */
621
+ interface HttpClientAdapter {
622
+ request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
623
+ }
624
+ /**
625
+ * Default Fetch API adapter.
626
+ * Uses native browser fetch() with proper error handling.
627
+ */
628
+ declare class FetchAdapter implements HttpClientAdapter {
629
+ request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
630
+ }
631
+
632
+ /**
633
+ * API Logger with Consola
634
+ * Beautiful console logging for API requests and responses
635
+ *
636
+ * Installation:
637
+ * npm install consola
638
+ */
639
+
640
+ /**
641
+ * Request log data
642
+ */
643
+ interface RequestLog {
644
+ method: string;
645
+ url: string;
646
+ headers?: Record<string, string>;
647
+ body?: any;
648
+ timestamp: number;
649
+ }
650
+ /**
651
+ * Response log data
652
+ */
653
+ interface ResponseLog {
654
+ status: number;
655
+ statusText: string;
656
+ data?: any;
657
+ duration: number;
658
+ timestamp: number;
659
+ }
660
+ /**
661
+ * Error log data
662
+ */
663
+ interface ErrorLog {
664
+ message: string;
665
+ statusCode?: number;
666
+ fieldErrors?: Record<string, string[]>;
667
+ duration: number;
668
+ timestamp: number;
669
+ }
670
+ /**
671
+ * Logger configuration
672
+ */
673
+ interface LoggerConfig {
674
+ /** Enable logging */
675
+ enabled: boolean;
676
+ /** Log requests */
677
+ logRequests: boolean;
678
+ /** Log responses */
679
+ logResponses: boolean;
680
+ /** Log errors */
681
+ logErrors: boolean;
682
+ /** Log request/response bodies */
683
+ logBodies: boolean;
684
+ /** Log headers (excluding sensitive ones) */
685
+ logHeaders: boolean;
686
+ /** Custom consola instance */
687
+ consola?: ConsolaInstance;
688
+ }
689
+ /**
690
+ * API Logger class
691
+ */
692
+ declare class APILogger {
693
+ private config;
694
+ private consola;
695
+ constructor(config?: Partial<LoggerConfig>);
696
+ /**
697
+ * Enable logging
698
+ */
699
+ enable(): void;
700
+ /**
701
+ * Disable logging
702
+ */
703
+ disable(): void;
704
+ /**
705
+ * Update configuration
706
+ */
707
+ setConfig(config: Partial<LoggerConfig>): void;
708
+ /**
709
+ * Filter sensitive headers
710
+ */
711
+ private filterHeaders;
712
+ /**
713
+ * Log request
714
+ */
715
+ logRequest(request: RequestLog): void;
716
+ /**
717
+ * Log response
718
+ */
719
+ logResponse(request: RequestLog, response: ResponseLog): void;
720
+ /**
721
+ * Log error
722
+ */
723
+ logError(request: RequestLog, error: ErrorLog): void;
724
+ /**
725
+ * Log general info
726
+ */
727
+ info(message: string, ...args: any[]): void;
728
+ /**
729
+ * Log warning
730
+ */
731
+ warn(message: string, ...args: any[]): void;
732
+ /**
733
+ * Log error
734
+ */
735
+ error(message: string, ...args: any[]): void;
736
+ /**
737
+ * Log debug
738
+ */
739
+ debug(message: string, ...args: any[]): void;
740
+ /**
741
+ * Log success
742
+ */
743
+ success(message: string, ...args: any[]): void;
744
+ /**
745
+ * Create a sub-logger with prefix
746
+ */
747
+ withTag(tag: string): ConsolaInstance;
748
+ }
749
+
750
+ /**
751
+ * Retry Configuration and Utilities
752
+ *
753
+ * Provides automatic retry logic for failed HTTP requests using p-retry.
754
+ * Retries only on network errors and server errors (5xx), not client errors (4xx).
755
+ */
756
+ /**
757
+ * Information about a failed retry attempt.
758
+ */
759
+ interface FailedAttemptInfo {
760
+ /** The error that caused the failure */
761
+ error: Error;
762
+ /** The attempt number (1-indexed) */
763
+ attemptNumber: number;
764
+ /** Number of retries left */
765
+ retriesLeft: number;
766
+ }
767
+ /**
768
+ * Retry configuration options.
769
+ *
770
+ * Uses exponential backoff with jitter by default to avoid thundering herd.
771
+ */
772
+ interface RetryConfig {
773
+ /**
774
+ * Maximum number of retry attempts.
775
+ * @default 3
776
+ */
777
+ retries?: number;
778
+ /**
779
+ * Exponential backoff factor.
780
+ * @default 2
781
+ */
782
+ factor?: number;
783
+ /**
784
+ * Minimum wait time between retries (ms).
785
+ * @default 1000
786
+ */
787
+ minTimeout?: number;
788
+ /**
789
+ * Maximum wait time between retries (ms).
790
+ * @default 60000
791
+ */
792
+ maxTimeout?: number;
793
+ /**
794
+ * Add randomness to wait times (jitter).
795
+ * Helps avoid thundering herd problem.
796
+ * @default true
797
+ */
798
+ randomize?: boolean;
799
+ /**
800
+ * Callback called on each failed attempt.
801
+ */
802
+ onFailedAttempt?: (info: FailedAttemptInfo) => void;
803
+ }
804
+ /**
805
+ * Default retry configuration.
806
+ */
807
+ declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
808
+ /**
809
+ * Determine if an error should trigger a retry.
810
+ *
811
+ * Retries on:
812
+ * - Network errors (connection refused, timeout, etc.)
813
+ * - Server errors (5xx status codes)
814
+ * - Rate limiting (429 status code)
815
+ *
816
+ * Does NOT retry on:
817
+ * - Client errors (4xx except 429)
818
+ * - Authentication errors (401, 403)
819
+ * - Not found (404)
820
+ *
821
+ * @param error - The error to check
822
+ * @returns true if should retry, false otherwise
823
+ */
824
+ declare function shouldRetry(error: any): boolean;
825
+ /**
826
+ * Wrap a function with retry logic.
827
+ *
828
+ * @param fn - Async function to retry
829
+ * @param config - Retry configuration
830
+ * @returns Result of the function
831
+ *
832
+ * @example
833
+ * ```typescript
834
+ * const result = await withRetry(
835
+ * async () => fetch('https://api.example.com/users'),
836
+ * { retries: 5, minTimeout: 2000 }
837
+ * );
838
+ * ```
839
+ */
840
+ declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
841
+
842
+ /**
843
+ * Async API client for Django CFG API.
844
+ *
845
+ * Usage:
846
+ * ```typescript
847
+ * const client = new APIClient('https://api.example.com');
848
+ * const users = await client.users.list();
849
+ * const post = await client.posts.create(newPost);
850
+ *
851
+ * // Custom HTTP adapter (e.g., Axios)
852
+ * const client = new APIClient('https://api.example.com', {
853
+ * httpClient: new AxiosAdapter()
854
+ * });
855
+ * ```
856
+ */
857
+ declare class APIClient {
858
+ private baseUrl;
859
+ private httpClient;
860
+ private logger;
861
+ private retryConfig;
862
+ ext_newsletter_bulk_email: ExtNewsletterBulkEmail;
863
+ ext_newsletter_campaigns: ExtNewsletterCampaigns;
864
+ ext_newsletter_logs: ExtNewsletterLogs;
865
+ ext_newsletter_newsletters: ExtNewsletterNewsletters;
866
+ ext_newsletter_subscriptions: ExtNewsletterSubscriptions;
867
+ ext_newsletter_testing: ExtNewsletterTesting;
868
+ ext_newsletter_newsletter: ExtNewsletterNewsletter;
869
+ constructor(baseUrl: string, options?: {
870
+ httpClient?: HttpClientAdapter;
871
+ loggerConfig?: Partial<LoggerConfig>;
872
+ retryConfig?: RetryConfig;
873
+ });
874
+ /**
875
+ * Get CSRF token from cookies (for SessionAuthentication).
876
+ *
877
+ * Returns null if cookie doesn't exist (JWT-only auth).
878
+ */
879
+ getCsrfToken(): string | null;
880
+ /**
881
+ * Make HTTP request with Django CSRF and session handling.
882
+ * Automatically retries on network errors and 5xx server errors.
883
+ */
884
+ request<T>(method: string, path: string, options?: {
885
+ params?: Record<string, any>;
886
+ body?: any;
887
+ formData?: FormData;
888
+ headers?: Record<string, string>;
889
+ }): Promise<T>;
890
+ /**
891
+ * Internal request method (without retry wrapper).
892
+ * Used by request() method with optional retry logic.
893
+ */
894
+ private _makeRequest;
895
+ }
896
+
897
+ /**
898
+ * Storage adapters for cross-platform token storage.
899
+ *
900
+ * Supports:
901
+ * - LocalStorage (browser)
902
+ * - Cookies (SSR/browser)
903
+ * - Memory (Node.js/Electron/testing)
904
+ */
905
+
906
+ /**
907
+ * Storage adapter interface for cross-platform token storage.
908
+ */
909
+ interface StorageAdapter {
910
+ getItem(key: string): string | null;
911
+ setItem(key: string, value: string): void;
912
+ removeItem(key: string): void;
913
+ }
914
+ /**
915
+ * LocalStorage adapter with safe try-catch for browser environments.
916
+ * Works in modern browsers with localStorage support.
917
+ *
918
+ * Note: This adapter uses window.localStorage and should only be used in browser/client environments.
919
+ * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.
920
+ */
921
+ declare class LocalStorageAdapter implements StorageAdapter {
922
+ private logger?;
923
+ constructor(logger?: APILogger);
924
+ getItem(key: string): string | null;
925
+ setItem(key: string, value: string): void;
926
+ removeItem(key: string): void;
927
+ }
928
+ /**
929
+ * Cookie-based storage adapter for SSR and browser environments.
930
+ * Useful for Next.js, Nuxt.js, and other SSR frameworks.
931
+ */
932
+ declare class CookieStorageAdapter implements StorageAdapter {
933
+ private logger?;
934
+ constructor(logger?: APILogger);
935
+ getItem(key: string): string | null;
936
+ setItem(key: string, value: string): void;
937
+ removeItem(key: string): void;
938
+ }
939
+ /**
940
+ * In-memory storage adapter for Node.js, Electron, and testing environments.
941
+ * Data is stored in RAM and cleared when process exits.
942
+ */
943
+ declare class MemoryStorageAdapter implements StorageAdapter {
944
+ private storage;
945
+ private logger?;
946
+ constructor(logger?: APILogger);
947
+ getItem(key: string): string | null;
948
+ setItem(key: string, value: string): void;
949
+ removeItem(key: string): void;
950
+ }
951
+
952
+ /**
953
+ * Zod schema for BulkEmailRequest
954
+ *
955
+ * This schema provides runtime validation and type inference.
956
+ * * Simple serializer for bulk email.
957
+ * */
958
+
959
+ /**
960
+ * Simple serializer for bulk email.
961
+ */
962
+ declare const BulkEmailRequestSchema: z.ZodObject<{
963
+ recipients: z.ZodArray<z.ZodEmail>;
964
+ subject: z.ZodString;
965
+ email_title: z.ZodString;
966
+ main_text: z.ZodString;
967
+ main_html_content: z.ZodOptional<z.ZodString>;
968
+ button_text: z.ZodOptional<z.ZodString>;
969
+ button_url: z.ZodOptional<z.ZodURL>;
970
+ secondary_text: z.ZodOptional<z.ZodString>;
971
+ }, z.core.$strip>;
972
+ /**
973
+ * Infer TypeScript type from Zod schema
974
+ */
975
+ type BulkEmailRequest = z.infer<typeof BulkEmailRequestSchema>;
976
+
977
+ /**
978
+ * Zod schema for BulkEmailResponse
979
+ *
980
+ * This schema provides runtime validation and type inference.
981
+ * * Response for bulk email sending.
982
+ * */
983
+
984
+ /**
985
+ * Response for bulk email sending.
986
+ */
987
+ declare const BulkEmailResponseSchema: z.ZodObject<{
988
+ success: z.ZodBoolean;
989
+ sent_count: z.ZodInt;
990
+ failed_count: z.ZodInt;
991
+ total_recipients: z.ZodInt;
992
+ error: z.ZodOptional<z.ZodString>;
993
+ }, z.core.$strip>;
994
+ /**
995
+ * Infer TypeScript type from Zod schema
996
+ */
997
+ type BulkEmailResponse = z.infer<typeof BulkEmailResponseSchema>;
998
+
999
+ /**
1000
+ * Zod schema for EmailLog
1001
+ *
1002
+ * This schema provides runtime validation and type inference.
1003
+ * * Serializer for EmailLog model.
1004
+ * */
1005
+
1006
+ /**
1007
+ * Serializer for EmailLog model.
1008
+ */
1009
+ declare const EmailLogSchema: z.ZodObject<{
1010
+ id: z.ZodString;
1011
+ user: z.ZodNullable<z.ZodInt>;
1012
+ user_email: z.ZodString;
1013
+ newsletter: z.ZodNullable<z.ZodInt>;
1014
+ newsletter_title: z.ZodString;
1015
+ recipient: z.ZodString;
1016
+ subject: z.ZodString;
1017
+ body: z.ZodString;
1018
+ status: z.ZodEnum<typeof EmailLogStatus>;
1019
+ created_at: z.ZodISODateTime;
1020
+ sent_at: z.ZodNullable<z.ZodISODateTime>;
1021
+ error_message: z.ZodNullable<z.ZodString>;
1022
+ }, z.core.$strip>;
1023
+ /**
1024
+ * Infer TypeScript type from Zod schema
1025
+ */
1026
+ type EmailLog = z.infer<typeof EmailLogSchema>;
1027
+
1028
+ /**
1029
+ * Zod schema for ErrorResponse
1030
+ *
1031
+ * This schema provides runtime validation and type inference.
1032
+ * * Generic error response.
1033
+ * */
1034
+
1035
+ /**
1036
+ * Generic error response.
1037
+ */
1038
+ declare const ErrorResponseSchema: z.ZodObject<{
1039
+ success: z.ZodOptional<z.ZodBoolean>;
1040
+ message: z.ZodString;
1041
+ }, z.core.$strip>;
1042
+ /**
1043
+ * Infer TypeScript type from Zod schema
1044
+ */
1045
+ type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
1046
+
1047
+ /**
1048
+ * Zod schema for Newsletter
1049
+ *
1050
+ * This schema provides runtime validation and type inference.
1051
+ * * Serializer for Newsletter model.
1052
+ * */
1053
+
1054
+ /**
1055
+ * Serializer for Newsletter model.
1056
+ */
1057
+ declare const NewsletterSchema: z.ZodObject<{
1058
+ id: z.ZodInt;
1059
+ title: z.ZodString;
1060
+ description: z.ZodOptional<z.ZodString>;
1061
+ is_active: z.ZodOptional<z.ZodBoolean>;
1062
+ auto_subscribe: z.ZodOptional<z.ZodBoolean>;
1063
+ created_at: z.ZodISODateTime;
1064
+ updated_at: z.ZodISODateTime;
1065
+ subscribers_count: z.ZodInt;
1066
+ }, z.core.$strip>;
1067
+ /**
1068
+ * Infer TypeScript type from Zod schema
1069
+ */
1070
+ type Newsletter = z.infer<typeof NewsletterSchema>;
1071
+
1072
+ /**
1073
+ * Zod schema for NewsletterCampaign
1074
+ *
1075
+ * This schema provides runtime validation and type inference.
1076
+ * * Serializer for NewsletterCampaign model.
1077
+ * */
1078
+
1079
+ /**
1080
+ * Serializer for NewsletterCampaign model.
1081
+ */
1082
+ declare const NewsletterCampaignSchema: z.ZodObject<{
1083
+ id: z.ZodInt;
1084
+ newsletter: z.ZodInt;
1085
+ newsletter_title: z.ZodString;
1086
+ subject: z.ZodString;
1087
+ email_title: z.ZodString;
1088
+ main_text: z.ZodString;
1089
+ main_html_content: z.ZodOptional<z.ZodString>;
1090
+ button_text: z.ZodOptional<z.ZodString>;
1091
+ button_url: z.ZodOptional<z.ZodURL>;
1092
+ secondary_text: z.ZodOptional<z.ZodString>;
1093
+ status: z.ZodEnum<typeof NewsletterCampaignStatus>;
1094
+ created_at: z.ZodISODateTime;
1095
+ sent_at: z.ZodNullable<z.ZodISODateTime>;
1096
+ recipient_count: z.ZodInt;
1097
+ }, z.core.$strip>;
1098
+ /**
1099
+ * Infer TypeScript type from Zod schema
1100
+ */
1101
+ type NewsletterCampaign = z.infer<typeof NewsletterCampaignSchema>;
1102
+
1103
+ /**
1104
+ * Zod schema for NewsletterCampaignRequest
1105
+ *
1106
+ * This schema provides runtime validation and type inference.
1107
+ * * Serializer for NewsletterCampaign model.
1108
+ * */
1109
+
1110
+ /**
1111
+ * Serializer for NewsletterCampaign model.
1112
+ */
1113
+ declare const NewsletterCampaignRequestSchema: z.ZodObject<{
1114
+ newsletter: z.ZodInt;
1115
+ subject: z.ZodString;
1116
+ email_title: z.ZodString;
1117
+ main_text: z.ZodString;
1118
+ main_html_content: z.ZodOptional<z.ZodString>;
1119
+ button_text: z.ZodOptional<z.ZodString>;
1120
+ button_url: z.ZodOptional<z.ZodURL>;
1121
+ secondary_text: z.ZodOptional<z.ZodString>;
1122
+ }, z.core.$strip>;
1123
+ /**
1124
+ * Infer TypeScript type from Zod schema
1125
+ */
1126
+ type NewsletterCampaignRequest = z.infer<typeof NewsletterCampaignRequestSchema>;
1127
+
1128
+ /**
1129
+ * Zod schema for NewsletterSubscription
1130
+ *
1131
+ * This schema provides runtime validation and type inference.
1132
+ * * Serializer for NewsletterSubscription model.
1133
+ * */
1134
+
1135
+ /**
1136
+ * Serializer for NewsletterSubscription model.
1137
+ */
1138
+ declare const NewsletterSubscriptionSchema: z.ZodObject<{
1139
+ id: z.ZodInt;
1140
+ newsletter: z.ZodInt;
1141
+ newsletter_title: z.ZodString;
1142
+ user: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1143
+ user_email: z.ZodString;
1144
+ email: z.ZodEmail;
1145
+ is_active: z.ZodOptional<z.ZodBoolean>;
1146
+ subscribed_at: z.ZodISODateTime;
1147
+ unsubscribed_at: z.ZodNullable<z.ZodISODateTime>;
1148
+ }, z.core.$strip>;
1149
+ /**
1150
+ * Infer TypeScript type from Zod schema
1151
+ */
1152
+ type NewsletterSubscription = z.infer<typeof NewsletterSubscriptionSchema>;
1153
+
1154
+ declare const PaginatedEmailLogListSchema: z.ZodObject<{
1155
+ count: z.ZodInt;
1156
+ page: z.ZodInt;
1157
+ pages: z.ZodInt;
1158
+ page_size: z.ZodInt;
1159
+ has_next: z.ZodBoolean;
1160
+ has_previous: z.ZodBoolean;
1161
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1162
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1163
+ results: z.ZodArray<z.ZodObject<{
1164
+ id: z.ZodString;
1165
+ user: z.ZodNullable<z.ZodInt>;
1166
+ user_email: z.ZodString;
1167
+ newsletter: z.ZodNullable<z.ZodInt>;
1168
+ newsletter_title: z.ZodString;
1169
+ recipient: z.ZodString;
1170
+ subject: z.ZodString;
1171
+ body: z.ZodString;
1172
+ status: z.ZodEnum<typeof EmailLogStatus>;
1173
+ created_at: z.ZodISODateTime;
1174
+ sent_at: z.ZodNullable<z.ZodISODateTime>;
1175
+ error_message: z.ZodNullable<z.ZodString>;
1176
+ }, z.core.$strip>>;
1177
+ }, z.core.$strip>;
1178
+ /**
1179
+ * Infer TypeScript type from Zod schema
1180
+ */
1181
+ type PaginatedEmailLogList = z.infer<typeof PaginatedEmailLogListSchema>;
1182
+
1183
+ declare const PaginatedNewsletterCampaignListSchema: z.ZodObject<{
1184
+ count: z.ZodInt;
1185
+ page: z.ZodInt;
1186
+ pages: z.ZodInt;
1187
+ page_size: z.ZodInt;
1188
+ has_next: z.ZodBoolean;
1189
+ has_previous: z.ZodBoolean;
1190
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1191
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1192
+ results: z.ZodArray<z.ZodObject<{
1193
+ id: z.ZodInt;
1194
+ newsletter: z.ZodInt;
1195
+ newsletter_title: z.ZodString;
1196
+ subject: z.ZodString;
1197
+ email_title: z.ZodString;
1198
+ main_text: z.ZodString;
1199
+ main_html_content: z.ZodOptional<z.ZodString>;
1200
+ button_text: z.ZodOptional<z.ZodString>;
1201
+ button_url: z.ZodOptional<z.ZodURL>;
1202
+ secondary_text: z.ZodOptional<z.ZodString>;
1203
+ status: z.ZodEnum<typeof NewsletterCampaignStatus>;
1204
+ created_at: z.ZodISODateTime;
1205
+ sent_at: z.ZodNullable<z.ZodISODateTime>;
1206
+ recipient_count: z.ZodInt;
1207
+ }, z.core.$strip>>;
1208
+ }, z.core.$strip>;
1209
+ /**
1210
+ * Infer TypeScript type from Zod schema
1211
+ */
1212
+ type PaginatedNewsletterCampaignList = z.infer<typeof PaginatedNewsletterCampaignListSchema>;
1213
+
1214
+ /**
1215
+ * Zod schema for PaginatedNewsletterList
1216
+ *
1217
+ * This schema provides runtime validation and type inference.
1218
+ * */
1219
+
1220
+ declare const PaginatedNewsletterListSchema: z.ZodObject<{
1221
+ count: z.ZodInt;
1222
+ page: z.ZodInt;
1223
+ pages: z.ZodInt;
1224
+ page_size: z.ZodInt;
1225
+ has_next: z.ZodBoolean;
1226
+ has_previous: z.ZodBoolean;
1227
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1228
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1229
+ results: z.ZodArray<z.ZodObject<{
1230
+ id: z.ZodInt;
1231
+ title: z.ZodString;
1232
+ description: z.ZodOptional<z.ZodString>;
1233
+ is_active: z.ZodOptional<z.ZodBoolean>;
1234
+ auto_subscribe: z.ZodOptional<z.ZodBoolean>;
1235
+ created_at: z.ZodISODateTime;
1236
+ updated_at: z.ZodISODateTime;
1237
+ subscribers_count: z.ZodInt;
1238
+ }, z.core.$strip>>;
1239
+ }, z.core.$strip>;
1240
+ /**
1241
+ * Infer TypeScript type from Zod schema
1242
+ */
1243
+ type PaginatedNewsletterList = z.infer<typeof PaginatedNewsletterListSchema>;
1244
+
1245
+ /**
1246
+ * Zod schema for PaginatedNewsletterSubscriptionList
1247
+ *
1248
+ * This schema provides runtime validation and type inference.
1249
+ * */
1250
+
1251
+ declare const PaginatedNewsletterSubscriptionListSchema: z.ZodObject<{
1252
+ count: z.ZodInt;
1253
+ page: z.ZodInt;
1254
+ pages: z.ZodInt;
1255
+ page_size: z.ZodInt;
1256
+ has_next: z.ZodBoolean;
1257
+ has_previous: z.ZodBoolean;
1258
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1259
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1260
+ results: z.ZodArray<z.ZodObject<{
1261
+ id: z.ZodInt;
1262
+ newsletter: z.ZodInt;
1263
+ newsletter_title: z.ZodString;
1264
+ user: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1265
+ user_email: z.ZodString;
1266
+ email: z.ZodEmail;
1267
+ is_active: z.ZodOptional<z.ZodBoolean>;
1268
+ subscribed_at: z.ZodISODateTime;
1269
+ unsubscribed_at: z.ZodNullable<z.ZodISODateTime>;
1270
+ }, z.core.$strip>>;
1271
+ }, z.core.$strip>;
1272
+ /**
1273
+ * Infer TypeScript type from Zod schema
1274
+ */
1275
+ type PaginatedNewsletterSubscriptionList = z.infer<typeof PaginatedNewsletterSubscriptionListSchema>;
1276
+
1277
+ /**
1278
+ * Zod schema for PatchedNewsletterCampaignRequest
1279
+ *
1280
+ * This schema provides runtime validation and type inference.
1281
+ * * Serializer for NewsletterCampaign model.
1282
+ * */
1283
+
1284
+ /**
1285
+ * Serializer for NewsletterCampaign model.
1286
+ */
1287
+ declare const PatchedNewsletterCampaignRequestSchema: z.ZodObject<{
1288
+ newsletter: z.ZodOptional<z.ZodInt>;
1289
+ subject: z.ZodOptional<z.ZodString>;
1290
+ email_title: z.ZodOptional<z.ZodString>;
1291
+ main_text: z.ZodOptional<z.ZodString>;
1292
+ main_html_content: z.ZodOptional<z.ZodString>;
1293
+ button_text: z.ZodOptional<z.ZodString>;
1294
+ button_url: z.ZodOptional<z.ZodURL>;
1295
+ secondary_text: z.ZodOptional<z.ZodString>;
1296
+ }, z.core.$strip>;
1297
+ /**
1298
+ * Infer TypeScript type from Zod schema
1299
+ */
1300
+ type PatchedNewsletterCampaignRequest = z.infer<typeof PatchedNewsletterCampaignRequestSchema>;
1301
+
1302
+ /**
1303
+ * Zod schema for PatchedUnsubscribeRequest
1304
+ *
1305
+ * This schema provides runtime validation and type inference.
1306
+ * * Simple serializer for unsubscribe.
1307
+ * */
1308
+
1309
+ /**
1310
+ * Simple serializer for unsubscribe.
1311
+ */
1312
+ declare const PatchedUnsubscribeRequestSchema: z.ZodObject<{
1313
+ subscription_id: z.ZodOptional<z.ZodInt>;
1314
+ }, z.core.$strip>;
1315
+ /**
1316
+ * Infer TypeScript type from Zod schema
1317
+ */
1318
+ type PatchedUnsubscribeRequest = z.infer<typeof PatchedUnsubscribeRequestSchema>;
1319
+
1320
+ /**
1321
+ * Zod schema for SendCampaignRequest
1322
+ *
1323
+ * This schema provides runtime validation and type inference.
1324
+ * * Simple serializer for sending campaign.
1325
+ * */
1326
+
1327
+ /**
1328
+ * Simple serializer for sending campaign.
1329
+ */
1330
+ declare const SendCampaignRequestSchema: z.ZodObject<{
1331
+ campaign_id: z.ZodInt;
1332
+ }, z.core.$strip>;
1333
+ /**
1334
+ * Infer TypeScript type from Zod schema
1335
+ */
1336
+ type SendCampaignRequest = z.infer<typeof SendCampaignRequestSchema>;
1337
+
1338
+ /**
1339
+ * Zod schema for SendCampaignResponse
1340
+ *
1341
+ * This schema provides runtime validation and type inference.
1342
+ * * Response for sending campaign.
1343
+ * */
1344
+
1345
+ /**
1346
+ * Response for sending campaign.
1347
+ */
1348
+ declare const SendCampaignResponseSchema: z.ZodObject<{
1349
+ success: z.ZodBoolean;
1350
+ message: z.ZodOptional<z.ZodString>;
1351
+ sent_count: z.ZodOptional<z.ZodInt>;
1352
+ error: z.ZodOptional<z.ZodString>;
1353
+ }, z.core.$strip>;
1354
+ /**
1355
+ * Infer TypeScript type from Zod schema
1356
+ */
1357
+ type SendCampaignResponse = z.infer<typeof SendCampaignResponseSchema>;
1358
+
1359
+ /**
1360
+ * Zod schema for SubscribeRequest
1361
+ *
1362
+ * This schema provides runtime validation and type inference.
1363
+ * * Simple serializer for newsletter subscription.
1364
+ * */
1365
+
1366
+ /**
1367
+ * Simple serializer for newsletter subscription.
1368
+ */
1369
+ declare const SubscribeRequestSchema: z.ZodObject<{
1370
+ newsletter_id: z.ZodInt;
1371
+ email: z.ZodEmail;
1372
+ }, z.core.$strip>;
1373
+ /**
1374
+ * Infer TypeScript type from Zod schema
1375
+ */
1376
+ type SubscribeRequest = z.infer<typeof SubscribeRequestSchema>;
1377
+
1378
+ /**
1379
+ * Zod schema for SubscribeResponse
1380
+ *
1381
+ * This schema provides runtime validation and type inference.
1382
+ * * Response for subscription.
1383
+ * */
1384
+
1385
+ /**
1386
+ * Response for subscription.
1387
+ */
1388
+ declare const SubscribeResponseSchema: z.ZodObject<{
1389
+ success: z.ZodBoolean;
1390
+ message: z.ZodString;
1391
+ subscription_id: z.ZodOptional<z.ZodInt>;
1392
+ }, z.core.$strip>;
1393
+ /**
1394
+ * Infer TypeScript type from Zod schema
1395
+ */
1396
+ type SubscribeResponse = z.infer<typeof SubscribeResponseSchema>;
1397
+
1398
+ /**
1399
+ * Zod schema for SuccessResponse
1400
+ *
1401
+ * This schema provides runtime validation and type inference.
1402
+ * * Generic success response.
1403
+ * */
1404
+
1405
+ /**
1406
+ * Generic success response.
1407
+ */
1408
+ declare const SuccessResponseSchema: z.ZodObject<{
1409
+ success: z.ZodBoolean;
1410
+ message: z.ZodString;
1411
+ }, z.core.$strip>;
1412
+ /**
1413
+ * Infer TypeScript type from Zod schema
1414
+ */
1415
+ type SuccessResponse = z.infer<typeof SuccessResponseSchema>;
1416
+
1417
+ /**
1418
+ * Zod schema for TestEmailRequest
1419
+ *
1420
+ * This schema provides runtime validation and type inference.
1421
+ * * Simple serializer for test email.
1422
+ * */
1423
+
1424
+ /**
1425
+ * Simple serializer for test email.
1426
+ */
1427
+ declare const TestEmailRequestSchema: z.ZodObject<{
1428
+ email: z.ZodEmail;
1429
+ subject: z.ZodOptional<z.ZodString>;
1430
+ message: z.ZodOptional<z.ZodString>;
1431
+ }, z.core.$strip>;
1432
+ /**
1433
+ * Infer TypeScript type from Zod schema
1434
+ */
1435
+ type TestEmailRequest = z.infer<typeof TestEmailRequestSchema>;
1436
+
1437
+ /**
1438
+ * Zod schema for Unsubscribe
1439
+ *
1440
+ * This schema provides runtime validation and type inference.
1441
+ * * Simple serializer for unsubscribe.
1442
+ * */
1443
+
1444
+ /**
1445
+ * Simple serializer for unsubscribe.
1446
+ */
1447
+ declare const UnsubscribeSchema: z.ZodObject<{
1448
+ subscription_id: z.ZodInt;
1449
+ }, z.core.$strip>;
1450
+ /**
1451
+ * Infer TypeScript type from Zod schema
1452
+ */
1453
+ type Unsubscribe = z.infer<typeof UnsubscribeSchema>;
1454
+
1455
+ /**
1456
+ * Zod schema for UnsubscribeRequest
1457
+ *
1458
+ * This schema provides runtime validation and type inference.
1459
+ * * Simple serializer for unsubscribe.
1460
+ * */
1461
+
1462
+ /**
1463
+ * Simple serializer for unsubscribe.
1464
+ */
1465
+ declare const UnsubscribeRequestSchema: z.ZodObject<{
1466
+ subscription_id: z.ZodInt;
1467
+ }, z.core.$strip>;
1468
+ /**
1469
+ * Infer TypeScript type from Zod schema
1470
+ */
1471
+ type UnsubscribeRequest = z.infer<typeof UnsubscribeRequestSchema>;
1472
+
1473
+ /**
1474
+ * Zod Schemas - Runtime validation and type inference
1475
+ *
1476
+ * Auto-generated from OpenAPI specification.
1477
+ * Provides runtime validation for API requests and responses.
1478
+ *
1479
+ * Usage:
1480
+ * ```typescript
1481
+ * import { UserSchema } from './schemas'
1482
+ *
1483
+ * // Validate data
1484
+ * const user = UserSchema.parse(data)
1485
+ *
1486
+ * // Type inference
1487
+ * type User = z.infer<typeof UserSchema>
1488
+ * ```
1489
+ */
1490
+
1491
+ type index$1_BulkEmailRequest = BulkEmailRequest;
1492
+ declare const index$1_BulkEmailRequestSchema: typeof BulkEmailRequestSchema;
1493
+ type index$1_BulkEmailResponse = BulkEmailResponse;
1494
+ declare const index$1_BulkEmailResponseSchema: typeof BulkEmailResponseSchema;
1495
+ type index$1_EmailLog = EmailLog;
1496
+ declare const index$1_EmailLogSchema: typeof EmailLogSchema;
1497
+ type index$1_ErrorResponse = ErrorResponse;
1498
+ declare const index$1_ErrorResponseSchema: typeof ErrorResponseSchema;
1499
+ type index$1_Newsletter = Newsletter;
1500
+ type index$1_NewsletterCampaign = NewsletterCampaign;
1501
+ type index$1_NewsletterCampaignRequest = NewsletterCampaignRequest;
1502
+ declare const index$1_NewsletterCampaignRequestSchema: typeof NewsletterCampaignRequestSchema;
1503
+ declare const index$1_NewsletterCampaignSchema: typeof NewsletterCampaignSchema;
1504
+ declare const index$1_NewsletterSchema: typeof NewsletterSchema;
1505
+ type index$1_NewsletterSubscription = NewsletterSubscription;
1506
+ declare const index$1_NewsletterSubscriptionSchema: typeof NewsletterSubscriptionSchema;
1507
+ type index$1_PaginatedEmailLogList = PaginatedEmailLogList;
1508
+ declare const index$1_PaginatedEmailLogListSchema: typeof PaginatedEmailLogListSchema;
1509
+ type index$1_PaginatedNewsletterCampaignList = PaginatedNewsletterCampaignList;
1510
+ declare const index$1_PaginatedNewsletterCampaignListSchema: typeof PaginatedNewsletterCampaignListSchema;
1511
+ type index$1_PaginatedNewsletterList = PaginatedNewsletterList;
1512
+ declare const index$1_PaginatedNewsletterListSchema: typeof PaginatedNewsletterListSchema;
1513
+ type index$1_PaginatedNewsletterSubscriptionList = PaginatedNewsletterSubscriptionList;
1514
+ declare const index$1_PaginatedNewsletterSubscriptionListSchema: typeof PaginatedNewsletterSubscriptionListSchema;
1515
+ type index$1_PatchedNewsletterCampaignRequest = PatchedNewsletterCampaignRequest;
1516
+ declare const index$1_PatchedNewsletterCampaignRequestSchema: typeof PatchedNewsletterCampaignRequestSchema;
1517
+ type index$1_PatchedUnsubscribeRequest = PatchedUnsubscribeRequest;
1518
+ declare const index$1_PatchedUnsubscribeRequestSchema: typeof PatchedUnsubscribeRequestSchema;
1519
+ type index$1_SendCampaignRequest = SendCampaignRequest;
1520
+ declare const index$1_SendCampaignRequestSchema: typeof SendCampaignRequestSchema;
1521
+ type index$1_SendCampaignResponse = SendCampaignResponse;
1522
+ declare const index$1_SendCampaignResponseSchema: typeof SendCampaignResponseSchema;
1523
+ type index$1_SubscribeRequest = SubscribeRequest;
1524
+ declare const index$1_SubscribeRequestSchema: typeof SubscribeRequestSchema;
1525
+ type index$1_SubscribeResponse = SubscribeResponse;
1526
+ declare const index$1_SubscribeResponseSchema: typeof SubscribeResponseSchema;
1527
+ type index$1_SuccessResponse = SuccessResponse;
1528
+ declare const index$1_SuccessResponseSchema: typeof SuccessResponseSchema;
1529
+ type index$1_TestEmailRequest = TestEmailRequest;
1530
+ declare const index$1_TestEmailRequestSchema: typeof TestEmailRequestSchema;
1531
+ type index$1_Unsubscribe = Unsubscribe;
1532
+ type index$1_UnsubscribeRequest = UnsubscribeRequest;
1533
+ declare const index$1_UnsubscribeRequestSchema: typeof UnsubscribeRequestSchema;
1534
+ declare const index$1_UnsubscribeSchema: typeof UnsubscribeSchema;
1535
+ declare namespace index$1 {
1536
+ export { type index$1_BulkEmailRequest as BulkEmailRequest, index$1_BulkEmailRequestSchema as BulkEmailRequestSchema, type index$1_BulkEmailResponse as BulkEmailResponse, index$1_BulkEmailResponseSchema as BulkEmailResponseSchema, type index$1_EmailLog as EmailLog, index$1_EmailLogSchema as EmailLogSchema, type index$1_ErrorResponse as ErrorResponse, index$1_ErrorResponseSchema as ErrorResponseSchema, type index$1_Newsletter as Newsletter, type index$1_NewsletterCampaign as NewsletterCampaign, type index$1_NewsletterCampaignRequest as NewsletterCampaignRequest, index$1_NewsletterCampaignRequestSchema as NewsletterCampaignRequestSchema, index$1_NewsletterCampaignSchema as NewsletterCampaignSchema, index$1_NewsletterSchema as NewsletterSchema, type index$1_NewsletterSubscription as NewsletterSubscription, index$1_NewsletterSubscriptionSchema as NewsletterSubscriptionSchema, type index$1_PaginatedEmailLogList as PaginatedEmailLogList, index$1_PaginatedEmailLogListSchema as PaginatedEmailLogListSchema, type index$1_PaginatedNewsletterCampaignList as PaginatedNewsletterCampaignList, index$1_PaginatedNewsletterCampaignListSchema as PaginatedNewsletterCampaignListSchema, type index$1_PaginatedNewsletterList as PaginatedNewsletterList, index$1_PaginatedNewsletterListSchema as PaginatedNewsletterListSchema, type index$1_PaginatedNewsletterSubscriptionList as PaginatedNewsletterSubscriptionList, index$1_PaginatedNewsletterSubscriptionListSchema as PaginatedNewsletterSubscriptionListSchema, type index$1_PatchedNewsletterCampaignRequest as PatchedNewsletterCampaignRequest, index$1_PatchedNewsletterCampaignRequestSchema as PatchedNewsletterCampaignRequestSchema, type index$1_PatchedUnsubscribeRequest as PatchedUnsubscribeRequest, index$1_PatchedUnsubscribeRequestSchema as PatchedUnsubscribeRequestSchema, type index$1_SendCampaignRequest as SendCampaignRequest, index$1_SendCampaignRequestSchema as SendCampaignRequestSchema, type index$1_SendCampaignResponse as SendCampaignResponse, index$1_SendCampaignResponseSchema as SendCampaignResponseSchema, type index$1_SubscribeRequest as SubscribeRequest, index$1_SubscribeRequestSchema as SubscribeRequestSchema, type index$1_SubscribeResponse as SubscribeResponse, index$1_SubscribeResponseSchema as SubscribeResponseSchema, type index$1_SuccessResponse as SuccessResponse, index$1_SuccessResponseSchema as SuccessResponseSchema, type index$1_TestEmailRequest as TestEmailRequest, index$1_TestEmailRequestSchema as TestEmailRequestSchema, type index$1_Unsubscribe as Unsubscribe, type index$1_UnsubscribeRequest as UnsubscribeRequest, index$1_UnsubscribeRequestSchema as UnsubscribeRequestSchema, index$1_UnsubscribeSchema as UnsubscribeSchema };
1537
+ }
1538
+
1539
+ /**
1540
+ * Zod Validation Events - Browser CustomEvent integration
1541
+ *
1542
+ * Dispatches browser CustomEvents when Zod validation fails, allowing
1543
+ * React/frontend apps to listen and handle validation errors globally.
1544
+ *
1545
+ * @example
1546
+ * ```typescript
1547
+ * // In your React app
1548
+ * window.addEventListener('zod-validation-error', (event) => {
1549
+ * const { operation, path, method, error, response } = event.detail;
1550
+ * console.error(`Validation failed for ${method} ${path}`, error);
1551
+ * // Show toast notification, log to Sentry, etc.
1552
+ * });
1553
+ * ```
1554
+ */
1555
+
1556
+ /**
1557
+ * Validation error event detail
1558
+ */
1559
+ interface ValidationErrorDetail {
1560
+ /** Operation/function name that failed validation */
1561
+ operation: string;
1562
+ /** API endpoint path */
1563
+ path: string;
1564
+ /** HTTP method */
1565
+ method: string;
1566
+ /** Zod validation error */
1567
+ error: ZodError;
1568
+ /** Raw response data that failed validation */
1569
+ response: any;
1570
+ /** Timestamp of the error */
1571
+ timestamp: Date;
1572
+ }
1573
+ /**
1574
+ * Custom event type for Zod validation errors
1575
+ */
1576
+ type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>;
1577
+ /**
1578
+ * Dispatch a Zod validation error event.
1579
+ *
1580
+ * Only dispatches in browser environment (when window is defined).
1581
+ * Safe to call in Node.js/SSR - will be a no-op.
1582
+ *
1583
+ * @param detail - Validation error details
1584
+ */
1585
+ declare function dispatchValidationError(detail: ValidationErrorDetail): void;
1586
+ /**
1587
+ * Add a global listener for Zod validation errors.
1588
+ *
1589
+ * @param callback - Function to call when validation error occurs
1590
+ * @returns Cleanup function to remove the listener
1591
+ *
1592
+ * @example
1593
+ * ```typescript
1594
+ * const cleanup = onValidationError(({ operation, error }) => {
1595
+ * toast.error(`Validation failed in ${operation}`);
1596
+ * logToSentry(error);
1597
+ * });
1598
+ *
1599
+ * // Later, remove listener
1600
+ * cleanup();
1601
+ * ```
1602
+ */
1603
+ declare function onValidationError(callback: (detail: ValidationErrorDetail) => void): () => void;
1604
+ /**
1605
+ * Format Zod error for logging/display.
1606
+ *
1607
+ * @param error - Zod validation error
1608
+ * @returns Formatted error message
1609
+ */
1610
+ declare function formatZodError(error: ZodError): string;
1611
+
1612
+ /**
1613
+ * API operation
1614
+ *
1615
+ * @method PATCH
1616
+ * @path /cfg/newsletter/campaigns/{id}/
1617
+ */
1618
+ declare function partialUpdateNewsletterCampaignsPartialUpdate(id: number, data?: PatchedNewsletterCampaignRequest, client?: any): Promise<NewsletterCampaign>;
1619
+ /**
1620
+ * API operation
1621
+ *
1622
+ * @method PUT
1623
+ * @path /cfg/newsletter/unsubscribe/
1624
+ */
1625
+ declare function updateNewsletterUnsubscribeUpdate(data: UnsubscribeRequest, client?: any): Promise<Unsubscribe>;
1626
+ /**
1627
+ * API operation
1628
+ *
1629
+ * @method PATCH
1630
+ * @path /cfg/newsletter/unsubscribe/
1631
+ */
1632
+ declare function partialUpdateNewsletterUnsubscribePartialUpdate(data?: PatchedUnsubscribeRequest, client?: any): Promise<Unsubscribe>;
1633
+
1634
+ /**
1635
+ * Send Bulk Email
1636
+ *
1637
+ * @method POST
1638
+ * @path /cfg/newsletter/bulk/
1639
+ */
1640
+ declare function createNewsletterBulkCreate(data: BulkEmailRequest, client?: any): Promise<BulkEmailResponse>;
1641
+
1642
+ /**
1643
+ * List Newsletter Campaigns
1644
+ *
1645
+ * @method GET
1646
+ * @path /cfg/newsletter/campaigns/
1647
+ */
1648
+ declare function getNewsletterCampaignsList(params?: {
1649
+ page?: number;
1650
+ page_size?: number;
1651
+ }, client?: any): Promise<PaginatedNewsletterCampaignList>;
1652
+ /**
1653
+ * Create Newsletter Campaign
1654
+ *
1655
+ * @method POST
1656
+ * @path /cfg/newsletter/campaigns/
1657
+ */
1658
+ declare function createNewsletterCampaignsCreate(data: NewsletterCampaignRequest, client?: any): Promise<NewsletterCampaign>;
1659
+ /**
1660
+ * Get Campaign Details
1661
+ *
1662
+ * @method GET
1663
+ * @path /cfg/newsletter/campaigns/{id}/
1664
+ */
1665
+ declare function getNewsletterCampaignsRetrieve(id: number, client?: any): Promise<NewsletterCampaign>;
1666
+ /**
1667
+ * Update Campaign
1668
+ *
1669
+ * @method PUT
1670
+ * @path /cfg/newsletter/campaigns/{id}/
1671
+ */
1672
+ declare function updateNewsletterCampaignsUpdate(id: number, data: NewsletterCampaignRequest, client?: any): Promise<NewsletterCampaign>;
1673
+ /**
1674
+ * Delete Campaign
1675
+ *
1676
+ * @method DELETE
1677
+ * @path /cfg/newsletter/campaigns/{id}/
1678
+ */
1679
+ declare function deleteNewsletterCampaignsDestroy(id: number, client?: any): Promise<void>;
1680
+ /**
1681
+ * Send Newsletter Campaign
1682
+ *
1683
+ * @method POST
1684
+ * @path /cfg/newsletter/campaigns/send/
1685
+ */
1686
+ declare function createNewsletterCampaignsSendCreate(data: SendCampaignRequest, client?: any): Promise<SendCampaignResponse>;
1687
+
1688
+ /**
1689
+ * List Email Logs
1690
+ *
1691
+ * @method GET
1692
+ * @path /cfg/newsletter/logs/
1693
+ */
1694
+ declare function getNewsletterLogsList(params?: {
1695
+ page?: number;
1696
+ page_size?: number;
1697
+ }, client?: any): Promise<PaginatedEmailLogList>;
1698
+
1699
+ /**
1700
+ * List Active Newsletters
1701
+ *
1702
+ * @method GET
1703
+ * @path /cfg/newsletter/newsletters/
1704
+ */
1705
+ declare function getNewsletterNewslettersList(params?: {
1706
+ page?: number;
1707
+ page_size?: number;
1708
+ }, client?: any): Promise<PaginatedNewsletterList>;
1709
+ /**
1710
+ * Get Newsletter Details
1711
+ *
1712
+ * @method GET
1713
+ * @path /cfg/newsletter/newsletters/{id}/
1714
+ */
1715
+ declare function getNewsletterNewslettersRetrieve(id: number, client?: any): Promise<Newsletter>;
1716
+
1717
+ /**
1718
+ * Subscribe to Newsletter
1719
+ *
1720
+ * @method POST
1721
+ * @path /cfg/newsletter/subscribe/
1722
+ */
1723
+ declare function createNewsletterSubscribeCreate(data: SubscribeRequest, client?: any): Promise<SubscribeResponse>;
1724
+ /**
1725
+ * List User Subscriptions
1726
+ *
1727
+ * @method GET
1728
+ * @path /cfg/newsletter/subscriptions/
1729
+ */
1730
+ declare function getNewsletterSubscriptionsList(params?: {
1731
+ page?: number;
1732
+ page_size?: number;
1733
+ }, client?: any): Promise<PaginatedNewsletterSubscriptionList>;
1734
+ /**
1735
+ * Unsubscribe from Newsletter
1736
+ *
1737
+ * @method POST
1738
+ * @path /cfg/newsletter/unsubscribe/
1739
+ */
1740
+ declare function createNewsletterUnsubscribeCreate(data: UnsubscribeRequest, client?: any): Promise<SuccessResponse>;
1741
+
1742
+ /**
1743
+ * Test Email Sending
1744
+ *
1745
+ * @method POST
1746
+ * @path /cfg/newsletter/test/
1747
+ */
1748
+ declare function createNewsletterTestCreate(data: TestEmailRequest, client?: any): Promise<BulkEmailResponse>;
1749
+
1750
+ /**
1751
+ * Typed Fetchers - Universal API functions
1752
+ *
1753
+ * Auto-generated from OpenAPI specification.
1754
+ * These functions work in any JavaScript environment.
1755
+ *
1756
+ * Features:
1757
+ * - Runtime validation with Zod
1758
+ * - Type-safe parameters and responses
1759
+ * - Works with any data-fetching library (SWR, React Query, etc)
1760
+ * - Server Component compatible
1761
+ *
1762
+ * Usage:
1763
+ * ```typescript
1764
+ * import * as fetchers from './fetchers'
1765
+ *
1766
+ * // Direct usage
1767
+ * const user = await fetchers.getUser(1)
1768
+ *
1769
+ * // With SWR
1770
+ * const { data } = useSWR('user-1', () => fetchers.getUser(1))
1771
+ *
1772
+ * // With React Query
1773
+ * const { data } = useQuery(['user', 1], () => fetchers.getUser(1))
1774
+ * ```
1775
+ */
1776
+
1777
+ declare const index_createNewsletterBulkCreate: typeof createNewsletterBulkCreate;
1778
+ declare const index_createNewsletterCampaignsCreate: typeof createNewsletterCampaignsCreate;
1779
+ declare const index_createNewsletterCampaignsSendCreate: typeof createNewsletterCampaignsSendCreate;
1780
+ declare const index_createNewsletterSubscribeCreate: typeof createNewsletterSubscribeCreate;
1781
+ declare const index_createNewsletterTestCreate: typeof createNewsletterTestCreate;
1782
+ declare const index_createNewsletterUnsubscribeCreate: typeof createNewsletterUnsubscribeCreate;
1783
+ declare const index_deleteNewsletterCampaignsDestroy: typeof deleteNewsletterCampaignsDestroy;
1784
+ declare const index_getNewsletterCampaignsList: typeof getNewsletterCampaignsList;
1785
+ declare const index_getNewsletterCampaignsRetrieve: typeof getNewsletterCampaignsRetrieve;
1786
+ declare const index_getNewsletterLogsList: typeof getNewsletterLogsList;
1787
+ declare const index_getNewsletterNewslettersList: typeof getNewsletterNewslettersList;
1788
+ declare const index_getNewsletterNewslettersRetrieve: typeof getNewsletterNewslettersRetrieve;
1789
+ declare const index_getNewsletterSubscriptionsList: typeof getNewsletterSubscriptionsList;
1790
+ declare const index_partialUpdateNewsletterCampaignsPartialUpdate: typeof partialUpdateNewsletterCampaignsPartialUpdate;
1791
+ declare const index_partialUpdateNewsletterUnsubscribePartialUpdate: typeof partialUpdateNewsletterUnsubscribePartialUpdate;
1792
+ declare const index_updateNewsletterCampaignsUpdate: typeof updateNewsletterCampaignsUpdate;
1793
+ declare const index_updateNewsletterUnsubscribeUpdate: typeof updateNewsletterUnsubscribeUpdate;
1794
+ declare namespace index {
1795
+ export { index_createNewsletterBulkCreate as createNewsletterBulkCreate, index_createNewsletterCampaignsCreate as createNewsletterCampaignsCreate, index_createNewsletterCampaignsSendCreate as createNewsletterCampaignsSendCreate, index_createNewsletterSubscribeCreate as createNewsletterSubscribeCreate, index_createNewsletterTestCreate as createNewsletterTestCreate, index_createNewsletterUnsubscribeCreate as createNewsletterUnsubscribeCreate, index_deleteNewsletterCampaignsDestroy as deleteNewsletterCampaignsDestroy, index_getNewsletterCampaignsList as getNewsletterCampaignsList, index_getNewsletterCampaignsRetrieve as getNewsletterCampaignsRetrieve, index_getNewsletterLogsList as getNewsletterLogsList, index_getNewsletterNewslettersList as getNewsletterNewslettersList, index_getNewsletterNewslettersRetrieve as getNewsletterNewslettersRetrieve, index_getNewsletterSubscriptionsList as getNewsletterSubscriptionsList, index_partialUpdateNewsletterCampaignsPartialUpdate as partialUpdateNewsletterCampaignsPartialUpdate, index_partialUpdateNewsletterUnsubscribePartialUpdate as partialUpdateNewsletterUnsubscribePartialUpdate, index_updateNewsletterCampaignsUpdate as updateNewsletterCampaignsUpdate, index_updateNewsletterUnsubscribeUpdate as updateNewsletterUnsubscribeUpdate };
1796
+ }
1797
+
1798
+ /**
1799
+ * Global API Instance - Singleton configuration
1800
+ *
1801
+ * This module provides a global API instance that can be configured once
1802
+ * and used throughout your application.
1803
+ *
1804
+ * Usage:
1805
+ * ```typescript
1806
+ * // Configure once (e.g., in your app entry point)
1807
+ * import { configureAPI } from './api-instance'
1808
+ *
1809
+ * configureAPI({
1810
+ * baseUrl: 'https://api.example.com',
1811
+ * token: 'your-jwt-token'
1812
+ * })
1813
+ *
1814
+ * // Then use fetchers and hooks anywhere without configuration
1815
+ * import { getUsers } from './fetchers'
1816
+ * const users = await getUsers({ page: 1 })
1817
+ * ```
1818
+ *
1819
+ * For SSR or multiple instances:
1820
+ * ```typescript
1821
+ * import { API } from './index'
1822
+ * import { getUsers } from './fetchers'
1823
+ *
1824
+ * const api = new API('https://api.example.com')
1825
+ * const users = await getUsers({ page: 1 }, api)
1826
+ * ```
1827
+ */
1828
+
1829
+ /**
1830
+ * Get the global API instance
1831
+ * @throws Error if API is not configured
1832
+ */
1833
+ declare function getAPIInstance(): API;
1834
+ /**
1835
+ * Check if API is configured
1836
+ */
1837
+ declare function isAPIConfigured(): boolean;
1838
+ /**
1839
+ * Configure the global API instance
1840
+ *
1841
+ * @param baseUrl - Base URL for the API
1842
+ * @param options - Optional configuration (storage, retry, logger)
1843
+ *
1844
+ * @example
1845
+ * ```typescript
1846
+ * configureAPI({
1847
+ * baseUrl: 'https://api.example.com',
1848
+ * token: 'jwt-token',
1849
+ * options: {
1850
+ * retryConfig: { maxRetries: 3 },
1851
+ * loggerConfig: { enabled: true }
1852
+ * }
1853
+ * })
1854
+ * ```
1855
+ */
1856
+ declare function configureAPI(config: {
1857
+ baseUrl: string;
1858
+ token?: string;
1859
+ refreshToken?: string;
1860
+ options?: APIOptions;
1861
+ }): API;
1862
+ /**
1863
+ * Reconfigure the global API instance with new settings
1864
+ * Useful for updating tokens or base URL
1865
+ */
1866
+ declare function reconfigureAPI(updates: {
1867
+ baseUrl?: string;
1868
+ token?: string;
1869
+ refreshToken?: string;
1870
+ }): API;
1871
+ /**
1872
+ * Clear tokens from the global API instance
1873
+ */
1874
+ declare function clearAPITokens(): void;
1875
+ /**
1876
+ * Reset the global API instance
1877
+ * Useful for testing or logout scenarios
1878
+ */
1879
+ declare function resetAPI(): void;
1880
+
1881
+ /**
1882
+ * API Error Classes
1883
+ *
1884
+ * Typed error classes with Django REST Framework support.
1885
+ */
1886
+ /**
1887
+ * HTTP API Error with DRF field-specific validation errors.
1888
+ *
1889
+ * Usage:
1890
+ * ```typescript
1891
+ * try {
1892
+ * await api.users.create(userData);
1893
+ * } catch (error) {
1894
+ * if (error instanceof APIError) {
1895
+ * if (error.isValidationError) {
1896
+ * console.log('Field errors:', error.fieldErrors);
1897
+ * // { "email": ["Email already exists"], "username": ["Required"] }
1898
+ * }
1899
+ * }
1900
+ * }
1901
+ * ```
1902
+ */
1903
+ declare class APIError extends Error {
1904
+ statusCode: number;
1905
+ statusText: string;
1906
+ response: any;
1907
+ url: string;
1908
+ constructor(statusCode: number, statusText: string, response: any, url: string, message?: string);
1909
+ /**
1910
+ * Get error details from response.
1911
+ * DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
1912
+ */
1913
+ get details(): Record<string, any> | null;
1914
+ /**
1915
+ * Get field-specific validation errors from DRF.
1916
+ * Returns: { "field_name": ["error1", "error2"], ... }
1917
+ */
1918
+ get fieldErrors(): Record<string, string[]> | null;
1919
+ /**
1920
+ * Get single error message from DRF.
1921
+ * Checks for "detail", "message", or first field error.
1922
+ */
1923
+ get errorMessage(): string;
1924
+ get isValidationError(): boolean;
1925
+ get isAuthError(): boolean;
1926
+ get isPermissionError(): boolean;
1927
+ get isNotFoundError(): boolean;
1928
+ get isServerError(): boolean;
1929
+ }
1930
+ /**
1931
+ * Network Error (connection failed, timeout, etc.)
1932
+ */
1933
+ declare class NetworkError extends Error {
1934
+ url: string;
1935
+ originalError?: Error;
1936
+ constructor(message: string, url: string, originalError?: Error);
1937
+ }
1938
+
1939
+ /**
1940
+ * Django CFG API - API Client with JWT Management
1941
+ *
1942
+ * Usage:
1943
+ * ```typescript
1944
+ * import { API } from './api';
1945
+ *
1946
+ * const api = new API('https://api.example.com');
1947
+ *
1948
+ * // Set JWT token
1949
+ * api.setToken('your-jwt-token', 'refresh-token');
1950
+ *
1951
+ * // Use API
1952
+ * const posts = await api.posts.list();
1953
+ * const user = await api.users.retrieve(1);
1954
+ *
1955
+ * // Check authentication
1956
+ * if (api.isAuthenticated()) {
1957
+ * // ...
1958
+ * }
1959
+ *
1960
+ * // Custom storage with logging (for Electron/Node.js)
1961
+ * import { MemoryStorageAdapter, APILogger } from './storage';
1962
+ * const logger = new APILogger({ enabled: true, logLevel: 'debug' });
1963
+ * const api = new API('https://api.example.com', {
1964
+ * storage: new MemoryStorageAdapter(logger),
1965
+ * loggerConfig: { enabled: true, logLevel: 'debug' }
1966
+ * });
1967
+ *
1968
+ * // Get OpenAPI schema
1969
+ * const schema = api.getSchema();
1970
+ * ```
1971
+ */
1972
+
1973
+ declare const TOKEN_KEY = "auth_token";
1974
+ declare const REFRESH_TOKEN_KEY = "refresh_token";
1975
+ interface APIOptions {
1976
+ /** Custom storage adapter (defaults to LocalStorageAdapter) */
1977
+ storage?: StorageAdapter;
1978
+ /** Retry configuration for failed requests */
1979
+ retryConfig?: RetryConfig;
1980
+ /** Logger configuration */
1981
+ loggerConfig?: Partial<LoggerConfig>;
1982
+ }
1983
+ declare class API {
1984
+ private baseUrl;
1985
+ private _client;
1986
+ private _token;
1987
+ private _refreshToken;
1988
+ private storage;
1989
+ private options?;
1990
+ ext_newsletter_bulk_email: ExtNewsletterBulkEmail;
1991
+ ext_newsletter_campaigns: ExtNewsletterCampaigns;
1992
+ ext_newsletter_logs: ExtNewsletterLogs;
1993
+ ext_newsletter_newsletters: ExtNewsletterNewsletters;
1994
+ ext_newsletter_subscriptions: ExtNewsletterSubscriptions;
1995
+ ext_newsletter_testing: ExtNewsletterTesting;
1996
+ ext_newsletter_newsletter: ExtNewsletterNewsletter;
1997
+ constructor(baseUrl: string, options?: APIOptions);
1998
+ private _loadTokensFromStorage;
1999
+ private _reinitClients;
2000
+ private _injectAuthHeader;
2001
+ /**
2002
+ * Get current JWT token
2003
+ */
2004
+ getToken(): string | null;
2005
+ /**
2006
+ * Get current refresh token
2007
+ */
2008
+ getRefreshToken(): string | null;
2009
+ /**
2010
+ * Set JWT token and refresh token
2011
+ * @param token - JWT access token
2012
+ * @param refreshToken - JWT refresh token (optional)
2013
+ */
2014
+ setToken(token: string, refreshToken?: string): void;
2015
+ /**
2016
+ * Clear all tokens
2017
+ */
2018
+ clearTokens(): void;
2019
+ /**
2020
+ * Check if user is authenticated
2021
+ */
2022
+ isAuthenticated(): boolean;
2023
+ /**
2024
+ * Update base URL and reinitialize clients
2025
+ * @param url - New base URL
2026
+ */
2027
+ setBaseUrl(url: string): void;
2028
+ /**
2029
+ * Get current base URL
2030
+ */
2031
+ getBaseUrl(): string;
2032
+ /**
2033
+ * Get OpenAPI schema path
2034
+ * @returns Path to the OpenAPI schema JSON file
2035
+ *
2036
+ * Note: The OpenAPI schema is available in the schema.json file.
2037
+ * You can load it dynamically using:
2038
+ * ```typescript
2039
+ * const schema = await fetch('./schema.json').then(r => r.json());
2040
+ * // or using fs in Node.js:
2041
+ * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
2042
+ * ```
2043
+ */
2044
+ getSchemaPath(): string;
2045
+ }
2046
+
2047
+ /**
2048
+ * Newsletter Extension API
2049
+ *
2050
+ * Pre-configured API instance with shared authentication
2051
+ */
2052
+
2053
+ declare const apiNewsletter: API;
2054
+
2055
+ /**
2056
+ * Hero Component Types
2057
+ */
2058
+ interface HeroAction {
2059
+ label: string;
2060
+ onClick: () => void;
2061
+ }
2062
+ interface HeroProps {
2063
+ /** Main heading text */
2064
+ title: string;
2065
+ /** Supporting description text */
2066
+ description?: string;
2067
+ /** Primary call-to-action button */
2068
+ primaryAction?: HeroAction;
2069
+ /** Secondary call-to-action button */
2070
+ secondaryAction?: HeroAction;
2071
+ /** Show newsletter subscription form */
2072
+ showNewsletter?: boolean;
2073
+ /** Email input placeholder */
2074
+ newsletterPlaceholder?: string;
2075
+ /** Subscribe button text */
2076
+ newsletterButtonText?: string;
2077
+ /** Newsletter submission handler */
2078
+ onNewsletterSubmit?: (email: string) => Promise<{
2079
+ message?: string;
2080
+ } | void>;
2081
+ /** Additional CSS classes */
2082
+ className?: string;
2083
+ }
2084
+
2085
+ /**
2086
+ * Newsletter extension configuration
2087
+ */
2088
+ declare const extensionConfig: _djangocfg_ext_base.ExtensionMetadata;
2089
+
2090
+ export { API, APIClient, APIError, APILogger, type APIOptions, type BulkEmailRequest, BulkEmailRequestSchema, type BulkEmailResponse, BulkEmailResponseSchema, CookieStorageAdapter, DEFAULT_RETRY_CONFIG, type EmailLog, EmailLogSchema, enums as Enums, type ErrorLog, type ErrorResponse, ErrorResponseSchema, models$6 as ExtNewsletterBulkEmailTypes, models$5 as ExtNewsletterCampaignsTypes, models$4 as ExtNewsletterLogsTypes, models as ExtNewsletterNewsletterTypes, models$3 as ExtNewsletterNewslettersTypes, models$2 as ExtNewsletterSubscriptionsTypes, models$1 as ExtNewsletterTestingTypes, type FailedAttemptInfo, FetchAdapter, index as Fetchers, type HeroAction, type HeroProps, type HttpClientAdapter, type HttpRequest, type HttpResponse, LocalStorageAdapter, type LoggerConfig, MemoryStorageAdapter, NetworkError, type Newsletter, type NewsletterCampaign, type NewsletterCampaignRequest, NewsletterCampaignRequestSchema, NewsletterCampaignSchema, NewsletterSchema, type NewsletterSubscription, NewsletterSubscriptionSchema, type PaginatedEmailLogList, PaginatedEmailLogListSchema, type PaginatedNewsletterCampaignList, PaginatedNewsletterCampaignListSchema, type PaginatedNewsletterList, PaginatedNewsletterListSchema, type PaginatedNewsletterSubscriptionList, PaginatedNewsletterSubscriptionListSchema, type PatchedNewsletterCampaignRequest, PatchedNewsletterCampaignRequestSchema, type PatchedUnsubscribeRequest, PatchedUnsubscribeRequestSchema, REFRESH_TOKEN_KEY, type RequestLog, type ResponseLog, type RetryConfig, index$1 as Schemas, type SendCampaignRequest, SendCampaignRequestSchema, type SendCampaignResponse, SendCampaignResponseSchema, type StorageAdapter, type SubscribeRequest, SubscribeRequestSchema, type SubscribeResponse, SubscribeResponseSchema, type SuccessResponse, SuccessResponseSchema, TOKEN_KEY, type TestEmailRequest, TestEmailRequestSchema, type Unsubscribe, type UnsubscribeRequest, UnsubscribeRequestSchema, UnsubscribeSchema, type ValidationErrorDetail, type ValidationErrorEvent, apiNewsletter, clearAPITokens, configureAPI, createNewsletterBulkCreate, createNewsletterCampaignsCreate, createNewsletterCampaignsSendCreate, createNewsletterSubscribeCreate, createNewsletterTestCreate, createNewsletterUnsubscribeCreate, deleteNewsletterCampaignsDestroy, dispatchValidationError, extensionConfig, formatZodError, getAPIInstance, getNewsletterCampaignsList, getNewsletterCampaignsRetrieve, getNewsletterLogsList, getNewsletterNewslettersList, getNewsletterNewslettersRetrieve, getNewsletterSubscriptionsList, isAPIConfigured, onValidationError, partialUpdateNewsletterCampaignsPartialUpdate, partialUpdateNewsletterUnsubscribePartialUpdate, reconfigureAPI, resetAPI, shouldRetry, updateNewsletterCampaignsUpdate, updateNewsletterUnsubscribeUpdate, withRetry };