tele/types/
advanced_forum.rs1use serde::Serialize;
3use serde_json::Value;
4
5use super::AdvancedRequest;
6
7#[derive(Clone, Debug, Serialize)]
9pub struct AdvancedCloseForumTopicRequest {
10 pub chat_id: crate::types::common::ChatId,
11 pub message_thread_id: i64,
12}
13
14impl AdvancedCloseForumTopicRequest {
15 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
16 Self {
17 chat_id: chat_id.into(),
18 message_thread_id,
19 }
20 }
21}
22
23impl AdvancedRequest for AdvancedCloseForumTopicRequest {
24 type Response = bool;
25 const METHOD: &'static str = "closeForumTopic";
26}
27
28#[derive(Clone, Debug, Serialize)]
30pub struct AdvancedCloseGeneralForumTopicRequest {
31 pub chat_id: crate::types::common::ChatId,
32}
33
34impl AdvancedCloseGeneralForumTopicRequest {
35 pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
36 Self {
37 chat_id: chat_id.into(),
38 }
39 }
40}
41
42impl AdvancedRequest for AdvancedCloseGeneralForumTopicRequest {
43 type Response = bool;
44 const METHOD: &'static str = "closeGeneralForumTopic";
45}
46
47#[derive(Clone, Debug, Serialize)]
49pub struct AdvancedCreateForumTopicRequest {
50 pub chat_id: crate::types::common::ChatId,
51 pub name: String,
52 #[serde(default, skip_serializing_if = "Option::is_none")]
53 pub icon_color: Option<i64>,
54 #[serde(default, skip_serializing_if = "Option::is_none")]
55 pub icon_custom_emoji_id: Option<String>,
56}
57
58impl AdvancedCreateForumTopicRequest {
59 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, name: impl Into<String>) -> Self {
60 Self {
61 chat_id: chat_id.into(),
62 name: name.into(),
63 icon_color: None,
64 icon_custom_emoji_id: None,
65 }
66 }
67}
68
69impl AdvancedRequest for AdvancedCreateForumTopicRequest {
70 type Response = Value;
71 const METHOD: &'static str = "createForumTopic";
72}
73
74#[derive(Clone, Debug, Serialize)]
76pub struct AdvancedDeleteForumTopicRequest {
77 pub chat_id: crate::types::common::ChatId,
78 pub message_thread_id: i64,
79}
80
81impl AdvancedDeleteForumTopicRequest {
82 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
83 Self {
84 chat_id: chat_id.into(),
85 message_thread_id,
86 }
87 }
88}
89
90impl AdvancedRequest for AdvancedDeleteForumTopicRequest {
91 type Response = bool;
92 const METHOD: &'static str = "deleteForumTopic";
93}
94
95#[derive(Clone, Debug, Serialize)]
97pub struct AdvancedEditForumTopicRequest {
98 pub chat_id: crate::types::common::ChatId,
99 pub message_thread_id: i64,
100 #[serde(default, skip_serializing_if = "Option::is_none")]
101 pub name: Option<String>,
102 #[serde(default, skip_serializing_if = "Option::is_none")]
103 pub icon_custom_emoji_id: Option<String>,
104}
105
106impl AdvancedEditForumTopicRequest {
107 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
108 Self {
109 chat_id: chat_id.into(),
110 message_thread_id,
111 name: None,
112 icon_custom_emoji_id: None,
113 }
114 }
115}
116
117impl AdvancedRequest for AdvancedEditForumTopicRequest {
118 type Response = bool;
119 const METHOD: &'static str = "editForumTopic";
120}
121
122#[derive(Clone, Debug, Serialize)]
124pub struct AdvancedEditGeneralForumTopicRequest {
125 pub chat_id: crate::types::common::ChatId,
126 pub name: String,
127}
128
129impl AdvancedEditGeneralForumTopicRequest {
130 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, name: impl Into<String>) -> Self {
131 Self {
132 chat_id: chat_id.into(),
133 name: name.into(),
134 }
135 }
136}
137
138impl AdvancedRequest for AdvancedEditGeneralForumTopicRequest {
139 type Response = bool;
140 const METHOD: &'static str = "editGeneralForumTopic";
141}
142
143#[derive(Clone, Debug, Default, Serialize)]
145pub struct AdvancedGetForumTopicIconStickersRequest {}
146
147impl AdvancedGetForumTopicIconStickersRequest {
148 pub fn new() -> Self {
149 Self {}
150 }
151}
152
153impl AdvancedRequest for AdvancedGetForumTopicIconStickersRequest {
154 type Response = Vec<crate::types::sticker::Sticker>;
155 const METHOD: &'static str = "getForumTopicIconStickers";
156}
157
158#[derive(Clone, Debug, Serialize)]
160pub struct AdvancedHideGeneralForumTopicRequest {
161 pub chat_id: crate::types::common::ChatId,
162}
163
164impl AdvancedHideGeneralForumTopicRequest {
165 pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
166 Self {
167 chat_id: chat_id.into(),
168 }
169 }
170}
171
172impl AdvancedRequest for AdvancedHideGeneralForumTopicRequest {
173 type Response = bool;
174 const METHOD: &'static str = "hideGeneralForumTopic";
175}
176
177#[derive(Clone, Debug, Serialize)]
179pub struct AdvancedReopenForumTopicRequest {
180 pub chat_id: crate::types::common::ChatId,
181 pub message_thread_id: i64,
182}
183
184impl AdvancedReopenForumTopicRequest {
185 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
186 Self {
187 chat_id: chat_id.into(),
188 message_thread_id,
189 }
190 }
191}
192
193impl AdvancedRequest for AdvancedReopenForumTopicRequest {
194 type Response = bool;
195 const METHOD: &'static str = "reopenForumTopic";
196}
197
198#[derive(Clone, Debug, Serialize)]
200pub struct AdvancedReopenGeneralForumTopicRequest {
201 pub chat_id: crate::types::common::ChatId,
202}
203
204impl AdvancedReopenGeneralForumTopicRequest {
205 pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
206 Self {
207 chat_id: chat_id.into(),
208 }
209 }
210}
211
212impl AdvancedRequest for AdvancedReopenGeneralForumTopicRequest {
213 type Response = bool;
214 const METHOD: &'static str = "reopenGeneralForumTopic";
215}
216
217#[derive(Clone, Debug, Serialize)]
219pub struct AdvancedUnhideGeneralForumTopicRequest {
220 pub chat_id: crate::types::common::ChatId,
221}
222
223impl AdvancedUnhideGeneralForumTopicRequest {
224 pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
225 Self {
226 chat_id: chat_id.into(),
227 }
228 }
229}
230
231impl AdvancedRequest for AdvancedUnhideGeneralForumTopicRequest {
232 type Response = bool;
233 const METHOD: &'static str = "unhideGeneralForumTopic";
234}
235
236#[derive(Clone, Debug, Serialize)]
238pub struct AdvancedUnpinAllForumTopicMessagesRequest {
239 pub chat_id: crate::types::common::ChatId,
240 pub message_thread_id: i64,
241}
242
243impl AdvancedUnpinAllForumTopicMessagesRequest {
244 pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
245 Self {
246 chat_id: chat_id.into(),
247 message_thread_id,
248 }
249 }
250}
251
252impl AdvancedRequest for AdvancedUnpinAllForumTopicMessagesRequest {
253 type Response = bool;
254 const METHOD: &'static str = "unpinAllForumTopicMessages";
255}
256
257#[derive(Clone, Debug, Serialize)]
259pub struct AdvancedUnpinAllGeneralForumTopicMessagesRequest {
260 pub chat_id: crate::types::common::ChatId,
261}
262
263impl AdvancedUnpinAllGeneralForumTopicMessagesRequest {
264 pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
265 Self {
266 chat_id: chat_id.into(),
267 }
268 }
269}
270
271impl AdvancedRequest for AdvancedUnpinAllGeneralForumTopicMessagesRequest {
272 type Response = bool;
273 const METHOD: &'static str = "unpinAllGeneralForumTopicMessages";
274}