Skip to content

docs(download): document MediaDownloader and the MediaConnection → MediaRoute breaking change - #469

Merged
jlucaso1 merged 5 commits into
mainfrom
claude/nifty-bohr-a8k73v
Jul 30, 2026
Merged

docs(download): document MediaDownloader and the MediaConnection → MediaRoute breaking change#469
jlucaso1 merged 5 commits into
mainfrom
claude/nifty-bohr-a8k73v

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Documents oxidezap/whatsapp-rust#1194, which:

  • Replaced wacore::download::MediaConnection (required auth: String) with MediaRoute (auth: Option<String>), plus a new MediaHost::new and DEFAULT_MEDIA_HOSTS — a breaking change for any caller using DownloadUtils::prepare_download_requests directly.
  • Added MediaDownloader, a session-less counterpart to Client::download/download_to_writer that needs only an HttpClient + Runtime, for downloading persisted media references after the client has disconnected.
  • Added MediaDownloadError (ReferenceRejected / HostsUnreachable / NoHosts / Other) for the new session-less path, classifying failures a caller with no session to refresh can't recover from the same way Client::download does.
  • Made Client::prepare_requests skip the media-conn IQ entirely for static_url downloads (newsletter/channel media), since that IQ's answer was previously discarded unread.

Changes

  • api/download.mdx — added ## MediaDownloader (with MediaDownloadError and MediaRoute/MediaHost subsections), updated the DownloadUtils table entry for prepare_download_requests to reflect the MediaRoute parameter, added a note on the static_url IQ skip, and cross-linked MediaDownloader from the top of download.
  • guides/media-handling.mdx — added a "Downloading without an active session" subsection under Downloading Media, with a MediaDownloader example, and cross-referenced it from the existing retry/failover note.

No changelog entry was added, per the note that changelog entries are human-authored.

Test plan

  • Docs build (mint dev / mint broken-links) — not run in this environment; please verify locally or via CI if configured.
  • Cross-checked every new/changed heading anchor (#mediadownloader, #mediadownloaderror, #mediaroute-and-mediahost) against the links referencing them.
  • Diffed against whatsapp-rust-docs main content changes for the actual public API surface (public struct/enum/fn signatures) added or changed in whatsapp-rust#1194.

Generated by Claude Code


Summary by cubic

Adds MediaDownloader for session-less media downloads and documents the breaking change replacing wacore::download::MediaConnection with MediaRoute. Also clarifies the static_url exception, credential/host caching, and distinguishes stale auth (401/403) vs expired references (404/410) in both API and guide.

  • New Features

    • api/download.mdx: adds MediaDownloader (download/download_to_writer) and MediaDownloadError (#[non_exhaustive], clear 401/403 vs 404/410); documents MediaRoute/MediaHost/DEFAULT_MEDIA_HOSTS; updates DownloadUtils::prepare_download_requests(route); notes static_url downloads skip the media‑conn round trip and that host/token data is cached.
    • guides/media-handling.mdx: adds “Downloading without an active session” with a MediaDownloader example; clarifies it can’t refresh credentials and that apps must persist CDN fields; explicitly calls out the static_url exception; aligns error guidance with API docs (retry once with route.without_auth() on 401/403; treat 404/410 as terminal).
  • Migration

    • Replace MediaConnection with MediaRoute if you call DownloadUtils::prepare_download_requests.
    • Build routes with MediaRoute::authenticated(hosts, auth) or MediaRoute::unauthenticated(hosts); auth is now Option<String>.
    • MediaRoute::from(&mediaconn) converts the server’s mediaconn::MediaConn response, not the removed MediaConnection.

Written for commit 98807de. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added MediaDownloader for downloading and decrypting media without an active client session.
    • Added support for configurable media hosts, routing, authentication, and host failover.
    • Added buffered and streaming download options with typed download errors.
  • Documentation

    • Clarified when to use client-based downloads versus offline media downloads.
    • Documented credential limitations and failure behavior for disconnected sessions.
    • Updated download preparation guidance to use media routes.

jlucaso1 added 2 commits July 30, 2026 08:30
…nnection breaking change

whatsapp-rust#1194 replaced wacore::download::MediaConnection with MediaRoute
(auth is now optional) and added MediaDownloader, a session-less downloader
for callers with no connected Client. Document the new types and API on
api/download.mdx, and add a guide section on guides/media-handling.mdx
showing how to download persisted media references after disconnecting.
Cross-reference the new MediaDownloader from whatsapp-rust#1194 in the
media-handling guide, for readers who want to download persisted CDN
references after the client has disconnected.
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The documentation adds session-independent media downloading through MediaDownloader, defines media routing and typed download errors, updates the request-preparation contract, and explains host failover and credential-refresh behavior.

Changes

Offline media download

Layer / File(s) Summary
MediaDownloader API and routing contract
api/download.mdx
Documents MediaDownloader, MediaDownloadError, MediaHost, MediaRoute, default hosts, static URL handling, and the MediaRoute-based request-preparation signature.
Disconnected-session download guidance
api/download.mdx, guides/media-handling.mdx
Clarifies that Client downloads require an active session and documents persisted-parameter downloads, host failover, and the absence of credential refresh.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a rabbit with bytes in my burrow,
Downloading through routes in a hurry.
No session? Don’t fear—
Hosts hop far and near,
While errors stay typed, crisp, and furry.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the documentation update for MediaDownloader and the MediaConnection to MediaRoute change.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
whatsapp-rust 🟢 Ready View Preview Jul 30, 2026, 11:33 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/download.mdx`:
- Around line 380-382: Update the breaking-change warning to direct removed
MediaConnection callers to construct a MediaRoute with
MediaRoute::authenticated(hosts, auth). Mention MediaRoute::from(&media_conn)
only for callers that still have a client-side MediaConn, and preserve the note
that Client::download APIs are unaffected.
- Around line 81-84: Update the Note in the download documentation to replace
the inconsistent prepare_requests reference with the documented
DownloadUtils::prepare_download_requests symbol, preserving the existing
explanation about static_url media and media-conn requests.
- Around line 323-337: Update the MediaDownloadError documentation table to
describe Other as an unspecified or future error category rather than narrowly
tying it to missing URL fields, and remove the duplicated “no host was
contacted” wording. Clarify that #[non_exhaustive] requires consumers to include
a wildcard match arm when matching MediaDownloadError.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1ea25792-3404-4443-b753-e3d2bb176abd

📥 Commits

Reviewing files that changed from the base of the PR and between fd0ab7a and 97840b4.

📒 Files selected for processing (2)
  • api/download.mdx
  • guides/media-handling.mdx

Comment thread api/download.mdx
Comment thread api/download.mdx Outdated
Comment thread api/download.mdx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97840b4ec3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/download.mdx Outdated
Comment thread api/download.mdx Outdated
Comment thread api/download.mdx Outdated
Comment thread api/download.mdx Outdated
Comment thread api/download.mdx Outdated
- Qualify "download needs a connected Client" — static_url media is the
  documented exception, and the top Tip contradicted the note below it.
- Stop implying the client re-fetches CDN hosts on every download; it's
  cached and refreshed automatically per the existing retry docs.
- Don't attribute DownloadParams persistence to PersistenceManager, which
  only covers device/session state.
- Distinguish a stale MediaRoute auth token (401/403, recoverable via
  without_auth()) from a genuinely expired reference (404/410, terminal)
  in the MediaDownloadError table, and note the #[non_exhaustive] wildcard
  requirement.
- Fix the MediaConnection migration guidance: MediaRoute::from(&media_conn)
  converts mediaconn::MediaConn (the server response type), not the
  removed MediaConnection struct — point removed-type callers at
  MediaRoute::authenticated(hosts, auth) instead.

Addresses review comments from coderabbitai and chatgpt-codex-connector
on PR #469.
…atic_url media

The "Downloading without an active session" note categorically said
client.download() needs a connected Client, contradicting the static_url
exception documented on the download API page. Cross-reference it here too.

Addresses a chatgpt-codex-connector review comment on PR #469.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e70c7ca5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread guides/media-handling.mdx Outdated
…e into the guide

The API reference already distinguishes a stale MediaRoute auth token
(401/403, recoverable via without_auth()) from a genuinely expired
reference (404/410, terminal), but this guide's Note still called every
rejection "expired or revoked." Bring it in line.

Addresses a chatgpt-codex-connector review comment on PR #469.
@jlucaso1
jlucaso1 merged commit 630980f into main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant