ChannelClient

Properties

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

Functions

Link copied to clipboard
fun acceptInvite(message: String?): Call<Channel>
Link copied to clipboard
fun addMembers(memberIds: List<String>, systemMessage: Message? = null, hideHistory: Boolean? = null, skipPush: Boolean? = null): Call<Channel>

Adds members to a given channel.

Link copied to clipboard
fun banUser(targetId: String, reason: String?, timeout: Int?): Call<Unit>
Link copied to clipboard
fun create(memberIds: List<String>, extraData: Map<String, Any>): Call<Channel>

Creates the id-based channel.

Link copied to clipboard
Link copied to clipboard

Deletes the file represented by url from the given channel.

Link copied to clipboard

Deletes the image represented by url from the given channel.

Link copied to clipboard
fun deleteMessage(messageId: String, hard: Boolean = false): Call<Message>
Link copied to clipboard
fun deleteReaction(messageId: String, reactionType: String): Call<Message>

Deletes the reaction associated with the message with the given message id.

Link copied to clipboard

Disables slow mode for the channel.

Link copied to clipboard
fun enableSlowMode(cooldownTimeInSeconds: Int): Call<Channel>

Enables slow mode for the channel. When slow mode is enabled, users can only send a message every cooldownTimeInSeconds time interval. The cooldownTimeInSeconds is specified in seconds, and should be between 1-120.

Link copied to clipboard
fun get(messageLimit: Int = 0, memberLimit: Int = 0, state: Boolean = false): Call<Channel>

Gets the channel.

Link copied to clipboard
fun getFileAttachments(offset: Int, limit: Int): Call<List<Attachment>>
Link copied to clipboard
fun getImageAttachments(offset: Int, limit: Int): Call<List<Attachment>>
Link copied to clipboard
fun getMessage(messageId: String): Call<Message>
Link copied to clipboard
fun getMessagesWithAttachments(offset: Int, limit: Int, types: List<String>): Call<List<Message>>

Returns a Call with messages that contain at least one desired type attachment but not necessarily all of them will have a specified type.

Link copied to clipboard

Returns a list of messages pinned in the channel. You can sort the list by specifying sort parameter. Keep in mind that for now we only support sorting by Message.pinnedAt. The list can be paginated in a few different ways using limit and pagination.

Link copied to clipboard
fun getReactions(messageId: String, offset: Int, limit: Int): Call<List<Reaction>>
fun getReactions(messageId: String, firstReactionId: String, limit: Int): Call<List<Message>>
Link copied to clipboard
fun hide(clearHistory: Boolean = false): Call<Unit>

Hides the channel.

Link copied to clipboard
fun inviteMembers(memberIds: List<String>, systemMessage: Message? = null, skipPush: Boolean? = null): Call<Channel>

Invites members to a given channel.

Link copied to clipboard
fun keystroke(parentId: String? = null): Call<ChatEvent>

Sends a start typing event EventType.TYPING_START in this channel to the server.

Link copied to clipboard
fun markMessageRead(messageId: String): Call<Unit>
Link copied to clipboard
Link copied to clipboard
fun markThreadRead(threadId: String): Call<Unit>

Marks a given thread in the channel as read.

Link copied to clipboard
fun markThreadUnread(threadId: String, messageId: String): Call<Unit>

Marks a given thread in the channel starting from the given message as unread.

Link copied to clipboard
fun markUnread(messageId: String): Call<Unit>
Link copied to clipboard
fun mute(expiration: Int? = null): Call<Unit>

Mutes a channel for the current user. Messages added to the channel will not trigger push notifications, and will not change the unread count for the users that muted it. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set an expiration time. Triggers notification.channel_mutes_updated event.

Link copied to clipboard
Link copied to clipboard
fun muteUser(userId: String, timeout: Int? = null): Call<Mute>

Mutes a user. Messages from muted users will not trigger push notifications. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set a mute timeout. Triggers notification.mutes_updated event.

Link copied to clipboard
fun pinMessage(message: Message, expirationDate: Date?): Call<Message>
fun pinMessage(message: Message, timeout: Int): Call<Message>
Link copied to clipboard
Link copied to clipboard
fun queryBannedUsers(filter: FilterObject? = null, sort: QuerySorter<BannedUsersSort> = QuerySortByField.ascByName("created_at"), offset: Int? = null, limit: Int? = null, createdAtAfter: Date? = null, createdAtAfterOrEqual: Date? = null, createdAtBefore: Date? = null, createdAtBeforeOrEqual: Date? = null): Call<List<BannedUser>>
Link copied to clipboard
fun queryMembers(offset: Int, limit: Int, filter: FilterObject, sort: QuerySorter<Member>, members: List<Member> = emptyList()): Call<List<Member>>

Queries members for this channel.

Link copied to clipboard
Link copied to clipboard
fun removeMembers(memberIds: List<String>, systemMessage: Message? = null, skipPush: Boolean? = null): Call<Channel>

Removes members from a given channel.

Link copied to clipboard
fun removeShadowBan(targetId: String): Call<Unit>
Link copied to clipboard
Link copied to clipboard
fun sendEvent(eventType: String, extraData: Map<Any, Any> = emptyMap()): Call<ChatEvent>

Sends an event to all users watching the channel.

Link copied to clipboard
fun sendFile(file: File, callback: ProgressCallback? = null): Call<UploadedFile>

Uploads a file for the given channel. Progress can be accessed via callback.

Link copied to clipboard

Uploads an image for the given channel. Progress can be accessed via callback.

Link copied to clipboard
fun sendMessage(message: Message, isRetrying: Boolean = false): Call<Message>

Sends the message to the given channel with side effects if there is any plugin added in the client.

Link copied to clipboard
fun sendReaction(reaction: Reaction, enforceUnique: Boolean = false): Call<Reaction>

Sends the reaction. Use enforceUnique parameter to specify whether the reaction should replace other reactions added by the current user.

Link copied to clipboard
fun shadowBanUser(targetId: String, reason: String?, timeout: Int?): Call<Unit>
Link copied to clipboard
fun show(): Call<Unit>
Link copied to clipboard
fun stopTyping(parentId: String? = null): Call<ChatEvent>

Sends a stop typing event EventType.TYPING_STOP in this channel to the server.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun subscribeFor(vararg eventTypes: Class<out ChatEvent>, listener: ChatEventListener<ChatEvent>): Disposable
fun subscribeFor(vararg eventTypes: String, listener: ChatEventListener<ChatEvent>): Disposable
fun subscribeFor(lifecycleOwner: LifecycleOwner, vararg eventTypes: Class<out ChatEvent>, listener: ChatEventListener<ChatEvent>): Disposable
fun subscribeFor(lifecycleOwner: LifecycleOwner, vararg eventTypes: String, listener: ChatEventListener<ChatEvent>): Disposable
Link copied to clipboard
Link copied to clipboard
fun truncate(systemMessage: Message? = null): Call<Channel>

Removes all of the messages of the channel but doesn't affect the channel data or members.

Link copied to clipboard
fun unbanUser(targetId: String): Call<Unit>
Link copied to clipboard
fun unmute(): Call<Unit>

Unmutes a channel for the current user. Triggers notification.channel_mutes_updated event.

Link copied to clipboard
Link copied to clipboard
fun unmuteUser(userId: String): Call<Unit>

Unmutes a previously muted user. Triggers notification.mutes_updated event.

Link copied to clipboard
Link copied to clipboard
fun update(message: Message? = null, extraData: Map<String, Any> = emptyMap()): Call<Channel>

Updates all of the channel data. Any data that is present on the channel and not included in a full update will be deleted.

Link copied to clipboard
Link copied to clipboard
fun updatePartial(set: Map<String, Any> = emptyMap(), unset: List<String> = emptyList()): Call<Channel>

Updates specific fields of channel data retaining the custom data fields which were set previously.

Link copied to clipboard

Inherited functions

Link copied to clipboard

Subscribes to events of type T in the channel.

inline fun <T : ChatEvent> ChannelClient.subscribeFor(lifecycleOwner: LifecycleOwner, listener: ChatEventListener<T>): Disposable

Subscribes to events of type T in the channel, in the lifecycle of lifecycleOwner.

Subscribes to the specific eventTypes of the channel.

fun ChannelClient.subscribeFor(lifecycleOwner: LifecycleOwner, vararg eventTypes: KClass<out ChatEvent>, listener: ChatEventListener<ChatEvent>): Disposable

Subscribes to the specific eventTypes of the channel, in the lifecycle of lifecycleOwner.

Link copied to clipboard

Subscribes for the next channel event of type T.