UNPKG

@voiceflow/fetch

Version:

Voiceflow fetch wrapper and error handling for SDKs

34 lines 1.72 kB
import type { ClientConfiguration } from './client-configuration.interface.js'; import type { FetchAPI, FetchOptions, FetchResponse } from './fetch.interface.js'; import type { RequestOptions } from './request-options.interface.js'; export declare class FetchClient<Opts extends FetchOptions<any, any> = RequestInit, Req = URL | Request, Res extends FetchResponse = Response> { private static extractHeaders; private static extractQuery; private static formatURL; private readonly config; private readonly fetch; constructor(config?: ClientConfiguration); constructor(fetch: FetchAPI<Opts, Req, Res>, options?: ClientConfiguration); private send; private createMethod; raw(...args: Parameters<FetchAPI<Opts, Req, Res>>): Promise<Res>; delete: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; get: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; head: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; patch: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; post: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; put: (url: string | Req, options?: Omit<RequestOptions<Opts>, "method">) => Promise<Res> & { json: <T = unknown>() => Promise<T>; }; } //# sourceMappingURL=fetch.client.d.ts.map