GQLClient

class GQLClient(val httpClient: HttpClient = HttpClient(), val json: Json = Json)

Client used to send HTTP POST requests to an api

Parameters

httpClient

The HttpClient used to send requests. Uses an automatically configured HttpClient by default.

json

The instance of Json to use to serialize variables and serialize responses.

See also

HttpClient

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient = HttpClient(), json: Json = Json)

Properties

Link copied to clipboard
val httpClient: HttpClient
Link copied to clipboard
val json: Json

Functions

Link copied to clipboard
inline suspend fun <T, E : GQLError> sendMutation(url: String, mutation: Mutation, variables: JsonObject? = null, operationName: String = "", headers: List<HttpHeader> = listOf()): Response<T, E>

Sends a mutation to a specified HTTP endpoint as a POST request.

Link copied to clipboard
inline suspend fun <T, E : GQLError> sendQuery(url: String, query: Query, variables: JsonObject? = null, operationName: String = "", headers: List<HttpHeader> = listOf()): Response<T, E>

Sends a query to a specified HTTP endpoint as a POST request.

Link copied to clipboard
suspend fun stringSendMutation(url: String, mutation: Mutation, variables: JsonObject? = null, operationName: String = "", headers: List<HttpHeader> = listOf()): StringResponse
Link copied to clipboard
suspend fun stringSendQuery(url: String, mutation: Query, variables: JsonObject? = null, operationName: String = "", headers: List<HttpHeader> = listOf()): StringResponse