import { Anonymize, NamedParams, Paths, RequestBody, ResponseBody } from '../util'; import { HttpSchema, Method } from '../shared'; /** Returns a strongly typed object for making requests to a remote HTTP server that implements the given `schema`. */ export declare function createHttpClient(schema: S, options?: Partial): HttpClient; /** Options for `createHttpClient`. */ export interface HttpClientOptions { /** Will be prepended request paths unless they are absolute. Default is blank. */ baseURL: string; /** * Specifies the number of milliseconds before the request times out. * A value of zero indicates no timeout should be applied. Default is zero. */ timeout: number; /** * Indicates whether or not cross-site Access-Control requests should * be made using credentials. Default is false. See Axios docs. */ withCredentials: boolean; } /** Strongly typed object for making requests to a remote HTTP server that implements the schema `S`. */ export declare type HttpClient = { [M in Method as Lowercase]:

>(path: P, ...info: HasNamedParamsOrBody extends false ? [RequestInfo?] : [RequestInfo]) => Promise>; }; /** Strongly-typed object used to provide details for a HTTP request to a specific route. */ declare type RequestInfo = Anonymize<(HasNamedParams extends true ? { params: Record, string>; } : { params?: Record; }) & (HasBody extends true ? { body: RequestBody; } : { body?: never; })>; /** Helper type that resolves to `true` if the route for the given method/path has defined namedParams. */ declare type HasNamedParams = NamedParams extends never ? false : true; /** Helper type that resolves to `true` if the route for the given method/path has defined requestBody. */ declare type HasBody = RequestBody extends undefined ? false : true; /** Helper type that resolves to `true` if the route for the given method/path has namedParams and/or requestBody. */ declare type HasNamedParamsOrBody = HasNamedParams extends true ? true : HasBody; export {};