class REST

external
declare class REST extends AsyncEventEmitter<RestEvents>

Represents the class that manages handlers for endpoints

Constructors

constructor(
options?: Partial<RESTOptions>
)

Constructs a new instance of the REST class

external
agent : Dispatcher | null

The Agent for all requests performed by this manager.

readonlyexternal
cdn : CDN

external
globalDelay : Promise<void> | null

The promise used to wait out the global rate limit

external
globalRemaining : number

The number of requests remaining in the global bucket

external
globalReset : number

The timestamp at which the global bucket resets

readonlyexternal
handlers : Collection<string, IHandler>

Request handlers created from the bucket hash and the major parameters

readonlyexternal
hashes : Collection<string, HashData>

API bucket hashes that are cached from provided routes

readonlyexternal
options : RESTOptions

external
clearHandlerSweeper() : void

Stops the request handler sweeping interval

external
clearHashSweeper() : void

Stops the hash sweeping interval

external
delete(
fullRoute: RouteLike
options?: RequestData
) : Promise<unknown>

Runs a delete request from the api

external
get(
fullRoute: RouteLike
options?: RequestData
) : Promise<unknown>

Runs a get request from the api

external
patch(
fullRoute: RouteLike
options?: RequestData
) : Promise<unknown>

Runs a patch request from the api

external
post(
fullRoute: RouteLike
options?: RequestData
) : Promise<unknown>

Runs a post request from the api

external
put(
fullRoute: RouteLike
options?: RequestData
) : Promise<unknown>

Runs a put request from the api

external
queueRequest() : Promise<ResponseLike>

Queues a request to be sent

Returns: The response from the api request

external
request() : Promise<unknown>

Runs a request from the api

external
setAgent(
agent: Dispatcher
) : this

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

external
setToken(
token: string
) : this

Sets the authorization token that should be used for requests