diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-09 08:52:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 08:52:25 +0200 |
commit | 370d9b3e46332d38df8798cda208c534c58be808 (patch) | |
tree | f3db0cd7463468ff52c74446acd608356f8b8ab6 /lib/csapi/definitions/device_keys.h | |
parent | e1f5d0aa2c33e6da6c3a609c8bc7e0b5867e748d (diff) | |
parent | 10d9ac4673e374a9ac17ff492591136520337c4c (diff) | |
download | libquotient-370d9b3e46332d38df8798cda208c534c58be808.tar.gz libquotient-370d9b3e46332d38df8798cda208c534c58be808.zip |
Merge pull request #405 from quotient-im/kitsune-basejob-store-json-response
Store JSON response in BaseJob + tweaks to the generated code
Diffstat (limited to 'lib/csapi/definitions/device_keys.h')
-rw-r--r-- | lib/csapi/definitions/device_keys.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/csapi/definitions/device_keys.h b/lib/csapi/definitions/device_keys.h index a067b4f3..3065f218 100644 --- a/lib/csapi/definitions/device_keys.h +++ b/lib/csapi/definitions/device_keys.h @@ -6,12 +6,7 @@ #include "converters.h" -#include <QtCore/QHash> - namespace Quotient { - -// Data structures - /// Device identity keys struct DeviceKeys { /// The ID of the user the device belongs to. Must match the user ID used @@ -40,8 +35,22 @@ struct DeviceKeys { template <> struct JsonObjectConverter<DeviceKeys> { - static void dumpTo(QJsonObject& jo, const DeviceKeys& pod); - static void fillFrom(const QJsonObject& jo, DeviceKeys& pod); + static void dumpTo(QJsonObject& jo, const DeviceKeys& pod) + { + addParam<>(jo, QStringLiteral("user_id"), pod.userId); + addParam<>(jo, QStringLiteral("device_id"), pod.deviceId); + addParam<>(jo, QStringLiteral("algorithms"), pod.algorithms); + addParam<>(jo, QStringLiteral("keys"), pod.keys); + addParam<>(jo, QStringLiteral("signatures"), pod.signatures); + } + static void fillFrom(const QJsonObject& jo, DeviceKeys& pod) + { + fromJson(jo.value("user_id"_ls), pod.userId); + fromJson(jo.value("device_id"_ls), pod.deviceId); + fromJson(jo.value("algorithms"_ls), pod.algorithms); + fromJson(jo.value("keys"_ls), pod.keys); + fromJson(jo.value("signatures"_ls), pod.signatures); + } }; } // namespace Quotient |