Class

RequestManager

Constructor

new RequestManager(options: Partial<RestOptions>)
ParamTypeDescription
optionsPartial<RestOptions>

Properties

baseUrl: string (readonly)
options: RestOptions (readonly)
rateLimiter: RateLimitManager (readonly)
routeHashCache: Map<string, string> (readonly)
token: string | null

Methods

buildBody(options: RequestOptions): string | FormData | undefined
ParamTypeDescription
optionsRequestOptions
buildHeaders(options: RequestOptions, body: string | FormData | undefined): Record<string, string>
ParamTypeDescription
optionsRequestOptions
bodystring | FormData | undefined
getRouteHash(route: string): string

Hash route for rate limit bucket (path without snowflake ids). LRU via Map insertion order.

ParamTypeDescription
routestring
getToken(): string | null
parseError(response: Response, method: string, route: string): Promise<FluxerAPIError | HTTPError>
ParamTypeDescription
responseResponse
methodstring
routestring
parseSuccess(response: Response): Promise<unknown>
ParamTypeDescription
responseResponse
request(method: string, route: string, options: RequestOptions): Promise<>
ParamTypeDescription
methodstring
routestring
optionsRequestOptions
setToken(token: string | null): void
ParamTypeDescription
tokenstring | null