Interface RawRequestOptions

The options for a raw API request

interface RawRequestOptions {
    allowCache?: boolean;
    apiKey?: string;
    cacheFor?: number;
    ignoreVersion?: boolean;
    interpret?: boolean;
    priority?: boolean;
    retries?: number;
    reuseJson: boolean;
    route: `https://api.wynncraft.com/${string}`;
    routeVersion?: null | string | number;
    timeout?: number;
}

Hierarchy

Properties

allowCache?: boolean

Whether to allow this request to use the cache or ongoing requests if available

Requests using cache or other requests do not count towards the ratelimit and return a lot faster.
apiKey?: string

The API key to use in this request

The key has to be registered in the config.
If this is not given, the registered key with the most free requests will be selected.
cacheFor?: number

The amount of time the request should be cached for, overwrites the defaults specified in the config

ignoreVersion?: boolean

Whether to ignore version errors

You can use this to resolve temporary conflicts while the library awaits being updated. Otherwise it should stay enabled.

Default

false
interpret?: boolean

Whether errors or profiles not being found should be filtered out and throw errors/return null

Default

true
priority?: boolean

Whether this request should be put to the front of the queue, executing before any non-priority requests are handled

Default

false
retries?: number

The amount of times to retry the request on error

reuseJson: boolean

Whether to reuse objects returned by this in other calls to fetchRaw(). If you want to modify the return value, you should set this to false.

Disabling this hurts performance, but hardens the code against bugs due to downstream code modifying cached objects.

Default

true
route: `https://api.wynncraft.com/${string}`

The API route to request

routeVersion?: null | string | number

The expected version property, responses with another version will throw an error. This has no effect on v3

timeout?: number

The amount of milliseconds a until the request should be rejected

Be aware that each retry has it's own timeout, meaning 30,000 ms of timeout may lead to a 90,000 ms wait until a request is rejected on 2 retries.

Generated using TypeDoc