如何在 tdlib 中使用 getChats [英] how to use getChats in tdlib

查看:30
本文介绍了如何在 tdlib 中使用 getChats的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 android 项目中使用 TD Java API.

I want to use TD Java API in my android project.

方法getchats"返回聊天列表.我不知道如何使用这种方法

method "getchats" return list of chat. I dont know how to use this method

getchats 有 3 个参数:offset_order、offset_chat_id、限制

getchats has 3 parameters: offset_order, offset_chat_id, limit

limit 是最大聊天数,由服务器发送到我的应用程序.offset_order 和 offset_chat_id 是什么?

limit is max number of chats, sent by server to my app. what are offset_order and offset_chat_id?

我只能找到有关此方法的简短文档

i could only find this brief documentation about this method

Returns list of chats in the right order, chats are sorted by (order, chat_id) in decreasing order. For example, to get list of chats from the beginning, the offset_order should be equal 2^63 - 1 
@offset_order Chat order to return chats from 
@offset_chat_id Chat identifier to return chats from 
@limit Maximum number of chats to be returned

推荐答案

(谷歌翻译)answer来自官方技术支持:

(Google translated) answer from official technical support:

聊天按降序排列一对 (offsetOrder, offsetChatId).offsetOrder - 用于聊天排序的参数,受控库.当Order相等时,chat按照ChatId的降序排序.第一个请求从头开始获取列表,需要传递非常大的offsetOrder,例如2^63 - 1.

Chats sorted in descending order a pair (offsetOrder, offsetChatId). offsetOrder - a parameter for sorting of chats, controlled library. When Order equality, chat to sort in descending order of ChatId. The first request to get a list from the beginning, you need to transfer very large offsetOrder, for example, 2 ^ 63 - 1.

如果 offsetOrder 是 2 ^ 63 - 1,offsetChatId 没有关系,你可以传 0.请求新的 GetChats (9223372036854775807L, 0, 10) 应该返回前 10 个会话.

if offsetOrder is 2 ^ 63 - 1, offsetChatId does not matter, you can pass 0. Request new GetChats (9223372036854775807L, 0, 10) should return the first 10 conversations.

需要将上次返回的chat.order chat.id传输到GetChats聊天以接收下一个聊天.另外值得记住的是,聊天的顺序是可以变化的,所以需要在获取结果GetChats的时候保留这些值.

It is necessary to transmit and chat.order chat.id last returned to the GetChats chat to receive next chats. It is also worth remembering that the order of chats can change, so you need to keep these values ​​at the time of obtaining the result GetChats.

这篇关于如何在 tdlib 中使用 getChats的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆