tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
SuggestedPostPrice.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
8 SuggestedPostPrice() = default;
9 explicit SuggestedPostPrice(const nl::json& json) {
10 fromJson(json);
11 }
12
15 std::string currency;
16
20 std::int64_t amount{};
21
24 nl::json toJson() const {
25 nl::json json = nl::json::object();
26 OBJECT_SERIALIZE_FIELD(json, "currency", currency);
27 OBJECT_SERIALIZE_FIELD(json, "amount", amount);
28 return json;
29 }
30
32 void fromJson(const nl::json& json) {
33 OBJECT_DESERIALIZE_FIELD(json, "currency", currency, "", false);
34 OBJECT_DESERIALIZE_FIELD(json, "amount", amount, 0, false);
35 }
36 };
37}
#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
Describes the price of a suggested post. https://core.telegram.org/bots/api#suggestedpostprice.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
SuggestedPostPrice(const nl::json &json)
nl::json toJson() const
Serializes this object to JSON.
SuggestedPostPrice()=default
std::string currency
Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” ...
std::int64_t amount
The amount of the currency that will be paid for the post in the smallest units of the currency,...