public class Request
extends java.lang.Object
RiotApi object.RiotApi| Modifier and Type | Field and Description |
|---|---|
static int |
CODE_ERROR_BAD_GATEWAY |
static int |
CODE_ERROR_BAD_REQUEST |
static int |
CODE_ERROR_FORBIDDEN |
static int |
CODE_ERROR_GATEWAY_TIMEOUT |
static int |
CODE_ERROR_METHOD_NOT_ALLOWED |
static int |
CODE_ERROR_NOT_FOUND |
static int |
CODE_ERROR_RATE_LIMITED |
static int |
CODE_ERROR_SERVER_ERROR |
static int |
CODE_ERROR_SERVICE_UNAVAILABLE |
static int |
CODE_ERROR_UNAUTHORIZED |
static int |
CODE_ERROR_UNPROCESSABLE_ENTITY |
static int |
CODE_ERROR_UNSUPPORTED_MEDIA_TYPE |
static int |
CODE_SUCCESS_NO_CONTENT |
static int |
CODE_SUCCESS_OK |
| Constructor and Description |
|---|
Request(ApiConfig config,
ApiMethod object)
Constructs a synchronous request
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel()
Attempts to cancel the request.
|
<T> T |
getDto()
Retrieves the result of the request.
|
RiotApiException |
getException()
Returns the exception that was thrown when calling
execute(). |
ApiMethod |
getObject()
Returns the object defining the request
|
RequestResponse |
getResponse()
Returns the raw response from the Riot Api
|
boolean |
isCancelled()
Returns
true if this request was cancelled before it completed normally. |
boolean |
isDone()
Returns
true if this request completed. |
boolean |
isFailed()
Returns
true if this request failed. |
boolean |
isPending()
Returns
true if this request is still waiting for a response from the Riot Api. |
boolean |
isSuccessful()
Returns
true if this request completed successfully. |
boolean |
isTimeOut()
Returns
true if this request timed out before it completed normally. |
public static final int CODE_SUCCESS_OK
public static final int CODE_SUCCESS_NO_CONTENT
public static final int CODE_ERROR_BAD_REQUEST
public static final int CODE_ERROR_UNAUTHORIZED
public static final int CODE_ERROR_FORBIDDEN
public static final int CODE_ERROR_NOT_FOUND
public static final int CODE_ERROR_METHOD_NOT_ALLOWED
public static final int CODE_ERROR_UNSUPPORTED_MEDIA_TYPE
public static final int CODE_ERROR_UNPROCESSABLE_ENTITY
public static final int CODE_ERROR_RATE_LIMITED
public static final int CODE_ERROR_SERVER_ERROR
public static final int CODE_ERROR_BAD_GATEWAY
public static final int CODE_ERROR_SERVICE_UNAVAILABLE
public static final int CODE_ERROR_GATEWAY_TIMEOUT
public Request(ApiConfig config, ApiMethod object) throws RateLimitException, RiotApiException
config - Configuration to usemethod - Api method to callRateLimitExceptionRiotApiExceptionApiConfig,
ApiMethodpublic boolean cancel()
cancel is called, this request should never run.false if the request could not be cancelled, typically because it has already completed normally; true
otherwisepublic <T> T getDto()
throws RiotApiException,
RateLimitException
java.lang.IllegalStateException - If this request did not complete yet or did not succeedRiotApiException - If parsing the Riot Api's response failsRateLimitExceptionpublic RiotApiException getException()
execute().public ApiMethod getObject()
public RequestResponse getResponse()
RequestResponse object, providing raw data of the Riot Api's responseRequestResponsepublic boolean isCancelled()
true if this request was cancelled before it completed normally.true if this request was cancelled before it completedpublic boolean isDone()
true if this request completed. Completion may be due to normal termination, an exception, cancellation or timing out
-- in all of these cases, this method will return true.true if this request completedpublic boolean isFailed()
true if this request failed.true if this request failedpublic boolean isPending()
true if this request is still waiting for a response from the Riot Api.true if this request is still waiting for a responsepublic boolean isSuccessful()
true if this request completed successfully.true if this request completed successfullypublic boolean isTimeOut()
true if this request timed out before it completed normally.true if this request timed out before it completed