tgbotxx  1.1.6.9
Telegram Bot C++ Library
ChatLocation.hpp
Go to the documentation of this file.
1 #pragma once
4 
5 namespace tgbotxx {
8  struct ChatLocation {
9  ChatLocation() = default;
10  explicit ChatLocation(const nl::json& json) {
11  fromJson(json);
12  }
13 
16 
18  std::string address;
19 
20 
23  nl::json toJson() const {
24  nl::json json = nl::json::object();
25  OBJECT_SERIALIZE_FIELD_PTR(json, "location", location);
26  OBJECT_SERIALIZE_FIELD(json, "address", address);
27  return json;
28  }
29 
31  void fromJson(const nl::json& json) {
32  OBJECT_DESERIALIZE_FIELD_PTR(json, "location", location, false);
33  OBJECT_DESERIALIZE_FIELD(json, "address", address, "", false);
34  }
35  };
36 }
#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
Represents a location to which a chat is connected. https://core.telegram.org/bots/api#chatlocation.
Definition: ChatLocation.hpp:8
ChatLocation(const nl::json &json)
Ptr< Location > location
The location to which the supergroup is connected. Can't be a live location.
nl::json toJson() const
Serializes this object to JSON.
std::string address
Location address; 1-64 characters, as defined by the chat owner.
void fromJson(const nl::json &json)
Deserializes this object from JSON.