public class LineApiResponse<R>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> LineApiResponse<T> |
createAsError(LineApiResponseCode responseCode,
LineApiError errorData) |
static <T> LineApiResponse<T> |
createAsSuccess(T responseData) |
boolean |
equals(java.lang.Object o) |
LineApiError |
getErrorData()
Gets information about an API error occurred.
|
LineApiResponseCode |
getResponseCode()
Gets the response code that is returned.
|
R |
getResponseData()
Gets data that is associated with the response if it exists.
|
int |
hashCode() |
boolean |
isNetworkError()
Checks if the API call fails with a network error.
|
boolean |
isServerError()
Checks if the API call fails with a server error.
|
boolean |
isSuccess()
Checks if the API call is successful.
|
java.lang.String |
toString() |
@NonNull public static <T> LineApiResponse<T> createAsSuccess(@Nullable T responseData)
responseData - The response data to construct the LineApiResponse with.LineApiResponse with LineApiResponseCode.SUCCESS response code,
the given responseData, and the LineApiError.DEFAULT error data.@NonNull public static <T> LineApiResponse<T> createAsError(@NonNull LineApiResponseCode responseCode, @NonNull LineApiError errorData)
responseCode - The response code to construct the LineApiResponse with.errorData - The error data to construct the LineApiResponse with.LineApiResponse with the given responseCode, the null
response data, and the given errorData.java.lang.AssertionError - If the given responseCode is LineApiResponseCode.SUCCESS
and the current build is debug build.public boolean isSuccess()
public boolean isNetworkError()
public boolean isServerError()
@NonNull public LineApiResponseCode getResponseCode()
LineApiResponseCode object containing the HTTP status code which
indicates if the API call is successful.@NonNull public R getResponseData()
NoSuchElementException. You must check if the response
succeeded by using the isSuccess() method before calling this method.LineApiResponse class.java.util.NoSuchElementException - if the response data is null.@NonNull public LineApiError getErrorData()
LineApiError object that contains information about the error. If no
error occurs, the LineApiError object will not contain any useful information.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object