GraphQLOperationRequest

data class GraphQLOperationRequest<TVariables : GraphQLVariables>(val query: String, val operationName: String, val variables: TVariables? = null, val extensions: GraphQLValue.ObjectValue? = null)(source)

Backend-neutral GraphQL operation request payload.

GraphQLOperationRequest is the transport contract for a single GraphQL request before any Retrofit or HTTP concerns are applied. It is the neutral counterpart of the serializer-coupled co.anitrend.retrofit.graphql.model.GraphQLRequest.

All properties are immutable vals; use copy or withPersistedQuery to derive a new request. variables is nullable because an operation may take no variables.

Usage

val request = GraphQLOperationRequest<EmptyGraphQLVariables>(
query = "query GetCurrentUser { viewer { login } }",
operationName = "GetCurrentUser",
)

Type Parameters

TVariables

The type of variables, or co.anitrend.retrofit.graphql.model.EmptyGraphQLVariables for operations without variables.

See also

Constructors

Link copied to clipboard
constructor(query: String, operationName: String, variables: TVariables? = null, extensions: GraphQLValue.ObjectValue? = null)

Properties

Link copied to clipboard

Optional protocol extensions (for example persistedQuery), or null when absent.

Link copied to clipboard

The operation name.

Link copied to clipboard

The full GraphQL document string.

Link copied to clipboard

The operation variables, or null when there are none.

Functions

Link copied to clipboard

Returns a copy of this request with a persisted query extension added.