query
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)Content copied to clipboard
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
abstract suspend fun query(selections: String, variables: Map<String, Any?> = emptyMap()): Q(source)
Deprecated
This API is not supported and will be deleted. Use the GraphQLOperation-based query(operation, variables) instead.
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 } }")Content copied to clipboard
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