ChannelData

@Immutable
data class ChannelData(val id: String, val type: String, val name: String = "", val image: String = "", val createdBy: User = User(), val cooldown: Int = 0, val frozen: Boolean = false, val createdAt: Date? = null, val updatedAt: Date? = null, val deletedAt: Date? = null, val memberCount: Int = 0, val team: String = "", val extraData: Map<String, Any> = mapOf(), val ownCapabilities: Set<String> = setOf(), val membership: Member? = null)

A class that only stores the channel data and not the channel state that changes a lot (for example messages, watchers, etc.).

Parameters

id

Channel's unique ID.

type

Type of the channel.

name

Channel's name.

image

Channel's image.

createdBy

Creator of the channel.

cooldown

Cooldown period after sending each message in seconds.

frozen

Whether channel is frozen or not.

createdAt

Date/time of creation.

updatedAt

Date/time of the last update.

deletedAt

Date/time of deletion.

memberCount

Number of members in the channel.

team

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

extraData

A map of custom fields for 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 the channel.

Constructors

Link copied to clipboard
constructor(channel: Channel, currentOwnCapabilities: Set<String>)

Creates a ChannelData entity from a Channel object. Keeps existing ChannelData.ownCapabilities if the Channel object comes with an empty set of capabilities.

constructor(id: String, type: String, name: String = "", image: String = "", createdBy: User = User(), cooldown: Int = 0, frozen: Boolean = false, createdAt: Date? = null, updatedAt: Date? = null, deletedAt: Date? = null, memberCount: Int = 0, team: String = "", extraData: Map<String, Any> = mapOf(), ownCapabilities: Set<String> = setOf(), membership: Member? = null)

Properties

Link copied to clipboard
val cid: String

The channel id in the format messaging:123.

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
Link copied to clipboard
val frozen: Boolean = false
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
val memberCount: Int = 0
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
val updatedAt: Date? = null

Functions

Link copied to clipboard
fun isUserAbleTo(channelCapability: String): Boolean

Checks if the user has specific capabilities.

Link copied to clipboard
fun toChannel(messages: List<Message>, cachedLatestMessages: List<Message>, members: List<Member>, reads: List<ChannelUserRead>, watchers: List<User>, watcherCount: Int, insideSearch: Boolean): Channel

Converts a ChannelData entity to a Channel based on additional information.

Inherited functions

Link copied to clipboard