search - YoYoGames/GMEXT-Twitch GitHub Wiki

Search

Functions

These are the functions of this module:



Back To Top

twitch_search_categories

Twitch Endpoint: Search Categories

This function gets the games or categories that match the specified query.

To match, the category's name must contain all parts of the query string. For example, if the query string is 42, the response includes any category name that contains 42 in the title. If the query string is a phrase like love computer, the response includes any category name that contains the words love and computer anywhere in the name. The comparison is case insensitive.

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_search_categories(query, optionals, callback_success, callback_failed)
Argument Type Description
query String The URI-encoded search string. For example, encode #archery as %23archery and search strings like angel of death as angel%20of%20death.
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 items per page. 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:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of games or categories that match the query. The list is empty if there are no matches.
 ├── box_art_url String A URL to an image of the game's box art or streaming category.
 ├── name String The name of the game or category.
 └── id String An ID that uniquely identifies the game or category.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_search_channels

Twitch Endpoint: Search Channels

This function gets the channels that match the specified query and have streamed content within the past 6 months.

The fields that the API uses for comparison depends on the value that the live_only parameter is set to. If live_only is false, the API matches on the broadcaster's login name. However, if live_only is true, the API matches on the broadcaster's name and category name.

To match, the beginning of the broadcaster's name or category must match the query string. The comparison is case insensitive. If the query string is "angel_of_death", it matches all names that begin with "angel_of_death". However, if the query string is a phrase like "angel of death", it matches to names starting with "angelofdeath" or names starting with "angel_of_death".

By default, the results include both live and offline channels. To get only live channels set the live_only parameter to true.

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_search_channels(query, optionals, callback_success, callback_failed)
Argument Type Description
query String The URI-encoded search string. For example, encode search strings like "angel of death" as "angel%20of%20death".
optionals Struct The optional parameters to be passed into the function:

- live_only : Boolean : A Boolean value that determines whether the response includes only channels that are currently streaming live. Set to true to get only channels that are streaming live; otherwise, false to get live and offline channels. The default is false.
- 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 items per page. 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:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of channels that match the query. The list is empty if there are no matches.
 ├── broadcaster_language String The ISO 639-1 two-letter language code of the language used by the broadcaster. For example, "en" for English. If the broadcaster uses a language not in the list of supported stream languages, the value is "other".
 ├── broadcaster_login String The broadcaster's login name.
 ├── display_name String The broadcaster's display name.
 ├── game_id String The ID of the game that the broadcaster is playing or last played.
 ├── game_name String The name of the game that the broadcaster is playing or last played.
 ├── id String An ID that uniquely identifies the channel (this is the broadcaster's ID).
 ├── is_live Boolean A Boolean value that determines whether the broadcaster is streaming live. Is true if the broadcaster is streaming live; otherwise, false.
 ├── tag_ids Array of String IMPORTANT As of February 28, 2023, this field is deprecated and returns only an empty array. If you use this field, please update your code to use the tags field.The list of tags that apply to the stream. The list contains IDs only when the channel is streaming live. For a list of possible tags, see List of All Tags. The list doesn't include Category Tags.
 ├── tags Array of String The tags applied to the channel.
 ├── thumbnail_url String A URL to a thumbnail of the broadcaster's profile image.
 ├── title String The stream's title. Is an empty string if the broadcaster didn't set it.
 └── started_at String The UTC date and time (in RFC3339 format) of when the broadcaster started streaming. The string is empty if the broadcaster is not streaming live.

Failure Callback

This method is triggered on failure.



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