Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StevesDBClient

Hierarchy

  • StevesDBClient

Index

Constructors

constructor

Properties

Static Readonly CLIENT_VERSION

CLIENT_VERSION: string = require("../package.json").version

Version of the client itself

Static Readonly PROTOCOL_VERSION

PROTOCOL_VERSION: number = 2

The protocol version this client was made against

Methods

connect

  • connect(host: string, port?: number, options?: { encryption: boolean }): Promise<void>
  • Connect to a database

    Parameters

    • host: string

      server host

    • Default value port: number = 2540

      server port

    • Default value options: { encryption: boolean } = {encryption: true}

      connection options

      • encryption: boolean

    Returns Promise<void>

database

getDatabase

getDatabaseIfExists

  • getDatabaseIfExists(name: string): Promise<Database | undefined>
  • Get the database by it's name if it exists, undefined otherwise

    Parameters

    • name: string

      database name

    Returns Promise<Database | undefined>

    database instance if it exists, undefined otherwise

getDatabases

getUsername

  • getUsername(): string | undefined
  • Get the current user username

    Returns string | undefined

    user username if the connection is authorized, undefined otherwise

isLoggedIn

  • isLoggedIn(): boolean
  • Check whether the connection is authorized

    Returns boolean

    true, if connection is auhorized

login

  • login(username: string, password: string): Promise<boolean>
  • Log in to the database

    Parameters

    • username: string

      user username

    • password: string

      user password

    Returns Promise<boolean>

    true, if the login details are correct

logout

  • logout(): Promise<boolean>
  • Log out from the database

    Returns Promise<boolean>

    true, if the connnetion has been successfuly unauthorized

sendPacket

  • sendPacket(packet: PacketOut): void

waitForResponse

  • waitForResponse<T>(packet: {}): Promise<T>

Generated using TypeDoc