libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
whoami.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 the owner of an access token.
10//!
11//! Gets information about the owner of a given access token.
12//!
13//! Note that, as with the rest of the Client-Server API,
14//! Application Services may masquerade as users within their
15//! namespace by giving a `user_id` query parameter. In this
16//! situation, the server should verify that the given `user_id`
17//! is registered by the appservice, and return it in the response
18//! body.
20public:
21 explicit GetTokenOwnerJob();
22
23 //! \brief Construct a URL without creating a full-fledged job object
24 //!
25 //! This function can be used when a URL for GetTokenOwnerJob
26 //! is necessary but the job itself isn't.
28
29 // Result properties
30
31 //! The user ID that owns the access token.
32 QString userId() const { return loadFromJson<QString>("user_id"_L1); }
33
34 //! Device ID associated with the access token. If no device
35 //! is associated with the access token (such as in the case
36 //! of application services) then this field can be omitted.
37 //! Otherwise this is required.
38 QString deviceId() const { return loadFromJson<QString>("device_id"_L1); }
39
40 //! When `true`, the user is a [Guest User](#guest-access). When
41 //! not present or `false`, the user is presumed to be a non-guest
42 //! user.
43 std::optional<bool> isGuest() const { return loadFromJson<std::optional<bool>>("is_guest"_L1); }
44
45 struct Response {
46 //! The user ID that owns the access token.
48
49 //! Device ID associated with the access token. If no device
50 //! is associated with the access token (such as in the case
51 //! of application services) then this field can be omitted.
52 //! Otherwise this is required.
54
55 //! When `true`, the user is a [Guest User](#guest-access). When
56 //! not present or `false`, the user is presumed to be a non-guest
57 //! user.
59 };
60};
61
63constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> GetTokenOwnerJob::Response {
64 return { j->userId(), j->deviceId(), j->isGuest() };
65};
66
67} // namespace Quotient
Gets information about the owner of an access token.
Definition whoami.h:19
#define QUOTIENT_API