tgbotxx 1.1.6.9
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) {
20 _fromJson(json);
21 }
22
24 std::string source;
25
28 std::string type;
29
32 virtual nl::json toJson() const {
33 nl::json json = nl::json::object();
34 OBJECT_SERIALIZE_FIELD(json, "source", source);
35 OBJECT_SERIALIZE_FIELD(json, "type", type);
36 return json;
37 }
38
40 virtual void fromJson(const nl::json& json) {
41 OBJECT_DESERIALIZE_FIELD(json, "source", source, "", false);
42 OBJECT_DESERIALIZE_FIELD(json, "type", type, "", false);
43 }
44
45 private:
46 void _fromJson(const nl::json& json) {
47 fromJson(json);
48 }
49 };
50
58 explicit PassportElementErrorDataField(const nl::json& json) {
61 }
62
64 std::string fieldName;
65
67 std::string dataHash;
68
70 std::string message;
71
72 nl::json toJson() const override {
73 nl::json json = PassportElementError::toJson();
74 OBJECT_SERIALIZE_FIELD(json, "field_name", fieldName);
75 OBJECT_SERIALIZE_FIELD(json, "data_hash", dataHash);
76 OBJECT_SERIALIZE_FIELD(json, "message", message);
77 return json;
78 }
79 void fromJson(const nl::json& json) override {
81 OBJECT_DESERIALIZE_FIELD(json, "field_name", fieldName, "", false);
82 OBJECT_DESERIALIZE_FIELD(json, "data_hash", dataHash, "", false);
83 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
84 }
85 };
86
94 explicit PassportElementErrorFrontSide(const nl::json& json) {
96 PassportElementError::source = "front_side";
97 }
98
100 std::string fileHash;
101
103 std::string message;
104
105 nl::json toJson() const override {
106 nl::json json = PassportElementError::toJson();
107 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
108 OBJECT_SERIALIZE_FIELD(json, "message", message);
109 return json;
110 }
111 void fromJson(const nl::json& json) override {
113 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
114 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
115 }
116 };
117
125 explicit PassportElementErrorReverseSide(const nl::json& json) {
127 PassportElementError::source = "reverse_side";
128 }
129
131 std::string fileHash;
132
134 std::string message;
135
136 nl::json toJson() const override {
137 nl::json json = PassportElementError::toJson();
138 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
139 OBJECT_SERIALIZE_FIELD(json, "message", message);
140 return json;
141 }
142 void fromJson(const nl::json& json) override {
144 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
145 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
146 }
147 };
148
156 explicit PassportElementErrorSelfie(const nl::json& json) {
159 }
160
162 std::string fileHash;
163
165 std::string message;
166
167 nl::json toJson() const override {
168 nl::json json = PassportElementError::toJson();
169 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
170 OBJECT_SERIALIZE_FIELD(json, "message", message);
171 return json;
172 }
173 void fromJson(const nl::json& json) override {
175 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
176 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
177 }
178 };
179
187 explicit PassportElementErrorFile(const nl::json& json) {
190 }
191
193 std::string fileHash;
194
196 std::string message;
197
198 nl::json toJson() const override {
199 nl::json json = PassportElementError::toJson();
200 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
201 OBJECT_SERIALIZE_FIELD(json, "message", message);
202 return json;
203 }
204 void fromJson(const nl::json& json) override {
206 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
207 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
208 }
209 };
210
211
219 explicit PassportElementErrorFiles(const nl::json& json) {
222 }
223
225 std::vector<std::string> fileHashes;
226
228 std::string message;
229
230 nl::json toJson() const override {
231 nl::json json = PassportElementError::toJson();
232 OBJECT_SERIALIZE_FIELD(json, "file_hashes", fileHashes);
233 OBJECT_SERIALIZE_FIELD(json, "message", message);
234 return json;
235 }
236 void fromJson(const nl::json& json) override {
238 OBJECT_DESERIALIZE_FIELD(json, "file_hashes", fileHashes, {}, false);
239 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
240 }
241 };
242
250 explicit PassportElementErrorTranslationFile(const nl::json& json) {
252 PassportElementError::source = "translation_file";
253 }
254
256 std::string fileHash;
257
259 std::string message;
260
261 nl::json toJson() const override {
262 nl::json json = PassportElementError::toJson();
263 OBJECT_SERIALIZE_FIELD(json, "file_hash", fileHash);
264 OBJECT_SERIALIZE_FIELD(json, "message", message);
265 return json;
266 }
267 void fromJson(const nl::json& json) override {
269 OBJECT_DESERIALIZE_FIELD(json, "file_hash", fileHash, "", false);
270 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
271 }
272 };
273
281 explicit PassportElementErrorTranslationFiles(const nl::json& json) {
283 PassportElementError::source = "translation_files";
284 }
285
287 std::vector<std::string> fileHashes;
288
290 std::string message;
291
292 nl::json toJson() const override {
293 nl::json json = PassportElementError::toJson();
294 OBJECT_SERIALIZE_FIELD(json, "file_hashes", fileHashes);
295 OBJECT_SERIALIZE_FIELD(json, "message", message);
296 return json;
297 }
298 void fromJson(const nl::json& json) override {
300 OBJECT_DESERIALIZE_FIELD(json, "file_hashes", fileHashes, {}, false);
301 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
302 }
303 };
304
312 explicit PassportElementErrorUnspecified(const nl::json& json) {
314 PassportElementError::source = "unspecified";
315 }
316
318 std::string elementHash;
319
321 std::string message;
322
323 nl::json toJson() const override {
324 nl::json json = PassportElementError::toJson();
325 OBJECT_SERIALIZE_FIELD(json, "element_hash", elementHash);
326 OBJECT_SERIALIZE_FIELD(json, "message", message);
327 return json;
328 }
329 void fromJson(const nl::json& json) override {
331 OBJECT_DESERIALIZE_FIELD(json, "element_hash", elementHash, "", false);
332 OBJECT_DESERIALIZE_FIELD(json, "message", message, "", false);
333 }
334 };
335
336}
#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
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.
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.