# `ExWapp.Media`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/media.ex#L1)

Public media helpers shared by send and receive flows.

The media domain is split into smaller files under `lib/ex_wapp/domains/media/`
so the public API stays easy to find while crypto, HTTP, and source-handling
details live in focused modules.

# `download_type`

```elixir
@type download_type() :: media_type() | :history
```

Media kinds accepted by the download API, including history-sync blobs.

# `media_type`

```elixir
@type media_type() :: :image | :audio | :document
```

Media kinds currently supported by the high-level API.

# `source`

```elixir
@type source() :: {:bytes, binary()} | {:path, Path.t()} | ExWapp.Media.Upload.t()
```

Accepted media input values when sending a message.

`{:bytes, binary}` keeps everything in memory, `{:path, path}` reads from
disk, and `%ExWapp.Media.Upload{}` skips the upload step when the caller
already has WhatsApp upload metadata.

# `build_retry_receipt`

Builds the authenticated `server-error` receipt used to re-request expired media.

# `decode_retry_notification`

Decrypts a `mediaretry` notification with the original message media key.

# `read_source`

```elixir
@spec read_source(source()) :: {:ok, binary()} | {:error, term()}
```

Normalizes a send source into plaintext bytes.

This is the boundary between the user-facing send API and the upload
pipeline. Existing `%Upload{}` values are rejected because they already
represent uploaded server-side media rather than local plaintext bytes.

# `ref_from_upload`

```elixir
@spec ref_from_upload(ExWapp.Media.Upload.t(), keyword()) :: ExWapp.Media.Ref.t()
```

Converts upload metadata into a reusable download reference.

The resulting `%ExWapp.Media.Ref{}` can be attached to an event payload or
passed back into `ExWapp.download_media/3`.

# `retry_key`

Derives the media-retry wrapping key from a media key.

---

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