use super::call_method;
use crate::{connectors::Client, errors, token};
use serde::Serialize;
#[derive(Serialize, Debug, Clone)]
#[must_use = "methods do nothing unless turned into a future"]
pub struct SetStickerPositionInSet<'a> {
#[serde(skip)]
client: &'a Client,
#[serde(skip)]
token: token::Ref<'a>,
sticker: &'a str,
position: u32,
}
impl<'a> SetStickerPositionInSet<'a> {
pub(crate) const fn new(
client: &'a Client,
token: token::Ref<'a>,
sticker: &'a str,
position: u32,
) -> Self {
Self {
client,
token,
sticker,
position,
}
}
}
impl SetStickerPositionInSet<'_> {
pub async fn call(self) -> Result<(), errors::MethodCall> {
call_method::<bool>(
self.client,
self.token,
"setStickerPositionInSet",
None,
serde_json::to_vec(&self).unwrap(),
)
.await?;
Ok(())
}
}