bananas-commerce
Version:
A client for bananas-commerce with support for TypeScript
18 lines (17 loc) • 695 B
TypeScript
import { ApiError, FetcherApi } from "./deps/deno.land/x/openapi_ts_fetch@2.1.0/index.js";
export declare class Api<Paths, Defaults> {
protected fetcher: FetcherApi<Paths> | undefined;
protected defaults: Defaults | undefined;
load(fetcher: FetcherApi<Paths>, defaults: Defaults): this;
/** */
protected assertLoaded<T = this>(): asserts this is T & {
fetcher: FetcherApi<Paths>;
defaults: Defaults;
};
/**
* Catches any {@link ApiError} thrown by the promise and returns the response
* or any thrown {@link ApiError}.
*/
protected catchApiError<R>(response: Promise<R>): Promise<R | ApiError>;
static Error: typeof ApiError;
}