Ltix.DeepLinking.ContentItem.Image (Ltix v0.1.0)

Copy Markdown View Source

An image content item for Deep Linking responses.

The platform renders the image directly using an HTML img tag. For images that are part of a larger resource, consider using Ltix.DeepLinking.ContentItem.Link with an embed instead.

Options

  • :title (String.t/0) - Title for the content item.

  • :text (String.t/0) - Plain-text description.

  • :extensions (map/0) - Required. Vendor-specific extension properties. The default value is %{}.

  • :width (integer/0) - Width of the image in pixels.

  • :url (String.t/0) - Required. URL of the image.

  • :icon (map/0) - Icon or thumbnail for the image.

  • :thumbnail (map/0) - Icon or thumbnail for the image.

  • :height (integer/0) - Height of the image in pixels.

Summary

Functions

Create a new image content item.

Types

t()

@type t() :: %Ltix.DeepLinking.ContentItem.Image{
  extensions: %{optional(binary()) => any()},
  height: integer(),
  icon: %{
    optional(:width) => integer(),
    :url => binary(),
    optional(:height) => integer()
  },
  text: binary(),
  thumbnail: %{
    optional(:width) => integer(),
    :url => binary(),
    optional(:height) => integer()
  },
  title: binary(),
  url: binary(),
  width: integer()
}

Functions

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, Exception.t()}

Create a new image content item.

Examples

iex> {:ok, image} = Ltix.DeepLinking.ContentItem.Image.new(url: "https://example.com/photo.png")
iex> image.url
"https://example.com/photo.png"

iex> {:error, %Ltix.Errors.Invalid{}} =
...>   Ltix.DeepLinking.ContentItem.Image.new([])