tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
InputPollOption.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
9 InputPollOption() = default;
10 explicit InputPollOption(const nl::json& json) {
11 fromJson(json);
12 }
13
15 std::string text;
16
18 std::string textParseMode;
19
22 std::vector<Ptr<MessageEntity>> textEntities;
23
26 nl::json toJson() const {
27 nl::json json = nl::json::object();
28 OBJECT_SERIALIZE_FIELD(json, "text", text);
29 OBJECT_SERIALIZE_FIELD(json, "text_parse_mode", textParseMode);
30 OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "text_entities", textEntities);
31 return json;
32 }
33
35 void fromJson(const nl::json& json) {
36 OBJECT_DESERIALIZE_FIELD(json, "text", text, "", false);
37 OBJECT_DESERIALIZE_FIELD(json, "text_parse_mode", textParseMode, "", true);
38 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "text_entities", textEntities, true);
39 }
40 };
41}
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:27
#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
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:89
This object contains information about one answer option in a poll to be sent. https://core....
nl::json toJson() const
Serializes this object to JSON.
std::vector< Ptr< MessageEntity > > textEntities
Optional. A JSON-serialized list of special entities that appear in the poll option text....
InputPollOption(const nl::json &json)
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::string textParseMode
Optional. Mode for parsing entities in the text. Currently, only custom emoji entities are allowed.
std::string text
Option text, 1-100 characters.