GraphQL.Response (GraphQL Client v0.2.1) View Source
Functions to handle GraphQL responses
Link to this section Summary
Functions
Creates a new failure response with the given errors
Create a new partial success response with the given data and errors
Creates a succes response with the given data
Link to this section Types
Specs
A struct that contains the GraphQL response data.
Link to this section Functions
Specs
Creates a new failure response with the given errors
Examples
iex> failure([%{message: "some error", locations: [%{line: 2, column: 5}]}])
%GraphQL.Response{success?: false, errors: [%{message: "some error", locations: [%{line: 2, column: 5}]}]}
Specs
Create a new partial success response with the given data and errors
Examples
iex> data = %{field: "value"}
%{field: "value"}
iex> errors = [%{message: "some error", locations: [%{line: 2, column: 5}]}]
[%{message: "some error", locations: [%{line: 2, column: 5}]}]
iex> partial_success(data, errors)
%GraphQL.Response{success?: :partial, data: %{field: "value"}, errors: [%{message: "some error", locations: [%{line: 2, column: 5}]}]}
Specs
Creates a succes response with the given data
Examples
iex> success(%{field: "value"})
%GraphQL.Response{success?: true, data: %{field: "value"}}