rust_tdlib/types/
get_group_call_invite_link.rs

1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5/// Returns invite link to a video chat in a public chat
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct GetGroupCallInviteLink {
8    #[doc(hidden)]
9    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
10    extra: Option<String>,
11    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
12    client_id: Option<i32>,
13    /// Group call identifier
14
15    #[serde(default)]
16    group_call_id: i32,
17    /// Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag
18
19    #[serde(default)]
20    can_self_unmute: bool,
21
22    #[serde(rename(serialize = "@type"))]
23    td_type: String,
24}
25
26impl RObject for GetGroupCallInviteLink {
27    #[doc(hidden)]
28    fn extra(&self) -> Option<&str> {
29        self.extra.as_deref()
30    }
31    #[doc(hidden)]
32    fn client_id(&self) -> Option<i32> {
33        self.client_id
34    }
35}
36
37impl RFunction for GetGroupCallInviteLink {}
38
39impl GetGroupCallInviteLink {
40    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
41        Ok(serde_json::from_str(json.as_ref())?)
42    }
43    pub fn builder() -> GetGroupCallInviteLinkBuilder {
44        let mut inner = GetGroupCallInviteLink::default();
45        inner.extra = Some(Uuid::new_v4().to_string());
46
47        inner.td_type = "getGroupCallInviteLink".to_string();
48
49        GetGroupCallInviteLinkBuilder { inner }
50    }
51
52    pub fn group_call_id(&self) -> i32 {
53        self.group_call_id
54    }
55
56    pub fn can_self_unmute(&self) -> bool {
57        self.can_self_unmute
58    }
59}
60
61#[doc(hidden)]
62pub struct GetGroupCallInviteLinkBuilder {
63    inner: GetGroupCallInviteLink,
64}
65
66#[deprecated]
67pub type RTDGetGroupCallInviteLinkBuilder = GetGroupCallInviteLinkBuilder;
68
69impl GetGroupCallInviteLinkBuilder {
70    pub fn build(&self) -> GetGroupCallInviteLink {
71        self.inner.clone()
72    }
73
74    pub fn group_call_id(&mut self, group_call_id: i32) -> &mut Self {
75        self.inner.group_call_id = group_call_id;
76        self
77    }
78
79    pub fn can_self_unmute(&mut self, can_self_unmute: bool) -> &mut Self {
80        self.inner.can_self_unmute = can_self_unmute;
81        self
82    }
83}
84
85impl AsRef<GetGroupCallInviteLink> for GetGroupCallInviteLink {
86    fn as_ref(&self) -> &GetGroupCallInviteLink {
87        self
88    }
89}
90
91impl AsRef<GetGroupCallInviteLink> for GetGroupCallInviteLinkBuilder {
92    fn as_ref(&self) -> &GetGroupCallInviteLink {
93        &self.inner
94    }
95}