tgbotxx 1.2.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
PassportElementError.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
19 explicit PassportElementError(const nl::json& json) {
21 }
22 virtual ~PassportElementError() = default;
23
25 std::string source;
26
29 std::string type;
30
33 [[nodiscard]] virtual nl::json toJson() const {
34 nl::json json = nl::json::object();
37 return json;
38 }
39
41 virtual void fromJson(const nl::json& json) {
42 OBJECT_DESERIALIZE_FIELD(json, "source", source, "", false);
43 OBJECT_DESERIALIZE_FIELD(json, "type", type, "", false);
44 }
45 };
46
57
59 std::string fieldName;
60
62 std::string dataHash;
63
65 std::string message;
66
67 [[nodiscard]] nl::json toJson() const override {
72 return json;
73 }
74 void fromJson(const nl::json& json) override {
76 OBJECT_DESERIALIZE_FIELD(json, "field_name", fieldName, "", false);
77 OBJECT_DESERIALIZE_FIELD(json, "data_hash", dataHash, "", false);
78 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
79 }
80 };
81
87 source = "front_side";
88 }
92
94 std::string fileHash;
95
97 std::string message;
98
99 [[nodiscard]] nl::json toJson() const override {
101 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
103 return json;
104 }
105 void fromJson(const nl::json& json) override {
107 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
108 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
109 }
110 };
111
117 source = "reverse_side";
118 }
122
124 std::string fileHash;
125
127 std::string message;
128
129 [[nodiscard]] nl::json toJson() const override {
131 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
133 return json;
134 }
135 void fromJson(const nl::json& json) override {
137 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
138 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
139 }
140 };
141
147 source = "selfie";
148 }
152
154 std::string fileHash;
155
157 std::string message;
158
159 [[nodiscard]] nl::json toJson() const override {
161 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
163 return json;
164 }
165 void fromJson(const nl::json& json) override {
167 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
168 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
169 }
170 };
171
177 source = "file";
178 }
182
184 std::string fileHash;
185
187 std::string message;
188
189 [[nodiscard]] nl::json toJson() const override {
191 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
193 return json;
194 }
195 void fromJson(const nl::json& json) override {
197 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
198 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
199 }
200 };
201
202
208 source = "files";
209 }
213
215 std::vector<std::string> fileHashes;
216
218 std::string message;
219
220 [[nodiscard]] nl::json toJson() const override {
222 OBJECT_SERIALIZE_FIELD(json, "file_hashes", fileHashes);
224 return json;
225 }
226 void fromJson(const nl::json& json) override {
228 OBJECT_DESERIALIZE_FIELD(json, "file_hashes", fileHashes, {}, false);
229 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
230 }
231 };
232
238 source = "translation_file";
239 }
243
245 std::string fileHash;
246
248 std::string message;
249
250 [[nodiscard]] nl::json toJson() const override {
252 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
254 return json;
255 }
256 void fromJson(const nl::json& json) override {
258 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
259 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
260 }
261 };
262
268 source = "translation_files";
269 }
273
275 std::vector<std::string> fileHashes;
276
278 std::string message;
279
280 [[nodiscard]] nl::json toJson() const override {
282 OBJECT_SERIALIZE_FIELD(json, "file_hashes", fileHashes);
284 return json;
285 }
286 void fromJson(const nl::json& json) override {
288 OBJECT_DESERIALIZE_FIELD(json, "file_hashes", fileHashes, {}, false);
289 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
290 }
291 };
292
298 source = "unspecified";
299 }
303
305 std::string elementHash;
306
308 std::string message;
309
310 [[nodiscard]] nl::json toJson() const override {
312 OBJECT_SERIALIZE_FIELD(json, "element_hash", elementHash);
314 return json;
315 }
316 void fromJson(const nl::json& json) override {
318 OBJECT_DESERIALIZE_FIELD(json, "element_hash", elementHash, "", false);
319 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
320 }
321 };
322
323}
#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
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
Represents an issue in one of the data fields that was provided by the user. The error is considered ...
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
nl::json toJson() const override
Serializes this object to JSON.
std::string fieldName
Name of the data field which has the error.
std::string dataHash
Base64-encoded data hash.
Represents an issue with a document scan. The error is considered resolved when the file with the doc...
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
std::string fileHash
Base64-encoded file hash.
nl::json toJson() const override
Serializes this object to JSON.
Represents an issue with a list of scans. The error is considered resolved when the list of files con...
std::vector< std::string > fileHashes
List of base64-encoded file hashes.
nl::json toJson() const override
Serializes this object to JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
Represents an issue with the front side of a document. The error is considered resolved when the file...
std::string fileHash
Base64-encoded hash of the file with the front side of the document.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
nl::json toJson() const override
Serializes this object to JSON.
This object represents an error in the Telegram Passport element which was submitted that should be r...
virtual nl::json toJson() const
Serializes this object to JSON.
std::string type
The section of the user's Telegram Passport which has the issue, one of “passport”,...
virtual void fromJson(const nl::json &json)
Deserializes this object from JSON.
virtual ~PassportElementError()=default
PassportElementError(const nl::json &json)
Represents an issue with the reverse side of a document. The error is considered resolved when the fi...
nl::json toJson() const override
Serializes this object to JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
std::string fileHash
Base64-encoded hash of the file with the front side of the document.
Represents an issue with the selfie with a document. The error is considered resolved when the file w...
nl::json toJson() const override
Serializes this object to JSON.
std::string fileHash
Base64-encoded hash of the file with the selfie.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
Represents an issue with one of the files that constitute the translation of a document....
std::string fileHash
Base64-encoded file hash.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
nl::json toJson() const override
Serializes this object to JSON.
Represents an issue with the translated version of a document. The error is considered resolved when ...
nl::json toJson() const override
Serializes this object to JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
std::vector< std::string > fileHashes
List of base64-encoded file hashes.
Represents an issue in an unspecified place. The error is considered resolved when new data is added....
nl::json toJson() const override
Serializes this object to JSON.
std::string elementHash
Base64-encoded element hash.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.