public final class Response<T> extends Object
| Modifier and Type | Method and Description |
|---|---|
T |
body()
The deserialized response body of a successful response.
|
int |
code()
HTTP status code.
|
static <T> Response<T> |
error(int code,
okhttp3.ResponseBody body)
Create a synthetic error response with an HTTP status code of
code and body
as the error body. |
static <T> Response<T> |
error(okhttp3.ResponseBody body,
okhttp3.Response rawResponse)
Create an error response from
rawResponse with body as the error body. |
okhttp3.ResponseBody |
errorBody()
The raw response body of an unsuccessful response.
|
okhttp3.Headers |
headers()
HTTP headers.
|
boolean |
isSuccess()
true if code() is in the range [200..300). |
String |
message()
HTTP status message or null if unknown.
|
okhttp3.Response |
raw()
The raw response from the HTTP client.
|
static <T> Response<T> |
success(T body)
Create a synthetic successful response with
body as the deserialized body. |
static <T> Response<T> |
success(T body,
okhttp3.Response rawResponse)
Create a successful response from
rawResponse with body as the deserialized
body. |
public static <T> Response<T> success(T body)
body as the deserialized body.public static <T> Response<T> success(T body, okhttp3.Response rawResponse)
rawResponse with body as the deserialized
body.public static <T> Response<T> error(int code, okhttp3.ResponseBody body)
code and body
as the error body.public static <T> Response<T> error(okhttp3.ResponseBody body, okhttp3.Response rawResponse)
rawResponse with body as the error body.public okhttp3.Response raw()
public int code()
public String message()
public okhttp3.Headers headers()
public boolean isSuccess()
true if code() is in the range [200..300).public T body()
public okhttp3.ResponseBody errorBody()
Copyright © 2016 Square, Inc.. All rights reserved.