Sha256: 7ae90319d81f28ea94c1b30604e6ed93f18b9a2be2c4630c3c0aca792fba79c7

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

# typed: strict
# frozen_string_literal: true

module WhatsappSdk
  module Resource
    class MediaTypes
      extend T::Sig

      # The media types supported by Whatsapp. The list contains all the types defined in the Whatsapp API
      # documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types
      #
      # The media type is used as a content-type header when downloading the file with MediasApi#download_file.
      # The content-type header matches with the media type using Internet Assigned Numbers Authority (IANA).
      # Media type list defined by IANA https://www.iana.org/assignments/media-types/media-types.xhtml
      #

      AUDIO_TYPES = %w[audio/aac audio/mp4 audio/mpeg audio/amr audio/ogg].freeze
      DOCUMENT_TYPES = %w[
        text/plain application/pdf application/vnd.ms-powerpoint application/msword application/vnd.ms-excel
        application/vnd.openxmlformats-officedocument.wordprocessingml.document
        application/vnd.openxmlformats-officedocument.presentationml.presentation
        application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
      ].freeze
      IMAGE_TYPES = %w[image/jpeg image/png].freeze
      STICKER_TYPES = %w[image/webp].freeze
      VIDEO_TYPES = %w[video/mp4 video/3gp].freeze

      SUPPORTED_MEDIA_TYPES = [AUDIO_TYPES + DOCUMENT_TYPES + IMAGE_TYPES + STICKER_TYPES + VIDEO_TYPES].flatten.freeze
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whatsapp_sdk-0.11.0 lib/whatsapp_sdk/resource/media_types.rb
whatsapp_sdk-0.10.0 lib/whatsapp_sdk/resource/media_types.rb
whatsapp_sdk-0.9.2 lib/whatsapp_sdk/resource/media_types.rb