rust_tdlib/types/
toggle_group_call_enabled_start_notification.rs

1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5/// Toggles whether the current user will receive a notification when the group call will start; scheduled group calls only
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct ToggleGroupCallEnabledStartNotification {
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    /// New value of the enabled_start_notification setting
18
19    #[serde(default)]
20    enabled_start_notification: bool,
21
22    #[serde(rename(serialize = "@type"))]
23    td_type: String,
24}
25
26impl RObject for ToggleGroupCallEnabledStartNotification {
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 ToggleGroupCallEnabledStartNotification {}
38
39impl ToggleGroupCallEnabledStartNotification {
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() -> ToggleGroupCallEnabledStartNotificationBuilder {
44        let mut inner = ToggleGroupCallEnabledStartNotification::default();
45        inner.extra = Some(Uuid::new_v4().to_string());
46
47        inner.td_type = "toggleGroupCallEnabledStartNotification".to_string();
48
49        ToggleGroupCallEnabledStartNotificationBuilder { inner }
50    }
51
52    pub fn group_call_id(&self) -> i32 {
53        self.group_call_id
54    }
55
56    pub fn enabled_start_notification(&self) -> bool {
57        self.enabled_start_notification
58    }
59}
60
61#[doc(hidden)]
62pub struct ToggleGroupCallEnabledStartNotificationBuilder {
63    inner: ToggleGroupCallEnabledStartNotification,
64}
65
66#[deprecated]
67pub type RTDToggleGroupCallEnabledStartNotificationBuilder =
68    ToggleGroupCallEnabledStartNotificationBuilder;
69
70impl ToggleGroupCallEnabledStartNotificationBuilder {
71    pub fn build(&self) -> ToggleGroupCallEnabledStartNotification {
72        self.inner.clone()
73    }
74
75    pub fn group_call_id(&mut self, group_call_id: i32) -> &mut Self {
76        self.inner.group_call_id = group_call_id;
77        self
78    }
79
80    pub fn enabled_start_notification(&mut self, enabled_start_notification: bool) -> &mut Self {
81        self.inner.enabled_start_notification = enabled_start_notification;
82        self
83    }
84}
85
86impl AsRef<ToggleGroupCallEnabledStartNotification> for ToggleGroupCallEnabledStartNotification {
87    fn as_ref(&self) -> &ToggleGroupCallEnabledStartNotification {
88        self
89    }
90}
91
92impl AsRef<ToggleGroupCallEnabledStartNotification>
93    for ToggleGroupCallEnabledStartNotificationBuilder
94{
95    fn as_ref(&self) -> &ToggleGroupCallEnabledStartNotification {
96        &self.inner
97    }
98}