aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/device_keys.cpp
blob: d17f4c1239a1cc465eb5b20538528718f80df478 (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, QStringLiteral("user_id"), pod.userId);
    addParam<>(_json, QStringLiteral("device_id"), pod.deviceId);
    addParam<>(_json, QStringLiteral("algorithms"), pod.algorithms);
    addParam<>(_json, QStringLiteral("keys"), pod.keys);
    addParam<>(_json, QStringLiteral("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"_ls));
    result.deviceId =
        fromJson<QString>(_json.value("device_id"_ls));
    result.algorithms =
        fromJson<QStringList>(_json.value("algorithms"_ls));
    result.keys =
        fromJson<QHash<QString, QString>>(_json.value("keys"_ls));
    result.signatures =
        fromJson<QHash<QString, QHash<QString, QString>>>(_json.value("signatures"_ls));
    
    return result;
}