aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/device_keys.cpp
blob: 43cd5d2ef5b20273c1d2fc5b237b0261fe4fcbdd (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
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;
    addParam<>(_json, "user_id", pod.userId);
    addParam<>(_json, "device_id", pod.deviceId);
    addParam<>(_json, "algorithms", pod.algorithms);
    addParam<>(_json, "keys", pod.keys);
    addParam<>(_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;
}