tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
InputChecklist.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace tgbotxx {
10 InputChecklist() = default;
11 explicit InputChecklist(const nl::json& json) {
12 fromJson(json);
13 }
14
16 std::string title;
17
19 std::string parseMode;
20
24 std::vector<Ptr<MessageEntity>> titleEntities;
25
27 std::vector<Ptr<InputChecklistTask>> tasks;
28
31
34
37 nl::json toJson() const {
38 nl::json json = nl::json::object();
39 OBJECT_SERIALIZE_FIELD(json, "title", title);
40 OBJECT_SERIALIZE_FIELD(json, "parse_mode", parseMode);
41 OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "title_entities", titleEntities);
43 OBJECT_SERIALIZE_FIELD(json, "others_can_add_tasks", othersCanAddTasks);
44 OBJECT_SERIALIZE_FIELD(json, "others_can_mark_tasks_as_done", othersCanMarkTasksAsDone);
45 return json;
46 }
47
49 void fromJson(const nl::json& json) {
50 OBJECT_DESERIALIZE_FIELD(json, "title", title, "", false);
51 OBJECT_DESERIALIZE_FIELD(json, "parse_mode", parseMode, "", true);
52 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "title_entities", titleEntities, true);
53 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "tasks", tasks, false);
54 OBJECT_DESERIALIZE_FIELD(json, "others_can_add_tasks", othersCanAddTasks, false, true);
55 OBJECT_DESERIALIZE_FIELD(json, "others_can_mark_tasks_as_done", othersCanMarkTasksAsDone, false, true);
56 }
57 };
58
59}
#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 checklist to create. https://core.telegram.org/bots/api#inputchecklist.
bool othersCanMarkTasksAsDone
Optional. Pass True if other users can mark tasks as done or not done in the checklist.
nl::json toJson() const
Serializes this object to JSON.
bool othersCanAddTasks
Optional. Pass True if other users can add tasks to the checklist.
std::vector< Ptr< MessageEntity > > titleEntities
Optional. List of special entities that appear in the title, which can be specified instead of parse_...
std::string title
Title of the checklist; 1-255 characters after entities parsing.
std::string parseMode
Optional. Mode for parsing entities in the title. See formatting options for more details.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::vector< Ptr< InputChecklistTask > > tasks
List of 1-30 tasks in the checklist.
InputChecklist(const nl::json &json)