import type { HerokuApiClientOptions, RequestOptions } from '@heroku/heroku-fetch'; import type { RouteDefinition } from '@heroku/types/types'; type RoutesModule = Record>; /** * Subset of `RequestOptions` that makes sense to apply across every * call on a derived client. Per-call concerns like `searchParams` * and `stream` are deliberately excluded — those belong on the * individual route call, not on the client wrapper. */ export type StickyRouteOptions = Pick & { /** * Request body applied to write calls on the derived client. Primarily * for methods whose route metadata lacks `hasRequestBody` (e.g. DELETE * with a `force` payload) where the body cannot be passed positionally. * The underlying client forwards this as the JSON payload. */ body?: unknown; }; /** * Methods available on every routes-generated client in addition to * the resources/methods generated from the routes registry. */ export type RoutesClientExtras = { /** * Convenience wrapper around `withOptions({headers})`. Kept for * backward compatibility; new code should prefer `withOptions`. */ withHeaders(headers: Record): RoutesClientExtras & T; /** * Returns a same-shaped client where each route call applies the * provided options. Caller-supplied headers override the api-client's * defaults; subsequent `withOptions` calls layer headers and replace * signal / timeout / reauthorize. * * Pass `reauthorize: false` to opt the derived client's calls out of the * client-level 401 refresh (see {@link RequestOptions.reauthorize}) — for * call sites where a 401 means something other than an expired Heroku * credential and must not drive a login. * * The original client is not mutated. */ withOptions(options: StickyRouteOptions): RoutesClientExtras & T; }; export declare function createClient(routes: RoutesModule, options?: HerokuApiClientOptions): RoutesClientExtras & T; export {};