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 SetStickerKeywordsParams {
pub sticker: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub keywords: Vec<String>,
}
impl_into_future!(SetStickerKeywordsRequest<'a>);
#[derive(Clone)]
pub struct SetStickerKeywordsRequest<'a> {
api: &'a API,
params: SetStickerKeywordsParams,
}
impl<'a> RequestT for SetStickerKeywordsRequest<'a> {
type ParamsType = SetStickerKeywordsParams;
type ReturnType = bool;
fn get_name() -> &'static str {
"setStickerKeywords"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> SetStickerKeywordsRequest<'a> {
pub fn new(api: &'a API, sticker: impl Into<String>) -> Self {
Self {
api,
params: SetStickerKeywordsParams {
sticker: sticker.into(),
keywords: Vec::default(),
},
}
}
#[must_use]
pub fn sticker(mut self, sticker: impl Into<String>) -> Self {
self.params.sticker = sticker.into();
self
}
#[must_use]
pub fn keywords(mut self, keywords: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.params.keywords = keywords.into_iter().map(Into::into).collect();
self
}
}
impl API {
pub fn set_sticker_keywords(&self, sticker: impl Into<String>) -> SetStickerKeywordsRequest {
SetStickerKeywordsRequest::new(self, sticker)
}
}