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.
|
static class |
ApolloCall.StatusEvent
Represents a status event that corresponds to a
ApolloCall action |
Modifier and Type | Method and Description |
---|---|
ApolloCall<T> |
cacheHeaders(CacheHeaders cacheHeaders)
Sets the
CacheHeaders to use for this call. |
void |
cancel()
Cancels this
ApolloCall . |
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.Operation |
operation()
Returns GraphQL operation this call executes
|
isCanceled
void 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@NotNull ApolloCall<T> cacheHeaders(@NotNull CacheHeaders cacheHeaders)
CacheHeaders
to use for this call. com.apollographql.apollo.interceptor.FetchOptions
will
be configured with this headers, and will be accessible from the ResponseFetcher
used 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
.@NotNull ApolloCall<T> clone()
@NotNull com.apollographql.apollo.api.Operation operation()
Operation
void cancel()
ApolloCall
. If the call was started with enqueue(Callback)
, the
ApolloCall.Callback
will be disposed, and will receive no more events.
The call will attempt to abort and release resources, if possible.cancel
in interface Cancelable