use std::{
future::{Future, IntoFuture},
pin::Pin,
};
use serde::Serialize;
use crate::{
api::API, entities::sticker::Sticker, errors::ConogramError, impl_into_future,
request::RequestT,
};
#[derive(Debug, Clone, Serialize)]
pub struct GetCustomEmojiStickersParams {
pub custom_emoji_ids: Vec<String>,
}
impl_into_future!(GetCustomEmojiStickersRequest<'a>);
#[derive(Clone)]
pub struct GetCustomEmojiStickersRequest<'a> {
api: &'a API,
params: GetCustomEmojiStickersParams,
}
impl<'a> RequestT for GetCustomEmojiStickersRequest<'a> {
type ParamsType = GetCustomEmojiStickersParams;
type ReturnType = Vec<Sticker>;
fn get_name() -> &'static str {
"getCustomEmojiStickers"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> GetCustomEmojiStickersRequest<'a> {
pub fn new(
api: &'a API,
custom_emoji_ids: impl IntoIterator<Item = impl Into<String>>,
) -> Self {
Self {
api,
params: GetCustomEmojiStickersParams {
custom_emoji_ids: custom_emoji_ids.into_iter().map(Into::into).collect(),
},
}
}
#[must_use]
pub fn custom_emoji_ids(
mut self,
custom_emoji_ids: impl IntoIterator<Item = impl Into<String>>,
) -> Self {
self.params.custom_emoji_ids = custom_emoji_ids.into_iter().map(Into::into).collect();
self
}
}
impl API {
pub fn get_custom_emoji_stickers(
&self,
custom_emoji_ids: impl IntoIterator<Item = impl Into<String>>,
) -> GetCustomEmojiStickersRequest {
GetCustomEmojiStickersRequest::new(self, custom_emoji_ids)
}
}