Chat2Desk

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun fetchMessages()

Fetch message from Chat2Desk service. After fetching process the property IChat2Desk.messages will be updated.

Link copied to clipboard
open suspend override fun flushAll()

Remove all library data like IChat2Desk.messages, IChat2Desk.clientPhone. It will also stop the current connection to the service. After reset, you need to call IChat2Desk.start to start using the library.

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

Resend message if it have status DeliveryStatus.NOT_DELIVERED.

Link copied to clipboard
open suspend override fun sendClientParams(name: String, phone: String, fieldSet: Map<Int, String>)

Send client params. You can send name and phone by default. If you want to send other client field, which declared in Chat2Desk service, you need to use CustomField.id property from IChat2Desk.customFields as key and your value

Link copied to clipboard
open suspend override fun sendMessage(msg: String)

Send the simple message with text.

open suspend override fun sendMessage(msg: String, attachedFile: AttachedFile)

Send the message with attachment.

Link copied to clipboard
open suspend override fun start()

Connect to Chat2Desk and start the chat.

Link copied to clipboard
open suspend override fun stop()

Disconnect from Chat2Desk.

Properties

Link copied to clipboard
open override val connectionStatus: StateFlow<ConnectionState?>

Current connection status.

Link copied to clipboard
open override val customFields: StateFlow<List<CustomField>>

List of custom fields, declared on company.

Link copied to clipboard
open override val error: StateFlow<Throwable?>

Flow with errors.

Link copied to clipboard
open override val messages: StateFlow<List<Message>>

List of Message.

Link copied to clipboard
open override val operator: StateFlow<Operator?>

Current connected operator.

Extensions

Link copied to clipboard
fun Chat2Desk.watchConnectionStatus(): CFlow<ConnectionState?>

Wrapper for connection status

Link copied to clipboard
fun Chat2Desk.watchCustomFields(): CFlow<List<CustomField>>

Wrapper for custom fields list

Link copied to clipboard

Wrapper for errors

Link copied to clipboard

Wrapper for message list

Link copied to clipboard
fun Chat2Desk.watchOperator(): CFlow<Operator?>

Wrapper for operator