Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use getChats in tdlib

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

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

getchats has 3 parameters: offset_order, offset_chat_id, limit

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
like image 903
Motahare Sehati Avatar asked Jun 13 '16 05:06

Motahare Sehati


1 Answers

(Google translated) answer from official technical support:

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.

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.

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.

like image 50
Ruslan Berozov Avatar answered Sep 28 '22 06:09

Ruslan Berozov