This commit is contained in:
2025-10-09 22:13:52 -07:00
parent 9a743eb723
commit a20e8697fe
2 changed files with 24 additions and 2 deletions

View File

@ -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",

View File

@ -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<boolean> {
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<CheckResult> {
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<Array<CheckResult>> {
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.")