tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
InputChecklistTask.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
6
10 InputChecklistTask() = default;
11 explicit InputChecklistTask(const nl::json& json) {
12 fromJson(json);
13 }
14
16 std::int32_t id{};
17
19 std::string text;
20
22 std::string parseMode;
23
26 std::vector<Ptr<MessageEntity>> textEntities;
27
30 nl::json toJson() const {
31 nl::json json = nl::json::object();
32 OBJECT_SERIALIZE_FIELD(json, "id", id);
33 OBJECT_SERIALIZE_FIELD(json, "text", text);
34 OBJECT_SERIALIZE_FIELD(json, "parse_mode", parseMode);
35 OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "text_entities", textEntities);
36 return json;
37 }
38
40 void fromJson(const nl::json& json) {
41 OBJECT_DESERIALIZE_FIELD(json, "id", id, 0, false);
42 OBJECT_DESERIALIZE_FIELD(json, "text", text, "", false);
43 OBJECT_DESERIALIZE_FIELD(json, "parse_mode", parseMode, "", true);
44 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "text_entities", textEntities, true);
45 }
46 };
47
48}
#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
Describes a task to add to a checklist. https://core.telegram.org/bots/api#inputchecklisttask.
InputChecklistTask(const nl::json &json)
std::string parseMode
Optional. Mode for parsing entities in the text. See formatting options for more details.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.
std::string text
Text of the task; 1-100 characters after entities parsing.
std::vector< Ptr< MessageEntity > > textEntities
Optional. List of special entities that appear in the text, which can be specified instead of parse_m...