View Source BridgeEx.Graphql.Utils (bridge_ex v2.4.0)

Misc utils for handling Graphql requests/responses.

Summary

Types

@type client_response() :: {:ok, any()} | {:error, any()}
@type graphql_response() ::
  {:error, String.t()}
  | {:ok, %{data: term()}}
  | {:ok,
     %{
       error: [
         %{
           message: String.t(),
           locations: [%{line: integer(), column: integer()}]
         }
       ],
       data: term()
     }}

Functions

Link to this function

decode_http_response(arg, query, decode_keys, log_options)

View Source
@spec decode_http_response(
  {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
  | {:error, HTTPoison.Error.t()},
  String.t(),
  :strings | :atoms | :existing_atoms,
  Keyword.t()
) :: client_response()
@spec parse_response(graphql_response()) :: client_response()