Shopify.GraphQL (shopify_graphql v1.6.0)

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

Specs

http_headers_t() :: [{String.t(), String.t()}]
Link to this type

http_method_t()

Specs

http_method_t() :: :delete | :get | :post | :put
Link to this type

response_t()

Specs

response_t() ::
  {:ok, Shopify.GraphQL.Response.t()}
  | {:error, Shopify.GraphQL.Response.t() | any()}

Link to this section Functions

Link to this function

put_variable(operation_or_query, name, value)

Specs

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(query, config)

Specs

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.