41 if (! jo.is_object()) { jo = json::object(); }
56 if (jo.contains(
"device_id"s)) {
57 result.
deviceId = jo.at(
"device_id"s);
59 if (jo.contains(
"display_name"s)) {
62 if (jo.contains(
"last_seen_ip"s)) {
65 if (jo.contains(
"last_seen_ts"s)) {
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
A client device.
Definition: client_device.hpp:13
std::string deviceId
Identifier of this device.
Definition: client_device.hpp:16
std::optional< std::string > lastSeenIp
The IP address where this device was last seen.
Definition: client_device.hpp:24
std::optional< std::int_fast64_t > lastSeenTs
The timestamp (in milliseconds since the unix epoch) when this devices was last seen.
Definition: client_device.hpp:29
std::optional< std::string > displayName
Display name set by the user for this device.
Definition: client_device.hpp:20
static void to_json(json &jo, const Device &pod)
Definition: client_device.hpp:39
static void from_json(const json &jo, Device &result)
Definition: client_device.hpp:53