tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ReactionCount.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
8 struct ReactionCount {
9 ReactionCount() = default;
10 explicit ReactionCount(const nl::json& json) {
11 fromJson(json);
12 }
13
16
18 std::int32_t totalCount{};
19
22 nl::json toJson() const {
23 nl::json json = nl::json::object();
24 OBJECT_SERIALIZE_FIELD_PTR(json, "type", type);
25 OBJECT_SERIALIZE_FIELD(json, "total_count", totalCount);
26 return json;
27 }
28
30 void fromJson(const nl::json& json) {
31 OBJECT_DESERIALIZE_FIELD_PTR(json, "type", type, false);
32 OBJECT_DESERIALIZE_FIELD(json, "total_count", totalCount, 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: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
Represents a reaction added to a message along with the number of times it was added....
Ptr< ReactionType > type
Type of the reaction.
nl::json toJson() const
Serializes this object to JSON.
ReactionCount(const nl::json &json)
std::int32_t totalCount
Number of times the reaction was added.
void fromJson(const nl::json &json)
Deserializes this object from JSON.