1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use crate::client::Bot;
use serde::Serialize;
/// Use this method to get a list of administrators in a chat. Returns an Array of [`crate::types::ChatMember`] objects.
/// # Documentation
/// <https://core.telegram.org/bots/api#getchatadministrators>
/// # Returns
/// - `Box<[crate::types::ChatMember]>`
#[derive(Clone, Debug, Serialize)]
pub struct GetChatAdministrators {
/// Unique identifier for the target chat or username of the target supergroup or channel in the format @username
pub chat_id: crate::types::ChatIdKind,
/// Pass `true` to additionally receive all bots that are administrators of the chat. By default, bots other than the current bot are omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub return_bots: Option<bool>,
}
impl GetChatAdministrators {
/// Creates a new `GetChatAdministrators`.
///
/// # Arguments
/// * `chat_id` - Unique identifier for the target chat or username of the target supergroup or channel in the format @username
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<crate::types::ChatIdKind>>(chat_id: T0) -> Self {
Self {
chat_id: chat_id.into(),
return_bots: None,
}
}
/// Unique identifier for the target chat or username of the target supergroup or channel in the format @username
#[must_use]
pub fn chat_id<T: Into<crate::types::ChatIdKind>>(mut self, val: T) -> Self {
self.chat_id = val.into();
self
}
/// Pass `true` to additionally receive all bots that are administrators of the chat. By default, bots other than the current bot are omitted.
#[must_use]
pub fn return_bots<T: Into<bool>>(mut self, val: T) -> Self {
self.return_bots = Some(val.into());
self
}
/// Pass `true` to additionally receive all bots that are administrators of the chat. By default, bots other than the current bot are omitted.
#[must_use]
pub fn return_bots_option<T: Into<bool>>(mut self, val: Option<T>) -> Self {
self.return_bots = val.map(Into::into);
self
}
}
impl super::TelegramMethod for GetChatAdministrators {
type Method = Self;
type Return = Box<[crate::types::ChatMember]>;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("getChatAdministrators", self, None)
}
}