API
@ogygia/router/api
The typed fetch client for a route table's endpoints.
On this page
This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source.
import { … } from '@ogygia/router/api';Exports api · ApiError · ApiClient · ApiClientOptions
api
function
function api<App>(base: string, opts?: ApiClientOptions): ApiClient<App>;ApiError
class
class ApiError extends Error {/*…*/}ApiError.status
readonly status: number;ApiError.body
readonly body: unknown;ApiClient
interface
interface ApiClient<App> {/*…*/}ApiClient.get
get<K extends KeysWith<App, "get">>(path: K, ...args: CallArgs<K>): Promise<OutOf<App, K, "get">>;ApiClient.delete
delete<K extends KeysWith<App, "delete">>(path: K, ...args: CallArgs<K>): Promise<OutOf<App, K, "delete">>;ApiClient.post
post<K extends KeysWith<App, "post">>(path: K, ...args: CallArgs<K, InOf<App, K, "post">>): Promise<OutOf<App, K, "post">>;ApiClient.put
put<K extends KeysWith<App, "put">>(path: K, ...args: CallArgs<K, InOf<App, K, "put">>): Promise<OutOf<App, K, "put">>;ApiClient.patch
patch<K extends KeysWith<App, "patch">>(path: K, ...args: CallArgs<K, InOf<App, K, "patch">>): Promise<OutOf<App, K, "patch">>;ApiClientOptions
interface
interface ApiClientOptions {/*…*/}ApiClientOptions.headers
Extra headers on every call (auth tokens, signed hops — compose with sign_headers).
headers?: Record<string, string>;ApiClientOptions.fetch
Custom fetch (a Kit event's cookie-forwarding fetch, a test stub). Default: global.
fetch?: typeof fetch;