subscriptions - YoYoGames/GMEXT-Twitch GitHub Wiki

Subscriptions

Functions

These are the functions of this module:



Back To Top

twitch_subscriptions_get_broadcaster_subscriptions

Twitch Endpoint: Get Broadcaster Subscriptions

This function gets a list of users that subscribe to the specified broadcaster.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_SUBSCRIPTIONS.

A Twitch extensions may use an app access token if the broadcaster has granted the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_SUBSCRIPTIONS.from within the Twitch Extensions manager.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_subscriptions_get_broadcaster_subscriptions(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The broadcaster's ID. This ID must match the user ID in the access token.
optionals Struct The optional parameters to be passed into the function:

- user_id : Real or Array of Real : Filters the list to include only the specified subscribers. To specify more than one subscriber, pass an array with the ID of each subscriber. You may specify a maximum of 100 subscribers.
- first : String : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 20.
- after : String : The cursor used to get the next page of results. Do not specify if you set the user_id parameter. The Pagination struct in the response contains the cursor's value. Read more
- before : String : The cursor used to get the previous page of results. Do not specify if you set the user_id parameter. The Pagination struct in the response contains the cursor's value. Read more
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of users that subscribe to the broadcaster. The list is empty if the broadcaster has no subscribers.
 ├── broadcaster_id String An ID that identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── gifter_id String The ID of the user that gifted the subscription to the user. Is an empty string if is_gift is false.
 ├── gifter_login String The gifter's login name. Is an empty string if is_gift is false.
 ├── gifter_name String The gifter's display name. Is an empty string if is_gift is false.
 ├── is_gift Boolean A Boolean value that determines whether the subscription is a gift subscription. Is true if the subscription was gifted.
 ├── plan_name String The name of the subscription.
 ├── tier String The type of subscription. Possible values are: 1000 - Tier 1, 2000 - Tier 2, 3000 - Tier 3
 ├── user_id String An ID that identifies the subscribing user.
 ├── user_name String The user's display name.
 └── user_login String The user's login name.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next or previous page of results. Use the cursor to set the request's after or before parameter depending on whether you're paging forwards or backwards.
points Real The current number of subscriber points earned by this broadcaster. Points are based on the subscription tier of each user that subscribes to this broadcaster. For example, a Tier 1 subscription is worth 1 point, Tier 2 is worth 2 points, and Tier 3 is worth 6 points. The number of points determines the number of emote slots that are unlocked for the broadcaster (see Subscriber Emote Slots).
total Real The total number of users that subscribe to this broadcaster.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_subscriptions_check_user_subscription

Twitch Endpoint: Check User Subscription

This function checks whether the user subscribes to the broadcaster's channel.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_SUBSCRIPTIONS.

A Twitch extension may use an app access token if the broadcaster has granted the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_SUBSCRIPTIONS.from within the Twitch Extensions manager.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_subscriptions_check_user_subscription(broadcaster_id, user_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of a partner or affiliate broadcaster.
user_id String The ID of the user that you're checking to see whether they subscribe to the broadcaster in broadcaster_id. This ID must match the user ID in the access Token.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains a single struct with information about the user's subscription.
 ├── broadcaster_id String An ID that identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── gifter_id String The ID of the user that gifted the subscription. The struct includes this field only if is_gift is true.
 ├── gifter_login String The gifter's login name. The struct includes this field only if is_gift is true.
 ├── gifter_name String The gifter's display name. The struct includes this field only if is_gift is true.
 ├── is_gift Boolean A Boolean value that determines whether the subscription is a gift subscription. Is true if the subscription was gifted.
 └── tier String The type of subscription. Possible values are: 1000 - Tier 1, 2000 - Tier 2, 3000 - Tier 3

Failure Callback

This method is triggered on failure.



⚠️ **GitHub.com Fallback** ⚠️