1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #include "registration.h" |
6 | |
7 | using namespace Quotient; |
8 | |
9 | auto queryToRegister(const QString& kind) |
10 | { |
11 | QUrlQuery _q; |
12 | addParam<IfNotEmpty>(container&: _q, QStringLiteral("kind" ), value: kind); |
13 | return _q; |
14 | } |
15 | |
16 | RegisterJob::RegisterJob(const QString& kind, |
17 | const Omittable<AuthenticationData>& auth, |
18 | const QString& username, const QString& password, |
19 | const QString& deviceId, |
20 | const QString& initialDeviceDisplayName, |
21 | Omittable<bool> inhibitLogin, |
22 | Omittable<bool> refreshToken) |
23 | : BaseJob(HttpVerb::Post, QStringLiteral("RegisterJob" ), |
24 | makePath(parts: "/_matrix/client/v3" , parts: "/register" ), |
25 | queryToRegister(kind), {}, false) |
26 | { |
27 | QJsonObject _dataJson; |
28 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("auth" ), value: auth); |
29 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("username" ), value: username); |
30 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("password" ), value: password); |
31 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("device_id" ), value: deviceId); |
32 | addParam<IfNotEmpty>(container&: _dataJson, |
33 | QStringLiteral("initial_device_display_name" ), |
34 | value: initialDeviceDisplayName); |
35 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("inhibit_login" ), |
36 | value&: inhibitLogin); |
37 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("refresh_token" ), |
38 | value&: refreshToken); |
39 | setRequestData({ _dataJson }); |
40 | addExpectedKey(key: "user_id" ); |
41 | } |
42 | |
43 | RequestTokenToRegisterEmailJob::RequestTokenToRegisterEmailJob( |
44 | const EmailValidationData& body) |
45 | : BaseJob(HttpVerb::Post, QStringLiteral("RequestTokenToRegisterEmailJob" ), |
46 | makePath(parts: "/_matrix/client/v3" , parts: "/register/email/requestToken" ), |
47 | false) |
48 | { |
49 | setRequestData({ toJson(pod: body) }); |
50 | } |
51 | |
52 | RequestTokenToRegisterMSISDNJob::RequestTokenToRegisterMSISDNJob( |
53 | const MsisdnValidationData& body) |
54 | : BaseJob(HttpVerb::Post, QStringLiteral("RequestTokenToRegisterMSISDNJob" ), |
55 | makePath(parts: "/_matrix/client/v3" , parts: "/register/msisdn/requestToken" ), |
56 | false) |
57 | { |
58 | setRequestData({ toJson(pod: body) }); |
59 | } |
60 | |
61 | ChangePasswordJob::ChangePasswordJob(const QString& newPassword, |
62 | bool logoutDevices, |
63 | const Omittable<AuthenticationData>& auth) |
64 | : BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob" ), |
65 | makePath(parts: "/_matrix/client/v3" , parts: "/account/password" )) |
66 | { |
67 | QJsonObject _dataJson; |
68 | addParam<>(container&: _dataJson, QStringLiteral("new_password" ), value: newPassword); |
69 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("logout_devices" ), |
70 | value&: logoutDevices); |
71 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("auth" ), value: auth); |
72 | setRequestData({ _dataJson }); |
73 | } |
74 | |
75 | RequestTokenToResetPasswordEmailJob::RequestTokenToResetPasswordEmailJob( |
76 | const EmailValidationData& body) |
77 | : BaseJob(HttpVerb::Post, |
78 | QStringLiteral("RequestTokenToResetPasswordEmailJob" ), |
79 | makePath(parts: "/_matrix/client/v3" , |
80 | parts: "/account/password/email/requestToken" ), |
81 | false) |
82 | { |
83 | setRequestData({ toJson(pod: body) }); |
84 | } |
85 | |
86 | RequestTokenToResetPasswordMSISDNJob::RequestTokenToResetPasswordMSISDNJob( |
87 | const MsisdnValidationData& body) |
88 | : BaseJob(HttpVerb::Post, |
89 | QStringLiteral("RequestTokenToResetPasswordMSISDNJob" ), |
90 | makePath(parts: "/_matrix/client/v3" , |
91 | parts: "/account/password/msisdn/requestToken" ), |
92 | false) |
93 | { |
94 | setRequestData({ toJson(pod: body) }); |
95 | } |
96 | |
97 | DeactivateAccountJob::DeactivateAccountJob( |
98 | const Omittable<AuthenticationData>& auth, const QString& idServer) |
99 | : BaseJob(HttpVerb::Post, QStringLiteral("DeactivateAccountJob" ), |
100 | makePath(parts: "/_matrix/client/v3" , parts: "/account/deactivate" )) |
101 | { |
102 | QJsonObject _dataJson; |
103 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("auth" ), value: auth); |
104 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("id_server" ), value: idServer); |
105 | setRequestData({ _dataJson }); |
106 | addExpectedKey(key: "id_server_unbind_result" ); |
107 | } |
108 | |
109 | auto queryToCheckUsernameAvailability(const QString& username) |
110 | { |
111 | QUrlQuery _q; |
112 | addParam<>(container&: _q, QStringLiteral("username" ), value: username); |
113 | return _q; |
114 | } |
115 | |
116 | QUrl CheckUsernameAvailabilityJob::makeRequestUrl(QUrl baseUrl, |
117 | const QString& username) |
118 | { |
119 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
120 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
121 | parts: "/register/available" ), |
122 | query: queryToCheckUsernameAvailability(username)); |
123 | } |
124 | |
125 | CheckUsernameAvailabilityJob::CheckUsernameAvailabilityJob( |
126 | const QString& username) |
127 | : BaseJob(HttpVerb::Get, QStringLiteral("CheckUsernameAvailabilityJob" ), |
128 | makePath(parts: "/_matrix/client/v3" , parts: "/register/available" ), |
129 | queryToCheckUsernameAvailability(username), {}, false) |
130 | {} |
131 | |