Search...

RequestManager

Represents the class that manages handlers for endpoints
declare class RequestManager extends EventEmitter 
declare class RequestManager extends EventEmitter 

Extends

EventEmitter

constructor(options)

Constructs a new instance of the RequestManager class
NameTypeOptionalDescription
optionsPartial<RESTOptions>NoNone

agent

:

Dispatcher | null

The Agent for all requests performed by this manager.

globalDelay

:

Promise<void> | null

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
Readonly

handlers

:

Collection<string, IHandler>

Request handlers created from the bucket hash and the major parameters
Readonly

hashes

:

Collection<string, HashData>

API bucket hashes that are cached from provided routes
Readonly

options

:

RESTOptions

clearHandlerSweeper()

:

void

Stops the request handler sweeping interval

clearHashSweeper()

:

void

Stops the hash sweeping interval

queueRequest(request)

:

Promise<Dispatcher.ResponseData>

Queues a request to be sent
NameTypeOptionalDescription
requestInternalRequestNoAll the information needed to make a request

setAgent(agent)

:

this

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

setToken(token)

:

this

Sets the authorization token that should be used for requests
NameTypeOptionalDescription
tokenstringNoThe authorization token to use