Represents a GraphQL response.
Contains the decoded data (typed per-query), any errors
returned by the server, and an assigns map for user-defined
metadata populated via Req response steps.
Examples
{:ok, %TypedGql.Result{data: %MyClient.GetUser.Result.User{name: "Alice"}, errors: []}}
{:ok, %TypedGql.Result{data: nil, errors: [%TypedGql.Error{message: "Not found"}]}}Assigns
The assigns field carries response metadata a Req response step put
there with put_resp_assign/3 — rate-limit numbers from a GraphQL
extensions field, say. See the
prepare_req guide for a
worked client.
Summary
Functions
Stores a key-value pair in the TypedGql assigns area of a Req.Response.
Types
@type t(data_type) :: %TypedGql.Result{ assigns: map(), data: data_type | nil, errors: [TypedGql.Error.t()] }
Functions
@spec put_resp_assign(Req.Response.t(), atom(), term()) :: Req.Response.t()
Stores a key-value pair in the TypedGql assigns area of a Req.Response.
Intended for use inside Req response steps. The stored assigns are
automatically transferred to %TypedGql.Result{assigns: ...} after
the response is decoded.