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)
asyncChecks 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}.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. |
getSubscriptionForUser(broadcaster, user)
asyncGets 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}.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. |
getSubscriptions(broadcaster, pagination)
asyncGets a list of all subscriptions to a given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. | |
pagination | HelixForwardPagination | none | see below | |
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | number | none | The number of results per page. |
getSubscriptionsForUsers(broadcaster, users)
asyncGets the subset of the given user list that is subscribed to the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. |
getSubscriptionsPaginated(broadcaster)
Creates a paginator for all subscriptions to a given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. |