From 6b94d0110a52a355758432ff6cd14c80553471ea Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 25 Mar 2022 21:13:13 -0500 Subject: Add typed-hypixel-api as a dep and change some code --- test-data-generator/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test-data-generator/index.ts') diff --git a/test-data-generator/index.ts b/test-data-generator/index.ts index 18cefd7..f296c16 100644 --- a/test-data-generator/index.ts +++ b/test-data-generator/index.ts @@ -4,6 +4,7 @@ globalThis.isTest = true +import typedHypixelApi from 'typed-hypixel-api' import * as hypixelApi from '../src/hypixelApi' import * as constants from '../src/constants' import * as mojang from '../src/mojang' @@ -24,11 +25,10 @@ async function writeTestData(requestPath: string, name: string, contents: any) { await fs.writeFile(path.join(dir, `${name}.json`), JSON.stringify(contents, null, 2)) } -async function addResponse(requestPath: string, args: { [ key: string ]: string }, name: string) { - const response = await hypixelApi.sendApiRequest({ - path: requestPath, - args: args, - key: hypixelApi.chooseApiKey() +async function addResponse(requestPath: keyof typedHypixelApi.Requests, args: { [ key: string ]: string }, name: string) { + const response = await hypixelApi.sendApiRequest(requestPath, { + key: hypixelApi.chooseApiKey(), + ...args, }) await writeTestData(requestPath, name, response) } -- cgit