ts-mailcow-api 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +6 -150
  2. package/dist/client.d.ts +178 -0
  3. package/dist/client.js +173 -0
  4. package/dist/client.js.map +1 -0
  5. package/dist/endpoints/address-rewriting-endpoint.js +34 -0
  6. package/dist/endpoints/address-rewriting-endpoint.js.map +1 -0
  7. package/dist/{Endpoints → endpoints}/alias-endpoints.js +10 -4
  8. package/dist/endpoints/alias-endpoints.js.map +1 -0
  9. package/dist/{Endpoints → endpoints}/antispam-endpoints.js +7 -3
  10. package/dist/endpoints/antispam-endpoints.js.map +1 -0
  11. package/dist/endpoints/app-password-endpoints.d.ts +29 -0
  12. package/dist/endpoints/app-password-endpoints.js +27 -0
  13. package/dist/endpoints/app-password-endpoints.js.map +1 -0
  14. package/dist/endpoints/dkim-endpoints.d.ts +37 -0
  15. package/dist/endpoints/dkim-endpoints.js +31 -0
  16. package/dist/endpoints/dkim-endpoints.js.map +1 -0
  17. package/dist/endpoints/domain-admin-endpoints.d.ts +42 -0
  18. package/dist/endpoints/domain-admin-endpoints.js +35 -0
  19. package/dist/endpoints/domain-admin-endpoints.js.map +1 -0
  20. package/dist/{Endpoints → endpoints}/domain-endpoints.js +10 -4
  21. package/dist/endpoints/domain-endpoints.js.map +1 -0
  22. package/dist/endpoints/fail2ban-endpoints.d.ts +22 -0
  23. package/dist/endpoints/fail2ban-endpoints.js +23 -0
  24. package/dist/endpoints/fail2ban-endpoints.js.map +1 -0
  25. package/dist/{Endpoints → endpoints}/forwarding-endpoints.js +8 -3
  26. package/dist/endpoints/forwarding-endpoints.js.map +1 -0
  27. package/dist/endpoints/log-endpoints.js +50 -0
  28. package/dist/endpoints/log-endpoints.js.map +1 -0
  29. package/dist/endpoints/mailbox-endpoint.js +52 -0
  30. package/dist/endpoints/mailbox-endpoint.js.map +1 -0
  31. package/dist/endpoints/oauth2-endpoints.d.ts +31 -0
  32. package/dist/endpoints/oauth2-endpoints.js +27 -0
  33. package/dist/endpoints/oauth2-endpoints.js.map +1 -0
  34. package/dist/endpoints/quarantine-endpoints.d.ts +24 -0
  35. package/dist/endpoints/quarantine-endpoints.js +23 -0
  36. package/dist/endpoints/quarantine-endpoints.js.map +1 -0
  37. package/dist/endpoints/queue-manager-endpoints.d.ts +27 -0
  38. package/dist/endpoints/queue-manager-endpoints.js +29 -0
  39. package/dist/endpoints/queue-manager-endpoints.js.map +1 -0
  40. package/dist/endpoints/ratelimit-endpoints.d.ts +35 -0
  41. package/dist/endpoints/ratelimit-endpoints.js +32 -0
  42. package/dist/endpoints/ratelimit-endpoints.js.map +1 -0
  43. package/dist/endpoints/resource-endpoints.d.ts +19 -0
  44. package/dist/endpoints/resource-endpoints.js +22 -0
  45. package/dist/endpoints/resource-endpoints.js.map +1 -0
  46. package/dist/endpoints/routing-endpoints.d.ts +49 -0
  47. package/dist/endpoints/routing-endpoints.js +39 -0
  48. package/dist/endpoints/routing-endpoints.js.map +1 -0
  49. package/dist/endpoints/status-endpoints.d.ts +17 -0
  50. package/dist/endpoints/status-endpoints.js +22 -0
  51. package/dist/endpoints/status-endpoints.js.map +1 -0
  52. package/dist/endpoints/syncjob-endpoints.js +26 -0
  53. package/dist/endpoints/syncjob-endpoints.js.map +1 -0
  54. package/dist/endpoints/tls-policy-map-endpoints.d.ts +32 -0
  55. package/dist/endpoints/tls-policy-map-endpoints.js +27 -0
  56. package/dist/endpoints/tls-policy-map-endpoints.js.map +1 -0
  57. package/dist/index.d.ts +2 -92
  58. package/dist/index.js +2 -87
  59. package/dist/index.js.map +1 -1
  60. package/dist/types.d.ts +851 -0
  61. package/package.json +5 -5
  62. package/dist/Endpoints/address-rewriting-endpoint.js +0 -26
  63. package/dist/Endpoints/address-rewriting-endpoint.js.map +0 -1
  64. package/dist/Endpoints/alias-endpoints.js.map +0 -1
  65. package/dist/Endpoints/antispam-endpoints.js.map +0 -1
  66. package/dist/Endpoints/domain-endpoints.js.map +0 -1
  67. package/dist/Endpoints/forwarding-endpoints.js.map +0 -1
  68. package/dist/Endpoints/log-endpoints.js +0 -38
  69. package/dist/Endpoints/log-endpoints.js.map +0 -1
  70. package/dist/Endpoints/mailbox-endpoint.js +0 -41
  71. package/dist/Endpoints/mailbox-endpoint.js.map +0 -1
  72. package/dist/Endpoints/syncjob-endpoints.js +0 -20
  73. package/dist/Endpoints/syncjob-endpoints.js.map +0 -1
  74. package/index.js +0 -2
  75. package/src/Endpoints/address-rewriting-endpoint.ts +0 -74
  76. package/src/Endpoints/alias-endpoints.ts +0 -54
  77. package/src/Endpoints/antispam-endpoints.ts +0 -50
  78. package/src/Endpoints/domain-endpoints.ts +0 -54
  79. package/src/Endpoints/forwarding-endpoints.ts +0 -43
  80. package/src/Endpoints/log-endpoints.ts +0 -99
  81. package/src/Endpoints/mailbox-endpoint.ts +0 -123
  82. package/src/Endpoints/syncjob-endpoints.ts +0 -44
  83. package/src/index.ts +0 -120
  84. package/src/request-factory.ts +0 -78
  85. package/src/types.ts +0 -1489
  86. /package/dist/{Endpoints → endpoints}/address-rewriting-endpoint.d.ts +0 -0
  87. /package/dist/{Endpoints → endpoints}/alias-endpoints.d.ts +0 -0
  88. /package/dist/{Endpoints → endpoints}/antispam-endpoints.d.ts +0 -0
  89. /package/dist/{Endpoints → endpoints}/domain-endpoints.d.ts +0 -0
  90. /package/dist/{Endpoints → endpoints}/forwarding-endpoints.d.ts +0 -0
  91. /package/dist/{Endpoints → endpoints}/log-endpoints.d.ts +0 -0
  92. /package/dist/{Endpoints → endpoints}/mailbox-endpoint.d.ts +0 -0
  93. /package/dist/{Endpoints → endpoints}/syncjob-endpoints.d.ts +0 -0
package/README.md CHANGED
@@ -4,19 +4,22 @@
4
4
  [![Build Status](https://github.com/JustSamuel/ts-mailcow-api/actions/workflows/lint-and-build.yml/badge.svg)](https://github.com/JustSamuel/ts-mailcow-api/actions/workflows/lint-and-build.yml)
5
5
  [![License](https://img.shields.io/npm/l/ts-mailcow-api)](https://github.com/JustSamuel/ts-mailcow-api/blob/main/LICENSE)
6
6
  [![Downloads](https://img.shields.io/npm/dt/ts-mailcow-api)](https://www.npmjs.com/package/ts-mailcow-api)
7
+ [![GitHub Pages](https://img.shields.io/badge/view-GitHub%20Pages-blue?logo=github)](https://justsamuel.github.io/ts-mailcow-api/classes/MailcowClient.html)
7
8
 
8
9
  Provides typing and a easy to use interface for the [Mailcow API](https://mailcow.docs.apiary.io/#).
9
10
 
10
11
  ## Usage
11
12
 
12
- Create a new wrapper using the base url and API_KEY.
13
+ The interface is exposed via the `MailcowClient` class. It's typedoc reference can be found [here](https://justsamuel.github.io/ts-mailcow-api/classes/MailcowClient.html).
14
+
15
+ To use the client, create a new wrapper using the base url and API_KEY.
13
16
 
14
17
  ```ts
15
18
  import MailCowClient from "./index";
16
19
 
17
20
  // Create MailCowClient based on BASE_URL and API_KEY
18
21
  const mcc = new MailCowClient(
19
- "https://demo.mailcow.email/",
22
+ "https://demo.mailcow.email/api/v1",
20
23
  "390448-22B69F-FA37D9-19701B-6F033F",
21
24
  );
22
25
  ```
@@ -41,151 +44,4 @@ mcc.mailbox
41
44
 
42
45
  The [Mailcow OpenAPI spec](https://github.com/mailcow/mailcow-dockerized/blob/master/data/web/api/openapi.yaml) doesn’t pass validation and isn’t RESTful (e.g. `POST /api/v1/add/domain`).
43
46
  If Mailcow ever fixes the naming or structure, a generated client would break.
44
- This wrapper acts as a middleman, so those changes can be patched internally without ruining the client interface.
45
-
46
-
47
- ## API implementation progress
48
-
49
- ### Domains
50
-
51
- - [x] Create domain
52
- - [x] Delete domain
53
- - [x] Update domain
54
- - [x] Get domain
55
-
56
- ### Domain antispam policies
57
-
58
- - [x] Create domain policy
59
- - [x] Delete domain policy
60
- - [x] List blacklist/whitelist domain policy
61
-
62
- ### Mailboxes
63
-
64
- - [x] Create mailbox
65
- - [x] Delete mailbox
66
- - [x] Update mailbox
67
- - [x] Update Pushover settings
68
- - [x] Quarantine Notifications
69
- - [x] Update mailbox ACL
70
- - [x] Get mailboxes
71
- - [x] Edit mailbox spam filter score
72
- - [x] Get Active User Sieve
73
-
74
- ### Aliases
75
-
76
- - [x] Create alias
77
- - [x] Delete alias
78
- - [x] Update alias
79
- - [x] Get aliases
80
-
81
- ### Sync Jobs
82
-
83
- - [x] Create sync job
84
- - [x] Delete sync job
85
- - [x] Update sync job
86
- - [x] Get sync jobs
87
-
88
- ### Forwarding Hosts
89
-
90
- - [x] Add Forward Host
91
- - [x] Delete Forward Host
92
- - [x] Get Forwarding Hosts
93
-
94
- ### Logs
95
-
96
- - [x] Get ACME logs
97
- - [x] Get Api logs
98
- - [x] Get Autodiscover logs
99
- - [x] Get Dovecot logs
100
- - [x] Get Netfilter logs
101
- - [x] Get Postfix logs
102
- - [x] Get Ratelimit logs
103
- - [x] Get Rspamd logs
104
- - [x] Get SOGo logs
105
- - [x] Get Watchdog logs
106
-
107
- ### Address Rewriting
108
-
109
- - [x] Create BCC Map
110
- - [x] Create Recipient Map
111
- - [x] Delete BCC Map
112
- - [x] Delete Recipient Map
113
- - [x] Get BCC Map
114
- - [x] Get Recipient Map
115
-
116
- ### Queue Manager
117
-
118
- - [ ] Delete Queue
119
- - [ ] Flush Queue
120
- - [ ] Get Queue
121
-
122
- ### Quarantine
123
-
124
- - [ ] Delete mails in Quarantaine
125
- - [ ] Get mails in Quarantaine
126
-
127
- ### Fail2Ban
128
-
129
- - [ ] Edit Fail2Ban
130
- - [ ] Get Fail2Ban Config
131
-
132
- ### DKIM
133
-
134
- - [ ] Generate DKIM key
135
- - [ ] Duplicate DKIM key
136
- - [ ] Delete DKIM key
137
- - [ ] Get DKIM key
138
-
139
- ### Domain Admin
140
-
141
- - [ ] Create Domain Admin user
142
- - [ ] Edit Domain Admin ACL
143
- - [ ] Edit Domain Admin user
144
- - [ ] Delete Domain Admin
145
- - [ ] Get Domain Admins
146
-
147
- ### Outgoing TLS Policy Map Overrides
148
-
149
- - [ ] Create TLS Policy Map
150
- - [ ] Delete TLS Policy Map
151
- - [ ] Get TLS Policy Map
152
-
153
- ### oAuth Clients
154
-
155
- - [ ] Create oAuth client
156
- - [ ] Delete oAuth client
157
- - [ ] Get oAuth Clients
158
-
159
- ### Routing
160
-
161
- - [ ] Create Sender-Dependent Transports
162
- - [ ] Create Transport Maps
163
- - [ ] Delete Sender-Dependent Transports
164
- - [ ] Delete Transport Maps
165
- - [ ] Get Sender-Dependent Transports
166
- - [ ] Get Transport Maps
167
-
168
- ### Resources
169
-
170
- - [ ] Create Resources
171
- - [ ] Delete Resources
172
- - [ ] Get Resources
173
-
174
- ### App Passwords
175
-
176
- - [ ] Create App Passwords
177
- - [ ] Delete App Passwords
178
- - [ ] Get App Passwords
179
-
180
- ### Status
181
-
182
- - [ ] Get container status
183
- - [ ] Get solr status
184
- - [ ] Get vmail status
185
-
186
- ### Ratelimits
187
-
188
- - [ ] Get mailbox ratelimits
189
- - [ ] Get domain ratelimits
190
- - [ ] Edit domain ratelimits
191
- - [ ] Edit mailbox ratelimits
47
+ This wrapper acts as a middleman, so those changes can be patched internally without ruining the client interface.
@@ -0,0 +1,178 @@
1
+ /**
2
+ * @module MailcowClient
3
+ */
4
+ import { AxiosRequestConfig } from 'axios';
5
+ import { DomainEndpoints } from './endpoints/domain-endpoints';
6
+ import { AntiSpamEndpoints } from './endpoints/antispam-endpoints';
7
+ import { MailboxEndpoints } from './endpoints/mailbox-endpoint';
8
+ import RequestFactory from './request-factory';
9
+ import { AliasEndpoints } from './endpoints/alias-endpoints';
10
+ import { SyncjobEndpoints } from './endpoints/syncjob-endpoints';
11
+ import { ForwardingEndpoints } from './endpoints/forwarding-endpoints';
12
+ import { LogEndpoints } from './endpoints/log-endpoints';
13
+ import { AdressRewritingEndpoints } from './endpoints/address-rewriting-endpoint';
14
+ import { Fail2BanEndpoints } from './endpoints/fail2ban-endpoints';
15
+ import { StatusEndpoints } from './endpoints/status-endpoints';
16
+ import { ResourceEndpoints } from './endpoints/resource-endpoints';
17
+ import { QueueManagerEndpoints } from './endpoints/queue-manager-endpoints';
18
+ import { QuarantineEndpoints } from './endpoints/quarantine-endpoints';
19
+ import { RatelimitsEndpoints } from './endpoints/ratelimit-endpoints';
20
+ import { OAuth2Endpoints } from './endpoints/oauth2-endpoints';
21
+ import { AppPasswordEndpoints } from './endpoints/app-password-endpoints';
22
+ import { TlsPolicyMapEndpoints } from './endpoints/tls-policy-map-endpoints';
23
+ import { DkimEndpoints } from './endpoints/dkim-endpoints';
24
+ import { DomainAdminEndpoints } from './endpoints/domain-admin-endpoints';
25
+ import { RoutingEndpoints } from './endpoints/routing-endpoints';
26
+ /**
27
+ * Class containing all the logic to interface with the Mailcow API in TypeScript.
28
+ * @external
29
+ */
30
+ declare class MailcowClient {
31
+ /**
32
+ * The base URL of the Mailcow API.
33
+ * @internal
34
+ */
35
+ readonly BASE_URL: string;
36
+ /**
37
+ * The API key of the Mailcow API.
38
+ * @internal
39
+ */
40
+ readonly API_KEY: string;
41
+ /**
42
+ * The request config used for every request.
43
+ * @internal
44
+ */
45
+ AXIOS_CONFIG: AxiosRequestConfig;
46
+ /**
47
+ * Creates a MailcowClient using the given URL and API key.
48
+ * @param BASE_URL - The base URL of the Mailcow API.
49
+ * @param API_KEY - The API key of the Mailcow API.
50
+ * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
51
+ */
52
+ constructor(BASE_URL: string, API_KEY: string, EXTRA_AXIOS_CONFIG?: AxiosRequestConfig);
53
+ /**
54
+ * Factory method pattern for creating HTTP requests.
55
+ * @internal
56
+ */
57
+ requestFactory: RequestFactory;
58
+ /**
59
+ * All endpoints related to Aliases.
60
+ * See {@link AliasEndpoints}
61
+ */
62
+ aliases: AliasEndpoints;
63
+ /**
64
+ * All endpoints related to Domains.
65
+ * See {@link DomainEndpoints}
66
+ * @external
67
+ */
68
+ domains: DomainEndpoints;
69
+ /**
70
+ * All endpoints related to spam policies.
71
+ * See {@link AntiSpamEndpoints}
72
+ * @external
73
+ */
74
+ spamPolicy: AntiSpamEndpoints;
75
+ /**
76
+ * All endpoints related to mailboxes.
77
+ * See {@link MailboxEndpoints}
78
+ * @external
79
+ */
80
+ mailbox: MailboxEndpoints;
81
+ /**
82
+ * All endpoints related to sync jobs.
83
+ * See {@link SyncjobEndpoints}
84
+ * @external
85
+ */
86
+ syncjobs: SyncjobEndpoints;
87
+ /**
88
+ * All endpoints related to forwarding hosts.
89
+ * See {@link ForwardingEndpoints}
90
+ * @external
91
+ */
92
+ forwardingHosts: ForwardingEndpoints;
93
+ /**
94
+ * All endpoints related to address rewriting.
95
+ * See {@link AdressRewritingEndpoints}
96
+ * @external
97
+ */
98
+ addressRewriting: AdressRewritingEndpoints;
99
+ /**
100
+ * All endpoints related to logs.
101
+ * See {@link LogEndpoints}
102
+ * @external
103
+ */
104
+ logs: LogEndpoints;
105
+ /**
106
+ * All endpoints related to fail2ban.
107
+ * See {@link Fail2BanEndpoints}
108
+ * @external
109
+ */
110
+ fail2Ban: Fail2BanEndpoints;
111
+ /**
112
+ * All endpoints related to status.
113
+ * See {@link StatusEndpoints}
114
+ * @external
115
+ */
116
+ status: StatusEndpoints;
117
+ /**
118
+ * All endpoints related to resources.
119
+ * See {@link ResourceEndpoints}
120
+ * @external
121
+ */
122
+ resources: ResourceEndpoints;
123
+ /**
124
+ * All endpoints related to the mail queue.
125
+ * See {@link QueueManagerEndpoints}
126
+ * @external
127
+ */
128
+ queueManager: QueueManagerEndpoints;
129
+ /**
130
+ * All endpoints related to quarantine.
131
+ * See {@link QuarantineEndpoints}
132
+ * @external
133
+ */
134
+ quarantine: QuarantineEndpoints;
135
+ /**
136
+ * All endpoints related to rate limits.
137
+ * See {@link RatelimitsEndpoints}
138
+ * @external
139
+ */
140
+ ratelimits: RatelimitsEndpoints;
141
+ /**
142
+ * All endpoints related to OAuth2 clients.
143
+ * See {@link OAuth2Endpoints}
144
+ * @external
145
+ */
146
+ oauth2: OAuth2Endpoints;
147
+ /**
148
+ * All endpoints related to app passwords.
149
+ * See {@link AppPasswordEndpoints}
150
+ * @external
151
+ */
152
+ appPasswords: AppPasswordEndpoints;
153
+ /**
154
+ * All endpoints related to TLS Policy Maps.
155
+ * See {@link TlsPolicyMapEndpoints}
156
+ * @external
157
+ */
158
+ tlsPolicyMaps: TlsPolicyMapEndpoints;
159
+ /**
160
+ * All endpoints related to DKIM.
161
+ * See {@link DkimEndpoints}
162
+ * @external
163
+ */
164
+ dkim: DkimEndpoints;
165
+ /**
166
+ * All endpoints related to Domain Admins.
167
+ * See {@link DomainAdminEndpoints}
168
+ * @external
169
+ */
170
+ domainAdmins: DomainAdminEndpoints;
171
+ /**
172
+ * All endpoints related to Routing.
173
+ * See {@link RoutingEndpoints}
174
+ * @external
175
+ */
176
+ routing: RoutingEndpoints;
177
+ }
178
+ export default MailcowClient;
package/dist/client.js ADDED
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /**
3
+ * @module MailcowClient
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const domain_endpoints_1 = require("./endpoints/domain-endpoints");
7
+ const antispam_endpoints_1 = require("./endpoints/antispam-endpoints");
8
+ const mailbox_endpoint_1 = require("./endpoints/mailbox-endpoint");
9
+ const request_factory_1 = require("./request-factory");
10
+ const alias_endpoints_1 = require("./endpoints/alias-endpoints");
11
+ const syncjob_endpoints_1 = require("./endpoints/syncjob-endpoints");
12
+ const forwarding_endpoints_1 = require("./endpoints/forwarding-endpoints");
13
+ const log_endpoints_1 = require("./endpoints/log-endpoints");
14
+ const address_rewriting_endpoint_1 = require("./endpoints/address-rewriting-endpoint");
15
+ const fail2ban_endpoints_1 = require("./endpoints/fail2ban-endpoints");
16
+ const status_endpoints_1 = require("./endpoints/status-endpoints");
17
+ const resource_endpoints_1 = require("./endpoints/resource-endpoints");
18
+ const queue_manager_endpoints_1 = require("./endpoints/queue-manager-endpoints");
19
+ const quarantine_endpoints_1 = require("./endpoints/quarantine-endpoints");
20
+ const ratelimit_endpoints_1 = require("./endpoints/ratelimit-endpoints");
21
+ const oauth2_endpoints_1 = require("./endpoints/oauth2-endpoints");
22
+ const app_password_endpoints_1 = require("./endpoints/app-password-endpoints");
23
+ const tls_policy_map_endpoints_1 = require("./endpoints/tls-policy-map-endpoints");
24
+ const dkim_endpoints_1 = require("./endpoints/dkim-endpoints");
25
+ const domain_admin_endpoints_1 = require("./endpoints/domain-admin-endpoints");
26
+ const routing_endpoints_1 = require("./endpoints/routing-endpoints");
27
+ /**
28
+ * Class containing all the logic to interface with the Mailcow API in TypeScript.
29
+ * @external
30
+ */
31
+ class MailcowClient {
32
+ /**
33
+ * Creates a MailcowClient using the given URL and API key.
34
+ * @param BASE_URL - The base URL of the Mailcow API.
35
+ * @param API_KEY - The API key of the Mailcow API.
36
+ * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
37
+ */
38
+ constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) {
39
+ /**
40
+ * Factory method pattern for creating HTTP requests.
41
+ * @internal
42
+ */
43
+ this.requestFactory = new request_factory_1.default(this);
44
+ /**
45
+ * All endpoints related to Aliases.
46
+ * See {@link AliasEndpoints}
47
+ */
48
+ this.aliases = (0, alias_endpoints_1.aliasEndpoints)(this);
49
+ /**
50
+ * All endpoints related to Domains.
51
+ * See {@link DomainEndpoints}
52
+ * @external
53
+ */
54
+ this.domains = (0, domain_endpoints_1.domainEndpoints)(this);
55
+ /**
56
+ * All endpoints related to spam policies.
57
+ * See {@link AntiSpamEndpoints}
58
+ * @external
59
+ */
60
+ this.spamPolicy = (0, antispam_endpoints_1.antiSpamEndpoints)(this);
61
+ /**
62
+ * All endpoints related to mailboxes.
63
+ * See {@link MailboxEndpoints}
64
+ * @external
65
+ */
66
+ this.mailbox = (0, mailbox_endpoint_1.mailboxEndpoints)(this);
67
+ /**
68
+ * All endpoints related to sync jobs.
69
+ * See {@link SyncjobEndpoints}
70
+ * @external
71
+ */
72
+ this.syncjobs = (0, syncjob_endpoints_1.syncjobEndpoints)(this);
73
+ /**
74
+ * All endpoints related to forwarding hosts.
75
+ * See {@link ForwardingEndpoints}
76
+ * @external
77
+ */
78
+ this.forwardingHosts = (0, forwarding_endpoints_1.forwardingEndpoints)(this);
79
+ /**
80
+ * All endpoints related to address rewriting.
81
+ * See {@link AdressRewritingEndpoints}
82
+ * @external
83
+ */
84
+ this.addressRewriting = (0, address_rewriting_endpoint_1.addressRewritingEndpoints)(this);
85
+ /**
86
+ * All endpoints related to logs.
87
+ * See {@link LogEndpoints}
88
+ * @external
89
+ */
90
+ this.logs = (0, log_endpoints_1.logEndpoints)(this);
91
+ /**
92
+ * All endpoints related to fail2ban.
93
+ * See {@link Fail2BanEndpoints}
94
+ * @external
95
+ */
96
+ this.fail2Ban = (0, fail2ban_endpoints_1.fail2BanEndpoints)(this);
97
+ /**
98
+ * All endpoints related to status.
99
+ * See {@link StatusEndpoints}
100
+ * @external
101
+ */
102
+ this.status = (0, status_endpoints_1.statusEndpoints)(this);
103
+ /**
104
+ * All endpoints related to resources.
105
+ * See {@link ResourceEndpoints}
106
+ * @external
107
+ */
108
+ this.resources = (0, resource_endpoints_1.resourceEndpoints)(this);
109
+ /**
110
+ * All endpoints related to the mail queue.
111
+ * See {@link QueueManagerEndpoints}
112
+ * @external
113
+ */
114
+ this.queueManager = (0, queue_manager_endpoints_1.queueManagerEndpoints)(this);
115
+ /**
116
+ * All endpoints related to quarantine.
117
+ * See {@link QuarantineEndpoints}
118
+ * @external
119
+ */
120
+ this.quarantine = (0, quarantine_endpoints_1.quarantineEndpoints)(this);
121
+ /**
122
+ * All endpoints related to rate limits.
123
+ * See {@link RatelimitsEndpoints}
124
+ * @external
125
+ */
126
+ this.ratelimits = (0, ratelimit_endpoints_1.ratelimitsEndpoints)(this);
127
+ /**
128
+ * All endpoints related to OAuth2 clients.
129
+ * See {@link OAuth2Endpoints}
130
+ * @external
131
+ */
132
+ this.oauth2 = (0, oauth2_endpoints_1.oauth2Endpoints)(this);
133
+ /**
134
+ * All endpoints related to app passwords.
135
+ * See {@link AppPasswordEndpoints}
136
+ * @external
137
+ */
138
+ this.appPasswords = (0, app_password_endpoints_1.appPasswordEndpoints)(this);
139
+ /**
140
+ * All endpoints related to TLS Policy Maps.
141
+ * See {@link TlsPolicyMapEndpoints}
142
+ * @external
143
+ */
144
+ this.tlsPolicyMaps = (0, tls_policy_map_endpoints_1.tlsPolicyMapEndpoints)(this);
145
+ /**
146
+ * All endpoints related to DKIM.
147
+ * See {@link DkimEndpoints}
148
+ * @external
149
+ */
150
+ this.dkim = (0, dkim_endpoints_1.dkimEndpoints)(this);
151
+ /**
152
+ * All endpoints related to Domain Admins.
153
+ * See {@link DomainAdminEndpoints}
154
+ * @external
155
+ */
156
+ this.domainAdmins = (0, domain_admin_endpoints_1.domainAdminEndpoints)(this);
157
+ /**
158
+ * All endpoints related to Routing.
159
+ * See {@link RoutingEndpoints}
160
+ * @external
161
+ */
162
+ this.routing = (0, routing_endpoints_1.routingEndpoints)(this);
163
+ this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
164
+ this.API_KEY = API_KEY;
165
+ // Set the correct Axios request config.
166
+ this.AXIOS_CONFIG = Object.assign(Object.assign({}, EXTRA_AXIOS_CONFIG), { headers: {
167
+ 'Content-Type': 'application/json',
168
+ 'X-API-Key': this.API_KEY,
169
+ } });
170
+ }
171
+ }
172
+ exports.default = MailcowClient;
173
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addressRewritingEndpoints = addressRewritingEndpoints;
4
+ const ADDRESS_REWRITING_ENDPOINTS = {
5
+ ADD_BCC_MAP: 'add/bcc',
6
+ ADD_RECIPIENT_MAP: 'add/recipient_map',
7
+ DELETE_BCC_MAP: 'delete/bcc',
8
+ DELETE_RECIPIENT_MAP: 'delete/recipient_map',
9
+ GET_BCC_MAP: 'get/bcc',
10
+ GET_RECIPIENT_MAP: 'get/recipient_map',
11
+ };
12
+ function addressRewritingEndpoints(bind) {
13
+ return {
14
+ addBccMap(payload) {
15
+ return bind.requestFactory.post(ADDRESS_REWRITING_ENDPOINTS.ADD_BCC_MAP, payload);
16
+ },
17
+ addRecipientMap(payload) {
18
+ return bind.requestFactory.post(ADDRESS_REWRITING_ENDPOINTS.ADD_RECIPIENT_MAP, payload);
19
+ },
20
+ deleteBccMap(payload) {
21
+ return bind.requestFactory.post(ADDRESS_REWRITING_ENDPOINTS.DELETE_BCC_MAP, payload);
22
+ },
23
+ deleteRecipientMap(payload) {
24
+ return bind.requestFactory.post(ADDRESS_REWRITING_ENDPOINTS.DELETE_RECIPIENT_MAP, payload);
25
+ },
26
+ getBccMap(id) {
27
+ return bind.requestFactory.get(ADDRESS_REWRITING_ENDPOINTS.GET_BCC_MAP + `/${id}`);
28
+ },
29
+ getRecipientMap(id) {
30
+ return bind.requestFactory.get(ADDRESS_REWRITING_ENDPOINTS.GET_RECIPIENT_MAP + `/${id}`);
31
+ },
32
+ };
33
+ }
34
+ //# sourceMappingURL=address-rewriting-endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-rewriting-endpoint.js","sourceRoot":"","sources":["../../src/endpoints/address-rewriting-endpoint.ts"],"names":[],"mappings":";;AAqDA,8DAsCC;AA/CD,MAAM,2BAA2B,GAAG;IAClC,WAAW,EAAE,SAAS;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,YAAY;IAC5B,oBAAoB,EAAE,sBAAsB;IAC5C,WAAW,EAAE,SAAS;IACtB,iBAAiB,EAAE,mBAAmB;CACvC,CAAC;AAEF,SAAgB,yBAAyB,CAAC,IAAmB;IAC3D,OAAO;QACL,SAAS,CAAC,OAAyB;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,2BAA2B,CAAC,WAAW,EACvC,OAAO,CACR,CAAC;QACJ,CAAC;QAED,eAAe,CAAC,OAA+B;YAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,2BAA2B,CAAC,iBAAiB,EAC7C,OAAO,CACR,CAAC;QACJ,CAAC;QAED,YAAY,CAAC,OAA8B;YACzC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,2BAA2B,CAAC,cAAc,EAC1C,OAAO,CACR,CAAC;QACJ,CAAC;QAED,kBAAkB,CAAC,OAAoC;YACrD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,2BAA2B,CAAC,oBAAoB,EAChD,OAAO,CACR,CAAC;QACJ,CAAC;QAED,SAAS,CAAC,EAAkB;YAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAoB,2BAA2B,CAAC,WAAW,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC;QACxG,CAAC;QAED,eAAe,CAAC,EAAkB;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAA0B,2BAA2B,CAAC,iBAAiB,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC;QACpH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -2,6 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.aliasEndpoints = aliasEndpoints;
4
4
  const request_factory_1 = require("../request-factory");
5
+ const ALIAS_ENDPOINTS = {
6
+ GET: 'get/alias',
7
+ ADD: 'add/alias',
8
+ EDIT: 'edit/alias',
9
+ DELETE: 'delete/alias',
10
+ };
5
11
  /**
6
12
  * Binder function between the MailcowClient class and the AliasEndpoints.
7
13
  * @param bind - The MailcowClient to bind.
@@ -10,16 +16,16 @@ const request_factory_1 = require("../request-factory");
10
16
  function aliasEndpoints(bind) {
11
17
  return {
12
18
  get(id = 'all') {
13
- return (0, request_factory_1.wrapPromiseToArray)(bind.requestFactory.get(`/api/v1/get/alias/${id}`));
19
+ return (0, request_factory_1.wrapPromiseToArray)(bind.requestFactory.get(ALIAS_ENDPOINTS.GET + `/${id}`));
14
20
  },
15
21
  create: (payload) => {
16
- return bind.requestFactory.post('/api/v1/add/alias', payload);
22
+ return bind.requestFactory.post(ALIAS_ENDPOINTS.ADD, payload);
17
23
  },
18
24
  edit: (payload) => {
19
- return bind.requestFactory.post('/api/v1/edit/alias', payload);
25
+ return bind.requestFactory.post(ALIAS_ENDPOINTS.EDIT, payload);
20
26
  },
21
27
  delete: (payload) => {
22
- return bind.requestFactory.post('/api/v1/delete/alias', payload.items);
28
+ return bind.requestFactory.post(ALIAS_ENDPOINTS.DELETE, payload.items);
23
29
  },
24
30
  };
25
31
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/alias-endpoints.ts"],"names":[],"mappings":";;AA6CA,wCAeC;AA1DD,wDAAwD;AA+BxD,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAmB;IAChD,OAAO;QACL,GAAG,CAAC,EAAE,GAAG,KAAK;YACZ,OAAO,IAAA,oCAAkB,EAAQ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAkB,eAAe,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7G,CAAC;QACD,MAAM,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC9D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAoC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACnG,CAAC;QACD,IAAI,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAoC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpG,CAAC;QACD,MAAM,EAAE,CAAC,OAA2B,EAA4B,EAAE;YAChE,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACpG,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.antiSpamEndpoints = antiSpamEndpoints;
4
+ const ANTI_SPAM_ENDPOINTS = {
5
+ CREATE: 'add/domain-policy',
6
+ DELETE: 'delete/domain-policy',
7
+ };
4
8
  /**
5
9
  * Binder function between the MailcowClient class and the AntiSpamEndpoints
6
10
  * @param bind - The MailcowClient to bind.
@@ -9,13 +13,13 @@ exports.antiSpamEndpoints = antiSpamEndpoints;
9
13
  function antiSpamEndpoints(bind) {
10
14
  return {
11
15
  create(payload) {
12
- return bind.requestFactory.post('/api/v1/add/domain-policy', payload);
16
+ return bind.requestFactory.post(ANTI_SPAM_ENDPOINTS.CREATE, payload);
13
17
  },
14
18
  delete(payload) {
15
- return bind.requestFactory.post('/api/v1/delete/domain-policy', payload.prefid);
19
+ return bind.requestFactory.post(ANTI_SPAM_ENDPOINTS.DELETE, payload.prefid);
16
20
  },
17
21
  get(payload) {
18
- return bind.requestFactory.get(`/api/v1/get/policy_${payload.type}_domain/${payload.domain}`);
22
+ return bind.requestFactory.get(`get/policy_${payload.type}_domain/${payload.domain}`);
19
23
  },
20
24
  };
21
25
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antispam-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/antispam-endpoints.ts"],"names":[],"mappings":";;AA0CA,8CAYC;AAtBD,MAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE,mBAAmB;IAC3B,MAAM,EAAE,sBAAsB;CAC/B,CAAC;AAEF;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO;QACL,MAAM,CAAC,OAA8B;YACnC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAyC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/G,CAAC;QACD,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACzG,CAAC;QACD,GAAG,CAAC,OAA6B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAe,cAAc,OAAO,CAAC,IAAI,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACtG,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { AddAppPasswordRequest, AppPassword, DeleteAppPasswordRequest, MailcowResponse } from '../types';
2
+ import MailcowClient from '../index';
3
+ /**
4
+ * Interface for all App Password endpoints related to email handling in Mailcow.
5
+ */
6
+ export interface AppPasswordEndpoints {
7
+ /**
8
+ * Adds a new app password.
9
+ * @param payload - Object containing the app password details.
10
+ */
11
+ add(payload: AddAppPasswordRequest): Promise<MailcowResponse>;
12
+ /**
13
+ * Deletes specified app passwords.
14
+ * @param payload - Object containing a list of app password IDs to delete.
15
+ */
16
+ delete(payload: DeleteAppPasswordRequest): Promise<MailcowResponse>;
17
+ /**
18
+ * Retrieves app passwords for a specific mailbox.
19
+ * @param mailbox - The mailbox for which to retrieve app passwords.
20
+ * @returns A promise that resolves to an array of `AppPassword` objects.
21
+ */
22
+ get(mailbox: string): Promise<AppPassword[]>;
23
+ }
24
+ /**
25
+ * Binder function between the MailcowClient class and the AppPasswordEndpoints.
26
+ * @param bind - The MailcowClient instance to bind.
27
+ * @internal
28
+ */
29
+ export declare function appPasswordEndpoints(bind: MailcowClient): AppPasswordEndpoints;