conogram/methods/
unban_chat_sender_chat.rs1use std::{
2 future::{Future, IntoFuture},
3 pin::Pin,
4};
5
6use serde::Serialize;
7
8use crate::{
9 api::API, entities::misc::chat_id::ChatId, errors::ConogramError, impl_into_future,
10 request::RequestT,
11};
12
13#[derive(Debug, Clone, Serialize)]
14pub struct UnbanChatSenderChatParams {
15 pub chat_id: ChatId,
16 pub sender_chat_id: i64,
17}
18
19impl_into_future!(UnbanChatSenderChatRequest<'a>);
20
21#[derive(Clone)]
23pub struct UnbanChatSenderChatRequest<'a> {
24 api: &'a API,
25 params: UnbanChatSenderChatParams,
26}
27
28impl<'a> RequestT for UnbanChatSenderChatRequest<'a> {
29 type ParamsType = UnbanChatSenderChatParams;
30 type ReturnType = bool;
31 fn get_name() -> &'static str {
32 "unbanChatSenderChat"
33 }
34 fn get_api_ref(&self) -> &API {
35 self.api
36 }
37 fn get_params_ref(&self) -> &Self::ParamsType {
38 &self.params
39 }
40 fn is_multipart() -> bool {
41 false
42 }
43}
44impl<'a> UnbanChatSenderChatRequest<'a> {
45 pub fn new(api: &'a API, chat_id: impl Into<ChatId>, sender_chat_id: impl Into<i64>) -> Self {
46 Self {
47 api,
48 params: UnbanChatSenderChatParams {
49 chat_id: chat_id.into(),
50 sender_chat_id: sender_chat_id.into(),
51 },
52 }
53 }
54
55 #[must_use]
57 pub fn chat_id(mut self, chat_id: impl Into<ChatId>) -> Self {
58 self.params.chat_id = chat_id.into();
59 self
60 }
61
62 #[must_use]
64 pub fn sender_chat_id(mut self, sender_chat_id: impl Into<i64>) -> Self {
65 self.params.sender_chat_id = sender_chat_id.into();
66 self
67 }
68}
69
70impl API {
71 pub fn unban_chat_sender_chat(
73 &self,
74 chat_id: impl Into<ChatId>,
75 sender_chat_id: impl Into<i64>,
76 ) -> UnbanChatSenderChatRequest {
77 UnbanChatSenderChatRequest::new(self, chat_id, sender_chat_id)
78 }
79}
80
81