UNPKG

asaas

Version:

Unofficial Asaas Payment Gateway SDK

56 lines (55 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebhooksAPI = void 0; const BaseAPI_1 = require("./BaseAPI"); class WebhooksAPI extends BaseAPI_1.BaseAPI { constructor(apiClient, options = {}) { super(apiClient, options); } async create(params) { try { const response = await this.apiClient.post('/webhooks', params); return response.data; } catch (error) { return this.handleError(error, 'Erro ao criar uma novo webhook:'); } } async list() { try { const response = await this.apiClient.get('/webhooks'); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter a lista de webhooks:'); } } async getById(id) { try { const response = await this.apiClient.get(`/webhooks/${id}`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter o webhook:'); } } async delete(id) { try { const response = await this.apiClient.delete(`/webhooks/${id}`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao deletar o webhook:'); } } async updateById(id, params) { try { const response = await this.apiClient.post(`/webhooks/${id}`, params); return response.data; } catch (error) { return this.handleError(error, 'Erro ao atualizar o webhook:'); } } } exports.WebhooksAPI = WebhooksAPI;