import type { RequestCredentials } from "node-fetch"; type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; type QueryParams = Record>; export type FetcherOptions = { host: string; token?: string; apiKey?: string; teamID?: string; envID?: string; envSlug?: string; runID?: string; source?: string; tunnelToken?: string; sandboxToken?: string; retryDelay?: (attempt: number) => number; clientKind: string; clientVersion: string; headers?: Record; mode?: RequestMode; credentials?: RequestCredentials; }; export type RequestOptions = { abortSignal?: AbortSignal; host?: string; timeoutMs?: number; idempotencyKey?: string; headers?: Record; retryNetworkErrors?: boolean; }; export declare class Fetcher { private opts; private httpAgent; private httpsAgent; constructor(opts: FetcherOptions); get(path: string, queryParams?: QueryParams, opts?: RequestOptions): Promise; post(path: string, body?: Record, opts?: RequestOptions): Promise; put(path: string, body?: Record, opts?: RequestOptions): Promise; patch(path: string, body?: Record, opts?: RequestOptions): Promise; delete(path: string, body?: Record, opts?: RequestOptions): Promise; protected request(path: string, method: Method, opts?: RequestOptions & { queryParams?: QueryParams; body?: Record; }): Promise; } /** * Applies exponential backoff (with jitter) to compute how long to backoff between requests. * * Inspired by: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ * @param attempt number of attempts that have been performed so far (should start at 1) * @returns a duration, in milliseconds, to backoff */ export declare const defaultRetryDelay: (attempt: number) => number; export declare const isJSONResponse: (response: Response) => boolean; /** * Checks for and parses the Retry-After header, if any. * * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After * @returns duration to wait, in milliseconds, else undefined if not set or invalid. */ export declare const parseRetryAfter: (header: string | null | undefined) => number | undefined; export {};