UNPKG

jspteroapi

Version:

A pterodactyl v1 api using undici

132 lines (131 loc) 4.73 kB
import { Client } from '../index'; import { ApiKey } from '../interfaces/ApiKey'; import { Permissions } from '../interfaces/Permissions'; import { UserAttributes } from '../interfaces/User'; export declare class accountMethods { private readonly client; constructor(client: Client); /** * @returns Permission data * @remarks Just returns all available permissions. Not that useful! * @example * ```ts * const res = await client.getPermissions() // res = Permissions * ``` * @example * ```ts * client.getPermissions().then((res) => console.log(res)) // res = Permissions * ``` */ getAllPermissions: () => Promise<Permissions>; /** * @returns Account information * @example * ```ts * const res = await client.getAccountInfo() // res = UserAttributes * ``` * @example * ```ts * client.getAccountInfo().then((res) => console.log(res)) // res = UserAttributes * ``` */ getAccountInfo: () => Promise<UserAttributes>; /** * @returns TOTP QR code image url (otpauth) * ```ts * const res = await client.getAccountInfo() // res = string (otpauth) * ``` * @example * ```ts * client.getAccountInfo().then((res) => console.log(res)) // res = string (otpauth) * ``` */ getAccount2FADetails: () => Promise<string>; /** * @param code - The code from authenticator * @returns Tokens * ```ts * const res = await client.enable2FA('505134') // res = string[] (tokens) * ``` * @example * ```ts * client.enable2FA('505134').then((res) => console.log(res)) // res = string[] (tokens) * ``` */ enable2FA: (code: string) => Promise<string[]>; /** * @param password - The code from authenticator * @returns If succesful returns Successfully disable 2FA! * ```ts * const res = await client.disable2FA('securepassword') // res = Successfully disable 2FA! * ``` * @example * ```ts * client.disable2FA('securepassword').then((res) => console.log(res)) // res = Successfully disable 2FA! * ``` */ disable2FA: (password: string) => Promise<string>; /** * @param email - The new email address * @param password - The password of the user * @returns If succesful returns Successfully updated email! * ```ts * const res = await client.updateEmail('jspteroapi@linux123123.cf', 'verySecurePass') // res = Successfully updated email! * ``` * @example * ```ts * client.updateEmail('jspteroapi@linux123123.cf', 'verySecurePass').then((res) => console.log(res)) // res = Successfully updated email! * ``` */ updateEmail: (email: string, password: string) => Promise<string>; /** * @param currentPassword - The currect passowrd * @param password - The new password * @returns If succesful returns Successfully updated password! * ```ts * const res = await client.updatePassword('verySecurePass', 'moreSecurePass') // res = Successfully updated password! * ``` * @example * ```ts * client.updatePassword('verySecurePass', 'moreSecurePass').then((res) => console.log(res)) // res = Successfully updated password! * ``` */ updatePassword: (currentPassword: string, password: string) => Promise<string>; /** * @returns Api key array * @example * ```ts * const res = await client.getAllApiKeys() // res = ApiKey[] * ``` * @example * ```ts * client.getAllApiKeys().then((res) => console.log(res)) // res = ApiKey[] * ``` */ getAllApiKeys: () => Promise<ApiKey[]>; /** * @param description - Api key description * @param allowedIps - Array of allowed IP addresses (default empty []) * @returns The new api key information + meta (token) * ```ts * const res = await client.createApiKey('TESTING', []) // res = ApiKey + meta (token) * ``` * @example * ```ts * client.createApiKey('TESTING', []).then((res) => console.log(res)) // res = ApiKey + meta (token) * ``` */ createApiKey: (description: string, allowedIps?: string[]) => Promise<ApiKey>; /** * @param apiKeyIden - The api keys identifier code * @returns If succesful returns Successfully deleted api key! * ```ts * const res = await client.deleteApiKey('NWKMYMT2Mrav0Iq2') // res = Successfully deleted api key! * ``` * @example * ```ts * client.deleteApiKey('NWKMYMT2Mrav0Iq2').then((res) => console.log(res)) // res = Successfully deleted api key! * ``` */ deleteApiKey: (apiKeyIden: string) => Promise<string>; }