TdLibFacade

class TdLibFacade(client: TdLibClient)

Constructors

Link copied to clipboard
constructor(client: TdLibClient)

Functions

Link copied to clipboard
fun authorizationState(): TdApi.AuthorizationState?
Link copied to clipboard
suspend fun checkCode(code: String): String?
Link copied to clipboard
suspend fun checkPassword(password: String): String?
Link copied to clipboard
fun close()
Link copied to clipboard
fun closeChat(chatId: Long)
Link copied to clipboard
suspend fun configureProxy(host: String, port: Int, username: String?, password: String?): Boolean
Link copied to clipboard
fun configureProxyFireAndForget(host: String, port: Int, username: String?, password: String?)
Link copied to clipboard
Link copied to clipboard
suspend fun fetchFullChatHistory(chatId: Long, pageSize: Int = 100, syncRemote: Boolean = true, onPage: suspend (List<TdApi.Message>) -> Unit): Pair<Int, Int>

Loads local TDLib cache first, then syncs from Telegram when the network is reachable.

Link copied to clipboard
suspend fun getChat(chatId: Long): TdApi.Chat?
Link copied to clipboard
suspend fun getChatHistory(chatId: Long, fromMessageId: Long = 0, limit: Int = 100, onlyLocal: Boolean = false): List<TdApi.Message>
Link copied to clipboard
suspend fun getChatIds(limit: Int = 100): List<Long>
Link copied to clipboard
suspend fun getMe(): TdApi.User?
Link copied to clipboard
fun loadChats(limit: Int = 100)

TDLib Example.java uses LoadChats, not deprecated GetChats.

Link copied to clipboard
fun onUpdate(update: TdApi.Object)
Link copied to clipboard
fun openChat(chatId: Long)
Link copied to clipboard
suspend fun paginateChatHistory(chatId: Long, onlyLocal: Boolean, pageSize: Int = 100, onPage: suspend (List<TdApi.Message>) -> Unit): Int

Paginates GetChatHistory until the thread is exhausted (newest → oldest).

Link copied to clipboard
suspend fun registerUser(firstName: String, lastName: String): String?
Link copied to clipboard
fun requestChat(chatId: Long)
Link copied to clipboard
suspend fun resendCode(): String?
Link copied to clipboard
suspend fun searchPublicChat(username: String): TdApi.Chat?
Link copied to clipboard
fun sendText(chatId: Long, text: String)
Link copied to clipboard
fun setParameters(databaseDirectory: String, apiId: Int, apiHash: String)
Link copied to clipboard
Link copied to clipboard
suspend fun syncChatList(limit: Int = 200): List<TdApi.Chat>
Link copied to clipboard
fun viewMessages(chatId: Long, messageIds: LongArray)