ExShopify v0.2.0 ExShopify.Page

Static content customers see often.

Summary

Functions

Receive a count of all pages

Create a new page

Delete a page

Receive a single page

Receive a list of all pages

Types

page_plural()
page_plural() :: {:ok, [%ExShopify.Page{author: term, body_html: term, created_at: term, handle: term, id: term, metafields: term, published_at: term, shop_id: term, template_suffix: term, title: term, updated_at: term}], %ExShopify.Meta{api_call_limit: term}}
page_singular()
page_singular() :: {:ok, %ExShopify.Page{author: term, body_html: term, created_at: term, handle: term, id: term, metafields: term, published_at: term, shop_id: term, template_suffix: term, title: term, updated_at: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

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

Receive a count of all pages.

Examples

iex> ExShopify.Page.count(session)
{:ok, count, meta}
create(session, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  page_singular |
  ExShopify.Resource.error

Create a new page.

Examples

Create a new, but unpublished page

iex> params = %{
...>   title: "Warranty information",
...>   body_html: "<h1>Warranty</h1>\n<p><strong>Forget it</strong>, we aint giving you nothing</p>",
...>   published: false
...> }

iex> ExShopify.Page.create(session, params)
{:ok, page, meta}

Create a page with a metafield

iex> params = %{
...>   title: "Warranty information",
...>   body_html: "<h1>Warranty</h1>\n<p><strong>Forget it</strong>, we aint giving you nothing</p>",
...>   metafields: [
...>     %ExShopify.Metafield{
...>       key: "new",
...>       value: "newvalue",
...>       value_type: "string",
...>       namespace: "global"
...>     }
...>   ]
...> }

iex> ExShopify.Page.create(session, params)
{:ok, page, meta}
delete(session, 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) ::
  ExShopify.Resource.only_meta |
  ExShopify.Resource.error

Delete a page.

Examples

iex> ExShopify.Page.delete(session, 131092082)
{:ok, meta}
find(session, 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) ::
  page_singular |
  ExShopify.Resource.error

Receive a single page.

Examples

iex> ExShopify.Page.find(session, 131092082)
{:ok, page, meta}
list(session)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) ::
  page_plural |
  ExShopify.Resource.error
list(session, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  page_plural |
  ExShopify.Resource.error

Receive a list of all pages.

Examples

iex> ExShopify.Page.list(session)
{:ok, page, meta}
update(session, 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) ::
  page_singular |
  ExShopify.Resource.error

Update a page.

Examples

Update an existing page body_html

iex> params = %{
...>   body_html: "<p>Okay, maybe we will give you a warranty.</p>"
...> }

iex> ExShopify.Page.update(session, 131092082, params)
{:ok, page, meta}

Add a metafield to an existing page

iex> params = %{
...>   metafields: [
...>     %{
...>       key: "new",
...>       value: "newvalue",
...>       value_type: "string",
...>       namespace: "gloabl"
...>     }
...>   ]
...> }

iex> ExShopify.Page.update(session, 131092082, params)
{:ok, page, meta}