use super::get_chat_join_requests::Importers;
use crate::Client;
use crate::errors::Result;
use crate::types::{ChatJoiner, PeerRef};
#[must_use = "a pager does nothing until it is awaited or read with next()"]
pub struct GetChatInviteLinkJoiners<'a> {
client: &'a Client,
importers: Importers,
}
impl Client {
pub fn get_chat_invite_link_joiners(
&self,
chat_id: impl Into<PeerRef>,
invite_link: impl Into<String>,
) -> GetChatInviteLinkJoiners<'_> {
let importers = Importers::new(chat_id.into(), false, Some(invite_link.into()));
GetChatInviteLinkJoiners { client: self, importers }
}
}
impl GetChatInviteLinkJoiners<'_> {
pub fn limit(mut self, limit: usize) -> Self {
self.importers.pages.remaining = limit;
self
}
pub async fn next(&mut self) -> Result<Option<ChatJoiner>> {
self.importers.next(self.client).await
}
}
pager!(GetChatInviteLinkJoiners, ChatJoiner);