ts-mailcow-api 0.6.2 → 0.8.1

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