Skip to main content

RestManagerEvents

Documentation


Documentation / @discordeno/rest / RestManagerEvents

Interface: RestManagerEvents

Defined in: rest/src/types.ts:3272

Properties

request()

request: (request, extra) => void

Defined in: rest/src/types.ts:3279

Emitted when a request is made to the API.

Parameters

request

Request

extra
body

any

Returns

void

Remarks

The body that will be sent to the API is available in the extra parameter. Do not consume the body in the Request object and use the one in the extra parameter instead.


requestError()

requestError: (request, error, extra) => void

Defined in: rest/src/types.ts:3295

Emitted when a request errors due to fetch error.

Parameters

request

Request

error

any

extra
body

any

Returns

void

Remarks

The body that was sent to the API is available in the extra parameter.


response()

response: (request, response, extra) => void

Defined in: rest/src/types.ts:3288

Emitted when a response is received from the API.

Parameters

request

Request

response

Response

extra
requestBody

any

responseBody

string | object

Returns

void

Remarks

This is fired for both successful and failed requests, you should check the Response object to determine if the request was successful or not.

Both the request and the response body are available in the extra parameter. Do not consume the body in the Request or Response object and use the one in the extra parameter instead.