tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ChatBoostRemoved.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace tgbotxx {
10 ChatBoostRemoved() = default;
11 explicit ChatBoostRemoved(const nl::json& json) {
12 fromJson(json);
13 }
14
17
19 std::string boostID;
20
22 std::time_t removeDate{};
23
26
27
30 nl::json toJson() const {
31 nl::json json = nl::json::object();
32 OBJECT_SERIALIZE_FIELD_PTR(json, "chat", chat);
33 OBJECT_SERIALIZE_FIELD(json, "boost_id", boostID);
34 OBJECT_SERIALIZE_FIELD(json, "remove_date", removeDate);
35 OBJECT_SERIALIZE_FIELD_PTR(json, "source", source);
36 return json;
37 }
38
40 void fromJson(const nl::json& json) {
41 OBJECT_DESERIALIZE_FIELD_PTR(json, "chat", chat, false);
42 OBJECT_DESERIALIZE_FIELD(json, "boost_id", boostID, "", false);
43 OBJECT_DESERIALIZE_FIELD(json, "remove_date", removeDate, 0, false);
44 OBJECT_DESERIALIZE_FIELD_PTR(json, "source", source, false);
45 }
46 };
47}
#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 a boost removed from a chat. https://core.telegram.org/bots/api#chatboostremov...
nl::json toJson() const
Serializes this object to JSON.
Ptr< Chat > chat
Chat which was boosted.
Ptr< ChatBoostSource > source
Source of the removed boost.
std::string boostID
Unique identifier of the boost.
std::time_t removeDate
Point in time (Unix timestamp) when the boost was removed.
ChatBoostRemoved(const nl::json &json)
void fromJson(const nl::json &json)
Deserializes this object from JSON.