UNPKG

bananas-commerce

Version:

A client for bananas-commerce with support for TypeScript

12 lines (11 loc) 543 B
import { ExtractRequestBodyMediaTypes, FetchConfig, Middleware, OpenapiPaths, TypedFetch } from "./types.js"; export interface FetcherApi<Paths> { configure: (config: FetchConfig) => this; use: (mw: Middleware) => this; endpoint: <P extends keyof Paths>(path: P) => { method: <M extends keyof Paths[P], T extends ExtractRequestBodyMediaTypes<Paths[P][M]>>(method: M, mediaType?: T) => TypedFetch<Paths[P][M]>; }; } export declare const Fetcher: { for: <Paths extends OpenapiPaths<Paths>>() => FetcherApi<Paths>; };