Package org.matrix.android.sdk.api.session.room.model.message

Types

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class AudioInfo(    @Json(name = "mimetype") val mimeType: String? = null,     @Json(name = "size") val size: Long? = null,     @Json(name = "duration") val duration: Int? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class AudioWaveformInfo(@Json(name = "duration") val duration: Int? = null, @Json(name = "waveform") val waveform: List<Int?>? = null)

See https://github.com/matrix-org/matrix-doc/blob/travis/msc/audio-waveform/proposals/3246-audio-waveform.md

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class FileInfo(    @Json(name = "mimetype") val mimeType: String?,     @Json(name = "size") val size: Long = 0,     @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null,     @Json(name = "thumbnail_url") val thumbnailUrl: String? = null,     @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class ImageInfo(    @Json(name = "mimetype") val mimeType: String?,     @Json(name = "w") val width: Int = 0,     @Json(name = "h") val height: Int = 0,     @Json(name = "size") val size: Long = 0,     @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null,     @Json(name = "thumbnail_url") val thumbnailUrl: String? = null,     @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class LocationAsset(@Json(name = "type") val type: String? = null)
Link copied to clipboard
object LocationAssetType

Define what particular asset is being referred to. We don't use enum type since it is not limited to a specific set of values. The way this type should be interpreted in client side is described in MSC3488

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class LocationInfo(@Json(name = "uri") val geoUri: String? = null, @Json(name = "description") val description: String? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageAudioContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "info") val audioInfo: AudioInfo? = null,     @Json(name = "url") val url: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "file") val encryptedFileInfo: EncryptedFileInfo? = null,     @Json(name = "org.matrix.msc1767.audio") val audioWaveformInfo: AudioWaveformInfo? = null,     @Json(name = "org.matrix.msc3245.voice") val voiceMessageIndicator: JsonDict? = null) : MessageWithAttachmentContent
Link copied to clipboard
value class MessageAudioEvent(val root: Event)

Event wrapper for EventType.MESSAGE event type. Provides additional fields and functions related to this event type.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageBeaconInfoContent(    val msgType: String = MessageType.MSGTYPE_BEACON_INFO,     @Json(name = "body") val body: String = "",     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "description") val description: String? = null,     @Json(name = "timeout") val timeout: Long? = null,     @Json(name = "live") val isLive: Boolean? = null,     @Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,     @Json(name = "m.ts") val timestampMillis: Long? = null,     @Json(name = "org.matrix.msc3488.asset") val unstableLocationAsset: LocationAsset = LocationAsset(LocationAssetType.SELF),     @Json(name = "m.asset") val locationAsset: LocationAsset? = null) : MessageContent

Content of the state event of type EventType.STATE_ROOM_BEACON_INFO

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageBeaconLocationDataContent(    val msgType: String = MessageType.MSGTYPE_BEACON_LOCATION_DATA,     @Json(name = "body") val body: String = "",     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "org.matrix.msc3488.location") val unstableLocationInfo: LocationInfo? = null,     @Json(name = "m.location") val locationInfo: LocationInfo? = null,     @Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,     @Json(name = "m.ts") val timestampMillis: Long? = null) : MessageContent

Content of the event of type EventType.BEACON_LOCATION_DATA

Link copied to clipboard
interface MessageContent
Link copied to clipboard
interface MessageContentWithFormattedBody : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageDefaultContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null) : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageEmoteContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "format") val format: String? = null,     @Json(name = "formatted_body") val formattedBody: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null) : MessageContentWithFormattedBody
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageEndPollContent(    val msgType: String = MessageType.MSGTYPE_POLL_END,     @Json(name = "body") val body: String = "",     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "org.matrix.msc1767.text") val unstableText: String? = null,     @Json(name = "m.text") val text: String? = null) : MessageContent

Class representing the org.matrix.msc3381.poll.end event content.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageFileContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "filename") val filename: String? = null,     @Json(name = "info") val info: FileInfo? = null,     @Json(name = "url") val url: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "file") val encryptedFileInfo: EncryptedFileInfo? = null) : MessageWithAttachmentContent
Link copied to clipboard
object MessageFormat
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageImageContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "info") val info: ImageInfo? = null,     @Json(name = "url") val url: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "file") val encryptedFileInfo: EncryptedFileInfo? = null) : MessageImageInfoContent
Link copied to clipboard
interface MessageImageInfoContent : MessageWithAttachmentContent

A content with image information.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageLocationContent(    @Json(name = "msgtype") val msgType: String = MessageType.MSGTYPE_LOCATION,     @Json(name = "body") val body: String,     @Json(name = "geo_uri") val geoUri: String,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "org.matrix.msc3488.location") val unstableLocationInfo: LocationInfo? = null,     @Json(name = "m.location") val locationInfo: LocationInfo? = null,     @Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,     @Json(name = "m.ts") val timestampMillis: Long? = null,     @Json(name = "org.matrix.msc1767.text") val unstableText: String? = null,     @Json(name = "m.text") val text: String? = null,     @Json(name = "org.matrix.msc3488.asset") val unstableLocationAsset: LocationAsset? = null,     @Json(name = "m.asset") val locationAsset: LocationAsset? = null) : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageNoticeContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "format") val format: String? = null,     @Json(name = "formatted_body") val formattedBody: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null) : MessageContentWithFormattedBody
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessagePollContent(    val msgType: String = MessageType.MSGTYPE_POLL_START,     @Json(name = "body") val body: String = "",     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "org.matrix.msc3381.poll.start") val unstablePollCreationInfo: PollCreationInfo? = null,     @Json(name = "m.poll.start") val pollCreationInfo: PollCreationInfo? = null) : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessagePollResponseContent(    val msgType: String = MessageType.MSGTYPE_POLL_RESPONSE,     @Json(name = "body") val body: String = "",     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "org.matrix.msc3381.poll.response") val unstableResponse: PollResponse? = null,     @Json(name = "m.response") val response: PollResponse? = null) : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageRelationContent(@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageStickerContent(    val msgType: String = MessageType.MSGTYPE_STICKER_LOCAL,     @Json(name = "body") val body: String = "",     @Json(name = "info") val info: ImageInfo? = null,     @Json(name = "url") val url: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "file") val encryptedFileInfo: EncryptedFileInfo? = null) : MessageImageInfoContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageTextContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "format") val format: String? = null,     @Json(name = "formatted_body") val formattedBody: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null) : MessageContentWithFormattedBody
Link copied to clipboard
object MessageType
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageVerificationCancelContent(    @Json(name = "code") val code: String? = null,     @Json(name = "reason") val reason: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageVerificationRequestContent(    @Json(name = "msgtype") val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST,     @Json(name = "body") val body: String,     @Json(name = "from_device") val fromDevice: String?,     @Json(name = "methods") val methods: List<String>,     @Json(name = "to") val toUserId: String,     @Json(name = "timestamp") val timestamp: Long?,     @Json(name = "format") val format: String? = null,     @Json(name = "formatted_body") val formattedBody: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     val transactionId: String? = null) : MessageContent
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MessageVideoContent(    @Json(name = "msgtype") val msgType: String,     @Json(name = "body") val body: String,     @Json(name = "info") val videoInfo: VideoInfo? = null,     @Json(name = "url") val url: String? = null,     @Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null,     @Json(name = "m.new_content") val newContent: Content? = null,     @Json(name = "file") val encryptedFileInfo: EncryptedFileInfo? = null) : MessageWithAttachmentContent
Link copied to clipboard
interface MessageWithAttachmentContent : MessageContent

Interface for message which can contains an encrypted file.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class PollAnswer(    @Json(name = "id") val id: String? = null,     @Json(name = "org.matrix.msc1767.text") val unstableAnswer: String? = null,     @Json(name = "m.text") val answer: String? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class PollCreationInfo(    @Json(name = "question") val question: PollQuestion? = null,     @Json(name = "kind") val kind: PollType? = PollType.DISCLOSED_UNSTABLE,     @Json(name = "max_selections") val maxSelections: Int = 1,     @Json(name = "answers") val answers: List<PollAnswer>? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class PollQuestion(@Json(name = "org.matrix.msc1767.text") val unstableQuestion: String? = null, @Json(name = "m.text") val question: String? = null)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class PollResponse(@Json(name = "answers") val answers: List<String>? = null)
Link copied to clipboard
@JsonClass(generateAdapter = false)
enum PollType : Enum<PollType>
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class ThumbnailInfo(    @Json(name = "w") val width: Int = 0,     @Json(name = "h") val height: Int = 0,     @Json(name = "size") val size: Long = 0,     @Json(name = "mimetype") val mimeType: String?)
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class VideoInfo(    @Json(name = "mimetype") val mimeType: String?,     @Json(name = "w") val width: Int = 0,     @Json(name = "h") val height: Int = 0,     @Json(name = "size") val size: Long = 0,     @Json(name = "duration") val duration: Int = 0,     @Json(name = "thumbnail_info") val thumbnailInfo: ThumbnailInfo? = null,     @Json(name = "thumbnail_url") val thumbnailUrl: String? = null,     @Json(name = "thumbnail_file") val thumbnailFile: EncryptedFileInfo? = null)

Functions

Link copied to clipboard
fun Event.asMessageAudioEvent(): MessageAudioEvent?
Link copied to clipboard
fun MessageWithAttachmentContent.getFileName(): String
Link copied to clipboard
fun MessageWithAttachmentContent.getFileUrl(): String?

Get the url of the encrypted file or of the file.

Link copied to clipboard
fun FileInfo.getThumbnailUrl(): String?
fun ImageInfo.getThumbnailUrl(): String?
fun VideoInfo.getThumbnailUrl(): String?

Get the url of the encrypted thumbnail or of the thumbnail.