tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
EncryptedPassportElement.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
10 explicit EncryptedPassportElement(const nl::json& json) {
11 fromJson(json);
12 }
13
18 std::string type;
19
23 std::string data;
24
26 std::string phoneNumber;
27
29 std::string email;
30
34 std::vector<Ptr<PassportFile>> files;
35
40
44
48
53 std::vector<Ptr<PassportFile>> translation;
54
56 std::string hash;
57
58
61 nl::json toJson() const {
62 nl::json json = nl::json::object();
63 OBJECT_SERIALIZE_FIELD(json, "type", type);
64 OBJECT_SERIALIZE_FIELD(json, "data", data);
65 OBJECT_SERIALIZE_FIELD(json, "phone_number", phoneNumber);
66 OBJECT_SERIALIZE_FIELD(json, "email", email);
68 OBJECT_SERIALIZE_FIELD_PTR(json, "front_side", frontSide);
69 OBJECT_SERIALIZE_FIELD_PTR(json, "reverse_side", reverseSide);
70 OBJECT_SERIALIZE_FIELD_PTR(json, "selfie", selfie);
72 OBJECT_SERIALIZE_FIELD(json, "hash", hash);
73 return json;
74 }
75
77 void fromJson(const nl::json& json) {
78 OBJECT_DESERIALIZE_FIELD(json, "type", type, "", false);
79 OBJECT_DESERIALIZE_FIELD(json, "data", data, "", true);
80 OBJECT_DESERIALIZE_FIELD(json, "phone_number", phoneNumber, "", true);
81 OBJECT_DESERIALIZE_FIELD(json, "email", email, "", true);
82 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "files", files, true);
83 OBJECT_DESERIALIZE_FIELD_PTR(json, "front_side", frontSide, true);
84 OBJECT_DESERIALIZE_FIELD_PTR(json, "reverse_side", reverseSide, true);
85 OBJECT_DESERIALIZE_FIELD_PTR(json, "selfie", selfie, true);
86 OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "translation", translation, true);
87 OBJECT_DESERIALIZE_FIELD(json, "hash", hash, "", false);
88 }
89 };
90}
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition Object.hpp:22
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition Object.hpp:70
#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
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:87
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
Describes documents or other Telegram Passport elements shared with the bot by the user....
std::string type
Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”,...
std::vector< Ptr< PassportFile > > translation
Optional. Array of encrypted files with translated versions of documents provided by the user....
Ptr< PassportFile > reverseSide
Optional. Encrypted file with the reverse side of the document, provided by the user....
Ptr< PassportFile > selfie
Optional. Encrypted file with the selfie of the user holding a document, provided by the user; availa...
std::string email
Optional. User's verified email address, available only for “email” type.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::string hash
Base64-encoded element hash for using in PassportElementErrorUnspecified.
std::string data
Optional. Base64-encoded encrypted Telegram Passport element data provided by the user,...
Ptr< PassportFile > frontSide
Optional. Encrypted file with the front side of the document, provided by the user....
nl::json toJson() const
Serializes this object to JSON.
std::string phoneNumber
Optional. User's verified phone number, available only for “phone_number” type.
std::vector< Ptr< PassportFile > > files
Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”,...