UNPKG

culqi-node

Version:

Typescript wrapper for Culqi web services developed for Node.js with 0 runtime dependencies

22 lines (21 loc) 1.24 kB
/// <reference types="node" /> /// <reference types="node" /> import https from 'https'; import { IncomingMessage } from 'http'; export type RequestMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'; export type HttpProvider = typeof https; export type HttpRequestOptions = { method?: RequestMethod; useSecureEndpoint?: true; headers?: Record<string, string>; queryParams?: Record<string, string>; body?: Record<string, unknown>; _httpProvider?: HttpProvider; }; declare function _httpResponseCallback<T>(res: IncomingMessage, resolve: (r: T) => void, reject: (e: Error) => void): void; declare function request<T>(path: string, options?: HttpRequestOptions): Promise<T>; declare function get<T>(path: string, queryParams?: Record<string, string>, options?: Partial<HttpRequestOptions>): Promise<T>; declare function post<T>(path: string, body?: Record<string, unknown>, options?: Partial<HttpRequestOptions>): Promise<T>; declare function delete_<T>(path: string, options?: Partial<HttpRequestOptions>): Promise<T>; declare function patch<T>(path: string, body?: Record<string, unknown>, options?: Partial<HttpRequestOptions>): Promise<T>; export { get, post, patch, delete_, request, _httpResponseCallback };