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

Provides functions to operate Zendesk HelpCenter Translation.

Link to this section Summary

Functions

Create translation specified by category or section or article id.

Delete translation specified by id.

List translations by category or section or article id.

List missing locales by category or section or article id.

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

Update translation specified by category or section or article id.

Link to this section Functions

Link to this function

create(list, translation)

@spec create([{:category_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}
@spec create([{:section_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}
@spec create([{:article_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}

Create translation specified by category or section or article id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Translation.create([article_id: 1], %ZenEx.HelpCenter.Entity.Translation{title: xxx, locale: xxx, ...})
{:ok, %ZenEx.HelpCenter.Entity.Translation{title: xxx, locale: xxx, ...}}
@spec destroy(integer()) :: :ok | {:error, any()}

Delete translation specified by id.

examples

Examples

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

list(arg1, opts \\ [])

List translations by category or section or article id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Translation.list(article_id: 1)
{:ok, %ZenEx.Collection{}}
Link to this function

list_missing(list)

@spec list_missing([{:category_id, integer()}]) ::
  {:ok, [String.t()]} | {:error, any()}
@spec list_missing([{:section_id, integer()}]) ::
  {:ok, [String.t()]} | {:error, any()}
@spec list_missing([{:article_id, integer()}]) ::
  {:ok, [String.t()]} | {:error, any()}

List missing locales by category or section or article id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Translation.list_missing(article_id: 1)
{:ok, ["en-us", "da-dk"]}
Link to this function

show(locale, article_id)

@spec show(String.t(), integer()) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}

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

examples

Examples

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

update(list, translation)

@spec update([{:category_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}
@spec update([{:section_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}
@spec update([{:article_id, integer()}], %ZenEx.HelpCenter.Entity.Translation{
  body: term(),
  created_at: term(),
  created_by_id: term(),
  draft: term(),
  html_url: term(),
  id: term(),
  locale: term(),
  outdated: term(),
  source_id: term(),
  source_type: term(),
  title: term(),
  updated_at: term(),
  updated_by_id: term(),
  url: term()
}) ::
  {:ok,
   %ZenEx.HelpCenter.Entity.Translation{
     body: term(),
     created_at: term(),
     created_by_id: term(),
     draft: term(),
     html_url: term(),
     id: term(),
     locale: term(),
     outdated: term(),
     source_id: term(),
     source_type: term(),
     title: term(),
     updated_at: term(),
     updated_by_id: term(),
     url: term()
   }}
  | {:error, any()}

Update translation specified by category or section or article id.

examples

Examples

iex> ZenEx.HelpCenter.Model.Translation.update([article_id: 1], %ZenEx.HelpCenter.Entity.Translation{id: 1, title: xxx, locale: xxx, ...})
{:ok, %ZenEx.HelpCenter.Entity.Translation{id: 1, title: xxx, locale: xxx, ...}}