aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/device_keys.cpp
blob: a0e0ca42861c50d7146d5dabee1dd81f726d1c49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "device_keys.h"

using namespace QMatrixClient;

QJsonObject QMatrixClient::toJson(const DeviceKeys& pod)
{
    QJsonObject jo;
    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);
    return jo;
}

DeviceKeys FromJsonObject<DeviceKeys>::operator()(const QJsonObject& jo) const
{
    DeviceKeys result;
    result.userId =
        fromJson<QString>(jo.value("user_id"_ls));
    result.deviceId =
        fromJson<QString>(jo.value("device_id"_ls));
    result.algorithms =
        fromJson<QStringList>(jo.value("algorithms"_ls));
    result.keys =
        fromJson<QHash<QString, QString>>(jo.value("keys"_ls));
    result.signatures =
        fromJson<QHash<QString, QHash<QString, QString>>>(jo.value("signatures"_ls));

    return result;
}