vaegram 0.2.0

Telegram MTProto client library for users and bots
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::Client;
use crate::dispatcher::Entities;
use crate::errors::Result;
use crate::raw::{base, functions};
use crate::types::Chat;

use super::create_folder_invite_link::chatlist;

impl Client {
    /// Returns the chats added to a shared folder that the account hasn't joined yet.
    pub async fn get_folder_updates(&self, folder_id: i32) -> Result<Vec<Chat>> {
        let request = functions::chatlists::GetChatlistUpdates { chatlist: chatlist(folder_id) };
        let base::chatlists::ChatlistUpdates::ChatlistUpdates(u) = self.invoke(&request).await?;
        let entities = Entities::new(self, u.users, u.chats);
        Ok(u.missing_peers.iter().map(|p| Chat::parse(p, &entities, false)).collect())
    }
}