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

Classes

ApiClientBadgesApiBitsApiChannelChannelApiChannelFollowChannelPlaceholderChannelSubscriptionChatApiChatBadgeListChatBadgeSetChatBadgeVersionChatEmoteChatEmoteListChattersListCheermoteListConfigErrorCreatedVideoEmoteSetListHelixApiGroupHelixBanHelixBanEventHelixBitsApiHelixBitsLeaderboardHelixBitsLeaderboardEntryHelixChannelHelixChannelApiHelixChannelEditorHelixChannelEmoteHelixChannelPointsApiHelixChannelSearchResultHelixChatApiHelixChatBadgeSetHelixChatBadgeVersionHelixCheermoteListHelixClipHelixClipApiHelixCustomRewardHelixCustomRewardRedemptionHelixEmoteHelixEmoteFromSetHelixEventSubApiHelixEventSubSubscriptionHelixExtensionsApiHelixExtensionTransactionHelixFollowHelixGameHelixGameApiHelixHypeTrainApiHelixHypeTrainContributionHelixHypeTrainEventHelixInstalledExtensionHelixInstalledExtensionListHelixModerationApiHelixModeratorHelixModeratorEventHelixPaginatedRequestHelixPaginatedRequestWithTotalHelixPaginatedScheduleSegmentRequestHelixPollHelixPollApiHelixPollChoiceHelixPredictionHelixPredictionApiHelixPredictionOutcomeHelixPredictorHelixPrivilegedUserHelixScheduleHelixScheduleApiHelixScheduleSegmentHelixSearchApiHelixStreamHelixStreamApiHelixStreamMarkerHelixStreamMarkerWithVideoHelixSubscriptionHelixSubscriptionApiHelixSubscriptionEventHelixTagHelixTagApiHelixTeamHelixTeamApiHelixTeamWithUsersHelixUserHelixUserApiHelixUserBlockHelixUserExtensionHelixUserRelationHelixUserSubscriptionHelixVideoHelixVideoApiHelixWebHooksApiHelixWebHookSubscriptionKrakenApiGroupNoSubscriptionProgramErrorPrivilegedChannelPrivilegedUserSearchApiStreamStreamApiStreamNotLiveErrorSubscriptionTeamTeamApiTeamWithUsersUnsupportedApiUserUserApiUserBlockUserChatInfoUserFollowUserSubscriptionVideoVideoApi

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.

ParameterTypeRequiredDefaultDescription
targetUserIdResolvablenone

The user to block.

additionalInfoHelixUserBlockAdditionalInfo{}

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.

ParameterTypeRequiredDefaultDescription
fromUserUserIdResolvablenone

The user to create the follow for.

toUserUserIdResolvablenone

The user to follow.

allowNotificationsbooleannone

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.

ParameterTypeRequiredDefaultDescription
targetUserIdResolvablenone

The user to unblock.

Return type: void

deleteFollow(fromUser, toUser)

async

Removes a follow from a user to another user.

ParameterTypeRequiredDefaultDescription
fromUserUserIdResolvablenone

The user to remove the follow for.

toUserUserIdResolvablenone

The user to unfollow.

Return type: void

getActiveExtensions(user)

async

Retrieves a list of all installed extensions for the given user.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

The user to retrieve blocks for.

paginationHelixForwardPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitstringnone

The number of results per page.

getBlocksPaginated(user)

Creates a paginator for users blocked by the given user.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

The user to retrieve the follow relation for.

broadcasterUserIdResolvablenone

The broadcaster to retrieve the follow relation for.

Return type: HelixFollow | null

getFollows(filter)

async

Retrieves a list of follow relations.

ParameterTypeRequiredDefaultDescription
filterHelixFollowFilternone

Several filtering and pagination parameters. See the HelixFollowFilter documentation.

getFollowsPaginated(filter)

Creates a paginator for follow relations.

ParameterTypeRequiredDefaultDescription
filterHelixFollowFilternone

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.

ParameterTypeRequiredDefaultDescription
withEmailbooleanfalse

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.

ParameterTypeRequiredDefaultDescription
userIdUserIdResolvablenone

The user ID you want to look up.

Return type: HelixUser | null

getUserByName(userName)

async

Retrieves the user data for the given user name.

ParameterTypeRequiredDefaultDescription
userNameUserNameResolvablenone

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.

ParameterTypeRequiredDefaultDescription
userIdsArray<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.

ParameterTypeRequiredDefaultDescription
userNamesArray<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.

ParameterTypeRequiredDefaultDescription
dataHelixUserExtensionUpdatePayloadnone

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.

ParameterTypeRequiredDefaultDescription
dataHelixUserUpdatenone

The data to update.

Return type: HelixPrivilegedUser

userFollowsBroadcaster(user, broadcaster)

async

Checks whether the given user follows the given broadcaster.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

The user to check the follow for.

broadcasterUserIdResolvablenone

The broadcaster to check the follow for.

Return type: boolean