APIClient<C>
A base class for API clients used in ISP Nexus.
Extends
EventTarget
Type Parameters
| Type Parameter | Default type |
|---|---|
C extends APIClientConfig | APIClientConfig |
Implements
AsyncDisposable
Constructors
new APIClient()
new APIClient<C>(config): APIClient<C>
Parameters
| Parameter | Type |
|---|---|
config | C |
Returns
APIClient<C>
Overrides
EventTarget.constructor
Properties
axios
readonly axios: AxiosInstance | AxiosCacheInstance;
The Axios instance for the API client.
config
readonly config: C;
logger
readonly logger: IRuntimeLogger<string[]>;
The prefixed logger for the API client.
Accessors
$cooldown
get $cooldown(): Promise<void>
Returns
Promise<void>
Methods
[asyncDispose]()
asyncDispose: Promise<void>
Returns
Promise<void>
Implementation of
AsyncDisposable.[asyncDispose]
addEventListener()
addEventListener(
type,
listener,
options?): void
Adds a new handler for the type event. Any given listener is added only once per type and per capture option value.
If the once option is true, the listener is removed after the next time a type event is dispatched.
The capture option is not used by Node.js in any functional way other than tracking registered event listeners per the EventTarget specification.
Specifically, the capture option is used as part of the key when registering a listener.
Any individual listener may be added once with capture = false, and once with capture = true.
Parameters
| Parameter | Type |
|---|---|
type | string |
listener | EventListener | EventListenerObject |
options? | boolean | AddEventListenerOptions |
Returns
void
Inherited from
EventTarget.addEventListener
dispatchEvent()
dispatchEvent(event): boolean
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
Parameters
| Parameter | Type |
|---|---|
event | Event |
Returns
boolean
Inherited from
EventTarget.dispatchEvent
fetch()
fetch<T>(options): Promise<AxiosResponse<T, any>>
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
options | AxiosRequestConfig<any> |
Returns
Promise<AxiosResponse<T, any>>
removeEventListener()
removeEventListener(
type,
listener,
options?): void
Removes the event listener in target's event listener list with the same type, callback, and options.
Parameters
| Parameter | Type |
|---|---|
type | string |
listener | EventListener | EventListenerObject |
options? | boolean | EventListenerOptions |
Returns
void
Inherited from
EventTarget.removeEventListener
setCooldown()
protected setCooldown(nextCooldown): void
Parameters
| Parameter | Type |
|---|---|
nextCooldown | number |
Returns
void
toString()
toString(): string
Returns a string representation of an object.
Returns
string
updateCooldownAfterResponse()
protected updateCooldownAfterResponse(response): AxiosResponse<any, any> | CacheAxiosResponse<any, any>
Parameters
| Parameter | Type |
|---|---|
response | AxiosResponse<any, any> | CacheAxiosResponse<any, any> |
Returns
AxiosResponse<any, any> | CacheAxiosResponse<any, any>