ApolloClient
The main entry point for the Apollo runtime. An ApolloClient is responsible for executing queries, mutations and subscriptions
Use ApolloClient.Builder to create a new ApolloClient:
val apolloClient = ApolloClient.Builder()
.serverUrl("https://example.com/graphql")
.build()
val response = apolloClient.query(MyQuery()).execute()
if (response.data != null) {
// Handle (potentially partial) data
} else {
// Something wrong happened
if (response.exception != null) {
// Handle fetch errors
} else {
// Handle GraphQL errors in response.errors
}
}
On native targets, ApolloClient.close must be called to release resources when not in use anymore.
Types
A Builder used to create instances of ApolloClient.
Properties
Functions
Disposes resources held by this ApolloClient. On JVM platforms, resources are ultimately garbage collected but calling close is necessary on other platform or to reclaim those resources earlier.
Low level API to execute the given apolloRequest and return a Flow.
Creates a new ApolloCall for the given Mutation.
Creates a new Builder from this ApolloClient.
Creates a new ApolloCall for the given Query.
Creates a new ApolloCall for the given Subscription.