UNPKG

@vanakaru/ekilex-api-client

Version:

A node api client for the Ekilex API

52 lines (51 loc) 1.22 kB
export interface Headers { [key: string]: string; } export interface NormalizedRequest { method: string; url: string; headers: Headers; body?: { [key: string]: unknown; }; } export declare enum DataType { JSON = "application/json", GraphQL = "application/graphql", URLEncoded = "application/x-www-form-urlencoded", Binary = "application/octet-stream" } export declare enum Method { Get = "GET", Post = "POST", Put = "PUT", Patch = "PATCH", Delete = "DELETE", Head = "HEAD", Options = "OPTIONS", Connect = "CONNECT" } export declare type QueryParams = string | number | string[] | number[] | { [key: string]: QueryParams; }; export interface RequestParams { method: Method; path: string; data?: { [key: string]: unknown; } | string; query?: { [key: string]: QueryParams; }; headers?: Headers; retries?: number; } export declare class HttpClient { private apiKey; private basePath; static readonly RETRY_WAIT_TIME = 1000; constructor(apiKey: string, basePath: string); private doRequest; private sleep; request(requestParams: RequestParams): Promise<any>; }