ts-mailcow-api 0.8.4 → 0.9.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 (32) hide show
  1. package/LICENSE +661 -661
  2. package/dist/Endpoints/alias-endpoints.d.ts +33 -33
  3. package/dist/Endpoints/alias-endpoints.js +25 -26
  4. package/dist/Endpoints/alias-endpoints.js.map +1 -1
  5. package/dist/Endpoints/antispam-endpoints.d.ts +28 -28
  6. package/dist/Endpoints/antispam-endpoints.js +21 -22
  7. package/dist/Endpoints/antispam-endpoints.js.map +1 -1
  8. package/dist/Endpoints/domain-endpoints.d.ts +33 -33
  9. package/dist/Endpoints/domain-endpoints.js +25 -26
  10. package/dist/Endpoints/domain-endpoints.js.map +1 -1
  11. package/dist/Endpoints/forwarding-endpoints.d.ts +27 -27
  12. package/dist/Endpoints/forwarding-endpoints.js +21 -22
  13. package/dist/Endpoints/forwarding-endpoints.js.map +1 -1
  14. package/dist/Endpoints/log-endpoints.d.ts +55 -55
  15. package/dist/Endpoints/log-endpoints.js +37 -38
  16. package/dist/Endpoints/log-endpoints.js.map +1 -1
  17. package/dist/Endpoints/mailbox-endpoint.d.ts +58 -58
  18. package/dist/Endpoints/mailbox-endpoint.js +40 -41
  19. package/dist/Endpoints/mailbox-endpoint.js.map +1 -1
  20. package/dist/Endpoints/syncjob-endpoints.d.ts +24 -24
  21. package/dist/Endpoints/syncjob-endpoints.js +19 -20
  22. package/dist/Endpoints/syncjob-endpoints.js.map +1 -1
  23. package/dist/index.d.ts +86 -86
  24. package/dist/index.js +82 -82
  25. package/dist/index.js.map +1 -1
  26. package/dist/request-factory.d.ts +27 -27
  27. package/dist/request-factory.js +87 -88
  28. package/dist/request-factory.js.map +1 -1
  29. package/dist/types.d.ts +1313 -1313
  30. package/dist/types.js +9 -9
  31. package/package.json +15 -16
  32. package/src/types.ts +1393 -1393
package/src/types.ts CHANGED
@@ -1,1393 +1,1393 @@
1
- /* eslint-disable camelcase */
2
- /**
3
- * Payloads should be JSONs.
4
- */
5
- export type Payload = Record<string, any> | null;
6
-
7
- /**
8
- * Base attributes of a domain.
9
- */
10
- export interface BaseDomainAttributes {
11
- /**
12
- * The language code associated with this domain.
13
- */
14
- lang:
15
- | 'sk'
16
- | 'cs'
17
- | 'de'
18
- | 'en'
19
- | 'es'
20
- | 'fr'
21
- | 'lv'
22
- | 'nl'
23
- | 'pl'
24
- | 'pt'
25
- | 'ru'
26
- | 'it'
27
- | 'ca';
28
- /**
29
- * Boolean if the domain is active.
30
- */
31
- active: boolean;
32
- /**
33
- * Amount of aliases in the domain.
34
- */
35
- aliases: number;
36
- /**
37
- * Boolean to relay domain or not.
38
- */
39
- backupmx: number;
40
- /**
41
- * The predefined mailbox quota in add mailbox form
42
- */
43
- defquota: number;
44
- /**
45
- * The description of the domain.
46
- */
47
- description: string;
48
- /**
49
- * The limit count of mailboxes associated with this domain.
50
- */
51
- mailboxes: number;
52
- /**
53
- * The maximum quota per mailbox.
54
- */
55
- maxquota: number;
56
- /**
57
- * The maximum quota for this domain (sum of all mailboxes).
58
- */
59
- quota: number;
60
- /**
61
- * If not, then you have to create "dummy" mailbox for each address to relay
62
- */
63
- relay_all_recipients: boolean;
64
- }
65
-
66
- /**
67
- * Relay interval settings.
68
- */
69
- type RelayFrame = 's' | 'm' | 'h' | 'd';
70
-
71
- /**
72
- * Domain creation payload.
73
- */
74
- export interface DomainPostRequest extends BaseDomainAttributes {
75
- /**
76
- * The domain to create.
77
- */
78
- domain: string;
79
- /**
80
- * The frame of the relay setting.
81
- */
82
- rl_frame: RelayFrame;
83
- /**
84
- * The value of the relay setting.
85
- */
86
- rl_value: number;
87
- /**
88
- * If true: sogo will restart after domain creation.
89
- */
90
- restart_sogo: boolean;
91
- }
92
-
93
- /**
94
- * Domain delete request.
95
- */
96
- export interface DomainDeleteRequest {
97
- /**
98
- * List of domains to delete.
99
- */
100
- domains: string[];
101
- }
102
-
103
- /**
104
- * All attributes of the domain you can edit.
105
- */
106
- export interface DomainEditAttributes extends BaseDomainAttributes {
107
- /**
108
- * Is domain global address list active or not, it enables shared contacts across domain in SOGo webmail
109
- */
110
- gal: boolean;
111
- /**
112
- * Id of the relayhost.
113
- */
114
- relayhost: number;
115
- }
116
-
117
- /**
118
- * Domain edit request.
119
- */
120
- export interface DomainEditRequest {
121
- /**
122
- * Possible attributes you can edit.
123
- */
124
- attr: Partial<DomainEditAttributes>;
125
- /**
126
- * Domains you wish to edit.
127
- */
128
- items: string | string[];
129
- }
130
-
131
- /**
132
- * Interface of the Domain as returned by Mailcow.
133
- */
134
- export interface Domain {
135
- /**
136
- * 0 = False, 1 = True.
137
- */
138
- active: number;
139
- /**
140
- * Amount of aliases in this domain.
141
- */
142
- aliases_in_domain: number;
143
- /**
144
- * Amount of aliases remaining in the alias quota.
145
- */
146
- aliases_left: number;
147
- /**
148
- * If backupmx is activated.
149
- */
150
- backupmx?: boolean;
151
- /**
152
- * Total amount of bytes used by this domain.
153
- */
154
- bytes_total?: number;
155
- /**
156
- * New mailbox quota.
157
- */
158
- def_new_mailbox_quota?: number;
159
- /**
160
- * Quota for a mailbox.
161
- */
162
- def_quota_for_mbox?: number;
163
- /**
164
- * Description of the domain.
165
- */
166
- description: string;
167
- /**
168
- * Name of the domain.
169
- */
170
- domain_name: string;
171
- /**
172
- * Is domain global address list active or not, it enables shared contacts across domain in SOGo webmail
173
- */
174
- gal: boolean;
175
- /**
176
- * Max quota for new mailboxes.
177
- */
178
- max_new_mailbox_quota?: string;
179
- /**
180
- * Max quota aliases on this domain.
181
- */
182
- max_num_aliases_for_domain?: number;
183
- /**
184
- * Max number of mailboxes in this domain.
185
- */
186
- max_num_mboxes_for_domain: number;
187
- /**
188
- * Max quota for this domain.
189
- */
190
- max_quota_for_domain: number;
191
- /**
192
- * Max quota for a mailbox.
193
- */
194
- max_quota_for_mbox: number;
195
- /**
196
- * Amount of mailboxes in this domain.
197
- */
198
- mboxes_in_domain: number;
199
- /**
200
- * Amount of mailboxes left in the quota.
201
- */
202
- mboxes_left: number;
203
- /**
204
- * Amount of total messages in this domain.
205
- */
206
- msgs_total: number;
207
- /**
208
- * Quota used in this domain.
209
- */
210
- quota_used_in_domain: number;
211
- /**
212
- * If all mails are relayed.
213
- */
214
- relay_all_recipients?: boolean;
215
- /**
216
- * Id of the relay host
217
- */
218
- relayhost?: number;
219
- /**
220
- * If the domain is relayed.
221
- */
222
- rl: boolean | { value: string; frame: string };
223
- /**
224
- * If XMPP is enable.d
225
- */
226
- xmpp: boolean;
227
- /**
228
- * The XMPP prefix.
229
- */
230
- xmpp_prefix: string;
231
- /**
232
- * Integer representation of the boolean.
233
- */
234
- gal_int: number;
235
- /**
236
- * Integer representation of the boolean.
237
- */
238
- active_int: number;
239
- /**
240
- * Integer representation of the boolean.
241
- */
242
- relay_all_recipients_int: boolean;
243
- /**
244
- * If the domain should only relay unknown adresses.
245
- */
246
- relay_unknown_only: boolean;
247
- /**
248
- * Integer representation of the boolean.
249
- */
250
- relay_unknown_only_int: boolean;
251
- /**
252
- * List of domain admins
253
- */
254
- domain_admins: string[];
255
- }
256
-
257
- /**
258
- * Antispam policy creation request.
259
- */
260
- export interface SpamPolicyPostRequest {
261
- /**
262
- * Domain for which the policies applies.
263
- */
264
- domain: string;
265
- /**
266
- * The 'from' parameter off the antispam policy
267
- */
268
- object_from: string;
269
- /**
270
- * Use 'wl' for whitelist and 'bl' for blacklist.
271
- */
272
- object_list: 'wl' | 'bl';
273
- }
274
-
275
- /**
276
- * Antispam deletion request.
277
- */
278
- export interface SpamPolicyDeleteRequest {
279
- /**
280
- * IDs of the policies to delete.
281
- */
282
- prefid: number[];
283
- }
284
-
285
- /**
286
- * Antispam policy get request.
287
- */
288
- export interface SpamPolicyGetRequest {
289
- /**
290
- * Use 'wl' to get whitelist policies and use 'bl' to get blacklist policies.
291
- */
292
- type: 'wl' | 'bl';
293
- /**
294
- * The exact address or use wildcard to match whole domain.
295
- */
296
- domain: string;
297
- }
298
-
299
- /**
300
- * Interface of the Antispam Policy as returned by Mailcow.
301
- */
302
- export interface SpamPolicy {
303
- /**
304
- * The domain of the policy.
305
- */
306
- object: string;
307
- /**
308
- * The address of the policy.
309
- */
310
- value: string;
311
- /**
312
- * The ID of the policy.
313
- */
314
- prefid: number;
315
- }
316
-
317
- /**
318
- * Base attributes of a mailbox.
319
- */
320
- export interface BaseMailboxAttributes {
321
- /**
322
- * Integer representing if the mailbox is active (allows for custom states).
323
- */
324
- active: number;
325
- /**
326
- * Boolean if the user is forced to update their password on login.
327
- */
328
- force_pw_update: boolean;
329
- /**
330
- * The ull name of the mailbox user.
331
- */
332
- name: string;
333
- /**
334
- * The mailbox password.
335
- */
336
- password: string;
337
- /**
338
- * The mailbox password for confirmation.
339
- */
340
- password2: string;
341
- /**
342
- * The mailbox quota.
343
- */
344
- quota: number;
345
- }
346
-
347
- /**
348
- * Mailbox creation request.
349
- */
350
- export interface MailboxPostRequest extends BaseMailboxAttributes {
351
- /**
352
- * The domain of the mailbox.
353
- */
354
- domain: string;
355
- /**
356
- * The local part of the mailbox.
357
- */
358
- local_part: string;
359
- /**
360
- * Boolean if inbound email encryption is forced.
361
- */
362
- tls_enforce_in: boolean;
363
- /**
364
- * Boolean if outbound email encryption is forced.
365
- */
366
- tls_enforce_out: boolean;
367
- }
368
-
369
- /**
370
- * Mailbox deletion request.
371
- */
372
- export interface MailboxDeleteRequest {
373
- /**
374
- * List of mailboxes to delete.
375
- */
376
- mailboxes: string[];
377
- }
378
-
379
- /**
380
- * Attributes of the mailbox you can edit.
381
- */
382
- export interface MailboxEditAttributes extends BaseMailboxAttributes {
383
- /**
384
- * List of allowed send from addresses.
385
- */
386
- sender_acl: string[];
387
- /**
388
- * Boolean iff mailbox has SOGo acces.
389
- */
390
- sogo_access: boolean;
391
- }
392
-
393
- /**
394
- * Mailbox update request.
395
- */
396
- export interface MailboxEditRequest {
397
- /**
398
- * List of attributes you wish to update.
399
- */
400
- attr: Partial<MailboxEditAttributes>;
401
- /**
402
- * List of mailboxes to edit.
403
- */
404
- items: string[];
405
- }
406
-
407
- /**
408
- * Possible options for the Quarantine time frames.
409
- */
410
- type QuarantineSchedule = 'hourly' | 'daily' | 'weekly' | 'never';
411
-
412
- /**
413
- * Options of what should happen if email is quarantined.
414
- */
415
- type QuarantineCategory = 'reject' | 'add_header' | 'all';
416
-
417
- /**
418
- * Interface of the Mailbox as returned by Mailcow.
419
- */
420
- export interface Mailbox {
421
- /**
422
- * The full mailbox name, equal to local_part@domain
423
- */
424
- username: string;
425
- /**
426
- * Boolean if the mailbox is active.
427
- */
428
- active: boolean;
429
- /**
430
- * Int representation of the boolean.
431
- */
432
- active_int: number;
433
- /**
434
- * Domain of the mailbox.
435
- */
436
- domain: string;
437
- /**
438
- * Boolean if XMPP is enabled for this domain.
439
- */
440
- domain_xmpp?: boolean;
441
- /**
442
- * Name of the user belonging to the mailbox.
443
- */
444
- name: string;
445
- /**
446
- * The prefix used for the XMPP login.
447
- */
448
- domain_xmpp_prefix?: string;
449
- /**
450
- * The local part of the mailbox.
451
- */
452
- local_part: string;
453
- /**
454
- * The quota of the mailbox.
455
- */
456
- quota: number;
457
- /**
458
- * Amount of messages in the mailbox.
459
- */
460
- messages: number;
461
- /**
462
- * Attributes belonging to this mailbox
463
- */
464
- attributes: {
465
- /**
466
- * Boolean if the user is forced to update their password on login.
467
- */
468
- force_pw_update: boolean;
469
- /**
470
- * Boolean if inbound email encryption is forced.
471
- */
472
- tls_enforce_in: boolean;
473
- /**
474
- * Boolean if outbound email encryption is forced.
475
- */
476
- tls_enforce_out: boolean;
477
- /**
478
- * Boolean if mailbox has SOGo acces.
479
- */
480
- sogo_access: boolean;
481
- /**
482
- * Boolean if mailbox has IMAP acces.
483
- */
484
- imap_access: boolean;
485
- /**
486
- * Boolean if mailbox has POP3 acces.
487
- */
488
- pop3_access: boolean;
489
- /**
490
- * Boolean if mailbox has SMTP acces.
491
- */
492
- smtp_access: boolean;
493
- /**
494
- * Boolean if mailbox has XMPP acces.
495
- */
496
- xmpp_access: boolean;
497
- /**
498
- * Boolean if mailbox is XMPP admin.
499
- */
500
- xmpp_admin: boolean;
501
- /**
502
- * The format of the mailbox.
503
- */
504
- mailbox_format: string;
505
- /**
506
- * The schedule on which the mailbox gets quarantine notifications.
507
- */
508
- quarantine_notification: QuarantineSchedule;
509
- /**
510
- * What happens with the quarantined emails.
511
- */
512
- quarantine_category: QuarantineCategory;
513
- };
514
- /**
515
- * Amount of quota used.
516
- */
517
- quota_used: number;
518
- /**
519
- * Percentage of mailbox quota used.
520
- */
521
- percent_in_use: number;
522
- /**
523
- * Last IMAP login time in epoch timestamp..
524
- */
525
- last_imap_login: number;
526
- /**
527
- * Last SMTP login time in epoch timestamp..
528
- */
529
- last_smtp_login: number;
530
- /**
531
- * Last POP3 login time in epoch timestamp..
532
- */
533
- last_pop3_login: number;
534
- /**
535
- * Class representation of quota usage.
536
- */
537
- percent_class: 'success' | 'warning' | 'danger';
538
- /**
539
- * Maximum possible quota.
540
- */
541
- max_new_quota: number;
542
- /**
543
- * Amount of spam aliases belonging to this mailbox.
544
- */
545
- spam_aliases: number;
546
- /**
547
- * Boolean if pushover is active.
548
- */
549
- pushover_active: boolean;
550
- /**
551
- * Relay settings.
552
- */
553
- rl: {
554
- /**
555
- * Value of the frame settings.
556
- */
557
- value: number;
558
- /**
559
- * Relay interval.
560
- */
561
- frame: RelayFrame;
562
- };
563
- /**
564
- * Scope of the relay.
565
- */
566
- rl_scope: string;
567
- /**
568
- * Boolean if the mailbox is relayed.
569
- */
570
- is_relayed: boolean;
571
- }
572
-
573
- /**
574
- * Pushover settings interface.
575
- */
576
- export interface PushoverEditAttributes {
577
- active: boolean;
578
- evaluate_x_prio: boolean;
579
- key: string;
580
- only_x_prio: boolean;
581
- senders: string;
582
- senders_regex: string;
583
- text: string;
584
- title: string;
585
- token: string;
586
- }
587
-
588
- /**
589
- * Pushover edit payload.
590
- */
591
- export interface PushoverEditRequest {
592
- /**
593
- * The attributes to edit.
594
- */
595
- attr: Partial<PushoverEditAttributes>;
596
- /**
597
- * List of mailboxes to edit.
598
- */
599
- items: string | string[];
600
- }
601
-
602
- /**
603
- * Quarantaine notification edit payload.
604
- */
605
- export interface QuarantaineEditRequest {
606
- /**
607
- * The attributes to edit.
608
- */
609
- attr: {
610
- /**
611
- * How often quarantine notifications should be sent.
612
- */
613
- quarantine_notification: QuarantineSchedule;
614
- };
615
- /**
616
- * The mailboxes to edit.
617
- */
618
- items: {
619
- anyOf: string | string[];
620
- };
621
- }
622
-
623
- /**
624
- * Spam score edit payload.
625
- */
626
- export interface SpamScoreEditRequest {
627
- /**
628
- * Mailboxes to edit.
629
- */
630
- items: string | string[];
631
- /**
632
- * The attributes to edit.
633
- */
634
- attr: {
635
- /**
636
- * The spamscore to set, should be of the form 'lowerbound, upperbound'.
637
- */
638
- spam_score: string;
639
- };
640
- }
641
-
642
- /**
643
- * List of possible userACL.
644
- */
645
- type userAcl =
646
- | 'spam_alias'
647
- | 'tls_policy'
648
- | 'spam_score'
649
- | 'spam_policy'
650
- | 'delimiter_action'
651
- | 'syncjobs'
652
- | 'eas_reset'
653
- | 'quarantine'
654
- | 'sogo_profile_reset'
655
- | 'quarantine_attachments'
656
- | 'quarantine_notification'
657
- | 'app_passwds'
658
- | 'pushover';
659
-
660
- /**
661
- * ACL Edit payload.
662
- */
663
- export interface ACLEditRequest {
664
- /**
665
- * Mailboxes to edit.
666
- */
667
- items: string | string[];
668
- /**
669
- * Attributes to set.
670
- */
671
- attr: {
672
- /**
673
- * List of ACLs to set.
674
- */
675
- user_acl: userAcl[];
676
- };
677
- }
678
-
679
- /**
680
- * Base attributes of an Alias.
681
- */
682
- export interface AliasAttributes {
683
- /**
684
- * The alias address, for catchall use "@domain.tld".
685
- */
686
- address: string;
687
- /**
688
- * The destination address, comma separated.
689
- */
690
- goto: string;
691
- /**
692
- * If true: silently ignore.
693
- */
694
- goto_null?: boolean;
695
- /**
696
- * If true: learn as spam.
697
- */
698
- goto_spam?: boolean;
699
- /**
700
- * If true: learn as ham.
701
- */
702
- goto_ham?: boolean;
703
- /**
704
- * If alias is visible in sogo.
705
- */
706
- sogo_visible: boolean;
707
- /**
708
- * If alias is active or not.
709
- */
710
- active: boolean;
711
- }
712
-
713
- /**
714
- * All attributes of an Alias you can edit.
715
- */
716
- export interface AliasEditAttributes extends Partial<AliasAttributes> {
717
- /**
718
- * The private comment of the alias.
719
- */
720
- private_comment?: string;
721
- /**
722
- * The public comment of the alias.
723
- */
724
- public_comment?: string;
725
- }
726
-
727
- /**
728
- * Alias post payload.
729
- */
730
- export type AliasPostRequest = AliasAttributes;
731
-
732
- /**
733
- * Alias update payload.
734
- */
735
- export interface AliasEditRequest {
736
- /**
737
- * List of IDs of the aliases to update.
738
- */
739
- items: number | number[];
740
- /**
741
- * The attributes to set.
742
- */
743
- attr: AliasEditAttributes;
744
- }
745
-
746
- /**
747
- * Alias delete payload.
748
- */
749
- export interface AliasDeleteRequest {
750
- /**
751
- * List of IDs of the aliases to delete.
752
- */
753
- items: number[];
754
- }
755
-
756
- /**
757
- * Interface of the Alias as returned by Mailcow.
758
- */
759
- export interface Alias extends AliasAttributes {
760
- in_primary_domain: string;
761
- /**
762
- * The ID of the alias.
763
- */
764
- id: number;
765
- /**
766
- * The domain of the alias.
767
- */
768
- domain: string;
769
- /**
770
- * The public comment of the alias.
771
- */
772
- public_comment: string;
773
- /**
774
- * The private comment of the alias.
775
- */
776
- private_comment: string;
777
- /**
778
- * Boolean if the Alias is a catch-all.
779
- */
780
- is_catch_all: boolean;
781
- /**
782
- * Int representation of the boolean.
783
- */
784
- active_int: number;
785
- /**
786
- * Int representation of the boolean.
787
- */
788
- sogo_visible_int: number;
789
- /**
790
- * Creation date of the alias.
791
- */
792
- created: string;
793
- /**
794
- * Last modified date of the alias.
795
- */
796
- modified: string | null;
797
- }
798
-
799
- /**
800
- * All the attributes of a sync job.
801
- */
802
- export interface SyncjobAttributes {
803
- /**
804
- * Your local mailcow mailbox.
805
- */
806
- username: string;
807
- /**
808
- * The smtp server where mails should be synced from.
809
- */
810
- host1: string;
811
- /**
812
- * The smtp port of the target mail server.
813
- */
814
- port1: number;
815
- /**
816
- * The password of the mailbox.
817
- */
818
- password1: string;
819
- /**
820
- * The target email account.
821
- */
822
- user1: string;
823
- /**
824
- * The encryption method used to connect to the mailserver.
825
- */
826
- enc1: 'TLS' | 'SSL' | 'PLAIN';
827
- /**
828
- * The interval in which messages should be synced.
829
- */
830
- mins_interval: number;
831
- /**
832
- * Sync into subfolder on destination (empty = do not use subfolder).
833
- */
834
- subfolder2: string;
835
- /**
836
- * Only sync messages up to this age in days.
837
- */
838
- maxage: number;
839
- /**
840
- * Max speed transfer limit for the sync.
841
- */
842
- maxbytespersecond: number;
843
- /**
844
- * Timeout for connection to remote host.
845
- */
846
- timeout1: number;
847
- /**
848
- * Timeout for connection to local host.
849
- */
850
- timeout2: number;
851
- /**
852
- * Exclude objects (regex).
853
- */
854
- exclude: string;
855
- /**
856
- * Custom parameters.
857
- */
858
- custom_params: string;
859
- /**
860
- * Delete duplicates on destination (--delete2duplicates).
861
- */
862
- delete2duplicates: boolean;
863
- /**
864
- * Delete from source when completed (--delete1).
865
- */
866
- delete1: boolean;
867
- /**
868
- * Delete messages on destination that are not on source (--delete2).
869
- */
870
- delete2: boolean;
871
- /**
872
- * Try to automap folders ("sent items", "sent" => "sent" etc.) (--automap).
873
- */
874
- automap: boolean;
875
- /**
876
- * Skip duplicate messages across folders (first come, first serve) (--skipcrossduplicates).
877
- */
878
- skipcrossduplicates: boolean;
879
- /**
880
- * Subscribe all folders (--subscribeall).
881
- */
882
- subscribeall: boolean;
883
- /**
884
- * Enables or disables the sync job.
885
- */
886
- active: boolean;
887
- }
888
-
889
- /**
890
- * Sync job creation payload.
891
- */
892
- export type SyncjobPostRequest = SyncjobAttributes;
893
-
894
- /**
895
- * Sync job delete payload.
896
- */
897
- export interface SyncjobDeleteRequest {
898
- /**
899
- * Array of IDs to delete.
900
- */
901
- items: number[];
902
- }
903
-
904
- export type SyncjobEditAttributes = Partial<SyncjobAttributes>;
905
-
906
- /**
907
- * Sync job update payload.
908
- */
909
- export interface SyncjobUpdateRequest {
910
- /**
911
- * The attributes to set.
912
- */
913
- attr: SyncjobEditAttributes;
914
- /**
915
- * List of IDs to update.
916
- */
917
- items: number | number[];
918
- }
919
-
920
- /**
921
- * Sync job as returned by the Mailcow API.
922
- */
923
- export interface Syncjob {
924
- /**
925
- * Enables or disables the sync job.
926
- */
927
- active: boolean;
928
- /**
929
- * MD5 hash of the authentication.
930
- */
931
- authmd51: boolean;
932
- /**
933
- * Authentication mechanism.
934
- */
935
- authmech1: 'TLS' | 'SSL' | 'PLAIN';
936
- /**
937
- * Try to automap folders ("sent items", "sent" => "sent" etc.) (--automap).
938
- */
939
- automap: boolean;
940
- /**
941
- * Creation date in epoch.
942
- */
943
- created: string;
944
- /**
945
- * Custom parameters.
946
- */
947
- custom_params: string;
948
- /**
949
- * Delete from source when completed (--delete1).
950
- */
951
- delete1: boolean;
952
- /**
953
- * Delete messages on destination that are not on source (--delete2).
954
- */
955
- delete2: boolean;
956
- /**
957
- * Delete duplicates on destination (--delete2duplicates).
958
- */
959
- delete2duplicates: boolean;
960
- /**
961
- * Target domain.
962
- */
963
- domain2: string;
964
- /**
965
- * The encryption method used to connect to the mailserver.
966
- */
967
- enc1: 'TLS' | 'SSL' | 'PLAIN';
968
- /**
969
- * Exclude objects (regex).
970
- */
971
- exclude: string;
972
- /**
973
- * The smtp server where mails should be synced from.
974
- */
975
- host1: string;
976
- /**
977
- * ID of the sync job.
978
- */
979
- id: number;
980
- /**
981
- * If the sync job is currently running.
982
- */
983
- is_running: boolean;
984
- /**
985
- * Date of the last run.
986
- */
987
- last_run: string;
988
- /**
989
- * Logfile
990
- */
991
- log: string;
992
- /**
993
- * Only sync messages up to this age in days.
994
- */
995
- maxage: number;
996
- /**
997
- * Max speed transfer limit for the sync.
998
- */
999
- maxbytespersecond: number;
1000
- /**
1001
- * The interval in which messages should be synced.
1002
- */
1003
- mins_interval: number;
1004
- /**
1005
- * Last modified date of the sync job..
1006
- */
1007
- modified: string | null;
1008
- /**
1009
- * Port of the source server.
1010
- */
1011
- port1: number;
1012
- /**
1013
- * Regex.
1014
- */
1015
- regextrans2: string;
1016
- /**
1017
- * If cross duplicates should be skipped.
1018
- */
1019
- skipcrossduplicates: boolean;
1020
- /**
1021
- * Subfolder on target server.
1022
- */
1023
- subfolder2: string;
1024
- /**
1025
- * If the sync job is subscribed to all mailboxes.
1026
- */
1027
- subscribeall: boolean;
1028
- /**
1029
- * Timeout for connection to remote host.
1030
- */
1031
- timeout1: number;
1032
- /**
1033
- * Timeout for connection to local host.
1034
- */
1035
- timeout2: number;
1036
- /**
1037
- * User on the remote host.
1038
- */
1039
- user1: string;
1040
- /**
1041
- * User on the local host.
1042
- */
1043
- user2: string;
1044
- }
1045
-
1046
- /**
1047
- * Forwarding host creation payload.
1048
- */
1049
- export interface ForwardingCreateRequest {
1050
- /**
1051
- * True to enable spam filter, false to disable spam filter.
1052
- */
1053
- filter_spam: boolean;
1054
-
1055
- /**
1056
- * Contains the hostname you want to add.
1057
- */
1058
- hostname: string;
1059
- }
1060
-
1061
- /**
1062
- * Forwarding host deletion payload.
1063
- */
1064
- export interface ForwardingDeleteRequest {
1065
- /**
1066
- * IPs of the forwarding hosts to delete.
1067
- */
1068
- items: string[];
1069
- }
1070
-
1071
- /**
1072
- * Forwarding host as returned by the Mailcow API.
1073
- */
1074
- export interface ForwardingHost {
1075
- /**
1076
- * IP of the forwarding host.
1077
- */
1078
- host: string;
1079
- /**
1080
- * If the host keeps or discards spam.
1081
- */
1082
- keep_spam: 'yes' | 'no';
1083
- /**
1084
- * Hostname.
1085
- */
1086
- source: string;
1087
- }
1088
-
1089
- /**
1090
- * Base Log interface
1091
- */
1092
- export interface Log {
1093
- /**
1094
- * Timestamp in Epoch format.
1095
- */
1096
- time: number;
1097
- }
1098
-
1099
- export interface ACMELog extends Log {
1100
- /**
1101
- * Log message.
1102
- */
1103
- message: string;
1104
- }
1105
-
1106
- /**
1107
- * API Log item.
1108
- */
1109
- export interface APILog extends Log {
1110
- /**
1111
- * Payload used in the API call.
1112
- */
1113
- data: string;
1114
- /**
1115
- * Request method.
1116
- */
1117
- method: 'GET' | 'POST';
1118
- /**
1119
- * IP that did the call.
1120
- */
1121
- remote: string;
1122
- /**
1123
- * API Route used.
1124
- */
1125
- uri: string;
1126
- }
1127
-
1128
- /**
1129
- * Autodiscover log item.
1130
- */
1131
- export interface ADLog extends Log {
1132
- /**
1133
- * Service used.
1134
- */
1135
- service: string;
1136
- /**
1137
- * User agent.
1138
- */
1139
- ua: string;
1140
- /**
1141
- * The user.
1142
- */
1143
- user: string;
1144
- }
1145
-
1146
- /**
1147
- * Dovecot log item.
1148
- */
1149
- export interface DCLog extends Log {
1150
- /**
1151
- * The dovecot log message.
1152
- */
1153
- message: string;
1154
- /**
1155
- * The dovecot priority level.
1156
- */
1157
- priority: string;
1158
- /**
1159
- * Program used.
1160
- */
1161
- program: string;
1162
- }
1163
-
1164
- /**
1165
- * Netfilter log item.
1166
- */
1167
- export interface NFLog extends Log {
1168
- /**
1169
- * The netfilter message.
1170
- */
1171
- message: string;
1172
- /**
1173
- * The netfilter priority level.
1174
- */
1175
- priority: string;
1176
- }
1177
-
1178
- /**
1179
- * Postfix log item.
1180
- */
1181
- export interface PFLog extends Log {
1182
- /**
1183
- * The Postfix log message.
1184
- */
1185
- message: string;
1186
- /**
1187
- * The Postfix priority level.
1188
- */
1189
- priority: string;
1190
- /**
1191
- * Program used.
1192
- */
1193
- program: string;
1194
- }
1195
-
1196
- /**
1197
- * Ratelimited log item.
1198
- */
1199
- export interface RLLog extends Log {
1200
- /**
1201
- * From email adress.
1202
- */
1203
- from: string;
1204
- /**
1205
- * Header of the from field.
1206
- */
1207
- header_from: string;
1208
- /**
1209
- * Header of the subject field.
1210
- */
1211
- header_subject: string;
1212
- /**
1213
- * IP of the sender.
1214
- */
1215
- ip: string;
1216
- /**
1217
- * ID of the message.
1218
- */
1219
- message_id: string;
1220
- /**
1221
- * QID of the message.
1222
- */
1223
- qid: string;
1224
- /**
1225
- * Recipient of the message.
1226
- */
1227
- rcpt: string;
1228
- /**
1229
- * Ratelimit hash.
1230
- */
1231
- rl_hash: string;
1232
- /**
1233
- * Ratelimit info
1234
- */
1235
- rl_info: string;
1236
- /**
1237
- * Ratelimit name
1238
- */
1239
- rl_name: string;
1240
- /**
1241
- * Sender of the message.
1242
- */
1243
- user: string;
1244
- }
1245
-
1246
- /**
1247
- * Rspamd log item.
1248
- */
1249
- export interface RSLog extends Log {
1250
- /**
1251
- * What happend to the message.
1252
- */
1253
- action: string;
1254
- /**
1255
- * Size of the message.
1256
- */
1257
- size: string;
1258
- /**
1259
- * Array of recipients SMTPs.
1260
- */
1261
- rcpt_smtp: string[];
1262
- /**
1263
- * Array of recipients MIME.
1264
- */
1265
- rcpt_mime: string[];
1266
- /**
1267
- * Object containing all the Rspamd scoring info.
1268
- */
1269
- symbols: object;
1270
- /**
1271
- * Score needed to pass.
1272
- */
1273
- required_score: string;
1274
- /**
1275
- * Message ID
1276
- */
1277
- 'message-id': string;
1278
- /**
1279
- * IP of the sender
1280
- */
1281
- ip: string;
1282
- /**
1283
- * Name of the user
1284
- */
1285
- user: string;
1286
- /**
1287
- * Time used.
1288
- */
1289
- time_real: string;
1290
- /**
1291
- * SMTP of the receiver.
1292
- */
1293
- sender_smtp: string;
1294
- /**
1295
- * If the message was skipped.
1296
- */
1297
- is_skipped: boolean;
1298
- /**
1299
- * Score of the message
1300
- */
1301
- score: number;
1302
- /**
1303
- * MIME of the sender.
1304
- */
1305
- sender_mime: string;
1306
- /**
1307
- * EPOCH time stamp.
1308
- */
1309
- unix_time: number;
1310
- /**
1311
- * Subject of the e-mail.
1312
- */
1313
- subject: string;
1314
- }
1315
-
1316
- /**
1317
- * SOGo log item.
1318
- */
1319
- export interface SGLog extends Log {
1320
- /**
1321
- * The log message.
1322
- */
1323
- message: string;
1324
- /**
1325
- * The priority level.
1326
- */
1327
- priority: string;
1328
-
1329
- program: 'sogod';
1330
- }
1331
-
1332
- /**
1333
- * Watchdog log item.
1334
- */
1335
- export interface WDLog extends Log {
1336
- /**
1337
- * Difference with previous health.
1338
- */
1339
- hpdiff: number;
1340
- /**
1341
- * Current health
1342
- */
1343
- hpnow: number;
1344
- /**
1345
- * Total health.
1346
- */
1347
- hptotal: number;
1348
- /**
1349
- * Level of the service
1350
- */
1351
- lvl: number;
1352
- /**
1353
- * Service being watched
1354
- */
1355
- service: string;
1356
- /**
1357
- * Time of report in Epoch.
1358
- */
1359
- time: number;
1360
- }
1361
-
1362
- /**
1363
- * Error class used for exception handling.
1364
- */
1365
- export class MailcowException extends Error {
1366
- /**
1367
- * The error message provided by Mailcow.
1368
- */
1369
- message: string;
1370
- }
1371
-
1372
- /**
1373
- * Interface for a general Mailcow API response.
1374
- *
1375
- * This is used when the API call doesn't return any objects, i.e. POST requests.
1376
- */
1377
- export interface BaseResponse {
1378
- log?: (string | Payload)[];
1379
- msg: string[] | string;
1380
- type: 'succes' | 'danger' | 'error';
1381
- }
1382
-
1383
- /**
1384
- * Mailcow API calls returns an array of Base Responses.
1385
- */
1386
- export type MailcowResponse = BaseResponse[];
1387
-
1388
- /**
1389
- * Interface for when the API called returned an Error.
1390
- */
1391
- export interface MailcowErrorResponse extends MailcowResponse {
1392
- msg: string;
1393
- }
1
+ /* eslint-disable camelcase */
2
+ /**
3
+ * Payloads should be JSONs.
4
+ */
5
+ export type Payload = Record<string, any> | null;
6
+
7
+ /**
8
+ * Base attributes of a domain.
9
+ */
10
+ export interface BaseDomainAttributes {
11
+ /**
12
+ * The language code associated with this domain.
13
+ */
14
+ lang:
15
+ | 'sk'
16
+ | 'cs'
17
+ | 'de'
18
+ | 'en'
19
+ | 'es'
20
+ | 'fr'
21
+ | 'lv'
22
+ | 'nl'
23
+ | 'pl'
24
+ | 'pt'
25
+ | 'ru'
26
+ | 'it'
27
+ | 'ca';
28
+ /**
29
+ * Boolean if the domain is active.
30
+ */
31
+ active: boolean;
32
+ /**
33
+ * Amount of aliases in the domain.
34
+ */
35
+ aliases: number;
36
+ /**
37
+ * Boolean to relay domain or not.
38
+ */
39
+ backupmx: number;
40
+ /**
41
+ * The predefined mailbox quota in add mailbox form
42
+ */
43
+ defquota: number;
44
+ /**
45
+ * The description of the domain.
46
+ */
47
+ description: string;
48
+ /**
49
+ * The limit count of mailboxes associated with this domain.
50
+ */
51
+ mailboxes: number;
52
+ /**
53
+ * The maximum quota per mailbox.
54
+ */
55
+ maxquota: number;
56
+ /**
57
+ * The maximum quota for this domain (sum of all mailboxes).
58
+ */
59
+ quota: number;
60
+ /**
61
+ * If not, then you have to create "dummy" mailbox for each address to relay
62
+ */
63
+ relay_all_recipients: boolean;
64
+ }
65
+
66
+ /**
67
+ * Relay interval settings.
68
+ */
69
+ type RelayFrame = 's' | 'm' | 'h' | 'd';
70
+
71
+ /**
72
+ * Domain creation payload.
73
+ */
74
+ export interface DomainPostRequest extends BaseDomainAttributes {
75
+ /**
76
+ * The domain to create.
77
+ */
78
+ domain: string;
79
+ /**
80
+ * The frame of the relay setting.
81
+ */
82
+ rl_frame: RelayFrame;
83
+ /**
84
+ * The value of the relay setting.
85
+ */
86
+ rl_value: number;
87
+ /**
88
+ * If true: sogo will restart after domain creation.
89
+ */
90
+ restart_sogo: boolean;
91
+ }
92
+
93
+ /**
94
+ * Domain delete request.
95
+ */
96
+ export interface DomainDeleteRequest {
97
+ /**
98
+ * List of domains to delete.
99
+ */
100
+ domains: string[];
101
+ }
102
+
103
+ /**
104
+ * All attributes of the domain you can edit.
105
+ */
106
+ export interface DomainEditAttributes extends BaseDomainAttributes {
107
+ /**
108
+ * Is domain global address list active or not, it enables shared contacts across domain in SOGo webmail
109
+ */
110
+ gal: boolean;
111
+ /**
112
+ * Id of the relayhost.
113
+ */
114
+ relayhost: number;
115
+ }
116
+
117
+ /**
118
+ * Domain edit request.
119
+ */
120
+ export interface DomainEditRequest {
121
+ /**
122
+ * Possible attributes you can edit.
123
+ */
124
+ attr: Partial<DomainEditAttributes>;
125
+ /**
126
+ * Domains you wish to edit.
127
+ */
128
+ items: string | string[];
129
+ }
130
+
131
+ /**
132
+ * Interface of the Domain as returned by Mailcow.
133
+ */
134
+ export interface Domain {
135
+ /**
136
+ * 0 = False, 1 = True.
137
+ */
138
+ active: number;
139
+ /**
140
+ * Amount of aliases in this domain.
141
+ */
142
+ aliases_in_domain: number;
143
+ /**
144
+ * Amount of aliases remaining in the alias quota.
145
+ */
146
+ aliases_left: number;
147
+ /**
148
+ * If backupmx is activated.
149
+ */
150
+ backupmx?: boolean;
151
+ /**
152
+ * Total amount of bytes used by this domain.
153
+ */
154
+ bytes_total?: number;
155
+ /**
156
+ * New mailbox quota.
157
+ */
158
+ def_new_mailbox_quota?: number;
159
+ /**
160
+ * Quota for a mailbox.
161
+ */
162
+ def_quota_for_mbox?: number;
163
+ /**
164
+ * Description of the domain.
165
+ */
166
+ description: string;
167
+ /**
168
+ * Name of the domain.
169
+ */
170
+ domain_name: string;
171
+ /**
172
+ * Is domain global address list active or not, it enables shared contacts across domain in SOGo webmail
173
+ */
174
+ gal: boolean;
175
+ /**
176
+ * Max quota for new mailboxes.
177
+ */
178
+ max_new_mailbox_quota?: string;
179
+ /**
180
+ * Max quota aliases on this domain.
181
+ */
182
+ max_num_aliases_for_domain?: number;
183
+ /**
184
+ * Max number of mailboxes in this domain.
185
+ */
186
+ max_num_mboxes_for_domain: number;
187
+ /**
188
+ * Max quota for this domain.
189
+ */
190
+ max_quota_for_domain: number;
191
+ /**
192
+ * Max quota for a mailbox.
193
+ */
194
+ max_quota_for_mbox: number;
195
+ /**
196
+ * Amount of mailboxes in this domain.
197
+ */
198
+ mboxes_in_domain: number;
199
+ /**
200
+ * Amount of mailboxes left in the quota.
201
+ */
202
+ mboxes_left: number;
203
+ /**
204
+ * Amount of total messages in this domain.
205
+ */
206
+ msgs_total: number;
207
+ /**
208
+ * Quota used in this domain.
209
+ */
210
+ quota_used_in_domain: number;
211
+ /**
212
+ * If all mails are relayed.
213
+ */
214
+ relay_all_recipients?: boolean;
215
+ /**
216
+ * Id of the relay host
217
+ */
218
+ relayhost?: number;
219
+ /**
220
+ * If the domain is relayed.
221
+ */
222
+ rl: boolean | { value: string; frame: string };
223
+ /**
224
+ * If XMPP is enable.d
225
+ */
226
+ xmpp: boolean;
227
+ /**
228
+ * The XMPP prefix.
229
+ */
230
+ xmpp_prefix: string;
231
+ /**
232
+ * Integer representation of the boolean.
233
+ */
234
+ gal_int: number;
235
+ /**
236
+ * Integer representation of the boolean.
237
+ */
238
+ active_int: number;
239
+ /**
240
+ * Integer representation of the boolean.
241
+ */
242
+ relay_all_recipients_int: boolean;
243
+ /**
244
+ * If the domain should only relay unknown adresses.
245
+ */
246
+ relay_unknown_only: boolean;
247
+ /**
248
+ * Integer representation of the boolean.
249
+ */
250
+ relay_unknown_only_int: boolean;
251
+ /**
252
+ * List of domain admins
253
+ */
254
+ domain_admins: string[];
255
+ }
256
+
257
+ /**
258
+ * Antispam policy creation request.
259
+ */
260
+ export interface SpamPolicyPostRequest {
261
+ /**
262
+ * Domain for which the policies applies.
263
+ */
264
+ domain: string;
265
+ /**
266
+ * The 'from' parameter off the antispam policy
267
+ */
268
+ object_from: string;
269
+ /**
270
+ * Use 'wl' for whitelist and 'bl' for blacklist.
271
+ */
272
+ object_list: 'wl' | 'bl';
273
+ }
274
+
275
+ /**
276
+ * Antispam deletion request.
277
+ */
278
+ export interface SpamPolicyDeleteRequest {
279
+ /**
280
+ * IDs of the policies to delete.
281
+ */
282
+ prefid: number[];
283
+ }
284
+
285
+ /**
286
+ * Antispam policy get request.
287
+ */
288
+ export interface SpamPolicyGetRequest {
289
+ /**
290
+ * Use 'wl' to get whitelist policies and use 'bl' to get blacklist policies.
291
+ */
292
+ type: 'wl' | 'bl';
293
+ /**
294
+ * The exact address or use wildcard to match whole domain.
295
+ */
296
+ domain: string;
297
+ }
298
+
299
+ /**
300
+ * Interface of the Antispam Policy as returned by Mailcow.
301
+ */
302
+ export interface SpamPolicy {
303
+ /**
304
+ * The domain of the policy.
305
+ */
306
+ object: string;
307
+ /**
308
+ * The address of the policy.
309
+ */
310
+ value: string;
311
+ /**
312
+ * The ID of the policy.
313
+ */
314
+ prefid: number;
315
+ }
316
+
317
+ /**
318
+ * Base attributes of a mailbox.
319
+ */
320
+ export interface BaseMailboxAttributes {
321
+ /**
322
+ * Integer representing if the mailbox is active (allows for custom states).
323
+ */
324
+ active: number;
325
+ /**
326
+ * Boolean if the user is forced to update their password on login.
327
+ */
328
+ force_pw_update: boolean;
329
+ /**
330
+ * The ull name of the mailbox user.
331
+ */
332
+ name: string;
333
+ /**
334
+ * The mailbox password.
335
+ */
336
+ password: string;
337
+ /**
338
+ * The mailbox password for confirmation.
339
+ */
340
+ password2: string;
341
+ /**
342
+ * The mailbox quota.
343
+ */
344
+ quota: number;
345
+ }
346
+
347
+ /**
348
+ * Mailbox creation request.
349
+ */
350
+ export interface MailboxPostRequest extends BaseMailboxAttributes {
351
+ /**
352
+ * The domain of the mailbox.
353
+ */
354
+ domain: string;
355
+ /**
356
+ * The local part of the mailbox.
357
+ */
358
+ local_part: string;
359
+ /**
360
+ * Boolean if inbound email encryption is forced.
361
+ */
362
+ tls_enforce_in: boolean;
363
+ /**
364
+ * Boolean if outbound email encryption is forced.
365
+ */
366
+ tls_enforce_out: boolean;
367
+ }
368
+
369
+ /**
370
+ * Mailbox deletion request.
371
+ */
372
+ export interface MailboxDeleteRequest {
373
+ /**
374
+ * List of mailboxes to delete.
375
+ */
376
+ mailboxes: string[];
377
+ }
378
+
379
+ /**
380
+ * Attributes of the mailbox you can edit.
381
+ */
382
+ export interface MailboxEditAttributes extends BaseMailboxAttributes {
383
+ /**
384
+ * List of allowed send from addresses.
385
+ */
386
+ sender_acl: string[];
387
+ /**
388
+ * Boolean iff mailbox has SOGo acces.
389
+ */
390
+ sogo_access: boolean;
391
+ }
392
+
393
+ /**
394
+ * Mailbox update request.
395
+ */
396
+ export interface MailboxEditRequest {
397
+ /**
398
+ * List of attributes you wish to update.
399
+ */
400
+ attr: Partial<MailboxEditAttributes>;
401
+ /**
402
+ * List of mailboxes to edit.
403
+ */
404
+ items: string[];
405
+ }
406
+
407
+ /**
408
+ * Possible options for the Quarantine time frames.
409
+ */
410
+ type QuarantineSchedule = 'hourly' | 'daily' | 'weekly' | 'never';
411
+
412
+ /**
413
+ * Options of what should happen if email is quarantined.
414
+ */
415
+ type QuarantineCategory = 'reject' | 'add_header' | 'all';
416
+
417
+ /**
418
+ * Interface of the Mailbox as returned by Mailcow.
419
+ */
420
+ export interface Mailbox {
421
+ /**
422
+ * The full mailbox name, equal to local_part@domain
423
+ */
424
+ username: string;
425
+ /**
426
+ * Boolean if the mailbox is active.
427
+ */
428
+ active: boolean;
429
+ /**
430
+ * Int representation of the boolean.
431
+ */
432
+ active_int: number;
433
+ /**
434
+ * Domain of the mailbox.
435
+ */
436
+ domain: string;
437
+ /**
438
+ * Boolean if XMPP is enabled for this domain.
439
+ */
440
+ domain_xmpp?: boolean;
441
+ /**
442
+ * Name of the user belonging to the mailbox.
443
+ */
444
+ name: string;
445
+ /**
446
+ * The prefix used for the XMPP login.
447
+ */
448
+ domain_xmpp_prefix?: string;
449
+ /**
450
+ * The local part of the mailbox.
451
+ */
452
+ local_part: string;
453
+ /**
454
+ * The quota of the mailbox.
455
+ */
456
+ quota: number;
457
+ /**
458
+ * Amount of messages in the mailbox.
459
+ */
460
+ messages: number;
461
+ /**
462
+ * Attributes belonging to this mailbox
463
+ */
464
+ attributes: {
465
+ /**
466
+ * Boolean if the user is forced to update their password on login.
467
+ */
468
+ force_pw_update: boolean;
469
+ /**
470
+ * Boolean if inbound email encryption is forced.
471
+ */
472
+ tls_enforce_in: boolean;
473
+ /**
474
+ * Boolean if outbound email encryption is forced.
475
+ */
476
+ tls_enforce_out: boolean;
477
+ /**
478
+ * Boolean if mailbox has SOGo acces.
479
+ */
480
+ sogo_access: boolean;
481
+ /**
482
+ * Boolean if mailbox has IMAP acces.
483
+ */
484
+ imap_access: boolean;
485
+ /**
486
+ * Boolean if mailbox has POP3 acces.
487
+ */
488
+ pop3_access: boolean;
489
+ /**
490
+ * Boolean if mailbox has SMTP acces.
491
+ */
492
+ smtp_access: boolean;
493
+ /**
494
+ * Boolean if mailbox has XMPP acces.
495
+ */
496
+ xmpp_access: boolean;
497
+ /**
498
+ * Boolean if mailbox is XMPP admin.
499
+ */
500
+ xmpp_admin: boolean;
501
+ /**
502
+ * The format of the mailbox.
503
+ */
504
+ mailbox_format: string;
505
+ /**
506
+ * The schedule on which the mailbox gets quarantine notifications.
507
+ */
508
+ quarantine_notification: QuarantineSchedule;
509
+ /**
510
+ * What happens with the quarantined emails.
511
+ */
512
+ quarantine_category: QuarantineCategory;
513
+ };
514
+ /**
515
+ * Amount of quota used.
516
+ */
517
+ quota_used: number;
518
+ /**
519
+ * Percentage of mailbox quota used.
520
+ */
521
+ percent_in_use: number;
522
+ /**
523
+ * Last IMAP login time in epoch timestamp..
524
+ */
525
+ last_imap_login: number;
526
+ /**
527
+ * Last SMTP login time in epoch timestamp..
528
+ */
529
+ last_smtp_login: number;
530
+ /**
531
+ * Last POP3 login time in epoch timestamp..
532
+ */
533
+ last_pop3_login: number;
534
+ /**
535
+ * Class representation of quota usage.
536
+ */
537
+ percent_class: 'success' | 'warning' | 'danger';
538
+ /**
539
+ * Maximum possible quota.
540
+ */
541
+ max_new_quota: number;
542
+ /**
543
+ * Amount of spam aliases belonging to this mailbox.
544
+ */
545
+ spam_aliases: number;
546
+ /**
547
+ * Boolean if pushover is active.
548
+ */
549
+ pushover_active: boolean;
550
+ /**
551
+ * Relay settings.
552
+ */
553
+ rl: {
554
+ /**
555
+ * Value of the frame settings.
556
+ */
557
+ value: number;
558
+ /**
559
+ * Relay interval.
560
+ */
561
+ frame: RelayFrame;
562
+ };
563
+ /**
564
+ * Scope of the relay.
565
+ */
566
+ rl_scope: string;
567
+ /**
568
+ * Boolean if the mailbox is relayed.
569
+ */
570
+ is_relayed: boolean;
571
+ }
572
+
573
+ /**
574
+ * Pushover settings interface.
575
+ */
576
+ export interface PushoverEditAttributes {
577
+ active: boolean;
578
+ evaluate_x_prio: boolean;
579
+ key: string;
580
+ only_x_prio: boolean;
581
+ senders: string;
582
+ senders_regex: string;
583
+ text: string;
584
+ title: string;
585
+ token: string;
586
+ }
587
+
588
+ /**
589
+ * Pushover edit payload.
590
+ */
591
+ export interface PushoverEditRequest {
592
+ /**
593
+ * The attributes to edit.
594
+ */
595
+ attr: Partial<PushoverEditAttributes>;
596
+ /**
597
+ * List of mailboxes to edit.
598
+ */
599
+ items: string | string[];
600
+ }
601
+
602
+ /**
603
+ * Quarantaine notification edit payload.
604
+ */
605
+ export interface QuarantaineEditRequest {
606
+ /**
607
+ * The attributes to edit.
608
+ */
609
+ attr: {
610
+ /**
611
+ * How often quarantine notifications should be sent.
612
+ */
613
+ quarantine_notification: QuarantineSchedule;
614
+ };
615
+ /**
616
+ * The mailboxes to edit.
617
+ */
618
+ items: {
619
+ anyOf: string | string[];
620
+ };
621
+ }
622
+
623
+ /**
624
+ * Spam score edit payload.
625
+ */
626
+ export interface SpamScoreEditRequest {
627
+ /**
628
+ * Mailboxes to edit.
629
+ */
630
+ items: string | string[];
631
+ /**
632
+ * The attributes to edit.
633
+ */
634
+ attr: {
635
+ /**
636
+ * The spamscore to set, should be of the form 'lowerbound, upperbound'.
637
+ */
638
+ spam_score: string;
639
+ };
640
+ }
641
+
642
+ /**
643
+ * List of possible userACL.
644
+ */
645
+ type userAcl =
646
+ | 'spam_alias'
647
+ | 'tls_policy'
648
+ | 'spam_score'
649
+ | 'spam_policy'
650
+ | 'delimiter_action'
651
+ | 'syncjobs'
652
+ | 'eas_reset'
653
+ | 'quarantine'
654
+ | 'sogo_profile_reset'
655
+ | 'quarantine_attachments'
656
+ | 'quarantine_notification'
657
+ | 'app_passwds'
658
+ | 'pushover';
659
+
660
+ /**
661
+ * ACL Edit payload.
662
+ */
663
+ export interface ACLEditRequest {
664
+ /**
665
+ * Mailboxes to edit.
666
+ */
667
+ items: string | string[];
668
+ /**
669
+ * Attributes to set.
670
+ */
671
+ attr: {
672
+ /**
673
+ * List of ACLs to set.
674
+ */
675
+ user_acl: userAcl[];
676
+ };
677
+ }
678
+
679
+ /**
680
+ * Base attributes of an Alias.
681
+ */
682
+ export interface AliasAttributes {
683
+ /**
684
+ * The alias address, for catchall use "@domain.tld".
685
+ */
686
+ address: string;
687
+ /**
688
+ * The destination address, comma separated.
689
+ */
690
+ goto: string;
691
+ /**
692
+ * If true: silently ignore.
693
+ */
694
+ goto_null?: boolean;
695
+ /**
696
+ * If true: learn as spam.
697
+ */
698
+ goto_spam?: boolean;
699
+ /**
700
+ * If true: learn as ham.
701
+ */
702
+ goto_ham?: boolean;
703
+ /**
704
+ * If alias is visible in sogo.
705
+ */
706
+ sogo_visible: boolean;
707
+ /**
708
+ * If alias is active or not.
709
+ */
710
+ active: boolean;
711
+ }
712
+
713
+ /**
714
+ * All attributes of an Alias you can edit.
715
+ */
716
+ export interface AliasEditAttributes extends Partial<AliasAttributes> {
717
+ /**
718
+ * The private comment of the alias.
719
+ */
720
+ private_comment?: string;
721
+ /**
722
+ * The public comment of the alias.
723
+ */
724
+ public_comment?: string;
725
+ }
726
+
727
+ /**
728
+ * Alias post payload.
729
+ */
730
+ export type AliasPostRequest = AliasAttributes;
731
+
732
+ /**
733
+ * Alias update payload.
734
+ */
735
+ export interface AliasEditRequest {
736
+ /**
737
+ * List of IDs of the aliases to update.
738
+ */
739
+ items: number | number[];
740
+ /**
741
+ * The attributes to set.
742
+ */
743
+ attr: AliasEditAttributes;
744
+ }
745
+
746
+ /**
747
+ * Alias delete payload.
748
+ */
749
+ export interface AliasDeleteRequest {
750
+ /**
751
+ * List of IDs of the aliases to delete.
752
+ */
753
+ items: number[];
754
+ }
755
+
756
+ /**
757
+ * Interface of the Alias as returned by Mailcow.
758
+ */
759
+ export interface Alias extends AliasAttributes {
760
+ in_primary_domain: string;
761
+ /**
762
+ * The ID of the alias.
763
+ */
764
+ id: number;
765
+ /**
766
+ * The domain of the alias.
767
+ */
768
+ domain: string;
769
+ /**
770
+ * The public comment of the alias.
771
+ */
772
+ public_comment: string;
773
+ /**
774
+ * The private comment of the alias.
775
+ */
776
+ private_comment: string;
777
+ /**
778
+ * Boolean if the Alias is a catch-all.
779
+ */
780
+ is_catch_all: boolean;
781
+ /**
782
+ * Int representation of the boolean.
783
+ */
784
+ active_int: number;
785
+ /**
786
+ * Int representation of the boolean.
787
+ */
788
+ sogo_visible_int: number;
789
+ /**
790
+ * Creation date of the alias.
791
+ */
792
+ created: string;
793
+ /**
794
+ * Last modified date of the alias.
795
+ */
796
+ modified: string | null;
797
+ }
798
+
799
+ /**
800
+ * All the attributes of a sync job.
801
+ */
802
+ export interface SyncjobAttributes {
803
+ /**
804
+ * Your local mailcow mailbox.
805
+ */
806
+ username: string;
807
+ /**
808
+ * The smtp server where mails should be synced from.
809
+ */
810
+ host1: string;
811
+ /**
812
+ * The smtp port of the target mail server.
813
+ */
814
+ port1: number;
815
+ /**
816
+ * The password of the mailbox.
817
+ */
818
+ password1: string;
819
+ /**
820
+ * The target email account.
821
+ */
822
+ user1: string;
823
+ /**
824
+ * The encryption method used to connect to the mailserver.
825
+ */
826
+ enc1: 'TLS' | 'SSL' | 'PLAIN';
827
+ /**
828
+ * The interval in which messages should be synced.
829
+ */
830
+ mins_interval: number;
831
+ /**
832
+ * Sync into subfolder on destination (empty = do not use subfolder).
833
+ */
834
+ subfolder2: string;
835
+ /**
836
+ * Only sync messages up to this age in days.
837
+ */
838
+ maxage: number;
839
+ /**
840
+ * Max speed transfer limit for the sync.
841
+ */
842
+ maxbytespersecond: number;
843
+ /**
844
+ * Timeout for connection to remote host.
845
+ */
846
+ timeout1: number;
847
+ /**
848
+ * Timeout for connection to local host.
849
+ */
850
+ timeout2: number;
851
+ /**
852
+ * Exclude objects (regex).
853
+ */
854
+ exclude: string;
855
+ /**
856
+ * Custom parameters.
857
+ */
858
+ custom_params: string;
859
+ /**
860
+ * Delete duplicates on destination (--delete2duplicates).
861
+ */
862
+ delete2duplicates: boolean;
863
+ /**
864
+ * Delete from source when completed (--delete1).
865
+ */
866
+ delete1: boolean;
867
+ /**
868
+ * Delete messages on destination that are not on source (--delete2).
869
+ */
870
+ delete2: boolean;
871
+ /**
872
+ * Try to automap folders ("sent items", "sent" => "sent" etc.) (--automap).
873
+ */
874
+ automap: boolean;
875
+ /**
876
+ * Skip duplicate messages across folders (first come, first serve) (--skipcrossduplicates).
877
+ */
878
+ skipcrossduplicates: boolean;
879
+ /**
880
+ * Subscribe all folders (--subscribeall).
881
+ */
882
+ subscribeall: boolean;
883
+ /**
884
+ * Enables or disables the sync job.
885
+ */
886
+ active: boolean;
887
+ }
888
+
889
+ /**
890
+ * Sync job creation payload.
891
+ */
892
+ export type SyncjobPostRequest = SyncjobAttributes;
893
+
894
+ /**
895
+ * Sync job delete payload.
896
+ */
897
+ export interface SyncjobDeleteRequest {
898
+ /**
899
+ * Array of IDs to delete.
900
+ */
901
+ items: number[];
902
+ }
903
+
904
+ export type SyncjobEditAttributes = Partial<SyncjobAttributes>;
905
+
906
+ /**
907
+ * Sync job update payload.
908
+ */
909
+ export interface SyncjobUpdateRequest {
910
+ /**
911
+ * The attributes to set.
912
+ */
913
+ attr: SyncjobEditAttributes;
914
+ /**
915
+ * List of IDs to update.
916
+ */
917
+ items: number | number[];
918
+ }
919
+
920
+ /**
921
+ * Sync job as returned by the Mailcow API.
922
+ */
923
+ export interface Syncjob {
924
+ /**
925
+ * Enables or disables the sync job.
926
+ */
927
+ active: boolean;
928
+ /**
929
+ * MD5 hash of the authentication.
930
+ */
931
+ authmd51: boolean;
932
+ /**
933
+ * Authentication mechanism.
934
+ */
935
+ authmech1: 'TLS' | 'SSL' | 'PLAIN';
936
+ /**
937
+ * Try to automap folders ("sent items", "sent" => "sent" etc.) (--automap).
938
+ */
939
+ automap: boolean;
940
+ /**
941
+ * Creation date in epoch.
942
+ */
943
+ created: string;
944
+ /**
945
+ * Custom parameters.
946
+ */
947
+ custom_params: string;
948
+ /**
949
+ * Delete from source when completed (--delete1).
950
+ */
951
+ delete1: boolean;
952
+ /**
953
+ * Delete messages on destination that are not on source (--delete2).
954
+ */
955
+ delete2: boolean;
956
+ /**
957
+ * Delete duplicates on destination (--delete2duplicates).
958
+ */
959
+ delete2duplicates: boolean;
960
+ /**
961
+ * Target domain.
962
+ */
963
+ domain2: string;
964
+ /**
965
+ * The encryption method used to connect to the mailserver.
966
+ */
967
+ enc1: 'TLS' | 'SSL' | 'PLAIN';
968
+ /**
969
+ * Exclude objects (regex).
970
+ */
971
+ exclude: string;
972
+ /**
973
+ * The smtp server where mails should be synced from.
974
+ */
975
+ host1: string;
976
+ /**
977
+ * ID of the sync job.
978
+ */
979
+ id: number;
980
+ /**
981
+ * If the sync job is currently running.
982
+ */
983
+ is_running: boolean;
984
+ /**
985
+ * Date of the last run.
986
+ */
987
+ last_run: string;
988
+ /**
989
+ * Logfile
990
+ */
991
+ log: string;
992
+ /**
993
+ * Only sync messages up to this age in days.
994
+ */
995
+ maxage: number;
996
+ /**
997
+ * Max speed transfer limit for the sync.
998
+ */
999
+ maxbytespersecond: number;
1000
+ /**
1001
+ * The interval in which messages should be synced.
1002
+ */
1003
+ mins_interval: number;
1004
+ /**
1005
+ * Last modified date of the sync job..
1006
+ */
1007
+ modified: string | null;
1008
+ /**
1009
+ * Port of the source server.
1010
+ */
1011
+ port1: number;
1012
+ /**
1013
+ * Regex.
1014
+ */
1015
+ regextrans2: string;
1016
+ /**
1017
+ * If cross duplicates should be skipped.
1018
+ */
1019
+ skipcrossduplicates: boolean;
1020
+ /**
1021
+ * Subfolder on target server.
1022
+ */
1023
+ subfolder2: string;
1024
+ /**
1025
+ * If the sync job is subscribed to all mailboxes.
1026
+ */
1027
+ subscribeall: boolean;
1028
+ /**
1029
+ * Timeout for connection to remote host.
1030
+ */
1031
+ timeout1: number;
1032
+ /**
1033
+ * Timeout for connection to local host.
1034
+ */
1035
+ timeout2: number;
1036
+ /**
1037
+ * User on the remote host.
1038
+ */
1039
+ user1: string;
1040
+ /**
1041
+ * User on the local host.
1042
+ */
1043
+ user2: string;
1044
+ }
1045
+
1046
+ /**
1047
+ * Forwarding host creation payload.
1048
+ */
1049
+ export interface ForwardingCreateRequest {
1050
+ /**
1051
+ * True to enable spam filter, false to disable spam filter.
1052
+ */
1053
+ filter_spam: boolean;
1054
+
1055
+ /**
1056
+ * Contains the hostname you want to add.
1057
+ */
1058
+ hostname: string;
1059
+ }
1060
+
1061
+ /**
1062
+ * Forwarding host deletion payload.
1063
+ */
1064
+ export interface ForwardingDeleteRequest {
1065
+ /**
1066
+ * IPs of the forwarding hosts to delete.
1067
+ */
1068
+ items: string[];
1069
+ }
1070
+
1071
+ /**
1072
+ * Forwarding host as returned by the Mailcow API.
1073
+ */
1074
+ export interface ForwardingHost {
1075
+ /**
1076
+ * IP of the forwarding host.
1077
+ */
1078
+ host: string;
1079
+ /**
1080
+ * If the host keeps or discards spam.
1081
+ */
1082
+ keep_spam: 'yes' | 'no';
1083
+ /**
1084
+ * Hostname.
1085
+ */
1086
+ source: string;
1087
+ }
1088
+
1089
+ /**
1090
+ * Base Log interface
1091
+ */
1092
+ export interface Log {
1093
+ /**
1094
+ * Timestamp in Epoch format.
1095
+ */
1096
+ time: number;
1097
+ }
1098
+
1099
+ export interface ACMELog extends Log {
1100
+ /**
1101
+ * Log message.
1102
+ */
1103
+ message: string;
1104
+ }
1105
+
1106
+ /**
1107
+ * API Log item.
1108
+ */
1109
+ export interface APILog extends Log {
1110
+ /**
1111
+ * Payload used in the API call.
1112
+ */
1113
+ data: string;
1114
+ /**
1115
+ * Request method.
1116
+ */
1117
+ method: 'GET' | 'POST';
1118
+ /**
1119
+ * IP that did the call.
1120
+ */
1121
+ remote: string;
1122
+ /**
1123
+ * API Route used.
1124
+ */
1125
+ uri: string;
1126
+ }
1127
+
1128
+ /**
1129
+ * Autodiscover log item.
1130
+ */
1131
+ export interface ADLog extends Log {
1132
+ /**
1133
+ * Service used.
1134
+ */
1135
+ service: string;
1136
+ /**
1137
+ * User agent.
1138
+ */
1139
+ ua: string;
1140
+ /**
1141
+ * The user.
1142
+ */
1143
+ user: string;
1144
+ }
1145
+
1146
+ /**
1147
+ * Dovecot log item.
1148
+ */
1149
+ export interface DCLog extends Log {
1150
+ /**
1151
+ * The dovecot log message.
1152
+ */
1153
+ message: string;
1154
+ /**
1155
+ * The dovecot priority level.
1156
+ */
1157
+ priority: string;
1158
+ /**
1159
+ * Program used.
1160
+ */
1161
+ program: string;
1162
+ }
1163
+
1164
+ /**
1165
+ * Netfilter log item.
1166
+ */
1167
+ export interface NFLog extends Log {
1168
+ /**
1169
+ * The netfilter message.
1170
+ */
1171
+ message: string;
1172
+ /**
1173
+ * The netfilter priority level.
1174
+ */
1175
+ priority: string;
1176
+ }
1177
+
1178
+ /**
1179
+ * Postfix log item.
1180
+ */
1181
+ export interface PFLog extends Log {
1182
+ /**
1183
+ * The Postfix log message.
1184
+ */
1185
+ message: string;
1186
+ /**
1187
+ * The Postfix priority level.
1188
+ */
1189
+ priority: string;
1190
+ /**
1191
+ * Program used.
1192
+ */
1193
+ program: string;
1194
+ }
1195
+
1196
+ /**
1197
+ * Ratelimited log item.
1198
+ */
1199
+ export interface RLLog extends Log {
1200
+ /**
1201
+ * From email adress.
1202
+ */
1203
+ from: string;
1204
+ /**
1205
+ * Header of the from field.
1206
+ */
1207
+ header_from: string;
1208
+ /**
1209
+ * Header of the subject field.
1210
+ */
1211
+ header_subject: string;
1212
+ /**
1213
+ * IP of the sender.
1214
+ */
1215
+ ip: string;
1216
+ /**
1217
+ * ID of the message.
1218
+ */
1219
+ message_id: string;
1220
+ /**
1221
+ * QID of the message.
1222
+ */
1223
+ qid: string;
1224
+ /**
1225
+ * Recipient of the message.
1226
+ */
1227
+ rcpt: string;
1228
+ /**
1229
+ * Ratelimit hash.
1230
+ */
1231
+ rl_hash: string;
1232
+ /**
1233
+ * Ratelimit info
1234
+ */
1235
+ rl_info: string;
1236
+ /**
1237
+ * Ratelimit name
1238
+ */
1239
+ rl_name: string;
1240
+ /**
1241
+ * Sender of the message.
1242
+ */
1243
+ user: string;
1244
+ }
1245
+
1246
+ /**
1247
+ * Rspamd log item.
1248
+ */
1249
+ export interface RSLog extends Log {
1250
+ /**
1251
+ * What happend to the message.
1252
+ */
1253
+ action: string;
1254
+ /**
1255
+ * Size of the message.
1256
+ */
1257
+ size: string;
1258
+ /**
1259
+ * Array of recipients SMTPs.
1260
+ */
1261
+ rcpt_smtp: string[];
1262
+ /**
1263
+ * Array of recipients MIME.
1264
+ */
1265
+ rcpt_mime: string[];
1266
+ /**
1267
+ * Object containing all the Rspamd scoring info.
1268
+ */
1269
+ symbols: object;
1270
+ /**
1271
+ * Score needed to pass.
1272
+ */
1273
+ required_score: string;
1274
+ /**
1275
+ * Message ID
1276
+ */
1277
+ 'message-id': string;
1278
+ /**
1279
+ * IP of the sender
1280
+ */
1281
+ ip: string;
1282
+ /**
1283
+ * Name of the user
1284
+ */
1285
+ user: string;
1286
+ /**
1287
+ * Time used.
1288
+ */
1289
+ time_real: string;
1290
+ /**
1291
+ * SMTP of the receiver.
1292
+ */
1293
+ sender_smtp: string;
1294
+ /**
1295
+ * If the message was skipped.
1296
+ */
1297
+ is_skipped: boolean;
1298
+ /**
1299
+ * Score of the message
1300
+ */
1301
+ score: number;
1302
+ /**
1303
+ * MIME of the sender.
1304
+ */
1305
+ sender_mime: string;
1306
+ /**
1307
+ * EPOCH time stamp.
1308
+ */
1309
+ unix_time: number;
1310
+ /**
1311
+ * Subject of the e-mail.
1312
+ */
1313
+ subject: string;
1314
+ }
1315
+
1316
+ /**
1317
+ * SOGo log item.
1318
+ */
1319
+ export interface SGLog extends Log {
1320
+ /**
1321
+ * The log message.
1322
+ */
1323
+ message: string;
1324
+ /**
1325
+ * The priority level.
1326
+ */
1327
+ priority: string;
1328
+
1329
+ program: 'sogod';
1330
+ }
1331
+
1332
+ /**
1333
+ * Watchdog log item.
1334
+ */
1335
+ export interface WDLog extends Log {
1336
+ /**
1337
+ * Difference with previous health.
1338
+ */
1339
+ hpdiff: number;
1340
+ /**
1341
+ * Current health
1342
+ */
1343
+ hpnow: number;
1344
+ /**
1345
+ * Total health.
1346
+ */
1347
+ hptotal: number;
1348
+ /**
1349
+ * Level of the service
1350
+ */
1351
+ lvl: number;
1352
+ /**
1353
+ * Service being watched
1354
+ */
1355
+ service: string;
1356
+ /**
1357
+ * Time of report in Epoch.
1358
+ */
1359
+ time: number;
1360
+ }
1361
+
1362
+ /**
1363
+ * Error class used for exception handling.
1364
+ */
1365
+ export class MailcowException extends Error {
1366
+ /**
1367
+ * The error message provided by Mailcow.
1368
+ */
1369
+ message: string;
1370
+ }
1371
+
1372
+ /**
1373
+ * Interface for a general Mailcow API response.
1374
+ *
1375
+ * This is used when the API call doesn't return any objects, i.e. POST requests.
1376
+ */
1377
+ export interface BaseResponse {
1378
+ log?: (string | Payload)[];
1379
+ msg: string[] | string;
1380
+ type: 'succes' | 'danger' | 'error';
1381
+ }
1382
+
1383
+ /**
1384
+ * Mailcow API calls returns an array of Base Responses.
1385
+ */
1386
+ export type MailcowResponse = BaseResponse[];
1387
+
1388
+ /**
1389
+ * Interface for when the API called returned an Error.
1390
+ */
1391
+ export interface MailcowErrorResponse extends MailcowResponse {
1392
+ msg: string;
1393
+ }