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 SetStickerPositionInSetParams {
pub sticker: String,
pub position: i64,
}
impl_into_future!(SetStickerPositionInSetRequest<'a>);
#[derive(Clone)]
pub struct SetStickerPositionInSetRequest<'a> {
api: &'a API,
params: SetStickerPositionInSetParams,
}
impl<'a> RequestT for SetStickerPositionInSetRequest<'a> {
type ParamsType = SetStickerPositionInSetParams;
type ReturnType = bool;
fn get_name() -> &'static str {
"setStickerPositionInSet"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> SetStickerPositionInSetRequest<'a> {
pub fn new(api: &'a API, sticker: impl Into<String>, position: impl Into<i64>) -> Self {
Self {
api,
params: SetStickerPositionInSetParams {
sticker: sticker.into(),
position: position.into(),
},
}
}
#[must_use]
pub fn sticker(mut self, sticker: impl Into<String>) -> Self {
self.params.sticker = sticker.into();
self
}
#[must_use]
pub fn position(mut self, position: impl Into<i64>) -> Self {
self.params.position = position.into();
self
}
}
impl API {
pub fn set_sticker_position_in_set(
&self,
sticker: impl Into<String>,
position: impl Into<i64>,
) -> SetStickerPositionInSetRequest {
SetStickerPositionInSetRequest::new(self, sticker, position)
}
}