tgbotxx  1.1.6.9
Telegram Bot C++ Library
MessageId.hpp
Go to the documentation of this file.
1 #pragma once
3 
4 namespace tgbotxx {
7  struct MessageId {
8  MessageId() = default;
9  explicit MessageId(const nl::json& json) {
10  fromJson(json);
11  }
12 
13  std::int32_t messageId{};
14 
17  nl::json toJson() const {
18  nl::json json = nl::json::object();
19  OBJECT_SERIALIZE_FIELD(json, "message_id", messageId);
20  return json;
21  }
22 
24  void fromJson(const nl::json& json) {
25  OBJECT_DESERIALIZE_FIELD(json, "message_id", messageId, 0, false);
26  }
27  };
28 }
#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:44
Definition: Api.hpp:14
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:24
nl::json toJson() const
Serializes this object to JSON.
Definition: MessageId.hpp:17
std::int32_t messageId
Definition: MessageId.hpp:13