Query

interface Query<D : Query.Data> : Operation<D>

Type safe representation of a GraphQL query.

Types

Link copied to clipboard
interface Data : Operation.Data

Functions

Link copied to clipboard
abstract fun adapter(): Adapter<D>

The Adapter that maps the server response data to/from generated model class D.

Link copied to clipboard
fun <D : Executable.Data> Executable<D>.composeData(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: D)
Link copied to clipboard
fun <D : Operation.Data> Operation<D>.composeJsonRequest(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)

Reads a GraphQL Json response like below to a ApolloResponse

Link copied to clipboard
fun <D : Operation.Data> Operation<D>.composeJsonResponse(data: D, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): String

fun <D : Operation.Data> Operation<D>.composeJsonResponse(jsonWriter: JsonWriter, data: D, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)

writes a successful GraphQL Json response containing "data" to the given sink.

Link copied to clipboard
abstract fun document(): String

The GraphQL operation String to be sent to the server. This might differ from the input *.graphql file with:

Link copied to clipboard

Returns the Set of boolean variables that are false either explicitly or because there is a default value

Link copied to clipboard
abstract fun id(): String

An unique identifier for the operation. Used for Automatic Persisted Queries. You can customize it with a OperationIdGenerator

Link copied to clipboard
abstract fun name(): String

The GraphQL operation name as in the *.graphql file.

Link copied to clipboard
fun <D : Executable.Data> Executable<D>.parseData(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, falseVariables: Set<String>? = null, deferredFragmentIds: Set<DeferredFragmentIdentifier>? = null, errors: List<Error>? = null): D?
Link copied to clipboard
fun <D : Operation.Data> Operation<D>.parseJsonResponse(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>? = null): ApolloResponse<D>

Reads a GraphQL Json response to a ApolloResponse. GraphQL Json responses look like so:

Link copied to clipboard
fun <D : Operation.Data> Operation<D>.parseResponse(jsonReader: JsonReader, requestUuid: Uuid? = null, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>? = null): ApolloResponse<D>

Reads a GraphQL Json response like below to a ApolloResponse. GraphQL Json responses look like so:

Link copied to clipboard
abstract fun rootField(): CompiledField

A list of CompiledSelection. Used when reading from the cache and/or normalizing a model. Use com.apollographql.apollo.cache.normalized.ApolloStore.readOperation for a higher level API

Link copied to clipboard
abstract fun serializeVariables(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, withDefaultValues: Boolean)

Serializes the variables of this operation to a json

Link copied to clipboard

Returns a map of the variables as they would be sent over the wire. Use this to construct your own HTTP requests

fun <D : Executable.Data> Executable<D>.variables(customScalarAdapters: CustomScalarAdapters, withDefaultValues: Boolean): Executable.Variables
Link copied to clipboard

Returns the variables as they would be sent over the wire. Use this to construct your own HTTP requests