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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use crate::client::Bot;
use serde::Serialize;
/// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#setchatadministratorcustomtitle>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct SetChatAdministratorCustomTitle {
/// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
pub chat_id: crate::types::ChatIdKind,
/// Unique identifier of the target user
pub user_id: i64,
/// New custom title for the administrator; 0-16 characters, emoji are not allowed
pub custom_title: Box<str>,
}
impl SetChatAdministratorCustomTitle {
/// Creates a new `SetChatAdministratorCustomTitle`.
///
/// # Arguments
/// * `chat_id` - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
/// * `user_id` - Unique identifier of the target user
/// * `custom_title` - New custom title for the administrator; 0-16 characters, emoji are not allowed
#[must_use]
pub fn new<T0: Into<crate::types::ChatIdKind>, T1: Into<i64>, T2: Into<Box<str>>>(
chat_id: T0,
user_id: T1,
custom_title: T2,
) -> Self {
Self {
chat_id: chat_id.into(),
user_id: user_id.into(),
custom_title: custom_title.into(),
}
}
/// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
#[must_use]
pub fn chat_id<T: Into<crate::types::ChatIdKind>>(self, val: T) -> Self {
let mut this = self;
this.chat_id = val.into();
this
}
/// Unique identifier of the target user
#[must_use]
pub fn user_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.user_id = val.into();
this
}
/// New custom title for the administrator; 0-16 characters, emoji are not allowed
#[must_use]
pub fn custom_title<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.custom_title = val.into();
this
}
}
impl super::TelegramMethod for SetChatAdministratorCustomTitle {
type Method = Self;
type Return = bool;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("setChatAdministratorCustomTitle", self, None)
}
}