Functions

Link copied to clipboard
Link copied to clipboard
open suspend override fun onAttachmentSendRequest(channelType: String, channelId: String, message: Message)

Updates the SDK before the attachments are sent to backend. It can be used to update the database with the message whose attachments are going to be sent or to change the state of the messages that are presented to the end user.

Link copied to clipboard
open suspend override fun onChannelMarkReadPrecondition(channelType: String, channelId: String): Result<Unit>

Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open override fun onCreateChannelPrecondition(currentUser: User?, channelId: String, memberIds: List<String>): Result<Unit>

Runs precondition check for ChatClient.createChannel. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.

Link copied to clipboard
open suspend override fun onCreateChannelRequest(channelType: String, channelId: String, params: CreateChannelParams, currentUser: User)
open suspend override fun onCreateChannelRequest(channelType: String, channelId: String, memberIds: List<String>, extraData: Map<String, Any>, currentUser: User)

A method called before making an API call to create a channel.

Link copied to clipboard
open suspend override fun onCreateChannelResult(channelType: String, channelId: String, memberIds: List<String>, result: Result<Channel>)

A method called after receiving the response from the create channel call.

Link copied to clipboard
open suspend override fun onDeleteChannelPrecondition(currentUser: User?, channelType: String, channelId: String): Result<Unit>

Runs precondition check for ChatClient.deleteChannel. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.

Link copied to clipboard
open suspend override fun onDeleteChannelRequest(currentUser: User?, channelType: String, channelId: String)

A method called before making an API call to delete a channel.

Link copied to clipboard
open suspend override fun onDeleteChannelResult(channelType: String, channelId: String, result: Result<Channel>)

A method called after receiving the response from the delete channel call.

Link copied to clipboard
open override fun onDeleteReactionPrecondition(currentUser: User?): Result<Unit>

Runs precondition check for ChatClient.deleteReaction. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.

Link copied to clipboard
open suspend override fun onDeleteReactionRequest(cid: String?, messageId: String, reactionType: String, currentUser: User)

A method called before making an API call to delete the reaction.

Link copied to clipboard
open suspend override fun onDeleteReactionResult(cid: String?, messageId: String, reactionType: String, currentUser: User, result: Result<Message>)

A method called after receiving the response from the delete reaction call.

Link copied to clipboard
open suspend override fun onFetchCurrentUserResult(result: Result<User>)

Called when the current user is fetched from the backend.

Link copied to clipboard
open suspend override fun onGetMessageResult(messageId: String, result: Result<Message>)

Method called when the API call requesting a single new message has completed.

Link copied to clipboard
open suspend override fun onGetNewerRepliesRequest(parentId: String, limit: Int, lastId: String?)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onGetNewerRepliesResult(result: Result<List<Message>>, parentId: String, limit: Int, lastId: String?)

Runs this function on the result of the ChatClient.getNewerReplies request.

Link copied to clipboard
open suspend override fun onGetRepliesMoreRequest(parentId: String, firstId: String, limit: Int)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onGetRepliesMoreResult(result: Result<List<Message>>, parentId: String, firstId: String, limit: Int)

Runs this function on the result of the ChatClient.getRepliesMore request.

Link copied to clipboard
open suspend override fun onGetRepliesRequest(parentId: String, limit: Int)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onGetRepliesResult(result: Result<List<Message>>, parentId: String, limit: Int)

Runs this function on the result of the ChatClient.getReplies request.

Link copied to clipboard
open override fun onGiphySendResult(cid: String, result: Result<Message>)

A method called after receiving the response from the send Giphy call.

Link copied to clipboard
open suspend override fun onHideChannelPrecondition(channelType: String, channelId: String, clearHistory: Boolean): Result<Unit>

Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open suspend override fun onHideChannelRequest(channelType: String, channelId: String, clearHistory: Boolean)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onHideChannelResult(result: Result<Unit>, channelType: String, channelId: String, clearHistory: Boolean)

Runs this function on the result of the request.

Link copied to clipboard
open suspend override fun onMarkAllReadRequest()

Register this side effect to run just before actual ChatClient.markAllRead request is launched.

Link copied to clipboard
open suspend override fun onMessageDeletePrecondition(messageId: String): Result<Unit>

Runs precondition check for ChatClient.deleteMessage. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.

Link copied to clipboard
open suspend override fun onMessageDeleteRequest(messageId: String)

Method called when a request to delete a message in the API happens

Link copied to clipboard
open suspend override fun onMessageDeleteResult(originalMessageId: String, result: Result<Message>)

Method called when a request for message deletion return. Use it to update database, update messages or to present an error to the user.

Link copied to clipboard
open suspend override fun onMessageEditRequest(message: Message)

Method called when a request for message edition happens. Use it to update database, update messages in the SDK, update the UI when a message occurs...

Link copied to clipboard
open suspend override fun onMessageEditResult(originalMessage: Message, result: Result<Message>)

Method called when a request for message edition return. Use it to update database, update messages or to present an error to the user.

Link copied to clipboard
open suspend override fun onMessageSendResult(result: Result<Message>, channelType: String, channelId: String, message: Message)

Side effect to be invoked when the original request is completed with a response.

Link copied to clipboard
open suspend override fun onQueryChannelPrecondition(channelType: String, channelId: String, request: QueryChannelRequest): Result<Unit>

Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open suspend override fun onQueryChannelRequest(channelType: String, channelId: String, request: QueryChannelRequest)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onQueryChannelResult(result: Result<Channel>, channelType: String, channelId: String, request: QueryChannelRequest)

Runs this function on the result of the request.

Link copied to clipboard
open suspend override fun onQueryChannelsPrecondition(request: QueryChannelsRequest): Result<Unit>

Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open suspend override fun onQueryChannelsRequest(request: QueryChannelsRequest)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onQueryChannelsResult(result: Result<List<Channel>>, request: QueryChannelsRequest)

Runs this function on the Result of this QueryChannelsRequest.

Link copied to clipboard
open suspend override fun onQueryMembersResult(result: Result<List<Member>>, channelType: String, channelId: String, offset: Int, limit: Int, filter: FilterObject, sort: QuerySorter<Member>, members: List<Member>)

Runs this function on the Result of this request.

Link copied to clipboard
open suspend override fun onQueryThreadsPrecondition(request: QueryThreadsRequest): Result<Unit>

Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open suspend override fun onQueryThreadsRequest(request: QueryThreadsRequest)

Runs side effect before the request is launched.

Link copied to clipboard
open suspend override fun onQueryThreadsResult(result: Result<QueryThreadsResult>, request: QueryThreadsRequest)

Runs side effect the request was completed.

Link copied to clipboard
open suspend override fun onSendReactionPrecondition(currentUser: User?, reaction: Reaction): Result<Unit>

Runs precondition check for ChatClient.sendReaction. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.

Link copied to clipboard
open suspend override fun onSendReactionRequest(cid: String?, reaction: Reaction, enforceUnique: Boolean, currentUser: User)

A method called before making an API call to send the reaction.

Link copied to clipboard
open suspend override fun onSendReactionResult(cid: String?, reaction: Reaction, enforceUnique: Boolean, currentUser: User, result: Result<Reaction>)

A method called after receiving the response from the send reaction call.

Link copied to clipboard
open suspend override fun onShuffleGiphyResult(cid: String, result: Result<Message>)

A method called after receiving the response from the shuffle Giphy call.

Link copied to clipboard
open override fun onTypingEventPrecondition(eventType: String, channelType: String, channelId: String, extraData: Map<Any, Any>, eventTime: Date): Result<Unit>

Runs this precondition before ChatClient.keystroke and ChatClient.stopTyping request is invoked.

Link copied to clipboard
open override fun onTypingEventRequest(eventType: String, channelType: String, channelId: String, extraData: Map<Any, Any>, eventTime: Date)

Runs this side effect before ChatClient.keystroke and ChatClient.stopTyping request is invoked.

Link copied to clipboard
open override fun onTypingEventResult(result: Result<ChatEvent>, eventType: String, channelType: String, channelId: String, extraData: Map<Any, Any>, eventTime: Date)

Runs this side effect after ChatClient.keystroke and ChatClient.stopTyping request is completed.

Link copied to clipboard
abstract fun onUserDisconnected()
Link copied to clipboard
abstract fun onUserSet(user: User)

Inherited functions

Link copied to clipboard
open suspend fun onGetRepliesPrecondition(parentId: String): Result<Unit>

Runs precondition check for ChatClient.getReplies, ChatClient.getNewerReplies and ChatClient.getRepliesMore. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.

Link copied to clipboard
open fun <T : Any> resolveDependency(klass: KClass<T>): T?

Resolves dependencies to T objects.