RestManager

API reference for RestManager in @erlcjs/core.

Handles communication with the ER:LC HTTP API for all servers managed by a Client, managing rate limits and request queuing on a shared per-IP budget.

Buckets are gated conservatively: the server-reported remaining budget is reduced by tracked in-flight requests, and no request is dispatched while that effective budget is exhausted. A bucket's queue is frozen (with jittered backoff) while a Retry-After response is active, and window resets include a small safety buffer to avoid racing the server. In-flight concurrency is hard-capped to bound bursts.

Signature:

declare class RestManager

#Constructors

Constructor

Modifiers

Description

(constructor)(globalKey)

Creates an instance of RestManager.

#Properties

Property

Modifiers

Type

Description

inflight

readonly

number

The number of requests currently in flight awaiting a response.

#Methods

Method

Modifiers

Description

getRateLimits()

Returns a snapshot of the current rate-limit state for all known buckets, useful for monitoring and debugging. remaining is the server-reported budget; effective subtracts in-flight requests to show the usable budget.

request(method, endpoint, body, serverKey)

Enqueues and sends an HTTP request to the ER:LC API.