public interface ApolloCall<T> extends Cancelable
ApolloCall is an abstraction for a request that has been prepared for execution. ApolloCall represents a single request/response pair and cannot be executed twice, though it can be cancelled.
In order to execute the request again, call the clone() method which creates a new ApolloCall
object.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ApolloCall.Callback<T>
Communicates responses from a server or offline requests.
|
| Modifier and Type | Method and Description |
|---|---|
ApolloCall<T> |
cacheControl(CacheControl cacheControl)
Sets the
CacheControl strategy for an ApolloCall object. |
ApolloCall<T> |
cacheHeaders(CacheHeaders cacheHeaders)
Sets the
CacheHeaders to use for this call. |
ApolloCall<T> |
clone()
Creates a new, identical call to this one which can be enqueued or executed even if this call has already been.
|
void |
enqueue(ApolloCall.Callback<T> callback)
Schedules the request to be executed at some point in the future.
|
com.apollographql.apollo.api.Response<T> |
execute()
Sends the request immediately and blocks until the response can be processed or is an error.
|
com.apollographql.apollo.api.Operation |
operation()
Returns GraphQl operation this call executes
|
cancel, isCanceled@Nonnull com.apollographql.apollo.api.Response<T> execute() throws ApolloException
ResponseApolloException - if the request could not be executed due to a cancellation, a timeout, network
failure or a parsing errorjava.lang.IllegalStateException - when the call has already been executedvoid enqueue(@Nullable
ApolloCall.Callback<T> callback)
callback - Callback which will handle the response or a failure exception.java.lang.IllegalStateException - when the call has already been executed@Nonnull ApolloCall<T> cacheControl(@Nonnull CacheControl cacheControl)
CacheControl strategy for an ApolloCall object.cacheControl - the CacheControl strategy to set@Nonnull ApolloCall<T> cacheHeaders(@Nonnull CacheHeaders cacheHeaders)
CacheHeaders to use for this call.cacheHeaders - the CacheHeaders that will be passed with records generated from this request to NormalizedCache. Standardized cache headers are
defined in ApolloCacheHeaders.CacheHeaders.@Nonnull ApolloCall<T> clone()
@Nonnull com.apollographql.apollo.api.Operation operation()
Operation