pify

The Admin API client. Build one with new and pass it to the modules under pify/. Each of their functions returns a midas Effect, which your runner runs.

The API version is part of the Client. The request URL and every request shape that differs between versions follow from it.

Types

pub type Client {
  Client(
    access_token: String,
    shop_domain: String,
    version: api_version.ApiVersion,
    timeout_ms: Int,
  )
}

Constructors

  • Client(
      access_token: String,
      shop_domain: String,
      version: api_version.ApiVersion,
      timeout_ms: Int,
    )

    Arguments

    access_token

    An offline shpat_ token or a client-credentials token.

    shop_domain

    <handle>.myshopify.com, as parse_shop_domain returns it.

Why a text is not a shop domain. Each variant holds the normalised text that failed.

pub type ShopDomainError {
  ShopDomainNotMyshopify(domain: String)
  ShopDomainInvalidHandle(handle: String)
}

Constructors

  • ShopDomainNotMyshopify(domain: String)

    The host does not end in .myshopify.com, e.g. a custom storefront domain.

  • ShopDomainInvalidHandle(handle: String)

    The part before .myshopify.com is not a lowercase handle of letters, digits and inner hyphens.

Values

pub const default_timeout_ms: Int
pub fn endpoint_url(client: Client) -> String
pub fn new(
  access_token access_token: String,
  shop_domain shop_domain: String,
  version version: api_version.ApiVersion,
) -> Client
pub fn parse_shop_domain(
  text: String,
) -> Result(String, ShopDomainError)

Accept only <handle>.myshopify.com. Lowercases and trims the text and strips a scheme and trailing slashes first. A custom storefront domain is refused because the Admin API and webhooks name the shop by its myshopify.com domain.

pub fn shop_domain_error_to_string(
  error: ShopDomainError,
) -> String
✨ Search Document