tgbot/types/definitions/
verification.rs1use serde::Serialize;
2
3use crate::{
4 api::{Method, Payload},
5 types::{ChatId, Integer},
6};
7
8#[derive(Clone, Debug, Serialize)]
9pub struct RemoveChatVerification {
11 chat_id: ChatId,
12}
13
14impl RemoveChatVerification {
15 pub fn new<T>(chat_id: T) -> Self
22 where
23 T: Into<ChatId>,
24 {
25 Self {
26 chat_id: chat_id.into(),
27 }
28 }
29}
30
31impl Method for RemoveChatVerification {
32 type Response = bool;
33
34 fn into_payload(self) -> Payload {
35 Payload::json("removeChatVerification", self)
36 }
37}
38
39#[derive(Clone, Copy, Debug, Serialize)]
40pub struct RemoveUserVerification {
42 user_id: Integer,
43}
44
45impl RemoveUserVerification {
46 pub fn new(user_id: Integer) -> Self {
52 Self { user_id }
53 }
54}
55
56impl Method for RemoveUserVerification {
57 type Response = bool;
58
59 fn into_payload(self) -> Payload {
60 Payload::json("removeUserVerification", self)
61 }
62}
63
64#[serde_with::skip_serializing_none]
66#[derive(Clone, Debug, Serialize)]
67pub struct VerifyChat {
68 chat_id: ChatId,
69 custom_description: Option<String>,
70}
71
72impl VerifyChat {
73 pub fn new<T>(chat_id: T) -> Self
80 where
81 T: Into<ChatId>,
82 {
83 Self {
84 chat_id: chat_id.into(),
85 custom_description: None,
86 }
87 }
88
89 pub fn with_custom_description<T>(mut self, value: T) -> Self
96 where
97 T: Into<String>,
98 {
99 self.custom_description = Some(value.into());
100 self
101 }
102}
103
104impl Method for VerifyChat {
105 type Response = bool;
106
107 fn into_payload(self) -> Payload {
108 Payload::json("verifyChat", self)
109 }
110}
111
112#[serde_with::skip_serializing_none]
114#[derive(Clone, Debug, Serialize)]
115pub struct VerifyUser {
116 user_id: Integer,
117 custom_description: Option<String>,
118}
119
120impl VerifyUser {
121 pub fn new(user_id: Integer) -> Self {
127 Self {
128 user_id,
129 custom_description: None,
130 }
131 }
132
133 pub fn with_custom_description<T>(mut self, value: T) -> Self
140 where
141 T: Into<String>,
142 {
143 self.custom_description = Some(value.into());
144 self
145 }
146}
147
148impl Method for VerifyUser {
149 type Response = bool;
150
151 fn into_payload(self) -> Payload {
152 Payload::json("verifyUser", self)
153 }
154}