public final class ApolloClient extends java.lang.Object implements ApolloQueryCall.Factory, ApolloMutationCall.Factory, ApolloPrefetch.Factory, ApolloSubscriptionCall.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. |
boolean |
clearNormalizedCache()
Clear all entries from the normalized cache.
|
void |
clearNormalizedCache(ApolloStoreOperation.Callback<java.lang.Boolean> callback)
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)
Creates the ApolloPrefetch by wrapping the operation object inside.
|
<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. |
<D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> |
subscribe(com.apollographql.apollo.api.Subscription<D,T,V> subscription)
Creates and prepares a new
ApolloSubscriptionCall 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(@NotNull 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(@NotNull com.apollographql.apollo.api.Mutation<D,T,V> mutation, @NotNull 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(@NotNull 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(@NotNull com.apollographql.apollo.api.Operation<D,T,V> operation)
ApolloPrefetch.Factoryprefetch in interface ApolloPrefetch.Factoryoperation - the operation which needs to be performedpublic <D extends com.apollographql.apollo.api.Operation.Data,T,V extends com.apollographql.apollo.api.Operation.Variables> ApolloSubscriptionCall<T> subscribe(@NotNull com.apollographql.apollo.api.Subscription<D,T,V> subscription)
ApolloSubscriptionCall.FactoryApolloSubscriptionCall call.subscribe in interface ApolloSubscriptionCall.Factorysubscription - to be sent to the subscription server to start listening pushed updatesApolloSubscriptionCall call to be executedpublic CacheHeaders defaultCacheHeaders()
CacheHeaders which this instance of ApolloClient was configured.public void clearHttpCache()
HttpCache, if present.public void clearNormalizedCache(@NotNull
ApolloStoreOperation.Callback<java.lang.Boolean> callback)
callback - to be notified when operation is completedpublic boolean clearNormalizedCache()
true if operation succeed, false otherwisepublic 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.