import { type CallOptions, type Fetch } from './rpc-client.js'; export type RouteOperation = { method: TMethod; path: TPath; query?: TQuery; body?: TBody; output?: TOutput; stream?: TStream; }; type AnyOperation = { method: string; path: string; query?: unknown; body?: unknown; output?: unknown; stream?: boolean; }; type QueryOf = NonNullable; type BodyOf = NonNullable; type OutputOf = NonNullable; export type RouteCallOptions = CallOptions; type PathParamNames = TPath extends `${string}{${infer TParam}}${infer TRest}` ? TParam extends `+${infer TName}` ? TName | PathParamNames : TParam | PathParamNames : never; type PathArgs = [PathParamNames] extends [ never ] ? object : { params: Record, string>; }; type QueryArgs = [O['query']] extends [undefined] ? object : { query?: QueryOf; }; type BodyArgs = [O['body']] extends [undefined] ? object : { body: BodyOf; }; type CallArgs = PathArgs & QueryArgs & BodyArgs; type HasRequiredArgs = [ PathParamNames ] extends [never] ? [O['body']] extends [undefined] ? false : true : true; export type RouteMethod = (...args: true extends HasRequiredArgs ? [args: CallArgs, options?: RouteCallOptions] : [args?: CallArgs, options?: RouteCallOptions]) => true extends O['stream'] ? AsyncIterable> : Promise>; export type ClientOf = { [K in keyof TRoutes]: TRoutes[K] extends AnyOperation ? RouteMethod : never; }; export type RestClientOptions = { baseUrl?: string; fetch?: Fetch; }; type RouteDescriptor = { method: string; path: string; stream?: boolean; }; export declare function createRestClient(routes: Record, options?: RestClientOptions): ClientOf; export {}; //# sourceMappingURL=client.d.ts.map