@dappykit/sdk
Version:
Web3 SDK for DApps
28 lines (27 loc) • 996 B
TypeScript
export declare class HttpClient {
readonly baseUrl: string;
constructor(baseUrl: string);
/**
* Gets the full URL for the given path
* @param path Path to append to the base URL
*/
getUrl(path: string): string;
/**
* Gets the JSON response for the given path
* @param path Path to append to the base URL
* @param addRand Whether to add a random query parameter to the URL
*/
getJson<T>(path: string, addRand?: boolean): Promise<T>;
/**
* Posts the given form data to the given path and returns the JSON response
* @param path Path to append to the base URL
* @param body Body to send in the request
*/
postJson<T>(path: string, body: unknown): Promise<T>;
/**
* Gets the text response for the given path
* @param path Path to append to the base URL
* @param addRand Whether to add a random query parameter to the URL
*/
getText(path: string, addRand?: boolean): Promise<string>;
}