@sky-mavis/tanto-widget
Version:
Tanto Widget
14 lines (13 loc) • 489 B
TypeScript
export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
export interface RequestOptions {
method?: RequestMethod;
body?: unknown;
headers?: Record<string, string>;
timeout?: number;
}
export declare class RequestError extends Error {
readonly status: number;
readonly data: unknown;
constructor(message: string, status: number, data?: unknown);
}
export declare function request<T = unknown>(url: string, options?: RequestOptions): Promise<T>;