Class ChannelMediaMetadata
Channel adapters deliberately do not decode provider media into content blocks: material
identifiers (media_id / image_key / file_key / downloadCode)
are not URLs and can only be exchanged for bytes through a token-authenticated download whose
artifacts are short-lived. Deciding whether and when to fetch, where to buffer, and how to
degrade is application policy. Mappers therefore surface a media event as a user Msg
whose text content is a neutral marker and whose metadata
carries the keys defined here, so the application can observe the event, download the material
through its own path, or reply with guidance.
All values are strings. Keys absent on a given platform are omitted; readers must treat the metadata as a sparse map and never assume a key's presence.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPlayback duration in milliseconds, as reported by the platform (Feishu and DingTalk both document the field in milliseconds for audio and video messages).static final StringFile name, when the platform reports one.static final StringContainer / format token (WeCom voiceFormat, DingTalk videovideoType).static final StringPrimary provider material identifier (MediaId/image_key/file_key/downloadCode), verbatim.static final StringNormalized media kind — one ofimage,audio,video,file.static final StringNormalized media kind: audio (voice message).static final StringNormalized media kind: generic file attachment.static final StringNormalized media kind: image (photo / picture).static final StringNormalized media kind: video, including video-bearing composite messages.static final StringOriginal provider type token, verbatim (WeComMsgType, Feishumessage_type, DingTalkmsgtype) — e.g.static final StringPlatform speech-to-text result for audio messages, when the platform provides one.static final StringSecondary material identifier when the platform provides one (thumbnail / cover image / picture-specific download code).static final StringDirectly fetchable URL when the platform provides one alongside the material id (WeCom imagePicUrl). -
Method Summary
Modifier and TypeMethodDescriptionstatic StringmarkerText(String kind, String fileName) Returns the neutral marker text used as theMsgtext content of a mapped media message:"[image]","[audio]","[video]", or"[file: report.pdf]"when a file name is available.static voidPutsvalueunderkeyonly whenvalueis neithernullnor blank; a null/blank value is silently skipped.
-
Field Details
-
KIND_IMAGE
Normalized media kind: image (photo / picture).- See Also:
-
KIND_AUDIO
Normalized media kind: audio (voice message).- See Also:
-
KIND_VIDEO
Normalized media kind: video, including video-bearing composite messages.- See Also:
-
KIND_FILE
Normalized media kind: generic file attachment.- See Also:
-
KIND
Normalized media kind — one ofimage,audio,video,file.- See Also:
-
PROVIDER_TYPE
Original provider type token, verbatim (WeComMsgType, Feishumessage_type, DingTalkmsgtype) — e.g.voice,picture,media.- See Also:
-
ID
Primary provider material identifier (MediaId/image_key/file_key/downloadCode), verbatim.- See Also:
-
SECONDARY_ID
Secondary material identifier when the platform provides one (thumbnail / cover image / picture-specific download code).- See Also:
-
URL
Directly fetchable URL when the platform provides one alongside the material id (WeCom imagePicUrl).- See Also:
-
FILE_NAME
File name, when the platform reports one.- See Also:
-
FORMAT
Container / format token (WeCom voiceFormat, DingTalk videovideoType).- See Also:
-
DURATION_MS
Playback duration in milliseconds, as reported by the platform (Feishu and DingTalk both document the field in milliseconds for audio and video messages).- See Also:
-
RECOGNITION
Platform speech-to-text result for audio messages, when the platform provides one.- See Also:
-
-
Method Details
-
markerText
Returns the neutral marker text used as theMsgtext content of a mapped media message:"[image]","[audio]","[video]", or"[file: report.pdf]"when a file name is available. The marker keeps the event visible to text-only agents; applications are free to rewrite the text before dispatching.File names are provider-controlled input, so the embedded copy is sanitized — brackets, control characters and invisible formatting characters are removed, whitespace is collapsed and the copy is truncated — keeping the marker inert against crafted names; the raw name is preserved unmodified under
FILE_NAME.- Parameters:
kind- normalized media kind, as inKINDfileName- optional file name; a sanitized copy is embedded when non-blank- Throws:
NullPointerException- ifkindisnull
-
putIfPresent
Putsvalueunderkeyonly whenvalueis neithernullnor blank; a null/blank value is silently skipped. Channel payloads omit platform-optional fields; this keeps the metadata map sparse.- Throws:
NullPointerException- ifmetadataorkeyisnull
-