# `Ltix.DeepLinking.ContentItem.File`
[🔗](https://github.com/DecoyLex/ltix/blob/main/lib/ltix/deep_linking/content_item/file.ex#L1)

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` (`t:String.t/0`) - Title for the content item.

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

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

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

* `:icon` (`t:map/0`) - Icon or thumbnail for the file.

* `:thumbnail` (`t:map/0`) - Icon or thumbnail for the file.

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

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

# `t`

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

# `new`

```elixir
@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([])

---

*Consult [api-reference.md](api-reference.md) for complete listing*
