charity - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
Twitch Endpoint: Get Charity Campaign
This function gets information about the charity campaign that a broadcaster is running. For example, the campaign's fundraising goal and the current amount of donations.
To receive events when progress is made towards the campaign's goal or the broadcaster changes the fundraising goal, subscribe to the channel.charity_campaign.progress subscription type.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_CHARITY
.
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_charity_get_charity_campaign(broadcaster_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster that's currently running a charity campaign. 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:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | A list that contains the charity campaign that the broadcaster is currently running. The list is empty if the broadcaster is not running a charity campaign; the campaign information is not available after the campaign ends. |
├── id | String | An ID that identifies the charity campaign. |
├── broadcaster_id | String | An ID that identifies the broadcaster that's running the campaign. |
├── broadcaster_login | String | The broadcaster's login name. |
├── broadcaster_name | String | The broadcaster's display name. |
├── charity_name | String | The charity's name. |
├── charity_description | String | A description of the charity. |
├── charity_logo | String | A URL to an image of the charity's logo. The image's type is PNG and its size is 100px X 100px. |
├── charity_website | String | A URL to the charity's website. |
├── current_amount | Struct | The current amount of donations that the campaign has received. |
├── value | Real | The monetary amount. The amount is specified in the currency's minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550. |
├── decimal_places | Real | The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula: value / 10^decimal_places
|
└── currency | String | The ISO-4217 three-letter currency code that identifies the type of currency in value . |
└── target_amount | Struct | The campaign's fundraising goal. This field is undefined if the broadcaster has not defined a fundraising goal. |
├── value | Real | The monetary amount. The amount is specified in the currency's minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550. |
├── decimal_places | Real | The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula: value / 10^decimal_places
|
└── currency | String | The ISO-4217 three-letter currency code that identifies the type of currency in value . |
This method is triggered on failure.
Twitch Endpoint: Get Charity Campaign Donations
This function gets the list of donations that users have made to the broadcaster's active charity campaign.
To receive events as donations occur, subscribe to the channel.charity_campaign.donate subscription type.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_CHARITY
.
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_charity_get_charity_campaign_donations(broadcaster_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster that's currently running a charity campaign. This ID must match the user ID in the access token. |
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 | A list that contains the donations that users have made to the broadcaster's charity campaign. The list is empty if the broadcaster is not currently running a charity campaign; the donation information is not available after the campaign ends. |
├── id | String | An ID that identifies the donation. The ID is unique across campaigns. |
├── campaign_id | String | An ID that identifies the charity campaign that the donation applies to. |
├── user_id | String | An ID that identifies a user that donated money to the campaign. |
├── user_login | String | The user's login name. |
├── user_name | String | The user's display name. |
├── amount | Struct | a struct that contains the amount of money that the user donated. |
├── value | Real | The monetary amount. The amount is specified in the currency's minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550. |
├── decimal_places | Real | The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula:value / 10^decimal_places
|
└── currency | String | The ISO-4217 three-letter currency code that identifies the type of currency in value . |
pagination | Struct | a struct that 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 page of results. Use the cursor to set the request's after parameter. |
This method is triggered on failure.