TwurpleAuthenticationGetting dataExamplesFAQMigration

Main classes

HelixStreamApi

The Helix API methods that deal with streams.

Overview

Can be accessed using client.streams on an ApiClient instance.

Example

const api = new ApiClient({ authProvider });
const stream = await api.streams.getStreamByUserId('125328655');

Methods

createStreamMarker(broadcaster, description)

async

Creates a new stream marker.

Only works while the specified user's stream is live.

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 create a stream marker for.

descriptionstringnone

The description of the marker.

Return type: HelixStreamMarker

getFollowedStreams(user, pagination)

async

Gets the streams that are currently live and are followed 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 check followed streams for.

paginationHelixForwardPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitnumbernone

The number of results per page.

getFollowedStreamsPaginated(user)

Creates a paginator for the streams that are currently live and are followed 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 check followed streams for.

Return type: HelixPaginatedRequest<HelixStreamData, HelixStream>

getStreamByUserId(user)

async

Gets the current stream 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 to get the stream for.

Return type: HelixStream | null

getStreamByUserIdBatched(user)

async

Gets the current stream 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 to get the stream for.

Return type: HelixStream | null

getStreamByUserName(user)

async

Gets the current stream for the given username.

ParameterTypeRequiredDefaultDescription
user
UserNameResolvable

A user name or a user or channel object.

Aliased type: string | UserNameResolveableType

none

The username to get the stream for.

Return type: HelixStream | null

getStreamByUserNameBatched(user)

async

Gets the current stream 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 to get the stream for.

Return type: HelixStream | null

getStreamKey(broadcaster)

async

Gets the stream key of a stream.

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 stream key for.

Return type: string

getStreamMarkersForUser(user, pagination)

async

Gets a list of all stream markers for a 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 list the stream markers for.

paginationHelixPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.beforestringnone

A cursor to get the previous page of.

pagination.limitnumbernone

The number of results per page.

getStreamMarkersForUserPaginated(user)

Creates a paginator for all stream markers for a 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 list the stream markers for.

Return type: HelixPaginatedRequest<HelixStreamGetMarkersResponse, HelixStreamMarkerWithVideo>

getStreamMarkersForVideo(user, videoId, pagination)

async

Gets a list of all stream markers for a video.

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 the video belongs to.

videoIdstringnone

The video to list the stream markers for.

paginationHelixPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.beforestringnone

A cursor to get the previous page of.

pagination.limitnumbernone

The number of results per page.

getStreamMarkersForVideoPaginated(user, videoId)

Creates a paginator for all stream markers for a video.

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 the video belongs to.

videoIdstringnone

The video to list the stream markers for.

Return type: HelixPaginatedRequest<HelixStreamGetMarkersResponse, HelixStreamMarkerWithVideo>

getStreams(filter)

async

Gets a list of streams.

ParameterTypeRequiredDefaultDescription
filterHelixPaginatedStreamFilter<complex>see below
filter.afterstringnone

A cursor to get the following page of.

filter.beforestringnone

A cursor to get the previous page of.

filter.gamestring | string[]none

A game ID or a list thereof.

filter.languagestring | string[]none

A language or a list thereof.

filter.limitnumbernone

The number of results per page.

filter.type
HelixStreamType

The type of a stream.

Aliased type: "live" | "vodcast" | ""

none

A type of stream.

filter.userIdstring | string[]none

A user ID or a list thereof.

filter.userNamestring | string[]none

A user name or a list thereof.

getStreamsByUserIds(users)

async

Gets the current streams for the given user IDs.

ParameterTypeRequiredDefaultDescription
users
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 to get the streams for.

Return type: HelixStream[]

getStreamsByUserNames(users)

async

Gets the current streams for the given usernames.

ParameterTypeRequiredDefaultDescription
users
UserNameResolvable

A user name or a user or channel object.

Aliased type: string | UserNameResolveableType

[]
none

The username to get the streams for.

Return type: HelixStream[]

getStreamsPaginated(filter)

Creates a paginator for streams.

ParameterTypeRequiredDefaultDescription
filterHelixStreamFilter<complex>see below
filter.gamestring | string[]none

A game ID or a list thereof.

filter.languagestring | string[]none

A language or a list thereof.

filter.type
HelixStreamType

The type of a stream.

Aliased type: "live" | "vodcast" | ""

none

A type of stream.

filter.userIdstring | string[]none

A user ID or a list thereof.

filter.userNamestring | string[]none

A user name or a list thereof.

Return type: HelixPaginatedRequest<HelixStreamData, HelixStream>