@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
66 lines • 2.76 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TicketingTasksAPI = void 0;
const crud_1 = require("../../../../utils/crud");
const guards_1 = require("../../../../utils/guards");
const followers_1 = require("./followers");
const conversations_1 = require("./conversations");
const activity_logs_1 = require("./activity_logs");
const attachments_1 = require("./attachments");
const resources_1 = require("./resources");
const config_1 = require("./config");
class TicketingTasksAPI extends crud_1.CRUD {
_taskId;
constructor(httpClient, baseUrl, _taskId) {
super(httpClient, {
basePath: baseUrl,
id: _taskId,
});
this._taskId = _taskId;
}
async find(query) {
return super.find({ ...query, includeTeamResponsibles: true });
}
async findPaginated(query) {
const params = {
...query,
includeTeamResponsibles: true,
pagination: query?.pagination ?? { page: 0, size: 20 },
};
return this._httpClient.get(this._config.basePath, params);
}
async merge(data) {
(0, guards_1.requireField)('taskId', this._taskId);
return this._httpClient.patch(`${this._config.basePath}/${this._taskId}/merge`, data);
}
async metrics(query) {
return this._httpClient.get(`${this._config.basePath}/metrics`, query);
}
async inboxes() {
return this._httpClient.get(`${this._config.basePath}/inboxes`);
}
config() {
return new config_1.TicketingTaskConfigAPI(this._httpClient, `${this._config.basePath}/config`);
}
followers() {
(0, guards_1.requireField)('taskId', this._taskId);
return new followers_1.TicketingTaskFollowersAPI(this._httpClient, `${this._config.basePath}/${this._taskId}/followers`);
}
conversations() {
(0, guards_1.requireField)('taskId', this._taskId);
return new conversations_1.TicketingTaskConversationsAPI(this._httpClient, `${this._config.basePath}/${this._taskId}/conversations`);
}
activityLogs() {
(0, guards_1.requireField)('taskId', this._taskId);
return new activity_logs_1.TicketingTaskActivityLogsAPI(this._httpClient, `${this._config.basePath}/${this._taskId}/activity-logs`);
}
attachments() {
(0, guards_1.requireField)('taskId', this._taskId);
return new attachments_1.TicketingTaskAttachmentsAPI(this._httpClient, `${this._config.basePath}/${this._taskId}/attachments`);
}
resources() {
return new resources_1.TicketingTaskResourcesAPI(this._httpClient, `${this._config.basePath}`, this._taskId);
}
}
exports.TicketingTasksAPI = TicketingTasksAPI;
//# sourceMappingURL=tasks.js.map