ChatThreadHandler

Instance of a thread handler. This instance will contain the most up-to-date thread, even newer than the thread it was created from.

This object will not transfer any changes to the parent object and all updates are contained within this class. It's up to the client to keep the instance alive as long as they need it.

Creating the handler may trigger mode- and thread-state-dependent background work — for example welcome-message handling, and in live-chat configurations thread recovery and begin-conversation — so construction is not guaranteed to be free of side effects. The most visible case for integrators is the live-chat welcome message, delivered eagerly as the thread's first message at most once per thread; see ChatThreadsHandler.thread.

Properties

Link copied to clipboard
abstract val threadFlow: Flow<ChatThread>

A Flow of ChatThread updates for this handler. Emits the current thread state and subsequent updates triggered by thread recovered events (triggered by refresh), message events (triggered by messages and its methods), and metadata events.

Functions

Link copied to clipboard

Return new instance of thread action handler for this ChatThread.

Link copied to clipboard
abstract suspend fun archive(): Boolean

Requests that the server archive this thread.

Link copied to clipboard

Returns new instance of field handler for this ChatThread.

Link copied to clipboard
abstract fun endContact()

Terminate the contact.

Link copied to clipboard

Returns new instance of thread event handler for this ChatThread.

Link copied to clipboard
abstract fun get(): ChatThread

Returns the latest thread snapshot observed on this handler. This value is safe to call on the main thread.

Link copied to clipboard

Returns new instance of message handler for this ChatThread.

Link copied to clipboard
abstract fun refresh()

Notifies the server asynchronously that client wants the thread to be refreshed. The request can be performed even if the client doesn't expect new data. In which case the get returns updated value anyway.

Link copied to clipboard
abstract fun setName(name: String)

Notifies the server asynchronously that client wants to change the thread name to the supplied name. The change can fail, though if it doesn't get methods will return updated thread.