@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
40 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentsBinAPI = exports.DocumentsAPI = void 0;
const crud_1 = require("../../../../utils/crud");
class DocumentsAPI extends crud_1.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);
}
}
exports.DocumentsAPI = DocumentsAPI;
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);
}
}
exports.DocumentsBinAPI = DocumentsBinAPI;
//# sourceMappingURL=documents.js.map