telegram_bot_async_raw/requests/
get_chat_administrators.rs1use crate::{requests::*, types::*};
2
3#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
7#[must_use = "requests do nothing unless sent"]
8pub struct GetChatAdministrators {
9 chat_id: ChatRef,
10}
11
12impl Request for GetChatAdministrators {
13 type Type = JsonRequestType<Self>;
14 type Response = JsonIdResponse<Vec<ChatMember>>;
15
16 fn serialize(&self) -> Result<HttpRequest, Error> {
17 Self::Type::serialize(RequestUrl::method("getChatAdministrators"), self)
18 }
19}
20
21impl GetChatAdministrators {
22 pub fn new<C>(chat: C) -> Self
23 where
24 C: ToChatRef,
25 {
26 GetChatAdministrators {
27 chat_id: chat.to_chat_ref(),
28 }
29 }
30}
31
32pub trait CanGetChatAdministrators {
34 fn get_administrators(&self) -> GetChatAdministrators;
35}
36
37impl<C> CanGetChatAdministrators for C
38where
39 C: ToChatRef,
40{
41 fn get_administrators(&self) -> GetChatAdministrators {
42 GetChatAdministrators::new(self)
43 }
44}