11package com .mb3364 .twitch .api .resources ;
22
3- import com .mb3364 .http .HttpResponse ;
43import com .mb3364 .http .RequestParams ;
54import com .mb3364 .twitch .api .auth .Scopes ;
65import com .mb3364 .twitch .api .handlers .*;
76import com .mb3364 .twitch .api .models .*;
87
98import java .io .IOException ;
9+ import java .util .List ;
10+ import java .util .Map ;
1011
1112/**
1213 * The {@link ChannelsResource} provides the functionality
@@ -37,9 +38,9 @@ public void get(final ChannelResponseHandler handler) {
3738
3839 http .get (url , new TwitchHttpResponseHandler (handler ) {
3940 @ Override
40- public void onSuccess (HttpResponse response ) {
41+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
4142 try {
42- Channel value = objectMapper .readValue (response . getContent () , Channel .class );
43+ Channel value = objectMapper .readValue (content , Channel .class );
4344 handler .onSuccess (value );
4445 } catch (IOException e ) {
4546 handler .onFailure (e );
@@ -59,9 +60,9 @@ public void get(final String channelName, final ChannelResponseHandler handler)
5960
6061 http .get (url , new TwitchHttpResponseHandler (handler ) {
6162 @ Override
62- public void onSuccess (HttpResponse response ) {
63+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
6364 try {
64- Channel value = objectMapper .readValue (response . getContent () , Channel .class );
65+ Channel value = objectMapper .readValue (content , Channel .class );
6566 handler .onSuccess (value );
6667 } catch (IOException e ) {
6768 handler .onFailure (e );
@@ -82,9 +83,9 @@ public void getEditors(final String channelName, final UsersResponseHandler hand
8283
8384 http .get (url , new TwitchHttpResponseHandler (handler ) {
8485 @ Override
85- public void onSuccess (HttpResponse response ) {
86+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
8687 try {
87- Editors value = objectMapper .readValue (response . getContent () , Editors .class );
88+ Editors value = objectMapper .readValue (content , Editors .class );
8889 handler .onSuccess (value .getUsers ());
8990 } catch (IOException e ) {
9091 handler .onFailure (e );
@@ -110,25 +111,25 @@ public void put(final String channelName, final RequestParams params, final Chan
110111 String url = String .format ("%s/channels/%s" , getBaseUrl (), channelName );
111112
112113 if (params .containsKey ("status" )) {
113- params .put ("channel[status]" , params .get ("status" ));
114+ params .put ("channel[status]" , params .getString ("status" ));
114115 params .remove ("status" );
115116 }
116117
117118 if (params .containsKey ("game" )) {
118- params .put ("channel[game]" , params .get ("game" ));
119+ params .put ("channel[game]" , params .getString ("game" ));
119120 params .remove ("game" );
120121 }
121122
122123 if (params .containsKey ("delay" )) {
123- params .put ("channel[delay]" , params .get ("delay" ));
124+ params .put ("channel[delay]" , params .getString ("delay" ));
124125 params .remove ("delay" );
125126 }
126127
127128 http .put (url , params , new TwitchHttpResponseHandler (handler ) {
128129 @ Override
129- public void onSuccess (HttpResponse response ) {
130+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
130131 try {
131- Channel value = objectMapper .readValue (response . getContent () , Channel .class );
132+ Channel value = objectMapper .readValue (content , Channel .class );
132133 handler .onSuccess (value );
133134 } catch (IOException e ) {
134135 handler .onFailure (e );
@@ -149,9 +150,9 @@ public void resetStreamKey(final String channelName, final ChannelResponseHandle
149150
150151 http .delete (url , new TwitchHttpResponseHandler (handler ) {
151152 @ Override
152- public void onSuccess (HttpResponse response ) {
153+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
153154 try {
154- Channel value = objectMapper .readValue (response . getContent () , Channel .class );
155+ Channel value = objectMapper .readValue (content , Channel .class );
155156 handler .onSuccess (value );
156157 } catch (IOException e ) {
157158 handler .onFailure (e );
@@ -178,7 +179,7 @@ public void startCommercial(final String channelName, final int length, final Co
178179
179180 http .post (url , params , new TwitchHttpResponseHandler (handler ) {
180181 @ Override
181- public void onSuccess (HttpResponse response ) {
182+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
182183 handler .onSuccess ();
183184 }
184185 });
@@ -195,9 +196,9 @@ public void getTeams(final String channelName, final TeamsResponseHandler handle
195196
196197 http .get (url , new TwitchHttpResponseHandler (handler ) {
197198 @ Override
198- public void onSuccess (HttpResponse response ) {
199+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
199200 try {
200- Teams value = objectMapper .readValue (response . getContent () , Teams .class );
201+ Teams value = objectMapper .readValue (content , Teams .class );
201202 handler .onSuccess (value .getTeams ());
202203 } catch (IOException e ) {
203204 handler .onFailure (e );
@@ -225,9 +226,9 @@ public void getFollows(final String channelName, final RequestParams params, fin
225226
226227 http .get (url , params , new TwitchHttpResponseHandler (handler ) {
227228 @ Override
228- public void onSuccess (HttpResponse response ) {
229+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
229230 try {
230- ChannelFollows value = objectMapper .readValue (response . getContent () , ChannelFollows .class );
231+ ChannelFollows value = objectMapper .readValue (content , ChannelFollows .class );
231232 handler .onSuccess (value .getTotal (), value .getFollows ());
232233 } catch (IOException e ) {
233234 handler .onFailure (e );
@@ -271,9 +272,9 @@ public void getVideos(final String channelName, final RequestParams params, fina
271272
272273 http .get (url , params , new TwitchHttpResponseHandler (handler ) {
273274 @ Override
274- public void onSuccess (HttpResponse response ) {
275+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
275276 try {
276- Videos value = objectMapper .readValue (response . getContent () , Videos .class );
277+ Videos value = objectMapper .readValue (content , Videos .class );
277278 handler .onSuccess (value .getTotal (), value .getVideos ());
278279 } catch (IOException e ) {
279280 handler .onFailure (e );
@@ -314,9 +315,9 @@ public void getSubscriptions(final String channelName, final RequestParams param
314315
315316 http .get (url , params , new TwitchHttpResponseHandler (handler ) {
316317 @ Override
317- public void onSuccess (HttpResponse response ) {
318+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
318319 try {
319- ChannelSubscriptions value = objectMapper .readValue (response . getContent () , ChannelSubscriptions .class );
320+ ChannelSubscriptions value = objectMapper .readValue (content , ChannelSubscriptions .class );
320321 handler .onSuccess (value .getTotal (), value .getSubscriptions ());
321322 } catch (IOException e ) {
322323 handler .onFailure (e );
@@ -350,9 +351,9 @@ public void getSubscription(final String channelName, final String user, final C
350351
351352 http .get (url , new TwitchHttpResponseHandler (handler ) {
352353 @ Override
353- public void onSuccess (HttpResponse response ) {
354+ public void onSuccess (int statusCode , Map < String , List < String >> headers , String content ) {
354355 try {
355- ChannelSubscription value = objectMapper .readValue (response . getContent () , ChannelSubscription .class );
356+ ChannelSubscription value = objectMapper .readValue (content , ChannelSubscription .class );
356357 handler .onSuccess (value );
357358 } catch (IOException e ) {
358359 handler .onFailure (e );
0 commit comments