use std::{
future::{Future, IntoFuture},
pin::Pin,
};
use serde::Serialize;
use crate::{
api::API, entities::bot_description::BotDescription, errors::ConogramError, impl_into_future,
request::RequestT,
};
#[derive(Debug, Clone, Serialize)]
pub struct GetMyDescriptionParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
}
impl_into_future!(GetMyDescriptionRequest<'a>);
#[derive(Clone)]
pub struct GetMyDescriptionRequest<'a> {
api: &'a API,
params: GetMyDescriptionParams,
}
impl<'a> RequestT for GetMyDescriptionRequest<'a> {
type ParamsType = GetMyDescriptionParams;
type ReturnType = BotDescription;
fn get_name() -> &'static str {
"getMyDescription"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> GetMyDescriptionRequest<'a> {
pub fn new(api: &'a API) -> Self {
Self {
api,
params: GetMyDescriptionParams {
language_code: Option::default(),
},
}
}
#[must_use]
pub fn language_code(mut self, language_code: impl Into<String>) -> Self {
self.params.language_code = Some(language_code.into());
self
}
}
impl API {
pub fn get_my_description(&self) -> GetMyDescriptionRequest {
GetMyDescriptionRequest::new(self)
}
}