REST
Defined in: src/structures/rest.ts:19
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new REST(client: FMClient): REST;Defined in: src/structures/rest.ts:25
Parameters
Section titled “Parameters”client
Section titled “client”Returns
Section titled “Returns”REST
Accessors
Section titled “Accessors”requestQueueLength
Section titled “requestQueueLength”Get Signature
Section titled “Get Signature”get requestQueueLength(): number;Defined in: src/structures/rest.ts:35
Get the length of the request queue.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”clearRequestQueue()
Section titled “clearRequestQueue()”clearRequestQueue(): void;Defined in: src/structures/rest.ts:47
Clears all pending unresolved promises from the token bucket queue.
Returns
Section titled “Returns”void
get<T>(apiMethod: APIMethod, options?: RequestData): Promise<APIResponse<T>>;Defined in: src/structures/rest.ts:60
Runs a get request from the API.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”apiMethod
Section titled “apiMethod”The API method.
options?
Section titled “options?”RequestData = {}
The request options. See RequestData.
Returns
Section titled “Returns”Promise<APIResponse<T>>
A promise that resolves to the API response object.
- Success:
{ success: true, data: T } - Failure:
{ success: false, errorCode: number | string, errorMsg: string }
post()
Section titled “post()”post<T>(apiMethod: APIMethod, options?: RequestData): Promise<APIResponse<T>>;Defined in: src/structures/rest.ts:73
Runs a post request from the API.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”apiMethod
Section titled “apiMethod”The API method.
options?
Section titled “options?”RequestData = {}
The request options. See RequestData.
Returns
Section titled “Returns”Promise<APIResponse<T>>
A promise that resolves to the API response object.
- Success:
{ success: true, data: T } - Failure:
{ success: false, errorCode: number | string, errorMsg: string }