Yson.GraphQL.Api (yson v0.2.2) View Source

Defines the GraphQL Api.

It also provides a function to run requests to the api and parse the obtained response, hiding the complexity of Yson.GraphQL.Builder and Yson.Parser usage

iex> variables = %{var1: "value"}
iex> headers = [] # optional
iex> options = [] # optional
iex> Api.run(Schema, variables, "https://mysite.com/graphql", headers, options)

Link to this section Summary

Functions

Executes the GraphQL request and returns the parsed response or an error.

Link to this section Functions

Link to this function

run(schema, vars, graphql_url, headers \\ [], options \\ [])

View Source

Executes the GraphQL request and returns the parsed response or an error.

Example

run(ASchema, %{var1: "value"})

A successful call will return {:ok, parsed_data}, while a failed call will return a generic error {:error, message}.