@@ -48,7 +48,7 @@ private static <T> String convertToString(Class<T> cls, Object o) {
4848 * @param url The specific API URL to be used, excluding "https://api.spotify.com/v1/"
4949 * @return The raw json response from the request
5050 */
51- protected final JSONObject requestGet (String token , String url ) {
51+ protected final RequestResponse requestGet (String token , String url ) {
5252 // Initialisation of http get request
5353
5454
@@ -63,7 +63,7 @@ protected final JSONObject requestGet(String token, String url) {
6363 String s = response .getMessage ();
6464 switch (code ) {
6565 case 200 :
66- return new JSONObject (response .getContent ());
66+ return new RequestResponse ( new JSONObject (response .getContent ()), code , s );
6767 case 401 :
6868 System .out .println ("Bad or expired token. This can happen if the user revoked a " +
6969 "token or the access token has expired. You should re-authenticate the user." );
@@ -79,9 +79,8 @@ protected final JSONObject requestGet(String token, String url) {
7979 default :
8080 System .out .printf ("Unknown fail cause, status code: %s.%n" , code );
8181 }
82- System .out .println (s );
8382
84- return null ;
83+ return new RequestResponse ( null , code , s ) ;
8584
8685
8786 } catch (NullPointerException e ) {
@@ -91,7 +90,7 @@ protected final JSONObject requestGet(String token, String url) {
9190 }
9291
9392 @ Override
94- public JSONObject execute (String token ) {
93+ public RequestResponse execute (String token ) {
9594
9695 String urlQuery = this .buildRequestUrl ();
9796 if (urlQuery == null ) return null ;
0 commit comments