ts-mailcow-api
Version:
TypeScript wrapper for the mailcow API.
32 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.domainEndpoints = domainEndpoints;
const request_factory_1 = require("../request-factory");
const DOMAIN_ENDPOINTS = {
GET: 'get/domain',
ADD: 'add/domain',
DELETE: 'delete/domain',
EDIT: 'edit/domain',
};
/**
* Binder function between the MailcowClient class and the DomainEndpoints.
* @param bind - The MailcowClient to bind.
* @internal
*/
function domainEndpoints(bind) {
return {
get(domain = 'all') {
return (0, request_factory_1.wrapPromiseToArray)(bind.requestFactory.get(DOMAIN_ENDPOINTS.GET + `/${domain}`));
},
create(payload) {
return bind.requestFactory.post(DOMAIN_ENDPOINTS.ADD, payload);
},
delete(payload) {
return bind.requestFactory.post(DOMAIN_ENDPOINTS.DELETE, payload.domains);
},
edit(payload) {
return bind.requestFactory.post(DOMAIN_ENDPOINTS.EDIT, payload);
},
};
}
//# sourceMappingURL=domain-endpoints.js.map