UNPKG

@vivocha/request-retry

Version:

HTTP requests with retry, and API client utilities

19 lines (18 loc) 1.01 kB
import { Logger } from 'debuggo'; import { APICallOptions } from './types'; export declare class APIClient { private baseUrl; protected logger: Logger; private firstCall; private readonly DEFAULT_MAX; constructor(baseUrl: string, logger?: Logger); call(options: APICallOptions): Promise<any>; private isDoNotRetryCode; static get(url: string, options?: APICallOptions, logger?: Logger): Promise<any>; static post(url: string, body: any, options?: APICallOptions, logger?: Logger): Promise<any>; static put(url: string, body: any, options?: APICallOptions, logger?: Logger): Promise<any>; static delete(url: string, options?: APICallOptions, logger?: Logger): Promise<any>; static patch(url: string, body: any, options?: APICallOptions, logger?: Logger): Promise<any>; static head(url: string, options?: APICallOptions, logger?: Logger): Promise<any>; } export declare function computeRetryAfter(current: number, addShift?: boolean, max?: number): number;