tgbot/types/verification/
mod.rs1use serde::Serialize;
2
3use crate::{
4 api::{Method, Payload},
5 types::{ChatId, Integer},
6};
7
8#[cfg(test)]
9mod tests;
10
11#[derive(Clone, Debug, Serialize)]
12pub struct RemoveChatVerification {
14 chat_id: ChatId,
15}
16
17impl RemoveChatVerification {
18 pub fn new<T>(chat_id: T) -> Self
25 where
26 T: Into<ChatId>,
27 {
28 Self {
29 chat_id: chat_id.into(),
30 }
31 }
32}
33
34impl Method for RemoveChatVerification {
35 type Response = bool;
36
37 fn into_payload(self) -> Payload {
38 Payload::json("removeChatVerification", self)
39 }
40}
41
42#[derive(Clone, Copy, Debug, Serialize)]
43pub struct RemoveUserVerification {
45 user_id: Integer,
46}
47
48impl RemoveUserVerification {
49 pub fn new(user_id: Integer) -> Self {
55 Self { user_id }
56 }
57}
58
59impl Method for RemoveUserVerification {
60 type Response = bool;
61
62 fn into_payload(self) -> Payload {
63 Payload::json("removeUserVerification", self)
64 }
65}
66
67#[serde_with::skip_serializing_none]
69#[derive(Clone, Debug, Serialize)]
70pub struct VerifyChat {
71 chat_id: ChatId,
72 custom_description: Option<String>,
73}
74
75impl VerifyChat {
76 pub fn new<T>(chat_id: T) -> Self
83 where
84 T: Into<ChatId>,
85 {
86 Self {
87 chat_id: chat_id.into(),
88 custom_description: None,
89 }
90 }
91
92 pub fn with_custom_description<T>(mut self, value: T) -> Self
99 where
100 T: Into<String>,
101 {
102 self.custom_description = Some(value.into());
103 self
104 }
105}
106
107impl Method for VerifyChat {
108 type Response = bool;
109
110 fn into_payload(self) -> Payload {
111 Payload::json("verifyChat", self)
112 }
113}
114
115#[serde_with::skip_serializing_none]
117#[derive(Clone, Debug, Serialize)]
118pub struct VerifyUser {
119 user_id: Integer,
120 custom_description: Option<String>,
121}
122
123impl VerifyUser {
124 pub fn new(user_id: Integer) -> Self {
130 Self {
131 user_id,
132 custom_description: None,
133 }
134 }
135
136 pub fn with_custom_description<T>(mut self, value: T) -> Self
143 where
144 T: Into<String>,
145 {
146 self.custom_description = Some(value.into());
147 self
148 }
149}
150
151impl Method for VerifyUser {
152 type Response = bool;
153
154 fn into_payload(self) -> Payload {
155 Payload::json("verifyUser", self)
156 }
157}