tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
StoryArea.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace tgbotxx {
7
10 struct StoryArea {
11 StoryArea() = default;
12 explicit StoryArea(const nl::json& json) {
13 fromJson(json);
14 }
15
18
21
24 nl::json toJson() const {
25 nl::json json = nl::json::object();
26 OBJECT_SERIALIZE_FIELD_PTR(json, "position", position);
27 OBJECT_SERIALIZE_FIELD_PTR(json, "type", type);
28 return json;
29 }
30
32 void fromJson(const nl::json& json) {
33 OBJECT_DESERIALIZE_FIELD_PTR(json, "position", position, false);
34 OBJECT_DESERIALIZE_FIELD_PTR(json, "type", type, false);
35 }
36 };
37
38}
#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:72
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
Describes a clickable area on a story media https://core.telegram.org/bots/api#storyarea.
Definition StoryArea.hpp:10
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition StoryArea.hpp:32
StoryArea(const nl::json &json)
Definition StoryArea.hpp:12
Ptr< StoryAreaType > type
Type of the area.
Definition StoryArea.hpp:20
StoryArea()=default
Ptr< StoryAreaPosition > position
Position of the area.
Definition StoryArea.hpp:17
nl::json toJson() const
Serializes this object to JSON.
Definition StoryArea.hpp:24