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
}
}
Content copied to clipboard
On native targets, ApolloClient.close must be called to release resources when not in use anymore.
Types
Properties
Functions
Link copied to clipboard
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.
Link copied to clipboard
Link copied to clipboard
Low level API to execute the given apolloRequest and return a Flow.
Link copied to clipboard
Creates a new ApolloCall for the given Mutation.
Link copied to clipboard
Creates a new Builder from this ApolloClient.
Link copied to clipboard
Creates a new ApolloCall for the given Query.
Link copied to clipboard
Creates a new ApolloCall for the given Subscription.