Overview
Methods
Constructor
new ApiClient(config)
Creates a new API client instance.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
config | ApiConfig | none | Configuration for the client instance. |
Methods
asIntent<T>(intents, runner)
asyncCreates a contextualized ApiClient that can be used to call the API in the context of a given intent.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
intents | string[] | none | A list of intents. The first one that is found in your auth provider will be used. | |
runner | (ctx: BaseApiClient) => Promise<T> | none | The callback to execute. A parameter is passed that should be used in place of the normal Please note that requests which require scope authorization ignore this context. The return value of your callback will be propagated to the return value of this method. |
asUser<T>(user, runner)
asyncCreates a contextualized ApiClient that can be used to call the API in the context of a given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to use as context. | |
runner | (ctx: BaseApiClient) => Promise<T> | none | The callback to execute. A parameter is passed that should be used in place of the normal Please note that requests which require scope authorization ignore this context. The return value of your callback will be propagated to the return value of this method. |
withoutUser<T>(runner)
asyncCreates a contextualized ApiClient that can be used to call the API without the context of any user.
This usually means that an app access token is used.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
runner | (ctx: BaseApiClient) => Promise<T> | none | The callback to execute. A parameter is passed that should be used in place of the normal Please note that requests which require scope authorization ignore this context erasure. The return value of your callback will be propagated to the return value of this method. |