tgbotxx 1.1.6.9
Telegram Bot C++ Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BotName.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct BotName {
8 BotName() = default;
9 explicit BotName(const nl::json& json) {
10 fromJson(json);
11 }
12
14 std::string name;
15
18 nl::json toJson() const {
19 nl::json json = nl::json::object();
20 OBJECT_SERIALIZE_FIELD(json, "name", name);
21 return json;
22 }
23
25 void fromJson(const nl::json& json) {
26 OBJECT_DESERIALIZE_FIELD(json, "name", name, "", false);
27 }
28 };
29}
#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
This object represents the bot's name. https://core.telegram.org/bots/api#botname.
Definition BotName.hpp:7
BotName()=default
nl::json toJson() const
Serializes this object to JSON.
Definition BotName.hpp:18
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition BotName.hpp:25
std::string name
The bot's name.
Definition BotName.hpp:14
BotName(const nl::json &json)
Definition BotName.hpp:9