tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ProximityAlertTriggered.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
10 explicit ProximityAlertTriggered(const nl::json& json) {
11 fromJson(json);
12 }
13
16
19
21 std::int32_t distance{};
22
23
26 nl::json toJson() const {
27 nl::json json = nl::json::object();
28 OBJECT_SERIALIZE_FIELD_PTR(json, "traveler", traveler);
29 OBJECT_SERIALIZE_FIELD_PTR(json, "watcher", watcher);
30 OBJECT_SERIALIZE_FIELD(json, "distance", distance);
31 return json;
32 }
33
35 void fromJson(const nl::json& json) {
36 OBJECT_DESERIALIZE_FIELD_PTR(json, "traveler", traveler, false);
37 OBJECT_DESERIALIZE_FIELD_PTR(json, "watcher", watcher, false);
38 OBJECT_DESERIALIZE_FIELD(json, "distance", distance, 0, false);
39 }
40 };
41}
#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
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object represents the content of a service message, sent whenever a user in the chat triggers a ...
Ptr< User > traveler
User that triggered the alert.
Ptr< User > watcher
User that set the alert.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.
std::int32_t distance
The distance between the users.