facturapi
Version:
Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF
57 lines (56 loc) • 1.79 kB
TypeScript
import { GenericResponse, Retention, SearchResult, SendEmailBody } from '../types';
import { WrapperClient } from '../wrapper';
export default class Retentions {
client: WrapperClient;
constructor(client: WrapperClient);
/**
* Creates a new valid retention (CFDI).
* @param data
* @returns
*/
create(data: Record<string, any>): Promise<Retention>;
/**
* Gets a paginated list of retentions created by the organization
* @param params - Search parameters
* @returns
*/
list(params?: Record<string, any> | null): Promise<SearchResult<Retention>>;
/**
* Gets a single retention object
* @param id
* @returns
*/
retrieve(id: string): Promise<Retention>;
/**
* Cancels a retention.
* @param id
* @returns
*/
cancel(id: string): Promise<Retention>;
/**
* Sends a retention to the customer's email
* @param id Retention Id
* @param data Additional arguments
* @param data.email Email address to send the retention to
* @returns
*/
sendByEmail(id: string, data?: SendEmailBody): Promise<GenericResponse>;
/**
* Downloads the specified retention in PDF format
* @param id Retention Id
* @returns PDF file in a stream
*/
downloadPdf(id: string): Promise<NodeJS.ReadableStream>;
/**
* Downloads the specified retention in XML format
* @param id Retention Id
* @returns XML file in a stream
*/
downloadXml(id: string): Promise<NodeJS.ReadableStream>;
/**
* Downloads the specified retention in a ZIP package containing both PDF and XML files
* @param id Retention Id
* @returns ZIP file in a stream
*/
downloadZip(id: string): Promise<NodeJS.ReadableStream>;
}