tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
SuggestedPostApproved.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace tgbotxx {
7
12 explicit SuggestedPostApproved(const nl::json& json) {
13 fromJson(json);
14 }
15
18
21
23 std::time_t sendDate{};
24
27 nl::json toJson() const {
28 nl::json json = nl::json::object();
29 OBJECT_SERIALIZE_FIELD_PTR(json, "suggested_post_message", suggestedPostMessage);
30 OBJECT_SERIALIZE_FIELD_PTR(json, "price", price);
31 OBJECT_SERIALIZE_FIELD(json, "send_date", sendDate);
32 return json;
33 }
35 void fromJson(const nl::json& json) {
36 OBJECT_DESERIALIZE_FIELD_PTR(json, "suggested_post_message", suggestedPostMessage, true);
37 OBJECT_DESERIALIZE_FIELD_PTR(json, "price", price, true);
38 OBJECT_DESERIALIZE_FIELD(json, "send_date", sendDate, 0, false);
39 }
40 };
41
42}
#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 service message about the approval of a suggested post. https://core.telegram....
nl::json toJson() const
Serializes this object to JSON.
Ptr< SuggestedPostPrice > price
Optional. Amount paid for the post.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::time_t sendDate
Date when the post will be published.
SuggestedPostApproved(const nl::json &json)
Ptr< Message > suggestedPostMessage
Optional. Message containing the suggested post.
SuggestedPostApproved()=default