View Source ExWagtailContentClient (ex_wagtail_content_client v0.1.0)
Documentation for ExWagtailContentClient
.
Summary
Functions
For each of the specified fields, sanitizes the value
field, if one is present.
Fetches a list of pages from the default pages API.
Functions
For each of the specified fields, sanitizes the value
field, if one is present.
To sanitize a field, the library depends on https://github.com/rrrene/html_sanitize_ex by calling HtmlSanitizeEx.basic_html(value)
.
Fetches a list of pages from the default pages API.
Options
:base_url
- (required) The root url of the server:offset
- (optional) the number of items to skip during pagination, default 0 (see https://docs.wagtail.org/en/latest/advanced_topics/api/v2/usage.html#pagination):limit
- (optional) the number of items to fetch during pagination, default 20 (see https://docs.wagtail.org/en/latest/advanced_topics/api/v2/usage.html#pagination):req_opts
- (optional) List of options to pass to Req.get when executing the request:extra_params
- (optional) a list of tuples for additional parameters to be added to the query e.g.[{"locale", "fr"}]
Examples
iex> ExWagtailContentClient.list :pages, base_url: "https://iamkonstantin.eu"
{:ok, [%{"id" => 1, ...}], %{"total_count" => 38}, %{pagination}}
iex> ExWagtailContentClient.list :pages, base_url: "https://iamkonstantin.eu", extra_params: [{"locale", "fr"}]
{:ok, [%{"id" => 1, ...}], %{"total_count" => 38}, %{pagination}}
iex> ExWagtailContentClient.list :pages, base_url: "https://doesntexist"
{:error, %Req.TransportError{reason: :nxdomain}}