tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
MessageId.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct MessageId {
8 MessageId() = default;
9 explicit MessageId(const nl::json& json) {
10 fromJson(json);
11 }
12
16 std::int32_t messageId{};
17
20 nl::json toJson() const {
21 nl::json json = nl::json::object();
22 OBJECT_SERIALIZE_FIELD(json, "message_id", messageId);
23 return json;
24 }
25
27 void fromJson(const nl::json& json) {
28 OBJECT_DESERIALIZE_FIELD(json, "message_id", messageId, 0, false);
29 }
30 };
31}
#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
This object represents a unique message identifier. https://core.telegram.org/bots/api#messageid.
Definition MessageId.hpp:7
MessageId(const nl::json &json)
Definition MessageId.hpp:9
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition MessageId.hpp:27
nl::json toJson() const
Serializes this object to JSON.
Definition MessageId.hpp:20
std::int32_t messageId
Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat...
Definition MessageId.hpp:16