/** HTTP methods supported by the SDK */ type HttpMethod = 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE'; /** Shape of the `meta` field present in all Radar API responses */ interface RadarApiMeta { error?: string; message?: string; type?: string; /** * Attached from the `x-radar-request-id` response header * For use when reporting an issue to Radar */ requestId?: string; } /** Base shape all Radar API JSON responses share */ interface RadarApiResponse { meta?: RadarApiMeta; [key: string]: unknown; } /** Blob response shape returned when responseType is 'blob' */ interface RadarBlobResponse { meta?: undefined; code: number; data: Blob; } export type RadarResponse = RadarApiResponse | RadarBlobResponse; /** Request configuration for Http.request */ interface HttpRequestOptions { method: HttpMethod; path: string; data?: Record; host?: string; version?: string; headers?: Record; responseType?: 'blob' | 'json'; requestId?: string; /** when true, the request survives a page unload (fire-and-forget beacons) */ keepalive?: boolean; } /** fetch-based HTTP client for Radar API requests */ declare class Http { /** map of host patterns to custom error factories for intercepting network errors */ static errorInterceptors: Map Error>; /** * register a custom error factory for network errors matching a host pattern * @param hostPattern - substring matched against the request host * @param handler - factory that receives online status and returns an error */ static registerErrorInterceptor(hostPattern: string, handler: (online: boolean) => Error): void; /** * send an HTTP request to the Radar API * @param options - request configuration * @returns parsed response body, typed as `T` * @throws {RadarPublishableKeyError} if neither publishable key nor authToken is set * @throws {RadarBadRequestError} on 400 responses * @throws {RadarUnauthorizedError} on 401 responses * @throws {RadarNetworkError} on network failures */ static request(options: HttpRequestOptions & { responseType: 'blob'; }): Promise; static request = RadarApiResponse>(options: HttpRequestOptions): Promise; } export default Http;