twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks
Welcome

HelixUserApi

The Helix API methods that deal with users.

Overview

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)

async

Blocks 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.

Return type: void

createFollow(fromUser, toUser, allowNotifications)

async

Creates 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 fromUser still needs to have this enabled in their settings as well.

Return type: void

deleteBlock(target)

async

Unblocks the given user.

Parameter Type Required Default Description
target UserIdResolvable none

The user to unblock.

Return type: void

deleteFollow(fromUser, toUser)

async

Removes 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.

Return type: void

getActiveExtensions(user)

async

Retrieves 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)

async

Retrieves 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.

Return type: HelixPaginatedRequest<HelixUserBlockData, HelixUserBlock>

getFollowFromUserToBroadcaster(user, broadcaster)

async

Retrieves 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.

Return type: HelixFollow | null

getFollows(filter)

async

Retrieves 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.

Return type: HelixPaginatedRequestWithTotal<HelixFollowData, HelixFollow>

getMe(withEmail)

async

Retrieves the user data of the currently authenticated user.

Parameter Type Required Default Description
withEmail boolean false

Whether you need the user's email address.

Return type: HelixPrivilegedUser

getMyExtensions()

async

Retrieves a list of all extensions for the authenticated user.

Return type: Array<HelixUserExtension>

getUserById(userId)

async

Retrieves the user data for the given user ID.

Parameter Type Required Default Description
userId UserIdResolvable none

The user ID you want to look up.

Return type: HelixUser | null

getUserByName(userName)

async

Retrieves the user data for the given user name.

Parameter Type Required Default Description
userName UserNameResolvable none

The user name you want to look up.

Return type: HelixUser | null

getUsersByIds(userIds)

async

Retrieves 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.

Return type: Array<HelixUser>

getUsersByNames(userNames)

async

Retrieves 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.

Return type: Array<HelixUser>

updateMyActiveExtensions(data)

async

Updates 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)

async

Updates the currently authenticated user's data.

Parameter Type Required Default Description
data HelixUserUpdate none

The data to update.

Return type: HelixPrivilegedUser

userFollowsBroadcaster(user, broadcaster)

async

Checks 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.

Return type: boolean