tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
VideoQuality.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct VideoQuality {
8 VideoQuality() = default;
9 explicit VideoQuality(const nl::json& json) {
11 }
12
14 std::string fileId;
15
18 std::string fileUniqueId;
19
21 std::int32_t width{};
22
24 std::int32_t height{};
25
27 std::string codec;
28
32 std::int64_t fileSize{};
33
34
37 nl::json toJson() const {
38 nl::json json = nl::json::object();
40 OBJECT_SERIALIZE_FIELD(json, "file_unique_id", fileUniqueId);
45 return json;
46 }
47
49 void fromJson(const nl::json& json) {
50 OBJECT_DESERIALIZE_FIELD(json, "file_id", fileId, "", false);
51 OBJECT_DESERIALIZE_FIELD(json, "file_unique_id", fileUniqueId, "", false);
52 OBJECT_DESERIALIZE_FIELD(json, "width", width, 0, false);
53 OBJECT_DESERIALIZE_FIELD(json, "height", height, 0, false);
54 OBJECT_DESERIALIZE_FIELD(json, "codec", codec, "", false);
55 OBJECT_DESERIALIZE_FIELD(json, "file_size", fileSize, 0, true);
56 }
57 };
58}
#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
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object represents a video file of a specific quality. https://core.telegram.org/bots/api#videoqu...
VideoQuality(const nl::json &json)
std::string codec
Codec that was used to encode the video, for example, “h264”, “h265”, or “av01”
nl::json toJson() const
Serializes this object to JSON.
std::string fileUniqueId
Unique identifier for this file, which is supposed to be the same over time and for different bots....
std::int32_t width
Video width.
std::int32_t height
Video height.
std::string fileId
Identifier for this file, which can be used to download or reuse the file.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::int64_t fileSize
Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have diff...