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 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 pendingMessages: List<PendingMessage> = emptyList(), val pinnedMessages: List<Message> = listOf(), val ownCapabilities: Set<String> = setOf(), val membership: Member? = null, val cachedLatestMessages: List<Message> = emptyList(), val isInsideSearch: Boolean = false, val draftMessage: DraftMessage? = null, val activeLiveLocations: List<Location> = emptyList(), val messageCount: Int? = null, val pushPreference: PushPreference? = null, val filterTags: List<String> = emptyList(), val lastMessageAt: Date? = null, val truncatedAt: Date? = null, val disabled: Boolean = false, val blocked: Boolean? = null, val truncatedBy: User? = null, val autoTranslationEnabled: Boolean = false, val autoTranslationLanguages: Set<String> = emptySet(), val scheduledMessages: List<ScheduledMessage>? = null, val activeMemberCount: Int? = null, 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.

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.

pendingMessages

The list of pending messages in the channel for the current user (if the feature enabled).

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 newest 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.

draftMessage

The draft message for the channel.

activeLiveLocations

The list of active live locations in the channel.

messageCount

The total number of messages in the channel.

pushPreference

Channel-specific push preferences (if set).

filterTags

The list of filter tags applied to the channel.

lastMessageAt

Date/time of the last message sent.

truncatedAt

Date/time of the last truncation, if the channel was ever truncated.

disabled

Whether the channel is disabled or not.

blocked

Whether the channel is blocked or not. Note that the field is not provided by every endpoint, nor in the events.

truncatedBy

The user who last truncated the channel, if it was truncated by a user.

autoTranslationEnabled

Whether messages in the channel are translated automatically.

autoTranslationLanguages

The language codes messages are translated to when autoTranslationEnabled is set.

scheduledMessages

The current user's scheduled messages in the channel, pending ones first, each sorted by ScheduledMessage.scheduledAt, or null when they are not known. The channel state of a channel has the ones known on the device. A channel query with includeScheduledMessages returns all the ones the server has, or null when the server did not send them: the feature is off, the server could not read them, or they are more than 100 in the channel, or in all the channels of the page for a channels query. Other channels, for example from events or the offline storage, have null.

activeMemberCount

Number of members whose users are neither deactivated nor deleted. Only filled when the channels are queried with QueryChannelsRequest.includeActiveMemberCount, and kept from the last such query otherwise. Null when it was never requested, or when the server could not compute it in time. Use memberCount when it is null. Requesting it fails the whole query when the returned channels have more than 50,000 members in total.

Constructors

Link copied to clipboard
constructor(id: String = "", type: String = "", name: String = "", image: String = "", watcherCount: Int = 0, frozen: Boolean = false, 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, pendingMessages: List<PendingMessage> = emptyList(), pinnedMessages: List<Message> = listOf(), ownCapabilities: Set<String> = setOf(), membership: Member? = null, cachedLatestMessages: List<Message> = emptyList(), isInsideSearch: Boolean = false, draftMessage: DraftMessage? = null, activeLiveLocations: List<Location> = emptyList(), messageCount: Int? = null, pushPreference: PushPreference? = null, filterTags: List<String> = emptyList(), lastMessageAt: Date? = null, truncatedAt: Date? = null, disabled: Boolean = false, blocked: Boolean? = null, truncatedBy: User? = null, autoTranslationEnabled: Boolean = false, autoTranslationLanguages: Set<String> = emptySet(), scheduledMessages: List<ScheduledMessage>? = null, activeMemberCount: Int? = null, extraData: Map<String, Any> = mapOf())

Types

Link copied to clipboard
class Builder

Properties

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 cid: String

The channel id in the format messaging:123.

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
open override val extraData: Map<String, Any>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Whether a channel contains unread messages or not.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

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
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
Link copied to clipboard
Link copied to clipboard
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
open fun <T> getExtraValue(key: String, default: T): T

Returns the value associated with the given key, or default if the key is not present in the extraData.

Link copied to clipboard

Updates the given Channel with data from another Channel object. Keeps the current members when that has members but lists none, as events of large channels leave them out.

Link copied to clipboard
Link copied to clipboard

Converts the channel to the channel data.