TwurpleAuthenticationGetting dataExamplesFAQMigration

Main classes

HelixSubscriptionApi

The Helix API methods that deal with subscriptions.

Overview

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

Example

const api = new ApiClient({ authProvider });
const subscription = await api.subscriptions.getSubscriptionForUser('61369223', '125328655');

Methods

checkUserSubscription(user, broadcaster)

async

Checks if a given user is subscribed to a given broadcaster. Returns null if not subscribed.

This checks with the authorization of a user. If you only have the authorization of a broadcaster, check HelixSubscriptionApi#getSubscriptionForUser}.

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.

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 check the user's subscription for.

Return type: HelixUserSubscription | null

getSubscriptionForUser(broadcaster, user)

async

Gets the subscription data for a given user to a given broadcaster.

This checks with the authorization of a broadcaster. If you only have the authorization of a user, check HelixSubscriptionApi#checkUserSubscription}.

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

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.

Return type: HelixSubscription | null

getSubscriptions(broadcaster, pagination)

async

Gets a list of all subscriptions to a given broadcaster.

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 list subscriptions to.

paginationHelixForwardPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitnumbernone

The number of results per page.

getSubscriptionsForUsers(broadcaster, users)

async

Gets the subset of the given user list that is subscribed to the given broadcaster.

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 find subscriptions to.

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 users that should be checked for subscriptions.

Return type: HelixSubscription[]

getSubscriptionsPaginated(broadcaster)

Creates a paginator for all subscriptions to a given broadcaster.

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 list subscriptions to.