@hydro-protocol/hydro-client-js
Version:
Javascript SDK for the Hydro API
29 lines (28 loc) • 862 B
TypeScript
import { Account } from './HydroClient';
export interface ApiHandlerOptions {
apiUrl?: string;
}
/**
* Handle building requests to the server, including authentication
* in the request header.
*/
export declare class ApiHandler {
private BASE_MESSAGE;
private API_URL;
private HEADER;
private account;
private options?;
constructor(account: Account, options?: ApiHandlerOptions);
/**
* Methods to perform standard get/post/delete requests to the api server.
* Only implemented these three since they are the only ones the api
* currently requires.
*/
get(path: string, params?: {}, sign?: boolean): Promise<any>;
post(path: string, data?: {}): Promise<any>;
delete(path: string): Promise<any>;
private getURL;
private getAuthHeaders;
private getApiUrl;
private handleResponse;
}