use std::{
future::{Future, IntoFuture},
pin::Pin,
};
use serde::Serialize;
use crate::{
api::API, entities::misc::chat_id::ChatId, errors::ConogramError, impl_into_future,
request::RequestT,
};
#[derive(Debug, Clone, Serialize)]
pub struct ReopenGeneralForumTopicParams {
pub chat_id: ChatId,
}
impl_into_future!(ReopenGeneralForumTopicRequest<'a>);
#[derive(Clone)]
pub struct ReopenGeneralForumTopicRequest<'a> {
api: &'a API,
params: ReopenGeneralForumTopicParams,
}
impl<'a> RequestT for ReopenGeneralForumTopicRequest<'a> {
type ParamsType = ReopenGeneralForumTopicParams;
type ReturnType = bool;
fn get_name() -> &'static str {
"reopenGeneralForumTopic"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> ReopenGeneralForumTopicRequest<'a> {
pub fn new(api: &'a API, chat_id: impl Into<ChatId>) -> Self {
Self {
api,
params: ReopenGeneralForumTopicParams {
chat_id: chat_id.into(),
},
}
}
#[must_use]
pub fn chat_id(mut self, chat_id: impl Into<ChatId>) -> Self {
self.params.chat_id = chat_id.into();
self
}
}
impl API {
pub fn reopen_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
) -> ReopenGeneralForumTopicRequest {
ReopenGeneralForumTopicRequest::new(self, chat_id)
}
}