Skip to content

REST

Defined in: src/structures/rest.ts:19

new REST(client: FMClient): REST;

Defined in: src/structures/rest.ts:25

FMClient

REST

get requestQueueLength(): number;

Defined in: src/structures/rest.ts:35

Get the length of the request queue.

number

clearRequestQueue(): void;

Defined in: src/structures/rest.ts:47

Clears all pending unresolved promises from the token bucket queue.

void


get<T>(apiMethod: APIMethod, options?: RequestData): Promise<APIResponse<T>>;

Defined in: src/structures/rest.ts:60

Runs a get request from the API.

T

APIMethod

The API method.

RequestData = {}

The request options. See RequestData.

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<T>(apiMethod: APIMethod, options?: RequestData): Promise<APIResponse<T>>;

Defined in: src/structures/rest.ts:73

Runs a post request from the API.

T

APIMethod

The API method.

RequestData = {}

The request options. See RequestData.

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 }