View Source BridgeEx.Graphql.Client (bridge_ex v1.1.0)

Graphql client for BridgeEx.

Link to this section Summary

Functions

Formats a GraphQL query response to make it Absinthe compliant

Link to this section Types

@type bridge_response() ::
  {:ok, term()}
  | {:error, {:bad_response, integer()}}
  | {:error, {:http_error, String.t()}}
  | {:error, list()}

Link to this section Functions

Link to this function

call(url, query, variables, http_options, http_headers, retry_options, log_options)

View Source
@spec call(
  url :: String.t(),
  query :: String.t(),
  variables :: map(),
  http_options :: Keyword.t(),
  http_headers :: map(),
  retry_options :: Keyword.t(),
  log_options :: Keyword.t()
) :: bridge_response()

Calls a GraphQL endpoint

parameters

Parameters

  • url: URL of the endpoint.
  • query: Graphql query or mutation.
  • variables: dariables for Graphql query or mutation.
  • http_options: HTTPoison options.
  • http_headers: HTTPoison headers.
  • retry_options: configures retry attempts. Takes the form of [max_retries: 1, timing: :exponential]
  • log_options: configures logging on errors. Takes the form of [log_query_on_error: false, log_response_on_error: false].
Link to this function

format_response(response)

View Source
@spec format_response(%{required(atom()) => any()} | [%{required(atom()) => any()}]) ::
  %{required(atom()) => any()} | [%{required(atom()) => any()}]

Formats a GraphQL query response to make it Absinthe compliant