@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
33 lines • 1.15 kB
JavaScript
import { ELEVA_HEADER_IMPERSONATE } from '../../../../utils/http';
import { CRUD, deleteKeys } from '../../../../utils';
export class TicketingTaskConversationsAPI {
_httpClient;
_baseUrl;
_crud;
constructor(_httpClient, _baseUrl) {
this._httpClient = _httpClient;
this._baseUrl = _baseUrl;
this._crud = new CRUD(this._httpClient, {
basePath: this._baseUrl,
});
}
async create(data, opts) {
const path = `${this._baseUrl}`;
let headers = undefined;
if (opts?.createdBy) {
headers = headers || {};
headers[ELEVA_HEADER_IMPERSONATE] = opts.createdBy;
}
if (data.attachments) {
const attachments = data.attachments;
const formData = deleteKeys(data, ['attachments']);
formData.files = attachments;
return this._httpClient.form(path, formData, 'POST', undefined, headers);
}
return this._httpClient.post(path, data, undefined, headers);
}
async find(query) {
return this._crud.find(query);
}
}
//# sourceMappingURL=conversations.js.map