Debian Codegraph @

mtxclient/include/mtx/responses/device.hpp

raw symbols SCIP
1 #pragma once
2
3 /// @file
4 /// @brief device related endpoints.
5
6 #if __has_include(<nlohmann/json_fwd.hpp>)
7 #include <nlohmann/json_fwd.hpp>
8 #else
9 #include <nlohmann/json.hpp>
10 #endif
11
12 #include <string>
13 #include <vector>
14
15 namespace mtx {
16 namespace responses {
17
18 //! Information about one of your devices.
19 struct Device
20 {
21 //! **Required.** Identifier of this device.
22 std::string device_id;
23
24 //! Display name set by the user for this device. Absent if no name has been set.
25 std::string display_name;
26
27 //! The IP address where this device was last seen. (May be a few minutes out of date, for
28 //! efficiency reasons).
29 std::string last_seen_ip;
30
31 //! The timestamp (in milliseconds since the unix epoch) when this devices was last seen. (May
32 //! be a few minutes out of date, for efficiency reasons).
33 size_t last_seen_ts;
34
35 friend void from_json(const nlohmann::json &obj, Device &res);
36 };
37
38 //! Response from the `GET /_matrix/client/r0/devices` endpoint.
39 struct QueryDevices
40 {
41 //! Gets information about all devices for the current user.
42 //! A list of all registered devices for this user.
43 //
44 std::vector<Device> devices;
45
46 friend void from_json(const nlohmann::json &obj, QueryDevices &response);
47 };
48
49 }
50 }