Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Gateway

Hierarchy

  • Gateway

Index

Constructors

constructor

Properties

Readonly Private #provider

#provider: string

The provider's name that manages this gateway.

Readonly cache

cache: ProxyMap

The cached entries for this Gateway or the external datastore to get the settings from.

since

0.6.0

Readonly client

client: Client

The client this gateway was created with.

Readonly name

name: string

The name of this gateway.

ready

ready: boolean = false

Whether or not this gateway has been initialized.

Readonly requestHandler

requestHandler: RequestHandler<string, IdKeyed<string>>

The request handler that manages the synchronization queue.

since

0.6.0

Readonly schema

schema: Schema

The schema for this gateway.

Accessors

provider

Methods

Private _initializeSchemaEntries

  • _initializeSchemaEntries(schema: Schema): IterableIterator<string>

acquire

  • acquire(target: IdKeyed<string>, id?: string): Settings
  • Gets an entry from the cache or creates one if it does not exist

    example

    // Retrieve a members gateway const gateway = this.client.gateways.get('members');

    // Acquire a settings instance belonging to a member gateway.acquire(message.member);

    Parameters

    • target: IdKeyed<string>

      The target that holds a Settings instance of the holder for the new one

    • Default value id: string = target.id

      The settings' identificator

    Returns Settings

create

  • create(target: IdKeyed<string>, id?: string): Settings
  • Create a new Settings instance for this gateway.

    Parameters

    • target: IdKeyed<string>

      The target that will hold this instance alive

    • Default value id: string = target.id

      The settings' identificator

    Returns Settings

get

  • Get an entry from the cache.

    example

    // Retrieve a members gateway const gateway = this.client.gateways.get('members');

    // Retrieve a settings instance belonging to a member's id const settings = gateway.get(someMemberID);

    // Do something with it, be careful as it can return null if (settings === null) { // settings is null } else { // console.log(settings); }

    Parameters

    • id: string

      The key to get from the cache

    Returns Settings | null

init

  • init(): Promise<void>

sync

  • sync(): Promise<this>

toJSON

Generated using TypeDoc