telegram_bot_async_raw/requests/
export_chat_invite_link.rs

1use crate::requests::*;
2use crate::types::*;
3
4/// Use this method to get a list of administrators in a chat.
5/// If the chat is a group or a supergroup and no administrators were appointed,
6/// only the creator will be returned.
7#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
8#[must_use = "requests do nothing unless sent"]
9pub struct ExportChatInviteLink {
10    chat_id: ChatRef,
11}
12
13impl Request for ExportChatInviteLink {
14    type Type = JsonRequestType<Self>;
15    type Response = JsonIdResponse<String>;
16
17    fn serialize(&self) -> Result<HttpRequest, Error> {
18        Self::Type::serialize(RequestUrl::method("exportChatInviteLink"), self)
19    }
20}
21
22impl ExportChatInviteLink {
23    pub fn new<C>(chat: C) -> Self
24    where
25        C: ToChatRef,
26    {
27        ExportChatInviteLink {
28            chat_id: chat.to_chat_ref(),
29        }
30    }
31}
32
33/// Get a list of administrators in a chat.
34pub trait CanExportChatInviteLink {
35    fn export_chat_invite_link(&self) -> ExportChatInviteLink;
36}
37
38impl<C> CanExportChatInviteLink for C
39where
40    C: ToChatRef,
41{
42    fn export_chat_invite_link(&self) -> ExportChatInviteLink {
43        ExportChatInviteLink::new(self)
44    }
45}