ApolloCall

An ApolloCall is a thin class that binds an ApolloRequest with its ApolloClient. It offers a fluent way to configure the ApolloRequest.

Contrary to an ApolloRequest, an ApolloCall doesn't have a request id and a new request id is allocated every time execute or toFlow is called.

  • call execute for simple cases that expect a single response:

val response = apolloClient.query(myQuery).fetchPolicy(CacheOnly).execute()
apolloClient.subscription(mySubscription).toFlow().collect { response ->
println(response.data)
}

See also

Properties

Link copied to clipboard
open override val canBeBatched: Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val httpHeaders: List<HttpHeader>?
Link copied to clipboard
open override val httpMethod: HttpMethod?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val sendApqExtensions: Boolean?
Link copied to clipboard
open override val sendDocument: Boolean?

Functions

Link copied to clipboard
open override fun addExecutionContext(executionContext: ExecutionContext): ApolloCall<D>
Link copied to clipboard
open override fun addHttpHeader(name: String, value: String): ApolloCall<D>
Link copied to clipboard
open override fun canBeBatched(canBeBatched: Boolean?): ApolloCall<D>
Link copied to clipboard

When conflateResponses is true, the fetch policy interceptors emit a single response and ignores the first cache or network error if a successful response is ultimately fetched. If no successful response can be emitted, a com.apollographql.apollo.exception.ApolloCompositeException error response is emitted.

Link copied to clipboard
fun copy(): ApolloCall<D>
Link copied to clipboard
open override fun enableAutoPersistedQueries(enableAutoPersistedQueries: Boolean?): ApolloCall<D>
Link copied to clipboard
suspend fun execute(): ApolloResponse<D>

Retrieves a single ApolloResponse from this ApolloCall.

Link copied to clipboard

A version of execute that restores 3.x behaviour:

Link copied to clipboard
fun failFastIfOffline(failFastIfOffline: Boolean?): ApolloCall<D>
Link copied to clipboard
open override fun httpHeaders(httpHeaders: List<HttpHeader>?): ApolloCall<D>
Link copied to clipboard
open override fun httpMethod(httpMethod: HttpMethod?): ApolloCall<D>
Link copied to clipboard
fun ignoreApolloClientHttpHeaders(ignoreApolloClientHttpHeaders: Boolean?): ApolloCall<D>
Link copied to clipboard
Link copied to clipboard
open override fun sendApqExtensions(sendApqExtensions: Boolean?): ApolloCall<D>
Link copied to clipboard
open override fun sendDocument(sendDocument: Boolean?): ApolloCall<D>
Link copied to clipboard
fun toFlow(): Flow<ApolloResponse<D>>

Returns a cold Flow that produces ApolloResponses from this ApolloCall.

Link copied to clipboard

A version of execute that restores 3.x behaviour: