Class REST

Represents the class that manages handlers for endpoints

Hierarchy

Constructors

  • Parameters

    Returns REST

Properties

#private: any
[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
createHandler: any

Creates a new rate limit handler from a hash, based on the hash and the major parameter

Param

The hash for the route

Param

The major parameter for this handler

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

handlerTimer: any
handlers: Collection<string, IHandler>

Request handlers created from the bucket hash and the major parameters

hashTimer: any
hashes: Collection<string, HashData>

API bucket hashes that are cached from provided routes

options: RESTOptions
resolveRequest: any

Formats the request data to a usable format for fetch

Param

The request data

setupSweepers: any
generateRouteData: any

Generates route data for an endpoint:method

Param

The raw endpoint to generalize

Param

The HTTP method this endpoint is called without

Methods

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • 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

    • Optional options: RequestData

      Optional request options

    Returns Promise<unknown>

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • Rest ...args: InternalGetAsyncEventEmitterEventParameters<AsyncEventEmitter<RestEvents>, K, RestEvents>

    Returns boolean

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • Rest ...args: InternalGetAsyncEventEmitterEventParameters<AsyncEventEmitter<RestEvents>, K, RestEvents>

    Returns boolean

  • Returns (string | symbol)[] & (keyof AsyncEventEmitterPredefinedEvents)[] & (keyof RestEvents)[]

  • Runs a get request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optional options: 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

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K

    Returns Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>[]

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K

    Returns Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>[]

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Runs a patch request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optional options: RequestData

      Optional request options

    Returns Promise<unknown>

  • Runs a post request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optional options: RequestData

      Optional request options

    Returns Promise<unknown>

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Runs a put request from the api

    Parameters

    • fullRoute: `/${string}`

      The full route to query

    • Optional options: RequestData

      Optional request options

    Returns Promise<unknown>

  • Queues a request to be sent

    Parameters

    Returns Promise<ResponseLike>

    The response from the api request

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K

    Returns InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>[]

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K

    Returns InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>[]

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • event: K

    Returns REST

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • Optional event: K

    Returns REST

  • Parameters

    • event: string | symbol

    Returns REST

  • Parameters

    • Optional event: string | symbol

    Returns REST

  • Type Parameters

    • K extends keyof AsyncEventEmitterPredefinedEvents | keyof RestEvents

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Type Parameters

    • K extends string | symbol

    Parameters

    • eventName: K
    • listener: Exclude<InternalAsyncEventEmitterInternalListenerForEvent<AsyncEventEmitter<RestEvents>, K, RestEvents>["listener"], undefined>

    Returns REST

  • Runs a request from the api

    Parameters

    Returns Promise<unknown>

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

    Parameters

    • agent: Dispatcher

      The agent to use

    Returns REST

  • Parameters

    • n: number

    Returns REST

  • Sets the authorization token that should be used for requests

    Parameters

    • token: string

      The authorization token to use

    Returns REST

  • Returns Promise<boolean>

  • Type Parameters

    • EventMap extends {}

    • EventName extends PropertyKey = keyof EventMap | keyof AsyncEventEmitterPredefinedEvents

    Parameters

    • emitter: AsyncEventEmitter<EventMap>
    • eventName: EventName | keyof AsyncEventEmitterPredefinedEvents

    Returns number

  • Parameters

    • emitter: AsyncEventEmitter<any>
    • eventName: string | symbol

    Returns number

  • Type Parameters

    • EventMap extends {}

    • EventName extends PropertyKey = keyof AsyncEventEmitterPredefinedEvents | keyof EventMap

    Parameters

    • emitter: AsyncEventEmitter<EventMap>
    • eventName: EventName
    • Optional options: AbortableMethods

    Returns AsyncGenerator<InternalGetAsyncEventEmitterEventParameters<AsyncEventEmitter<EventMap>, EventName, EventMap>, void, unknown>

  • Parameters

    • emitter: AsyncEventEmitter<any>
    • eventName: string | symbol
    • Optional options: AbortableMethods

    Returns AsyncGenerator<any[], void, unknown>

  • Type Parameters

    • EventMap extends {}

    • EventName extends PropertyKey = keyof AsyncEventEmitterPredefinedEvents | keyof EventMap

    Parameters

    • emitter: AsyncEventEmitter<EventMap>
    • eventName: EventName
    • Optional options: AbortableMethods

    Returns Promise<InternalGetAsyncEventEmitterEventParameters<AsyncEventEmitter<EventMap>, EventName, EventMap>>

  • Parameters

    • emitter: AsyncEventEmitter<any>
    • eventName: string | symbol
    • Optional options: AbortableMethods

    Returns Promise<any[]>

Generated using TypeDoc