Channel

@Immutable
data class Channel(val id: String = "", val type: String = "", val name: String = "", val image: String = "", val watcherCount: Int = 0, val frozen: Boolean = false, val lastMessageAt: Date? = null, val createdAt: Date? = null, val deletedAt: Date? = null, val updatedAt: Date? = null, val syncStatus: SyncStatus = SyncStatus.COMPLETED, val memberCount: Int = 0, val messages: List<Message> = listOf(), val members: List<Member> = listOf(), val watchers: List<User> = listOf(), val read: List<ChannelUserRead> = listOf(), val config: Config = Config(), val createdBy: User = User(), val unreadCount: Int = 0, val team: String = "", val hidden: Boolean? = null, val hiddenMessagesBefore: Date? = null, val cooldown: Int = 0, val pinnedMessages: List<Message> = listOf(), val ownCapabilities: Set<String> = setOf(), val membership: Member? = null, val cachedLatestMessages: List<Message> = emptyList(), val isInsideSearch: Boolean = false, val extraData: Map<String, Any> = mapOf()) : CustomObject, ComparableFieldProvider

Channel is where conversations take place between two or more chat users. It contains a list of messages and have a list of the member users that are participating in the conversation.

Parameters

id

Channel's unique ID.

type

Type of the channel.

name

Channel's name.

image

Channel's image.

watcherCount

Number of channel watchers.

frozen

Whether channel is frozen or not.

lastMessageAt

Date of the last message sent.

createdAt

Date/time of creation.

deletedAt

Date/time of deletion.

updatedAt

Date/time of the last update.

syncStatus

Local field used to store channel's sync status and retry requests if needed.

memberCount

Number of members in the channel.

messages

The list of channel's messages.

members

The list of channel's members.

watchers

The list of channel's watchers.

read

The list of read states.

config

Channel's configuration.

createdBy

Creator of the channel.

unreadCount

The number of unread messages for the current user.

team

Team the channel belongs to (multi-tenant only).

hidden

Whether this channel is hidden by current user or not.

hiddenMessagesBefore

Messages before this date are hidden from the user.

cooldown

Cooldown period after sending each message in seconds.

pinnedMessages

The list of pinned messages in the channel.

ownCapabilities

Channel's capabilities available for the current user. Note that the field is not provided in the events.

membership

Represents relationship of the current user to this channel.

extraData

A map of custom fields for the channel.

cachedLatestMessages

The list of cached messages if the regular list does not contain the newest messages.

isInsideSearch

When the channel is inside search, eg. searching from the channel list for a message or when hopping to a quoted message a number pages away without retaining the newest messages in the list.

Constructors

Link copied to clipboard
constructor(id: String = "", type: String = "", name: String = "", image: String = "", watcherCount: Int = 0, frozen: Boolean = false, lastMessageAt: Date? = null, createdAt: Date? = null, deletedAt: Date? = null, updatedAt: Date? = null, syncStatus: SyncStatus = SyncStatus.COMPLETED, memberCount: Int = 0, messages: List<Message> = listOf(), members: List<Member> = listOf(), watchers: List<User> = listOf(), read: List<ChannelUserRead> = listOf(), config: Config = Config(), createdBy: User = User(), unreadCount: Int = 0, team: String = "", hidden: Boolean? = null, hiddenMessagesBefore: Date? = null, cooldown: Int = 0, pinnedMessages: List<Message> = listOf(), ownCapabilities: Set<String> = setOf(), membership: Member? = null, cachedLatestMessages: List<Message> = emptyList(), isInsideSearch: Boolean = false, extraData: Map<String, Any> = mapOf())

Types

Link copied to clipboard
class Builder

Properties

Link copied to clipboard
Link copied to clipboard
val cid: String

The channel id in the format messaging:123.

Link copied to clipboard
Link copied to clipboard
val cooldown: Int = 0
Link copied to clipboard
val createdAt: Date? = null
Link copied to clipboard
Link copied to clipboard
val deletedAt: Date? = null
Link copied to clipboard
open override val extraData: Map<String, Any>
Link copied to clipboard
val frozen: Boolean = false
Link copied to clipboard

Whether a channel contains unread messages or not.

Link copied to clipboard
val hidden: Boolean? = null
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
val isInsideSearch: Boolean = false
Link copied to clipboard
val lastMessageAt: Date? = null
Link copied to clipboard

Determines the last updated date/time. Returns either lastMessageAt or createdAt.

Link copied to clipboard
val memberCount: Int = 0
Link copied to clipboard
Link copied to clipboard
val membership: Member? = null
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val unreadCount: Int = 0
Link copied to clipboard
val updatedAt: Date? = null
Link copied to clipboard
val watcherCount: Int = 0
Link copied to clipboard

Functions

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

Gets a comparable fields from a name.

Link copied to clipboard

Inherited functions

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

Converts the channel to the channel data.