Skip to content

Commit

Permalink
Add NPC endpoint and cast type (closes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lavgup committed Dec 31, 2020
1 parent f1a353d commit 384c324
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<Buffer> {
return this.api('npc', { text1, text2 })
}

/**
* Makes a request for a rankcard.
* @param username - The username of the user levelling up.
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"moduleResolution": "node",
"target": "esnext",
"lib": [
"esnext"
"esnext",
"dom"
],
"declaration": true,
"removeComments": false,
Expand Down

0 comments on commit 384c324

Please sign in to comment.