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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
use serde::Serialize;
use crate::{
api::{Method, Payload},
types::{ChatId, Integer},
};
#[derive(Clone, Debug, Serialize)]
/// Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
pub struct RemoveChatVerification {
chat_id: ChatId,
}
impl RemoveChatVerification {
/// Creates a new `RemoveChatVerification`.
///
/// # Arguments
///
/// * `chat_id` - Unique identifier for the target chat
/// or username of the target channel (in the format @channelusername).
pub fn new<T>(chat_id: T) -> Self
where
T: Into<ChatId>,
{
Self {
chat_id: chat_id.into(),
}
}
}
impl Method for RemoveChatVerification {
type Response = bool;
fn into_payload(self) -> Payload {
Payload::json("removeChatVerification", self)
}
}
#[derive(Clone, Copy, Debug, Serialize)]
/// Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
pub struct RemoveUserVerification {
user_id: Integer,
}
impl RemoveUserVerification {
/// Creates a new `RemoveUserVerification`.
///
/// # Arguments
///
/// * `user_id` - Unique identifier of the target user.
pub fn new(user_id: Integer) -> Self {
Self { user_id }
}
}
impl Method for RemoveUserVerification {
type Response = bool;
fn into_payload(self) -> Payload {
Payload::json("removeUserVerification", self)
}
}
/// Verifies a chat on behalf of the organization which is represented by the bot.
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct VerifyChat {
chat_id: ChatId,
custom_description: Option<String>,
}
impl VerifyChat {
/// Creates a new `VerifyChat`.
///
/// # Arguments
///
/// * `chat_id` - Unique identifier for the target chat
/// or username of the target channel (in the format @channelusername).
pub fn new<T>(chat_id: T) -> Self
where
T: Into<ChatId>,
{
Self {
chat_id: chat_id.into(),
custom_description: None,
}
}
/// Sets a new custom description.
///
/// # Arguments
///
/// * `value` - Custom description for the verification; 0-70 characters.
/// Must be empty if the organization isn't allowed to provide a custom verification description.
pub fn with_custom_description<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.custom_description = Some(value.into());
self
}
}
impl Method for VerifyChat {
type Response = bool;
fn into_payload(self) -> Payload {
Payload::json("verifyChat", self)
}
}
/// Verifies a user on behalf of the organization which is represented by the bot.
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct VerifyUser {
user_id: Integer,
custom_description: Option<String>,
}
impl VerifyUser {
/// Creates a new `VerifyUser`.
///
/// # Arguments
///
/// * `user_id` - Unique identifier of the target user.
pub fn new(user_id: Integer) -> Self {
Self {
user_id,
custom_description: None,
}
}
/// Sets a new custom description.
///
/// # Arguments
///
/// * `value` - Custom description for the verification; 0-70 characters.
/// Must be empty if the organization isn't allowed to provide a custom verification description.
pub fn with_custom_description<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.custom_description = Some(value.into());
self
}
}
impl Method for VerifyUser {
type Response = bool;
fn into_payload(self) -> Payload {
Payload::json("verifyUser", self)
}
}