shopify_graphql v1.0.0 Shopify.GraphQL

Link to this section Summary

Functions

Add a variable to the operation.

Send a GraphQL operation to Shopify.

Link to this section Types

Link to this type

http_headers_t()
http_headers_t() :: [{String.t(), String.t()}]

Link to this type

http_method_t()
http_method_t() :: :delete | :get | :post | :put

Link to this section Functions

Link to this function

put_variable(operation_or_query, name, value)

Add a variable to the operation.

It's possible to pass either a Shopify.GraphQL.Operation struct or, as a convenience, a binary query.

Link to this function

send(operation_or_query, config \\ %{})
send(binary() | Shopify.GraphQL.Operation.t(), map()) ::
  {:ok, Shopify.GraphQL.Response.t()} | {:error, any()}

Send a GraphQL operation to Shopify.

It's possible to send either a Shopify.GraphQL.Operation struct or, as a convenience, a binary query.

query =
  """
  {
    shop {
      name
    }
  }
  """

operation = %Shopify.GraphQL.Operation{ query: query }

Shopify.GraphQL.send(operation)

or

query =
  """
  {
    shop {
      name
    }
  }
  """

Shopify.GraphQL.send(query)

You may also pass an optional map of config overrides. This allows you to use different config values on a per-request basis.