tgbotxx  1.1.6.9
Telegram Bot C++ Library
ChatPhoto.hpp
Go to the documentation of this file.
1 #pragma once
3 
4 namespace tgbotxx {
7  struct ChatPhoto {
8  ChatPhoto() = default;
9  explicit ChatPhoto(const nl::json& json) {
10  fromJson(json);
11  }
12 
14  std::string smallFileId;
15 
17  std::string smallFileUniqueId;
18 
20  std::string bigFileId;
21 
23  std::string bigFileUniqueId;
24 
27  nl::json toJson() const {
28  nl::json json = nl::json::object();
29  OBJECT_SERIALIZE_FIELD(json, "small_file_id", smallFileId);
30  OBJECT_SERIALIZE_FIELD(json, "small_file_unique_id", smallFileUniqueId);
31  OBJECT_SERIALIZE_FIELD(json, "big_file_id", bigFileId);
32  OBJECT_SERIALIZE_FIELD(json, "big_file_unique_id", bigFileUniqueId);
33  return json;
34  }
35 
37  void fromJson(const nl::json& json) {
38  OBJECT_DESERIALIZE_FIELD(json, "small_file_id", smallFileId, "", false);
39  OBJECT_DESERIALIZE_FIELD(json, "small_file_unique_id", smallFileUniqueId, "", false);
40  OBJECT_DESERIALIZE_FIELD(json, "big_file_id", bigFileId, "", false);
41  OBJECT_DESERIALIZE_FIELD(json, "big_file_unique_id", bigFileUniqueId, "", false);
42  }
43  };
44 }
#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 chat photo. https://core.telegram.org/bots/api#chatphoto.
Definition: ChatPhoto.hpp:7
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition: ChatPhoto.hpp:37
std::string smallFileUniqueId
Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and ...
Definition: ChatPhoto.hpp:17
std::string bigFileId
File identifier of big (640x640) chat photo. This file_id can be used only for photo download and onl...
Definition: ChatPhoto.hpp:20
std::string bigFileUniqueId
Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and fo...
Definition: ChatPhoto.hpp:23
nl::json toJson() const
Serializes this object to JSON.
Definition: ChatPhoto.hpp:27
std::string smallFileId
File identifier of small (160x160) chat photo. This file_id can be used only for photo download and o...
Definition: ChatPhoto.hpp:14
ChatPhoto(const nl::json &json)
Definition: ChatPhoto.hpp:9