BaileysEx.Media.Types (baileys_ex v0.1.0-alpha.9)

Copy Markdown View Source

Media type descriptors used by media crypto, upload, and download flows.

Summary

Functions

Infer a media type from a MIME type.

Return the descriptor for a media type.

Return the HKDF info string used for a media type.

Return the CDN upload path for a media type, or nil when that type does not use the normal media CDN upload flow.

Types

descriptor()

@type descriptor() :: %{
  path: String.t() | nil,
  hkdf_info: String.t(),
  proto_field: atom()
}

media_type()

@type media_type() ::
  :image
  | :video
  | :audio
  | :document
  | :sticker
  | :gif
  | :ptt
  | :ptv
  | :thumbnail_link
  | :product_catalog_image
  | :md_app_state
  | :md_msg_hist
  | :product
  | :thumbnail_document
  | :thumbnail_image
  | :thumbnail_video
  | :payment_bg_image
  | :ppic
  | :biz_cover_photo

Functions

from_mime(mime)

@spec from_mime(String.t()) :: media_type() | nil

Infer a media type from a MIME type.

get(type)

@spec get(media_type()) :: descriptor()

Return the descriptor for a media type.

hkdf_info(type)

@spec hkdf_info(media_type()) :: String.t()

Return the HKDF info string used for a media type.

path(type)

@spec path(media_type()) :: String.t() | nil

Return the CDN upload path for a media type, or nil when that type does not use the normal media CDN upload flow.