tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
Story.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
8 struct Story {
9 Story() = default;
10 explicit Story(const nl::json& json) {
11 fromJson(json);
12 }
13
16
18 std::int32_t id{};
19
22 nl::json toJson() const {
23 nl::json json = nl::json::object();
24 OBJECT_SERIALIZE_FIELD_PTR(json, "chat", chat);
25 OBJECT_SERIALIZE_FIELD(json, "id", id);
26 return json;
27 }
28
30 void fromJson(const nl::json& json) {
31 OBJECT_DESERIALIZE_FIELD_PTR(json, "chat", chat, false);
32 OBJECT_DESERIALIZE_FIELD(json, "id", id, 0, false);
33 }
34 };
35}
#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
#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:46
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object represents a story. . https://core.telegram.org/bots/api#story.
Definition Story.hpp:8
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition Story.hpp:30
Story()=default
Story(const nl::json &json)
Definition Story.hpp:10
nl::json toJson() const
Serializes this object to JSON.
Definition Story.hpp:22
Ptr< Chat > chat
Chat that posted the story.
Definition Story.hpp:15