ferrisgram 0.2.1

An elegent rust client for the Telegram Bot API.
Documentation
// WARNING: THIS CODE IS AUTOGENERATED.
// DO NOT EDIT!!!

#![allow(clippy::too_many_arguments)]
use serde::Serialize;

use crate::error::Result;
use crate::Bot;

impl Bot {
    /// Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
    /// <https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail>
    pub fn set_custom_emoji_sticker_set_thumbnail(
        &self,
        name: String,
    ) -> SetCustomEmojiStickerSetThumbnailBuilder {
        SetCustomEmojiStickerSetThumbnailBuilder::new(self, name)
    }
}

#[derive(Serialize)]
pub struct SetCustomEmojiStickerSetThumbnailBuilder<'a> {
    #[serde(skip)]
    bot: &'a Bot,
    /// Sticker set name
    pub name: String,
    /// Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub custom_emoji_id: Option<String>,
}

impl<'a> SetCustomEmojiStickerSetThumbnailBuilder<'a> {
    pub fn new(bot: &'a Bot, name: String) -> Self {
        Self {
            bot,
            name,
            custom_emoji_id: None,
        }
    }

    pub fn name(mut self, name: String) -> Self {
        self.name = name;
        self
    }

    pub fn custom_emoji_id(mut self, custom_emoji_id: String) -> Self {
        self.custom_emoji_id = Some(custom_emoji_id);
        self
    }

    pub async fn send(self) -> Result<bool> {
        let form = serde_json::to_value(&self)?;
        self.bot
            .get("setCustomEmojiStickerSetThumbnail", Some(&form))
            .await
    }
}