tgbotxx  1.1.6.9
Telegram Bot C++ Library
ForumTopicCreated.hpp
Go to the documentation of this file.
1 #pragma once
3 
4 namespace tgbotxx {
8  ForumTopicCreated() = default;
9  explicit ForumTopicCreated(const nl::json& json) {
10  fromJson(json);
11  }
12 
14  std::string name;
15 
17  std::int32_t iconColor{};
18 
20  std::string iconCustomEmojiId;
21 
22 
25  nl::json toJson() const {
26  nl::json json = nl::json::object();
27  OBJECT_SERIALIZE_FIELD(json, "name", name);
28  OBJECT_SERIALIZE_FIELD(json, "icon_color", iconColor);
29  OBJECT_SERIALIZE_FIELD(json, "icon_custom_emoji_id", iconCustomEmojiId);
30  return json;
31  }
32 
34  void fromJson(const nl::json& json) {
35  OBJECT_DESERIALIZE_FIELD(json, "name", name, "", false);
36  OBJECT_DESERIALIZE_FIELD(json, "icon_color", iconColor, 0, false);
37  OBJECT_DESERIALIZE_FIELD(json, "icon_custom_emoji_id", iconCustomEmojiId, "", true);
38  }
39  };
40 }
#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:44
Definition: Api.hpp:14
This object represents a service message about a new forum topic created in the chat....
std::string iconCustomEmojiId
Optional. Unique identifier of the custom emoji shown as the topic icon.
nl::json toJson() const
Serializes this object to JSON.
std::string name
Name of the topic.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
ForumTopicCreated(const nl::json &json)
std::int32_t iconColor
Color of the topic icon in RGB format.