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.
- package/README.md +147 -147
- package/dist/Endpoints/alias-endpoints.d.ts +20 -17
- package/dist/Endpoints/alias-endpoints.js +6 -1
- package/dist/Endpoints/alias-endpoints.js.map +1 -1
- package/dist/Endpoints/antispam-endpoints.d.ts +25 -4
- package/dist/Endpoints/antispam-endpoints.js +8 -2
- package/dist/Endpoints/antispam-endpoints.js.map +1 -1
- package/dist/Endpoints/domain-endpoints.d.ts +29 -4
- package/dist/Endpoints/domain-endpoints.js +12 -5
- package/dist/Endpoints/domain-endpoints.js.map +1 -1
- package/dist/Endpoints/forwarding-endpoints.d.ts +27 -0
- package/dist/Endpoints/forwarding-endpoints.js +23 -0
- package/dist/Endpoints/forwarding-endpoints.js.map +1 -0
- package/dist/Endpoints/log-endpoints.d.ts +55 -0
- package/dist/Endpoints/log-endpoints.js +39 -0
- package/dist/Endpoints/log-endpoints.js.map +1 -0
- package/dist/Endpoints/mailbox-endpoint.d.ts +50 -5
- package/dist/Endpoints/mailbox-endpoint.js +13 -6
- package/dist/Endpoints/mailbox-endpoint.js.map +1 -1
- package/dist/Endpoints/syncjob-endpoints.d.ts +24 -0
- package/dist/Endpoints/syncjob-endpoints.js +21 -0
- package/dist/Endpoints/syncjob-endpoints.js.map +1 -0
- package/dist/index.d.ts +54 -23
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/request-factory.d.ts +5 -0
- package/dist/request-factory.js +10 -0
- package/dist/request-factory.js.map +1 -1
- package/dist/types.d.ts +1102 -47
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/src/Endpoints/alias-endpoints.ts +25 -21
- package/src/Endpoints/antispam-endpoints.ts +33 -4
- package/src/Endpoints/domain-endpoints.ts +50 -10
- package/src/Endpoints/forwarding-endpoints.ts +51 -0
- package/src/Endpoints/log-endpoints.ts +130 -0
- package/src/Endpoints/mailbox-endpoint.ts +74 -8
- package/src/Endpoints/syncjob-endpoints.ts +55 -0
- package/src/index.ts +58 -9
- package/src/request-factory.ts +10 -0
- package/src/types.ts +1149 -57
package/README.md
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
# TypeScript wrapper for the mailcow API.
|
|
2
|
-
|
|
3
|
-
Provides typing and a easy to use interface for the [Mailcow API](https://mailcow.docs.apiary.io/#).
|
|
4
|
-
## Usage
|
|
5
|
-
Create a new wrapper using the base url and API_KEY.
|
|
6
|
-
```ts
|
|
7
|
-
import MailCowClient from "./index";
|
|
8
|
-
|
|
9
|
-
// Create MailCowClient based on BASE_URL and API_KEY
|
|
10
|
-
const mcc = new MailCowClient("https://demo.mailcow.email/
|
|
11
|
-
```
|
|
12
|
-
Then you can use the created wrapper for promised-based API calls according to the Mailcow API specification.
|
|
13
|
-
```ts
|
|
14
|
-
// Get all the mailboxes available.
|
|
15
|
-
mcc.mailbox.get().then((e) => {
|
|
16
|
-
// Print all mailboxes.
|
|
17
|
-
console.log(JSON.stringify(e, null, 4));
|
|
18
|
-
}).catch(e => {
|
|
19
|
-
// Error handling.
|
|
20
|
-
console.log(e)
|
|
21
|
-
})
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## API implementation progress
|
|
25
|
-
### Domains
|
|
26
|
-
- [x] Create domain
|
|
27
|
-
- [x] Delete domain
|
|
28
|
-
- [x] Update domain
|
|
29
|
-
- [x] Get domain
|
|
30
|
-
|
|
31
|
-
### Domain antispam policies
|
|
32
|
-
- [x] Create domain policy
|
|
33
|
-
- [x] Delete domain policy
|
|
34
|
-
- [x] List blacklist/whitelist domain policy
|
|
35
|
-
|
|
36
|
-
### Mailboxes
|
|
37
|
-
- [x] Create mailbox
|
|
38
|
-
- [x] Delete mailbox
|
|
39
|
-
- [x] Update mailbox
|
|
40
|
-
- [x] Update Pushover settings
|
|
41
|
-
- [x] Quarantine Notifications
|
|
42
|
-
- [x] Update mailbox ACL
|
|
43
|
-
- [x] Get mailboxes
|
|
44
|
-
- [x] Edit mailbox spam filter score
|
|
45
|
-
- [x] Get Active User Sieve
|
|
46
|
-
|
|
47
|
-
### Aliases
|
|
48
|
-
- [x] Create alias
|
|
49
|
-
- [x] Delete alias
|
|
50
|
-
- [x] Update alias
|
|
51
|
-
- [x] Get aliases
|
|
52
|
-
|
|
53
|
-
### Sync Jobs
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
|
|
59
|
-
### Forwarding Hosts
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
|
|
64
|
-
### Logs
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
75
|
-
|
|
76
|
-
### Queue Manager
|
|
77
|
-
- [ ] Delete Queue
|
|
78
|
-
- [ ] Flush Queue
|
|
79
|
-
- [ ] Get Queue
|
|
80
|
-
|
|
81
|
-
### Quarantine
|
|
82
|
-
- [ ] Delete mails in Quarantaine
|
|
83
|
-
- [ ] Get mails in Quarantaine
|
|
84
|
-
|
|
85
|
-
### Fail2Ban
|
|
86
|
-
- [ ] Edit Fail2Ban
|
|
87
|
-
- [ ] Get Fail2Ban Config
|
|
88
|
-
|
|
89
|
-
### DKIM
|
|
90
|
-
- [ ] Generate DKIM key
|
|
91
|
-
- [ ] Duplicate DKIM key
|
|
92
|
-
- [ ] Delete DKIM key
|
|
93
|
-
- [ ] Get DKIM key
|
|
94
|
-
|
|
95
|
-
### Domain Admin
|
|
96
|
-
- [ ] Create Domain Admin user
|
|
97
|
-
- [ ] Edit Domain Admin ACL
|
|
98
|
-
- [ ] Edit Domain Admin user
|
|
99
|
-
- [ ] Delete Domain Admin
|
|
100
|
-
- [ ] Get Domain Admins
|
|
101
|
-
|
|
102
|
-
### Address Rewriting
|
|
103
|
-
- [ ] Create BCC Map
|
|
104
|
-
- [ ] Create Recipient Map
|
|
105
|
-
- [ ] Delete BCC Map
|
|
106
|
-
- [ ] Delete Recipient Map
|
|
107
|
-
- [ ] Get BCC Map
|
|
108
|
-
- [ ] Get Recipient Map
|
|
109
|
-
|
|
110
|
-
### Outgoing TLS Policy Map Overrides
|
|
111
|
-
- [ ] Create TLS Policy Map
|
|
112
|
-
- [ ] Delete TLS Policy Map
|
|
113
|
-
- [ ] Get TLS Policy Map
|
|
114
|
-
|
|
115
|
-
### oAuth Clients
|
|
116
|
-
- [ ] Create oAuth client
|
|
117
|
-
- [ ] Delete oAuth client
|
|
118
|
-
- [ ] Get oAuth Clients
|
|
119
|
-
|
|
120
|
-
### Routing
|
|
121
|
-
- [ ] Create Sender-Dependent Transports
|
|
122
|
-
- [ ] Create Transport Maps
|
|
123
|
-
- [ ] Delete Sender-Dependent Transports
|
|
124
|
-
- [ ] Delete Transport Maps
|
|
125
|
-
- [ ] Get Sender-Dependent Transports
|
|
126
|
-
- [ ] Get Transport Maps
|
|
127
|
-
|
|
128
|
-
### Resources
|
|
129
|
-
- [ ] Create Resources
|
|
130
|
-
- [ ] Delete Resources
|
|
131
|
-
- [ ] Get Resources
|
|
132
|
-
|
|
133
|
-
### App Passwords
|
|
134
|
-
- [ ] Create App Passwords
|
|
135
|
-
- [ ] Delete App Passwords
|
|
136
|
-
- [ ] Get App Passwords
|
|
137
|
-
|
|
138
|
-
### Status
|
|
139
|
-
- [ ] Get container status
|
|
140
|
-
- [ ] Get solr status
|
|
141
|
-
- [ ] Get vmail status
|
|
142
|
-
|
|
143
|
-
### Ratelimits
|
|
144
|
-
- [ ] Get mailbox ratelimits
|
|
145
|
-
- [ ] Get domain ratelimits
|
|
146
|
-
- [ ] Edit domain ratelimits
|
|
147
|
-
- [ ] Edit mailbox ratelimits
|
|
1
|
+
# TypeScript wrapper for the mailcow API.
|
|
2
|
+
|
|
3
|
+
Provides typing and a easy to use interface for the [Mailcow API](https://mailcow.docs.apiary.io/#).
|
|
4
|
+
## Usage
|
|
5
|
+
Create a new wrapper using the base url and API_KEY.
|
|
6
|
+
```ts
|
|
7
|
+
import MailCowClient from "./index";
|
|
8
|
+
|
|
9
|
+
// Create MailCowClient based on BASE_URL and API_KEY
|
|
10
|
+
const mcc = new MailCowClient("https://demo.mailcow.email/", "390448-22B69F-FA37D9-19701B-6F033F");
|
|
11
|
+
```
|
|
12
|
+
Then you can use the created wrapper for promised-based API calls according to the Mailcow API specification.
|
|
13
|
+
```ts
|
|
14
|
+
// Get all the mailboxes available.
|
|
15
|
+
mcc.mailbox.get().then((e) => {
|
|
16
|
+
// Print all mailboxes.
|
|
17
|
+
console.log(JSON.stringify(e, null, 4));
|
|
18
|
+
}).catch(e => {
|
|
19
|
+
// Error handling.
|
|
20
|
+
console.log(e)
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API implementation progress
|
|
25
|
+
### Domains
|
|
26
|
+
- [x] Create domain
|
|
27
|
+
- [x] Delete domain
|
|
28
|
+
- [x] Update domain
|
|
29
|
+
- [x] Get domain
|
|
30
|
+
|
|
31
|
+
### Domain antispam policies
|
|
32
|
+
- [x] Create domain policy
|
|
33
|
+
- [x] Delete domain policy
|
|
34
|
+
- [x] List blacklist/whitelist domain policy
|
|
35
|
+
|
|
36
|
+
### Mailboxes
|
|
37
|
+
- [x] Create mailbox
|
|
38
|
+
- [x] Delete mailbox
|
|
39
|
+
- [x] Update mailbox
|
|
40
|
+
- [x] Update Pushover settings
|
|
41
|
+
- [x] Quarantine Notifications
|
|
42
|
+
- [x] Update mailbox ACL
|
|
43
|
+
- [x] Get mailboxes
|
|
44
|
+
- [x] Edit mailbox spam filter score
|
|
45
|
+
- [x] Get Active User Sieve
|
|
46
|
+
|
|
47
|
+
### Aliases
|
|
48
|
+
- [x] Create alias
|
|
49
|
+
- [x] Delete alias
|
|
50
|
+
- [x] Update alias
|
|
51
|
+
- [x] Get aliases
|
|
52
|
+
|
|
53
|
+
### Sync Jobs
|
|
54
|
+
- [x] Create sync job
|
|
55
|
+
- [x] Delete sync job
|
|
56
|
+
- [x] Update sync job
|
|
57
|
+
- [x] Get sync jobs
|
|
58
|
+
|
|
59
|
+
### Forwarding Hosts
|
|
60
|
+
- [x] Add Forward Host
|
|
61
|
+
- [x] Delete Forward Host
|
|
62
|
+
- [x] Get Forwarding Hosts
|
|
63
|
+
|
|
64
|
+
### Logs
|
|
65
|
+
- [x] Get ACME logs
|
|
66
|
+
- [x] Get Api logs
|
|
67
|
+
- [x] Get Autodiscover logs
|
|
68
|
+
- [x] Get Dovecot logs
|
|
69
|
+
- [x] Get Netfilter logs
|
|
70
|
+
- [x] Get Postfix logs
|
|
71
|
+
- [x] Get Ratelimit logs
|
|
72
|
+
- [x] Get Rspamd logs
|
|
73
|
+
- [x] Get SOGo logs
|
|
74
|
+
- [x] Get Watchdog logs
|
|
75
|
+
|
|
76
|
+
### Queue Manager
|
|
77
|
+
- [ ] Delete Queue
|
|
78
|
+
- [ ] Flush Queue
|
|
79
|
+
- [ ] Get Queue
|
|
80
|
+
|
|
81
|
+
### Quarantine
|
|
82
|
+
- [ ] Delete mails in Quarantaine
|
|
83
|
+
- [ ] Get mails in Quarantaine
|
|
84
|
+
|
|
85
|
+
### Fail2Ban
|
|
86
|
+
- [ ] Edit Fail2Ban
|
|
87
|
+
- [ ] Get Fail2Ban Config
|
|
88
|
+
|
|
89
|
+
### DKIM
|
|
90
|
+
- [ ] Generate DKIM key
|
|
91
|
+
- [ ] Duplicate DKIM key
|
|
92
|
+
- [ ] Delete DKIM key
|
|
93
|
+
- [ ] Get DKIM key
|
|
94
|
+
|
|
95
|
+
### Domain Admin
|
|
96
|
+
- [ ] Create Domain Admin user
|
|
97
|
+
- [ ] Edit Domain Admin ACL
|
|
98
|
+
- [ ] Edit Domain Admin user
|
|
99
|
+
- [ ] Delete Domain Admin
|
|
100
|
+
- [ ] Get Domain Admins
|
|
101
|
+
|
|
102
|
+
### Address Rewriting
|
|
103
|
+
- [ ] Create BCC Map
|
|
104
|
+
- [ ] Create Recipient Map
|
|
105
|
+
- [ ] Delete BCC Map
|
|
106
|
+
- [ ] Delete Recipient Map
|
|
107
|
+
- [ ] Get BCC Map
|
|
108
|
+
- [ ] Get Recipient Map
|
|
109
|
+
|
|
110
|
+
### Outgoing TLS Policy Map Overrides
|
|
111
|
+
- [ ] Create TLS Policy Map
|
|
112
|
+
- [ ] Delete TLS Policy Map
|
|
113
|
+
- [ ] Get TLS Policy Map
|
|
114
|
+
|
|
115
|
+
### oAuth Clients
|
|
116
|
+
- [ ] Create oAuth client
|
|
117
|
+
- [ ] Delete oAuth client
|
|
118
|
+
- [ ] Get oAuth Clients
|
|
119
|
+
|
|
120
|
+
### Routing
|
|
121
|
+
- [ ] Create Sender-Dependent Transports
|
|
122
|
+
- [ ] Create Transport Maps
|
|
123
|
+
- [ ] Delete Sender-Dependent Transports
|
|
124
|
+
- [ ] Delete Transport Maps
|
|
125
|
+
- [ ] Get Sender-Dependent Transports
|
|
126
|
+
- [ ] Get Transport Maps
|
|
127
|
+
|
|
128
|
+
### Resources
|
|
129
|
+
- [ ] Create Resources
|
|
130
|
+
- [ ] Delete Resources
|
|
131
|
+
- [ ] Get Resources
|
|
132
|
+
|
|
133
|
+
### App Passwords
|
|
134
|
+
- [ ] Create App Passwords
|
|
135
|
+
- [ ] Delete App Passwords
|
|
136
|
+
- [ ] Get App Passwords
|
|
137
|
+
|
|
138
|
+
### Status
|
|
139
|
+
- [ ] Get container status
|
|
140
|
+
- [ ] Get solr status
|
|
141
|
+
- [ ] Get vmail status
|
|
142
|
+
|
|
143
|
+
### Ratelimits
|
|
144
|
+
- [ ] Get mailbox ratelimits
|
|
145
|
+
- [ ] Get domain ratelimits
|
|
146
|
+
- [ ] Edit domain ratelimits
|
|
147
|
+
- [ ] Edit mailbox ratelimits
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { Alias, AliasDeleteRequest, AliasPostRequest,
|
|
1
|
+
import { Alias, AliasDeleteRequest, AliasPostRequest, AliasEditRequest, MailcowResponse } from '../types';
|
|
2
2
|
import MailcowClient from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for all Alias endpoints.
|
|
5
|
+
*/
|
|
3
6
|
export interface AliasEndpoints {
|
|
4
7
|
/**
|
|
5
8
|
* Endpoint for getting mailbox aliases in the system.
|
|
6
9
|
* @param id - The id of the alias you want to get. Use 'all' to retrieve all aliases in the system.
|
|
7
|
-
*
|
|
8
|
-
* @example Get all aliases:
|
|
9
|
-
* ```typescript
|
|
10
|
-
* mcc.aliases.get('all').then((res) => { console.log(res); });
|
|
11
|
-
* ```
|
|
12
|
-
* @example Get a single alias:
|
|
13
|
-
* ```typescript
|
|
14
|
-
* mcc.aliases.get(8).then((res) => { console.log(res); });
|
|
15
|
-
* ```
|
|
16
10
|
*/
|
|
17
|
-
get
|
|
11
|
+
get(id?: number | 'all'): Promise<Alias[]>;
|
|
18
12
|
/**
|
|
19
13
|
* Endpoint for creating mailbox aliases.
|
|
20
|
-
* @param payload -
|
|
14
|
+
* @param payload - The creation payload.
|
|
21
15
|
*/
|
|
22
|
-
create
|
|
16
|
+
create(payload: AliasPostRequest): Promise<MailcowResponse>;
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param payload -
|
|
18
|
+
* Endpoint for editing a mailbox alias.
|
|
19
|
+
* @param payload - The edit payload.
|
|
26
20
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
edit(payload: AliasEditRequest): Promise<MailcowResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Endpoint for deleting a mailbox alias.
|
|
24
|
+
* @param payload - The deletion payload.
|
|
25
|
+
*/
|
|
26
|
+
delete(payload: AliasDeleteRequest): Promise<MailcowResponse>;
|
|
29
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Binder function between the MailcowClient class and the AliasEndpoints.
|
|
30
|
+
* @param bind - The MailcowClient to bind.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
30
33
|
export declare function aliasEndpoints(bind: MailcowClient): AliasEndpoints;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.aliasEndpoints = void 0;
|
|
4
4
|
const request_factory_1 = require("../request-factory");
|
|
5
|
+
/**
|
|
6
|
+
* Binder function between the MailcowClient class and the AliasEndpoints.
|
|
7
|
+
* @param bind - The MailcowClient to bind.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
5
10
|
function aliasEndpoints(bind) {
|
|
6
11
|
return {
|
|
7
12
|
get(id = 'all') {
|
|
@@ -10,7 +15,7 @@ function aliasEndpoints(bind) {
|
|
|
10
15
|
create: (payload) => {
|
|
11
16
|
return bind.requestFactory.post('/api/v1/add/alias', payload);
|
|
12
17
|
},
|
|
13
|
-
|
|
18
|
+
edit: (payload) => {
|
|
14
19
|
return bind.requestFactory.post('/api/v1/edit/alias', payload);
|
|
15
20
|
},
|
|
16
21
|
delete: (payload) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/alias-endpoints.ts"],"names":[],"mappings":";;;AAQA,wDAAwD;AA+BxD,SAAgB,cAAc,CAAC,IAAmB;IAChD,OAAO;QACL,GAAG,CAAC,EAAE,GAAG,KAAK;YACZ,OAAO,oCAAkB,CACvB,IAAI,CAAC,cAAc,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"alias-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/alias-endpoints.ts"],"names":[],"mappings":";;;AAQA,wDAAwD;AA+BxD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAmB;IAChD,OAAO;QACL,GAAG,CAAC,EAAE,GAAG,KAAK;YACZ,OAAO,oCAAkB,CACvB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAkB,qBAAqB,EAAE,EAAE,CAAC,CACpE,CAAC;QACJ,CAAC;QACD,MAAM,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC9D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,mBAAmB,EACnB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,IAAI,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,oBAAoB,EACpB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,MAAM,EAAE,CAAC,OAA2B,EAA4B,EAAE;YAChE,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,sBAAsB,EACtB,OAAO,CAAC,KAAK,CACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA1BD,wCA0BC"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import { SpamPolicyDeleteRequest, SpamPolicyPostRequest, MailcowResponse, SpamPolicyGetRequest,
|
|
1
|
+
import { SpamPolicyDeleteRequest, SpamPolicyPostRequest, MailcowResponse, SpamPolicyGetRequest, SpamPolicy } from '../types';
|
|
2
2
|
import MailcowClient from '../index';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Interface for all antispam policies.
|
|
5
|
+
*/
|
|
6
|
+
export interface AntiSpamEndpoints {
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint for getting antispam policies.
|
|
9
|
+
* @param payload - The get payload.
|
|
10
|
+
*/
|
|
11
|
+
get(payload: SpamPolicyGetRequest): Promise<SpamPolicy[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Endpoint for creating antispam policies.
|
|
14
|
+
* @param payload - The creation payload.
|
|
15
|
+
*/
|
|
4
16
|
create(payload: SpamPolicyPostRequest): Promise<MailcowResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Endpoint for deleting antispam policies.
|
|
19
|
+
* @param payload - The deletion payload.
|
|
20
|
+
*/
|
|
5
21
|
delete(payload: SpamPolicyDeleteRequest): Promise<MailcowResponse>;
|
|
6
|
-
|
|
7
|
-
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Binder function between the MailcowClient class and the AntiSpamEndpoints
|
|
25
|
+
* @param bind - The MailcowClient to bind.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function antiSpamEndpoints(bind: MailcowClient): AntiSpamEndpoints;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.antiSpamEndpoints = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Binder function between the MailcowClient class and the AntiSpamEndpoints
|
|
6
|
+
* @param bind - The MailcowClient to bind.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function antiSpamEndpoints(bind) {
|
|
4
10
|
return {
|
|
5
11
|
create(payload) {
|
|
6
12
|
return bind.requestFactory.post('/api/v1/add/domain-policy', payload);
|
|
@@ -13,5 +19,5 @@ function AntiSpamEndpoints(bind) {
|
|
|
13
19
|
}
|
|
14
20
|
};
|
|
15
21
|
}
|
|
16
|
-
exports.
|
|
22
|
+
exports.antiSpamEndpoints = antiSpamEndpoints;
|
|
17
23
|
//# sourceMappingURL=antispam-endpoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antispam-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/antispam-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"antispam-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/antispam-endpoints.ts"],"names":[],"mappings":";;;AAiCA;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO;QACL,MAAM,CAAC,OAA8B;YACnC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,2BAA2B,EAC3B,OAAO,CACR,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,8BAA8B,EAC9B,OAAO,CAAC,MAAM,CACf,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,OAA6B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,sBAAuB,OAAO,CAAC,IAAK,WAAY,OAAO,CAAC,MAAO,EAAE,CAClE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AApBD,8CAoBC"}
|
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
import { DomainDeleteRequest, DomainEditRequest, DomainPostRequest,
|
|
1
|
+
import { DomainDeleteRequest, DomainEditRequest, DomainPostRequest, Domain, MailcowResponse } from '../types';
|
|
2
2
|
import MailcowClient from '../index';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Interface for all Domain endpoints.
|
|
5
|
+
*/
|
|
6
|
+
export interface DomainEndpoints {
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint for getting domains.
|
|
9
|
+
* @param domain - Name of the domain to get.
|
|
10
|
+
*/
|
|
11
|
+
get(domain: string): Promise<Domain[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Endpoint for creating domains.
|
|
14
|
+
* @param payload - The creation payload.
|
|
15
|
+
*/
|
|
4
16
|
create(payload: DomainPostRequest): Promise<MailcowResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Endpoint for deleting a domain.
|
|
19
|
+
* @param payload - The deletion payload.
|
|
20
|
+
*/
|
|
5
21
|
delete(payload: DomainDeleteRequest): Promise<MailcowResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Endpoint for editing a domain.
|
|
24
|
+
* @param payload - The edit payload.
|
|
25
|
+
*/
|
|
6
26
|
edit(payload: DomainEditRequest): Promise<MailcowResponse>;
|
|
7
|
-
|
|
8
|
-
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Binder function between the MailcowClient class and the DomainEndpoints.
|
|
30
|
+
* @param bind - The MailcowClient to bind.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare function domainEndpoints(bind: MailcowClient): DomainEndpoints;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.domainEndpoints = void 0;
|
|
4
|
+
const request_factory_1 = require("../request-factory");
|
|
5
|
+
/**
|
|
6
|
+
* Binder function between the MailcowClient class and the DomainEndpoints.
|
|
7
|
+
* @param bind - The MailcowClient to bind.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function domainEndpoints(bind) {
|
|
4
11
|
return {
|
|
12
|
+
get(domain = 'all') {
|
|
13
|
+
return request_factory_1.wrapPromiseToArray(bind.requestFactory.get(`/api/v1/get/domain/${domain}`));
|
|
14
|
+
},
|
|
5
15
|
create(payload) {
|
|
6
16
|
return bind.requestFactory.post('/api/v1/add/domain', payload);
|
|
7
17
|
},
|
|
@@ -10,11 +20,8 @@ function DomainEndpoints(bind) {
|
|
|
10
20
|
},
|
|
11
21
|
edit(payload) {
|
|
12
22
|
return bind.requestFactory.post('/api/v1/edit/domain', payload);
|
|
13
|
-
},
|
|
14
|
-
get(domain = 'all') {
|
|
15
|
-
return bind.requestFactory.get(`/api/v1/get/domain/${domain}`);
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
|
-
exports.
|
|
26
|
+
exports.domainEndpoints = domainEndpoints;
|
|
20
27
|
//# sourceMappingURL=domain-endpoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/domain-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domain-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/domain-endpoints.ts"],"names":[],"mappings":";;;AAQA,wDAAwD;AA+BxD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAmB;IACjD,OAAO;QACL,GAAG,CAAC,SAAiB,KAAK;YACxB,OAAO,oCAAkB,CACvB,IAAI,CAAC,cAAc,CAAC,GAAG,CACrB,sBAAuB,MAAO,EAAE,CACjC,CACF,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAA0B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,oBAAoB,EACpB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAA4B;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,uBAAuB,EACvB,OAAO,CAAC,OAAO,CAChB,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAA0B;YAC7B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,qBAAqB,EACrB,OAAO,CACR,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA5BD,0CA4BC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import { ForwardingCreateRequest, ForwardingDeleteRequest, ForwardingHost, MailcowResponse } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for all Forwarding Hosts endpoints.
|
|
5
|
+
*/
|
|
6
|
+
export interface ForwardingEndpoints {
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint for deleting forwarding host.
|
|
9
|
+
* @param payload - The deletion payload
|
|
10
|
+
*/
|
|
11
|
+
delete(payload: ForwardingDeleteRequest): Promise<MailcowResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Endpoint for creating forwarding host.
|
|
14
|
+
* @param payload - The creation payload
|
|
15
|
+
*/
|
|
16
|
+
create(payload: ForwardingCreateRequest): Promise<MailcowResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Endpoint for getting all forwarding host.
|
|
19
|
+
*/
|
|
20
|
+
getAll(): Promise<ForwardingHost[]>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Binder function between the MailcowClient class and the ForwardingEndpoints.
|
|
24
|
+
* @param bind - The MailcowClient to bind.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function forwardingEndpoints(bind: MailcowClient): ForwardingEndpoints;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forwardingEndpoints = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Binder function between the MailcowClient class and the ForwardingEndpoints.
|
|
6
|
+
* @param bind - The MailcowClient to bind.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function forwardingEndpoints(bind) {
|
|
10
|
+
return {
|
|
11
|
+
delete(payload) {
|
|
12
|
+
return bind.requestFactory.post('/api/v1/delete/fwdhost', payload.items);
|
|
13
|
+
},
|
|
14
|
+
create(payload) {
|
|
15
|
+
return bind.requestFactory.post('/api/v1/add/fwdhost', payload);
|
|
16
|
+
},
|
|
17
|
+
getAll() {
|
|
18
|
+
return bind.requestFactory.get('/api/v1/get/fwdhost/all');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.forwardingEndpoints = forwardingEndpoints;
|
|
23
|
+
//# sourceMappingURL=forwarding-endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarding-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/forwarding-endpoints.ts"],"names":[],"mappings":";;;AAyBA;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO;QACL,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,wBAAwB,EACxB,OAAO,CAAC,KAAK,CACd,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,qBAAqB,EACrB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,MAAM;YACJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,yBAAyB,CAC1B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AApBD,kDAoBC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import { ACMELog, ADLog, APILog, DCLog, NFLog, PFLog, RLLog, RSLog, SGLog, WDLog } from '../types';
|
|
3
|
+
export interface LogEndpoints {
|
|
4
|
+
/**
|
|
5
|
+
* Endpoint for returning ACME Logs.
|
|
6
|
+
* @param count - The number of logs to return.
|
|
7
|
+
*/
|
|
8
|
+
acme(count: number): Promise<ACMELog[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Endpoint for returning API Logs.
|
|
11
|
+
* @param count - The number of logs to return.
|
|
12
|
+
*/
|
|
13
|
+
api(count: number): Promise<APILog[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Endpoint for returning Autodiscover Logs.
|
|
16
|
+
* @param count - The number of logs to return.
|
|
17
|
+
*/
|
|
18
|
+
autodiscover(count: number): Promise<ADLog[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Endpoint for returning dovecot Logs.
|
|
21
|
+
* @param count - The number of logs to return.
|
|
22
|
+
*/
|
|
23
|
+
dovecot(count: number): Promise<DCLog[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Endpoint for returning Netfilter Logs.
|
|
26
|
+
* @param count - The number of logs to return.
|
|
27
|
+
*/
|
|
28
|
+
netfilter(count: number): Promise<NFLog[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Endpoint for returning Postfix Logs.
|
|
31
|
+
* @param count - The number of logs to return.
|
|
32
|
+
*/
|
|
33
|
+
postfix(count: number): Promise<PFLog[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Endpoint for returning Rate limited Logs.
|
|
36
|
+
* @param count - The number of logs to return.
|
|
37
|
+
*/
|
|
38
|
+
ratelimited(count: number): Promise<RLLog[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Endpoint for returning Rspamd Logs.
|
|
41
|
+
* @param count - The number of logs to return.
|
|
42
|
+
*/
|
|
43
|
+
rspamd(count: number): Promise<RSLog[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Endpoint for returning SOGo Logs.
|
|
46
|
+
* @param count - The number of logs to return.
|
|
47
|
+
*/
|
|
48
|
+
sogo(count: number): Promise<SGLog[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Endpoint for returning Watchdog Logs.
|
|
51
|
+
* @param count - The number of logs to return.
|
|
52
|
+
*/
|
|
53
|
+
watchdog(count: number): Promise<WDLog[]>;
|
|
54
|
+
}
|
|
55
|
+
export declare function logEndpoints(bind: MailcowClient): LogEndpoints;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logEndpoints = void 0;
|
|
4
|
+
function logEndpoints(bind) {
|
|
5
|
+
return {
|
|
6
|
+
acme(count) {
|
|
7
|
+
return bind.requestFactory.get(`/api/v1/get/logs/acme/${count}`);
|
|
8
|
+
},
|
|
9
|
+
api(count) {
|
|
10
|
+
return bind.requestFactory.get(`/api/v1/get/logs/api/${count}`);
|
|
11
|
+
},
|
|
12
|
+
autodiscover(count) {
|
|
13
|
+
return bind.requestFactory.get(`/api/v1/get/logs/autodiscover/${count}`);
|
|
14
|
+
},
|
|
15
|
+
dovecot(count) {
|
|
16
|
+
return bind.requestFactory.get(`/api/v1/get/logs/dovecot/${count}`);
|
|
17
|
+
},
|
|
18
|
+
netfilter(count) {
|
|
19
|
+
return bind.requestFactory.get(`/api/v1/get/logs/netfilter/${count}`);
|
|
20
|
+
},
|
|
21
|
+
postfix(count) {
|
|
22
|
+
return bind.requestFactory.get(`/api/v1/get/logs/postfix/${count}`);
|
|
23
|
+
},
|
|
24
|
+
ratelimited(count) {
|
|
25
|
+
return bind.requestFactory.get(`/api/v1/get/logs/ratelimited/${count}`);
|
|
26
|
+
},
|
|
27
|
+
rspamd(count) {
|
|
28
|
+
return bind.requestFactory.get(`/api/v1/get/logs/rspamd-history/${count}`);
|
|
29
|
+
},
|
|
30
|
+
sogo(count) {
|
|
31
|
+
return bind.requestFactory.get(`/api/v1/get/logs/sogo/${count}`);
|
|
32
|
+
},
|
|
33
|
+
watchdog(count) {
|
|
34
|
+
return bind.requestFactory.get(`/api/v1/get/logs/watchdog/${count}`);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.logEndpoints = logEndpoints;
|
|
39
|
+
//# sourceMappingURL=log-endpoints.js.map
|