ts-mailcow-api
Version:
TypeScript wrapper for the mailcow API.
52 lines • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mailboxEndpoints = mailboxEndpoints;
const request_factory_1 = require("../request-factory");
const MAILBOX_ENDPOINTS = {
CREATE: 'add/mailbox',
DELETE: 'delete/mailbox',
EDIT: 'edit/mailbox',
GET: 'get/mailbox',
EDIT_PUSHOVER: 'edit/pushover',
EDIT_QUARANTAINE: 'edit/quarantine_notification',
EDIT_SPAM_SCORE: 'edit/spam-score',
EDIT_USER_ACL: 'edit/user-acl',
GET_ACTIVE_USER_SIEVE: 'get/active-user-sieve',
};
/**
* Binder function between the MailcowClient class and the MailboxEndpoints
* @param bind - The MailcowClient to bind.
* @internal
*/
function mailboxEndpoints(bind) {
return {
create(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.CREATE, payload);
},
delete(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.DELETE, payload.mailboxes);
},
edit(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.EDIT, payload);
},
get(mailbox = 'all') {
return (0, request_factory_1.wrapPromiseToArray)(bind.requestFactory.get(MAILBOX_ENDPOINTS.GET + `/${mailbox}`));
},
editPushover(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.EDIT_PUSHOVER, payload);
},
editQuarantine(payload) {
return bind.requestFactory.post('edit/quarantine_notification', payload);
},
editSpamScore(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.EDIT_SPAM_SCORE, payload);
},
editUserACL(payload) {
return bind.requestFactory.post(MAILBOX_ENDPOINTS.EDIT_USER_ACL, payload);
},
getActiveUserSieve(mailbox) {
return bind.requestFactory.get(MAILBOX_ENDPOINTS.GET_ACTIVE_USER_SIEVE + `/${mailbox}`);
},
};
}
//# sourceMappingURL=mailbox-endpoint.js.map