aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/client_device.cpp
blob: 60b3617c1dae37f21e33dcd5410ef46201cbc3bb (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
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "client_device.h"

using namespace QMatrixClient;

QJsonObject QMatrixClient::toJson(const Device& pod)
{
    QJsonObject _json;
    addToJson<>(_json, "device_id", pod.deviceId);
    addToJson<IfNotEmpty>(_json, "display_name", pod.displayName);
    addToJson<IfNotEmpty>(_json, "last_seen_ip", pod.lastSeenIp);
    addToJson<IfNotEmpty>(_json, "last_seen_ts", pod.lastSeenTs);
    return _json;
}

Device FromJson<Device>::operator()(const QJsonValue& jv)
{
    const auto& _json = jv.toObject();
    Device result;
    result.deviceId =
        fromJson<QString>(_json.value("device_id"));
    result.displayName =
        fromJson<QString>(_json.value("display_name"));
    result.lastSeenIp =
        fromJson<QString>(_json.value("last_seen_ip"));
    result.lastSeenTs =
        fromJson<qint64>(_json.value("last_seen_ts"));
    
    return result;
}