bungie-api-ts
Version:
TypeScript mappings for the Bungie.net API
19 lines (18 loc) • 798 B
TypeScript
export type HttpQueryParams = Record<string, string>;
export interface HttpClientConfig {
method: 'GET' | 'POST';
url: string;
/** Query string params */
params?: HttpQueryParams;
/** Request body */
body?: any;
}
/**
* A generic, minimal type for providing an HTTP client function.
* This gets the necessary config provided as an argument, and then
* should produce a promise for the parsed JSON as a result. The API
* helper functions will use this to return the right type.
*/
export type HttpClient = <Return>(config: HttpClientConfig) => Promise<Return>;
export declare function get<Return>(http: HttpClient, url: string, params?: HttpQueryParams): Promise<Return>;
export declare function post<Return>(http: HttpClient, url: string, body?: any): Promise<Return>;