Interface RESTOptions

interface RESTOptions {
    agent?: null | Dispatcher;
    baseURL?: string;
    disableLatencyCompensation?: boolean;
    followRedirects?: boolean;
    host?: string;
    latencyThreshold?: number;
    maxRatelimitRetryWindow?: number;
    ratelimiterOffset?: number;
    requestTimeout?: number;
    superProperties?: null | string | Record<string, unknown>;
    userAgent?: string;
}

Properties

agent?: null | Dispatcher

The agent to use for requests.

Default Value

null
baseURL?: string

The base URL to use for requests - must be a fully qualified url.

Default Value

https://discordapp.com/api/v{REST_VERSION}
disableLatencyCompensation?: boolean

If the built-in latency compensator should be disabled.

Default Value

false
followRedirects?: boolean

If redirects should be followed.

Default Value

false
host?: string

The Host header to use for requests.

Default Value

Parsed from baseURL

latencyThreshold?: number

In milliseconds, the average request latency at which to start emitting latency errors.

Default Value

30000
maxRatelimitRetryWindow?: number

In milliseconds, the maximum ratelimit delay (in milliseconds) the lib will internally wait for to retry the request. If a ratelimit resets after this window, an error will be thrown instead.

Note

This currently defaults to Infinity for backwards compatibility, but this will be changed in 1.12.0.

Default Value

Infinity
ratelimiterOffset?: number

In milliseconds, the time to offset ratelimit calculations by.

Default Value

0
requestTimeout?: number

In milliseconds, how long to wait until a request is timed out.

Default Value

15000
superProperties?: null | string | Record<string, unknown>

A value for the X-Super-Properties header, sent with all requests if present. This can be used to reveal some properties only visible to >= client builds. Provide either an object, or a base64 encoded string.

Example

eyJjbGllbnRfYnVpbGRfbnVtYmVyIjoxNjI5OTJ9

Example

{ client_build_number: 162992 }

Default Value

null
userAgent?: string

The User-Agent header to use for requests.

Default Value

Oceanic/{VERSION} (https://github.com/OceanicJS/Oceanic)