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

Misc utils for handling Graphql requests/responses.

Summary

Types

client_response()

@type client_response() :: {:ok, any()} | {:error, any()}

graphql_response()

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

Functions

decode_http_response(arg, query, decode_keys, log_options)

@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()

parse_response(arg)

@spec parse_response(graphql_response()) :: client_response()