UNPKG

@eleva-io/erp-sdk

Version:

SDK oficial para el ERP de Eleva

35 lines 1.1 kB
import { CRUD } from '../../../../utils/crud'; export class DocumentsAPI extends CRUD { constructor(httpClient, baseUrl, documentId) { super(httpClient, { basePath: baseUrl, id: documentId }); } bin() { return new DocumentsBinAPI(this._httpClient, `${this._config.basePath}/bin`); } create(data) { const path = `${this._config.basePath}`; return this._httpClient.form(path, { ...data }); } download(id) { const idParam = this._getIdParam(id); const path = `${this._config.basePath}/${idParam}/download`; return this._httpClient.getBinary(path); } } export class DocumentsBinAPI { _httpClient; _baseUrl; constructor(_httpClient, _baseUrl) { this._httpClient = _httpClient; this._baseUrl = _baseUrl; } async find() { const path = `${this._baseUrl}`; return this._httpClient.get(path); } async restore(id) { const path = `${this._baseUrl}/${id}/restore`; return this._httpClient.put(path); } } //# sourceMappingURL=documents.js.map