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::types::Sticker;
use crate::Bot;

impl Bot {
    /// Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
    /// <https://core.telegram.org/bots/api#getcustomemojistickers>
    pub fn get_custom_emoji_stickers(
        &self,
        custom_emoji_ids: Vec<String>,
    ) -> GetCustomEmojiStickersBuilder {
        GetCustomEmojiStickersBuilder::new(self, custom_emoji_ids)
    }
}

#[derive(Serialize)]
pub struct GetCustomEmojiStickersBuilder<'a> {
    #[serde(skip)]
    bot: &'a Bot,
    /// A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
    pub custom_emoji_ids: Vec<String>,
}

impl<'a> GetCustomEmojiStickersBuilder<'a> {
    pub fn new(bot: &'a Bot, custom_emoji_ids: Vec<String>) -> Self {
        Self {
            bot,
            custom_emoji_ids,
        }
    }

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

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