1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #include "key_backup.h" |
6 | |
7 | using namespace Quotient; |
8 | |
9 | PostRoomKeysVersionJob::PostRoomKeysVersionJob(const QString& algorithm, |
10 | const QJsonObject& authData) |
11 | : BaseJob(HttpVerb::Post, QStringLiteral("PostRoomKeysVersionJob" ), |
12 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/version" )) |
13 | { |
14 | QJsonObject _dataJson; |
15 | addParam<>(container&: _dataJson, QStringLiteral("algorithm" ), value: algorithm); |
16 | addParam<>(container&: _dataJson, QStringLiteral("auth_data" ), value: authData); |
17 | setRequestData({ _dataJson }); |
18 | addExpectedKey(key: "version" ); |
19 | } |
20 | |
21 | QUrl GetRoomKeysVersionCurrentJob::makeRequestUrl(QUrl baseUrl) |
22 | { |
23 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
24 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
25 | parts: "/room_keys/version" )); |
26 | } |
27 | |
28 | GetRoomKeysVersionCurrentJob::GetRoomKeysVersionCurrentJob() |
29 | : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomKeysVersionCurrentJob" ), |
30 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/version" )) |
31 | { |
32 | addExpectedKey(key: "algorithm" ); |
33 | addExpectedKey(key: "auth_data" ); |
34 | addExpectedKey(key: "count" ); |
35 | addExpectedKey(key: "etag" ); |
36 | addExpectedKey(key: "version" ); |
37 | } |
38 | |
39 | QUrl GetRoomKeysVersionJob::makeRequestUrl(QUrl baseUrl, const QString& version) |
40 | { |
41 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
42 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
43 | parts: "/room_keys/version/" , parts: version)); |
44 | } |
45 | |
46 | GetRoomKeysVersionJob::GetRoomKeysVersionJob(const QString& version) |
47 | : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomKeysVersionJob" ), |
48 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/version/" , parts: version)) |
49 | { |
50 | addExpectedKey(key: "algorithm" ); |
51 | addExpectedKey(key: "auth_data" ); |
52 | addExpectedKey(key: "count" ); |
53 | addExpectedKey(key: "etag" ); |
54 | addExpectedKey(key: "version" ); |
55 | } |
56 | |
57 | PutRoomKeysVersionJob::PutRoomKeysVersionJob(const QString& version, |
58 | const QString& algorithm, |
59 | const QJsonObject& authData) |
60 | : BaseJob(HttpVerb::Put, QStringLiteral("PutRoomKeysVersionJob" ), |
61 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/version/" , parts: version)) |
62 | { |
63 | QJsonObject _dataJson; |
64 | addParam<>(container&: _dataJson, QStringLiteral("algorithm" ), value: algorithm); |
65 | addParam<>(container&: _dataJson, QStringLiteral("auth_data" ), value: authData); |
66 | setRequestData({ _dataJson }); |
67 | } |
68 | |
69 | QUrl DeleteRoomKeysVersionJob::makeRequestUrl(QUrl baseUrl, |
70 | const QString& version) |
71 | { |
72 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
73 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
74 | parts: "/room_keys/version/" , parts: version)); |
75 | } |
76 | |
77 | DeleteRoomKeysVersionJob::DeleteRoomKeysVersionJob(const QString& version) |
78 | : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteRoomKeysVersionJob" ), |
79 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/version/" , parts: version)) |
80 | {} |
81 | |
82 | auto queryToPutRoomKeyBySessionId(const QString& version) |
83 | { |
84 | QUrlQuery _q; |
85 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
86 | return _q; |
87 | } |
88 | |
89 | PutRoomKeyBySessionIdJob::PutRoomKeyBySessionIdJob(const QString& roomId, |
90 | const QString& sessionId, |
91 | const QString& version, |
92 | const KeyBackupData& data) |
93 | : BaseJob(HttpVerb::Put, QStringLiteral("PutRoomKeyBySessionIdJob" ), |
94 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId, parts: "/" , |
95 | parts: sessionId), |
96 | queryToPutRoomKeyBySessionId(version)) |
97 | { |
98 | setRequestData({ toJson(pod: data) }); |
99 | addExpectedKey(key: "etag" ); |
100 | addExpectedKey(key: "count" ); |
101 | } |
102 | |
103 | auto queryToGetRoomKeyBySessionId(const QString& version) |
104 | { |
105 | QUrlQuery _q; |
106 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
107 | return _q; |
108 | } |
109 | |
110 | QUrl GetRoomKeyBySessionIdJob::makeRequestUrl(QUrl baseUrl, |
111 | const QString& roomId, |
112 | const QString& sessionId, |
113 | const QString& version) |
114 | { |
115 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
116 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
117 | parts: "/room_keys/keys/" , parts: roomId, parts: "/" , |
118 | parts: sessionId), |
119 | query: queryToGetRoomKeyBySessionId(version)); |
120 | } |
121 | |
122 | GetRoomKeyBySessionIdJob::GetRoomKeyBySessionIdJob(const QString& roomId, |
123 | const QString& sessionId, |
124 | const QString& version) |
125 | : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomKeyBySessionIdJob" ), |
126 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId, parts: "/" , |
127 | parts: sessionId), |
128 | queryToGetRoomKeyBySessionId(version)) |
129 | {} |
130 | |
131 | auto queryToDeleteRoomKeyBySessionId(const QString& version) |
132 | { |
133 | QUrlQuery _q; |
134 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
135 | return _q; |
136 | } |
137 | |
138 | QUrl DeleteRoomKeyBySessionIdJob::makeRequestUrl(QUrl baseUrl, |
139 | const QString& roomId, |
140 | const QString& sessionId, |
141 | const QString& version) |
142 | { |
143 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
144 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
145 | parts: "/room_keys/keys/" , parts: roomId, parts: "/" , |
146 | parts: sessionId), |
147 | query: queryToDeleteRoomKeyBySessionId(version)); |
148 | } |
149 | |
150 | DeleteRoomKeyBySessionIdJob::DeleteRoomKeyBySessionIdJob( |
151 | const QString& roomId, const QString& sessionId, const QString& version) |
152 | : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteRoomKeyBySessionIdJob" ), |
153 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId, parts: "/" , |
154 | parts: sessionId), |
155 | queryToDeleteRoomKeyBySessionId(version)) |
156 | { |
157 | addExpectedKey(key: "etag" ); |
158 | addExpectedKey(key: "count" ); |
159 | } |
160 | |
161 | auto queryToPutRoomKeysByRoomId(const QString& version) |
162 | { |
163 | QUrlQuery _q; |
164 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
165 | return _q; |
166 | } |
167 | |
168 | PutRoomKeysByRoomIdJob::PutRoomKeysByRoomIdJob(const QString& roomId, |
169 | const QString& version, |
170 | const RoomKeyBackup& backupData) |
171 | : BaseJob(HttpVerb::Put, QStringLiteral("PutRoomKeysByRoomIdJob" ), |
172 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId), |
173 | queryToPutRoomKeysByRoomId(version)) |
174 | { |
175 | setRequestData({ toJson(pod: backupData) }); |
176 | addExpectedKey(key: "etag" ); |
177 | addExpectedKey(key: "count" ); |
178 | } |
179 | |
180 | auto queryToGetRoomKeysByRoomId(const QString& version) |
181 | { |
182 | QUrlQuery _q; |
183 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
184 | return _q; |
185 | } |
186 | |
187 | QUrl GetRoomKeysByRoomIdJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, |
188 | const QString& version) |
189 | { |
190 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
191 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
192 | parts: "/room_keys/keys/" , parts: roomId), |
193 | query: queryToGetRoomKeysByRoomId(version)); |
194 | } |
195 | |
196 | GetRoomKeysByRoomIdJob::GetRoomKeysByRoomIdJob(const QString& roomId, |
197 | const QString& version) |
198 | : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomKeysByRoomIdJob" ), |
199 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId), |
200 | queryToGetRoomKeysByRoomId(version)) |
201 | {} |
202 | |
203 | auto queryToDeleteRoomKeysByRoomId(const QString& version) |
204 | { |
205 | QUrlQuery _q; |
206 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
207 | return _q; |
208 | } |
209 | |
210 | QUrl DeleteRoomKeysByRoomIdJob::makeRequestUrl(QUrl baseUrl, |
211 | const QString& roomId, |
212 | const QString& version) |
213 | { |
214 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
215 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
216 | parts: "/room_keys/keys/" , parts: roomId), |
217 | query: queryToDeleteRoomKeysByRoomId(version)); |
218 | } |
219 | |
220 | DeleteRoomKeysByRoomIdJob::DeleteRoomKeysByRoomIdJob(const QString& roomId, |
221 | const QString& version) |
222 | : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteRoomKeysByRoomIdJob" ), |
223 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys/" , parts: roomId), |
224 | queryToDeleteRoomKeysByRoomId(version)) |
225 | { |
226 | addExpectedKey(key: "etag" ); |
227 | addExpectedKey(key: "count" ); |
228 | } |
229 | |
230 | auto queryToPutRoomKeys(const QString& version) |
231 | { |
232 | QUrlQuery _q; |
233 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
234 | return _q; |
235 | } |
236 | |
237 | PutRoomKeysJob::PutRoomKeysJob(const QString& version, |
238 | const QHash<QString, RoomKeyBackup>& rooms) |
239 | : BaseJob(HttpVerb::Put, QStringLiteral("PutRoomKeysJob" ), |
240 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys" ), |
241 | queryToPutRoomKeys(version)) |
242 | { |
243 | QJsonObject _dataJson; |
244 | addParam<>(container&: _dataJson, QStringLiteral("rooms" ), value: rooms); |
245 | setRequestData({ _dataJson }); |
246 | addExpectedKey(key: "etag" ); |
247 | addExpectedKey(key: "count" ); |
248 | } |
249 | |
250 | auto queryToGetRoomKeys(const QString& version) |
251 | { |
252 | QUrlQuery _q; |
253 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
254 | return _q; |
255 | } |
256 | |
257 | QUrl GetRoomKeysJob::makeRequestUrl(QUrl baseUrl, const QString& version) |
258 | { |
259 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
260 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
261 | parts: "/room_keys/keys" ), |
262 | query: queryToGetRoomKeys(version)); |
263 | } |
264 | |
265 | GetRoomKeysJob::GetRoomKeysJob(const QString& version) |
266 | : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomKeysJob" ), |
267 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys" ), |
268 | queryToGetRoomKeys(version)) |
269 | { |
270 | addExpectedKey(key: "rooms" ); |
271 | } |
272 | |
273 | auto queryToDeleteRoomKeys(const QString& version) |
274 | { |
275 | QUrlQuery _q; |
276 | addParam<>(container&: _q, QStringLiteral("version" ), value: version); |
277 | return _q; |
278 | } |
279 | |
280 | QUrl DeleteRoomKeysJob::makeRequestUrl(QUrl baseUrl, const QString& version) |
281 | { |
282 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
283 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
284 | parts: "/room_keys/keys" ), |
285 | query: queryToDeleteRoomKeys(version)); |
286 | } |
287 | |
288 | DeleteRoomKeysJob::DeleteRoomKeysJob(const QString& version) |
289 | : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteRoomKeysJob" ), |
290 | makePath(parts: "/_matrix/client/v3" , parts: "/room_keys/keys" ), |
291 | queryToDeleteRoomKeys(version)) |
292 | { |
293 | addExpectedKey(key: "etag" ); |
294 | addExpectedKey(key: "count" ); |
295 | } |
296 | |