UNPKG

facturapi

Version:

Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF

50 lines (49 loc) 1.79 kB
import { SearchResult, Webhook, ApiEvent, ApiEventType } from '../types'; import { WrapperClient } from '../wrapper'; export default class Webhooks { client: WrapperClient; constructor(client: WrapperClient); /** * Creates a new webhook in your organization * @param data - Webhook options * @returns Webhook object */ create(data: Record<string, any>): Promise<Webhook>; /** * Gets a paginated list of webhooks that belong to your organization * @param params - Search parameters * @returns Search results object. The object contains a `data` property with the list of webhooks. */ list(params: Record<string, any>): Promise<SearchResult<Webhook>>; /** * Gets a single webhook object * @param id - Webhook Id * @returns Webhook object */ retrieve(id: string): Promise<Webhook>; /** * Updates a webhook * @param id - Webhook Id * @param data Updated webhook data * @returns */ update(id: string, data: Record<string, any>): Promise<Webhook>; /** * Permanently removes a webhook from your organization. * @param id - Webhook Id * @returns Deleted webhook */ del(id: string): Promise<Webhook>; /** * Validate the response of webhook with the secret and facturapi-signature * @param secret - Webhook Secret, received in the webhook creation * @param signature - Facturapi Signature Header * @param payload - Received event object to validate * @returns When the signature is valid, it returns the event object */ validateSignature<T extends ApiEventType = any>(data: { secret: string; signature: string; payload: string | Buffer | ApiEvent<T>; }): Promise<ApiEvent<T>>; }