View Source GQL (gql v0.6.2)
Simple GraphQL client.
Link to this section Summary
Functions
Queries a GraphQL endpoint. Returns {:ok, body, headers}
upon success or {:error, body, headers}
if the response contains an "errors" key.
Like query/2
, except raises GQL.GraphQLError
if the server returns errors.
Link to this section Functions
@spec query( String.t(), keyword() ) :: {:ok, map(), Mint.Types.headers()} | {:error, map(), Mint.Types.headers()}
Queries a GraphQL endpoint. Returns {:ok, body, headers}
upon success or {:error, body, headers}
if the response contains an "errors" key.
An exception will be raised for exceptional errors:
GQL.ConnectionError
if the HTTP client returns a connection error such as a timeout.GQL.ServerError
if the server responded with a 5xx code.
options
Options
:headers
(list ofterm/0
) - HTTP headers to include. The default value is[]
.:http_options
(keyword/0
) - Options to be passed toFinch.request/3
. The default value is[receive_timeout: 30000]
.:variables
(term/0
) - Keyword list or map of variables. The default value is[]
.:url
(String.t/0
) - Required. URL to which the request is made.
@spec query!( String.t(), keyword() ) :: {map(), Mint.Types.headers()}
Like query/2
, except raises GQL.GraphQLError
if the server returns errors.