tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
UniqueGiftBackdrop.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
9 UniqueGiftBackdrop() = default;
10 explicit UniqueGiftBackdrop(const nl::json& json) {
11 fromJson(json);
12 }
13
15 std::string name;
16
19
21 std::int32_t rarityPerMille{};
22
24 nl::json toJson() const {
25 nl::json json = nl::json::object();
26 OBJECT_SERIALIZE_FIELD(json, "name", name);
27 OBJECT_SERIALIZE_FIELD_PTR(json, "colors", colors);
28 OBJECT_SERIALIZE_FIELD(json, "rarity_per_mille", rarityPerMille);
29 return json;
30 }
31
33 void fromJson(const nl::json& json) {
34 OBJECT_DESERIALIZE_FIELD(json, "name", name, "", false);
35 OBJECT_DESERIALIZE_FIELD_PTR(json, "colors", colors, false);
36 OBJECT_DESERIALIZE_FIELD(json, "rarity_per_mille", rarityPerMille, 0, false);
37 }
38 };
39
40}
#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
This object describes the backdrop of a unique gift. https://core.telegram.org/bots/api#uniquegiftbac...
Ptr< UniqueGiftBackdropColors > colors
Colors of the backdrop.
std::int32_t rarityPerMille
The number of unique gifts that receive this backdrop for every 1000 gifts upgraded.
UniqueGiftBackdrop(const nl::json &json)
nl::json toJson() const
Serializes this object to JSON.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::string name
Name of the backdrop.