View Source GhostContent (ghost_content v0.1.0)

An Elixir client for the Ghost publishing platform's Content API.

Full documentation of the Ghost Content API is available at: https://ghost.org/docs/content-api/

Summary

Functions

Loads a configuration for use in subsequent API calls.

Gets a single author by ID.

Gets a single author by Slug.

Gets a list of authors.

Gets a single page by ID.

Gets a single page by Slug.

Gets a list of pages.

Gets a single post by ID.

Gets a single post by Slug.

Gets a list of posts.

Gets a single tag by ID.

Gets a single tag by Slug.

Gets a list of tags.

Types

@type config() :: [api_key: String.t(), host: String.t()]
@type meta() :: %{
  next: String.t() | nil,
  prev: String.t() | nil,
  total: integer(),
  limit: integer(),
  pages: integer(),
  page: integer()
}
@type options() :: [
  filter: String.t() | nil,
  include: String.t() | nil,
  page: String.t() | nil,
  limit: String.t() | nil,
  order: String.t() | nil,
  fields: String.t() | nil
]

Functions

@spec config(atom()) :: config()

Loads a configuration for use in subsequent API calls.

Link to this function

get_author(config, id, opts \\ [])

View Source
@spec get_author(config(), String.t(), options() | nil) ::
  {:ok, %{authors: [GhostContent.Author.t()]}}

Gets a single author by ID.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#authors

Link to this function

get_author_by_slug(config, slug, opts \\ [])

View Source
@spec get_author_by_slug(config(), String.t(), options() | nil) ::
  {:ok, %{authors: [GhostContent.Author.t()]}}

Gets a single author by Slug.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#authors

Link to this function

get_authors(config, opts \\ [])

View Source
@spec get_authors(config(), options() | nil) ::
  {:ok, %{authors: [GhostContent.Author.t()]}}

Gets a list of authors.

Accepts the following options: limit, page, filter, order, fields, include

For exact usage, see: https://ghost.org/docs/content-api/#authors

Link to this function

get_page(config, id, opts \\ [])

View Source
@spec get_page(config(), String.t(), options() | nil) ::
  {:ok, %{pages: [GhostContent.Post.t()]}}

Gets a single page by ID.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#pages

Link to this function

get_page_by_slug(config, slug, opts \\ [])

View Source
@spec get_page_by_slug(config(), String.t(), options() | nil) ::
  {:ok, %{pages: [GhostContent.Post.t()]}}

Gets a single page by Slug.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#pages

Link to this function

get_pages(config, opts \\ [])

View Source
@spec get_pages(config(), options() | nil) :: {:ok, %{pages: [GhostContent.Post.t()]}}

Gets a list of pages.

Accepts the following options: limit, page, filter, order, fields, include

For exact usage, see: https://ghost.org/docs/content-api/#pages

Link to this function

get_post(config, id, opts \\ [])

View Source
@spec get_post(config(), String.t(), options() | nil) ::
  {:ok, %{posts: [GhostContent.Post.t()]}}

Gets a single post by ID.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#posts

Link to this function

get_post_by_slug(config, slug, opts \\ [])

View Source
@spec get_post_by_slug(config(), String.t(), options() | nil) ::
  {:ok, %{posts: [GhostContent.Post.t()]}}

Gets a single post by Slug.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#posts

Link to this function

get_posts(config, opts \\ [])

View Source
@spec get_posts(config(), options() | nil) ::
  {:ok, %{meta: meta(), posts: [GhostContent.Post.t()]}}

Gets a list of posts.

Accepts the following options: limit, page, filter, order, fields, include

For exact usage, see: https://ghost.org/docs/content-api/#posts

Link to this function

get_tag(config, id, opts \\ [])

View Source
@spec get_tag(config(), String.t(), options() | nil) ::
  {:ok, %{tags: [GhostContent.Tag.t()]}}

Gets a single tag by ID.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#tags

Link to this function

get_tag_by_slug(config, slug, opts \\ [])

View Source
@spec get_tag_by_slug(config(), String.t(), options() | nil) ::
  {:ok, %{tags: [GhostContent.Tag.t()]}}

Gets a single tag by Slug.

Accepts the following options: fields, include

For exact usage, see: https://ghost.org/docs/content-api/#tags

Link to this function

get_tags(config, opts \\ [])

View Source
@spec get_tags(config(), options() | nil) :: {:ok, %{tags: [GhostContent.Tag.t()]}}

Gets a list of tags.

Accepts the following options: limit, page, filter, order, fields, include

For exact usage, see: https://ghost.org/docs/content-api/#tags