jspteroapi
Version:
A pterodactyl v1 api using undici
62 lines (61 loc) • 7.32 kB
TypeScript
import { JSPteroAPIError } from '../modules/Error';
declare class Application {
private host;
private key;
private errorHandler;
/**
* @param host - Panels address
* @param key - Api key to use
* @param fast - Fast login (No credential check)
*/
constructor(host: string, key: string, errorHandler?: (error: JSPteroAPIError) => void, fast?: boolean);
/**
* @param throwError - Whether to throw an error or return bool
* @remarks Will not work if using custom error handler.
*/
testAPI: (throwError?: boolean) => Promise<boolean>;
/**
@internal
*/
request: (requestType: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", data: unknown, dataObj: string, endpoint: string, text?: boolean) => Promise<any>;
getAllServers: (options?: import("./interfaces/Server").ServerIncludesInput | undefined, filter?: import("./interfaces/Server").ServerFilterInput | undefined) => Promise<import("./interfaces/Server").Server[]>;
getAllNodes: (options?: import("./interfaces/Node").NodeIncludeInput | undefined, filter?: import("./interfaces/Node").NodeFilterInput | undefined) => Promise<import("./interfaces/Node").Node[]>;
getAllUsers: (options?: import("./interfaces/User").UserIncludeInput | undefined, filter?: import("./interfaces/User").UserFilterInput | undefined) => Promise<import("./interfaces/User").User[]>;
getUserInfo: (userId: number, options?: import("./interfaces/User").UserIncludeInput | undefined) => Promise<import("./interfaces/User").UserAttributes>;
getNodeInfo: (nodeId: number, options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").NodeAttributes>;
getServerInfo: (serverId: number, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
getAllNests: (options?: import("./interfaces/Nest").NestIncludeInput | undefined) => Promise<import("./interfaces/Nest").Nest[]>;
getNestInfo: (nestId: number, options?: import("./interfaces/Nest").NestIncludeInput | undefined) => Promise<import("./interfaces/Nest").NestAttributes>;
getAllNestEggs: (nestId: number, options?: import("./interfaces/Nest").EggIncludeInput | undefined) => Promise<import("./interfaces/Egg").Egg[]>;
getEggInfo: (nestID: number, eggId: number, options?: import("./interfaces/Nest").EggIncludeInput | undefined) => Promise<import("./interfaces/Egg").EggAttributes>;
getServerInfoByExtId: (serverId: string, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
getServersDatabases: (serverId: number, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").Database[]>;
getServersDatabaseInfo: (serverId: number, databaseId: number, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").DatabaseAttributes>;
getNodeConfig: (nodeId: number) => Promise<import("./interfaces/Node").NodeConfig>;
getAllAllocations: (nodeId: number, options?: import("./interfaces/Allocation").AllocationIncludeInput | undefined, filter?: import("./interfaces/Allocation").AllocationFilterInput | undefined) => Promise<import("./interfaces/Allocation").Allocation[]>;
getAllLocations: (options?: import("./interfaces/Location").LocationIncludeInput | undefined, filter?: import("./interfaces/Location").LocationFilterInput | undefined) => Promise<import("./interfaces/Location").Location[]>;
getLocationInfo: (locationId: number, options?: import("./interfaces/Location").LocationIncludeInput | undefined) => Promise<import("./interfaces/Location").LocationAttributes>;
createUser: (username: string, firstName: string, lastName: string, email: string, password?: string, isAdmin?: boolean, language?: string, externalId?: string | undefined) => Promise<import("./interfaces/User").UserAttributes>;
createServer: (name: string, ownerId: number, description: string, nestId: number, eggId: number, defaultAllocationId: number, addAllocationIds?: number[], environment?: import("./interfaces/Server").ServerEnvironment | undefined, cpu?: number, ram?: number, disk?: number, amountOfDatabases?: number, amountOfAllocations?: number, amountOfBackups?: number, startupCmd?: string | undefined, dockerImage?: string | undefined, swap?: number, io?: number, startOnCompletion?: boolean, options?: import("./interfaces/Server").ServerIncludesInput | undefined) => Promise<import("./interfaces/Server").ServerAttributes>;
createNode: (name: string, description: string, locationID: number, fqdn: string, scheme: "http" | "https", ram: number, disk: number, isPublic?: boolean, daemonPort?: number, daemonSFTPPort?: number, ramOverAllocate?: number, diskOverallocate?: number, daemonDir?: string, maintenceMode?: boolean, maxUploadSize?: number, behindProxy?: boolean, options?: import("./interfaces/Node").NodeIncludeInput | undefined) => Promise<import("./interfaces/Node").NodeAttributes>;
createDatabase: (name: string, dbHostId: number, serverId: number, allowedIp?: string, options?: import("./interfaces/Database").DatabaseIncludeInput | undefined) => Promise<import("./interfaces/Database").DatabaseAttributes>;
suspendServer: (internalID: number) => Promise<string>;
unSuspendServer: (internalID: number) => Promise<string>;
reinstallServer: (internalID: number) => Promise<string>;
resetDatabasePassword: (serverId: number, databaseId: number) => Promise<string>;
createAllocation: (nodeId: number, ports: string[], alias?: string, ip?: string) => Promise<string>;
createLocation: (shortName: string, description?: string | undefined, options?: import("./interfaces/Location").LocationIncludeInput | undefined) => Promise<import("./interfaces/Location").LocationAttributes>;
editUser: (userId: number, options: import("./interfaces/User").EditUserOptions) => Promise<import("./interfaces/User").UserAttributes>;
editServerDetails: (serverId: number, options: import("./interfaces/Server").EditServerDetails) => Promise<import("./interfaces/Server").ServerAttributes>;
editServerBuild: (serverId: number, options: import("./interfaces/Server").EditServerBuild) => Promise<import("./interfaces/Server").ServerAttributes>;
editServerStartup: (serverId: number, options: import("./interfaces/Server").EditServerStartup) => Promise<import("./interfaces/Server").ServerAttributes>;
editNode: (nodeId: number, options: import("./interfaces/Node").NodeEditOptions) => Promise<import("./interfaces/Node").NodeAttributes>;
editLocation: (locationId: number, options: import("./interfaces/Location").EditLocationOptions) => Promise<import("./interfaces/Location").LocationAttributes>;
deleteUser: (userId: number) => Promise<string>;
deleteNode: (nodeId: number) => Promise<string>;
deleteServer: (internalId: number, forceDelete?: boolean) => Promise<string>;
deleteDatabase: (serverId: number, databaseId: number) => Promise<string>;
deleteAllocation: (nodeId: number, allocationId: number) => Promise<string>;
deleteLocation: (locationId: number) => Promise<string>;
}
export { Application };