query

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

Loads the provided selections on the root Query type, and returns the response typed as Q. This is a convenience method that combines selectionsFor and query.

Example usage:

val result = ctx.query("{ user { id name } }")

Return

The query result typed as Q

Parameters

selections

The selections to load on the root Query type

variables

Optional variables to use in the selections


abstract suspend fun query(operation: QueryFromAnnotation, variables: Map<String, Any?> = emptyMap()): Q(source)

Loads the operation declared by a @GraphQLOperation query object on the root Query type, and returns the response typed as Q.

Example usage:

val result = ctx.query(GetUserQuery)

Return

The query result typed as Q

Parameters

operation

The query operation object declaring the operation document

variables

Optional variables to use in the operation