ts-mailcow-api 0.7.0 → 0.8.2
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 +13 -13
- 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/syncjob-endpoints.d.ts +2 -2
- package/dist/Endpoints/syncjob-endpoints.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +398 -8
- package/dist/types.js +0 -4
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
- package/src/Endpoints/forwarding-endpoints.ts +51 -0
- package/src/Endpoints/log-endpoints.ts +130 -0
- package/src/Endpoints/mailbox-endpoint.ts +1 -1
- package/src/Endpoints/syncjob-endpoints.ts +7 -7
- package/src/index.ts +18 -2
- package/src/types.ts +1393 -974
package/README.md
CHANGED
|
@@ -57,21 +57,21 @@ mcc.mailbox.get().then((e) => {
|
|
|
57
57
|
- [x] Get sync jobs
|
|
58
58
|
|
|
59
59
|
### Forwarding Hosts
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
60
|
+
- [x] Add Forward Host
|
|
61
|
+
- [x] Delete Forward Host
|
|
62
|
+
- [x] Get Forwarding Hosts
|
|
63
63
|
|
|
64
64
|
### Logs
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
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
75
|
|
|
76
76
|
### Queue Manager
|
|
77
77
|
- [ ] Delete Queue
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/log-endpoints.ts"],"names":[],"mappings":";;;AA4EA,SAAgB,YAAY,CAAC,IAAmB;IAC9C,OAAO;QACL,IAAI,CAAC,KAAa;YAChB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,yBAAyB,KAAK,EAAE,CACjC,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,KAAa;YACf,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,wBAAwB,KAAK,EAAE,CAChC,CAAC;QACJ,CAAC;QACD,YAAY,CAAC,KAAa;YACxB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,iCAAiC,KAAK,EAAE,CACzC,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,KAAa;YACnB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,4BAA4B,KAAK,EAAE,CACpC,CAAC;QACJ,CAAC;QACD,SAAS,CAAC,KAAa;YACrB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,8BAA8B,KAAK,EAAE,CACtC,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,KAAa;YACnB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,4BAA4B,KAAK,EAAE,CACpC,CAAC;QACJ,CAAC;QACD,WAAW,CAAC,KAAa;YACvB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,gCAAgC,KAAK,EAAE,CACxC,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,KAAa;YAClB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,mCAAmC,KAAK,EAAE,CAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,KAAa;YAChB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,yBAAyB,KAAK,EAAE,CACjC,CAAC;QACJ,CAAC;QACD,QAAQ,CAAC,KAAa;YACpB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,6BAA6B,KAAK,EAAE,CACrC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AArDD,oCAqDC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import MailcowClient from
|
|
2
|
-
import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from '../types';
|
|
3
3
|
export interface SyncjobEndpoints {
|
|
4
4
|
/**
|
|
5
5
|
* Endpoint for creating sync jobs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncjob-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/syncjob-endpoints.ts"],"names":[],"mappings":";;;AA4BA,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO;QACL,MAAM;YACJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,iCAAiC,CAClC,
|
|
1
|
+
{"version":3,"file":"syncjob-endpoints.js","sourceRoot":"","sources":["../../src/Endpoints/syncjob-endpoints.ts"],"names":[],"mappings":";;;AA4BA,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO;QACL,MAAM;YACJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,iCAAiC,CAClC,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAA2B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,qBAAqB,EACrB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAA6B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,sBAAsB,EACtB,OAAO,CACR,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,OAA6B;YAClC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,wBAAwB,EACxB,OAAO,CAAC,KAAK,CACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA1BD,4CA0BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ import { AntiSpamEndpoints } from './Endpoints/antispam-endpoints';
|
|
|
7
7
|
import { MailboxEndpoints } from './Endpoints/mailbox-endpoint';
|
|
8
8
|
import RequestFactory from './request-factory';
|
|
9
9
|
import { AliasEndpoints } from './Endpoints/alias-endpoints';
|
|
10
|
-
import { SyncjobEndpoints } from
|
|
10
|
+
import { SyncjobEndpoints } from './Endpoints/syncjob-endpoints';
|
|
11
|
+
import { ForwardingEndpoints } from './Endpoints/forwarding-endpoints';
|
|
12
|
+
import { LogEndpoints } from './Endpoints/log-endpoints';
|
|
11
13
|
/**
|
|
12
14
|
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
13
15
|
* @external
|
|
@@ -67,5 +69,17 @@ declare class MailcowClient {
|
|
|
67
69
|
* @external
|
|
68
70
|
*/
|
|
69
71
|
syncjobs: SyncjobEndpoints;
|
|
72
|
+
/**
|
|
73
|
+
* All endpoints related to forwarding hosts.
|
|
74
|
+
* See {@link ForwardingEndpoints}
|
|
75
|
+
* @external
|
|
76
|
+
*/
|
|
77
|
+
forwardingHosts: ForwardingEndpoints;
|
|
78
|
+
/**
|
|
79
|
+
* All endpoints related to logs.
|
|
80
|
+
* See {@link LogEndpoints}
|
|
81
|
+
* @external
|
|
82
|
+
*/
|
|
83
|
+
logs: LogEndpoints;
|
|
70
84
|
}
|
|
71
85
|
export default MailcowClient;
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ const mailbox_endpoint_1 = require("./Endpoints/mailbox-endpoint");
|
|
|
9
9
|
const request_factory_1 = require("./request-factory");
|
|
10
10
|
const alias_endpoints_1 = require("./Endpoints/alias-endpoints");
|
|
11
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");
|
|
12
14
|
/**
|
|
13
15
|
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
14
16
|
* @external
|
|
@@ -55,7 +57,19 @@ class MailcowClient {
|
|
|
55
57
|
* @external
|
|
56
58
|
*/
|
|
57
59
|
this.syncjobs = syncjob_endpoints_1.syncjobEndpoints(this);
|
|
58
|
-
|
|
60
|
+
/**
|
|
61
|
+
* All endpoints related to forwarding hosts.
|
|
62
|
+
* See {@link ForwardingEndpoints}
|
|
63
|
+
* @external
|
|
64
|
+
*/
|
|
65
|
+
this.forwardingHosts = forwarding_endpoints_1.forwardingEndpoints(this);
|
|
66
|
+
/**
|
|
67
|
+
* All endpoints related to logs.
|
|
68
|
+
* See {@link LogEndpoints}
|
|
69
|
+
* @external
|
|
70
|
+
*/
|
|
71
|
+
this.logs = log_endpoints_1.logEndpoints(this);
|
|
72
|
+
this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
|
|
59
73
|
this.API_KEY = API_KEY;
|
|
60
74
|
// Set the correct Axios headers.
|
|
61
75
|
this.HEADERS = {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,mEAAgF;AAChF,uEAAsF;AACtF,mEAAkF;AAClF,uDAA+C;AAC/C,iEAA6E;AAC7E,qEAAmF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,mEAAgF;AAChF,uEAAsF;AACtF,mEAAkF;AAClF,uDAA+C;AAC/C,iEAA6E;AAC7E,qEAAmF;AACnF,2EAA4F;AAC5F,6DAAuE;AAEvE;;;GAGG;AACH,MAAM,aAAa;IAiBjB;;;;OAIG;IACH,YAAY,QAAgB,EAAE,OAAe;QAa7C;;;WAGG;QACI,mBAAc,GAAG,IAAI,yBAAc,CAAC,IAAI,CAAC,CAAA;QAEhD;;;;WAIG;QACI,YAAO,GAAmB,gCAAc,CAAC,IAAI,CAAC,CAAA;QAErD;;;;WAIG;QACI,YAAO,GAAoB,kCAAe,CAAC,IAAI,CAAC,CAAA;QAEvD;;;;WAIG;QACI,eAAU,GAAsB,sCAAiB,CAAC,IAAI,CAAC,CAAA;QAE9D;;;;WAIG;QACI,YAAO,GAAqB,mCAAgB,CAAC,IAAI,CAAC,CAAA;QAEzD;;;;WAIG;QACI,aAAQ,GAAqB,oCAAgB,CAAC,IAAI,CAAC,CAAA;QAE1D;;;;WAIG;QACI,oBAAe,GAAwB,0CAAmB,CAAC,IAAI,CAAC,CAAA;QAEvE;;;;WAIG;QACI,SAAI,GAAiB,4BAAY,CAAC,IAAI,CAAC,CAAA;QAjE5C,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,iCAAiC;QACjC,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,IAAI,CAAC,OAAO;aAC1B;SACF,CAAC;IACJ,CAAC;CAwDF;AAED,kBAAe,aAAa,CAAC"}
|