ExShopify v0.2.0 ExShopify.Article

A single entry in a blog.

Summary

Functions

Get a list of all the authors of articles

Get a count of all articles from a certain blog

Create a new article for a blog

Delete an article of a blog

Get a single article by its id and the id of the parent blog

Get a list of all articles from a certain blog

Get a list of all the tags of articles

Get a list of all the tags of articles for a specific blog

Types

article_plural()
article_plural() :: {:ok, [%ExShopify.Article{author: term, blog_id: term, body_html: term, created_at: term, handle: term, id: term, image: term, metafields: term, published: term, published_at: term, summary_html: term, tags: term, template_suffix: term, title: term, updated_at: term, user_id: term}], %ExShopify.Meta{api_call_limit: term}}
article_singular()
article_singular() :: {:ok, %ExShopify.Article{author: term, blog_id: term, body_html: term, created_at: term, handle: term, id: term, image: term, metafields: term, published: term, published_at: term, summary_html: term, tags: term, template_suffix: term, title: term, updated_at: term, user_id: term}, %ExShopify.Meta{api_call_limit: term}}
author_plural()
author_plural() :: {:ok, [String.t], %ExShopify.Meta{api_call_limit: term}}
tag_plural()
tag_plural() :: {:ok, [String.t], %ExShopify.Meta{api_call_limit: term}}

Functions

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

Get a list of all the authors of articles.

Examples

iex> ExShopify.Article.authors(session)
{:ok, authors, meta}
count(session, blog_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, blog_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

Get a count of all articles from a certain blog.

Examples

iex> ExShopify.Article.count(session, 241253187)
{:ok, count, meta}
create(session, blog_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) ::
  article_singular |
  ExShopify.Resource.error

Create a new article for a blog.

Examples

Create a new article with an image which will be downloaded by Shopify

iex> params = %ExShopify.Article{
...>   title: "My new Article title",
...>   author: "John Smith",
...>   tags: "This Post, Has Been Tagged",
...>   body_html: "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class="caps">REST</span>.</p>",
...>   published_at: "Thu Mar 24 15:45:47 UTC 2016",
...>   image: {
...>     src: "http://example.com/elixir_logo.gif"
...>   }
...> }

iex> ExShopify.Article.create(session, 241253187, params)
{:ok, article, meta}

Create a new article with a base64 encoded image

iex> params = %ExShopify.Article{
...>   title: "My new Article title",
...>   author: "John Smith",
...>   tags: "This Post, Has Been Tagged",
...>   body_html: "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class="caps">REST</span>.</p>",
...>   published_at: "Thu Mar 24 15:45:47 UTC 2016",
...>   image: {
...>     attachment: Base.encode64(File.read("path/to/image.png"))
...>   }
...> }

iex> ExShopify.Article.create(session, 241253187, params)
{:ok, article, meta}

Create an article with a metafield

iex> params = %ExShopify.Article{
...>   title: "My new Article title",
...>   author: "John Smith",
...>   tags: "This Post, Has Been Tagged",
...>   body_html: "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class="caps">REST</span>.</p>",
...>   published_at: "Thu Mar 24 15:45:47 UTC 2016",
...>   metafields: [
...>     %ExShopify.Metafield{
...>       key: "new",
...>       value: "newvalue",
...>       value_type: "string",
...>       namespace: "global"
...>     }
...>   ]
...> }

iex> ExShopify.Article.create(session, 241253187, params)
{:ok, article, meta}
delete(session, id, blog_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.only_meta |
  ExShopify.Resource.error

Delete an article of a blog.

Examples

iex> ExShopify.Article.delete(session, 134645308, 241253187)
{:ok, meta}
find(session, id, blog_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) ::
  article_singular |
  ExShopify.Resource.error
find(session, id, blog_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) ::
  article_singular |
  ExShopify.Resource.error

Get a single article by its id and the id of the parent blog.

Examples

iex> ExShopify.Article.find(session, 134645308, 241253187, %{})
{:ok, article, meta}
list(session, blog_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) ::
  article_plural |
  ExShopify.Resource.error
list(session, blog_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) ::
  article_plural |
  ExShopify.Resource.error

Get a list of all articles from a certain blog.

Examples

Get all the articles

iex> ExShopify.Article.list(session, 241253187, %{})
{:ok, articles, meta}

Get all the articles after the specified id

iex> ExShopify.Article.list(session, 241253187, %{since_id: 134645308})
{:ok, articles, meta}
tags(session)
tags(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) :: tag_plural
tags(session, params)
tags(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) :: tag_plural

Get a list of all the tags of articles.

Examples

Get a list of all tags of articles

iex> ExShopify.Article.tags(session)
{:ok, tags, meta}

Get a list of the most popular tags

iex> ExShopify.Article.tags(session, %{limit: 1, popular: 1})
{:ok, tags, meta}

Get a list of all tags from a specific blog

iex> ExShopify.Article.tags(session, %{})
{:ok, tags, meta}

Get a list of the most popular tags

iex> ExShopify.Article.tags(session, %{limit: 1, popular: 1})
{:ok, tags, meta}
tags_from_blog(session, blog_id)
tags_from_blog(%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) :: tag_plural
tags_from_blog(session, blog_id, params)
tags_from_blog(%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) :: tag_plural

Get a list of all the tags of articles for a specific blog.

Examples

Get a list of all tags of articles

iex> ExShopify.Article.tags_from_blog(session, 134645308)
{:ok, tags, meta}

Get a list of the most popular tags

iex> ExShopify.Article.tags_from_blog(session, 134645308, %{limit: 1, popular: 1})
{:ok, tags, meta}

Get a list of the most popular tags

iex> ExShopify.Article.tags(session, 134645308, %{limit: 1, popular: 1})
{:ok, tags, meta}
update(session, id, blog_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) ::
  article_singular |
  ExShopify.Resource.error

Update an article.

Examples

iex> ExShopify.Article.update(session, 134645308, 241253187, %{published: false})
{:ok, article, meta}