Grapher v0.9.1 Grapher.GraphQL.Request View Source
The Grapher Request struct is a collection of all document
strings along with any variables
.
Link to this section Summary
Functions
Converts a Grapher.GraphQL.Request.t
struct to JSON
format
Builds a GraphQL Request struct for a query, this is used for the request payload
Link to this section Types
Link to this type
t()
View Source
t() :: %Grapher.GraphQL.Request{query: query_string(), variables: var_data()}
Link to this section Functions
Converts a Grapher.GraphQL.Request.t
struct to JSON
format.
Parameters
request
: The request struct to be converted
Examples
iex> Request.as_json(no_vars())
"{\"variables\":null,\"query\":\"query { stores { items } }\"}"
iex> Request.as_json(snake_atoms())
"{\"variables\":{\"userId\":\"bob\"},\"query\":\"query { stores { items } }\"}"
iex> Request.as_json(camel_atoms())
"{\"variables\":{\"userId\":\"bob\"},\"query\":\"query { stores { items } }\"}"
iex> Request.as_json(string_keys())
"{\"variables\":{\"userId\":\"bob\"},\"query\":\"query { stores { items } }\"}"
iex> Request.as_json(camel_strings())
"{\"variables\":{\"userId\":\"bob\"},\"query\":\"query { stores { items } }\"}"