UNPKG

@exceptionless/fetchclient

Version:

A simple fetch client with middleware support for Deno and the browser.

53 lines 2.06 kB
import type { Counter } from "./Counter.js"; import type { FetchClientCache } from "./FetchClientCache.js"; import type { FetchClientMiddleware } from "./FetchClientMiddleware.js"; import type { FetchClientProvider } from "./FetchClientProvider.js"; import type { ProblemDetails } from "./ProblemDetails.js"; import type { RequestOptions } from "./RequestOptions.js"; type Fetch = typeof globalThis.fetch; /** * Fetch client options to use for making HTTP requests. */ export type FetchClientOptions = { /** * The fetch client provider to get shared options from. Any options specified in this options class will override the provider options. */ provider?: FetchClientProvider; /** * The default request options to use for requests. If specified, these options will be merged with the * options from the FetchClientProvider and the options provided in each request. */ defaultRequestOptions?: RequestOptions; /** * The cache to use for storing HTTP responses. */ cache?: FetchClientCache; /** * The fetch implementation to use for making HTTP requests. * If not provided, the global fetch function will be used. */ fetch?: Fetch; /** * An array of middleware functions to be applied to the request. */ middleware?: FetchClientMiddleware[]; /** * The base URL for making HTTP requests. */ baseUrl?: string; /** * A function that validates the model before making the request. * Returns a Promise that resolves to a ProblemDetails object if validation fails, or null if validation succeeds. */ modelValidator?: (model: object | null) => Promise<ProblemDetails | null>; /** * A function that returns the access token to use for making requests. */ accessTokenFunc?: () => string | null; /** * Counter for tracking the number of inflight requests at the provider level */ providerCounter?: Counter; } & Record<string, unknown>; export {}; //# sourceMappingURL=FetchClientOptions.d.ts.map