libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
admin.h
Go to the documentation of this file.
1// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2
3#pragma once
4
5#include <Quotient/jobs/basejob.h>
6
7namespace Quotient {
8
9//! \brief Gets information about a particular user.
10//!
11//! Gets information about a particular user.
12//!
13//! This API may be restricted to only be called by the user being looked
14//! up, or by a server admin. Server-local administrator privileges are not
15//! specified in this document.
17public:
18 // Inner data structures
19
21 //! Most recently seen IP address of the session.
23
24 //! Unix timestamp that the session was last active.
26
27 //! User agent string last seen in the session.
29 };
30
32 //! Information particular connections in the session.
34 };
35
37 //! A user's sessions (i.e. what they did with an access token from one login).
39 };
40
41 // Construction/destruction
42
43 //! \param userId
44 //! The user to look up.
45 explicit GetWhoIsJob(const QString& userId);
46
47 //! \brief Construct a URL without creating a full-fledged job object
48 //!
49 //! This function can be used when a URL for GetWhoIsJob
50 //! is necessary but the job itself isn't.
52
53 // Result properties
54
55 //! The Matrix user ID of the user.
56 QString userId() const { return loadFromJson<QString>("user_id"_L1); }
57
58 //! Each key is an identifier for one of the user's devices.
60 {
61 return loadFromJson<QHash<QString, DeviceInfo>>("devices"_L1);
62 }
63
64 struct Response {
65 //! The Matrix user ID of the user.
67
68 //! Each key is an identifier for one of the user's devices.
70 };
71};
72
74constexpr inline auto doCollectResponse<JobT> =
75 [](JobT* j) -> GetWhoIsJob::Response { return { j->userId(), j->devices() }; };
76
77template <>
80 {
81 fillFromJson(jo.value("ip"_L1), result.ip);
82 fillFromJson(jo.value("last_seen"_L1), result.lastSeen);
83 fillFromJson(jo.value("user_agent"_L1), result.userAgent);
84 }
85};
86
87template <>
90 {
91 fillFromJson(jo.value("connections"_L1), result.connections);
92 }
93};
94
95template <>
97 static void fillFrom(const QJsonObject& jo, GetWhoIsJob::DeviceInfo& result)
98 {
99 fillFromJson(jo.value("sessions"_L1), result.sessions);
100 }
101};
102
103} // namespace Quotient
Gets information about a particular user.
Definition admin.h:16
#define QUOTIENT_API