Promise type fix
This commit is contained in:
parent
577cf284b2
commit
98f3b98055
|
@ -1,11 +1,9 @@
|
||||||
import { authorize, requestWithDefaults } from "./util";
|
import { authorize, requestWithDefaults } from "./util";
|
||||||
|
|
||||||
export type HypixelResponse<T> = Promise<
|
export type HypixelResponse<T> = {
|
||||||
{
|
_response: Response;
|
||||||
_response: Response;
|
success: boolean;
|
||||||
success: boolean;
|
} & T;
|
||||||
} & T
|
|
||||||
>;
|
|
||||||
|
|
||||||
export const ENDPOINT = "https://api.hypixel.net/";
|
export const ENDPOINT = "https://api.hypixel.net/";
|
||||||
const request = requestWithDefaults(ENDPOINT);
|
const request = requestWithDefaults(ENDPOINT);
|
||||||
|
@ -15,15 +13,17 @@ const request = requestWithDefaults(ENDPOINT);
|
||||||
* @param key API key
|
* @param key API key
|
||||||
* @returns A response with the API key information
|
* @returns A response with the API key information
|
||||||
*/
|
*/
|
||||||
export async function getAPIKeyInformation(key: string): HypixelResponse<{
|
export async function getAPIKeyInformation(key: string): Promise<
|
||||||
record?: {
|
HypixelResponse<{
|
||||||
key: string;
|
record?: {
|
||||||
owner: string;
|
key: string;
|
||||||
limit: number;
|
owner: string;
|
||||||
queriesInPastMin: number;
|
limit: number;
|
||||||
totalQueries: number;
|
queriesInPastMin: number;
|
||||||
};
|
totalQueries: number;
|
||||||
}> {
|
};
|
||||||
|
}>
|
||||||
|
> {
|
||||||
let response = await request("/key", authorize(key));
|
let response = await request("/key", authorize(key));
|
||||||
return {
|
return {
|
||||||
...(await response.json()),
|
...(await response.json()),
|
||||||
|
|
Loading…
Reference in New Issue