UNPKG

@letsparky/api-v2-client

Version:

TypeScript client for the LetsParky API V2

41 lines (40 loc) 1.13 kB
/** * Cross-platform fetch adapter with React Native compatibility * Uses XMLHttpRequest to avoid React Native fetch bugs */ import { RateLimitInfo } from '../types'; /** * Response-like interface for XMLHttpRequest compatibility */ interface FetchResponse { status: number; statusText: string; ok: boolean; headers: { get: (name: string) => string | null; forEach: (callback: (value: string, key: string) => void) => void; }; text: () => Promise<string>; json: () => Promise<any>; } /** * Fetch with timeout support and React Native compatibility */ export declare function fetchWithTimeout(url: string, options?: RequestInit & { timeout?: number; }): Promise<FetchResponse>; /** * Parse JSON response with error handling */ export declare function parseResponse<T>(response: FetchResponse): Promise<{ data: T; status: number; headers: Record<string, string>; }>; /** * Extract rate limit info from response headers */ export declare function extractRateLimitInfo(headers: { get: (name: string) => string | null; }): RateLimitInfo | null; export {};