libkazv
login.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 "basejob.hpp"
10 
11 namespace Kazv::Api {
12 
18 class GetLoginFlowsJob : public BaseJob {
19 public:
20  // Inner data structures
21 
24  struct LoginFlow
25  {
28  std::optional<std::string> type;
29 
30  };
31 
32 
33 
34 class JobResponse : public Response
35 {
36 
37 public:
39  bool success() const;
40 
41  // Result properties
42 
43 
44 
45 
47 immer::array<LoginFlow> flows() const;
48 
49 };
50  static constexpr auto needsAuth() {
51  return
52  false;
53  }
54 
55 
56 // Construction/destruction
57 
59  explicit GetLoginFlowsJob(std::string serverUrl
60 
61 
62 
63  );
64 
65 
67  );
68 
69  static BaseJob::Body buildBody();
70 
71 
72 
73 
74 
77  };
79  }
80  namespace nlohmann
81  {
82  using namespace Kazv;
83  using namespace Kazv::Api;
84  template<>
85  struct adl_serializer<GetLoginFlowsJob::LoginFlow> {
86 
87  static void to_json(json& jo, const GetLoginFlowsJob::LoginFlow &pod)
88  {
89  if (! jo.is_object()) { jo = json::object(); }
90 
91 
92 
93  addToJsonIfNeeded(jo, "type"s, pod.type);
94  }
95 
96  static void from_json(const json &jo, GetLoginFlowsJob::LoginFlow& result)
97  {
98 
99  if (jo.contains("type"s)) {
100  result.type = jo.at("type"s);
101  }
102 
103  }
104 
105 };
106  }
107 
108  namespace Kazv::Api
109  {
110 
124 class LoginJob : public BaseJob {
125 public:
126 
127 
128 
129 class JobResponse : public Response
130 {
131 
132 public:
134  bool success() const;
135 
136  // Result properties
137 
138 
139 
140 
142 std::optional<std::string> userId() const;
143 
144 
147 std::optional<std::string> accessToken() const;
148 
149 
153 std::optional<std::string> refreshToken() const;
154 
155 
162 std::optional<int> expiresInMs() const;
163 
164 
171 std::optional<std::string> homeServer() const;
172 
173 
176 std::optional<std::string> deviceId() const;
177 
178 
183 std::optional<DiscoveryInformation> wellKnown() const;
184 
185 };
186  static constexpr auto needsAuth() {
187  return
188  false;
189  }
190 
191 
192 // Construction/destruction
193 
233  explicit LoginJob(std::string serverUrl
234 
235  ,
236  std::string type , std::optional<UserIdentifier> identifier = std::nullopt, std::optional<std::string> password = std::nullopt, std::optional<std::string> token = std::nullopt, std::optional<std::string> deviceId = std::nullopt, std::optional<std::string> initialDeviceDisplayName = std::nullopt, std::optional<bool> refreshToken = std::nullopt
237  );
238 
239 
240  static BaseJob::Query buildQuery(
241  );
242 
243  static BaseJob::Body buildBody(std::string type, std::optional<UserIdentifier> identifier, std::optional<std::string> password, std::optional<std::string> token, std::optional<std::string> deviceId, std::optional<std::string> initialDeviceDisplayName, std::optional<bool> refreshToken);
244 
245 
246 
247 
248 
249  LoginJob withData(JsonWrap j) &&;
250  LoginJob withData(JsonWrap j) const &;
251  };
253  }
254  namespace nlohmann
255  {
256  using namespace Kazv;
257  using namespace Kazv::Api;
258 
259  }
260 
261  namespace Kazv::Api
262  {
263 
264 } // namespace Kazv::Api
Kazv::Api::LoginJob
Authenticates the user.
Definition: login.hpp:124
user_identifier.hpp
nlohmann::adl_serializer< GetLoginFlowsJob::LoginFlow >::to_json
static void to_json(json &jo, const GetLoginFlowsJob::LoginFlow &pod)
Definition: login.hpp:87
Kazv::Api::LoginJob::JobResponse
Definition: login.hpp:129
Kazv::Api::GetLoginFlowsJob
Get the supported login types to authenticate users.
Definition: login.hpp:20
nlohmann::adl_serializer< GetLoginFlowsJob::LoginFlow >::from_json
static void from_json(const json &jo, GetLoginFlowsJob::LoginFlow &result)
Definition: login.hpp:96
nlohmann
Definition: location.hpp:26
Kazv::Api::GetLoginFlowsJob::JobResponse::JobResponse
JobResponse(Response r)
Definition: login.cpp:69
Kazv::Api::GetLoginFlowsJob::JobResponse::success
bool success() const
Definition: login.cpp:72
Kazv::Api::GetLoginFlowsJob::buildQuery
static BaseJob::Query buildQuery()
Definition: login.cpp:15
Kazv::Api::GetLoginFlowsJob::GetLoginFlowsJob
GetLoginFlowsJob(std::string serverUrl)
Get the supported login types to authenticate users.
Definition: login.cpp:35
Kazv
Definition: location.hpp:10
Kazv::Api::GetLoginFlowsJob::JobResponse
Definition: login.hpp:38
Kazv::Api::GetLoginFlowsJob::LoginFlow
Gets the homeserver's supported login types to authenticate users.
Definition: login.hpp:28
Kazv::BaseJob::Query
Definition: basejob.hpp:90
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::Api::GetLoginFlowsJob::withData
GetLoginFlowsJob withData(JsonWrap j) &&
Definition: login.cpp:55
Kazv::Api::GetLoginFlowsJob::needsAuth
static constexpr auto needsAuth()
Definition: login.hpp:54
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
basejob.hpp
Kazv::JsonWrap
Definition: jsonwrap.hpp:22
Kazv::Api::LoginJob::needsAuth
static constexpr auto needsAuth()
Definition: login.hpp:186
Kazv::BaseJob
Definition: basejob.hpp:76
Kazv::Api::GetLoginFlowsJob::JobResponse::flows
immer::array< LoginFlow > flows() const
The homeserver's supported login types.
Definition: login.cpp:82
Kazv::BaseJob::Body
::Kazv::Body Body
Definition: basejob.hpp:100
Kazv::Api::GetLoginFlowsJob::buildBody
static BaseJob::Body buildBody()
Definition: login.cpp:23
Kazv::Api::GetLoginFlowsJob::LoginFlow::type
std::optional< std::string > type
The login type.
Definition: login.hpp:34
Kazv::Response
Definition: basejob.hpp:50
full.hpp