Overview
Methods
Can be accessed using client.helix.users
on an ApiClient instance.
Example
const api = new ApiClient(new StaticAuthProvider(clientId, accessToken));
const user = await api.helix.users.getUserById('125328655');
Methods
createBlock(target, additionalInfo)
asyncBlocks the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
target | UserIdResolvable | none | The user to block. | |
additionalInfo | HelixUserBlockAdditionalInfo | {} | 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. |
createFollow(fromUser, toUser, allowNotifications)
asyncCreates a new follow from a user to another user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
fromUser | UserIdResolvable | none | The user to create the follow for. | |
toUser | UserIdResolvable | none | The user to follow. | |
allowNotifications | boolean | none | Whether email or push notifications are allowed to be created. The user |
deleteBlock(target)
asyncUnblocks the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
target | UserIdResolvable | none | The user to unblock. |
deleteFollow(fromUser, toUser)
asyncRemoves a follow from a user to another user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
fromUser | UserIdResolvable | none | The user to remove the follow for. | |
toUser | UserIdResolvable | none | The user to unfollow. |
getActiveExtensions(user)
asyncRetrieves a list of all installed extensions for the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable | none | The user to get the installed extensions for. If not given, get the installed extensions for the authenticated user. |
getBlocks(user, pagination)
asyncRetrieves a list of users blocked by the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable | none | The user to retrieve blocks for. | |
pagination | HelixForwardPagination | none | ||
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | string | 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 | none | The user to retrieve blocks for. |
getFollowFromUserToBroadcaster(user, broadcaster)
asyncRetrieves the follow relation bewteen a given user and a given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable | none | The user to retrieve the follow relation for. | |
broadcaster | UserIdResolvable | none | The broadcaster to retrieve the follow relation for. |
getFollows(filter)
asyncRetrieves a list of follow relations.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
filter | HelixFollowFilter | none | Several filtering and pagination parameters. See the HelixFollowFilter documentation. |
getFollowsPaginated(filter)
Creates a paginator for follow relations.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
filter | HelixFollowFilter | none | Several filtering and pagination parameters. See the HelixFollowFilter documentation. |
getMe(withEmail)
asyncRetrieves the user data of the currently authenticated user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
withEmail | boolean | false | Whether you need the user's email address. |
getMyExtensions()
asyncRetrieves a list of all extensions for the authenticated user.
getUserById(userId)
asyncRetrieves the user data for the given user ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userId | UserIdResolvable | none | The user ID you want to look up. |
getUserByName(userName)
asyncRetrieves the user data for the given user name.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userName | UserNameResolvable | none | The user name you want to look up. |
getUsersByIds(userIds)
asyncRetrieves the user data for the given list of user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userIds | Array<UserIdResolvable> | none | The user IDs you want to look up. |
getUsersByNames(userNames)
asyncRetrieves the user data for the given list of user names.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userNames | Array<UserNameResolvable> | none | The user names you want to look up. |
updateMyActiveExtensions(data)
asyncUpdates the installed extensions for the authenticated user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
data | HelixUserExtensionUpdatePayload | none | The extension installation payload. The format is shown on the Twitch documentation. Don't use the "data" wrapper though. |
updateUser(data)
asyncUpdates the currently authenticated user's data.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
data | HelixUserUpdate | none | The data to update. |
userFollowsBroadcaster(user, broadcaster)
asyncChecks whether the given user follows the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable | none | The user to check the follow for. | |
broadcaster | UserIdResolvable | none | The broadcaster to check the follow for. |