@signalwire/js
Version:
21 lines • 812 B
TypeScript
interface InternalHttpResponse<T> extends Response {
parsedBody?: T;
}
declare function http<T>(input: string, init: RequestInit | undefined): Promise<InternalHttpResponse<T>>;
interface CreateHttpClientOptions extends RequestInit {
baseUrl: string;
/**
* Timeout in milliseconds
*/
timeout?: number;
}
interface HttpClientRequestInit extends Omit<RequestInit, 'body'> {
body?: Record<string, unknown>;
searchParams?: Record<string, any>;
}
export type CreateHttpClient = ReturnType<typeof createHttpClient>;
export declare const createHttpClient: ({ baseUrl, timeout, ...globalOptions }: CreateHttpClientOptions, fetcher?: typeof http) => <T>(path: string, options?: HttpClientRequestInit) => Promise<{
body: T;
}>;
export {};
//# sourceMappingURL=createHttpClient.d.ts.map