RequestManager

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

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
emit:(<K extends keyof RestEvents>(event: K, ...args: RestEvents[K]) => boolean) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, ...args: any[]) => boolean)
Inherited from RequestManager
off:(<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this)
Inherited from RequestManager
on:(<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this)
Inherited from RequestManager
once:(<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this)
Inherited from RequestManager
removeAllListeners:(<K extends keyof RestEvents>(event?: K) => this) & (<S extends string | symbol>(event?: Exclude<S, keyof RestEvents>) => this)
Inherited from RequestManager
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
Returns
The response from the api request
NameTypeOptionalDescription
requestInternalRequestNo
All the information needed to make a request
setAgent(agent):this
Sets the default agent to use for requests performed by this manager
NameTypeOptionalDescription
agentDispatcherNo
The agent to use
setToken(token):this
Sets the authorization token that should be used for requests
NameTypeOptionalDescription
tokenstringNo
The authorization token to use