1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use super::base::{Request, TelegramMethod};

use crate::{client::Bot, types::StickerSet};

use serde::Serialize;

/// Use this method to get a sticker set.
/// # Documentation
/// <https://core.telegram.org/bots/api#getstickerset>
/// # Returns
/// On success, a [`StickerSet`] object is returned
#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct GetStickerSet {
    /// Name of the sticker set
    pub name: String,
}

impl GetStickerSet {
    #[must_use]
    pub fn new(name: impl Into<String>) -> Self {
        Self { name: name.into() }
    }

    #[must_use]
    pub fn name(self, val: impl Into<String>) -> Self {
        Self { name: val.into() }
    }
}

impl TelegramMethod for GetStickerSet {
    type Method = Self;
    type Return = StickerSet;

    fn build_request<Client>(&self, _bot: &Bot<Client>) -> Request<Self::Method> {
        Request::new("getStickerSet", self, None)
    }
}

impl AsRef<GetStickerSet> for GetStickerSet {
    fn as_ref(&self) -> &Self {
        self
    }
}