1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #include "keys.h" |
6 | |
7 | using namespace Quotient; |
8 | |
9 | UploadKeysJob::UploadKeysJob(const Omittable<DeviceKeys>& deviceKeys, |
10 | const OneTimeKeys& oneTimeKeys, |
11 | const OneTimeKeys& fallbackKeys) |
12 | : BaseJob(HttpVerb::Post, QStringLiteral("UploadKeysJob" ), |
13 | makePath(parts: "/_matrix/client/v3" , parts: "/keys/upload" )) |
14 | { |
15 | QJsonObject _dataJson; |
16 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("device_keys" ), value: deviceKeys); |
17 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("one_time_keys" ), |
18 | value: oneTimeKeys); |
19 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("fallback_keys" ), |
20 | value: fallbackKeys); |
21 | setRequestData({ _dataJson }); |
22 | addExpectedKey(key: "one_time_key_counts" ); |
23 | } |
24 | |
25 | QueryKeysJob::QueryKeysJob(const QHash<QString, QStringList>& deviceKeys, |
26 | Omittable<int> timeout) |
27 | : BaseJob(HttpVerb::Post, QStringLiteral("QueryKeysJob" ), |
28 | makePath(parts: "/_matrix/client/v3" , parts: "/keys/query" )) |
29 | { |
30 | QJsonObject _dataJson; |
31 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("timeout" ), value&: timeout); |
32 | addParam<>(container&: _dataJson, QStringLiteral("device_keys" ), value: deviceKeys); |
33 | setRequestData({ _dataJson }); |
34 | } |
35 | |
36 | ClaimKeysJob::ClaimKeysJob( |
37 | const QHash<QString, QHash<QString, QString>>& oneTimeKeys, |
38 | Omittable<int> timeout) |
39 | : BaseJob(HttpVerb::Post, QStringLiteral("ClaimKeysJob" ), |
40 | makePath(parts: "/_matrix/client/v3" , parts: "/keys/claim" )) |
41 | { |
42 | QJsonObject _dataJson; |
43 | addParam<IfNotEmpty>(container&: _dataJson, QStringLiteral("timeout" ), value&: timeout); |
44 | addParam<>(container&: _dataJson, QStringLiteral("one_time_keys" ), value: oneTimeKeys); |
45 | setRequestData({ _dataJson }); |
46 | addExpectedKey(key: "one_time_keys" ); |
47 | } |
48 | |
49 | auto queryToGetKeysChanges(const QString& from, const QString& to) |
50 | { |
51 | QUrlQuery _q; |
52 | addParam<>(container&: _q, QStringLiteral("from" ), value: from); |
53 | addParam<>(container&: _q, QStringLiteral("to" ), value: to); |
54 | return _q; |
55 | } |
56 | |
57 | QUrl GetKeysChangesJob::makeRequestUrl(QUrl baseUrl, const QString& from, |
58 | const QString& to) |
59 | { |
60 | return BaseJob::makeRequestUrl(baseUrl: std::move(baseUrl), |
61 | encodedPath: makePath(parts: "/_matrix/client/v3" , |
62 | parts: "/keys/changes" ), |
63 | query: queryToGetKeysChanges(from, to)); |
64 | } |
65 | |
66 | GetKeysChangesJob::GetKeysChangesJob(const QString& from, const QString& to) |
67 | : BaseJob(HttpVerb::Get, QStringLiteral("GetKeysChangesJob" ), |
68 | makePath(parts: "/_matrix/client/v3" , parts: "/keys/changes" ), |
69 | queryToGetKeysChanges(from, to)) |
70 | {} |
71 | |