import { API, ZodBase } from '../def'; import type { Axios, AxiosRequestConfig } from 'axios'; import { z } from 'zod'; /** * A type-safe API client function. * If the API has a DTO, the client takes a `data` argument. * Otherwise, it takes no arguments. * @returns A Promise that resolves with the API's Value Object (VO) or void. */ export type ApiClient = (...args: DTO extends void ? [] : [data: DTO]) => Promise; /** * Base configuration for an API client. */ export interface ClientInfoBase { /** An optional Axios instance to use for requests. */ axios?: Axios; /** Optional Axios request configuration. */ requestConfig?: AxiosRequestConfig; /** An optional callback to handle errors. */ onError?: (err: unknown) => Promise; } /** * Configuration object for creating a typed API client. */ export interface ClientInfo extends ClientInfoBase { /** The API definition created by `defineAPI`. */ api: API; } /** * Creates a type-safe client function for a given API definition. * @param clientInfo The client configuration, including the API definition and optional request settings. * @returns A function that can be called to make requests to the specified API endpoint. */ export declare function clientOfAPI(clientInfo: ClientInfo): ApiClient : void, VO extends ZodBase ? z.output : void>; //# sourceMappingURL=use.d.ts.map