From 384c3245e40ac1219aefb69bff3168101163ba45 Mon Sep 17 00:00:00 2001 From: Sidemen19 Date: Thu, 31 Dec 2020 12:48:30 +1100 Subject: [PATCH] Add NPC endpoint and cast type (closes #3) --- package.json | 2 +- src/index.ts | 12 ++++++++++-- tsconfig.json | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fc74781..caa7720 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vacefron", - "version": "3.0.0", + "version": "3.1.0", "description": "A wrapper for the VACEfron API in TypeScript.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 526bb4c..9cd01d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,8 +30,7 @@ export class VACEFronJS { } } - // @ts-ignore - const params = new URLSearchParams(parameters); + const params = new URLSearchParams((parameters as URLSearchParams)); const response = await fetch(`${this.baseURL}/${endpoint}?${params}`); if (response.status !== 200) { @@ -150,6 +149,15 @@ export class VACEFronJS { return this.api('heaven', { user: avatarURL }); } + /** + * Makes a request for the NPC meme. + * @param text1 - The first text parameter. + * @param text2 - The second text parameter. + */ + public npc(text1: string, text2: string): Promise { + return this.api('npc', { text1, text2 }) + } + /** * Makes a request for a rankcard. * @param username - The username of the user levelling up. diff --git a/tsconfig.json b/tsconfig.json index 37cbc46..f9fce0e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "moduleResolution": "node", "target": "esnext", "lib": [ - "esnext" + "esnext", + "dom" ], "declaration": true, "removeComments": false,