diff --git a/package.json b/package.json index cd04ce0..b7ab086 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tase-api", - "version": "1.0.0", + "version": "1.0.1", "description": "The official NPM wrapper for The All Seeing Eye's API", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/src/class.ts b/src/class.ts index 2738e27..fc3e7e7 100644 --- a/src/class.ts +++ b/src/class.ts @@ -4,12 +4,22 @@ import { CheckResult } from "./types"; const TASEApi = `https://tase-staging.thegoober.xyz` export class TASEClient { - private token: string; + /** + * The API Token used to authenticate through TASE's API. + */ + token: string; + /** + * @param APIToken The API Token used to authenticate through TASE's API + */ constructor(APIToken: string){ this.token = APIToken } + /** + * Checks if the current token is valid. + * @returns A boolean indicating if the current token can be used on TASE's API. + */ async validate(): Promise { const Response = await fetch(TASEApi + `/api/v1/key/validate`, { headers: { @@ -21,6 +31,12 @@ export class TASEClient { return Response.ok } + /** + * Checks a user for flags on TASE's Database. + * + * @param UserID A Discord UserId. + * @returns The check result for the user. + */ async checkUser(UserID: string): Promise { if(UserID.length < 16 || UserID.length > 20) throw new Error("A UserID must be between 16-20 characters.") @@ -45,6 +61,12 @@ export class TASEClient { return Response.json() } + /** + * Checks 2 or more users through the TASE Database. + * + * @param UserIDs An array of Discord UserIds ranging from 1 to 10,000 possible users. + * @returns An array of check results of users who are flagged throughout TASE's 3 databases. + */ async checkUsers(UserIDs: string[]): Promise> { if(UserIDs.find((Value) => Value.length < 16 || Value.length > 20)) throw new Error("All UserIDs must be between 16-20 characters.") if(UserIDs.length > 10000) throw new Error("The amount of UserIDs must be less than 10,000.")