tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
GiftBackground.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
8 GiftBackground() = default;
9 explicit GiftBackground(const nl::json& json) {
11 }
12
14 std::int32_t centerColor{};
15
17 std::int32_t edgeColor{};
18
20 std::int32_t textColor{};
21
22
25 nl::json toJson() const {
26 nl::json json = nl::json::object();
27 OBJECT_SERIALIZE_FIELD(json, "center_color", centerColor);
30 return json;
31 }
32
34 void fromJson(const nl::json& json) {
35 OBJECT_DESERIALIZE_FIELD(json, "center_color", centerColor, 0x000000, false);
36 OBJECT_DESERIALIZE_FIELD(json, "edge_color", edgeColor, 0x000000, false);
37 OBJECT_DESERIALIZE_FIELD(json, "text_color", textColor, 0x000000, false);
38 }
39 };
40}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Serialize.
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:64
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object describes the background of a gift. https://core.telegram.org/bots/api#giftbackground.
std::int32_t textColor
Text color of the background in RGB format.
std::int32_t edgeColor
Edge color of the background in RGB format.
nl::json toJson() const
Serializes this object to JSON.
std::int32_t centerColor
Center color of the background in RGB format.
GiftBackground(const nl::json &json)
void fromJson(const nl::json &json)
Deserializes this object from JSON.