public class ChannelsResource extends AbstractResource
ChannelsResource provides the functionality
to access the /channels endpoints of the Twitch API.AbstractResource.TwitchHttpResponseHandlerhttp, objectMapper| Constructor and Description |
|---|
ChannelsResource(java.lang.String baseUrl,
int apiVersion)
Construct the resource using the Twitch API base URL and specified API version.
|
| Modifier and Type | Method and Description |
|---|---|
void |
get(ChannelResponseHandler handler)
Returns a channel object of authenticated user.
|
void |
get(java.lang.String channelName,
ChannelResponseHandler handler)
Returns a
Channel object. |
void |
getEditors(java.lang.String channelName,
UsersResponseHandler handler)
Returns a list of user objects who are editors of
channelName. |
void |
getFollows(java.lang.String channelName,
ChannelFollowsResponseHandler handler)
Returns a list of follow objects representing the followers of a channel.
|
void |
getFollows(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelFollowsResponseHandler handler)
Returns a list of follow objects representing the followers of a channel.
|
void |
getSubscription(java.lang.String channelName,
java.lang.String user,
ChannelSubscriptionResponseHandler handler)
Returns a subscription object which includes the user if that user is subscribed.
|
void |
getSubscriptions(java.lang.String channelName,
ChannelSubscriptionsResponseHandler handler)
Returns a list of subscription objects sorted by subscription relationship creation date
which contain users subscribed to the specified channel.
|
void |
getSubscriptions(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelSubscriptionsResponseHandler handler)
Returns a list of subscription objects sorted by subscription relationship creation date
which contain users subscribed to the specified channel.
|
void |
getTeams(java.lang.String channelName,
TeamsResponseHandler handler)
Returns a list of team objects the channel belongs to.
|
void |
getVideos(java.lang.String channelName,
com.mb3364.http.RequestParams params,
VideosResponseHandler handler)
Returns a list of videos ordered by time of creation, starting with
the most recent from specified channel.
|
void |
getVideos(java.lang.String channelName,
VideosResponseHandler handler)
Returns a list of videos ordered by time of creation, starting with
the most recent from specified channel.
|
void |
put(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelResponseHandler handler)
Update channel's status, game, or delay.
|
void |
resetStreamKey(java.lang.String channelName,
ChannelResponseHandler handler)
Reset channel's stream key.
|
void |
startCommercial(java.lang.String channelName,
int length,
CommercialResponseHandler handler)
Start a commercial on channel.
|
getBaseUrl, setAuthAccessToken, setClientIdpublic ChannelsResource(java.lang.String baseUrl,
int apiVersion)
baseUrl - the base URL of the Twitch APIapiVersion - the requested version of the Twitch APIpublic void get(ChannelResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_READ
handler - the response handlerpublic void get(java.lang.String channelName,
ChannelResponseHandler handler)
Channel object.channelName - the name of the Channelhandler - the response handlerpublic void getEditors(java.lang.String channelName,
UsersResponseHandler handler)
channelName.
Authenticated, required scope: Scopes.CHANNEL_READ
channelName - the name of the Channelhandler - the response handlerpublic void put(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_EDITOR
channelName - the name of the Channelparams - the optional request parameters:
status: Channel's titlegame: Game category to be classified as.delay: Channel delay in seconds. Requires the channel owner's OAuth token.handler - the response handlerpublic void resetStreamKey(java.lang.String channelName,
ChannelResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_STREAM
channelName - the name of the Channelhandler - the response handlerpublic void startCommercial(java.lang.String channelName,
int length,
CommercialResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_COMMERCIAL
channelName - the name of the channellength - Length of commercial break in seconds. Default value is 30.
Valid values are 30, 60, 90,
120, 150, and 180handler - the response handlerpublic void getTeams(java.lang.String channelName,
TeamsResponseHandler handler)
channelName - the name of the Channelhandler - the response handlerpublic void getFollows(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelFollowsResponseHandler handler)
channelName - the name of the Channelparams - the optional request parameters:
limit: Maximum number of objects in array. Default is 25. Maximum is 100.offset: Object offset for pagination. Default is 0.direction: Creation date sorting direction. Default is desc.
Valid values are asc and desc.
handler - the response handlerpublic void getFollows(java.lang.String channelName,
ChannelFollowsResponseHandler handler)
channelName - the name of the Channelhandler - the response handlerpublic void getVideos(java.lang.String channelName,
com.mb3364.http.RequestParams params,
VideosResponseHandler handler)
channelName - the name of the Channelparams - the optional request parameters:
limit: Maximum number of objects in array. Default is 10. Maximum is 100.offset: Object offset for pagination. Default is 0.broadcasts: Returns only broadcasts when true.
Otherwise only highlights are returned.
Default is false
hls: Returns only HLS VoDs when true.
Otherwise only non-HLS VoDs are returned.
Default is false.
handler - the response handlerpublic void getVideos(java.lang.String channelName,
VideosResponseHandler handler)
channelName - the name of the Channelhandler - the response handlerpublic void getSubscriptions(java.lang.String channelName,
com.mb3364.http.RequestParams params,
ChannelSubscriptionsResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_SUBSCRIPTIONS
channelName - the name of the Channelparams - the optional request parameters:
limit: Maximum number of objects in array. Default is 25. Maximum is 100.offset: Object offset for pagination. Default is 0.direction: Creation date sorting direction.
Default is asc. Valid values are asc and desc.
handler - the response handlerpublic void getSubscriptions(java.lang.String channelName,
ChannelSubscriptionsResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_SUBSCRIPTIONS
channelName - the name of the Channelhandler - the response handlerpublic void getSubscription(java.lang.String channelName,
java.lang.String user,
ChannelSubscriptionResponseHandler handler)
Authenticated, required scope: Scopes.CHANNEL_CHECK_SUBSCRIPTION
channelName - the name of the channeluser - the user to checkhandler - the response handler