From 6cb86433e0190cdead1e213fa3d11391ba9c56e4 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 19 May 2022 18:55:26 +0000 Subject: better achievements --- src/hypixel.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/hypixel.ts') diff --git a/src/hypixel.ts b/src/hypixel.ts index e0575dd..ba0b83c 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -53,13 +53,18 @@ export interface ApiOptions { basic?: boolean } -/** Sends an API request to Hypixel and cleans it up. */ -export async function sendCleanApiRequest

(path: P, args: Omit, options?: ApiOptions): Promise>> { +/** Sends an API request to Hypixel and returns the response. */ +export async function sendUncleanApiRequest

(path: P, args: Omit): Promise { const key = await chooseApiKey() const data = await sendApiRequest(path, { key, ...args }) if (!data) throw new Error(`No data returned from ${path}`) - // clean the response + return data +} + +/** Sends an API request to Hypixel and cleans it up. */ +export async function sendCleanApiRequest

(path: P, args: Omit, options?: ApiOptions): Promise>> { + const data = await sendUncleanApiRequest(path, args) return await cleanResponse(path, data, options ?? {}) } -- cgit