UNPKG

asaaas

Version:

Unofficial Asaas Payment Gateway SDK

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