Represents the class that manages handlers for endpoints

Hierarchy (View Summary)

Constructors

Properties

"[brandSymbol]": RestEvents

This field doesn't actually exist, it's just a way to make TS properly infer the events from classes that extend AsyncEventEmitter

agent: null | Dispatcher

The Agent for all requests performed by this manager.

cdn: CDN
globalDelay: null | Promise<void>

The promise used to wait out the global rate limit

globalRemaining: number

The number of requests remaining in the global bucket

globalReset: number

The timestamp at which the global bucket resets

handlers: Collection<string, IHandler>

Request handlers created from the bucket hash and the major parameters

hashes: Collection<string, HashData>

API bucket hashes that are cached from provided routes

options: RESTOptions

Methods

  • Stops the request handler sweeping interval

    Returns void

  • Stops the hash sweeping interval

    Returns void

  • Runs a delete request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optionaloptions: RequestData

      Optional request options

    Returns Promise<unknown>

  • Runs a get request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optionaloptions: RequestData

      Optional request options

    Returns Promise<unknown>

  • Returns number

  • Type Parameters

    • K extends (keyof AsyncEventEmitterPredefinedEvents) | (keyof RestEvents)

    Parameters

    • eventName: K

    Returns number

  • Parameters

    • eventName: string | symbol

    Returns number

  • Runs a patch request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optionaloptions: RequestData

      Optional request options

    Returns Promise<unknown>

  • Runs a post request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optionaloptions: RequestData

      Optional request options

    Returns Promise<unknown>

  • Runs a put request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optionaloptions: RequestData

      Optional request options

    Returns Promise<unknown>

  • Type Parameters

    • K extends (keyof AsyncEventEmitterPredefinedEvents) | (keyof RestEvents)

    Parameters

    • event: K

    Returns this

  • Type Parameters

    • K extends (keyof AsyncEventEmitterPredefinedEvents) | (keyof RestEvents)

    Parameters

    • Optionalevent: K

    Returns this

  • Parameters

    • event: string | symbol

    Returns this

  • Parameters

    • Optionalevent: string | symbol

    Returns this

  • Sets the default agent to use for requests performed by this manager

    Parameters

    Returns this

  • Parameters

    • n: number

    Returns this

  • Sets the authorization token that should be used for requests

    Parameters

    • token: string

      The authorization token to use

    Returns this