aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-08 17:07:33 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-08 17:07:33 +0900
commitc5ebff775e71b5d32a3b2af8f666e3f13f8970c2 (patch)
treef9eb65490277da58e5aab367ca4af35220d24f72 /lib/csapi/definitions
parentb28e2d697842f58e2994ead62635b31f48162cdc (diff)
downloadlibquotient-c5ebff775e71b5d32a3b2af8f666e3f13f8970c2.tar.gz
libquotient-c5ebff775e71b5d32a3b2af8f666e3f13f8970c2.zip
csapi: add jobs for keys management
This concludes the Great Income of Jobs to libQMatrixClient - all CS API calls are now covered with job classes, yay!
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r--lib/csapi/definitions/device_keys.cpp37
-rw-r--r--lib/csapi/definitions/device_keys.h32
2 files changed, 69 insertions, 0 deletions
diff --git a/lib/csapi/definitions/device_keys.cpp b/lib/csapi/definitions/device_keys.cpp
new file mode 100644
index 00000000..24357993
--- /dev/null
+++ b/lib/csapi/definitions/device_keys.cpp
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "device_keys.h"
+
+using namespace QMatrixClient;
+
+QJsonObject QMatrixClient::toJson(const DeviceKeys& pod)
+{
+ QJsonObject _json;
+ addToJson<>(_json, "user_id", pod.userId);
+ addToJson<>(_json, "device_id", pod.deviceId);
+ addToJson<>(_json, "algorithms", pod.algorithms);
+ addToJson<>(_json, "keys", pod.keys);
+ addToJson<>(_json, "signatures", pod.signatures);
+ return _json;
+}
+
+DeviceKeys FromJson<DeviceKeys>::operator()(const QJsonValue& jv)
+{
+ const auto& _json = jv.toObject();
+ DeviceKeys result;
+ result.userId =
+ fromJson<QString>(_json.value("user_id"));
+ result.deviceId =
+ fromJson<QString>(_json.value("device_id"));
+ result.algorithms =
+ fromJson<QStringList>(_json.value("algorithms"));
+ result.keys =
+ fromJson<QHash<QString, QString>>(_json.value("keys"));
+ result.signatures =
+ fromJson<QHash<QString, QHash<QString, QString>>>(_json.value("signatures"));
+
+ return result;
+}
+
diff --git a/lib/csapi/definitions/device_keys.h b/lib/csapi/definitions/device_keys.h
new file mode 100644
index 00000000..895700c1
--- /dev/null
+++ b/lib/csapi/definitions/device_keys.h
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+
+#include <QtCore/QHash>
+
+#include "converters.h"
+
+namespace QMatrixClient
+{
+ // Data structures
+
+ struct DeviceKeys
+ {
+ QString userId;
+ QString deviceId;
+ QStringList algorithms;
+ QHash<QString, QString> keys;
+ QHash<QString, QHash<QString, QString>> signatures;
+ };
+
+ QJsonObject toJson(const DeviceKeys& pod);
+
+ template <> struct FromJson<DeviceKeys>
+ {
+ DeviceKeys operator()(const QJsonValue& jv);
+ };
+
+} // namespace QMatrixClient