Files
forkmessager/client-mobile/chats/domain/repository/ChatRepository.kt
Халимов Рустам 9daa786cfb Заготовка
2026-05-07 23:27:37 +03:00

53 lines
2.0 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package chats.domain.repository
import chats.domain.model.Chat
import chats.domain.model.Message
import kotlinx.coroutines.flow.Flow
interface ChatRepository {
// Чаты
fun getChatsFlow(): Flow<List<Chat>>
suspend fun getChats(): List<Chat>
suspend fun syncChats()
// Сообщения - Single Source of Truth через Flow
fun getMessagesFlow(chatId: String): Flow<List<Message>>
suspend fun getMessages(chatId: String, cursor: String? = null, pivot: Long? = null, limit: Int? = null): List<Message>
// Отправка сообщений с поддержкой офлайн
suspend fun sendMessage(
chatId: String,
content: String?,
type: String = "text",
attachments: List<chats.data.remote.api.AttachmentRequest>? = null,
replyToId: String? = null,
forwardedFromId: String? = null
): Message
suspend fun retryFailedMessage(localId: String)
suspend fun syncMessagesForChat(chatId: String)
suspend fun schedulePeriodicSync()
// Реакции
suspend fun addReaction(messageId: String, emoji: String)
suspend fun sendTypingStatus(chatId: String)
suspend fun markMessagesAsRead(chatId: String, lastMessageId: String, lastReadSequenceId: Int)
// Локальное хранение
suspend fun saveMessage(message: Message)
suspend fun deleteLocalMessage(messageId: String)
// Медиа
suspend fun uploadMedia(file: java.io.File): String
suspend fun getTrendingGifs(page: Int = 0): List<chats.data.remote.api.KlipyGifDto>
suspend fun searchGifs(query: String, page: Int = 0): List<chats.data.remote.api.KlipyGifDto>
suspend fun getGifCategories(): List<chats.data.remote.api.GifCategoryDto>
// Управление чатами
suspend fun createPersonalChat(userId: String): Chat
suspend fun deleteMessage(messageId: String, forEveryone: Boolean)
suspend fun editMessage(messageId: String, content: String): Message
}