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

Copy Markdown View Source

A file content item for Deep Linking responses.

File URLs are short-lived. The platform downloads the file shortly after receiving the response, so the URL only needs to remain valid for a few minutes.

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 %{}.

  • :url (String.t/0) - Required. URL to download the file.

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

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

  • :media_type (String.t/0) - MIME type of the file (e.g. "application/pdf").

  • :expires_at (String.t/0) - ISO 8601 timestamp when the download URL expires.

Summary

Functions

Create a new file content item.

Types

t()

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

Functions

new(opts)

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

Create a new file content item.

Examples

iex> {:ok, file} = Ltix.DeepLinking.ContentItem.File.new(url: "https://example.com/doc.pdf")
iex> file.url
"https://example.com/doc.pdf"

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