sendUserMessageFlow

fun BaseChannel.sendUserMessageFlow(message: String): Flow<MessageResult<UserMessage>>

Send user message

** Sample code **

baseChannel.sendUserMessageFlow(paramsList)
.onEach {
when (it) {
is MessageResult.Pending -> {
// called it when sending message are called
// it contains pendingMessage
}
is MessageResult.Succeed -> {
// called it with result data when all job has been completed
}
is MessageResult.Failure -> {
// deliver exception with failed message when all job has been completed
// it.message : failed message
// it.e : exception
}
}
}.catch {
// error occurred (validation failed)
}.launchIn(viewModelScope)

Return

The user message

Since

4.17.0

Parameters

message

The message to send


fun BaseChannel.sendUserMessageFlow(params: UserMessageCreateParams): Flow<MessageResult<UserMessage>>

Send user message ** Sample code **

baseChannel.sendUserMessageFlow(params)
.onEach {
when (it) {
is MessageResult.Pending -> {
// called it when sending message are called
// it contains pendingMessage
}
is MessageResult.Succeed -> {
// called it with result data when all job has been completed
}
is MessageResult.Failure -> {
// deliver exception with failed message when all job has been completed
// it.message : failed message
// it.e : exception
}
}
}.catch {
// error occurred (validation failed)
}.launchIn(viewModelScope)

Return

The user message

Since

4.17.0

Parameters

params

The parameters to send user message