UNPKG

@vivocha/request-retry

Version:

HTTP requests with retry, and API client utilities

34 lines (33 loc) 982 B
export interface HTTPAuthOptions { authorizationType?: string; token?: string; user?: string; password?: string; } export declare type errorCodePattern = number | string; export interface APICallOptions { method?: APICallOptions.Method; path?: string; qs?: any; body?: any; headers?: any; json?: boolean; authOptions?: HTTPAuthOptions; timeout?: number; retries: number; retryAfter?: number; minRetryAfter?: number; maxRetryAfter?: number; doNotRetryOnErrors?: errorCodePattern[]; getFullResponse?: boolean; } export declare namespace APICallOptions { type Method = 'get' | 'post' | 'put' | 'delete' | 'options' | 'head' | 'patch' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; } export declare class APICallError extends Error { name: string; data: any; status: number; message: string; constructor(name?: string, data?: any, status?: number, message?: string); }