import { RequestInit, Response } from 'node-fetch'; import { CanRetryDecision, ClientDelayedRequestEvent, ClientEvent, ClientEvents, ClientRequestEvent, ClientResponseEvent, RateLimitConfig, RateLimitState, RetryConfig } from './types'; /** * @param events `ClientEventEmitter` to which request lifecycle `ClientEvents` will * be published, allowing a client to reuse the emitter across a number of * requests. * @param request `APIRequest` defining everything necessary to execute a * request */ export declare function executeAPIRequest(events: ClientEventEmitter, request: APIRequest): Promise; type APIRequest = { url: string; hash: string; exec: () => Promise; retryConfig: RetryConfig; rateLimitConfig: RateLimitConfig; rateLimitState: RateLimitState; }; type APIRequestAttempt = APIRequest & { completed: boolean; retryable: boolean; retryDecision?: CanRetryDecision; totalAttempts: number; retryAttempts: number; rateLimitedAttempts: number; }; type APIResponse = { request: APIRequestAttempt; response: Response; completed: boolean; status: Response['status']; statusText: Response['statusText']; rateLimitState: RateLimitState; }; type ListenerEvent = ClientResponseEvent | ClientDelayedRequestEvent | ClientRequestEvent; type PickListenerEvent = L extends { type: E; } ? L : never; type RegisteredClientEventListener = { event: ClientEvents; listener: (...args: any) => void; }; /** * An event emitter designed for specific events in the lifecycle of executing a * request. */ export declare class ClientEventEmitter { private events; constructor(); on(event: E, listener: (event: PickListenerEvent) => void, options?: { path?: string; }): RegisteredClientEventListener; removeListener(listener: RegisteredClientEventListener): void; emit(event: E): void; } export declare function hashAPIRequest(init: RequestInit): string; export type UsernamePassword = { username: string; password: string; }; export declare function basicAuthentication({ username, password, }: UsernamePassword): string; export declare function buildAuthenticatedRequestInit(init: RequestInit, basicAuth: string): RequestInit; export {}; //# sourceMappingURL=request.d.ts.map