@prezly/theme-kit-core
Version:
Data layer and utility library for developing Prezly themes with JavaScript
21 lines (20 loc) • 641 B
TypeScript
export interface HttpClient {
get<T>(url: string, query?: Record<string, string | number | undefined | null>): Promise<T>;
withHeaders(headers: Record<string, string>): HttpClient;
}
export interface Options {
fetch?: typeof fetch;
headers?: Record<string, string>;
}
export declare function create(options?: Options): HttpClient;
interface Status {
code: number;
text: string;
}
export declare class HttpError extends Error {
readonly status: Status;
readonly body: string | undefined;
readonly headers: Headers;
constructor(status: Status, headers: Headers, body?: string | undefined);
}
export {};