Operation

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

Represents a GraphQL operation (mutation, query or subscription).

Types

Link copied to clipboard
interface Data : Executable.Data

Marker interface for generated models built from data returned by the server in response to this operation.

Functions

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

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

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
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
abstract override fun rootField(): CompiledField

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

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

Serializes the variables of this operation to a json

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

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(    jsonWriter: JsonWriter,     data: D,     customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)

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

Link copied to clipboard
fun <D : Operation.Data> Operation<D>.parseJsonResponse(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): ApolloResponse<D>

Reads a GraphQL Json response like below to a ApolloResponse

fun <D : Operation.Data> Operation<D>.parseJsonResponse(json: String, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): ApolloResponse<D>