UNPKG

asaas

Version:

Unofficial Asaas Payment Gateway SDK

65 lines (64 loc) 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomersAPI = void 0; const BaseAPI_1 = require("./BaseAPI"); class CustomersAPI extends BaseAPI_1.BaseAPI { constructor(apiClient, options = {}) { super(apiClient, options); } async new(customerData) { try { const response = await this.apiClient.post('/customers', customerData); return response.data; } catch (error) { return this.handleError(error, 'Erro ao criar o cliente:'); } } async list(params) { try { const response = await this.apiClient.get('/customers', { params }); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter a lista de clientes:'); } } async getById(id) { try { const response = await this.apiClient.get(`/customers/${id}`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter o cliente:'); } } async delete(id) { try { const response = await this.apiClient.delete(`/customers/${id}`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao deletar o cliente:'); } } async restore(id) { try { const response = await this.apiClient.post(`/customers/${id}/restore`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao restaurar o cliente:'); } } async updateById(id, customerData) { try { const response = await this.apiClient.post(`/customers/${id}`, customerData); return response.data; } catch (error) { return this.handleError(error, 'Erro ao atualizar o cliente:'); } } } exports.CustomersAPI = CustomersAPI;