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