tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
SuggestedPostParameters.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
10 explicit SuggestedPostParameters(const nl::json& json) {
11 fromJson(json);
12 }
13
16
20 std::time_t sendDate{};
21
24 nl::json toJson() const {
25 nl::json json = nl::json::object();
26 OBJECT_SERIALIZE_FIELD_PTR(json, "price", price);
27 OBJECT_SERIALIZE_FIELD(json, "send_date", sendDate);
28 return json;
29 }
30
32 void fromJson(const nl::json& json) {
33 OBJECT_DESERIALIZE_FIELD_PTR(json, "price", price, true);
34 OBJECT_DESERIALIZE_FIELD(json, "send_date", sendDate, 0, true);
35 }
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
Contains parameters of a post that is being suggested by the bot. https://core.telegram....
Ptr< SuggestedPostPrice > price
Optional. Proposed price for the post. If the field is omitted, then the post is unpaid.
SuggestedPostParameters(const nl::json &json)
SuggestedPostParameters()=default
nl::json toJson() const
Serializes this object to JSON.
std::time_t sendDate
Optional. Proposed send date of the post. If specified, then the date must be between 300 second and ...
void fromJson(const nl::json &json)
Deserializes this object from JSON.