TwurpleAuthenticationGetting dataExamplesFAQMigration

Main classes

HelixUserApi

The Helix API methods that deal with users.

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)

async

Blocks the given user.

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

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

Return type: void

deleteBlock(broadcaster, target)

async

Unblocks the given user.

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

Return type: void

getActiveExtensions(user, withDev)

async

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

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

withDevbooleanfalse

Whether to include extensions that are in development.

getAuthenticatedUser(user, withEmail)

async

Gets the user data of the given authenticated user.

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

withEmailbooleanfalse

Whether you need the user's email address.

Return type: HelixPrivilegedUser

getBlocks(user, pagination)

async

Gets a list of users blocked by the given user.

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

paginationHelixForwardPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitnumbernone

The number of results per page.

getBlocksPaginated(user)

Creates a paginator for users blocked by the given user.

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

Return type: HelixPaginatedRequest<HelixUserBlockData, HelixUserBlock>

getExtensionsForAuthenticatedUser(broadcaster, withInactive)

async

Gets a list of all extensions for the given authenticated user.

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

withInactivebooleanfalse

Whether to include inactive extensions.

Return type: HelixUserExtension[]

getUserById(user)

async

Gets the user data for the given user ID.

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

Return type: HelixUser | null

getUserByIdBatched(user)

async

Gets the user data for the given user ID, batching multiple calls into fewer requests as the API allows.

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

Return type: HelixUser | null

getUserByName(userName)

async

Gets the user data for the given username.

ParameterTypeRequiredDefaultDescription
userName
UserNameResolvable

A user name or a user or channel object.

Aliased type: string | UserNameResolveableType

none

The username you want to look up.

Return type: HelixUser | null

getUserByNameBatched(user)

async

Gets the user data for the given username, batching multiple calls into fewer requests as the API allows.

ParameterTypeRequiredDefaultDescription
user
UserNameResolvable

A user name or a user or channel object.

Aliased type: string | UserNameResolveableType

none

The username you want to look up.

Return type: HelixUser | null

getUsersByIds(userIds)

async

Gets the user data for the given list of user IDs.

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

Return type: HelixUser[]

getUsersByNames(userNames)

async

Gets the user data for the given list of usernames.

ParameterTypeRequiredDefaultDescription
userNames
UserNameResolvable

A user name or a user or channel object.

Aliased type: string | UserNameResolveableType

[]
none

The usernames you want to look up.

Return type: HelixUser[]

updateActiveExtensionsForAuthenticatedUser(broadcaster, data)

async

Updates the installed extensions for the given authenticated user.

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

dataHelixUserExtensionUpdatePayloadnone

The extension installation payload.

The format is shown on the Twitch documentation. Don't use the "data" wrapper though.

updateAuthenticatedUser(user, data)

async

Updates the given authenticated user's data.

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

dataHelixUserUpdatenone

The data to update.

Return type: HelixPrivilegedUser