tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ChecklistTask.hpp
Go to the documentation of this file.
1#pragma once
6
7namespace tgbotxx {
11 ChecklistTask() = default;
12 explicit ChecklistTask(const nl::json& json) {
14 }
15
17 std::int32_t id{};
18
20 std::string text;
21
23 std::vector<Ptr<MessageEntity>> textEntities;
24
27
30
32 std::time_t completionDate{};
33
34
37 nl::json toJson() const {
38 nl::json json = nl::json::object();
42 OBJECT_SERIALIZE_FIELD_PTR(json, "completed_by_user", completedByUser);
43 OBJECT_SERIALIZE_FIELD_PTR(json, "completed_by_chat", completedByChat);
44 OBJECT_SERIALIZE_FIELD(json, "completion_date", completionDate);
45 return json;
46 }
47
49 void fromJson(const nl::json& json) {
50 OBJECT_DESERIALIZE_FIELD(json, "id", id, 0, false);
51 OBJECT_DESERIALIZE_FIELD(json, "text", text, "", false);
53 OBJECT_DESERIALIZE_FIELD_PTR(json, "completed_by_user", completedByUser, true);
54 OBJECT_DESERIALIZE_FIELD_PTR(json, "completed_by_chat", completedByChat, true);
55 OBJECT_DESERIALIZE_FIELD(json, "completion_date", completionDate, 0, true);
56 }
57 };
58}
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition Object.hpp:32
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:39
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition Object.hpp:92
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Serialize.
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:64
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:111
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
Describes a task in a checklist. https://core.telegram.org/bots/api#checklisttask.
std::string text
Text of the task.
std::time_t completionDate
Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed.
ChecklistTask(const nl::json &json)
nl::json toJson() const
Serializes this object to JSON.
Ptr< User > completedByUser
Optional. User that completed the task; omitted if the task wasn't completed.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::vector< Ptr< MessageEntity > > textEntities
Optional. Special entities that appear in the task text.
Ptr< Chat > completedByChat
Optional. User that completed the task; omitted if the task wasn't completed.