relegram/requests/
reply_markup.rs1use std::ops::Not;
2
3#[derive(Serialize, Debug, Clone)]
4#[serde(untagged)]
5pub enum ReplyMarkup {
6 InlineKeyboard(InlineKeyboard),
7 ReplyKeyboardMarkup(ReplyKeyboardMarkup),
8 ReplyKeyboardRemove(ReplyKeyboardRemove),
9 ForceReply(ForceReply),
10}
11
12
13#[derive(Serialize, Debug, Clone)]
14pub struct InlineKeyboard {
15 pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>
16}
17
18#[derive(Serialize, Debug, Clone)]
19pub struct ReplyKeyboardMarkup {
20 pub keyboard: Vec<Vec<KeyboardButton>>,
21 #[serde(skip_serializing_if = "Not::not")]
22 pub resize_keyboard: bool,
23 #[serde(skip_serializing_if = "Not::not")]
24 pub one_time_keyboard: bool,
25 #[serde(skip_serializing_if = "Not::not")]
26 pub selective: bool,
27}
28
29#[derive(Serialize, Debug, Clone)]
30pub struct ReplyKeyboardRemove {
31 #[serde(skip_serializing_if = "Not::not")]
32 pub remove_keyboard: bool,
33 #[serde(skip_serializing_if = "Not::not")]
34 pub selective: bool,
35}
36
37#[derive(Serialize, Debug, Clone)]
38pub struct ForceReply {
39 #[serde(skip_serializing_if = "Not::not")]
40 pub force_reply: bool,
41 #[serde(skip_serializing_if = "Not::not")]
42 pub selective: bool,
43}
44
45#[derive(Serialize, Debug, Clone)]
46pub struct InlineKeyboardButton {
47 pub text: String,
48
49 #[serde(skip_serializing_if = "Option::is_none")]
50 pub url: Option<String>,
51
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub callback_data: Option<String>,
54
55 #[serde(skip_serializing_if = "Option::is_none")]
56 pub switch_inline_query: Option<String>,
57
58 #[serde(skip_serializing_if = "Option::is_none")]
59 pub switch_inline_query_current_chat: Option<String>,
60 #[serde(skip_serializing_if = "Not::not")]
62 pub pay: bool,
63}
64
65#[derive(Serialize, Debug, Clone)]
66pub struct KeyboardButton {
67 pub text: String,
68 #[serde(skip_serializing_if = "Not::not")]
69 pub request_contact: bool,
70 #[serde(skip_serializing_if = "Not::not")]
71 pub request_location: bool,
72}