import { type IEndpointInfo } from './endpoint.types.js'; import type { ApiCaller, GenericApiCaller } from './call.js'; export type IEndpointCaller> = ApiCaller & { readonly Endpoint: T; }; export type ApiDefinition = IEndpointInfo | { [key: string]: ApiDefinition; }; export type ApiRemapped = T extends IEndpointInfo ? TResult : T extends Record ? { [K in keyof T]: ApiRemapped; } : never; /** Converts each endpoint in a nested structure to something via transformer */ export declare function remapApisStructure(root: TApi, transformer: (api: IEndpointInfo) => TResult): ApiRemapped; export type ApiRunner> = T extends IEndpointInfo ? IEndpointCaller : T extends Record ? { [K in keyof T]: ApiRunner; } : never; /** Converts an composite API endpoints object to the same tree of functions */ export declare function buildApi>(api: TApi, caller: GenericApiCaller): ApiRunner; /** Partial application: binding an endpoint to callApi, so only input data and extra are passed to a newly created function. */ export declare function createEndpointCallable, TExtra extends object = Record>(endpoint: TEndpoint, caller: TCaller): IEndpointCaller;