Overview
Can be accessed using client.users
on an ApiClient instance.
Example
const api = new ApiClient({ authProvider }); const user = await api.users.getUserById('125328655');
Methods
createBlock(broadcaster, target, additionalInfo)
asyncBlocks the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | 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 add the block to. | |
target | 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 block. | |
additionalInfo | HelixUserBlockAdditionalInfo | <complex> | Additional info to give context to the block. | |
additionalInfo.reason | "spam" | "harassment" | "other" | none | The reason for blocking the user. | |
additionalInfo.sourceContext | "chat" | "whisper" | none | The source context for blocking the user. |
deleteBlock(broadcaster, target)
asyncUnblocks the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | 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 remove the block from. | |
target | 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 unblock. |
getActiveExtensions(user, withDev)
asyncGets a list of all installed extensions for the 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 get the installed extensions for. | |
withDev | boolean | false | Whether to include extensions that are in development. |
getAuthenticatedUser(user, withEmail)
asyncGets the user data of the given authenticated 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 get data for. | |
withEmail | boolean | false | Whether you need the user's email address. |
getBlocks(user, pagination)
asyncGets a list of users blocked by the 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 get blocks for. | |
pagination | HelixForwardPagination | none | see below | |
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | number | none | The number of results per page. |
getBlocksPaginated(user)
Creates a paginator for users blocked by the 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 get blocks for. |
getExtensionsForAuthenticatedUser(broadcaster, withInactive)
asyncGets a list of all extensions for the given authenticated user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | 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 broadcaster to get the list of extensions for. | |
withInactive | boolean | false | Whether to include inactive extensions. |
getUserById(user)
asyncGets the user data for the given user ID.
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 ID you want to look up. |
getUserByIdBatched(user)
asyncGets the user data for the given user ID, batching multiple calls into fewer requests as the API allows.
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 ID you want to look up. |
getUserByName(userName)
asyncGets the user data for the given username.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userName | UserNameResolvable A user name or a user or channel object. Aliased type: string | UserNameResolveableType | none | The username you want to look up. |
getUserByNameBatched(user)
asyncGets the user data for the given username, batching multiple calls into fewer requests as the API allows.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserNameResolvable A user name or a user or channel object. Aliased type: string | UserNameResolveableType | none | The username you want to look up. |
getUsersByIds(userIds)
asyncGets the user data for the given list of user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userIds | 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 IDs you want to look up. |
getUsersByNames(userNames)
asyncGets the user data for the given list of usernames.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userNames | UserNameResolvable []A user name or a user or channel object. Aliased type: string | UserNameResolveableType | none | The usernames you want to look up. |
updateActiveExtensionsForAuthenticatedUser(broadcaster, data)
asyncUpdates the installed extensions for the given authenticated user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | 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 update the installed extensions for. | |
data | HelixUserExtensionUpdatePayload | none | The extension installation payload. The format is shown on the Twitch documentation. Don't use the "data" wrapper though. |
updateAuthenticatedUser(user, data)
asyncUpdates the given authenticated user's data.
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 update. | |
data | HelixUserUpdate | none | The data to update. |