/// /// /// import { AxiosRequestConfig } from 'axios'; import { URLSearchParams } from 'url'; import { IncomingMessage } from 'http'; import { ProxyConfig } from './types'; type HttpMethod = 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH'; /** * Options for sending HTTP requests. * @private */ interface SendRequestOptions { /** * Fields to include in message body (or params) as form-encoded data. Values must be either * strings, or arrays of strings (for repeated parameters). * Cannot be used together with jsonBody. */ data?: URLSearchParams; /** * JSON body to send with the request. If provided, Content-Type will be set to * application/json. Cannot be used together with data or fileBuffer. */ jsonBody?: Record; /** Extra HTTP headers to include in request, in addition to headers defined in constructor. */ headers?: Record; /** Buffer containing file data to include. */ fileBuffer?: Buffer; /** Filename of file to include. */ filename?: string; } /** * Internal class implementing HTTP requests. * @private */ export declare class HttpClient { private readonly serverUrl; private readonly headers; private readonly minTimeout; private readonly maxRetries; private readonly proxy?; constructor(serverUrl: string, headers: Record, maxRetries: number, minTimeout: number, proxy?: ProxyConfig); prepareRequest(method: HttpMethod, url: string, timeoutMs: number, responseAsStream: boolean, options: SendRequestOptions): AxiosRequestConfig; /** * Makes API request retrying if necessary, and returns (as Promise) response. * @param method HTTP method, for example 'GET' * @param url Path to endpoint, excluding base server URL. * @param options Additional options controlling request. * @param responseAsStream Set to true if the return type is IncomingMessage. * @return Fulfills with status code and response (as text or stream). */ sendRequestWithBackoff(method: HttpMethod, url: string, options?: SendRequestOptions, responseAsStream?: boolean): Promise<{ statusCode: number; content: TContent; }>; /** * Performs given HTTP request and returns status code and response content (text or stream). * @param axiosRequestConfig * @private */ private static sendAxiosRequest; private static shouldRetry; } export {};