ts-mailcow-api 0.10.0 → 0.12.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.
- package/README.md +11 -3
- package/dist/client.d.ts +101 -0
- package/dist/client.js +96 -0
- package/dist/client.js.map +1 -0
- package/dist/{Endpoints → endpoints}/address-rewriting-endpoint.js.map +1 -1
- package/dist/{Endpoints → endpoints}/alias-endpoints.js.map +1 -1
- package/dist/{Endpoints → endpoints}/antispam-endpoints.js.map +1 -1
- package/dist/{Endpoints → endpoints}/domain-endpoints.js.map +1 -1
- package/dist/endpoints/fail2ban-endpoints.d.ts +22 -0
- package/dist/endpoints/fail2ban-endpoints.js +19 -0
- package/dist/endpoints/fail2ban-endpoints.js.map +1 -0
- package/dist/{Endpoints → endpoints}/forwarding-endpoints.js.map +1 -1
- package/dist/{Endpoints → endpoints}/log-endpoints.js.map +1 -1
- package/dist/{Endpoints → endpoints}/mailbox-endpoint.js.map +1 -1
- package/dist/{Endpoints → endpoints}/syncjob-endpoints.js.map +1 -1
- package/dist/index.d.ts +2 -92
- package/dist/index.js +2 -87
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +96 -0
- package/package.json +12 -12
- package/index.js +0 -2
- package/src/Endpoints/address-rewriting-endpoint.ts +0 -74
- package/src/Endpoints/alias-endpoints.ts +0 -54
- package/src/Endpoints/antispam-endpoints.ts +0 -50
- package/src/Endpoints/domain-endpoints.ts +0 -54
- package/src/Endpoints/forwarding-endpoints.ts +0 -43
- package/src/Endpoints/log-endpoints.ts +0 -99
- package/src/Endpoints/mailbox-endpoint.ts +0 -123
- package/src/Endpoints/syncjob-endpoints.ts +0 -44
- package/src/index.ts +0 -120
- package/src/request-factory.ts +0 -78
- package/src/types.ts +0 -1489
- /package/dist/{Endpoints → endpoints}/address-rewriting-endpoint.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/address-rewriting-endpoint.js +0 -0
- /package/dist/{Endpoints → endpoints}/alias-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/alias-endpoints.js +0 -0
- /package/dist/{Endpoints → endpoints}/antispam-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/antispam-endpoints.js +0 -0
- /package/dist/{Endpoints → endpoints}/domain-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/domain-endpoints.js +0 -0
- /package/dist/{Endpoints → endpoints}/forwarding-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/forwarding-endpoints.js +0 -0
- /package/dist/{Endpoints → endpoints}/log-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/log-endpoints.js +0 -0
- /package/dist/{Endpoints → endpoints}/mailbox-endpoint.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/mailbox-endpoint.js +0 -0
- /package/dist/{Endpoints → endpoints}/syncjob-endpoints.d.ts +0 -0
- /package/dist/{Endpoints → endpoints}/syncjob-endpoints.js +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
|
|
1
2
|
# TypeScript wrapper for the mailcow API
|
|
3
|
+
[](https://www.npmjs.com/package/ts-mailcow-api)
|
|
4
|
+
[](https://github.com/JustSamuel/ts-mailcow-api/actions/workflows/lint-and-build.yml)
|
|
5
|
+
[](https://github.com/JustSamuel/ts-mailcow-api/blob/main/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/ts-mailcow-api)
|
|
7
|
+
[](https://justsamuel.github.io/ts-mailcow-api/classes/MailcowClient.html)
|
|
2
8
|
|
|
3
9
|
Provides typing and a easy to use interface for the [Mailcow API](https://mailcow.docs.apiary.io/#).
|
|
4
10
|
|
|
5
11
|
## Usage
|
|
6
12
|
|
|
7
|
-
|
|
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.
|
|
8
16
|
|
|
9
17
|
```ts
|
|
10
18
|
import MailCowClient from "./index";
|
|
@@ -121,8 +129,8 @@ This wrapper acts as a middleman, so those changes can be patched internally wit
|
|
|
121
129
|
|
|
122
130
|
### Fail2Ban
|
|
123
131
|
|
|
124
|
-
- [
|
|
125
|
-
- [
|
|
132
|
+
- [x] Edit Fail2Ban
|
|
133
|
+
- [x] Get Fail2Ban Config
|
|
126
134
|
|
|
127
135
|
### DKIM
|
|
128
136
|
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
17
|
+
* @external
|
|
18
|
+
*/
|
|
19
|
+
declare class MailcowClient {
|
|
20
|
+
/**
|
|
21
|
+
* The base URL of the Mailcow API.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
readonly BASE_URL: string;
|
|
25
|
+
/**
|
|
26
|
+
* The API key of the Mailcow API.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
readonly API_KEY: string;
|
|
30
|
+
/**
|
|
31
|
+
* The request config used for every request.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
AXIOS_CONFIG: AxiosRequestConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a MailcowClient using the given URL and API key.
|
|
37
|
+
* @param BASE_URL - The base URL of the Mailcow API.
|
|
38
|
+
* @param API_KEY - The API key of the Mailcow API.
|
|
39
|
+
* @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
|
|
40
|
+
*/
|
|
41
|
+
constructor(BASE_URL: string, API_KEY: string, EXTRA_AXIOS_CONFIG?: AxiosRequestConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Factory method pattern for creating HTTP requests.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
requestFactory: RequestFactory;
|
|
47
|
+
/**
|
|
48
|
+
* All endpoints related to Aliases.
|
|
49
|
+
* See {@link AliasEndpoints}
|
|
50
|
+
*/
|
|
51
|
+
aliases: AliasEndpoints;
|
|
52
|
+
/**
|
|
53
|
+
* All endpoints related to Domains.
|
|
54
|
+
* See {@link DomainEndpoints}
|
|
55
|
+
* @external
|
|
56
|
+
*/
|
|
57
|
+
domains: DomainEndpoints;
|
|
58
|
+
/**
|
|
59
|
+
* All endpoints related to spam policies.
|
|
60
|
+
* See {@link AntiSpamEndpoints}
|
|
61
|
+
* @external
|
|
62
|
+
*/
|
|
63
|
+
spamPolicy: AntiSpamEndpoints;
|
|
64
|
+
/**
|
|
65
|
+
* All endpoints related to mailboxes.
|
|
66
|
+
* See {@link MailboxEndpoints}
|
|
67
|
+
* @external
|
|
68
|
+
*/
|
|
69
|
+
mailbox: MailboxEndpoints;
|
|
70
|
+
/**
|
|
71
|
+
* All endpoints related to sync jobs.
|
|
72
|
+
* See {@link SyncjobEndpoints}
|
|
73
|
+
* @external
|
|
74
|
+
*/
|
|
75
|
+
syncjobs: SyncjobEndpoints;
|
|
76
|
+
/**
|
|
77
|
+
* All endpoints related to forwarding hosts.
|
|
78
|
+
* See {@link ForwardingEndpoints}
|
|
79
|
+
* @external
|
|
80
|
+
*/
|
|
81
|
+
forwardingHosts: ForwardingEndpoints;
|
|
82
|
+
/**
|
|
83
|
+
* All endpoints related to address rewriting.
|
|
84
|
+
* See {@link AdressRewritingEndpoints}
|
|
85
|
+
* @external
|
|
86
|
+
*/
|
|
87
|
+
addressRewriting: AdressRewritingEndpoints;
|
|
88
|
+
/**
|
|
89
|
+
* All endpoints related to logs.
|
|
90
|
+
* See {@link LogEndpoints}
|
|
91
|
+
* @external
|
|
92
|
+
*/
|
|
93
|
+
logs: LogEndpoints;
|
|
94
|
+
/**
|
|
95
|
+
* All endpoints related to fail2ban.
|
|
96
|
+
* See {@link Fail2BanEndpoints}
|
|
97
|
+
* @external
|
|
98
|
+
*/
|
|
99
|
+
fail2Ban: Fail2BanEndpoints;
|
|
100
|
+
}
|
|
101
|
+
export default MailcowClient;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
18
|
+
* @external
|
|
19
|
+
*/
|
|
20
|
+
class MailcowClient {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a MailcowClient using the given URL and API key.
|
|
23
|
+
* @param BASE_URL - The base URL of the Mailcow API.
|
|
24
|
+
* @param API_KEY - The API key of the Mailcow API.
|
|
25
|
+
* @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
|
|
26
|
+
*/
|
|
27
|
+
constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) {
|
|
28
|
+
/**
|
|
29
|
+
* Factory method pattern for creating HTTP requests.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
this.requestFactory = new request_factory_1.default(this);
|
|
33
|
+
/**
|
|
34
|
+
* All endpoints related to Aliases.
|
|
35
|
+
* See {@link AliasEndpoints}
|
|
36
|
+
*/
|
|
37
|
+
this.aliases = (0, alias_endpoints_1.aliasEndpoints)(this);
|
|
38
|
+
/**
|
|
39
|
+
* All endpoints related to Domains.
|
|
40
|
+
* See {@link DomainEndpoints}
|
|
41
|
+
* @external
|
|
42
|
+
*/
|
|
43
|
+
this.domains = (0, domain_endpoints_1.domainEndpoints)(this);
|
|
44
|
+
/**
|
|
45
|
+
* All endpoints related to spam policies.
|
|
46
|
+
* See {@link AntiSpamEndpoints}
|
|
47
|
+
* @external
|
|
48
|
+
*/
|
|
49
|
+
this.spamPolicy = (0, antispam_endpoints_1.antiSpamEndpoints)(this);
|
|
50
|
+
/**
|
|
51
|
+
* All endpoints related to mailboxes.
|
|
52
|
+
* See {@link MailboxEndpoints}
|
|
53
|
+
* @external
|
|
54
|
+
*/
|
|
55
|
+
this.mailbox = (0, mailbox_endpoint_1.mailboxEndpoints)(this);
|
|
56
|
+
/**
|
|
57
|
+
* All endpoints related to sync jobs.
|
|
58
|
+
* See {@link SyncjobEndpoints}
|
|
59
|
+
* @external
|
|
60
|
+
*/
|
|
61
|
+
this.syncjobs = (0, syncjob_endpoints_1.syncjobEndpoints)(this);
|
|
62
|
+
/**
|
|
63
|
+
* All endpoints related to forwarding hosts.
|
|
64
|
+
* See {@link ForwardingEndpoints}
|
|
65
|
+
* @external
|
|
66
|
+
*/
|
|
67
|
+
this.forwardingHosts = (0, forwarding_endpoints_1.forwardingEndpoints)(this);
|
|
68
|
+
/**
|
|
69
|
+
* All endpoints related to address rewriting.
|
|
70
|
+
* See {@link AdressRewritingEndpoints}
|
|
71
|
+
* @external
|
|
72
|
+
*/
|
|
73
|
+
this.addressRewriting = (0, address_rewriting_endpoint_1.addressRewritingEndpoints)(this);
|
|
74
|
+
/**
|
|
75
|
+
* All endpoints related to logs.
|
|
76
|
+
* See {@link LogEndpoints}
|
|
77
|
+
* @external
|
|
78
|
+
*/
|
|
79
|
+
this.logs = (0, log_endpoints_1.logEndpoints)(this);
|
|
80
|
+
/**
|
|
81
|
+
* All endpoints related to fail2ban.
|
|
82
|
+
* See {@link Fail2BanEndpoints}
|
|
83
|
+
* @external
|
|
84
|
+
*/
|
|
85
|
+
this.fail2Ban = (0, fail2ban_endpoints_1.fail2BanEndpoints)(this);
|
|
86
|
+
this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
|
|
87
|
+
this.API_KEY = API_KEY;
|
|
88
|
+
// Set the correct Axios request config.
|
|
89
|
+
this.AXIOS_CONFIG = Object.assign(Object.assign({}, EXTRA_AXIOS_CONFIG), { headers: {
|
|
90
|
+
'Content-Type': 'application/json',
|
|
91
|
+
'X-API-Key': this.API_KEY,
|
|
92
|
+
} });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.default = MailcowClient;
|
|
96
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,mEAAgF;AAChF,uEAAsF;AACtF,mEAAkF;AAClF,uDAA+C;AAC/C,iEAA6E;AAC7E,qEAAmF;AACnF,2EAA4F;AAC5F,6DAAuE;AACvE,uFAA6G;AAC7G,uEAAsF;AAEtF;;;GAGG;AACH,MAAM,aAAa;IAmBjB;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,OAAe,EAAE,kBAAuC;QActF;;;WAGG;QACI,mBAAc,GAAG,IAAI,yBAAc,CAAC,IAAI,CAAC,CAAC;QAEjD;;;WAGG;QACI,YAAO,GAAmB,IAAA,gCAAc,EAAC,IAAI,CAAC,CAAC;QAEtD;;;;WAIG;QACI,YAAO,GAAoB,IAAA,kCAAe,EAAC,IAAI,CAAC,CAAC;QAExD;;;;WAIG;QACI,eAAU,GAAsB,IAAA,sCAAiB,EAAC,IAAI,CAAC,CAAC;QAE/D;;;;WAIG;QACI,YAAO,GAAqB,IAAA,mCAAgB,EAAC,IAAI,CAAC,CAAC;QAE1D;;;;WAIG;QACI,aAAQ,GAAqB,IAAA,oCAAgB,EAAC,IAAI,CAAC,CAAC;QAE3D;;;;WAIG;QACI,oBAAe,GAAwB,IAAA,0CAAmB,EAAC,IAAI,CAAC,CAAC;QAExE;;;;WAIG;QACI,qBAAgB,GAA6B,IAAA,sDAAyB,EAAC,IAAI,CAAC,CAAC;QAEpF;;;;WAIG;QACI,SAAI,GAAiB,IAAA,4BAAY,EAAC,IAAI,CAAC,CAAC;QAE/C;;;;WAIG;QACI,aAAQ,GAAsB,IAAA,sCAAiB,EAAC,IAAI,CAAC,CAAC;QA/E3D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,wCAAwC;QACxC,IAAI,CAAC,YAAY,mCACZ,kBAAkB,KACrB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,IAAI,CAAC,OAAO;aAC1B,GACF,CAAC;IACJ,CAAC;CAqEF;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-rewriting-endpoint.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"address-rewriting-endpoint.js","sourceRoot":"","sources":["../../src/endpoints/address-rewriting-endpoint.ts"],"names":[],"mappings":";;AA4CA,8DA6BC;AA7BD,SAAgB,yBAAyB,CAAC,IAAmB;IAC3D,OAAO;QACL,SAAS,CAAC,OAAyB;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAoC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QACjG,CAAC;QAED,eAAe,CAAC,OAA+B;YAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA0C,2BAA2B,EAAE,OAAO,CAAC,CAAC;QACjH,CAAC;QAED,YAAY,CAAC,OAA8B;YACzC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAyC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QACzG,CAAC;QAED,kBAAkB,CAAC,OAAoC;YACrD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,8BAA8B,EAC9B,OAAO,CACR,CAAC;QACJ,CAAC;QAED,SAAS,CAAC,EAAkB;YAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAoB,mBAAmB,EAAE,EAAE,CAAC,CAAC;QAC7E,CAAC;QAED,eAAe,CAAC,EAAkB;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAA0B,6BAA6B,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"alias-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/alias-endpoints.ts"],"names":[],"mappings":";;AAsCA,wCAeC;AAnDD,wDAAwD;AA+BxD;;;;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,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;QACxG,CAAC;QACD,MAAM,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC9D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAoC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACnG,CAAC;QACD,IAAI,EAAE,CAAC,OAAyB,EAA4B,EAAE;YAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAoC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QACpG,CAAC;QACD,MAAM,EAAE,CAAC,OAA2B,EAA4B,EAAE;YAChE,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,sBAAsB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACpG,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antispam-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"antispam-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/antispam-endpoints.ts"],"names":[],"mappings":";;AAqCA,8CAYC;AAjBD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO;QACL,MAAM,CAAC,OAA8B;YACnC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAyC,2BAA2B,EAAE,OAAO,CAAC,CAAC;QAChH,CAAC;QACD,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,8BAA8B,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7G,CAAC;QACD,GAAG,CAAC,OAA6B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAe,sBAAsB,OAAO,CAAC,IAAI,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9G,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"domain-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/domain-endpoints.ts"],"names":[],"mappings":";;AAsCA,0CAeC;AAnDD,wDAAwD;AA+BxD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAmB;IACjD,OAAO;QACL,GAAG,CAAC,SAAiB,KAAK;YACxB,OAAO,IAAA,oCAAkB,EAAS,IAAI,CAAC,cAAc,CAAC,GAAG,CAAoB,sBAAsB,MAAM,EAAE,CAAC,CAAC,CAAC;QAChH,CAAC;QACD,MAAM,CAAC,OAA0B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAqC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,CAAC,OAA4B;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACvG,CAAC;QACD,IAAI,CAAC,OAA0B;YAC7B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAqC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACtG,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MailcowResponse, Fail2BanEditRequest, Fail2BanResponse } from '../types';
|
|
2
|
+
import MailcowClient from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for all Fail2Ban endpoints.
|
|
5
|
+
*/
|
|
6
|
+
export interface Fail2BanEndpoints {
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint for editing Fail2Ban settings.
|
|
9
|
+
* @param payload - The edit payload.
|
|
10
|
+
*/
|
|
11
|
+
edit(payload: Fail2BanEditRequest): Promise<MailcowResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Endpoint for getting Fail2Ban settings.
|
|
14
|
+
*/
|
|
15
|
+
get(): Promise<Fail2BanResponse>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Binder function between the MailcowClient class and the Fail2BanEndpoints.
|
|
19
|
+
* @param bind - The MailcowClient to bind.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function fail2BanEndpoints(bind: MailcowClient): Fail2BanEndpoints;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fail2BanEndpoints = fail2BanEndpoints;
|
|
4
|
+
/**
|
|
5
|
+
* Binder function between the MailcowClient class and the Fail2BanEndpoints.
|
|
6
|
+
* @param bind - The MailcowClient to bind.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function fail2BanEndpoints(bind) {
|
|
10
|
+
return {
|
|
11
|
+
edit(payload) {
|
|
12
|
+
return bind.requestFactory.post('/api/v1/edit/fail2ban', payload);
|
|
13
|
+
},
|
|
14
|
+
get() {
|
|
15
|
+
return bind.requestFactory.get('/api/v1/get/fail2ban');
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fail2ban-endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fail2ban-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/fail2ban-endpoints.ts"],"names":[],"mappings":";;AAwBA,8CASC;AAdD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAmB;IACnD,OAAO;QACL,IAAI,CAAC,OAA4B;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAuC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QAC1G,CAAC;QACD,GAAG;YACD,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAmB,sBAAsB,CAAC,CAAC;QAC3E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forwarding-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"forwarding-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/forwarding-endpoints.ts"],"names":[],"mappings":";;AA8BA,kDAYC;AAjBD;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO;QACL,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,wBAAwB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACtG,CAAC;QACD,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA2C,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5G,CAAC;QACD,MAAM;YACJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAmB,yBAAyB,CAAC,CAAC;QAC9E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"log-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/log-endpoints.ts"],"names":[],"mappings":";;AAiEA,oCAiCC;AAjCD,SAAgB,YAAY,CAAC,IAAmB;IAC9C,OAAO;QACL,IAAI,CAAC,KAAa;YAChB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAY,yBAAyB,KAAK,EAAE,CAAC,CAAC;QAC9E,CAAC;QACD,GAAG,CAAC,KAAa;YACf,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAW,wBAAwB,KAAK,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,YAAY,CAAC,KAAa;YACxB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,iCAAiC,KAAK,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,KAAa;YACnB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,4BAA4B,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,SAAS,CAAC,KAAa;YACrB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,8BAA8B,KAAK,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,CAAC,KAAa;YACnB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,4BAA4B,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,WAAW,CAAC,KAAa;YACvB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,gCAAgC,KAAK,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,CAAC,KAAa;YAClB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,mCAAmC,KAAK,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,IAAI,CAAC,KAAa;YAChB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,yBAAyB,KAAK,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,QAAQ,CAAC,KAAa;YACpB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAU,6BAA6B,KAAK,EAAE,CAAC,CAAC;QAChF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox-endpoint.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"mailbox-endpoint.js","sourceRoot":"","sources":["../../src/endpoints/mailbox-endpoint.ts"],"names":[],"mappings":";;AA+EA,4CA2CC;AA9GD,wDAAwD;AA8DxD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO;QACL,MAAM,CAAC,OAA2B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAsC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,CAAC,OAA6B;YAClC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,wBAAwB,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1G,CAAC;QAED,IAAI,CAAC,OAA2B;YAC9B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAsC,sBAAsB,EAAE,OAAO,CAAC,CAAC;QACxG,CAAC;QAED,GAAG,CAAC,UAAkB,KAAK;YACzB,OAAO,IAAA,oCAAkB,EACvB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAsB,uBAAuB,OAAO,EAAE,CAAC,CAC/E,CAAC;QACJ,CAAC;QAED,YAAY,CAAC,OAA4B;YACvC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAuC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QAC1G,CAAC;QAED,cAAc,CAAC,OAA+B;YAC5C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,sCAAsC,EACtC,OAAO,CACR,CAAC;QACJ,CAAC;QAED,aAAa,CAAC,OAA6B;YACzC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAwC,yBAAyB,EAAE,OAAO,CAAC,CAAC;QAC7G,CAAC;QAED,WAAW,CAAC,OAAuB;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAkC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACrG,CAAC;QAED,kBAAkB,CAAC,OAAe;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAW,iCAAiC,OAAO,EAAE,CAAC,CAAC;QACvF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncjob-endpoints.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"syncjob-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/syncjob-endpoints.ts"],"names":[],"mappings":";;AA4BA,4CAeC;AAfD,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO;QACL,MAAM;YACJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAY,iCAAiC,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,CAAC,OAA2B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAsC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACvG,CAAC;QACD,IAAI,CAAC,OAA6B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAwC,sBAAsB,EAAE,OAAO,CAAC,CAAC;QAC1G,CAAC;QACD,MAAM,CAAC,OAA6B;YAClC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,wBAAwB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACtG,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,93 +1,3 @@
|
|
|
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
|
-
/**
|
|
15
|
-
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
16
|
-
* @external
|
|
17
|
-
*/
|
|
18
|
-
declare class MailcowClient {
|
|
19
|
-
/**
|
|
20
|
-
* The base URL of the Mailcow API.
|
|
21
|
-
*/
|
|
22
|
-
readonly BASE_URL: string;
|
|
23
|
-
/**
|
|
24
|
-
* The API key of the Mailcow API.
|
|
25
|
-
*/
|
|
26
|
-
readonly API_KEY: string;
|
|
27
|
-
/**
|
|
28
|
-
* The request config used for every request.
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
AXIOS_CONFIG: AxiosRequestConfig;
|
|
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: string, API_KEY: string, EXTRA_AXIOS_CONFIG?: AxiosRequestConfig);
|
|
39
|
-
/**
|
|
40
|
-
* Factory method pattern for creating HTTP requests.
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
requestFactory: RequestFactory;
|
|
44
|
-
/**
|
|
45
|
-
* All endpoints related to Aliases.
|
|
46
|
-
* See {@link AliasEndpoints}
|
|
47
|
-
* @external
|
|
48
|
-
*/
|
|
49
|
-
aliases: AliasEndpoints;
|
|
50
|
-
/**
|
|
51
|
-
* All endpoints related to Domains.
|
|
52
|
-
* See {@link DomainEndpoints}
|
|
53
|
-
* @external
|
|
54
|
-
*/
|
|
55
|
-
domains: DomainEndpoints;
|
|
56
|
-
/**
|
|
57
|
-
* All endpoints related to spam policies.
|
|
58
|
-
* See {@link AntiSpamEndpoints}
|
|
59
|
-
* @external
|
|
60
|
-
*/
|
|
61
|
-
spamPolicy: AntiSpamEndpoints;
|
|
62
|
-
/**
|
|
63
|
-
* All endpoints related to mailboxes.
|
|
64
|
-
* See {@link MailboxEndpoints}
|
|
65
|
-
* @external
|
|
66
|
-
*/
|
|
67
|
-
mailbox: MailboxEndpoints;
|
|
68
|
-
/**
|
|
69
|
-
* All endpoints related to sync jobs.
|
|
70
|
-
* See {@link SyncjobEndpoints}
|
|
71
|
-
* @external
|
|
72
|
-
*/
|
|
73
|
-
syncjobs: SyncjobEndpoints;
|
|
74
|
-
/**
|
|
75
|
-
* All endpoints related to forwarding hosts.
|
|
76
|
-
* See {@link ForwardingEndpoints}
|
|
77
|
-
* @external
|
|
78
|
-
*/
|
|
79
|
-
forwardingHosts: ForwardingEndpoints;
|
|
80
|
-
/**
|
|
81
|
-
* All endpoints related to address rewriting.
|
|
82
|
-
* See {@link AdressRewritingEndpoints}
|
|
83
|
-
* @external
|
|
84
|
-
*/
|
|
85
|
-
addressRewriting: AdressRewritingEndpoints;
|
|
86
|
-
/**
|
|
87
|
-
* All endpoints related to logs.
|
|
88
|
-
* See {@link LogEndpoints}
|
|
89
|
-
* @external
|
|
90
|
-
*/
|
|
91
|
-
logs: LogEndpoints;
|
|
92
|
-
}
|
|
1
|
+
import MailcowClient from './client';
|
|
93
2
|
export default MailcowClient;
|
|
3
|
+
export type * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,90 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module MailcowClient
|
|
4
|
-
*/
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
|
|
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
|
-
/**
|
|
16
|
-
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
17
|
-
* @external
|
|
18
|
-
*/
|
|
19
|
-
class MailcowClient {
|
|
20
|
-
/**
|
|
21
|
-
* Creates a MailcowClient using the given URL and API key.
|
|
22
|
-
* @param BASE_URL - The base URL of the Mailcow API.
|
|
23
|
-
* @param API_KEY - The API key of the Mailcow API.
|
|
24
|
-
* @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
|
|
25
|
-
*/
|
|
26
|
-
constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) {
|
|
27
|
-
/**
|
|
28
|
-
* Factory method pattern for creating HTTP requests.
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
this.requestFactory = new request_factory_1.default(this);
|
|
32
|
-
/**
|
|
33
|
-
* All endpoints related to Aliases.
|
|
34
|
-
* See {@link AliasEndpoints}
|
|
35
|
-
* @external
|
|
36
|
-
*/
|
|
37
|
-
this.aliases = (0, alias_endpoints_1.aliasEndpoints)(this);
|
|
38
|
-
/**
|
|
39
|
-
* All endpoints related to Domains.
|
|
40
|
-
* See {@link DomainEndpoints}
|
|
41
|
-
* @external
|
|
42
|
-
*/
|
|
43
|
-
this.domains = (0, domain_endpoints_1.domainEndpoints)(this);
|
|
44
|
-
/**
|
|
45
|
-
* All endpoints related to spam policies.
|
|
46
|
-
* See {@link AntiSpamEndpoints}
|
|
47
|
-
* @external
|
|
48
|
-
*/
|
|
49
|
-
this.spamPolicy = (0, antispam_endpoints_1.antiSpamEndpoints)(this);
|
|
50
|
-
/**
|
|
51
|
-
* All endpoints related to mailboxes.
|
|
52
|
-
* See {@link MailboxEndpoints}
|
|
53
|
-
* @external
|
|
54
|
-
*/
|
|
55
|
-
this.mailbox = (0, mailbox_endpoint_1.mailboxEndpoints)(this);
|
|
56
|
-
/**
|
|
57
|
-
* All endpoints related to sync jobs.
|
|
58
|
-
* See {@link SyncjobEndpoints}
|
|
59
|
-
* @external
|
|
60
|
-
*/
|
|
61
|
-
this.syncjobs = (0, syncjob_endpoints_1.syncjobEndpoints)(this);
|
|
62
|
-
/**
|
|
63
|
-
* All endpoints related to forwarding hosts.
|
|
64
|
-
* See {@link ForwardingEndpoints}
|
|
65
|
-
* @external
|
|
66
|
-
*/
|
|
67
|
-
this.forwardingHosts = (0, forwarding_endpoints_1.forwardingEndpoints)(this);
|
|
68
|
-
/**
|
|
69
|
-
* All endpoints related to address rewriting.
|
|
70
|
-
* See {@link AdressRewritingEndpoints}
|
|
71
|
-
* @external
|
|
72
|
-
*/
|
|
73
|
-
this.addressRewriting = (0, address_rewriting_endpoint_1.addressRewritingEndpoints)(this);
|
|
74
|
-
/**
|
|
75
|
-
* All endpoints related to logs.
|
|
76
|
-
* See {@link LogEndpoints}
|
|
77
|
-
* @external
|
|
78
|
-
*/
|
|
79
|
-
this.logs = (0, log_endpoints_1.logEndpoints)(this);
|
|
80
|
-
this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
|
|
81
|
-
this.API_KEY = API_KEY;
|
|
82
|
-
// Set the correct Axios request config.
|
|
83
|
-
this.AXIOS_CONFIG = Object.assign(Object.assign({}, EXTRA_AXIOS_CONFIG), { headers: {
|
|
84
|
-
'Content-Type': 'application/json',
|
|
85
|
-
'X-API-Key': this.API_KEY,
|
|
86
|
-
} });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.default = MailcowClient;
|
|
3
|
+
const client_1 = require("./client");
|
|
4
|
+
exports.default = client_1.default;
|
|
90
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qCAAqC;AAErC,kBAAe,gBAAa,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1390,6 +1390,102 @@ export declare class MailcowException extends Error {
|
|
|
1390
1390
|
*/
|
|
1391
1391
|
message: string;
|
|
1392
1392
|
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Fail2Ban edit request.
|
|
1395
|
+
*/
|
|
1396
|
+
export interface Fail2BanEditRequest {
|
|
1397
|
+
/**
|
|
1398
|
+
* Configuration attributes to apply.
|
|
1399
|
+
*/
|
|
1400
|
+
attr: {
|
|
1401
|
+
/**
|
|
1402
|
+
* Duration (in seconds) a ban should last.
|
|
1403
|
+
*/
|
|
1404
|
+
ban_time: string;
|
|
1405
|
+
/**
|
|
1406
|
+
* Whether to increment ban time on repeated offenses.
|
|
1407
|
+
*/
|
|
1408
|
+
ban_time_increment: string;
|
|
1409
|
+
/**
|
|
1410
|
+
* List of blacklisted IPs or CIDRs, comma separated.
|
|
1411
|
+
*/
|
|
1412
|
+
blacklist: string;
|
|
1413
|
+
/**
|
|
1414
|
+
* Maximum number of failed attempts before banning.
|
|
1415
|
+
*/
|
|
1416
|
+
max_attempts: string;
|
|
1417
|
+
/**
|
|
1418
|
+
* Maximum duration (in seconds) for a ban.
|
|
1419
|
+
*/
|
|
1420
|
+
max_ban_time: string;
|
|
1421
|
+
/**
|
|
1422
|
+
* Netban range for IPv4.
|
|
1423
|
+
*/
|
|
1424
|
+
netban_ipv4: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* Netban range for IPv6.
|
|
1427
|
+
*/
|
|
1428
|
+
netban_ipv6: string;
|
|
1429
|
+
/**
|
|
1430
|
+
* Time window (in seconds) for retry count.
|
|
1431
|
+
*/
|
|
1432
|
+
retry_window: string;
|
|
1433
|
+
/**
|
|
1434
|
+
* List of whitelisted IPs or domains, comma separated.
|
|
1435
|
+
*/
|
|
1436
|
+
whitelist: string;
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* Affected networks (use "all" for global update).
|
|
1440
|
+
*/
|
|
1441
|
+
items: string;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Fail2Ban configuration response.
|
|
1445
|
+
*/
|
|
1446
|
+
export interface Fail2Ban {
|
|
1447
|
+
/**
|
|
1448
|
+
* Duration (in seconds) a ban should last.
|
|
1449
|
+
*/
|
|
1450
|
+
ban_time: number;
|
|
1451
|
+
/**
|
|
1452
|
+
* Whether to increment ban time on repeated offenses.
|
|
1453
|
+
*/
|
|
1454
|
+
ban_time_increment: number;
|
|
1455
|
+
/**
|
|
1456
|
+
* List of blacklisted IPs or CIDRs, newline-separated.
|
|
1457
|
+
*/
|
|
1458
|
+
blacklist: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* Maximum number of failed attempts before banning.
|
|
1461
|
+
*/
|
|
1462
|
+
max_attempts: number;
|
|
1463
|
+
/**
|
|
1464
|
+
* Maximum duration (in seconds) for a ban.
|
|
1465
|
+
*/
|
|
1466
|
+
max_ban_time: number;
|
|
1467
|
+
/**
|
|
1468
|
+
* Netban range for IPv4.
|
|
1469
|
+
*/
|
|
1470
|
+
netban_ipv4: number;
|
|
1471
|
+
/**
|
|
1472
|
+
* Netban range for IPv6.
|
|
1473
|
+
*/
|
|
1474
|
+
netban_ipv6: number;
|
|
1475
|
+
/**
|
|
1476
|
+
* List of permanently banned IPs.
|
|
1477
|
+
*/
|
|
1478
|
+
perm_bans: string[];
|
|
1479
|
+
/**
|
|
1480
|
+
* Time window (in seconds) for retry count.
|
|
1481
|
+
*/
|
|
1482
|
+
retry_window: number;
|
|
1483
|
+
/**
|
|
1484
|
+
* List of whitelisted IPs or domains, comma or newline-separated.
|
|
1485
|
+
*/
|
|
1486
|
+
whitelist: string;
|
|
1487
|
+
}
|
|
1488
|
+
export type Fail2BanResponse = Fail2Ban;
|
|
1393
1489
|
/**
|
|
1394
1490
|
* Interface for a general Mailcow API response.
|
|
1395
1491
|
*
|