ExShopify v0.2.0 ExShopify.Asset

Individual files that make up a shop’s theme.

Summary

Functions

Remove theme assets from a shop

Find a specific asset within a theme

List of theme asset metadata

Create new assets and update existing ones

Types

asset_plural()
asset_plural() :: {:ok, [%ExShopify.Asset{attachment: term, content_type: term, created_at: term, key: term, public_url: term, size: term, source_key: term, src: term, theme_id: term, updated_at: term, value: term}], %ExShopify.Meta{api_call_limit: term}}
asset_singular()
asset_singular() :: {:ok, %ExShopify.Asset{attachment: term, content_type: term, created_at: term, key: term, public_url: term, size: term, source_key: term, src: term, theme_id: term, updated_at: term, value: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

create(session, theme_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) ::
  asset_singular |
  ExShopify.Resource.error

See ExShopify.Asset.update/3.

delete(session, theme_id, params)
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, map) ::
  ExShopify.Resource.only_meta |
  ExShopify.Resource.error

Remove theme assets from a shop.

Examples

iex> ExShopify.Asset.delete(session, 828155753, %{asset: %{key: "assets/bg-body.gif"}})
{:ok, meta}
find(session, theme_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, map) ::
  asset_singular |
  ExShopify.Resource.error

Find a specific asset within a theme.

Examples

Get a liquid template

iex> ExShopify.Asset.find(session, 828155753, %{asset: %{key: "templates/index.liquid"}})
{:ok, asset, meta}

Get a theme image

iex> ExShopify.Asset.find(session, 828155753, %{asset: %{key: "assets/bg-body.gif"}})
{:ok, asset, meta}
list(session, theme_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) ::
  asset_plural |
  ExShopify.Resource.error
list(session, theme_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) ::
  asset_plural |
  ExShopify.Resource.error

List of theme asset metadata.

Examples

iex> ExShopify.Asset.list(session, 828155753)
{:ok, assets, meta}
update(session, theme_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, map) ::
  asset_singular |
  ExShopify.Resource.error

Create new assets and update existing ones.

Examples

Create a new image by providing a base64-encoded attachment

iex> params = %ExShopify.Asset{
...>   key: "assets/empty.gif",
...>   attachment: Base.encode64(Fild.read("path/to/file.png"))
...> }

iex> ExShopify.Asset.update(session, 828155753, params)
{:ok, asset, meta}

Update an image by providing a source URL from which to fetch the value

iex> params = %ExShopify.Asset{
...>   key: "assets/empty.gif",
...>   src: "http://apple.com/new_bg.gif"
...> }

iex> ExShopify.Asset.update(session, 828155753, params)
{:ok, asset, meta}