tgbotxx  1.1.6.9
Telegram Bot C++ Library
PassportData.hpp
Go to the documentation of this file.
1 #pragma once
5 
6 namespace tgbotxx {
9  struct PassportData {
10  PassportData() = default;
11  explicit PassportData(const nl::json& json) {
12  fromJson(json);
13  }
14 
16  std::vector<Ptr<EncryptedPassportElement>> data;
17 
20 
23  nl::json toJson() const {
24  nl::json json = nl::json::object();
26  OBJECT_SERIALIZE_FIELD_PTR(json, "credentials", credentials);
27  return json;
28  }
29 
31  void fromJson(const nl::json& json) {
32  OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "data", data, false);
33  OBJECT_DESERIALIZE_FIELD_PTR(json, "credentials", credentials, false);
34  }
35  };
36 }
#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_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition: Object.hpp:87
Definition: Api.hpp:14
std::shared_ptr< T > Ptr
Definition: Ptr.hpp:6
Describes Telegram Passport data shared with the bot by the user. https://core.telegram....
Definition: PassportData.hpp:9
nl::json toJson() const
Serializes this object to JSON.
PassportData(const nl::json &json)
std::vector< Ptr< EncryptedPassportElement > > data
Array with information about documents and other Telegram Passport elements that was shared with the ...
Ptr< EncryptedCredentials > credentials
Encrypted credentials required to decrypt the data.
void fromJson(const nl::json &json)
Deserializes this object from JSON.