public final class ApolloClient extends java.lang.Object implements ApolloQueryCall.Factory, ApolloMutationCall.Factory, ApolloPrefetch.Factory
See the ApolloClient.Builder class for configuring the ApolloClient.
| Modifier and Type | Class and Description |
|---|---|
static class |
ApolloClient.Builder |
| Modifier and Type | Method and Description |
|---|---|
int |
activeCallsCount()
Returns the count of
ApolloCall & ApolloPrefetch objects which are currently in progress. |
ApolloStore |
apolloStore() |
static ApolloClient.Builder |
builder() |
void |
clearHttpCache()
Clear all entries from the
HttpCache, if present. |
ApolloStoreOperation<java.lang.Boolean> |
clearNormalizedCache()
Clear all entries from the normalized cache.
|
CacheHeaders |
defaultCacheHeaders() |
void |
idleCallback(IdleResourceCallback idleResourceCallback)
Sets the idleResourceCallback which will be called when this ApolloClient is idle.
|
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
mutate(com.apollographql.apollo.api.Mutation<D,T,V> mutation)
Creates and prepares a new
ApolloMutationCall call. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
mutate(com.apollographql.apollo.api.Mutation<D,T,V> mutation,
D withOptimisticUpdates)
Creates and prepares a new
ApolloMutationCall call with optimistic updates. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
prefetch(com.apollographql.apollo.api.Operation<D,T,V> operation)
Prepares the
ApolloPrefetch which will be executed at some point in the future. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
query(com.apollographql.apollo.api.Query<D,T,V> query)
Creates and prepares a new
ApolloQueryCall call. |
public static ApolloClient.Builder builder()
public <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> ApolloMutationCall<T> mutate(@Nonnull com.apollographql.apollo.api.Mutation<D,T,V> mutation)
ApolloMutationCall.FactoryApolloMutationCall call.mutate in interface ApolloMutationCall.Factorymutation - the Mutation which needs to be performedApolloMutationCall call to be executed at some point in the futurepublic <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> ApolloMutationCall<T> mutate(@Nonnull com.apollographql.apollo.api.Mutation<D,T,V> mutation, @Nonnull D withOptimisticUpdates)
ApolloMutationCall.FactoryCreates and prepares a new ApolloMutationCall call with optimistic updates.
ApolloStore
immediately before mutation execution. Any ApolloQueryWatcher dependent on the changed cache records will
be re-fetched.mutate in interface ApolloMutationCall.Factorymutation - the Mutation which needs to be performedwithOptimisticUpdates - optimistic updates for this mutationApolloMutationCall call to be executed at some point in the futurepublic <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> ApolloQueryCall<T> query(@Nonnull com.apollographql.apollo.api.Query<D,T,V> query)
ApolloQueryCall.FactoryApolloQueryCall call.query in interface ApolloQueryCall.Factoryquery - the operation which needs to be performedApolloQueryCall call to be executed at some point in the futurepublic <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> ApolloPrefetch prefetch(@Nonnull com.apollographql.apollo.api.Operation<D,T,V> operation)
ApolloPrefetch which will be executed at some point in the future.prefetch in interface ApolloPrefetch.Factoryoperation - the operation which needs to be performedpublic CacheHeaders defaultCacheHeaders()
CacheHeaders which this instance of ApolloClient was configured.public void clearHttpCache()
HttpCache, if present.@Nonnull public ApolloStoreOperation<java.lang.Boolean> clearNormalizedCache()
ApolloStoreOperation operation to executepublic ApolloStore apolloStore()
ApolloStore managing access to the normalized cache created by ApolloClient.Builder.normalizedCache(NormalizedCacheFactory, CacheKeyResolver) }public void idleCallback(IdleResourceCallback idleResourceCallback)
public int activeCallsCount()
ApolloCall & ApolloPrefetch objects which are currently in progress.