ts-mailcow-api 0.8.3 → 0.8.5

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.
@@ -1,58 +1,58 @@
1
- import { ACLEditRequest, MailboxDeleteRequest, MailboxEditRequest, MailboxPostRequest, Mailbox, MailcowResponse, PushoverEditRequest, QuarantaineEditRequest, SpamScoreEditRequest } from '../types';
2
- import MailcowClient from '../index';
3
- /**
4
- * Interface for all Mailbox endpoints.
5
- */
6
- export interface MailboxEndpoints {
7
- /**
8
- * Endpoint for creating a mailbox.
9
- * @param payload - The creation payload.
10
- */
11
- create(payload: MailboxPostRequest): Promise<MailcowResponse>;
12
- /**
13
- * Endpoint for deleting a mailbox.
14
- * @param payload - The deletion payload.
15
- */
16
- delete(payload: MailboxDeleteRequest): Promise<MailcowResponse>;
17
- /**
18
- * Endpoint for editing a mailbox.
19
- * @param payload
20
- */
21
- edit(payload: MailboxEditRequest): Promise<MailcowResponse>;
22
- /**
23
- * Endpoint for getting a mailbox.
24
- * @param mailbox - The mailbox to get
25
- */
26
- get(mailbox: string | 'all'): Promise<Mailbox[]>;
27
- /**
28
- * Endpoint for editing a mailbox's pushover settings.
29
- * @param payload - The edit payload.
30
- */
31
- editPushover(payload: PushoverEditRequest): Promise<MailcowResponse>;
32
- /**
33
- * Endpoint for editing a mailbox's quarantine settings.
34
- * @param payload - The edit payload.
35
- */
36
- editQuarantine(payload: QuarantaineEditRequest): Promise<MailcowResponse>;
37
- /**
38
- * Endpoint for editing a mailbox's spam score settings.
39
- * @param payload - The edit payload.
40
- */
41
- editSpamScore(payload: SpamScoreEditRequest): Promise<MailcowResponse>;
42
- /**
43
- * Endpoint for editing a mailbox's ACL settings.
44
- * @param payload - The edit payload.
45
- */
46
- editUserACL(payload: ACLEditRequest): Promise<MailcowResponse>;
47
- /**
48
- * Endpoint fot getting a mailbox's active sieve.
49
- * @param mailbox - The mailbox to get.
50
- */
51
- getActiveUserSieve(mailbox: string): Promise<string[]>;
52
- }
53
- /**
54
- * Binder function between the MailcowClient class and the MailboxEndpoints
55
- * @param bind - The MailcowClient to bind.
56
- * @internal
57
- */
58
- export declare function mailboxEndpoints(bind: MailcowClient): MailboxEndpoints;
1
+ import { ACLEditRequest, MailboxDeleteRequest, MailboxEditRequest, MailboxPostRequest, Mailbox, MailcowResponse, PushoverEditRequest, QuarantaineEditRequest, SpamScoreEditRequest } from '../types';
2
+ import MailcowClient from '../index';
3
+ /**
4
+ * Interface for all Mailbox endpoints.
5
+ */
6
+ export interface MailboxEndpoints {
7
+ /**
8
+ * Endpoint for creating a mailbox.
9
+ * @param payload - The creation payload.
10
+ */
11
+ create(payload: MailboxPostRequest): Promise<MailcowResponse>;
12
+ /**
13
+ * Endpoint for deleting a mailbox.
14
+ * @param payload - The deletion payload.
15
+ */
16
+ delete(payload: MailboxDeleteRequest): Promise<MailcowResponse>;
17
+ /**
18
+ * Endpoint for editing a mailbox.
19
+ * @param payload
20
+ */
21
+ edit(payload: MailboxEditRequest): Promise<MailcowResponse>;
22
+ /**
23
+ * Endpoint for getting a mailbox.
24
+ * @param mailbox - The mailbox to get
25
+ */
26
+ get(mailbox: string | 'all'): Promise<Mailbox[]>;
27
+ /**
28
+ * Endpoint for editing a mailbox's pushover settings.
29
+ * @param payload - The edit payload.
30
+ */
31
+ editPushover(payload: PushoverEditRequest): Promise<MailcowResponse>;
32
+ /**
33
+ * Endpoint for editing a mailbox's quarantine settings.
34
+ * @param payload - The edit payload.
35
+ */
36
+ editQuarantine(payload: QuarantaineEditRequest): Promise<MailcowResponse>;
37
+ /**
38
+ * Endpoint for editing a mailbox's spam score settings.
39
+ * @param payload - The edit payload.
40
+ */
41
+ editSpamScore(payload: SpamScoreEditRequest): Promise<MailcowResponse>;
42
+ /**
43
+ * Endpoint for editing a mailbox's ACL settings.
44
+ * @param payload - The edit payload.
45
+ */
46
+ editUserACL(payload: ACLEditRequest): Promise<MailcowResponse>;
47
+ /**
48
+ * Endpoint fot getting a mailbox's active sieve.
49
+ * @param mailbox - The mailbox to get.
50
+ */
51
+ getActiveUserSieve(mailbox: string): Promise<string[]>;
52
+ }
53
+ /**
54
+ * Binder function between the MailcowClient class and the MailboxEndpoints
55
+ * @param bind - The MailcowClient to bind.
56
+ * @internal
57
+ */
58
+ export declare function mailboxEndpoints(bind: MailcowClient): MailboxEndpoints;
@@ -1,42 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mailboxEndpoints = void 0;
4
- const request_factory_1 = require("../request-factory");
5
- /**
6
- * Binder function between the MailcowClient class and the MailboxEndpoints
7
- * @param bind - The MailcowClient to bind.
8
- * @internal
9
- */
10
- function mailboxEndpoints(bind) {
11
- return {
12
- create(payload) {
13
- return bind.requestFactory.post('/api/v1/add/mailbox', payload);
14
- },
15
- delete(payload) {
16
- return bind.requestFactory.post('/api/v1/delete/mailbox', payload.mailboxes);
17
- },
18
- edit(payload) {
19
- return bind.requestFactory.post('/api/v1/edit/mailbox', payload);
20
- },
21
- get(mailbox = 'all') {
22
- return request_factory_1.wrapPromiseToArray(bind.requestFactory.get(`/api/v1/get/mailbox/${mailbox}`));
23
- },
24
- editPushover(payload) {
25
- return bind.requestFactory.post('/api/v1/edit/pushover', payload);
26
- },
27
- editQuarantine(payload) {
28
- return bind.requestFactory.post('/api/v1/edit/quarantine_notification', payload);
29
- },
30
- editSpamScore(payload) {
31
- return bind.requestFactory.post('/api/v1/edit/spam-score', payload);
32
- },
33
- editUserACL(payload) {
34
- return bind.requestFactory.post('/api/v1/edit/user-acl', payload);
35
- },
36
- getActiveUserSieve(mailbox) {
37
- return bind.requestFactory.get(`/api/v1/get/active-user-sieve/${mailbox}`);
38
- }
39
- };
40
- }
41
- exports.mailboxEndpoints = mailboxEndpoints;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mailboxEndpoints = void 0;
4
+ const request_factory_1 = require("../request-factory");
5
+ /**
6
+ * Binder function between the MailcowClient class and the MailboxEndpoints
7
+ * @param bind - The MailcowClient to bind.
8
+ * @internal
9
+ */
10
+ function mailboxEndpoints(bind) {
11
+ return {
12
+ create(payload) {
13
+ return bind.requestFactory.post('/api/v1/add/mailbox', payload);
14
+ },
15
+ delete(payload) {
16
+ return bind.requestFactory.post('/api/v1/delete/mailbox', payload.mailboxes);
17
+ },
18
+ edit(payload) {
19
+ return bind.requestFactory.post('/api/v1/edit/mailbox', payload);
20
+ },
21
+ get(mailbox = 'all') {
22
+ return (0, request_factory_1.wrapPromiseToArray)(bind.requestFactory.get(`/api/v1/get/mailbox/${mailbox}`));
23
+ },
24
+ editPushover(payload) {
25
+ return bind.requestFactory.post('/api/v1/edit/pushover', payload);
26
+ },
27
+ editQuarantine(payload) {
28
+ return bind.requestFactory.post('/api/v1/edit/quarantine_notification', payload);
29
+ },
30
+ editSpamScore(payload) {
31
+ return bind.requestFactory.post('/api/v1/edit/spam-score', payload);
32
+ },
33
+ editUserACL(payload) {
34
+ return bind.requestFactory.post('/api/v1/edit/user-acl', payload);
35
+ },
36
+ getActiveUserSieve(mailbox) {
37
+ return bind.requestFactory.get(`/api/v1/get/active-user-sieve/${mailbox}`);
38
+ }
39
+ };
40
+ }
41
+ exports.mailboxEndpoints = mailboxEndpoints;
42
42
  //# sourceMappingURL=mailbox-endpoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mailbox-endpoint.js","sourceRoot":"","sources":["../../src/Endpoints/mailbox-endpoint.ts"],"names":[],"mappings":";;;AAYA,wDAAwD;AA6DxD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAmB;IAClD,OAAO;QACL,MAAM,CAAC,OAA2B;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,qBAAqB,EACrB,OAAO,CACR,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,OAA6B;YAClC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,wBAAwB,EACxB,OAAO,CAAC,SAAS,CAClB,CAAC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,CAAC,cAAc,CAAC,IAAI,CAC7B,wBAAwB,EACxB,OAAO,CAAC,SAAS,CAClB,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAA2B;YAC9B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,sBAAsB,EACtB,OAAO,CACR,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,UAAkB,KAAK;YACzB,OAAO,IAAA,oCAAkB,EACvB,IAAI,CAAC,cAAc,CAAC,GAAG,CACrB,uBAAwB,OAAQ,EAAE,CAAC,CACtC,CAAC;QACJ,CAAC;QAED,YAAY,CAAC,OAA4B;YACvC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,uBAAuB,EACvB,OAAO,CACR,CAAC;QACJ,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,CAC7B,yBAAyB,EACzB,OAAO,CACR,CAAC;QACJ,CAAC;QAED,WAAW,CAAC,OAAuB;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAC7B,uBAAuB,EACvB,OAAO,CACR,CAAC;QACJ,CAAC;QAED,kBAAkB,CAAC,OAAe;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAC5B,iCAAkC,OAAQ,EAAE,CAC7C,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAhED,4CAgEC"}
@@ -1,24 +1,24 @@
1
- import MailcowClient from '../index';
2
- import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from '../types';
3
- export interface SyncjobEndpoints {
4
- /**
5
- * Endpoint for creating sync jobs.
6
- * @param payload - The creation payload.
7
- */
8
- create(payload: SyncjobPostRequest): Promise<MailcowResponse>;
9
- /**
10
- * Endpoint for editing sync jobs.
11
- * @param payload - The edit payload.
12
- */
13
- edit(payload: SyncjobUpdateRequest): Promise<MailcowResponse>;
14
- /**
15
- * Endpoint for deleting sync jobs
16
- * @param payload - The deletion payload.
17
- */
18
- delete(payload: SyncjobDeleteRequest): Promise<MailcowResponse>;
19
- /**
20
- * Endpoint for getting all sync jobs.
21
- */
22
- getAll(): Promise<Syncjob[]>;
23
- }
24
- export declare function syncjobEndpoints(bind: MailcowClient): SyncjobEndpoints;
1
+ import MailcowClient from '../index';
2
+ import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from '../types';
3
+ export interface SyncjobEndpoints {
4
+ /**
5
+ * Endpoint for creating sync jobs.
6
+ * @param payload - The creation payload.
7
+ */
8
+ create(payload: SyncjobPostRequest): Promise<MailcowResponse>;
9
+ /**
10
+ * Endpoint for editing sync jobs.
11
+ * @param payload - The edit payload.
12
+ */
13
+ edit(payload: SyncjobUpdateRequest): Promise<MailcowResponse>;
14
+ /**
15
+ * Endpoint for deleting sync jobs
16
+ * @param payload - The deletion payload.
17
+ */
18
+ delete(payload: SyncjobDeleteRequest): Promise<MailcowResponse>;
19
+ /**
20
+ * Endpoint for getting all sync jobs.
21
+ */
22
+ getAll(): Promise<Syncjob[]>;
23
+ }
24
+ export declare function syncjobEndpoints(bind: MailcowClient): SyncjobEndpoints;
@@ -1,21 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syncjobEndpoints = void 0;
4
- function syncjobEndpoints(bind) {
5
- return {
6
- getAll() {
7
- return bind.requestFactory.get('/api/v1/get/syncjobs/all/no_log');
8
- },
9
- create(payload) {
10
- return bind.requestFactory.post('/api/v1/add/syncjob', payload);
11
- },
12
- edit(payload) {
13
- return bind.requestFactory.post('/api/v1/edit/syncjob', payload);
14
- },
15
- delete(payload) {
16
- return bind.requestFactory.post('/api/v1/delete/syncjob', payload.items);
17
- }
18
- };
19
- }
20
- exports.syncjobEndpoints = syncjobEndpoints;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.syncjobEndpoints = void 0;
4
+ function syncjobEndpoints(bind) {
5
+ return {
6
+ getAll() {
7
+ return bind.requestFactory.get('/api/v1/get/syncjobs/all/no_log');
8
+ },
9
+ create(payload) {
10
+ return bind.requestFactory.post('/api/v1/add/syncjob', payload);
11
+ },
12
+ edit(payload) {
13
+ return bind.requestFactory.post('/api/v1/edit/syncjob', payload);
14
+ },
15
+ delete(payload) {
16
+ return bind.requestFactory.post('/api/v1/delete/syncjob', payload.items);
17
+ }
18
+ };
19
+ }
20
+ exports.syncjobEndpoints = syncjobEndpoints;
21
21
  //# sourceMappingURL=syncjob-endpoints.js.map
package/dist/index.d.ts CHANGED
@@ -1,86 +1,86 @@
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
- /**
14
- * Class containing all the logic to interface with the Mailcow API in TypeScript.
15
- * @external
16
- */
17
- declare class MailcowClient {
18
- /**
19
- * The base URL of the Mailcow API.
20
- */
21
- readonly BASE_URL: string;
22
- /**
23
- * The API key of the Mailcow API.
24
- */
25
- readonly API_KEY: string;
26
- /**
27
- * The headers used for every request.
28
- * @internal
29
- */
30
- HEADERS: AxiosRequestConfig;
31
- /**
32
- * Creates a MailcowClient using the given URL and API key.
33
- * @param BASE_URL - The base URL of the Mailcow API.
34
- * @param API_KEY - The API key of the Mailcow API.
35
- * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
36
- */
37
- constructor(BASE_URL: string, API_KEY: string, EXTRA_AXIOS_CONFIG: AxiosRequestConfig);
38
- /**
39
- * Factory method pattern for creating HTTP requests.
40
- * @internal
41
- */
42
- requestFactory: RequestFactory;
43
- /**
44
- * All endpoints related to Aliases.
45
- * See {@link AliasEndpoints}
46
- * @external
47
- */
48
- aliases: AliasEndpoints;
49
- /**
50
- * All endpoints related to Domains.
51
- * See {@link DomainEndpoints}
52
- * @external
53
- */
54
- domains: DomainEndpoints;
55
- /**
56
- * All endpoints related to spam policies.
57
- * See {@link AntiSpamEndpoints}
58
- * @external
59
- */
60
- spamPolicy: AntiSpamEndpoints;
61
- /**
62
- * All endpoints related to mailboxes.
63
- * See {@link MailboxEndpoints}
64
- * @external
65
- */
66
- mailbox: MailboxEndpoints;
67
- /**
68
- * All endpoints related to sync jobs.
69
- * See {@link SyncjobEndpoints}
70
- * @external
71
- */
72
- syncjobs: SyncjobEndpoints;
73
- /**
74
- * All endpoints related to forwarding hosts.
75
- * See {@link ForwardingEndpoints}
76
- * @external
77
- */
78
- forwardingHosts: ForwardingEndpoints;
79
- /**
80
- * All endpoints related to logs.
81
- * See {@link LogEndpoints}
82
- * @external
83
- */
84
- logs: LogEndpoints;
85
- }
86
- export default MailcowClient;
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
+ /**
14
+ * Class containing all the logic to interface with the Mailcow API in TypeScript.
15
+ * @external
16
+ */
17
+ declare class MailcowClient {
18
+ /**
19
+ * The base URL of the Mailcow API.
20
+ */
21
+ readonly BASE_URL: string;
22
+ /**
23
+ * The API key of the Mailcow API.
24
+ */
25
+ readonly API_KEY: string;
26
+ /**
27
+ * The headers used for every request.
28
+ * @internal
29
+ */
30
+ HEADERS: AxiosRequestConfig;
31
+ /**
32
+ * Creates a MailcowClient using the given URL and API key.
33
+ * @param BASE_URL - The base URL of the Mailcow API.
34
+ * @param API_KEY - The API key of the Mailcow API.
35
+ * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
36
+ */
37
+ constructor(BASE_URL: string, API_KEY: string, EXTRA_AXIOS_CONFIG?: AxiosRequestConfig);
38
+ /**
39
+ * Factory method pattern for creating HTTP requests.
40
+ * @internal
41
+ */
42
+ requestFactory: RequestFactory;
43
+ /**
44
+ * All endpoints related to Aliases.
45
+ * See {@link AliasEndpoints}
46
+ * @external
47
+ */
48
+ aliases: AliasEndpoints;
49
+ /**
50
+ * All endpoints related to Domains.
51
+ * See {@link DomainEndpoints}
52
+ * @external
53
+ */
54
+ domains: DomainEndpoints;
55
+ /**
56
+ * All endpoints related to spam policies.
57
+ * See {@link AntiSpamEndpoints}
58
+ * @external
59
+ */
60
+ spamPolicy: AntiSpamEndpoints;
61
+ /**
62
+ * All endpoints related to mailboxes.
63
+ * See {@link MailboxEndpoints}
64
+ * @external
65
+ */
66
+ mailbox: MailboxEndpoints;
67
+ /**
68
+ * All endpoints related to sync jobs.
69
+ * See {@link SyncjobEndpoints}
70
+ * @external
71
+ */
72
+ syncjobs: SyncjobEndpoints;
73
+ /**
74
+ * All endpoints related to forwarding hosts.
75
+ * See {@link ForwardingEndpoints}
76
+ * @external
77
+ */
78
+ forwardingHosts: ForwardingEndpoints;
79
+ /**
80
+ * All endpoints related to logs.
81
+ * See {@link LogEndpoints}
82
+ * @external
83
+ */
84
+ logs: LogEndpoints;
85
+ }
86
+ export default MailcowClient;
package/dist/index.js CHANGED
@@ -1,83 +1,83 @@
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
- /**
15
- * Class containing all the logic to interface with the Mailcow API in TypeScript.
16
- * @external
17
- */
18
- class MailcowClient {
19
- /**
20
- * Creates a MailcowClient using the given URL and API key.
21
- * @param BASE_URL - The base URL of the Mailcow API.
22
- * @param API_KEY - The API key of the Mailcow API.
23
- * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
24
- */
25
- constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) {
26
- /**
27
- * Factory method pattern for creating HTTP requests.
28
- * @internal
29
- */
30
- this.requestFactory = new request_factory_1.default(this);
31
- /**
32
- * All endpoints related to Aliases.
33
- * See {@link AliasEndpoints}
34
- * @external
35
- */
36
- this.aliases = alias_endpoints_1.aliasEndpoints(this);
37
- /**
38
- * All endpoints related to Domains.
39
- * See {@link DomainEndpoints}
40
- * @external
41
- */
42
- this.domains = domain_endpoints_1.domainEndpoints(this);
43
- /**
44
- * All endpoints related to spam policies.
45
- * See {@link AntiSpamEndpoints}
46
- * @external
47
- */
48
- this.spamPolicy = antispam_endpoints_1.antiSpamEndpoints(this);
49
- /**
50
- * All endpoints related to mailboxes.
51
- * See {@link MailboxEndpoints}
52
- * @external
53
- */
54
- this.mailbox = mailbox_endpoint_1.mailboxEndpoints(this);
55
- /**
56
- * All endpoints related to sync jobs.
57
- * See {@link SyncjobEndpoints}
58
- * @external
59
- */
60
- this.syncjobs = syncjob_endpoints_1.syncjobEndpoints(this);
61
- /**
62
- * All endpoints related to forwarding hosts.
63
- * See {@link ForwardingEndpoints}
64
- * @external
65
- */
66
- this.forwardingHosts = forwarding_endpoints_1.forwardingEndpoints(this);
67
- /**
68
- * All endpoints related to logs.
69
- * See {@link LogEndpoints}
70
- * @external
71
- */
72
- this.logs = log_endpoints_1.logEndpoints(this);
73
- this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
74
- this.API_KEY = API_KEY;
75
- // Set the correct Axios headers.
76
- this.HEADERS = Object.assign({ headers: {
77
- 'Content-Type': 'application/json',
78
- 'X-API-Key': this.API_KEY
79
- } }, EXTRA_AXIOS_CONFIG);
80
- }
81
- }
82
- exports.default = MailcowClient;
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
+ /**
15
+ * Class containing all the logic to interface with the Mailcow API in TypeScript.
16
+ * @external
17
+ */
18
+ class MailcowClient {
19
+ /**
20
+ * Creates a MailcowClient using the given URL and API key.
21
+ * @param BASE_URL - The base URL of the Mailcow API.
22
+ * @param API_KEY - The API key of the Mailcow API.
23
+ * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive.
24
+ */
25
+ constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) {
26
+ /**
27
+ * Factory method pattern for creating HTTP requests.
28
+ * @internal
29
+ */
30
+ this.requestFactory = new request_factory_1.default(this);
31
+ /**
32
+ * All endpoints related to Aliases.
33
+ * See {@link AliasEndpoints}
34
+ * @external
35
+ */
36
+ this.aliases = (0, alias_endpoints_1.aliasEndpoints)(this);
37
+ /**
38
+ * All endpoints related to Domains.
39
+ * See {@link DomainEndpoints}
40
+ * @external
41
+ */
42
+ this.domains = (0, domain_endpoints_1.domainEndpoints)(this);
43
+ /**
44
+ * All endpoints related to spam policies.
45
+ * See {@link AntiSpamEndpoints}
46
+ * @external
47
+ */
48
+ this.spamPolicy = (0, antispam_endpoints_1.antiSpamEndpoints)(this);
49
+ /**
50
+ * All endpoints related to mailboxes.
51
+ * See {@link MailboxEndpoints}
52
+ * @external
53
+ */
54
+ this.mailbox = (0, mailbox_endpoint_1.mailboxEndpoints)(this);
55
+ /**
56
+ * All endpoints related to sync jobs.
57
+ * See {@link SyncjobEndpoints}
58
+ * @external
59
+ */
60
+ this.syncjobs = (0, syncjob_endpoints_1.syncjobEndpoints)(this);
61
+ /**
62
+ * All endpoints related to forwarding hosts.
63
+ * See {@link ForwardingEndpoints}
64
+ * @external
65
+ */
66
+ this.forwardingHosts = (0, forwarding_endpoints_1.forwardingEndpoints)(this);
67
+ /**
68
+ * All endpoints related to logs.
69
+ * See {@link LogEndpoints}
70
+ * @external
71
+ */
72
+ this.logs = (0, log_endpoints_1.logEndpoints)(this);
73
+ this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
74
+ this.API_KEY = API_KEY;
75
+ // Set the correct Axios headers.
76
+ this.HEADERS = Object.assign({ headers: {
77
+ 'Content-Type': 'application/json',
78
+ 'X-API-Key': this.API_KEY
79
+ } }, EXTRA_AXIOS_CONFIG);
80
+ }
81
+ }
82
+ exports.default = MailcowClient;
83
83
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js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