libkazv
auth_data.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3  */
4 
5 #pragma once
6 
7 #include "types.hpp"
8 
9 
10 namespace Kazv::Api {
12 struct AuthenticationData
13 {
14 
19  std::optional<std::string> type;
20 
22  std::optional<std::string> session;
23 
25  immer::map<std::string, JsonWrap> authInfo;
26 };
27 
28 }
29 namespace nlohmann
30 {
31 using namespace Kazv;
32 using namespace Kazv::Api;
33 template<>
34 struct adl_serializer<AuthenticationData> {
35  static void to_json(json& jo, const AuthenticationData &pod)
36  {
37  if (! jo.is_object()) { jo = json::object(); }
38 
39  addPropertyMapToJson(jo, pod.authInfo);
40 
41  addToJsonIfNeeded(jo, "type"s, pod.type);
42 
43  addToJsonIfNeeded(jo, "session"s, pod.session);
44  }
45  static void from_json(const json &jo, AuthenticationData& result)
46  {
47 
48  if (jo.contains("type"s)) {
49  result.type = jo.at("type"s);
50  }
51  if (jo.contains("session"s)) {
52  result.session = jo.at("session"s);
53  }
54  result.authInfo = jo;
55  }
56 };
57  }
58 
59  namespace Kazv::Api
60  {
61 } // namespace Kazv::Api
types.hpp
nlohmann
Definition: location.hpp:26
Kazv::Api::AuthenticationData::session
std::optional< std::string > session
The value of the session key given by the homeserver.
Definition: auth_data.hpp:26
Kazv
Definition: location.hpp:10
Kazv::addPropertyMapToJson
void addPropertyMapToJson(json &j, MapT &&arg)
Definition: types.hpp:91
nlohmann::adl_serializer< AuthenticationData >::from_json
static void from_json(const json &jo, AuthenticationData &result)
Definition: auth_data.hpp:45
Kazv::Api::AuthenticationData::type
std::optional< std::string > type
The authentication type that the client is attempting to complete.
Definition: auth_data.hpp:23
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
Kazv::Api::AuthenticationData
Used by clients to submit authentication information to the interactive-authentication API.
Definition: auth_data.hpp:14
nlohmann::adl_serializer< AuthenticationData >::to_json
static void to_json(json &jo, const AuthenticationData &pod)
Definition: auth_data.hpp:35
Kazv::Api::AuthenticationData::authInfo
immer::map< std::string, JsonWrap > authInfo
Keys dependent on the login type.
Definition: auth_data.hpp:29