# `XClient.Media`
[🔗](https://github.com/iamkanishka/x-client.ex.git/blob/v1.0.0/lib/twitter_client/media.ex#L1)

Media upload operations for X API v1.1.

Supports uploading images, videos, and GIFs with chunked upload for large files.

## Supported Media Types

- Images: JPEG, PNG, GIF, WEBP
- Videos: MP4
- GIFs: Animated GIF

## Size Limits

- Images: 5 MB
- GIFs: 15 MB
- Videos: 512 MB

## Examples

    # Simple image upload
    {:ok, media} = XClient.Media.upload("path/to/image.jpg")

    # Upload with category
    {:ok, media} = XClient.Media.upload("path/to/video.mp4",
      media_category: "tweet_video")

    # Upload from binary data
    {:ok, media} = XClient.Media.upload(image_binary,
      media_type: "image/png")

# `add_metadata`

Adds metadata (like alt text) to uploaded media.

## Parameters

  - `media_id` - The media ID
  - `alt_text` - Alt text for accessibility (up to 1000 characters)

## Examples

    {:ok, _} = XClient.Media.add_metadata("123456789", "A beautiful sunset")

# `chunked_upload`

Uploads media using chunked upload (for large files).

Automatically used for files larger than 5 MB.

## Parameters

  - `media_path` - Path to the media file
  - `opts` - Optional parameters (same as `upload/3`)

## Returns

`{:ok, media_object}` with media_id_string.

# `upload`

Uploads media to X.

## Parameters

  - `media` - File path or binary data
  - `opts` - Optional parameters
    - `:media_category` - Media category (tweet_image, tweet_gif, tweet_video, dm_image, dm_video, dm_gif)
    - `:media_type` - MIME type (auto-detected if not provided)
    - `:additional_owners` - List of user IDs who can use the media
    - `:alt_text` - Alt text for accessibility (up to 1000 characters)

## Examples

    {:ok, media} = XClient.Media.upload("image.jpg")
    {:ok, media} = XClient.Media.upload("video.mp4", media_category: "tweet_video")
    {:ok, media} = XClient.Media.upload(binary_data, media_type: "image/png")

## Returns

`{:ok, media_object}` with media_id_string that can be used in tweets.

# `upload_status`

Gets the processing status of uploaded media.

Used for videos and GIFs that require processing.

## Parameters

  - `media_id` - The media ID to check

## Examples

    {:ok, status} = XClient.Media.upload_status("123456789")

## Returns

Processing status with state: "pending", "in_progress", "failed", or "succeeded"

---

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