pyrogram icon indicating copy to clipboard operation
pyrogram copied to clipboard

Rethink get_user/chat API

Open delivrance opened this issue 5 years ago • 0 comments

Currently, we have:

  • get_users (plural) to get 1 or N (up to 200) users.
  • get_chat (singular) to get one full chat only.

The API should be more consistent and also take Full entities into account. For example, we have a User object in MTProto that stores basic user info and a UserFull to store extra info such as the bio. The same applies to ChatFull and ChannelFull (which will just be Chat objects in Pyrogram's API and the extra info stored as optional args available only when fetching the full variant).

Proposal

Have these to get basic info about users and chats (up to 200 at once):

  • get_users
  • get_chats

And these to get one full user/chat only :

  • get_full_user
  • get_full_chat

The reason behind why one method is able to get up to 200 entities and the other just one is because that's what Telegram allows us to do. The latter method for getting a full user/chat is more expensive and thus allows one entity per call only.

delivrance avatar Aug 03 '19 10:08 delivrance