All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.sceyt.chatuikit.persistence.interactor.MessageInteractor.kt Maven / Gradle / Ivy

package com.sceyt.chatuikit.persistence.interactor

import com.sceyt.chat.models.message.DeleteMessageType
import com.sceyt.chat.models.message.Message
import com.sceyt.chat.models.message.MessageListMarker
import com.sceyt.chatuikit.SceytChatUIKit
import com.sceyt.chatuikit.data.models.LoadKeyData
import com.sceyt.chatuikit.data.models.PaginationResponse
import com.sceyt.chatuikit.data.models.SceytPagingResponse
import com.sceyt.chatuikit.data.models.SceytResponse
import com.sceyt.chatuikit.data.models.SendMessageResult
import com.sceyt.chatuikit.data.models.SyncNearMessagesResult
import com.sceyt.chatuikit.data.models.channels.SceytChannel
import com.sceyt.chatuikit.data.models.messages.MarkerType
import com.sceyt.chatuikit.data.models.messages.SceytMessage
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharedFlow

interface MessageInteractor {
    suspend fun loadPrevMessages(
            conversationId: Long, lastMessageId: Long,
            replyInThread: Boolean, offset: Int,
            limit: Int = SceytChatUIKit.config.queryLimits.messageListQueryLimit,
            loadKey: LoadKeyData, ignoreDb: Boolean = false
    ): Flow>

    suspend fun loadNextMessages(
            conversationId: Long, lastMessageId: Long, replyInThread: Boolean,
            offset: Int, limit: Int = SceytChatUIKit.config.queryLimits.messageListQueryLimit,
            ignoreDb: Boolean = false
    ): Flow>

    suspend fun loadNearMessages(
            conversationId: Long, messageId: Long, replyInThread: Boolean,
            limit: Int, loadKey: LoadKeyData, ignoreDb: Boolean = false,
            ignoreServer: Boolean = false
    ): Flow>

    suspend fun loadNewestMessages(
            conversationId: Long, replyInThread: Boolean,
            limit: Int = SceytChatUIKit.config.queryLimits.messageListQueryLimit,
            loadKey: LoadKeyData, ignoreDb: Boolean
    ): Flow>

    suspend fun searchMessages(
            conversationId: Long, replyInThread: Boolean, query: String
    ): SceytPagingResponse>

    suspend fun loadNextSearchMessages(): SceytPagingResponse>
    suspend fun loadMessagesById(conversationId: Long, ids: List): SceytResponse>

    suspend fun syncMessagesAfterMessageId(conversationId: Long, replyInThread: Boolean,
                                           messageId: Long): Flow>>

    suspend fun syncNearMessages(conversationId: Long, messageId: Long,
                                 replyInThread: Boolean): SyncNearMessagesResult

    suspend fun sendMessageAsFlow(channelId: Long, message: Message): Flow
    suspend fun sendMessage(channelId: Long, message: Message)
    suspend fun sendMessages(channelId: Long, messages: List)
    suspend fun sendSharedFileMessage(channelId: Long, message: Message)
    suspend fun sendFrowardMessages(channelId: Long, vararg messagesToSend: Message): SceytResponse
    suspend fun sendMessageWithUploadedAttachments(channelId: Long, message: Message): SceytResponse
    suspend fun sendPendingMessages(channelId: Long)
    suspend fun sendAllPendingMessages()
    suspend fun sendAllPendingMarkers()
    suspend fun sendAllPendingMessageStateUpdates()
    suspend fun sendAllPendingReactions()
    suspend fun markMessagesAs(channelId: Long, marker: MarkerType,
                               vararg ids: Long): List>

    suspend fun addMessagesMarker(channelId: Long, marker: String,
                                  vararg ids: Long): List>

    suspend fun editMessage(channelId: Long, message: SceytMessage): SceytResponse
    suspend fun deleteMessage(channelId: Long, message: SceytMessage,
                              deleteType: DeleteMessageType): SceytResponse

    suspend fun getMessageFromServerById(channelId: Long, messageId: Long): SceytResponse
    suspend fun getMessageDbById(messageId: Long): SceytMessage?
    suspend fun getMessageDbByTid(messageTid: Long): SceytMessage?
    suspend fun sendTyping(channelId: Long, typing: Boolean)
    fun getOnMessageFlow(): SharedFlow>
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy