Package tv.phantombot.twitch.api
Class Helix
java.lang.Object
tv.phantombot.twitch.api.Helix
Start of the Helix API. This class will handle the rate limits.
- Author:
- ScaniaTV, gmt2001
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Colors to be used withsendChatAnnouncement(java.lang.String,java.lang.String,java.lang.String)
static enum
The status of a custom reward redemptionstatic enum
The status to set the prediction to forendPredictionAsync(String, PredictionStatus, String)
) -
Method Summary
Modifier and TypeMethodDescriptionBans a user from participating in a broadcaster's chat room, or puts them in a timeout.banUserAsync
(String broadcaster_id, String user_id, String reason, int duration) Bans a user from participating in a broadcaster's chat room, or puts them in a timeout.cancelRaid
(String broadcaster_id) Cancel a pending raid.cancelRaidAsync
(String broadcaster_id) Cancel a pending raid.createCustomReward
(String title, int cost, Boolean is_enabled, String background_color, Boolean is_user_input_required, String prompt, Boolean is_max_per_stream_enabled, Integer max_per_stream, Boolean is_max_per_user_per_stream_enabled, Integer max_per_user_per_stream, Boolean is_global_cooldown_enabled, Integer global_cooldown_seconds, Boolean should_redemptions_skip_request_queue) Creates a Custom Reward in the broadcaster\'s channel.createCustomRewardAsync
(String title, int cost, Boolean is_enabled, String background_color, Boolean is_user_input_required, String prompt, Boolean is_max_per_stream_enabled, Integer max_per_stream, Boolean is_max_per_user_per_stream_enabled, Integer max_per_user_per_stream, Boolean is_global_cooldown_enabled, Integer global_cooldown_seconds, Boolean should_redemptions_skip_request_queue) Creates a Custom Reward in the broadcaster\'s channel.createEventSubSubscriptionAsync
(String jsonString) Creates an EventSub subscription.createPoll
(String title, List<String> choices, int durationSec, int channelPointsPerVote) Creates a poll that viewers in the broadcaster’s channel can vote on.createPollAsync
(String title, List<String> choices, int durationSec, int channelPointsPerVote) Creates a poll that viewers in the broadcaster’s channel can vote on.createPrediction
(String title, long seconds, List<String> choices) Creates a Channel Points Prediction.createPrediction
(String title, Duration duration, List<String> choices) Creates a Channel Points Prediction.createPredictionAsync
(String title, Duration duration, List<String> choices) Creates a Channel Points Prediction.deleteChatMessages
(String broadcaster_id, String message_id) Removes a single chat message or all chat messages from the broadcaster's chat room.deleteChatMessagesAsync
(String broadcaster_id, String message_id) Removes a single chat message or all chat messages from the broadcaster's chat room.Deletes a custom reward that the broadcaster created.Deletes a custom reward that the broadcaster created.Deletes an EventSub subscription.Ends an active poll.endPollAsync
(String id, String status) Ends an active poll.endPrediction
(String id, Helix.PredictionStatus status, String winningOutcomeId) Locks, resolves, or cancels a Channel Points Prediction.endPredictionAsync
(String id, Helix.PredictionStatus status, String winningOutcomeId) Locks, resolves, or cancels a Channel Points Prediction.getBroadcasterSubscriptions
(String broadcaster_id, List<String> user_id, int first, String after) Get all of the subscriptions for a specific broadcaster.getBroadcasterSubscriptionsAsync
(String broadcaster_id, List<String> user_id, int first, String after) Get all of the subscriptions for a specific broadcaster.getChannelEmotes
(String broadcaster_id) Gets all custom emotes for a specific Twitch channel including subscriber emotes, Bits tier emotes, and follower emotes.getChannelEmotesAsync
(String broadcaster_id) Gets all custom emotes for a specific Twitch channel including subscriber emotes, Bits tier emotes, and follower emotes.getChannelFollowers
(String user_id, int first, String after) Gets a list of users that follow the broadcaster.getChannelFollowers
(String broadcaster_id, String user_id, int first, String after) Gets a list of users that follow the specified broadcaster.getChannelFollowersAsync
(String user_id, int first, String after) Gets a list of users that follow the broadcaster.getChannelFollowersAsync
(String broadcaster_id, String user_id, int first, String after) Gets a list of users that follow the specified broadcaster.getChannelInformation
(String broadcaster_id) Gets channel information for users.getChannelInformationAsync
(String broadcaster_id) Gets channel information for users.getChannelTeams
(String broadcaster_id) Retrieves a list of Twitch Teams of which the specified channel/broadcaster is a member.getChannelTeamsAsync
(String broadcaster_id) Retrieves a list of Twitch Teams of which the specified channel/broadcaster is a member.getChattersAsync
(int first, String after) Gets the list of users that are connected to the broadcaster’s chat session.getCheermotes
(String broadcaster_id) Retrieves the list of available Cheermotes, animated emotes to which viewers can assign Bits, to cheer in chat.getCheermotesAsync
(String broadcaster_id) Retrieves the list of available Cheermotes, animated emotes to which viewers can assign Bits, to cheer in chat.getClips
(List<String> id, String broadcaster_id, String game_id, int first, String before, String after, String started_at, String ended_at) Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only).getClipsAsync
(List<String> id, String broadcaster_id, String game_id, int first, String before, String after, String started_at, String ended_at) Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only).getClipsAsync
(List<String> id, String broadcaster_id, String game_id, int first, String before, String after, ZonedDateTime started_at, ZonedDateTime ended_at) Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only).getCustomReward
(List<String> id, Boolean only_manageable_rewards) Returns a list of Custom Reward objects for the Custom Rewards on a channel.getCustomRewardAsync
(List<String> id, Boolean only_manageable_rewards) Returns a list of Custom Reward objects for the Custom Rewards on a channel.getEventSubSubscriptionsAsync
(EventSubSubscription.SubscriptionStatus status, String type, String user_id, String after) Gets a list of EventSub subscriptions that the client in the access token created.Gets all global emotes.Gets all global emotes.Gets a list of polls that the broadcaster created.getPollsAsync
(List<String> pollIds, int first, String after) Gets a list of polls that the broadcaster created.getPredictions
(List<String> id, int first, String after) Gets a list of Channel Points Predictions that the broadcaster created.getPredictionsAsync
(List<String> id, int first, String after) Gets a list of Channel Points Predictions that the broadcaster created.getStreams
(int first, String before, String after, List<String> user_id, List<String> user_login, List<String> game_id, List<String> language) Gets information about active streams.getStreamsAsync
(int first, String before, String after, List<String> user_id, List<String> user_login, List<String> game_id, List<String> language) Gets information about active streams.Gets information for a specific Twitch Team.getTeamsAsync
(String name, String id) Gets information for a specific Twitch Team.Gets information about one or more specified Twitch users.getUsersAsync
(List<String> id, List<String> login) Gets information about one or more specified Twitch users.getUsersFollows
(String from_id, String to_id, int first, String after) Deprecated, for removal: This API element is subject to removal in a future version.getUsersFollowsAsync
(String from_id, String to_id, int first, String after) Deprecated, for removal: This API element is subject to removal in a future version.This endpoint is deprecated by Twitch in favor ofgetChannelFollowersAsync(String, int, String)
, which requires an OAuth scopegetVideos
(List<String> id, String user_id, String game_id, int first, String before, String after, String language, String period, String sort, String type) Gets video information by one or more video IDs, user ID, or game ID.getVideosAsync
(List<String> id, String user_id, String game_id, int first, String before, String after, String language, String period, String sort, String type) Gets video information by one or more video IDs, user ID, or game ID.static Helix
instance()
Method that returns the instance of Helix.int
The maximum value ofremainingRateLimit()
int
The remaining rate limit for HelixsearchCategories
(String query, int first, String after) Returns a list of games or categories that match the query via name either entirely or partially.searchCategoriesAsync
(String query, int first, String after) Returns a list of games or categories that match the query via name either entirely or partially.sendChatAnnouncement
(String broadcaster_id, String message, String color) Sends an announcement to the broadcaster's chat room.sendChatAnnouncement
(String broadcaster_id, String message, Helix.AnnouncementColors color) Sends an announcement to the broadcaster's chat room.sendChatAnnouncementAsync
(String broadcaster_id, String message, String color) Sends an announcement to the broadcaster's chat room.sendChatAnnouncementAsync
(String broadcaster_id, String message, Helix.AnnouncementColors color) Sends an announcement to the broadcaster's chat room.sendShoutout
(String from_broadcaster_id, String to_broadcaster_id) Sends a Shoutout to the specified broadcaster.sendShoutoutAsync
(String from_broadcaster_id, String to_broadcaster_id) Sends a Shoutout to the specified broadcaster.sendWhisper
(String to_user_id, String message) Sends a whisper message to the specified user.sendWhisperAsync
(String to_user_id, String message) Sends a whisper message to the specified user.void
startCommercial
(String broadcaster_id, int length) Starts a commercial on a specified channel.startCommercialAsync
(String broadcaster_id, int length) Starts a commercial on a specified channel.Raid another channel by sending the broadcaster's viewers to the targeted channel.startRaidAsync
(String from_broadcaster_id, String to_broadcaster_id) Raid another channel by sending the broadcaster's viewers to the targeted channel.Removes the ban or timeout that was placed on the specified user.unbanUserAsync
(String broadcaster_id, String user_id) Removes the ban or timeout that was placed on the specified user.updateChannelInformation
(String broadcaster_id, String game_id, String language, String title, int delay) Modifies channel information for users.updateChannelInformationAsync
(String broadcaster_id, String game_id, String language, String title, int delay) Modifies channel information for users.updateChatSettings
(String broadcaster_id, Boolean emote_mode, Boolean follower_mode, Integer follower_mode_duration, Boolean non_moderator_chat_delay, Integer non_moderator_chat_delay_duration, Boolean slow_mode, Integer slow_mode_wait_time, Boolean subscriber_mode, Boolean unique_chat_mode) Updates the broadcaster's chat settings.updateChatSettingsAsync
(String broadcaster_id, Boolean emote_mode, Boolean follower_mode, Integer follower_mode_duration, Boolean non_moderator_chat_delay, Integer non_moderator_chat_delay_duration, Boolean slow_mode, Integer slow_mode_wait_time, Boolean subscriber_mode, Boolean unique_chat_mode) Updates the broadcaster's chat settings.updateCustomReward
(String id, String title, Integer cost, Boolean is_enabled, Boolean is_paused, String background_color, Boolean is_user_input_required, String prompt, Boolean is_max_per_stream_enabled, Integer max_per_stream, Boolean is_max_per_user_per_stream_enabled, Integer max_per_user_per_stream, Boolean is_global_cooldown_enabled, Integer global_cooldown_seconds, Boolean should_redemptions_skip_request_queue) Updates a custom reward.updateCustomRewardAsync
(String id, String title, Integer cost, Boolean is_enabled, Boolean is_paused, String background_color, Boolean is_user_input_required, String prompt, Boolean is_max_per_stream_enabled, Integer max_per_stream, Boolean is_max_per_user_per_stream_enabled, Integer max_per_user_per_stream, Boolean is_global_cooldown_enabled, Integer global_cooldown_seconds, Boolean should_redemptions_skip_request_queue) Updates a custom reward.updateRedemptionStatus
(List<String> id, String reward_id, Helix.CustomRewardRedemptionStatus newStatus) Updates a redemption\'s status.updateRedemptionStatusAsync
(List<String> id, String reward_id, Helix.CustomRewardRedemptionStatus newStatus) Updates a redemption\'s status.updateShieldModeStatus
(String broadcaster_id, boolean isActive) Activates or deactivates the broadcaster’s Shield Mode.updateShieldModeStatusAsync
(String broadcaster_id, boolean isActive) Activates or deactivates the broadcaster’s Shield Mode.
-
Method Details
-
instance
Method that returns the instance of Helix.- Returns:
- A JSONObject with the response
-
setOAuth
-
maxRateLimit
public int maxRateLimit()The maximum value ofremainingRateLimit()
- Returns:
- The max rate limit
-
remainingRateLimit
public int remainingRateLimit()The remaining rate limit for Helix- Returns:
- The remaining rate limit
-
getChannelInformation
public JSONObject getChannelInformation(String broadcaster_id) throws JSONException, IllegalArgumentException Gets channel information for users.- Parameters:
broadcaster_id
- ID of the channel to be retrieved.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelInformationAsync
public Mono<JSONObject> getChannelInformationAsync(String broadcaster_id) throws JSONException, IllegalArgumentException Gets channel information for users.- Parameters:
broadcaster_id
- ID of the channel to be retrieved.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateChannelInformation
public JSONObject updateChannelInformation(String broadcaster_id, @Nullable String game_id, @Nullable String language, @Nullable String title, int delay) throws JSONException, IllegalArgumentException Modifies channel information for users. @paramref channelId is required. All others are optional, but at least one must be valid.- Parameters:
broadcaster_id
- ID of the channel to be updated.game_id
- The current game ID being played on the channel. Use "0" or "" (an empty string) to unset the game.language
- The language of the channel. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".title
- The title of the stream. Value must not be an empty string.delay
- Stream delay in seconds. Stream delay is a Twitch Partner feature; trying to set this value for other account types will return a 400 error.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateChannelInformationAsync
public Mono<JSONObject> updateChannelInformationAsync(String broadcaster_id, @Nullable String game_id, @Nullable String language, @Nullable String title, int delay) throws JSONException, IllegalArgumentException Modifies channel information for users. @paramref channelId is required. All others are optional, but at least one must be valid.- Parameters:
broadcaster_id
- ID of the channel to be updated.game_id
- The current game ID being played on the channel. Use "0" or "" (an empty string) to unset the game.language
- The language of the channel. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".title
- The title of the stream. Value must not be an empty string.delay
- Stream delay in seconds. Stream delay is a Twitch Partner feature; trying to set this value for other account types will return a 400 error.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
searchCategories
public JSONObject searchCategories(String query, int first, @Nullable String after) throws JSONException, IllegalArgumentException Returns a list of games or categories that match the query via name either entirely or partially.- Parameters:
query
- Search query.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
searchCategoriesAsync
public Mono<JSONObject> searchCategoriesAsync(String query, int first, @Nullable String after) throws JSONException, IllegalArgumentException Returns a list of games or categories that match the query via name either entirely or partially.- Parameters:
query
- Search query.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getUsersFollows
@Deprecated(since="3.8.0.0", forRemoval=true) public JSONObject getUsersFollows(@Nullable String from_id, @Nullable String to_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Deprecated, for removal: This API element is subject to removal in a future version.This endpoint is deprecated by Twitch in favor ofgetChannelFollowers(String, int, String)
, which requires an OAuth scopeGets information on follow relationships between two Twitch users. This can return information like "who is qotrok following," "who is following qotrok," or "is user X following user Y." Information returned is sorted in order, most recent follow first. At minimum, from_id or to_id must be provided for a query to be valid.- Parameters:
from_id
- User ID. The request returns information about users who are being followed by the from_id user.to_id
- User ID. The request returns information about users who are following the to_id user.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
UnsupportedOperationException
- 410 Gone: This API is not available.JSONException
IllegalArgumentException
-
getUsersFollowsAsync
@Deprecated(since="3.8.0.0", forRemoval=true) public Mono<JSONObject> getUsersFollowsAsync(@Nullable String from_id, @Nullable String to_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Deprecated, for removal: This API element is subject to removal in a future version.This endpoint is deprecated by Twitch in favor ofgetChannelFollowersAsync(String, int, String)
, which requires an OAuth scopeGets information on follow relationships between two Twitch users. This can return information like "who is qotrok following," "who is following qotrok," or "is user X following user Y." Information returned is sorted in order, most recent follow first. At minimum, from_id or to_id must be provided for a query to be valid.- Parameters:
from_id
- User ID. The request returns information about users who are being followed by the from_id user.to_id
- User ID. The request returns information about users who are following the to_id user.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
UnsupportedOperationException
- 410 Gone: This API is not available.JSONException
IllegalArgumentException
-
getBroadcasterSubscriptions
public JSONObject getBroadcasterSubscriptions(String broadcaster_id, @Nullable List<String> user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Get all of the subscriptions for a specific broadcaster.- Parameters:
broadcaster_id
- User ID of the broadcaster. Must match the User ID in the Bearer token.user_id
- Filters results to only include potential subscriptions made by the provided user IDs. Accepts up to 100 values.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results in a multi-page response. This applies only to queries without user_id. If a user_id is specified, it supersedes any cursor/offset combinations. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getBroadcasterSubscriptionsAsync
public Mono<JSONObject> getBroadcasterSubscriptionsAsync(String broadcaster_id, @Nullable List<String> user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Get all of the subscriptions for a specific broadcaster.- Parameters:
broadcaster_id
- User ID of the broadcaster. Must match the User ID in the Bearer token.user_id
- Filters results to only include potential subscriptions made by the provided user IDs. Accepts up to 100 values.first
- Maximum number of objects to return. Maximum: 100. Default: 20.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results in a multi-page response. This applies only to queries without user_id. If a user_id is specified, it supersedes any cursor/offset combinations. The cursor value specified here is from the pagination response field of a prior query.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getStreams
public JSONObject getStreams(int first, @Nullable String before, @Nullable String after, @Nullable List<String> user_id, @Nullable List<String> user_login, @Nullable List<String> game_id, @Nullable List<String> language) throws JSONException, IllegalArgumentException Gets information about active streams. Streams are returned sorted by number of current viewers, in descending order. Across multiple pages of results, there may be duplicate or missing streams, as viewers join and leave streams.- Parameters:
first
- Maximum number of objects to return. Maximum: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.user_id
- Returns streams broadcast by one or more specified user IDs. You can specify up to 100 IDs.user_login
- Returns streams broadcast by one or more specified user login names. You can specify up to 100 names.game_id
- Returns streams broadcasting a specified game ID. You can specify up to 100 IDs.language
- Stream language. You can specify up to 100 languages. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getStreamsAsync
public Mono<JSONObject> getStreamsAsync(int first, @Nullable String before, @Nullable String after, @Nullable List<String> user_id, @Nullable List<String> user_login, @Nullable List<String> game_id, @Nullable List<String> language) throws JSONException, IllegalArgumentException Gets information about active streams. Streams are returned sorted by number of current viewers, in descending order. Across multiple pages of results, there may be duplicate or missing streams, as viewers join and leave streams.- Parameters:
first
- Maximum number of objects to return. Maximum: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.user_id
- Returns streams broadcast by one or more specified user IDs. You can specify up to 100 IDs.user_login
- Returns streams broadcast by one or more specified user login names. You can specify up to 100 names.game_id
- Returns streams broadcasting a specified game ID. You can specify up to 100 IDs.language
- Stream language. You can specify up to 100 languages. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getUsers
public JSONObject getUsers(@Nullable List<String> id, @Nullable List<String> login) throws JSONException Gets information about one or more specified Twitch users. Users are identified by optional user IDs and/or login name. If neither a user ID nor a login name is specified, the user is looked up by Bearer token. Note: The limit of 100 IDs and login names is the total limit. You can request, for example, 50 of each or 100 of one of them. You cannot request 100 of both.- Parameters:
id
- User ID. Multiple user IDs can be specified. Limit: 100.login
- User login name. Multiple login names can be specified. Limit: 100.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
getUsersAsync
public Mono<JSONObject> getUsersAsync(@Nullable List<String> id, @Nullable List<String> login) throws JSONException Gets information about one or more specified Twitch users. Users are identified by optional user IDs and/or login name. If neither a user ID nor a login name is specified, the user is looked up by Bearer token. Note: The limit of 100 IDs and login names is the total limit. You can request, for example, 50 of each or 100 of one of them. You cannot request 100 of both.- Parameters:
id
- User ID. Multiple user IDs can be specified. Limit: 100.login
- User login name. Multiple login names can be specified. Limit: 100.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
startCommercial
public JSONObject startCommercial(String broadcaster_id, int length) throws JSONException, IllegalArgumentException Starts a commercial on a specified channel.- Parameters:
broadcaster_id
- ID of the channel requesting a commercial.length
- Desired length of the commercial in seconds. Valid options are 30, 60, 90, 120, 150, 180.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
startCommercialAsync
public Mono<JSONObject> startCommercialAsync(String broadcaster_id, int length) throws JSONException, IllegalArgumentException Starts a commercial on a specified channel.- Parameters:
broadcaster_id
- ID of the channel requesting a commercial.length
- Desired length of the commercial in seconds. Valid options are 30, 60, 90, 120, 150, 180.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelEmotes
public JSONObject getChannelEmotes(String broadcaster_id) throws JSONException, IllegalArgumentException Gets all custom emotes for a specific Twitch channel including subscriber emotes, Bits tier emotes, and follower emotes. Custom channel emotes are custom emoticons that viewers may use in Twitch chat once they are subscribed to, cheered in, or followed the channel that owns the emotes.- Parameters:
broadcaster_id
- The broadcaster whose emotes are being requested.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelEmotesAsync
public Mono<JSONObject> getChannelEmotesAsync(String broadcaster_id) throws JSONException, IllegalArgumentException Gets all custom emotes for a specific Twitch channel including subscriber emotes, Bits tier emotes, and follower emotes. Custom channel emotes are custom emoticons that viewers may use in Twitch chat once they are subscribed to, cheered in, or followed the channel that owns the emotes.- Parameters:
broadcaster_id
- The broadcaster whose emotes are being requested.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getGlobalEmotes
Gets all global emotes. Global emotes are Twitch-specific emoticons that every user can use in Twitch chat.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
getGlobalEmotesAsync
Gets all global emotes. Global emotes are Twitch-specific emoticons that every user can use in Twitch chat.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
getCheermotes
Retrieves the list of available Cheermotes, animated emotes to which viewers can assign Bits, to cheer in chat. Cheermotes returned are available throughout Twitch, in all Bits-enabled channels.- Parameters:
broadcaster_id
- ID for the broadcaster who might own specialized Cheermotes.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
getCheermotesAsync
Retrieves the list of available Cheermotes, animated emotes to which viewers can assign Bits, to cheer in chat. Cheermotes returned are available throughout Twitch, in all Bits-enabled channels.- Parameters:
broadcaster_id
- ID for the broadcaster who might own specialized Cheermotes.- Returns:
- A JSONObject with the response
- Throws:
JSONException
-
getVideos
public JSONObject getVideos(@Nullable List<String> id, @Nullable String user_id, @Nullable String game_id, int first, @Nullable String before, @Nullable String after, @Nullable String language, @Nullable String period, @Nullable String sort, @Nullable String type) throws JSONException, IllegalArgumentException Gets video information by one or more video IDs, user ID, or game ID. For lookup by user or game, several filters are available that can be specified as query parameters. Each request must specify one or more video ids, one user_id, or one game_id. A request that uses video ids can not use any other parameter. If a game is specified, a maximum of 500 results are available.- Parameters:
id
- ID of the video being queried. Limit: 100. If this is specified, you cannot use any of the other query parameters below.user_id
- ID of the user who owns the video.game_id
- ID of the game the video is of.first
- Number of values to be returned when getting videos by user or game ID. Limit: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.language
- Language of the video being queried. Limit: 1. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".period
- Period during which the video was created. Valid values: "all", "day", "week", "month". Default: "all".sort
- Sort order of the videos. Valid values: "time", "trending", "views". Default: "time".type
- Type of video. Valid values: "all", "upload", "archive", "highlight". Default: "all".- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getVideosAsync
public Mono<JSONObject> getVideosAsync(@Nullable List<String> id, @Nullable String user_id, @Nullable String game_id, int first, @Nullable String before, @Nullable String after, @Nullable String language, @Nullable String period, @Nullable String sort, @Nullable String type) throws JSONException, IllegalArgumentException Gets video information by one or more video IDs, user ID, or game ID. For lookup by user or game, several filters are available that can be specified as query parameters. Each request must specify one or more video ids, one user_id, or one game_id. A request that uses video ids can not use any other parameter. If a game is specified, a maximum of 500 results are available.- Parameters:
id
- ID of the video being queried. Limit: 100. If this is specified, you cannot use any of the other query parameters below.user_id
- ID of the user who owns the video.game_id
- ID of the game the video is of.first
- Number of values to be returned when getting videos by user or game ID. Limit: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.language
- Language of the video being queried. Limit: 1. A language value must be either the ISO 639-1 two-letter code for a supported stream language or "other".period
- Period during which the video was created. Valid values: "all", "day", "week", "month". Default: "all".sort
- Sort order of the videos. Valid values: "time", "trending", "views". Default: "time".type
- Type of video. Valid values: "all", "upload", "archive", "highlight". Default: "all".- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelTeams
public JSONObject getChannelTeams(String broadcaster_id) throws JSONException, IllegalArgumentException Retrieves a list of Twitch Teams of which the specified channel/broadcaster is a member.- Parameters:
broadcaster_id
- User ID for a Twitch user.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelTeamsAsync
public Mono<JSONObject> getChannelTeamsAsync(String broadcaster_id) throws JSONException, IllegalArgumentException Retrieves a list of Twitch Teams of which the specified channel/broadcaster is a member.- Parameters:
broadcaster_id
- User ID for a Twitch user.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getTeams
public JSONObject getTeams(@Nullable String name, @Nullable String id) throws JSONException, IllegalArgumentException Gets information for a specific Twitch Team. One of the two query parameters must be specified to return Team information.- Parameters:
name
- Team name.id
- Team ID.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getTeamsAsync
public Mono<JSONObject> getTeamsAsync(@Nullable String name, @Nullable String id) throws JSONException, IllegalArgumentException Gets information for a specific Twitch Team. One of the two query parameters must be specified to return Team information.- Parameters:
name
- Team name.id
- Team ID.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getClips
public JSONObject getClips(@Nullable List<String> id, @Nullable String broadcaster_id, @Nullable String game_id, int first, @Nullable String before, @Nullable String after, @Nullable String started_at, @Nullable String ended_at) throws JSONException, IllegalArgumentException Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only). Note: The clips service returns a maximum of 1000 clips.- Parameters:
id
- ID of the clip being queried. Limit: 100. If this is specified, you cannot use any of the other query parameters below.broadcaster_id
- ID of the broadcaster for whom clips are returned. Results are ordered by view count.game_id
- ID of the game for which clips are returned. Results are ordered by view count.first
- Maximum number of objects to return. Maximum: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.started_at
- Starting date/time for returned clips, in RFC3339 format. (The seconds value is ignored.) If this is specified, ended_at also should be specified; otherwise, the ended_at date/time will be 1 week after the started_at value.ended_at
- Ending date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.) If this is specified, started_at also must be specified; otherwise, the time period is ignored.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getClipsAsync
public Mono<JSONObject> getClipsAsync(@Nullable List<String> id, @Nullable String broadcaster_id, @Nullable String game_id, int first, @Nullable String before, @Nullable String after, @Nullable ZonedDateTime started_at, @Nullable ZonedDateTime ended_at) throws JSONException, IllegalArgumentException Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only). Note: The clips service returns a maximum of 1000 clips.- Parameters:
id
- ID of the clip being queried. Limit: 100. If this is specified, you cannot use any of the other query parameters below.broadcaster_id
- ID of the broadcaster for whom clips are returned. Results are ordered by view count.game_id
- ID of the game for which clips are returned. Results are ordered by view count.first
- Maximum number of objects to return. Maximum: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.started_at
- Starting date/time for returned clips. (The seconds value is ignored.) If this is specified, ended_at also should be specified; otherwise, the ended_at date/time will be 1 week after the started_at value.ended_at
- Ending date/time for returned clips. (Note that the seconds value is ignored.) If this is specified, started_at also must be specified; otherwise, the time period is ignored.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getClipsAsync
public Mono<JSONObject> getClipsAsync(@Nullable List<String> id, @Nullable String broadcaster_id, @Nullable String game_id, int first, @Nullable String before, @Nullable String after, @Nullable String started_at, @Nullable String ended_at) throws JSONException, IllegalArgumentException Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only). Note: The clips service returns a maximum of 1000 clips.- Parameters:
id
- ID of the clip being queried. Limit: 100. If this is specified, you cannot use any of the other query parameters below.broadcaster_id
- ID of the broadcaster for whom clips are returned. Results are ordered by view count.game_id
- ID of the game for which clips are returned. Results are ordered by view count.first
- Maximum number of objects to return. Maximum: 100. Default: 20.before
- Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.after
- Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.started_at
- Starting date/time for returned clips, in RFC3339 format. (The seconds value is ignored.) If this is specified, ended_at also should be specified; otherwise, the ended_at date/time will be 1 week after the started_at value.ended_at
- Ending date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.) If this is specified, started_at also must be specified; otherwise, the time period is ignored.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendChatAnnouncement
public JSONObject sendChatAnnouncement(String broadcaster_id, String message, String color) throws JSONException, IllegalArgumentException Sends an announcement to the broadcaster's chat room.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to send the announcement to.message
- The announcement to make in the broadcaster's chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.color
- The color used to highlight the announcement. If color is set to primary, the channel's accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendChatAnnouncementAsync
public Mono<JSONObject> sendChatAnnouncementAsync(String broadcaster_id, String message, String color) throws JSONException, IllegalArgumentException Sends an announcement to the broadcaster's chat room.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to send the announcement to.message
- The announcement to make in the broadcaster's chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.color
- The color used to highlight the announcement. If color is set to primary, the channel's accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendChatAnnouncement
public JSONObject sendChatAnnouncement(String broadcaster_id, String message, Helix.AnnouncementColors color) throws JSONException, IllegalArgumentException Sends an announcement to the broadcaster's chat room.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to send the announcement to.message
- The announcement to make in the broadcaster's chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.color
- The color used to highlight the announcement. If color is set to primary, the channel's accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendChatAnnouncementAsync
public Mono<JSONObject> sendChatAnnouncementAsync(String broadcaster_id, String message, Helix.AnnouncementColors color) throws JSONException, IllegalArgumentException Sends an announcement to the broadcaster's chat room.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to send the announcement to.message
- The announcement to make in the broadcaster's chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.color
- The color used to highlight the announcement. If color is set to primary, the channel's accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
banUser
public JSONObject banUser(String broadcaster_id, String user_id, @Nullable String reason, int duration) throws JSONException, IllegalArgumentException Bans a user from participating in a broadcaster's chat room, or puts them in a timeout. If the user is currently in a timeout, you can call this endpoint to change the duration of the timeout or ban them altogether. If the user is currently banned, you cannot call this method to put them in a timeout instead.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat room the user is being banned from.user_id
- The ID of the user to ban or put in a timeout.reason
- The reason the user is being banned or put in a timeout. The text is user defined and limited to a maximum of 500 characters.duration
- To ban a user indefinitely, specify this value as0
. To put a user in a timeout, specify the timeout period, in seconds. The minimum timeout is 1 second and the maximum is 1,209,600 seconds (2 weeks).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
banUserAsync
public Mono<JSONObject> banUserAsync(String broadcaster_id, String user_id, @Nullable String reason, int duration) throws JSONException, IllegalArgumentException Bans a user from participating in a broadcaster's chat room, or puts them in a timeout. If the user is currently in a timeout, you can call this endpoint to change the duration of the timeout or ban them altogether. If the user is currently banned, you cannot call this method to put them in a timeout instead.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat room the user is being banned from.user_id
- The ID of the user to ban or put in a timeout.reason
- The reason the user is being banned or put in a timeout. The text is user defined and limited to a maximum of 500 characters.duration
- To ban a user indefinitely, specify this value as0
. To put a user in a timeout, specify the timeout period, in seconds. The minimum timeout is 1 second and the maximum is 1,209,600 seconds (2 weeks).- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
unbanUser
public JSONObject unbanUser(String broadcaster_id, String user_id) throws JSONException, IllegalArgumentException Removes the ban or timeout that was placed on the specified user.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat room the user is banned from chatting in.user_id
- The ID of the user to remove the ban or timeout from.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
unbanUserAsync
public Mono<JSONObject> unbanUserAsync(String broadcaster_id, String user_id) throws JSONException, IllegalArgumentException Removes the ban or timeout that was placed on the specified user.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat room the user is banned from chatting in.user_id
- The ID of the user to remove the ban or timeout from.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
deleteChatMessages
public JSONObject deleteChatMessages(String broadcaster_id, @Nullable String message_id) throws JSONException, IllegalArgumentException Removes a single chat message or all chat messages from the broadcaster's chat room. Restrictions when specifying amessage_id
: The message must have been created within the last 6 hours. The message must not belong to the broadcaster.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to remove messages from.message_id
- The ID of the message to remove. The id tag in the PRIVMSG contains the message's ID. Ifnull
, the request removes all messages in the broadcaster's chat room.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
deleteChatMessagesAsync
public Mono<JSONObject> deleteChatMessagesAsync(String broadcaster_id, @Nullable String message_id) throws JSONException, IllegalArgumentException Removes a single chat message or all chat messages from the broadcaster's chat room. Restrictions when specifying amessage_id
: The message must have been created within the last 6 hours. The message must not belong to the broadcaster.- Parameters:
broadcaster_id
- The ID of the broadcaster that owns the chat room to remove messages from.message_id
- The ID of the message to remove. The id tag in the PRIVMSG contains the message's ID. Ifnull
, the request removes all messages in the broadcaster's chat room.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
startRaid
public JSONObject startRaid(String from_broadcaster_id, String to_broadcaster_id) throws JSONException, IllegalArgumentException Raid another channel by sending the broadcaster's viewers to the targeted channel. Requires the API OAuth to belong tofrom_broadcaster_id
. Rate Limit: The limit is 10 requests within a 10-minute window.- Parameters:
from_broadcaster_id
- The ID of the broadcaster that's sending the raiding party.to_broadcaster_id
- The ID of the broadcaster to raid.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
startRaidAsync
public Mono<JSONObject> startRaidAsync(String from_broadcaster_id, String to_broadcaster_id) throws JSONException, IllegalArgumentException Raid another channel by sending the broadcaster's viewers to the targeted channel. Requires the API OAuth to belong tofrom_broadcaster_id
. Rate Limit: The limit is 10 requests within a 10-minute window.- Parameters:
from_broadcaster_id
- The ID of the broadcaster that's sending the raiding party.to_broadcaster_id
- The ID of the broadcaster to raid.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
cancelRaid
Cancel a pending raid. Requires the API OAuth to belong tobroadcaster_id
. Rate Limit: The limit is 10 requests within a 10-minute window.- Parameters:
broadcaster_id
- The ID of the broadcaster that sent the raiding party.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
cancelRaidAsync
public Mono<JSONObject> cancelRaidAsync(String broadcaster_id) throws JSONException, IllegalArgumentException Cancel a pending raid. Requires the API OAuth to belong tobroadcaster_id
. Rate Limit: The limit is 10 requests within a 10-minute window.- Parameters:
broadcaster_id
- The ID of the broadcaster that sent the raiding party.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateChatSettings
public JSONObject updateChatSettings(String broadcaster_id, @Nullable Boolean emote_mode, @Nullable Boolean follower_mode, @Nullable Integer follower_mode_duration, @Nullable Boolean non_moderator_chat_delay, @Nullable Integer non_moderator_chat_delay_duration, @Nullable Boolean slow_mode, @Nullable Integer slow_mode_wait_time, @Nullable Boolean subscriber_mode, @Nullable Boolean unique_chat_mode) throws JSONException, IllegalArgumentException Updates the broadcaster's chat settings. Only supply a value for settings that are to be updated. All values that are to be unchanged must be set tonull
. Requires the API OAuth to belong tobroadcaster_id
.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat settings you want to update.emote_mode
- A Boolean value that determines whether chat messages must contain only emotes.follower_mode
- A Boolean value that determines whether the broadcaster restricts the chat room to followers only, based on how long they've followed.follower_mode_duration
- The length of time, in minutes, that the followers must have followed the broadcaster to participate in the chat room. You may specify a value in the range: 0 (no restriction) through 129600 (3 months).non_moderator_chat_delay
- A Boolean value that determines whether the broadcaster adds a short delay before chat messages appear in the chat room. This gives chat moderators and bots a chance to remove them before viewers can see the message.non_moderator_chat_delay_duration
- The amount of time, in seconds, that messages are delayed from appearing in chat. Must be one of: 2, 4, 6.slow_mode
- A Boolean value that determines whether the broadcaster limits how often users in the chat room are allowed to send messages.slow_mode_wait_time
- The amount of time, in seconds, that users need to wait between sending messages. You may specify a value in the range: 3 (3 second delay) through 120 (2 minute delay).subscriber_mode
- A Boolean value that determines whether only users that subscribe to the broadcaster's channel can talk in the chat room.unique_chat_mode
- A Boolean value that determines whether the broadcaster requires users to post only unique messages in the chat room. Formerly known as r9k beta.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateChatSettingsAsync
public Mono<JSONObject> updateChatSettingsAsync(String broadcaster_id, @Nullable Boolean emote_mode, @Nullable Boolean follower_mode, @Nullable Integer follower_mode_duration, @Nullable Boolean non_moderator_chat_delay, @Nullable Integer non_moderator_chat_delay_duration, @Nullable Boolean slow_mode, @Nullable Integer slow_mode_wait_time, @Nullable Boolean subscriber_mode, @Nullable Boolean unique_chat_mode) throws JSONException, IllegalArgumentException Updates the broadcaster's chat settings. Only supply a value for settings that are to be updated. All values that are to be unchanged must be set tonull
. Requires the API OAuth to belong tobroadcaster_id
.- Parameters:
broadcaster_id
- The ID of the broadcaster whose chat settings you want to update.emote_mode
- A Boolean value that determines whether chat messages must contain only emotes.follower_mode
- A Boolean value that determines whether the broadcaster restricts the chat room to followers only, based on how long they've followed.follower_mode_duration
- The length of time, in minutes, that the followers must have followed the broadcaster to participate in the chat room. You may specify a value in the range: 0 (no restriction) through 129600 (3 months).non_moderator_chat_delay
- A Boolean value that determines whether the broadcaster adds a short delay before chat messages appear in the chat room. This gives chat moderators and bots a chance to remove them before viewers can see the message.non_moderator_chat_delay_duration
- The amount of time, in seconds, that messages are delayed from appearing in chat. Must be one of: 2, 4, 6.slow_mode
- A Boolean value that determines whether the broadcaster limits how often users in the chat room are allowed to send messages.slow_mode_wait_time
- The amount of time, in seconds, that users need to wait between sending messages. You may specify a value in the range: 3 (3 second delay) through 120 (2 minute delay).subscriber_mode
- A Boolean value that determines whether only users that subscribe to the broadcaster's channel can talk in the chat room.unique_chat_mode
- A Boolean value that determines whether the broadcaster requires users to post only unique messages in the chat room. Formerly known as r9k beta.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendWhisper
public JSONObject sendWhisper(String to_user_id, String message) throws JSONException, IllegalArgumentException Sends a whisper message to the specified user. NOTE: uses the Bot (Chat) username and OAuth to send the whisper. NOTE: The user sending the whisper must have a verified phone number. NOTE: The API may silently drop whispers that it suspects of violating Twitch policies. (The API does not indicate that it dropped the whisper; it returns a 204 status code as if it succeeded). Rate Limits: You may whisper to a maximum of 40 unique recipients per day. Within the per day limit, you may whisper a maximum of 3 whispers per second and a maximum of 100 whispers per minute. The maximum message lengths are: 500 characters if the user you're sending the message to hasn't whispered you before. 10,000 characters if the user you're sending the message to has whispered you before. Messages that exceed the maximum length are truncated.- Parameters:
to_user_id
- The ID of the user to receive the whisper.message
- The whisper message to send. The message must not be empty.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendWhisperAsync
public Mono<JSONObject> sendWhisperAsync(String to_user_id, String message) throws JSONException, IllegalArgumentException Sends a whisper message to the specified user. NOTE: Uses the Bot (Chat) username and OAuth to send the whisper. NOTE: The user sending the whisper must have a verified phone number. NOTE: The API may silently drop whispers that it suspects of violating Twitch policies. (The API does not indicate that it dropped the whisper; it returns a 204 status code as if it succeeded). Rate Limits: You may whisper to a maximum of 40 unique recipients per day. Within the per day limit, you may whisper a maximum of 3 whispers per second and a maximum of 100 whispers per minute. The maximum message lengths are: 500 characters if the user you're sending the message to hasn't whispered you before. 10,000 characters if the user you're sending the message to has whispered you before. Messages that exceed the maximum length are truncated.- Parameters:
to_user_id
- The ID of the user to receive the whisper.message
- The whisper message to send. The message must not be empty.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getCustomReward
public JSONObject getCustomReward(@Nullable List<String> id, @Nullable Boolean only_manageable_rewards) throws JSONException, IllegalArgumentException Returns a list of Custom Reward objects for the Custom Rewards on a channel.- Parameters:
id
- When used, this parameter filters the results and only returns reward objects for the Custom Rewards with matching ID. Maximum: 50only_manageable_rewards
- When set totrue
, only returns custom rewards that the calling Client ID can manage. Default:false
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getCustomRewardAsync
public Mono<JSONObject> getCustomRewardAsync(@Nullable List<String> id, @Nullable Boolean only_manageable_rewards) throws JSONException, IllegalArgumentException Returns a list of Custom Reward objects for the Custom Rewards on a channel.- Parameters:
id
- When used, this parameter filters the results and only returns reward objects for the Custom Rewards with matching ID. Maximum: 50only_manageable_rewards
- When set totrue
, only returns custom rewards that the calling Client ID can manage. Default:false
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createCustomReward
public JSONObject createCustomReward(String title, int cost, @Nullable Boolean is_enabled, @Nullable String background_color, @Nullable Boolean is_user_input_required, @Nullable String prompt, @Nullable Boolean is_max_per_stream_enabled, @Nullable Integer max_per_stream, @Nullable Boolean is_max_per_user_per_stream_enabled, @Nullable Integer max_per_user_per_stream, @Nullable Boolean is_global_cooldown_enabled, @Nullable Integer global_cooldown_seconds, @Nullable Boolean should_redemptions_skip_request_queue) throws JSONException, IllegalArgumentException Creates a Custom Reward in the broadcaster\'s channel. The maximum number of custom rewards per channel is 50, which includes both enabled and disabled rewards.- Parameters:
title
- The custom reward\'s title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster\'s custom rewards.cost
- The cost of the reward, in Channel Points. The minimum is 1 point.is_enabled
- A Boolean value that determines whether the reward is enabled. Viewers see only enabled rewards. The default istrue
.background_color
- The background color to use for the reward. Specify the color using Hex format (for example,#9147FF
).is_user_input_required
- A Boolean value that determines whether the user needs to enter information when redeeming the reward. See theprompt
field. The default isfalse
.prompt
- The prompt shown to the viewer when they redeem the reward. Specify a prompt ifis_user_input_required
istrue
. The prompt is limited to a maximum of 200 characters.is_max_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see themax_per_stream
field). The default isfalse
.max_per_stream
- The maximum number of redemptions allowed per live stream. Applied only ifis_max_per_stream_enabled
istrue
. The minimum value is1
.is_max_per_user_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see themax_per_user_per_stream
field). The default isfalse
.max_per_user_per_stream
- The maximum number of redemptions allowed per user per stream. Applied only ifis_max_per_user_per_stream_enabled
istrue
. The minimum value is1
.is_global_cooldown_enabled
- A Boolean value that determines whether to apply a cooldown period between redemptions (see theglobal_cooldown_seconds
field for the duration of the cooldown period). The default isfalse
.global_cooldown_seconds
- The cooldown period, in seconds. Applied only if theis_global_cooldown_enabled
field istrue
. The minimum value is1
; however, the minimum value is60
for it to be shown in the Twitch UX.should_redemptions_skip_request_queue
- A Boolean value that determines whether redemptions should be set toFULFILLED
status immediately when a reward is redeemed. Iffalse
, status is set toUNFULFILLED
and follows the normal request queue process. The default isfalse
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createCustomRewardAsync
public Mono<JSONObject> createCustomRewardAsync(String title, int cost, @Nullable Boolean is_enabled, @Nullable String background_color, @Nullable Boolean is_user_input_required, @Nullable String prompt, @Nullable Boolean is_max_per_stream_enabled, @Nullable Integer max_per_stream, @Nullable Boolean is_max_per_user_per_stream_enabled, @Nullable Integer max_per_user_per_stream, @Nullable Boolean is_global_cooldown_enabled, @Nullable Integer global_cooldown_seconds, @Nullable Boolean should_redemptions_skip_request_queue) throws JSONException, IllegalArgumentException Creates a Custom Reward in the broadcaster\'s channel. The maximum number of custom rewards per channel is 50, which includes both enabled and disabled rewards.- Parameters:
title
- The custom reward\'s title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster\'s custom rewards.cost
- The cost of the reward, in Channel Points. The minimum is 1 point.is_enabled
- A Boolean value that determines whether the reward is enabled. Viewers see only enabled rewards. The default istrue
.background_color
- The background color to use for the reward. Specify the color using Hex format (for example,#9147FF
).is_user_input_required
- A Boolean value that determines whether the user needs to enter information when redeeming the reward. See theprompt
field. The default isfalse
.prompt
- The prompt shown to the viewer when they redeem the reward. Specify a prompt ifis_user_input_required
istrue
. The prompt is limited to a maximum of 200 characters.is_max_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see themax_per_stream
field). The default isfalse
.max_per_stream
- The maximum number of redemptions allowed per live stream. Applied only ifis_max_per_stream_enabled
istrue
. The minimum value is1
.is_max_per_user_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see themax_per_user_per_stream
field). The default isfalse
.max_per_user_per_stream
- The maximum number of redemptions allowed per user per stream. Applied only ifis_max_per_user_per_stream_enabled
istrue
. The minimum value is1
.is_global_cooldown_enabled
- A Boolean value that determines whether to apply a cooldown period between redemptions (see theglobal_cooldown_seconds
field for the duration of the cooldown period). The default isfalse
.global_cooldown_seconds
- The cooldown period, in seconds. Applied only if theis_global_cooldown_enabled
field istrue
. The minimum value is1
; however, the minimum value is60
for it to be shown in the Twitch UX.should_redemptions_skip_request_queue
- A Boolean value that determines whether redemptions should be set toFULFILLED
status immediately when a reward is redeemed. Iffalse
, status is set toUNFULFILLED
and follows the normal request queue process. The default isfalse
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateCustomReward
public JSONObject updateCustomReward(String id, @Nullable String title, @Nullable Integer cost, @Nullable Boolean is_enabled, @Nullable Boolean is_paused, @Nullable String background_color, @Nullable Boolean is_user_input_required, @Nullable String prompt, @Nullable Boolean is_max_per_stream_enabled, @Nullable Integer max_per_stream, @Nullable Boolean is_max_per_user_per_stream_enabled, @Nullable Integer max_per_user_per_stream, @Nullable Boolean is_global_cooldown_enabled, @Nullable Integer global_cooldown_seconds, @Nullable Boolean should_redemptions_skip_request_queue) throws JSONException, IllegalArgumentException Updates a custom reward. The app used to create the reward is the only app that may update the reward.- Parameters:
id
- The ID of the reward to update.title
- The custom reward\'s title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster\'s custom rewards.cost
- The cost of the reward, in Channel Points. The minimum is 1 point.is_enabled
- A Boolean value that determines whether the reward is enabled. Viewers see only enabled rewards. The default istrue
.is_paused
- A Boolean value that determines whether the reward is currently paused. Istrue
if the reward is paused. Viewers can\'t redeem paused rewards.background_color
- The background color to use for the reward. Specify the color using Hex format (for example,#9147FF
).is_user_input_required
- A Boolean value that determines whether the user needs to enter information when redeeming the reward. See theprompt
field. The default isfalse
.prompt
- The prompt shown to the viewer when they redeem the reward. Specify a prompt ifis_user_input_required
istrue
. The prompt is limited to a maximum of 200 characters.is_max_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see themax_per_stream
field). The default isfalse
.max_per_stream
- The maximum number of redemptions allowed per live stream. Applied only ifis_max_per_stream_enabled
istrue
. The minimum value is1
.is_max_per_user_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see themax_per_user_per_stream
field). The default isfalse
.max_per_user_per_stream
- The maximum number of redemptions allowed per user per stream. Applied only ifis_max_per_user_per_stream_enabled
istrue
. The minimum value is1
.is_global_cooldown_enabled
- A Boolean value that determines whether to apply a cooldown period between redemptions (see theglobal_cooldown_seconds
field for the duration of the cooldown period). The default isfalse
.global_cooldown_seconds
- The cooldown period, in seconds. Applied only if theis_global_cooldown_enabled
field istrue
. The minimum value is1
; however, the minimum value is60
for it to be shown in the Twitch UX.should_redemptions_skip_request_queue
- A Boolean value that determines whether redemptions should be set toFULFILLED
status immediately when a reward is redeemed. Iffalse
, status is set toUNFULFILLED
and follows the normal request queue process. The default isfalse
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateCustomRewardAsync
public Mono<JSONObject> updateCustomRewardAsync(String id, @Nullable String title, @Nullable Integer cost, @Nullable Boolean is_enabled, @Nullable Boolean is_paused, @Nullable String background_color, @Nullable Boolean is_user_input_required, @Nullable String prompt, @Nullable Boolean is_max_per_stream_enabled, @Nullable Integer max_per_stream, @Nullable Boolean is_max_per_user_per_stream_enabled, @Nullable Integer max_per_user_per_stream, @Nullable Boolean is_global_cooldown_enabled, @Nullable Integer global_cooldown_seconds, @Nullable Boolean should_redemptions_skip_request_queue) throws JSONException, IllegalArgumentException Updates a custom reward. The app used to create the reward is the only app that may update the reward.- Parameters:
id
- The ID of the reward to update.title
- The custom reward\'s title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster\'s custom rewards.cost
- The cost of the reward, in Channel Points. The minimum is 1 point.is_enabled
- A Boolean value that determines whether the reward is enabled. Viewers see only enabled rewards. The default istrue
.is_paused
- A Boolean value that determines whether the reward is currently paused. Istrue
if the reward is paused. Viewers can\'t redeem paused rewards.background_color
- The background color to use for the reward. Specify the color using Hex format (for example,#9147FF
).is_user_input_required
- A Boolean value that determines whether the user needs to enter information when redeeming the reward. See theprompt
field. The default isfalse
.prompt
- The prompt shown to the viewer when they redeem the reward. Specify a prompt ifis_user_input_required
istrue
. The prompt is limited to a maximum of 200 characters.is_max_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see themax_per_stream
field). The default isfalse
.max_per_stream
- The maximum number of redemptions allowed per live stream. Applied only ifis_max_per_stream_enabled
istrue
. The minimum value is1
.is_max_per_user_per_stream_enabled
- A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see themax_per_user_per_stream
field). The default isfalse
.max_per_user_per_stream
- The maximum number of redemptions allowed per user per stream. Applied only ifis_max_per_user_per_stream_enabled
istrue
. The minimum value is1
.is_global_cooldown_enabled
- A Boolean value that determines whether to apply a cooldown period between redemptions (see theglobal_cooldown_seconds
field for the duration of the cooldown period). The default isfalse
.global_cooldown_seconds
- The cooldown period, in seconds. Applied only if theis_global_cooldown_enabled
field istrue
. The minimum value is1
; however, the minimum value is60
for it to be shown in the Twitch UX.should_redemptions_skip_request_queue
- A Boolean value that determines whether redemptions should be set toFULFILLED
status immediately when a reward is redeemed. Iffalse
, status is set toUNFULFILLED
and follows the normal request queue process. The default isfalse
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
deleteCustomReward
Deletes a custom reward that the broadcaster created. The app used to create the reward is the only app that may delete it. If the reward\'s redemption status isUNFULFILLED
at the time the reward is deleted, its redemption status is marked asFULFILLED
.- Parameters:
id
- The ID of the custom reward to delete.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
deleteCustomRewardAsync
public Mono<JSONObject> deleteCustomRewardAsync(String id) throws JSONException, IllegalArgumentException Deletes a custom reward that the broadcaster created. The app used to create the reward is the only app that may delete it. If the reward\'s redemption status isUNFULFILLED
at the time the reward is deleted, its redemption status is marked asFULFILLED
.- Parameters:
id
- The ID of the custom reward to delete.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateRedemptionStatus
public JSONObject updateRedemptionStatus(List<String> id, String reward_id, Helix.CustomRewardRedemptionStatus newStatus) throws JSONException, IllegalArgumentException Updates a redemption\'s status. You may update a redemption only if its status is UNFULFILLED. The app used to create the reward is the only app that may update the redemption.- Parameters:
id
- A list of IDs that identify the redemptions to update. You may specify a maximum of 50 IDs.reward_id
- The ID that identifies the reward that\'s been redeemed.newStatus
- The status to set the redemption to. Setting the status toCustomRewardRedemptionStatus.CANCELLED
refunds the user\'s channel points.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateRedemptionStatusAsync
public Mono<JSONObject> updateRedemptionStatusAsync(List<String> id, String reward_id, Helix.CustomRewardRedemptionStatus newStatus) throws JSONException, IllegalArgumentException Updates a redemption\'s status. You may update a redemption only if its status is UNFULFILLED. The app used to create the reward is the only app that may update the redemption.- Parameters:
id
- A list of IDs that identify the redemptions to update. You may specify a maximum of 50 IDs.reward_id
- The ID that identifies the reward that\'s been redeemed.newStatus
- The status to set the redemption to. Setting the status toCustomRewardRedemptionStatus.CANCELLED
refunds the user\'s channel points.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateShieldModeStatus
public JSONObject updateShieldModeStatus(String broadcaster_id, boolean isActive) throws JSONException, IllegalArgumentException Activates or deactivates the broadcaster’s Shield Mode. Twitch's Shield Mode feature is like a panic button that broadcasters can push to protect themselves from chat abuse coming from one or more accounts. When activated, Shield Mode applies the overrides that the broadcaster configured in the Twitch UX. If the broadcaster hasn't configured Shield Mode, it applies default overrides.- Parameters:
broadcaster_id
- The ID of the broadcaster whose Shield Mode you want to activate or deactivate.isActive
- A Boolean value that determines whether to activate Shield Mode. Set totrue
to activate Shield Mode; otherwise,false
to deactivate Shield Mode.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
updateShieldModeStatusAsync
public Mono<JSONObject> updateShieldModeStatusAsync(String broadcaster_id, boolean isActive) throws JSONException, IllegalArgumentException Activates or deactivates the broadcaster’s Shield Mode. Twitch's Shield Mode feature is like a panic button that broadcasters can push to protect themselves from chat abuse coming from one or more accounts. When activated, Shield Mode applies the overrides that the broadcaster configured in the Twitch UX. If the broadcaster hasn't configured Shield Mode, it applies default overrides.- Parameters:
broadcaster_id
- The ID of the broadcaster whose Shield Mode you want to activate or deactivate.isActive
- A Boolean value that determines whether to activate Shield Mode. Set totrue
to activate Shield Mode; otherwise,false
to deactivate Shield Mode.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendShoutout
public JSONObject sendShoutout(String from_broadcaster_id, String to_broadcaster_id) throws JSONException, IllegalArgumentException Sends a Shoutout to the specified broadcaster. Rate Limits: The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.- Parameters:
from_broadcaster_id
- The ID of the broadcaster that's sending the Shoutout.to_broadcaster_id
- The ID of the broadcaster that's receiving the Shoutout.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
sendShoutoutAsync
public Mono<JSONObject> sendShoutoutAsync(String from_broadcaster_id, String to_broadcaster_id) throws JSONException, IllegalArgumentException Sends a Shoutout to the specified broadcaster. Rate Limits: The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.- Parameters:
from_broadcaster_id
- The ID of the broadcaster that's sending the Shoutout.to_broadcaster_id
- The ID of the broadcaster that's receiving the Shoutout.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getEventSubSubscriptionsAsync
public Mono<JSONObject> getEventSubSubscriptionsAsync(@Nullable EventSubSubscription.SubscriptionStatus status, @Nullable String type, @Nullable String user_id, @Nullable String after) throws JSONException, IllegalArgumentException Gets a list of EventSub subscriptions that the client in the access token created.Use the status, type, and user_id query parameters to filter the list of subscriptions that are returned. The filters are mutually exclusive; the request fails if you specify more than one filter.
- Parameters:
status
- Filter subscriptions by its status.type
- Filter subscriptions by subscription type.user_id
- Filter subscriptions by user ID. The response contains subscriptions where this ID matches a user ID that you specified in the Condition when you created the subscription.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createEventSubSubscriptionAsync
public Mono<JSONObject> createEventSubSubscriptionAsync(String jsonString) throws JSONException, IllegalArgumentException Creates an EventSub subscription.- Parameters:
jsonString
- A JSON string describing the parameters of the new subscription- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
deleteEventSubSubscriptionAsync
public Mono<JSONObject> deleteEventSubSubscriptionAsync(String id) throws JSONException, IllegalArgumentException Deletes an EventSub subscription.- Parameters:
id
- The ID of the subscription to delete.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getPolls
Gets a list of polls that the broadcaster created. Polls are available for 90 days after they’re created.- Parameters:
pollIds
- A list of IDs that identify the polls to return. You may specify a maximum of 20 IDs. Specify this parameter only if you want to filter the list that the request returns. The endpoint ignores duplicate IDs and those not owned by this broadcaster.first
- 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 20 items per page. The default is 20.after
- The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value.- Returns:
- A list of polls. The list is empty if the broadcaster hasn’t created polls.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
getPollsAsync
public Mono<JSONObject> getPollsAsync(List<String> pollIds, int first, String after) throws JSONException, IllegalArgumentException Gets a list of polls that the broadcaster created. Polls are available for 90 days after they’re created.- Parameters:
pollIds
- A list of IDs that identify the polls to return. You may specify a maximum of 20 IDs. Specify this parameter only if you want to filter the list that the request returns. The endpoint ignores duplicate IDs and those not owned by this broadcaster.first
- 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 20 items per page. The default is 20.after
- The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value.- Returns:
- A list of polls. The list is empty if the broadcaster hasn’t created polls.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
createPoll
public JSONObject createPoll(String title, List<String> choices, int durationSec, int channelPointsPerVote) throws JSONException, IllegalArgumentException Creates a poll that viewers in the broadcaster’s channel can vote on. The poll begins as soon as it’s created. You may run only one poll at a time.- Parameters:
title
- The question that viewers will vote on. For example, What game should I play next? The question may contain a maximum of 60 characters.choices
- A list of choices each with a maximum of 25 characters, that viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 5 choices.durationSec
- The length of time (in seconds) that the poll will run for. The minimum is 15 seconds and the maximum is 1800 seconds (30 minutes).channelPointsPerVote
- The number of points that the viewer must spend to cast one additional vote. The minimum is 1 and the maximum is 1000000. 0 and smaller disables this option.- Returns:
- A list that contains the single poll that you created.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
createPollAsync
public Mono<JSONObject> createPollAsync(String title, List<String> choices, int durationSec, int channelPointsPerVote) throws JSONException, IllegalArgumentException Creates a poll that viewers in the broadcaster’s channel can vote on. The poll begins as soon as it’s created. You may run only one poll at a time.- Parameters:
title
- The question that viewers will vote on. For example, What game should I play next? The question may contain a maximum of 60 characters.choices
- A list of choices each with a maximum of 25 characters, that viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 5 choices.durationSec
- The length of time (in seconds) that the poll will run for. The minimum is 15 seconds and the maximum is 1800 seconds (30 minutes).channelPointsPerVote
- The number of points that the viewer must spend to cast one additional vote. The minimum is 1 and the maximum is 1000000. 0 and smaller disables this option.- Returns:
- A list that contains the single poll that you created.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
endPoll
Ends an active poll. You have the option to end it or end it and archive it.- Parameters:
id
- The ID of the poll to update.status
- The status to set the poll to. Possible case-sensitive values are: TERMINATED — Ends the poll before the poll is scheduled to end. The poll remains publicly visible. ARCHIVED — Ends the poll before the poll is scheduled to end, and then archives it, so it's no longer publicly visible.- Returns:
- A list that contains the poll that you ended.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
endPollAsync
public Mono<JSONObject> endPollAsync(String id, String status) throws JSONException, IllegalArgumentException Ends an active poll. You have the option to end it or end it and archive it.- Parameters:
id
- The ID of the poll to update.status
- The status to set the poll to. Possible case-sensitive values are: TERMINATED — Ends the poll before the poll is scheduled to end. The poll remains publicly visible. ARCHIVED — Ends the poll before the poll is scheduled to end, and then archives it, so it's no longer publicly visible.- Returns:
- A list that contains the poll that you ended.
- Throws:
JSONException
- when the result object could not be parsedIllegalArgumentException
- when more ids are passed than the API allows
-
getPredictions
public JSONObject getPredictions(List<String> id, int first, String after) throws JSONException, IllegalArgumentException Gets a list of Channel Points Predictions that the broadcaster created.- Parameters:
id
- The ID of the prediction to get;null
to get the most recent predictions. You may specify a maximum of 25 IDs.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 25.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getPredictionsAsync
public Mono<JSONObject> getPredictionsAsync(List<String> id, int first, String after) throws JSONException, IllegalArgumentException Gets a list of Channel Points Predictions that the broadcaster created.- Parameters:
id
- The ID of the prediction to get;null
to get the most recent predictions. You may specify a maximum of 25 IDs.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 25.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createPrediction
public JSONObject createPrediction(String title, long seconds, List<String> choices) throws JSONException, IllegalArgumentException Creates a Channel Points Prediction.- Parameters:
title
- The question that the broadcaster is asking. The title is limited to a maximum of 45 characters.seconds
- The length of time (in seconds) that the prediction will run for. The minimum is 30 seconds and the maximum is 1800 seconds (30 minutes).choices
- The list of possible outcomes that the viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 10 choices. Echo choice is limited to a maximum of 25 characters.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createPrediction
public JSONObject createPrediction(String title, Duration duration, List<String> choices) throws JSONException, IllegalArgumentException Creates a Channel Points Prediction.- Parameters:
title
- The question that the broadcaster is asking. The title is limited to a maximum of 45 characters.duration
- The length of time that the prediction will run for. The minimum is 30 seconds and the maximum is 30 minutes.choices
- The list of possible outcomes that the viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 10 choices. Echo choice is limited to a maximum of 25 characters.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
createPredictionAsync
public Mono<JSONObject> createPredictionAsync(String title, Duration duration, List<String> choices) throws JSONException, IllegalArgumentException Creates a Channel Points Prediction.- Parameters:
title
- The question that the broadcaster is asking. The title is limited to a maximum of 45 characters.duration
- The length of time that the prediction will run for. The minimum is 30 seconds and the maximum is 30 minutes.choices
- The list of possible outcomes that the viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 10 choices. Each choice is limited to a maximum of 25 characters.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
endPrediction
public JSONObject endPrediction(String id, Helix.PredictionStatus status, String winningOutcomeId) throws JSONException, IllegalArgumentException Locks, resolves, or cancels a Channel Points Prediction. The broadcaster can update an active prediction toPredictionStatus.LOCKED
,PredictionStatus.RESOLVED
, orPredictionStatus.CANCELED
; and update a locked prediction toPredictionStatus.RESOLVED
orPredictionStatus.CANCELED
. The broadcaster has up to 24 hours after the prediction window closes to resolve the prediction. If not, Twitch sets the status toPredictionStatus.CANCELED
and returns the points.- Parameters:
id
- The ID of the prediction to update.status
- The status to set the prediction to.winningOutcomeId
- The ID of the winning outcome. You must set this parameter if you set status toPredictionStatus.RESOLVED
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
endPredictionAsync
public Mono<JSONObject> endPredictionAsync(String id, Helix.PredictionStatus status, String winningOutcomeId) throws JSONException, IllegalArgumentException Locks, resolves, or cancels a Channel Points Prediction. The broadcaster can update an active prediction toPredictionStatus.LOCKED
,PredictionStatus.RESOLVED
, orPredictionStatus.CANCELED
; and update a locked prediction toPredictionStatus.RESOLVED
orPredictionStatus.CANCELED
. The broadcaster has up to 24 hours after the prediction window closes to resolve the prediction. If not, Twitch sets the status toPredictionStatus.CANCELED
and returns the points.- Parameters:
id
- The ID of the prediction to update.status
- The status to set the prediction to.winningOutcomeId
- The ID of the winning outcome. You must set this parameter if you set status toPredictionStatus.RESOLVED
.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelFollowers
public JSONObject getChannelFollowers(@Nullable String user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Gets a list of users that follow the broadcaster.You can also use this endpoint to see whether a specific user follows the broadcaster.
- Parameters:
user_id
- A user's ID. Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this user if they follow the broadcaster. If not specified, the response contains all users that follow the broadcaster.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 100.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelFollowersAsync
public Mono<JSONObject> getChannelFollowersAsync(@Nullable String user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Gets a list of users that follow the broadcaster.You can also use this endpoint to see whether a specific user follows the broadcaster.
- Parameters:
user_id
- A user's ID. Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this user if they follow the broadcaster. If not specified, the response contains all users that follow the broadcaster.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 100.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelFollowers
public JSONObject getChannelFollowers(String broadcaster_id, @Nullable String user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Gets a list of users that follow the specified broadcaster.You can also use this endpoint to see whether a specific user follows the broadcaster.
- Parameters:
broadcaster_id
- The broadcaster's IDuser_id
- A user's ID. Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this user if they follow the broadcaster. If not specified, the response contains all users that follow the broadcaster.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 100.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelFollowersAsync
public Mono<JSONObject> getChannelFollowersAsync(String broadcaster_id, @Nullable String user_id, int first, @Nullable String after) throws JSONException, IllegalArgumentException Gets a list of users that follow the specified broadcaster.You can also use this endpoint to see whether a specific user follows the broadcaster.
- Parameters:
broadcaster_id
- The broadcaster's IDuser_id
- A user's ID. Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this user if they follow the broadcaster. If not specified, the response contains all users that follow the broadcaster.first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 100.after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChattersAsync
public Mono<JSONObject> getChattersAsync(int first, @Nullable String after) throws JSONException, IllegalArgumentException Gets the list of users that are connected to the broadcaster’s chat session.NOTE: There is a delay between when users join and leave a chat and when the list is updated accordingly.
- Parameters:
first
- The maximum number of items to return per page in the response. Minimum: 1. Maximum: 1,000after
- The cursor used to get the next page of results.- Returns:
- A JSONObject with the response
- Throws:
JSONException
IllegalArgumentException
-
getChannelFollowers(String, int, String)
, which requires an OAuth scope