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

Defines the GraphQL request builder.

iex> variables = %{key: "value"}
iex> Yson.GraphQL.Builder.build(ASchema.describe(), variables)
iex> %{
  query: "query ($key: String) ...",
  variables: %{key: "value"}
}

Link to this section Summary

Link to this section Functions

Link to this function

build(description, variables)

View Source

Builds the request.

The first parameter is a Yson.GraphQL.Schema description, while the second parameter is a map of variables.

Example

build(ASchema.describe(), %{key: "value"})

You can pass a shallow map of variables even if you specified deep args on Yson.GraphQL.Schema.query/3 or Yson.GraphQL.Schema.mutation/3.

Example

defmodule Person do
  use Yson.GraphQL.Schema

  query :person do
    arg :addresso do
      arg(:street, :string)
    end
  end

  # ...
end

# ...
build(Person.describe(), %{street: "a street"})