@marxlnfcs/wildduck-api
Version:
Provides a client to interact with the wildduck api
48 lines (47 loc) • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WildduckAutoRepliesService = void 0;
const client_component_1 = require("../../client-component");
const create_http_client_1 = require("../../../internals/create-http-client");
class WildduckAutoRepliesService extends client_component_1.WildduckClientComponent {
deleteAutoReply(user) {
return new Promise(async (resolve, reject) => {
this.http.delete('/users/{user}/autoreply', { params: { user } })
.then(r => {
this.events.emitFromResponse(this.deleteAutoReply, r);
resolve(r.data);
})
.catch((e) => {
this.events.emitFromError(this.deleteAutoReply, e);
reject((0, create_http_client_1.createHttpException)(e));
});
});
}
getAutoReply(user) {
return new Promise(async (resolve, reject) => {
this.http.get('/users/{user}/autoreply', { params: { user } })
.then(r => {
this.events.emitFromResponse(this.getAutoReply, r);
resolve(r.data);
})
.catch((e) => {
this.events.emitFromError(this.getAutoReply, e);
reject((0, create_http_client_1.createHttpException)(e));
});
});
}
updateAutoReply(user, dto) {
return new Promise(async (resolve, reject) => {
this.http.put('/users/{user}/autoreply', { params: { user }, body: dto })
.then(r => {
this.events.emitFromResponse(this.updateAutoReply, r);
resolve(r.data);
})
.catch((e) => {
this.events.emitFromError(this.updateAutoReply, e);
reject((0, create_http_client_1.createHttpException)(e));
});
});
}
}
exports.WildduckAutoRepliesService = WildduckAutoRepliesService;