users - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
- twitch_users_get_users
- twitch_users_get_user
- twitch_users_update_user
- twitch_users_get_user_block_list
- twitch_users_block_user
- twitch_users_unblock_user
- twitch_users_get_user_extensions
- twitch_users_get_user_active_extensions
- twitch_users_update_user_extensions
Twitch Endpoint: N / A
This function returns the current Twitch user.
This function is not part of the Twitch API and is specific to the extension.
Syntax:
twitch_users_get_user()
Returns:
N/A
Twitch Endpoint: Get Users
This function gets information about one or more users.
You may look up users using their user ID, login name, or both but the sum total of the number of users you may look up is 100. For example, you may specify 50 IDs and 50 names or 100 IDs or names, but you cannot specify 100 IDs and 100 names.
If you don't specify IDs or login names, the request returns information about the user in the access token if you specify a user access token.
To include the user's verified email address in the response, you must use a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_EMAIL
.
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_users_get_users(optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
optionals | Struct | The optional parameters to be passed into the function: - id : Real or Array of Real : The ID of the user to get. To specify more than one user, pass an array with the ID of each user to get. The maximum number of IDs you may specify is 100.- login : String or Array of String : The login name of the user to get. To specify more than one user, pass an array with the ID of each user to get. The maximum number of login names you may specify is 100. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of users. |
├── id | String | An ID that identifies the user. |
├── login | String | The user's login name. |
├── display_name | String | The user's display name. |
├── type | String | The type of user. Possible values are: "admin" — Twitch administrator, "global_mod" , "staff" — Twitch staff, "" — Normal user |
├── broadcaster_type | String | The type of broadcaster. The type of broadcaster. Possible values are: "affiliate" — An affiliate broadcaster affiliate broadcaster, "partner" — A partner broadcaster partner broadcaster, "" — A normal broadcaster |
├── description | String | The user's description of their channel. |
├── profile_image_url | String | A URL to the user's profile image. |
├── offline_image_url | String | A URL to the user's offline image. |
├── view_count | Real | The number of times the user's channel has been viewed. NOTE: This field has been deprecated (see Get Users API endpoint – "view_count" deprecation). Any data in this field is not valid and should not be used. |
String | The user's verified email address. The struct includes this field only if the user access token includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_EMAIL . If the request contains more than one user, only the user associated with the access token that provided consent will include an email address — the email address for all other users will be empty. |
|
└── created_at | String | The UTC date and time that the user's account was created. The timestamp is in RFC3339 format. |
This method is triggered on failure.
Twitch Endpoint: Update User
This function updates the specified user's information. The user ID in the OAuth token identifies the user whose information you want to update.
To include the user's verified email address in the response, the user access token must also include the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_EMAIL
.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_EDIT
.
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_users_update_user(optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
optionals | Struct | The optional parameters to be passed into the function: - description : String : The string to update the channel's description to. The description is limited to a maximum of 300 characters. To remove the description, specify this member and set it to an empty string "" . |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | A list contains the single user that you updated. |
├── id | String | An ID that identifies the user. |
├── login | String | The user's login name. |
├── display_name | String | The user's display name. |
├── type | String | The type of user. Possible values are: "admin" — Twitch administrator, "global_mod" , "staff" — Twitch staff, "" — Normal user |
├── broadcaster_type | String | The type of broadcaster. Possible values are: "affiliate" — An affiliate broadcaster, "partner" — A partner broadcaster, "" — A normal broadcaster |
├── description | String | The user's description of their channel. |
├── profile_image_url | String | A URL to the user's profile image. |
├── offline_image_url | String | A URL to the user's offline image. |
├── view_count | Real | The number of times the user's channel has been viewed. NOTE: This field has been deprecated (see Get Users API endpoint – "view_count" deprecation). Any data in this field is not valid and should not be used. |
String | The user's verified email address. The struct includes this field only if the user access token includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_EMAIL .If the request contains more than one user, only the user associated with the access token that provided consent will include an email address — the email address for all other users will be empty. |
|
└── created_at | String | The UTC date and time that the user's account was created. The timestamp is in RFC3339 format. |
This method is triggered on failure.
Twitch Endpoint: Get User Block List
This function gets the list of users that the broadcaster has blocked. Read More
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_READ_BLOCKED_USERS
.
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_users_get_user_block_list(broadcaster_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster whose list of blocked users you want to get. |
optionals | Struct | The optional parameters to be passed into the function: - first : Real : 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. The default is 20.- after : String : The cursor used to get the next page of results. 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:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of blocked users. The list is in descending order by when the user was blocked. |
├── user_id | String | An ID that identifies the blocked user. |
├── user_login | String | The blocked user's login name. |
└── display_name | String | The blocked user's display name. |
This method is triggered on failure.
Twitch Endpoint: Block User
This function blocks the specified user from interacting with or having contact with the broadcaster. The user ID in the OAuth token identifies the broadcaster who is blocking the user.
To learn more about blocking users, see Block Other Users on Twitch.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_MANAGE_BLOCKED_USERS
.
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_users_block_user(target_user_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
target_user_id | String | The ID of the user to block. The API ignores the request if the broadcaster has already blocked the user. |
optionals | Struct | The optional parameters to be passed into the function: - source_context : String : The location where the harassment took place that is causing the broadcaster to block the user. Possible values are: "chat" , "whisper" .- reason : String : The reason that the broadcaster is blocking the user. Possible values are: "harassment" , "spam" , "other"
|
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Unblock User
This function removes the user from the broadcaster's list of blocked users. The user ID in the OAuth token identifies the broadcaster who's removing the block.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_MANAGE_BLOCKED_USERS
.
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_users_unblock_user(target_user_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
target_user_id | String | The ID of the user to remove from the broadcaster's list of blocked users. The API ignores the request if the broadcaster hasn't blocked the user. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Get User Extensions
This function gets a list of all extensions (both active and inactive) that the broadcaster has installed. The user ID in the access token identifies the broadcaster.
Note
Requires a user access token that includes the TWITCH_SCOPE_USER_READ_BROADCAST
or TWITCH_SCOPE_USER_EDIT_BROADCAST
scope. To include inactive extensions, you must include the TWITCH_SCOPE: TWITCH_SCOPE_USER_EDIT_BROADCAST
.
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_users_get_user_extensions(callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of extensions that the user has installed. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
├── name | String | The extension's name. |
├── can_activate | Boolean | A Boolean value that determines whether the extension is configured and can be activated. Is true if the extension is configured and can be activated. |
└── type | Array of String | The extension types that you can activate for this extension. Possible values are: "component" , "mobile" , "overlay" , "panel"
|
This method is triggered on failure.
Twitch Endpoint: Get User Active Extensions
This function gets the active extensions that the broadcaster has installed for each configuration.
Note
To include extensions that you have under development, you must specify a user access token that includes the TWITCH_SCOPE_USER_READ_BROADCAST
or TWITCH_SCOPE_USER_EDIT_BROADCAST
scope.
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_users_get_user_active_extensions(optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
optionals | Struct | The optional parameters to be passed into the function: - user_id : String : The ID of the broadcaster whose active extensions you want to get. This parameter is required if you specify an app access token and is optional if you specify a user access token. If you specify a user access token and don't specify this parameter, the API uses the user ID from the access token. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Struct | The active extensions that the broadcaster has installed. |
├── panel | Struct | A dictionary that contains the data for a panel extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the panel's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured this panel extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
└── name | String | The extension's name. |
├── overlay | Struct | A dictionary that contains the data for a video-overlay extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the overlay's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured this overlay extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
└── name | String | The extension's name. |
└── component | Struct | A dictionary that contains the data for a video-component extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the component's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured this component extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
├── name | String | The extension's name. |
├── x | Real | The x-coordinate where the extension is placed. |
└── y | Real | The y-coordinate where the extension is placed. |
This method is triggered on failure.
Twitch Endpoint: Update User Extensions
This function updates an installed extension's information. You can update the extension's activation state, ID, and version number. The user ID in the access token identifies the broadcaster whose extensions you're updating.
Note
If you try to activate an extension under multiple extension types, the last write wins (and there is no guarantee of write order).
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_USER_EDIT_BROADCAST
.
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_users_update_user_extensions(data, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
data | Struct | The extensions to update. The data field is a dictionary of extension types. The dictionary's possible keys are: "panel" , "overlay" , or "component" . The key's value is a dictionary of extensions.For the extension's dictionary, the key is a sequential number beginning with 1. For panel and overlay extensions, the key's value is a struct that contains the following fields: active (true /false ), id (the extension's ID), and version (the extension's version). For component extensions, the key's value includes the above fields plus the x and y fields, which identify the coordinate where the extension is placed. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Struct | The extensions that the broadcaster updated. |
├── panel | Struct | A dictionary that contains the data for a panel extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the panel's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured a panel extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
└── name | String | The extension's name. |
├── overlay | Struct | A dictionary that contains the data for a video-overlay extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the overlay's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured an overlay extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
└── name | String | The extension's name. |
└── component | Struct | A dictionary that contains the data for a video-component extension. The dictionary's key is a sequential number beginning with "1" . The following fields contain the component's data for each key. |
├── active | Boolean | A Boolean value that determines the extension's activation state. If false , the user has not configured a component extension. |
├── id | String | An ID that identifies the extension. |
├── version | String | The extension's version. |
├── name | String | The extension's name. |
├── x | Real | The x-coordinate where the extension is placed. |
└── y | Real | The y-coordinate where the extension is placed. |
This method is triggered on failure.