tgbotxx  1.1.6.9
Telegram Bot C++ Library
Venue.hpp
Go to the documentation of this file.
1 #pragma once
4 
5 namespace tgbotxx {
8  struct Venue {
9  Venue() = default;
10  explicit Venue(const nl::json& json) {
11  fromJson(json);
12  }
13 
16 
18  std::string title;
19 
21  std::string address;
22 
24  std::string foursquareId;
25 
28  std::string foursquareType;
29 
31  std::string googlePlaceId;
32 
34  std::string googlePlaceType;
35 
36 
39  nl::json toJson() const {
40  nl::json json = nl::json::object();
41  OBJECT_SERIALIZE_FIELD_PTR(json, "location", location);
42  OBJECT_SERIALIZE_FIELD(json, "title", title);
43  OBJECT_SERIALIZE_FIELD(json, "address", address);
44  OBJECT_SERIALIZE_FIELD(json, "foursquare_id", foursquareId);
45  OBJECT_SERIALIZE_FIELD(json, "foursquare_type", foursquareType);
46  OBJECT_SERIALIZE_FIELD(json, "google_place_id", googlePlaceId);
47  OBJECT_SERIALIZE_FIELD(json, "google_place_type", googlePlaceType);
48  return json;
49  }
50 
52  void fromJson(const nl::json& json) {
53  OBJECT_DESERIALIZE_FIELD_PTR(json, "location", location, false);
54  OBJECT_DESERIALIZE_FIELD(json, "title", title, "", false);
55  OBJECT_DESERIALIZE_FIELD(json, "address", address, "", false);
56  OBJECT_DESERIALIZE_FIELD(json, "foursquare_id", foursquareId, "", true);
57  OBJECT_DESERIALIZE_FIELD(json, "foursquare_type", foursquareType, "", true);
58  OBJECT_DESERIALIZE_FIELD(json, "google_place_id", googlePlaceId, "", true);
59  OBJECT_DESERIALIZE_FIELD(json, "google_place_type", googlePlaceType, "", true);
60  }
61  };
62 }
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition: Object.hpp:22
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition: Object.hpp:70
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition: Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition: Object.hpp:44
Definition: Api.hpp:14
std::shared_ptr< T > Ptr
Definition: Ptr.hpp:6
This object represents a venue. https://core.telegram.org/bots/api#venue.
Definition: Venue.hpp:8
Venue(const nl::json &json)
Definition: Venue.hpp:10
Ptr< Location > location
Venue location. Can't be a live location.
Definition: Venue.hpp:15
std::string foursquareType
Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”,...
Definition: Venue.hpp:28
std::string title
Name of the venue.
Definition: Venue.hpp:18
std::string foursquareId
Optional. Foursquare identifier of the venue.
Definition: Venue.hpp:24
std::string googlePlaceId
Optional. Google Places identifier of the venue.
Definition: Venue.hpp:31
std::string googlePlaceType
Optional. Google Places type of the venue. (See supported types.) https://developers....
Definition: Venue.hpp:34
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition: Venue.hpp:52
Venue()=default
std::string address
Address of the venue.
Definition: Venue.hpp:21
nl::json toJson() const
Serializes this object to JSON.
Definition: Venue.hpp:39