UNPKG

ws-dottie

Version:

Your friendly TypeScript companion for Washington State transportation APIs - WSDOT and WSF data with smart caching and React Query integration

40 lines 1.46 kB
/** * @fileoverview Unified Fetch Tool for WS-Dottie * * This module provides a single, unified fetch function that combines * transport strategy (native vs JSONP) and validation strategy (with/without Zod) * into one easy-to-use interface. */ import type { FetchDottieParams } from "./types"; /** * Unified fetch function for WS-Dottie APIs * * This function provides a single entry point for all API calls with clear * control over fetch strategy and validation approach. It replaces the four * separate fetch functions with a more flexible and maintainable interface. * * @template TInput - The input parameters type * @template TOutput - The output response type * @param options - Configuration object with endpoint, params, and options * @returns Promise resolving to response data (validated and transformed as configured) * * @example * ```typescript * // Fetch without validation * const data = await fetchDottie({ * endpoint: myEndpoint, * params: { route: "SEA-BI" }, * fetchMode: "native", * logMode: "info" * }); * * // Fetch with validation * const validatedData = await fetchDottie({ * endpoint: myEndpoint, * params: { route: "SEA-BI" }, * validate: true * }); * ``` */ export declare const fetchDottie: <TInput = never, TOutput = unknown>({ endpoint, params, fetchMode, logMode, validate, }: FetchDottieParams<TInput, TOutput>) => Promise<TOutput>; //# sourceMappingURL=fetchDottie.d.ts.map