Package de.sonallux.spotify.api.http
Class Response<T>
- java.lang.Object
-
- de.sonallux.spotify.api.http.Response<T>
-
public class Response<T> extends Object
-
-
Constructor Summary
Constructors Constructor Description Response()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tbody()Returns the parsed response body for successful responses.intcode()Returns the HTTP status codestatic <T> Response<T>error(Error error, okhttp3.Response rawResponse)ErrorerrorBody()Returns an error representation for non successful responses.booleanisSuccessful()Returns true if the code is in [200..300), which means the request was successful.Stringmessage()Returns the HTTP status messageokhttp3.Responseraw()Returns the underlying OkHttp response objectstatic <T> Response<T>success(T body, okhttp3.Response rawResponse)
-
-
-
Method Detail
-
success
public static <T> Response<T> success(T body, okhttp3.Response rawResponse)
-
raw
public okhttp3.Response raw()
Returns the underlying OkHttp response object
-
code
public int code()
Returns the HTTP status code
-
message
public String message()
Returns the HTTP status message
-
isSuccessful
public boolean isSuccessful()
Returns true if the code is in [200..300), which means the request was successful.
-
body
public T body()
Returns the parsed response body for successful responses. null is returned if the response type is Void or the response has no body. For non successful response this is always null. Use {errorBody()} to get the associated error.
-
errorBody
public Error errorBody()
Returns an error representation for non successful responses. This is null if the response is successful.
-
-