tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
UniqueGiftColors.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
8 UniqueGiftColors() = default;
9 explicit UniqueGiftColors(const nl::json& json) {
11 }
12
14 std::string modelCustomEmojiId{};
15
17 std::string symbolCustomEmojiId{};
18
20 std::int32_t lightThemeMainColor{};
21
23 std::vector<std::int32_t> lightThemeOtherColors;
24
26 std::int32_t darkThemeMainColor{};
27
29 std::vector<std::int32_t> darkThemeOtherColors;
30
32 nl::json toJson() const {
33 nl::json json = nl::json::object();
34 OBJECT_SERIALIZE_FIELD(json, "model_custom_emoji_id", modelCustomEmojiId);
35 OBJECT_SERIALIZE_FIELD(json, "symbol_custom_emoji_id", symbolCustomEmojiId);
36 OBJECT_SERIALIZE_FIELD(json, "light_theme_main_color", lightThemeMainColor);
37 OBJECT_SERIALIZE_FIELD(json, "light_theme_other_colors", lightThemeOtherColors);
38 OBJECT_SERIALIZE_FIELD(json, "dark_theme_main_color", darkThemeMainColor);
39 OBJECT_SERIALIZE_FIELD(json, "dark_theme_other_colors", darkThemeOtherColors);
40 return json;
41 }
42
44 void fromJson(const nl::json& json) {
45 OBJECT_DESERIALIZE_FIELD(json, "model_custom_emoji_id", modelCustomEmojiId, "", false);
46 OBJECT_DESERIALIZE_FIELD(json, "symbol_custom_emoji_id", symbolCustomEmojiId, "", false);
47 OBJECT_DESERIALIZE_FIELD(json, "light_theme_main_color", lightThemeMainColor, 0, false);
48 OBJECT_DESERIALIZE_FIELD(json, "light_theme_other_colors", lightThemeOtherColors, {}, false);
49 OBJECT_DESERIALIZE_FIELD(json, "dark_theme_main_color", darkThemeMainColor, 0, false);
50 OBJECT_DESERIALIZE_FIELD(json, "dark_theme_other_colors", darkThemeOtherColors, {}, false);
51 }
52 };
53
54}
#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 contains information about the color scheme for a user's name, message replies and link p...
UniqueGiftColors(const nl::json &json)
std::int32_t darkThemeMainColor
Main color used in dark themes; RGB format.
std::int32_t lightThemeMainColor
Main color used in light themes; RGB format.
std::string modelCustomEmojiId
Custom emoji identifier of the unique gift's model.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.
std::vector< std::int32_t > darkThemeOtherColors
List of 1-3 additional colors used in dark themes; RGB format.
std::string symbolCustomEmojiId
Custom emoji identifier of the unique gift's symbol.
std::vector< std::int32_t > lightThemeOtherColors
List of 1-3 additional colors used in light themes; RGB format.