rust_tdlib/types/
get_recent_inline_bots.rs

1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5/// Returns up to 20 recently used inline bots in the order of their last usage
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct GetRecentInlineBots {
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
14    #[serde(rename(serialize = "@type"))]
15    td_type: String,
16}
17
18impl RObject for GetRecentInlineBots {
19    #[doc(hidden)]
20    fn extra(&self) -> Option<&str> {
21        self.extra.as_deref()
22    }
23    #[doc(hidden)]
24    fn client_id(&self) -> Option<i32> {
25        self.client_id
26    }
27}
28
29impl RFunction for GetRecentInlineBots {}
30
31impl GetRecentInlineBots {
32    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
33        Ok(serde_json::from_str(json.as_ref())?)
34    }
35    pub fn builder() -> GetRecentInlineBotsBuilder {
36        let mut inner = GetRecentInlineBots::default();
37        inner.extra = Some(Uuid::new_v4().to_string());
38
39        inner.td_type = "getRecentInlineBots".to_string();
40
41        GetRecentInlineBotsBuilder { inner }
42    }
43}
44
45#[doc(hidden)]
46pub struct GetRecentInlineBotsBuilder {
47    inner: GetRecentInlineBots,
48}
49
50#[deprecated]
51pub type RTDGetRecentInlineBotsBuilder = GetRecentInlineBotsBuilder;
52
53impl GetRecentInlineBotsBuilder {
54    pub fn build(&self) -> GetRecentInlineBots {
55        self.inner.clone()
56    }
57}
58
59impl AsRef<GetRecentInlineBots> for GetRecentInlineBots {
60    fn as_ref(&self) -> &GetRecentInlineBots {
61        self
62    }
63}
64
65impl AsRef<GetRecentInlineBots> for GetRecentInlineBotsBuilder {
66    fn as_ref(&self) -> &GetRecentInlineBots {
67        &self.inner
68    }
69}