1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/converters.h>
8
9namespace Quotient {
10/// A client device
11struct Device {
12 /// Identifier of this device.
13 QString deviceId;
14
15 /// Display name set by the user for this device. Absent if no name has been
16 /// set.
17 QString displayName{};
18
19 /// The IP address where this device was last seen. (May be a few minutes
20 /// out of date, for efficiency reasons).
21 QString lastSeenIp{};
22
23 /// The timestamp (in milliseconds since the unix epoch) when this devices
24 /// was last seen. (May be a few minutes out of date, for efficiency
25 /// reasons).
26 Omittable<qint64> lastSeenTs{};
27};
28
29template <>
30struct JsonObjectConverter<Device> {
31 static void dumpTo(QJsonObject& jo, const Device& pod)
32 {
33 addParam<>(container&: jo, QStringLiteral("device_id"), value: pod.deviceId);
34 addParam<IfNotEmpty>(container&: jo, QStringLiteral("display_name"),
35 value: pod.displayName);
36 addParam<IfNotEmpty>(container&: jo, QStringLiteral("last_seen_ip"), value: pod.lastSeenIp);
37 addParam<IfNotEmpty>(container&: jo, QStringLiteral("last_seen_ts"), value: pod.lastSeenTs);
38 }
39 static void fillFrom(const QJsonObject& jo, Device& pod)
40 {
41 fillFromJson(jv: jo.value(key: "device_id"_ls), pod&: pod.deviceId);
42 fillFromJson(jv: jo.value(key: "display_name"_ls), pod&: pod.displayName);
43 fillFromJson(jv: jo.value(key: "last_seen_ip"_ls), pod&: pod.lastSeenIp);
44 fillFromJson(jv: jo.value(key: "last_seen_ts"_ls), pod&: pod.lastSeenTs);
45 }
46};
47
48} // namespace Quotient
49