UNPKG

node-api-request

Version:

Using Node-API-Request for Simplified HTTP Requests in Node.js

19 lines (18 loc) 523 B
export interface RequestOptions { url: string; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; headers?: { [key: string]: string; }; body?: any; params?: any; } export interface ApiResponse<T = any> { status: number; body: T; } export default class NodeApiRequest { static sendRequest<T = any>(options: RequestOptions): Promise<ApiResponse<T>>; protected static methodHasNoBody(method: string): boolean; protected static getQueryParams(req: RequestOptions): any; }