ExShopify v0.2.0 ExShopify.ProductImage

Images of a product.

Summary

Functions

Receive a count of all product images

Create a new product image

Remove a product image from the database

Receive a single product image

Receive a list of all product images

Modify an existing product image

Types

product_image_plural()
product_image_plural() :: {:ok, [%ExShopify.ProductImage{created_at: term, id: term, position: term, product_id: term, src: term, updated_at: term, variant_ids: term}], %ExShopify.Meta{api_call_limit: term}}
product_image_singular()
product_image_singular() :: {:ok, %ExShopify.ProductImage{created_at: term, id: term, position: term, product_id: term, src: term, updated_at: term, variant_ids: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

count(session, product_id)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error
count(session, product_id, params)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error

Receive a count of all product images.

Examples

iex> ExShopify.ProductImage.count(session, 632910392)
{:ok, count, meta}
create(session, product_id, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_image_singular |
  ExShopify.Resource.error

Create a new product image.

Examples

Create a new product image using a source URL that will be downloaded by Shopify

iex> params = %{
...>   src: "http://example.com/elixir_logo.gif"
...> }

iex> ExShopify.ProductImage.create(session, 632910392, params)
{:ok, product_image, meta}

Create a new product image and attach it to product variants

iex> params = %{
...>   variant_ids: [808950810, 457924702]
...>   attachment: Base.encode64(File.read("path/to/image.png"))
...> }

iex> ExShopify.ProductImage.create(session, 632910392, params)
{:ok, product_image, meta}
delete(session, id, product_id)
delete(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t) ::
  ExShopify.Resource.meta_only |
  ExShopify.Resource.error

Remove a product image from the database.

Examples

iex> ExShopify.ProductImage.delete(session, 850703190, 632910392)
{:ok, meta}
find(session, id, product_id)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t) ::
  product_image_singular |
  ExShopify.Resource.error
find(session, id, product_id, params)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t, map) ::
  product_image_singular |
  ExShopify.Resource.error

Receive a single product image.

Examples

iex> ExShopify.ProductImage.find(session, 850703190, 632910392)
{:ok, product_image, meta}
list(session, product_id)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  product_image_plural |
  ExShopify.Resource.error
list(session, product_id, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_image_plural |
  ExShopify.Resource.error

Receive a list of all product images.

Examples

iex> ExShopify.ProductImage.list(session, 632910392)
{:ok, product_images, meta}
update(session, id, product_id, params)
update(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t, map) ::
  product_image_singular |
  ExShopify.Resource.error

Modify an existing product image.

Examples

iex> params = %{
...>   position: 2,
...>   metafields: [
...>     key: "alt",
...>     value: "new alt tag content",
...>     value_type: "string",
...>     namespace: "tags"
...>   ]
...> }

iex> ExShopify.ProductImage.update(session, 850703190, 632910392, params)
{:ok, product_image, meta}