Media re-upload request helpers modeled after Baileys' media retry flow.
Summary
Types
Opaque WAProto WebMessageInfo struct used by media retry helpers.
Functions
Apply a media-update event to a media message after decrypting the retry data.
Extract the media-bearing content from a Message, mirroring Baileys'
assertMediaContent.
Build the Baileys-style server-error receipt requesting media re-upload.
Decode a mediaretry notification node into a parity-shaped event payload.
Decrypt the encrypted media-update payload returned by the paired device.
Send a media re-upload request for the given message key.
Map a media retry result to the HTTP-style status Baileys uses.
Composed helper that performs the full media re-upload round trip.
Types
@type web_message_info() :: struct()
Opaque WAProto WebMessageInfo struct used by media retry helpers.
Functions
@spec apply_media_update(wa_message(), binary(), media_update_event()) :: {:ok, wa_message()} | {:error, term()}
Apply a media-update event to a media message after decrypting the retry data.
@spec assert_media_content(wa_message() | nil) :: {:ok, struct()} | {:error, :not_a_media_message}
Extract the media-bearing content from a Message, mirroring Baileys'
assertMediaContent.
Returns {:ok, media_content} or {:error, :not_a_media_message}.
@spec build_retry_request(message_key(), binary(), String.t(), keyword()) :: {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}
Build the Baileys-style server-error receipt requesting media re-upload.
@spec decode_notification_event(BaileysEx.BinaryNode.t()) :: media_update_event()
Decode a mediaretry notification node into a parity-shaped event payload.
@spec decrypt_media_update( %{ciphertext: binary(), iv: binary()}, binary(), String.t() ) :: {:ok, decrypted_media_update()} | {:error, term()}
Decrypt the encrypted media-update payload returned by the paired device.
@spec request_reupload( GenServer.server() | term(), message_key(), binary(), keyword() ) :: :ok | {:error, term()}
Send a media re-upload request for the given message key.
@spec status_code_for_result(atom() | integer()) :: pos_integer() | nil
Map a media retry result to the HTTP-style status Baileys uses.
@spec update_media_message( GenServer.server() | term(), GenServer.server(), web_message_info(), keyword() ) :: {:ok, web_message_info()} | {:error, term()}
Composed helper that performs the full media re-upload round trip.
Mirrors Baileys' updateMediaMessage: sends the retry request, subscribes to
:messages_media_update events, waits for the matching message ID, decrypts the
retry payload, and applies the refreshed directPath/url to the message.
Returns {:ok, updated_web_message_info} or {:error, reason}.
Options
:timeout— milliseconds to wait for the media update event (default10000):me_id— the caller's JID (required):send_fun— override the node send function (defaultSocket.send_node/2):iv— deterministic IV for testing