You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

REST

export declare class REST extends AsyncEventEmitter<RestEventsMap>
export declare class REST extends AsyncEventEmitter<RestEventsMap>
Represents the class that manages handlers for endpoints

Extends

AsyncEventEmitter<RestEventsMap>
constructor(options?)
Constructs a new instance of the REST class
NameTypeOptionalDescription
optionsPartial<RESTOptions>YesNone
agent:Dispatcher | null
The Agent for all requests performed by this manager.
Readonly
cdn:CDN
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
delete(fullRoute, options?):Promise<unknown>
Runs a delete request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNoThe full route to query
optionsRequestDataYesOptional request options
get(fullRoute, options?):Promise<unknown>
Runs a get request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNoThe full route to query
optionsRequestDataYesOptional request options
patch(fullRoute, options?):Promise<unknown>
Runs a patch request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNoThe full route to query
optionsRequestDataYesOptional request options
post(fullRoute, options?):Promise<unknown>
Runs a post request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNoThe full route to query
optionsRequestDataYesOptional request options
put(fullRoute, options?):Promise<unknown>
Runs a put request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNoThe full route to query
optionsRequestDataYesOptional request options
queueRequest(request):Promise<ResponseLike>
Queues a request to be sent
Returns
The response from the api request
NameTypeOptionalDescription
requestInternalRequestNoAll the information needed to make a request
request(options):Promise<unknown>
Runs a request from the api
NameTypeOptionalDescription
optionsInternalRequestNoRequest options
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