osu-api-extended
Version:
Advanced osu! api wrapper for v1 and v2, with extra stuff
45 lines (44 loc) • 1.35 kB
TypeScript
interface RequestParams {
method?: string;
headers?: {
[key: string]: string;
};
data?: string;
params?: object | [object, ...object[]];
}
export interface RequestNamespace {
(url: string, params: {
method: string;
data?: string;
headers?: {
[key: string]: string;
};
params?: object;
}): Promise<any>;
}
/**
* Executes an HTTP request
* @param {string} url The url
* @returns {Promise<any>} The response
*/
export declare const request: (url: string, { method, headers, data, params }?: RequestParams) => Promise<any>;
/**
* Executes an HTTP request
* @param {string} url The url
* @param {string} dest The file destination
* @returns {Promise<any>} The response
*/
export declare const download: (url: string, dest: string, { headers, data, params }?: RequestParams, callback?: Function) => Promise<any>;
/**
* Makes a namespace
* @param {string} url The namespace url
* @param {{ query?: string }} [params] Options ig
* @returns {(params: string, { query: string }) => Promise<any>} The function that does the reqs
*/
export declare const namespace: (url: string, { query }?: {
query?: {
[key: string]: string;
};
headers?: Record<string, string>;
}) => RequestNamespace;
export {};