library / io.getstream.chat.android.livedata.entity / MessageEntity

MessageEntity

data class MessageEntity

The Message Entity. Text and attachments are the most commonly used fields.

You can convert a Message object from the low level client to a MessageEntity like this: val messageEntity = MessageEntity(message) and back: messageEntity.toMessage()

Constructors

<init>

create a messageEntity from a message object

MessageEntity(m: Message)

The Message Entity. Text and attachments are the most commonly used fields.

MessageEntity(id: String, cid: String, userId: String)

Properties

attachments

the list of attachments

var attachments: MutableList<Attachment>

cid

var cid: String

command

slash command like /giphy etc

var command: String?

commandInfo

command info

var commandInfo: Map<String, String>?

createdAt

when the message was created

var createdAt: Date?

deletedAt

when the message was deleted

var deletedAt: Date?

extraData

all the custom data provided for this message

var extraData: MutableMap<String, Any>

id

var id: String

latestReactions

the last 5 reactions on this message

var latestReactions: MutableList<ReactionEntity>

mentionedUsersId

the users mentioned in this message

var mentionedUsersId: MutableList<String>

ownReactions

the reactions from the current user

var ownReactions: MutableList<ReactionEntity>

parentId

parent id, used for threads

var parentId: String?

reactionCounts

a mapping between reaction type and the count, ie like:10, heart:4

var reactionCounts: MutableMap<String, Int>

reactionScores

a mapping between reaction type and the reaction score, ie like:10, heart:4

var reactionScores: MutableMap<String, Int>

replyCount

the number of replies

var replyCount: Int

sendMessageCompletedAt

tracks when send message was completed

var sendMessageCompletedAt: Date?

syncStatus

if the message has been synced to the servers, default is synced

var syncStatus: SyncStatus

text

the message text

var text: String

type

message type can be system, regular or ephemeral

var type: String

updatedAt

when the message was updated

var updatedAt: Date?

userId

var userId: String

Functions

addReaction

add a reaction to this message. updated the own reactions, latestReactions, reaction Count

fun addReaction(reaction: Reaction, isMine: Boolean): Unit

removeReaction

fun removeReaction(reaction: Reaction, updateCounts: Boolean = false): Unit

toMessage

converts a message entity into a message object

fun toMessage(userMap: Map<String, User>): Message