REST

export declare class REST extends AsyncEventEmitter<RestEventsMap>
export declare class REST extends AsyncEventEmitter<RestEventsMap>
Represents the class that manages handlers for endpoints
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
fullRouteRouteLikeNo
The full route to query
optionsRequestDataYes
Optional request options
get(fullRoute, options?):Promise<unknown>
Runs a get request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNo
The full route to query
optionsRequestDataYes
Optional request options
patch(fullRoute, options?):Promise<unknown>
Runs a patch request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNo
The full route to query
optionsRequestDataYes
Optional request options
post(fullRoute, options?):Promise<unknown>
Runs a post request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNo
The full route to query
optionsRequestDataYes
Optional request options
put(fullRoute, options?):Promise<unknown>
Runs a put request from the api
NameTypeOptionalDescription
fullRouteRouteLikeNo
The full route to query
optionsRequestDataYes
Optional request options
queueRequest(request):Promise<ResponseLike>
Queues a request to be sent
Returns
The response from the api request
NameTypeOptionalDescription
requestInternalRequestNo
All the information needed to make a request
request(options):Promise<unknown>
Runs a request from the api
NameTypeOptionalDescription
optionsInternalRequestNo
Request options
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