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

Misc utils for handling Graphql requests/responses.

Link to this section Summary

Link to this section 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()
     }}

Link to this section 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()