telegram_bot_raw/requests/
export_chat_invite_link.rs

1use crate::requests::*;
2use crate::types::*;
3
4/// Use this method to export chat invite links.
5#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
6#[must_use = "requests do nothing unless sent"]
7pub struct ExportChatInviteLink {
8    chat_id: ChatRef,
9}
10
11impl Request for ExportChatInviteLink {
12    type Type = JsonRequestType<Self>;
13    type Response = JsonIdResponse<String>;
14
15    fn serialize(&self) -> Result<HttpRequest, Error> {
16        Self::Type::serialize(RequestUrl::method("exportChatInviteLink"), self)
17    }
18}
19
20impl ExportChatInviteLink {
21    pub fn new<C>(chat: C) -> Self
22    where
23        C: ToChatRef,
24    {
25        ExportChatInviteLink {
26            chat_id: chat.to_chat_ref(),
27        }
28    }
29}
30
31/// Export chat invite link.
32pub trait CanExportChatInviteLink {
33    fn export_invite_link(&self) -> ExportChatInviteLink;
34}
35
36impl<C> CanExportChatInviteLink for C
37where
38    C: ToChatRef,
39{
40    fn export_invite_link(&self) -> ExportChatInviteLink {
41        ExportChatInviteLink::new(self)
42    }
43}