ZenEx.HelpCenter.Model.Article (zen_ex v0.8.0)

Provides functions to operate Zendesk HelpCenter Article.

Link to this section Summary

Functions

Create article.

Delete article specified by id.

List articles specified by bcp-47 code of locale (es-419, en-us, pr-br) or locale and section_id.

Search articles by using query.

Show article specified by bcp-47 code of locale (es-419, en-us, pr-br) and id.

Update article specified by id.

Link to this section Functions

Link to this function

create(article)

@spec create(%ZenEx.HelpCenter.Entity.Article{
  author_id: term(),
  body: term(),
  comments_disabled: term(),
  created_at: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  label_names: term(),
  locale: term(),
  outdated: term(),
  outdated_locales: term(),
  position: term(),
  promoted: term(),
  section_id: term(),
  source_locale: term(),
  title: term(),
  updated_at: term(),
  url: term(),
  vote_count: term(),
  vote_sum: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Article{
     author_id: term(),
     body: term(),
     comments_disabled: term(),
     created_at: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     label_names: term(),
     locale: term(),
     outdated: term(),
     outdated_locales: term(),
     position: term(),
     promoted: term(),
     section_id: term(),
     source_locale: term(),
     title: term(),
     updated_at: term(),
     url: term(),
     vote_count: term(),
     vote_sum: term()
   }}
  | {:error, any()}

Create article.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.create(%ZenEx.HelpCenter.Entity.Article{name: xxx, locale: xxx, ...})
{:ok, %ZenEx.HelpCenter.Entity.Article{name: xxx, locale: xxx, ...}}
@spec destroy(integer()) :: :ok | {:error, any()}

Delete article specified by id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.destroy(1)
:ok
Link to this function

list(locale, section_id_or_opts \\ [], opts \\ [])

List articles specified by bcp-47 code of locale (es-419, en-us, pr-br) or locale and section_id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.list("en-us")
{:ok, %ZenEx.Collection{}}

iex> ZenEx.HelpCenter.Model.Article.list("en-us", 1)
{:ok, %ZenEx.Collection{}}
@spec search(String.t()) ::
  {:ok,
   %ZenEx.Collection{
     count: term(),
     decode_as: term(),
     entities: term(),
     next_page: term(),
     previous_page: term()
   }}
  | {:error, any()}

Search articles by using query.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.search("query={search_string}&updated_after=2017-01-01")
{:ok, %ZenEx.Collection{}}
Link to this function

show(locale, id)

@spec show(String.t(), integer()) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Article{
     author_id: term(),
     body: term(),
     comments_disabled: term(),
     created_at: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     label_names: term(),
     locale: term(),
     outdated: term(),
     outdated_locales: term(),
     position: term(),
     promoted: term(),
     section_id: term(),
     source_locale: term(),
     title: term(),
     updated_at: term(),
     url: term(),
     vote_count: term(),
     vote_sum: term()
   }}
  | {:error, any()}

Show article specified by bcp-47 code of locale (es-419, en-us, pr-br) and id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.show("en-us", 1)
{:ok, %ZenEx.HelpCenter.Entity.Article{id: 1, name: xxx, locale: "en-us", ...}}
Link to this function

update(article)

@spec update(%ZenEx.HelpCenter.Entity.Article{
  author_id: term(),
  body: term(),
  comments_disabled: term(),
  created_at: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  label_names: term(),
  locale: term(),
  outdated: term(),
  outdated_locales: term(),
  position: term(),
  promoted: term(),
  section_id: term(),
  source_locale: term(),
  title: term(),
  updated_at: term(),
  url: term(),
  vote_count: term(),
  vote_sum: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Article{
     author_id: term(),
     body: term(),
     comments_disabled: term(),
     created_at: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     label_names: term(),
     locale: term(),
     outdated: term(),
     outdated_locales: term(),
     position: term(),
     promoted: term(),
     section_id: term(),
     source_locale: term(),
     title: term(),
     updated_at: term(),
     url: term(),
     vote_count: term(),
     vote_sum: term()
   }}
  | {:error, any()}

Update article specified by id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Article.update(%ZenEx.HelpCenter.Entity.Article{id: 1, name: xxx, locale: xxx, ...})
{:ok, %ZenEx.HelpCenter.Entity.Article{id: 1, name: xxx, locale: xxx, ...}}