1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
use serde::{Deserialize, Serialize};
/// This object represents a venue.
/// # Documentation
/// <https://core.telegram.org/bots/api#venue>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Venue {
/// Venue location. Can't be a live location
pub location: crate::types::Location,
/// Name of the venue
pub title: Box<str>,
/// Address of the venue
pub address: Box<str>,
/// Foursquare identifier of the venue
#[serde(skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<Box<str>>,
/// Foursquare type of the venue. (For example, `arts_entertainment/default`, `arts_entertainment/aquarium` or `food/icecream`.)
#[serde(skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<Box<str>>,
/// Google Places identifier of the venue
#[serde(skip_serializing_if = "Option::is_none")]
pub google_place_id: Option<Box<str>>,
/// Google Places type of the venue. (See supported types.)
#[serde(skip_serializing_if = "Option::is_none")]
pub google_place_type: Option<Box<str>>,
}
impl Venue {
/// Creates a new `Venue`.
///
/// # Arguments
/// * `location` - Venue location. Can't be a live location
/// * `title` - Name of the venue
/// * `address` - Address of the venue
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<crate::types::Location>, T1: Into<Box<str>>, T2: Into<Box<str>>>(
location: T0,
title: T1,
address: T2,
) -> Self {
Self {
location: location.into(),
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
}
}
/// Venue location. Can't be a live location
#[must_use]
pub fn location<T: Into<crate::types::Location>>(mut self, val: T) -> Self {
self.location = val.into();
self
}
/// Name of the venue
#[must_use]
pub fn title<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.title = val.into();
self
}
/// Address of the venue
#[must_use]
pub fn address<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.address = val.into();
self
}
/// Foursquare identifier of the venue
#[must_use]
pub fn foursquare_id<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.foursquare_id = Some(val.into());
self
}
/// Foursquare identifier of the venue
#[must_use]
pub fn foursquare_id_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
self.foursquare_id = val.map(Into::into);
self
}
/// Foursquare type of the venue. (For example, `arts_entertainment/default`, `arts_entertainment/aquarium` or `food/icecream`.)
#[must_use]
pub fn foursquare_type<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.foursquare_type = Some(val.into());
self
}
/// Foursquare type of the venue. (For example, `arts_entertainment/default`, `arts_entertainment/aquarium` or `food/icecream`.)
#[must_use]
pub fn foursquare_type_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
self.foursquare_type = val.map(Into::into);
self
}
/// Google Places identifier of the venue
#[must_use]
pub fn google_place_id<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.google_place_id = Some(val.into());
self
}
/// Google Places identifier of the venue
#[must_use]
pub fn google_place_id_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
self.google_place_id = val.map(Into::into);
self
}
/// Google Places type of the venue. (See supported types.)
#[must_use]
pub fn google_place_type<T: Into<Box<str>>>(mut self, val: T) -> Self {
self.google_place_type = Some(val.into());
self
}
/// Google Places type of the venue. (See supported types.)
#[must_use]
pub fn google_place_type_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
self.google_place_type = val.map(Into::into);
self
}
}