@gobistories/gobi-web-integration
Version:
This library will let you put your Gobi stories on your site.
28 lines (27 loc) • 933 B
TypeScript
import { Throttler } from './throttler';
/**
* Simple api error with HTTP status and message.
*/
export declare class HttpError extends Error {
readonly message: string;
readonly status: number;
readonly url?: string;
constructor(message: string, status: number, url?: string);
}
export declare class HttpClient {
private throttler;
constructor(throttler?: Throttler);
/**
* Executes the request.
*/
protected request<T>(method: string, url: string, headers?: Record<string, string>, body?: any): Promise<T | string | Blob>;
/**
* Performs a request with `get` http method.
*/
get<T>(url: string, query?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
/**
* Performs a request with `post` http method.
*/
post<T>(url: string, body?: any, headers?: Record<string, string>): Promise<T>;
}
export declare const httpClient: HttpClient;