Package de.sonallux.spotify.api.http
Class Response<T>
java.lang.Object
de.sonallux.spotify.api.http.Response<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the parsed response body for successful responses.intcode()Returns the HTTP status codestatic <T> Response<T>Returns an error representation for non successful responses.booleanReturns true if the code is in [200..300), which means the request was successful.message()Returns the HTTP status messageokhttp3.Responseraw()Returns the underlying OkHttp response objectstatic <T> Response<T>success(T body, okhttp3.Response rawResponse)
-
Constructor Details
-
Response
public Response()
-
-
Method Details
-
success
-
error
-
raw
public okhttp3.Response raw()Returns the underlying OkHttp response object -
code
public int code()Returns the HTTP status code -
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
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
Returns an error representation for non successful responses. This is null if the response is successful.
-