mutation

abstract suspend fun mutation(selections: String, variables: Map<String, Any?> = emptyMap()): M(source)

Loads the provided selections on the root Mutation type, and returns the response typed as M. This is a convenience method that combines selectionsFor and mutation.

Example usage:

val result = ctx.mutation("{ createUser(input: $input) { id name } }")

Return

The mutation result typed as M

Parameters

selections

The selections to load on the root Mutation type

variables

Optional variables to use in the selections


abstract suspend fun mutation(operation: MutationFromAnnotation, variables: Map<String, Any?> = emptyMap()): M(source)

Loads the operation declared by a @GraphQLOperation mutation object on the root Mutation type, and returns the response typed as M.

Example usage:

val result = ctx.mutation(SendMessageMutation, mapOf("input" to inputValue))

Return

The mutation result typed as M

Parameters

operation

The mutation operation object declaring the operation document

variables

Optional variables to use in the operation