jspteroapi
Version:
A pterodactyl v1 api using undici
101 lines (100 loc) • 3.82 kB
TypeScript
import { Application } from '../index';
import { EditUserOptions, User, UserAttributes, UserFilterInput, UserIncludeInput } from '../interfaces/User';
export declare class userMethods {
private readonly application;
constructor(application: Application);
/**
* @internal
*/
private getUsers;
/**
* @param options - Include information about relationships
* @param filter - Filter Users by specific fields and values
* @returns Array of users
* @example
* ```ts
* const res = await app.getAllUsers() // res = User[]
* ```
* @example
* ```ts
* app.getAllUsers().then((res) => console.log(res)) // res = User[]
* ```
*/
getAllUsers: (options?: UserIncludeInput, filter?: UserFilterInput) => Promise<User[]>;
/**
* @param userId - The user id to get information about
* @param options - Include information about relationships
* @returns User information
* @example
* ```ts
* const res = await app.getUserInfo(1) // res = UserAttributes
* ```
* @example
* ```ts
* app.getUserInfo(1).then((res) => console.log(res)) // res = UserAttributes
* ```
*/
getUserInfo: (userId: number, options?: UserIncludeInput) => Promise<UserAttributes>;
/**
* @param userId - The external user id to get information about
* @param options - Include information about relationships
* @returns User information
* @example
* ```ts
* const res = await app.getUserInfoByExtId(1) // res = UserAttributes
* ```
* @example
* ```ts
* app.getUserInfoByExtId(1).then((res) => console.log(res)) // res = UserAttributes
* ```
*/
getUserInfoByExtId: (userId: string, options?: UserIncludeInput) => Promise<UserAttributes>;
/**
* @param username - The username of the user
* @param firstName - The first name of the user
* @param lastName - The last name of the user
* @param email - The email address of the user
* @param password - The password of the user
* @param isAdmin - Is the user admin (default false)
* @param language - The language of the user (default en)
* @param externalId - The external id of user
* @param options - Include information about relationships
* @returns User information
* @example
* ```ts
* const res = await app.createUser('linux123123', 'Linus', 'ADMIN', 'api@gmail.com') // res = UserAttributes
* ```
* @example
* ```ts
* app.createUser('linux123123', 'Linus', 'ADMIN', 'api@gmail.com').then((res) => console.log(res)) // res = UserAttributes
* ```
*/
createUser: (username: string, firstName: string, lastName: string, email: string, password?: string, isAdmin?: boolean, language?: string, externalId?: string) => Promise<UserAttributes>;
/**
* @param userId - The user id of the user to edit
* @param options - Options to edit user
* @returns User information
* @example
* ```ts
* const res = await app.editUser(1, 'linux123123', undefined, 'ADMIN_LAST) // res = UserAttributes
* ```
* @example
* ```ts
* app.editUser(1, undefined, 'Linux').then((res) => console.log(res)) // res = UserAttributes
* ```
*/
editUser: (userId: number, options: EditUserOptions) => Promise<UserAttributes>;
/**
* @param userId - The user id of the user to delete
* @returns If successful returns Successfully deleted!
* @example
* ```ts
* const res = await app.deleteUser(1) // res = Successfully deleted!
* ```
* @example
* ```ts
* app.deleteUser(1).then((res) => console.log(res)) // res = Successfully deleted!
* ```
*/
deleteUser: (userId: number) => Promise<string>;
}