Message

data class Message(    var id: String = "",     var cid: String = "",     var text: String = "",     val html: String = "",     var parentId: String? = null,     var command: String? = null,     var attachments: MutableList<Attachment> = mutableListOf(),     var mentionedUsersIds: MutableList<String> = mutableListOf(),     var mentionedUsers: MutableList<User> = mutableListOf(),     var replyCount: Int = 0,     var reactionCounts: MutableMap<String, Int> = mutableMapOf(),     var reactionScores: MutableMap<String, Int> = mutableMapOf(),     var syncStatus: SyncStatus = SyncStatus.COMPLETED,     var syncDescription: MessageSyncDescription? = null,     var type: String = "",     var latestReactions: MutableList<Reaction> = mutableListOf(),     var ownReactions: MutableList<Reaction> = mutableListOf(),     var createdAt: Date? = null,     var updatedAt: Date? = null,     var deletedAt: Date? = null,     var updatedLocallyAt: Date? = null,     var createdLocallyAt: Date? = null,     var user: User = User(),     var extraData: MutableMap<String, Any> = mutableMapOf(),     var silent: Boolean = false,     var shadowed: Boolean = false,     val i18n: Map<String, String> = mapOf(),     var showInChannel: Boolean = false,     var channelInfo: ChannelInfo? = null,     var replyTo: Message? = null,     var replyMessageId: String? = null,     var pinned: Boolean = false,     var pinnedAt: Date? = null,     var pinExpires: Date? = null,     var pinnedBy: User? = null,     var threadParticipants: List<User> = emptyList()) : CustomObject, ComparableFieldProvider

Constructors

Link copied to clipboard
fun Message(    id: String = "",     cid: String = "",     text: String = "",     html: String = "",     parentId: String? = null,     command: String? = null,     attachments: MutableList<Attachment> = mutableListOf(),     mentionedUsersIds: MutableList<String> = mutableListOf(),     mentionedUsers: MutableList<User> = mutableListOf(),     replyCount: Int = 0,     reactionCounts: MutableMap<String, Int> = mutableMapOf(),     reactionScores: MutableMap<String, Int> = mutableMapOf(),     syncStatus: SyncStatus = SyncStatus.COMPLETED,     syncDescription: MessageSyncDescription? = null,     type: String = "",     latestReactions: MutableList<Reaction> = mutableListOf(),     ownReactions: MutableList<Reaction> = mutableListOf(),     createdAt: Date? = null,     updatedAt: Date? = null,     deletedAt: Date? = null,     updatedLocallyAt: Date? = null,     createdLocallyAt: Date? = null,     user: User = User(),     extraData: MutableMap<String, Any> = mutableMapOf(),     silent: Boolean = false,     shadowed: Boolean = false,     i18n: Map<String, String> = mapOf(),     showInChannel: Boolean = false,     channelInfo: ChannelInfo? = null,     replyTo: Message? = null,     replyMessageId: String? = null,     pinned: Boolean = false,     pinnedAt: Date? = null,     pinExpires: Date? = null,     pinnedBy: User? = null,     threadParticipants: List<User> = emptyList())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var attachments: MutableList<Attachment>

The list of message attachments

Link copied to clipboard
var channelInfo: ChannelInfo? = null
Link copied to clipboard
var cid: String

Channel unique identifier in : format

Link copied to clipboard
var command: String? = null

Contains provided slash command

Link copied to clipboard
var createdAt: Date? = null

When the message was created

Link copied to clipboard
var createdLocallyAt: Date? = null

When the message was created locally

Link copied to clipboard
var deletedAt: Date? = null

When the message was deleted

Link copied to clipboard
open override var extraData: MutableMap<String, Any>

All the custom data provided for this message

Link copied to clipboard
val html: String

The message text formatted as HTML

Link copied to clipboard
val i18n: Map<String, String>

Mapping with translations. Key language contains the original language key. Other keys contain translations.

Link copied to clipboard
var id: String

The unique string identifier of the message. This is either created by Stream or set on the client side when the message is added.

Link copied to clipboard
var latestReactions: MutableList<Reaction>

List of the latest reactions to this message

Link copied to clipboard
var mentionedUsers: MutableList<User>

The list of user mentioned in the message

Link copied to clipboard
var mentionedUsersIds: MutableList<String>

The list of user mentioned in the message

Link copied to clipboard
var ownReactions: MutableList<Reaction>

List of reactions of authenticated user to this message

Link copied to clipboard
var parentId: String? = null

The ID of the parent message, if the message is a thread reply

Link copied to clipboard
var pinExpires: Date? = null

Date when pinned message expires

Link copied to clipboard
var pinned: Boolean = false

Whether message is pinned or not

Link copied to clipboard
var pinnedAt: Date? = null

Date when the message got pinned

Link copied to clipboard
var pinnedBy: User? = null

Contains user who pinned the message

Link copied to clipboard
var reactionCounts: MutableMap<String, Int>

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

Link copied to clipboard
var reactionScores: MutableMap<String, Int>

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

Link copied to clipboard
var replyCount: Int = 0

The number of replies to this message

Link copied to clipboard
var replyMessageId: String? = null

The ID of the quoted message, if the message is a quoted reply.

Link copied to clipboard
var replyTo: Message? = null

Contains quoted message

Link copied to clipboard
var shadowed: Boolean = false

If the message was sent by shadow banned user

Link copied to clipboard
var showInChannel: Boolean = false

Whether thread reply should be shown in the channel as well

Link copied to clipboard
var silent: Boolean = false

Whether message is silent or not

Link copied to clipboard
var syncDescription: MessageSyncDescription? = null

Contains details related to syncStatus.

Link copied to clipboard
var syncStatus: SyncStatus

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

Link copied to clipboard
var text: String

The text of this message

Link copied to clipboard
var threadParticipants: List<User>

The list of users who participate in thread

Link copied to clipboard
var type: String

Contains type of the message. Can be one of the following: regular, ephemeral, error, reply, system, deleted.

Link copied to clipboard
var updatedAt: Date? = null

When the message was updated

Link copied to clipboard
var updatedLocallyAt: Date? = null

When the message was updated locally

Link copied to clipboard
var user: User

The user who sent the message

Functions

Link copied to clipboard
open override fun getComparableField(fieldName: String): Comparable<*>?

Gets a comparable fields from a name.

Inherited functions

Link copied to clipboard
open fun <T> getExtraValue(key: String, default: T): T
Link copied to clipboard
open fun putExtraValue(key: String, value: Any)

Extensions

Link copied to clipboard
fun Message.addMyReaction(reaction: Reaction, enforceUnique: Boolean = false)
Link copied to clipboard
fun Message.createdAfter(that: Message): Boolean

Tests if this message was created after that message.

Link copied to clipboard
fun Message.enrichWithCid(cid: String): Message
Link copied to clipboard
fun Message.getTranslation(language: String): String
Link copied to clipboard
fun Message.hasPendingAttachments(): Boolean
Link copied to clipboard
fun Message.isEphemeral(): Boolean
Link copied to clipboard
val Message.originalLanguage: String
Link copied to clipboard
fun Message.populateMentions(channel: Channel)
Link copied to clipboard
fun Message.removeMyReaction(reaction: Reaction)
Link copied to clipboard
fun Message.shouldIncrementUnreadCount(    currentUserId: String,     lastMessageAtDate: Date?,     isChannelMuted: Boolean): Boolean

Function that parses if the unread count should be increased or not.

Link copied to clipboard
fun Message.updateFailedMessage(chatError: ChatError): Message

Updates a message that whose request (Edition/Delete/Reaction update...) has failed.

Link copied to clipboard
fun Message.updateMessageOnlineState(isOnline: Boolean): Message

Update the online state of a message.

Link copied to clipboard
fun Message.updateUsers(users: Map<String, User>): Message

Updates a message with more recent data of users. It updates author user, latestReactions, replyTo message, mentionedUsers, threadParticipants and pinnedBy user of this instance.

Link copied to clipboard
fun Message.users(): List<User>
Link copied to clipboard
fun Message.wasCreatedAfter(date: Date?): Boolean
Link copied to clipboard
fun Message.wasCreatedAfterOrAt(date: Date?): Boolean
Link copied to clipboard
fun Message.wasCreatedBefore(date: Date?): Boolean
Link copied to clipboard
fun Message.wasCreatedBeforeOrAt(date: Date?): Boolean