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
immer::array< LoginFlow > flows() const
The homeserver's supported login types.
Definition: login.cpp:80
bool success() const
Definition: login.cpp:70
JobResponse(Response r)
Definition: login.cpp:67
Get the supported login types to authenticate users.
Definition: login.hpp:18
static BaseJob::Body buildBody()
Definition: login.cpp:21
static BaseJob::Query buildQuery()
Definition: login.cpp:13
GetLoginFlowsJob withData(JsonWrap j) &&
Definition: login.cpp:53
static constexpr auto needsAuth()
Definition: login.hpp:50
GetLoginFlowsJob(std::string serverUrl)
Get the supported login types to authenticate users.
Definition: login.cpp:33
Definition: login.hpp:130
Authenticates the user.
Definition: login.hpp:124
static constexpr auto needsAuth()
Definition: login.hpp:186
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
Gets the homeserver's supported login types to authenticate users.
Definition: login.hpp:25
std::optional< std::string > type
The login type.
Definition: login.hpp:28
Definition: basejob.hpp:50
static void from_json(const json &jo, GetLoginFlowsJob::LoginFlow &result)
Definition: login.hpp:96
static void to_json(json &jo, const GetLoginFlowsJob::LoginFlow &pod)
Definition: login.hpp:87