Class Client

Hierarchy

  • Client

Constructors

Properties

assignAllocation: ((serverId: string) => Promise<Allocation>)

Type declaration

    • (serverId: string): Promise<Allocation>
    • Remarks

      This method is only available if auto-assign is enabled

      Example

      const res = await client.assignAllocation('c2f5a3b6') // res = Allocation
      

      Example

      client.assignAllocation('c2f5a3b6').then((res) => console.log(res)) // res = Allocation
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<Allocation>

compressFile: ((serverId: string, data: ServerFileCompress) => Promise<ServerFileAttributes>)

Type declaration

    • (serverId: string, data: ServerFileCompress): Promise<ServerFileAttributes>
    • Returns

      Returns a archive file information

      Example

      const res = await client.compressFile('c2f5a3b6', { root: '/', files: ['README.md', 'LICENSE'] }) // res = ServerFileAttributes
      

      Example

      client.compressFile('c2f5a3b6', { root: '/', files: ['README.md', 'LICENSE'] }).then((res) => console.log(res)) // res = ServerFileAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • data: ServerFileCompress

        An object composed of root of the file and array of objects for files to rename

      Returns Promise<ServerFileAttributes>

copyFile: ((serverId: string, location: string) => Promise<string>)

Type declaration

    • (serverId: string, location: string): Promise<string>
    • Returns

      If successful returns Successfuly copied!

      Example

      const res = await client.copyFile('c2f5a3b6', '/LICENSE') // res = Successfuly copied!
      

      Example

      client.copyFile('c2f5a3b6', '/dist/LICENSE').then((res) => console.log(res)) // res = Successfuly copied!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • location: string

        Location of file to copy (e. g. /LICENSE) (It will create a /LICENSE copy)

      Returns Promise<string>

createApiKey: ((description: string, allowedIps?: string[]) => Promise<ApiKey>)

Type declaration

    • (description: string, allowedIps?: string[]): Promise<ApiKey>
    • Returns

      The new api key information + meta (token)

      const res = await client.createApiKey('TESTING', []) // res = ApiKey + meta (token)
      

      Example

      client.createApiKey('TESTING', []).then((res) => console.log(res)) // res = ApiKey + meta (token)
      

      Parameters

      • description: string

        Api key description

      • allowedIps: string[] = []

        Array of allowed IP addresses (default empty [])

      Returns Promise<ApiKey>

createBackup: ((serverId: string, name?: string, ignored?: string[], isLocked?: boolean) => Promise<BackupAttributes>)

Type declaration

    • (serverId: string, name?: string, ignored?: string[], isLocked?: boolean): Promise<BackupAttributes>
    • Returns

      Backup information

      Example

      const res = await client.createBackup('7e74354d') // res = BackupAttributes
      

      Example

      client.createBackup('7e74354d', 'RandomBackup').then((res) => console.log(res)) // res = BackupAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • name: string = ''

        Name of the backup

      • ignored: string[] = []

        Ignored files / folders

      • isLocked: boolean = false

      Returns Promise<BackupAttributes>

createDatabase: ((serverId: string, databaseName: string, connectionsAllowedFrom?: string, options?: DatabaseIncludeInput) => Promise<DatabaseAttributes>)

Type declaration

    • (serverId: string, databaseName: string, connectionsAllowedFrom?: string, options?: DatabaseIncludeInput): Promise<DatabaseAttributes>
    • Returns

      Returns new database information (DatabaseAttributes)

      Example

      const res = await client.createDatabase('c2f5a3b6', 'Information') // res = DatabaseAttributes
      

      Example

      client.createDatabase('c2f5a3b6', 'info').then((res) => console.log(res)) // res = DatabaseAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • databaseName: string

        Database name

      • connectionsAllowedFrom: string = '%'

        Connections allowed from

      • Optional options: DatabaseIncludeInput

        Include information about relationships

      Returns Promise<DatabaseAttributes>

createFolder: ((serverId: string, data: ServerFileCreateFolder) => Promise<string>)

Type declaration

    • (serverId: string, data: ServerFileCreateFolder): Promise<string>
    • Returns

      If successful returns Successfuly created!

      Example

      const res = await client.createFolder('c2f5a3b6', { root: '/', name: 'world' }) // res = Successfuly created!
      

      Example

      client.createFolder('c2f5a3b6', { root: '/', name: 'world' }).then((res) => console.log(res)) // res = Successfuly created!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • data: ServerFileCreateFolder

        An object composed of root of the file and file to remove

      Returns Promise<string>

createSchedule: ((serverId: string, name: string, minute: string, hour: string, dayOfMonth: string, month: string, dayOfWeek: string, isActive?: boolean, onlyWhenOnline?: boolean) => Promise<ScheduleAttributes>)

Type declaration

    • (serverId: string, name: string, minute: string, hour: string, dayOfMonth: string, month: string, dayOfWeek: string, isActive?: boolean, onlyWhenOnline?: boolean): Promise<ScheduleAttributes>
    • Returns

      The schedule information

      Example

      const res = await client.createSchedule('TESTING', '*', '*', '*', '*') // res = ScheduleAttributes
      

      Example

      client.createSchedule('TESTING', '*', '*', '*', '*').then((res) => console.log(res)) // res = ScheduleAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • name: string

        Name of the schedule

      • minute: string

        Cron minute syntax

      • hour: string

        Cron hour syntax

      • dayOfMonth: string

        Cron day of month syntax

      • month: string

        Cron month syntax

      • dayOfWeek: string

        Cron day of week syntax

      • isActive: boolean = true

        Whether the schedule should be activated on creation (default true)

      • onlyWhenOnline: boolean = true

        Whether the schedule should only run when server is on (default true)

      Returns Promise<ScheduleAttributes>

createSubUser: ((serverId: string, email: string, permissions: SubuserPermission[]) => Promise<SubUserAttributes>)

Type declaration

    • (serverId: string, email: string, permissions: SubuserPermission[]): Promise<SubUserAttributes>
    • Returns

      SubUserAttributes

      Example

      const res = await client.createSubUser('c2f5a3b6', 'api@gmail.com', ['control.console']) // res = SubUserAttributes
      

      Example

      client.createSubUser('c2f5a3b6', 'api@gmail.com', ['control.console']).then((res) => console.log(res)) // res = SubUserAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • email: string

        Email of the subuser

      • permissions: SubuserPermission[]

      Returns Promise<SubUserAttributes>

decompressFile: ((serverId: string, data: ServerFileDecompress) => Promise<string>)

Type declaration

    • (serverId: string, data: ServerFileDecompress): Promise<string>
    • Returns

      If successful returns Successfuly decompressed!

      Example

      const res = await client.decompressFile('c2f5a3b6', { root: '/', file: 'archive.tar.gz' }) // res = Successfuly decompressed!
      

      Example

      client.decompressFile('c2f5a3b6', { root: '/', file: 'archive.tar.gz' }).then((res) => console.log(res)) // res = Successfuly decompressed!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • data: ServerFileDecompress

        An object composed of root of the file and file to remove

      Returns Promise<string>

deleteAllocation: ((serverId: string, allocationId: number) => Promise<string>)

Type declaration

    • (serverId: string, allocationId: number): Promise<string>
    • Remarks

      This method is only available if allocation is not primary

      Example

      const res = await client.deleteAllocation('c2f5a3b6', 1) // res = Sucessfully deleted Allocation!
      

      Example

      client.deleteAllocation('c2f5a3b6', 1).then((res) => console.log(res)) // res = Sucessfully deleted Allocation!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • allocationId: number

        ID of the allocation to delete

      Returns Promise<string>

deleteApiKey: ((apiKeyIden: string) => Promise<string>)

Type declaration

    • (apiKeyIden: string): Promise<string>
    • Returns

      If succesful returns Successfully deleted api key!

      const res = await client.deleteApiKey('NWKMYMT2Mrav0Iq2') // res = Successfully deleted api key!
      

      Example

      client.deleteApiKey('NWKMYMT2Mrav0Iq2').then((res) => console.log(res)) // res = Successfully deleted api key!
      

      Parameters

      • apiKeyIden: string

        The api keys identifier code

      Returns Promise<string>

deleteBackup: ((serverId: string, backupId: string) => Promise<string>)

Type declaration

    • (serverId: string, backupId: string): Promise<string>
    • Returns

      Backup information

      Example

      const res = await client.deleteBackup('7e74354d', '3a4e4b2a') // res = Backup successfully deleted!
      

      Example

      client.deleteBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = Backup successfully deleted!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • backupId: string

        ID of the backup to delete

      Returns Promise<string>

deleteDatabase: ((serverId: string, databaseId: string) => Promise<string>)

Type declaration

    • (serverId: string, databaseId: string): Promise<string>
    • Returns

      If successful returns Sucesfully deleted!

      Example

      const res = await client.deleteDatabase('c2f5a3b6', 's5_info') // res = Sucesfully deleted!
      

      Example

      client.deleteDatabase('c2f5a3b6', 's3_good').then((res) => console.log(res)) // res = Sucesfully deleted!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • databaseId: string

        Database id

      Returns Promise<string>

deleteFile: ((serverId: string, data: ServerFileCompress) => Promise<string>)

Type declaration

    • (serverId: string, data: ServerFileCompress): Promise<string>
    • Returns

      If successful returns Successfuly deleted!

      Example

      const res = await client.deleteFile('c2f5a3b6', { root: '/', files: ['README.md'] }) // res = Successfuly deleted!
      

      Example

      client.deleteFile('c2f5a3b6', { root: '/', files: ['LICENSE', 'README.md'] }).then((res) => console.log(res)) // res = Successfuly deleted!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • data: ServerFileCompress

        An object composed of root of the file and array of string (file names) for files to rename

      Returns Promise<string>

deleteSubUser: ((serverId: string, subUserId: string) => Promise<string>)

Type declaration

    • (serverId: string, subUserId: string): Promise<string>
    • Returns

      If successful returns Successfuly deleted SubUser!

      Example

      const res = await client.deleteSubUser('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4') // res = Successfuly deleted SubUser!
      

      Example

      client.deleteSubUser('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4').then((res) => console.log(res)) // res = Successfuly deleted SubUser!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • subUserId: string

        UUID of the subuser to get

      Returns Promise<string>

editSchedule: ((serverId: string, scheduleId: number, options: SheduleEditOptions) => Promise<ScheduleAttributes>)

Type declaration

    • (serverId: string, scheduleId: number, options: SheduleEditOptions): Promise<ScheduleAttributes>
    • Returns

      The schedule information

      Example

      const res = await client.editSchedule('7e74354d', 5, { name: 'EditedName' }) // res = ScheduleAttributes
      

      Example

      client.editSchedule('7e74354d', 5, { name: 'EditedName' }).then((res) => console.log(res)) // res = ScheduleAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • scheduleId: number

        Id of the schedule to edit

      • options: SheduleEditOptions

        Edit schedule options

      Returns Promise<ScheduleAttributes>

enable2FA: ((code: string) => Promise<string[]>)

Type declaration

    • (code: string): Promise<string[]>
    • Returns

      Tokens

      const res = await client.enable2FA('505134') // res = string[] (tokens)
      

      Example

      client.enable2FA('505134').then((res) => console.log(res)) // res = string[] (tokens)
      

      Parameters

      • code: string

        The code from authenticator

      Returns Promise<string[]>

errorHandler: ((error: JSPteroAPIError) => void) = ...

Type declaration

getAccount2FADetails: (() => Promise<string>)

Type declaration

    • (): Promise<string>
    • Returns

      TOTP QR code image url (otpauth)

      const res = await client.getAccountInfo() // res = string (otpauth)
      

      Example

      client.getAccountInfo().then((res) => console.log(res)) // res = string (otpauth)
      

      Returns Promise<string>

getAccountInfo: (() => Promise<UserAttributes>)

Type declaration

    • (): Promise<UserAttributes>
    • Returns

      Account information

      Example

      const res = await client.getAccountInfo() // res = UserAttributes
      

      Example

      client.getAccountInfo().then((res) => console.log(res)) // res = UserAttributes
      

      Returns Promise<UserAttributes>

getAllAlocations: ((serverId: string) => Promise<Allocation[]>)

Type declaration

    • (serverId: string): Promise<Allocation[]>
    • Returns

      Array of allocations

      Example

      const res = await client.getAllAlocations('c2f5a3b6') // res = Allocation[]
      

      Example

      client.getAllAlocations('c2f5a3b6').then((res) => console.log(res)) // res = Allocation[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<Allocation[]>

getAllApiKeys: (() => Promise<ApiKey[]>)

Type declaration

    • (): Promise<ApiKey[]>
    • Returns

      Api key array

      Example

      const res = await client.getAllApiKeys() // res = ApiKey[]
      

      Example

      client.getAllApiKeys().then((res) => console.log(res)) // res = ApiKey[]
      

      Returns Promise<ApiKey[]>

getAllBackups: ((serverId: string) => Promise<Backup[]>)

Type declaration

    • (serverId: string): Promise<Backup[]>
    • Returns

      An array of backups

      Example

      const res = await client.getAllBackups('7e74354d') // res = Backup[]
      

      Example

      client.getAllBackups('7e74354d').then((res) => console.log(res)) // res = Backup[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<Backup[]>

getAllDatabases: ((serverId: string, options?: DatabaseIncludeInput) => Promise<Database[]>)

Type declaration

    • (serverId: string, options?: DatabaseIncludeInput): Promise<Database[]>
    • Returns

      Returns array of servers databases (Database[])

      Example

      const res = await client.getAllDatabases('c2f5a3b6') // res = Database[]
      

      Example

      client.getAllDatabases('c2f5a3b6').then((res) => console.log(res)) // res = Database[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • Optional options: DatabaseIncludeInput

        Include information about relationships

      Returns Promise<Database[]>

getAllFiles: ((serverId: string, dir?: string) => Promise<ServerFile[]>)

Type declaration

    • (serverId: string, dir?: string): Promise<ServerFile[]>
    • Returns

      Array of file objects

      Example

      const res = await client.getAllFiles('c2f5a3b6') // res = ServerFile[]
      

      Example

      client.getAllFiles('c2f5a3b6', 'dist').then((res) => console.log(res)) // res = ServerFile[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • dir: string = ''

        Directory to get files from (if not provided gets root server dir) (e. g. dist or dist/classes)

      Returns Promise<ServerFile[]>

getAllPermissions: (() => Promise<Permissions>)

Type declaration

    • (): Promise<Permissions>
    • Returns

      Permission data

      Remarks

      Just returns all available permissions. Not that useful!

      Example

      const res = await client.getPermissions() // res = Permissions
      

      Example

      client.getPermissions().then((res) => console.log(res)) // res = Permissions
      

      Returns Promise<Permissions>

getAllSchedules: ((serverId: string) => Promise<Schedule[]>)

Type declaration

    • (serverId: string): Promise<Schedule[]>
    • Returns

      An Array of servers schedules

      Example

      const res = await client.getAllSchedules() // res = Schedule[]
      

      Example

      client.getAllSchedules().then((res) => console.log(res)) // res = Schedule[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<Schedule[]>

getAllServers: ((options?: ServerIncludeInput, filter?: ServerFilterInput, admin?: boolean) => Promise<Server[]>)

Type declaration

    • (options?: ServerIncludeInput, filter?: ServerFilterInput, admin?: boolean): Promise<Server[]>
    • Returns

      An Array of servers

      Example

      const res = await client.getAllServers() // res = Server[]
      

      Example

      client.getAllServers().then((res) => console.log(res)) // res = Server[]
      

      Parameters

      • Optional options: ServerIncludeInput

        Include information about server relationships

      • Optional filter: ServerFilterInput

        Filter servers by specified field and value

      • admin: boolean = false

      Returns Promise<Server[]>

getAllSubUsers: ((serverId: string) => Promise<SubUser[]>)

Type declaration

    • (serverId: string): Promise<SubUser[]>
    • Returns

      SubUser[]

      Example

      const res = await client.getAllSubUsers('c2f5a3b6') // res = SubUser[]
      

      Example

      client.getAllSubUsers('c2f5a3b6').then((res) => console.log(res)) // res = SubUser[]
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<SubUser[]>

getBackupDownloadLink: ((serverId: string, backupId: string) => Promise<string>)

Type declaration

    • (serverId: string, backupId: string): Promise<string>
    • Returns

      Returns backup download url

      Example

      const res = await client.getBackupDownloadLink('7e74354d', '3a4e4b2a') // res = url (string)
      

      Example

      client.getBackupDownloadLink('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = url (string)
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • backupId: string

        ID of the backup to get

      Returns Promise<string>

getBackupInfo: ((serverId: string, backupId: string) => Promise<BackupAttributes>)

Type declaration

    • (serverId: string, backupId: string): Promise<BackupAttributes>
    • Returns

      Backup information

      Example

      const res = await client.getBackupInfo('7e74354d', '3a4e4b2a') // res = BackupAttributes
      

      Example

      client.getBackupInfo('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = BackupAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • backupId: string

        ID of the backup to get

      Returns Promise<BackupAttributes>

getFileContents: ((serverId: string, file: string) => Promise<string>)

Type declaration

    • (serverId: string, file: string): Promise<string>
    • Returns

      Contents of the file (string)

      Example

      const res = await client.getFileContents('c2f5a3b6', 'index.js') // res = content of your file (string)
      

      Example

      client.getFileContents('c2f5a3b6', 'dist/index.js').then((res) => console.log(res)) // res = content of your file (string)
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • file: string

        File to get the contents of (full name like index.js or dist/index.js)

      Returns Promise<string>

getFileDownloadLink: ((serverId: string, file: string) => Promise<string>)

Type declaration

    • (serverId: string, file: string): Promise<string>
    • Returns

      Returns file download url

      Example

      const res = await client.getFileDownloadLink('c2f5a3b6', 'index.js') // res = url (string)
      

      Example

      client.getServerResources('c2f5a3b6', 'dist/index.js').then((res) => console.log(res)) // res = url (string)
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • file: string

        File to get the contents of (full name like index.js or dist/index.js)

      Returns Promise<string>

getFileUploadLink: ((serverId: string) => Promise<string>)

Type declaration

    • (serverId: string): Promise<string>
    • Returns

      If successful returns upload url

      Example

      const res = await client.getFileUploadLink('c2f5a3b6') // res = url (string)
      

      Example

      client.getFileUploadLink('c2f5a3b6').then((res) => console.log(res)) // res = url (string)
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<string>

getScheduleInfo: ((serverId: string, scheduleId: number) => Promise<ScheduleAttributes>)

Type declaration

    • (serverId: string, scheduleId: number): Promise<ScheduleAttributes>
    • Returns

      Schedule information

      Example

      const res = await client.getScheduleInfo('7e74354d', 7) // res = ScheduleAttributes
      

      Example

      client.getScheduleInfo('7e74354d', 8).then((res) => console.log(res)) // res = ScheduleAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • scheduleId: number

        Id of the schedule to get info

      Returns Promise<ScheduleAttributes>

getServerInfo: ((serverId: string, options?: ServerIncludeInput) => Promise<ServerAttributes>)

Type declaration

    • (serverId: string, options?: ServerIncludeInput): Promise<ServerAttributes>
    • Returns

      Server information

      Example

      const res = await client.getServerInfo('c2f5a3b6') // res = ServerAttributes
      

      Example

      client.getServerInfo('c2f5a3b6').then((res) => console.log(res)) // res = ServerAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • Optional options: ServerIncludeInput

        Include information about server relationships

      Returns Promise<ServerAttributes>

getServerResources: ((serverId: string) => Promise<ServerResources>)

Type declaration

    • (serverId: string): Promise<ServerResources>
    • Returns

      Server resource usage object

      Example

      const res = await client.getServerResources('c2f5a3b6') // res = ServerResources
      

      Example

      client.getServerResources('c2f5a3b6').then((res) => console.log(res)) // res = ServerResources
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<ServerResources>

getSubUserInfo: ((serverId: string, subUserId: string) => Promise<SubUserAttributes>)

Type declaration

    • (serverId: string, subUserId: string): Promise<SubUserAttributes>
    • Returns

      SubUserAttributes

      Example

      const res = await client.getSubUserInfo('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4') // res = SubUserAttributes
      

      Example

      client.getSubUserInfo('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4').then((res) => console.log(res)) // res = SubUserAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • subUserId: string

        UUID of the subuser to get

      Returns Promise<SubUserAttributes>

host: string

Panels address

key: string

Api key to use

reinstallServer: ((serverId: string) => Promise<string>)

Type declaration

    • (serverId: string): Promise<string>
    • Returns

      Successfuly started reinstalling!

      Example

      const res = await client.reinstallServer('c2f5a3b6') // res = Successfuly started reinstalling!
      

      Example

      client.reinstallServer('c2f5a3b6').then((res) => console.log(res)) // res = Successfuly started reinstalling!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<string>

renameFile: ((serverId: string, data: SeverFileRename) => Promise<string>)

Type declaration

    • (serverId: string, data: SeverFileRename): Promise<string>
    • Returns

      If successful returns Successfuly renamed!

      Example

      const res = await client.renameFile('c2f5a3b6', { root: '/', files: [{ from: 'LICENSE', to: 'LIC' }] }) // res = Successfuly renamed!
      

      Example

      client.renameFile('c2f5a3b6', { root: '/dist', files: [{ from: 'LICENSE', to: 'LIC' }] }).then((res) => console.log(res)) // res = Successfuly renamed!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • data: SeverFileRename

        An object composed of root of the file and array of objects for files to rename

      Returns Promise<string>

renameServer: ((serverId: string, name: string) => Promise<string>)

Type declaration

    • (serverId: string, name: string): Promise<string>
    • Returns

      Successfuly set new server name!

      Example

      const res = await client.renameServer('c2f5a3b6', 'Best Server') // res = Successfuly set new server name!
      

      Example

      client.renameServer('c2f5a3b6', 'Best Server').then((res) => console.log(res)) // res = Successfuly set new server name!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • name: string

        New name for the server

      Returns Promise<string>

restoreBackup: ((serverId: string, backupId: string, truncate?: boolean) => Promise<BackupAttributes>)

Type declaration

    • (serverId: string, backupId: string, truncate?: boolean): Promise<BackupAttributes>
    • Returns

      Sucessfully restored backup

      Example

      const res = await client.restoreBackup('7e74354d', '3a4e4b2a') // res = Sucessfully restored backup
      

      Example

      client.restoreBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = Sucessfully restored backup
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • backupId: string

        ID of the backup to restore

      • truncate: boolean = false

        Whether to remove all files before restoring backup

      Returns Promise<BackupAttributes>

rotateDatabasePass: ((serverId: string, databaseId: string) => Promise<DatabaseAttributes>)

Type declaration

    • (serverId: string, databaseId: string): Promise<DatabaseAttributes>
    • Returns

      Returns database information + Relationships(password)

      Example

      const res = await client.rotateDatabasePass('c2f5a3b6', 's5_info') // res = DatabaseAttributesRelationship
      

      Example

      client.rotateDatabasePass('c2f5a3b6', 's3_good').then((res) => console.log(res)) // res = DatabaseAttributesRelationship
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • databaseId: string

        Database id

      Returns Promise<DatabaseAttributes>

sendCommand: ((serverId: string, command: string) => Promise<string>)

Type declaration

    • (serverId: string, command: string): Promise<string>
    • Returns

      If successful returns Successfuly sent the command!

      Example

      const res = await client.sendCommand('c2f5a3b6', 'give Linux123123 star') // res = Successfuly sent the command!
      

      Example

      client.sendCommand('c2f5a3b6', 'give Linux123123 star').then((res) => console.log(res)) // res = Successfuly sent the command!
      

      Parameters

      • serverId: string

        ID of the server to send a command to

      • command: string

        Command to send

      Returns Promise<string>

setAllocationNote: ((serverId: string, allocationId: number, note: string) => Promise<Allocation>)

Type declaration

    • (serverId: string, allocationId: number, note: string): Promise<Allocation>
    • Example

      const res = await client.setAllocationNote('c2f5a3b6', 1, "Port for RDP") // res = Allocation
      

      Example

      client.setAllocationNote('c2f5a3b6', 1, "Port for RDP").then((res) => console.log(res)) // res = Allocation
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • allocationId: number

        ID of the allocation to set the note for

      • note: string

        The note you want to set

      Returns Promise<Allocation>

setAllocationPrimary: ((serverId: string, allocationId: number) => Promise<Allocation>)

Type declaration

    • (serverId: string, allocationId: number): Promise<Allocation>
    • Example

      const res = await client.setAllocationPrimary('c2f5a3b6', 1) // res = Allocation
      

      Example

      client.setAllocationPrimary('c2f5a3b6', 1).then((res) => console.log(res)) // res = Allocation
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • allocationId: number

        ID of the allocation to make primary

      Returns Promise<Allocation>

setPowerState: ((serverId: string, action: "stop" | "start" | "restart" | "kill") => Promise<string>)

Type declaration

    • (serverId: string, action: "stop" | "start" | "restart" | "kill"): Promise<string>
    • Returns

      If successful returns Successfuly set power state!

      Example

      const res = await client.setPowerState('c2f5a3b6', 'start') // res = Successfuly set power state!
      

      Example

      client.setPowerState('c2f5a3b6', 'kill).then((res) => console.log(res)) // res = Successfuly set power state!
      

      Parameters

      • serverId: string

        ID of the server to send a command to

      • action: "stop" | "start" | "restart" | "kill"

        start / stop / restart / kill

      Returns Promise<string>

startConsoleConnection: ((serverId: string) => Promise<WebsocketClient>)

Type declaration

    • (serverId: string): Promise<WebsocketClient>
    • Remarks

      This method is used to connect to server websocket and have automatic authentication. This exposes the websocket client.

      Returns

      WebsocketClient

      Example

      const res = await client.startConsoleConnection('c2f5a3b6') // res = WebsocketClient
      

      Example

      client.startConsoleConnection('c2f5a3b6').then((res) => console.log(res)) // res = WebsocketClient
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      Returns Promise<WebsocketClient>

toggleLockBackup: ((serverId: string, backupId: string) => Promise<BackupAttributes>)

Type declaration

    • (serverId: string, backupId: string): Promise<BackupAttributes>
    • Returns

      Backup information

      Example

      const res = await client.toggleLockBackup('7e74354d', '3a4e4b2a') // res = BackupAttributes
      

      Example

      client.toggleLockBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = BackupAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • backupId: string

        ID of the backup to toggle lock of

      Returns Promise<BackupAttributes>

updateEmail: ((email: string, password: string) => Promise<string>)

Type declaration

    • (email: string, password: string): Promise<string>
    • Returns

      If succesful returns Successfully updated email!

      const res = await client.updateEmail('jspteroapi@linux123123.cf', 'verySecurePass') // res = Successfully updated email!
      

      Example

      client.updateEmail('jspteroapi@linux123123.cf', 'verySecurePass').then((res) => console.log(res)) // res = Successfully updated email!
      

      Parameters

      • email: string

        The new email address

      • password: string

        The password of the user

      Returns Promise<string>

updatePassword: ((currentPassword: string, password: string) => Promise<string>)

Type declaration

    • (currentPassword: string, password: string): Promise<string>
    • Returns

      If succesful returns Successfully updated password!

      const res = await client.updatePassword('verySecurePass', 'moreSecurePass') // res = Successfully updated password!
      

      Example

      client.updatePassword('verySecurePass', 'moreSecurePass').then((res) => console.log(res)) // res = Successfully updated password!
      

      Parameters

      • currentPassword: string

        The currect passowrd

      • password: string

        The new password

      Returns Promise<string>

updateSubUserPermissions: ((serverId: string, subUserId: string, permissions: SubuserPermission[]) => Promise<SubUserAttributes>)

Type declaration

    • (serverId: string, subUserId: string, permissions: SubuserPermission[]): Promise<SubUserAttributes>
    • Returns

      SubUserAttributes

      Example

      const res = await client.updateSubUserPermissions('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4', ['control.console']) // res = SubUserAttributes
      

      Example

      client.updateSubUserPermissions('c2f5a3b6', '60a7aec3-e17d-4aa9-abb3-56d944d204b4', ['control.console']).then((res) => console.log(res)) // res = SubUserAttributes
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • subUserId: string

        UUID of the subuser to get

      • permissions: SubuserPermission[]

      Returns Promise<SubUserAttributes>

writeFile: ((serverId: string, file: string, contents: string) => Promise<string>)

Type declaration

    • (serverId: string, file: string, contents: string): Promise<string>
    • Returns

      If successful returns Successfuly written the file!

      Example

      const res = await client.writeFile('c2f5a3b6', 'HW.txt', 'Hello world!') // res = Successfuly written the file!
      

      Example

      client.writeFile('c2f5a3b6', 'dist/HW.txt', 'Hello world!').then((res) => console.log(res)) // res = Successfuly written the file!
      

      Parameters

      • serverId: string

        ID of the server to get (In the settings tab of server/in link)

      • file: string

        File to get the contents of (full name like index.js or dist/index.js)

      • contents: string

        The contents of file you want to write

      Returns Promise<string>

Methods

  • Remarks

    Will not work if using custom error handler.

    Parameters

    • throwError: boolean = true

      Whether to throw an error or return bool

    Returns Promise<boolean>

Generated using TypeDoc