teloxide_core/types/
inline_query_result_location.rs1use serde::{Deserialize, Serialize};
2
3use crate::types::{InlineKeyboardMarkup, InputMessageContent, LivePeriod};
4
5#[serde_with::skip_serializing_none]
13#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
14pub struct InlineQueryResultLocation {
15 pub id: String,
17
18 pub latitude: f64,
20
21 pub longitude: f64,
23
24 pub title: String,
26
27 pub horizontal_accuracy: Option<f64>,
29
30 pub live_period: Option<LivePeriod>,
34
35 pub heading: Option<u16>,
38
39 pub proximity_alert_radius: Option<u32>,
43
44 pub reply_markup: Option<InlineKeyboardMarkup>,
48
49 pub input_message_content: Option<InputMessageContent>,
51
52 pub thumbnail_url: Option<reqwest::Url>,
54
55 pub thumbnail_width: Option<u32>,
57
58 pub thumbnail_height: Option<u32>,
60}
61
62impl InlineQueryResultLocation {
63 pub fn new<S1, S2>(id: S1, title: S2, latitude: f64, longitude: f64) -> Self
64 where
65 S1: Into<String>,
66 S2: Into<String>,
67 {
68 Self {
69 id: id.into(),
70 title: title.into(),
71 latitude,
72 longitude,
73 live_period: None,
74 reply_markup: None,
75 input_message_content: None,
76 thumbnail_url: None,
77 thumbnail_width: None,
78 thumbnail_height: None,
79 horizontal_accuracy: None,
80 heading: None,
81 proximity_alert_radius: None,
82 }
83 }
84
85 pub fn id<S>(mut self, val: S) -> Self
86 where
87 S: Into<String>,
88 {
89 self.id = val.into();
90 self
91 }
92
93 #[must_use]
94 pub fn latitude(mut self, val: f64) -> Self {
95 self.latitude = val;
96 self
97 }
98
99 #[must_use]
100 pub fn longitude(mut self, val: f64) -> Self {
101 self.longitude = val;
102 self
103 }
104
105 pub fn title<S>(mut self, val: S) -> Self
106 where
107 S: Into<String>,
108 {
109 self.title = val.into();
110 self
111 }
112
113 #[must_use]
114 pub fn horizontal_accuracy<S>(mut self, val: f64) -> Self {
115 self.horizontal_accuracy = Some(val);
116 self
117 }
118
119 #[must_use]
120 pub fn live_period(mut self, val: LivePeriod) -> Self {
121 self.live_period = Some(val);
122 self
123 }
124
125 #[must_use]
126 pub fn heading(mut self, val: u16) -> Self {
127 self.heading = Some(val);
128 self
129 }
130
131 #[must_use]
132 pub fn proximity_alert_radius(mut self, val: u32) -> Self {
133 self.proximity_alert_radius = Some(val);
134 self
135 }
136
137 #[must_use]
138 pub fn reply_markup(mut self, val: InlineKeyboardMarkup) -> Self {
139 self.reply_markup = Some(val);
140 self
141 }
142
143 #[must_use]
144 pub fn input_message_content(mut self, val: InputMessageContent) -> Self {
145 self.input_message_content = Some(val);
146 self
147 }
148
149 #[must_use]
150 pub fn thumbnail_url(mut self, val: reqwest::Url) -> Self {
151 self.thumbnail_url = Some(val);
152 self
153 }
154
155 #[must_use]
156 pub fn thumbnail_width(mut self, val: u32) -> Self {
157 self.thumbnail_width = Some(val);
158 self
159 }
160
161 #[must_use]
162 pub fn thumbnail_height(mut self, val: u32) -> Self {
163 self.thumbnail_height = Some(val);
164 self
165 }
166}