conogram/methods/
set_sticker_emoji_list.rs1use std::{
2 future::{Future, IntoFuture},
3 pin::Pin,
4};
5
6use serde::Serialize;
7
8use crate::{api::API, errors::ConogramError, impl_into_future, request::RequestT};
9
10#[derive(Debug, Clone, Serialize)]
11pub struct SetStickerEmojiListParams {
12 pub sticker: String,
13 pub emoji_list: Vec<String>,
14}
15
16impl_into_future!(SetStickerEmojiListRequest<'a>);
17
18#[derive(Clone)]
20pub struct SetStickerEmojiListRequest<'a> {
21 api: &'a API,
22 params: SetStickerEmojiListParams,
23}
24
25impl<'a> RequestT for SetStickerEmojiListRequest<'a> {
26 type ParamsType = SetStickerEmojiListParams;
27 type ReturnType = bool;
28 fn get_name() -> &'static str {
29 "setStickerEmojiList"
30 }
31 fn get_api_ref(&self) -> &API {
32 self.api
33 }
34 fn get_params_ref(&self) -> &Self::ParamsType {
35 &self.params
36 }
37 fn is_multipart() -> bool {
38 false
39 }
40}
41impl<'a> SetStickerEmojiListRequest<'a> {
42 pub fn new(
43 api: &'a API,
44 sticker: impl Into<String>,
45 emoji_list: impl IntoIterator<Item = impl Into<String>>,
46 ) -> Self {
47 Self {
48 api,
49 params: SetStickerEmojiListParams {
50 sticker: sticker.into(),
51 emoji_list: emoji_list.into_iter().map(Into::into).collect(),
52 },
53 }
54 }
55
56 #[must_use]
58 pub fn sticker(mut self, sticker: impl Into<String>) -> Self {
59 self.params.sticker = sticker.into();
60 self
61 }
62
63 #[must_use]
65 pub fn emoji_list(mut self, emoji_list: impl IntoIterator<Item = impl Into<String>>) -> Self {
66 self.params.emoji_list = emoji_list.into_iter().map(Into::into).collect();
67 self
68 }
69}
70
71impl API {
72 pub fn set_sticker_emoji_list(
74 &self,
75 sticker: impl Into<String>,
76 emoji_list: impl IntoIterator<Item = impl Into<String>>,
77 ) -> SetStickerEmojiListRequest {
78 SetStickerEmojiListRequest::new(self, sticker, emoji_list)
79 }
80}
81
82