tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
DirectMessagesTopic.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
9 DirectMessagesTopic() = default;
10 explicit DirectMessagesTopic(const nl::json& json) {
11 fromJson(json);
12 }
13
17 std::int64_t topicId{};
18
21
22
25 nl::json toJson() const {
26 nl::json json = nl::json::object();
27 OBJECT_SERIALIZE_FIELD(json, "topic_id", topicId);
28 OBJECT_SERIALIZE_FIELD_PTR(json, "user", user);
29 return json;
30 }
31
33 void fromJson(const nl::json& json) {
34 OBJECT_DESERIALIZE_FIELD(json, "topic_id", topicId, 0, false);
35 OBJECT_DESERIALIZE_FIELD_PTR(json, "user", user, true);
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
#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
Describes a topic of a direct messages chat. https://core.telegram.org/bots/api#directmessagestopic.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
DirectMessagesTopic(const nl::json &json)
nl::json toJson() const
Serializes this object to JSON.
std::int64_t topicId
Unique identifier of the topic. This number may have more than 32 significant bits and some programmi...
Ptr< User > user
Optional. Information about the user that created the topic. Currently, it is always present.