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 {
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 
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
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
void addPropertyMapToJson(json &j, MapT &&arg)
Definition: types.hpp:91
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
Used by clients to submit authentication information to the interactive-authentication API.
Definition: auth_data.hpp:13
std::optional< std::string > type
The authentication type that the client is attempting to complete.
Definition: auth_data.hpp:19
immer::map< std::string, JsonWrap > authInfo
Keys dependent on the login type.
Definition: auth_data.hpp:25
std::optional< std::string > session
The value of the session key given by the homeserver.
Definition: auth_data.hpp:22
static void to_json(json &jo, const AuthenticationData &pod)
Definition: auth_data.hpp:35
static void from_json(const json &jo, AuthenticationData &result)
Definition: auth_data.hpp:45