Chalk v0.1.0 Chalk.GraphQLRespose View Source

Response struct to graphql responses

Link to this section Summary

Functions

It builds a struct with the GraphQL response. It returs a map with either :ok or :error

Link to this section Types

Link to this type

t()

View Source
t() :: %Chalk.GraphQLRespose{data: map(), errors: map()}

Link to this section Functions

Link to this function

build(raw_response)

View Source
build(raw_response :: map()) :: {:ok | :error, t()}

It builds a struct with the GraphQL response. It returs a map with either :ok or :error

##Arguments:

*raw_response, a map with grapql response that comes from HTTP request

##Examples:

iex> Response.build(%{data: %{"name" => "test_name"}}) %Response%{data: %{"name" => "test_name"}}

iex> Response.build(%{errors: %{"name" => "test_name"}}) %Response%{errors: []}