libkazv
Loading...
Searching...
No Matches
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
11namespace Kazv::Api {
12
18class GetLoginFlowsJob : public BaseJob {
19public:
20 // Inner data structures
21
24 struct LoginFlow
25 {
28 std::optional<std::string> type;
29
30 };
31
32
33
34class JobResponse : public Response
35{
36
37public:
39 bool success() const;
40
41 // Result properties
42
43
44
45
47immer::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
124class LoginJob : public BaseJob {
125public:
126
127
128
129class JobResponse : public Response
130{
131
132public:
134 bool success() const;
135
136 // Result properties
137
138
139
140
142std::optional<std::string> userId() const;
143
144
147std::optional<std::string> accessToken() const;
148
149
153std::optional<std::string> refreshToken() const;
154
155
162std::optional<int> expiresInMs() const;
163
164
171std::optional<std::string> homeServer() const;
172
173
176std::optional<std::string> deviceId() const;
177
178
183std::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
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
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
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
Definition login.hpp:130
std::optional< int > expiresInMs() const
The lifetime of the access token, in milliseconds.
Definition login.cpp:210
std::optional< DiscoveryInformation > wellKnown() const
Optional client configuration provided by the server.
Definition login.cpp:243
bool success() const
Definition login.cpp:167
std::optional< std::string > userId() const
The fully-qualified Matrix ID for the account.
Definition login.cpp:177
std::optional< std::string > accessToken() const
An access token for the account.
Definition login.cpp:188
std::optional< std::string > homeServer() const
The server_name of the homeserver on which the account has been registered.
Definition login.cpp:221
std::optional< std::string > deviceId() const
ID of the logged-in device.
Definition login.cpp:232
std::optional< std::string > refreshToken() const
A refresh token for the account.
Definition login.cpp:199
Authenticates the user.
Definition login.hpp:124
LoginJob withData(JsonWrap j) &&
Definition login.cpp:150
static constexpr auto needsAuth()
Definition login.hpp:186
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)
Definition login.cpp:100
static BaseJob::Query buildQuery()
Definition login.cpp:92
Definition basejob.hpp:94
Definition basejob.hpp:68
::Kazv::Body Body
Definition basejob.hpp:103
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:49
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