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.
@@ -1,5 +1,5 @@
1
- import MailcowClient from "../index";
2
- import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from "../types";
1
+ import MailcowClient from '../index';
2
+ import { MailcowResponse, Syncjob, SyncjobDeleteRequest, SyncjobPostRequest, SyncjobUpdateRequest } from '../types';
3
3
 
4
4
  export interface SyncjobEndpoints {
5
5
  /**
@@ -31,25 +31,25 @@ export function syncjobEndpoints(bind: MailcowClient): SyncjobEndpoints {
31
31
  getAll(): Promise<Syncjob[]> {
32
32
  return bind.requestFactory.get<Syncjob[]>(
33
33
  '/api/v1/get/syncjobs/all/no_log'
34
- )
34
+ );
35
35
  },
36
36
  create(payload: SyncjobPostRequest): Promise<MailcowResponse> {
37
37
  return bind.requestFactory.post<MailcowResponse>(
38
38
  '/api/v1/add/syncjob',
39
39
  payload
40
- )
40
+ );
41
41
  },
42
42
  edit(payload: SyncjobUpdateRequest): Promise<MailcowResponse> {
43
43
  return bind.requestFactory.post<MailcowResponse>(
44
44
  '/api/v1/edit/syncjob',
45
45
  payload
46
- )
46
+ );
47
47
  },
48
48
  delete(payload: SyncjobDeleteRequest): Promise<MailcowResponse> {
49
49
  return bind.requestFactory.post<MailcowResponse>(
50
50
  '/api/v1/delete/syncjob',
51
51
  payload.items
52
- )
52
+ );
53
53
  }
54
- }
54
+ };
55
55
  }
package/src/index.ts CHANGED
@@ -8,7 +8,9 @@ import { antiSpamEndpoints, AntiSpamEndpoints } from './Endpoints/antispam-endpo
8
8
  import { mailboxEndpoints, MailboxEndpoints } from './Endpoints/mailbox-endpoint';
9
9
  import RequestFactory from './request-factory';
10
10
  import { aliasEndpoints, AliasEndpoints } from './Endpoints/alias-endpoints';
11
- import { syncjobEndpoints, SyncjobEndpoints } from "./Endpoints/syncjob-endpoints";
11
+ import { syncjobEndpoints, SyncjobEndpoints } from './Endpoints/syncjob-endpoints';
12
+ import { forwardingEndpoints, ForwardingEndpoints } from './Endpoints/forwarding-endpoints';
13
+ import { logEndpoints, LogEndpoints } from './Endpoints/log-endpoints';
12
14
 
13
15
  /**
14
16
  * Class containing all the logic to interface with the Mailcow API in TypeScript.
@@ -37,7 +39,7 @@ class MailcowClient {
37
39
  * @param API_KEY - The API key of the Mailcow API.
38
40
  */
39
41
  constructor(BASE_URL: string, API_KEY: string) {
40
- this.BASE_URL = BASE_URL;
42
+ this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/');
41
43
  this.API_KEY = API_KEY;
42
44
 
43
45
  // Set the correct Axios headers.
@@ -89,6 +91,20 @@ class MailcowClient {
89
91
  * @external
90
92
  */
91
93
  public syncjobs: SyncjobEndpoints = syncjobEndpoints(this)
94
+
95
+ /**
96
+ * All endpoints related to forwarding hosts.
97
+ * See {@link ForwardingEndpoints}
98
+ * @external
99
+ */
100
+ public forwardingHosts: ForwardingEndpoints = forwardingEndpoints(this)
101
+
102
+ /**
103
+ * All endpoints related to logs.
104
+ * See {@link LogEndpoints}
105
+ * @external
106
+ */
107
+ public logs: LogEndpoints = logEndpoints(this)
92
108
  }
93
109
 
94
110
  export default MailcowClient;