libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
profile.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 Set the user's display name.
10//!
11//! This API sets the given user's display name. You must have permission to
12//! set this user's display name, e.g. you need to have their `access_token`.
14public:
15 //! \param userId
16 //! The user whose display name to set.
17 //!
18 //! \param displayname
19 //! The new display name for this user.
21};
22
23//! \brief Get the user's display name.
24//!
25//! Get the user's display name. This API may be used to fetch the user's
26//! own displayname or to query the name of other users; either locally or
27//! on remote homeservers.
29public:
30 //! \param userId
31 //! The user whose display name to get.
33
34 //! \brief Construct a URL without creating a full-fledged job object
35 //!
36 //! This function can be used when a URL for GetDisplayNameJob
37 //! is necessary but the job itself isn't.
39
40 // Result properties
41
42 //! The user's display name if they have set one, otherwise not present.
43 QString displayname() const { return loadFromJson<QString>("displayname"_L1); }
44};
45
46inline auto collectResponse(const GetDisplayNameJob* job) { return job->displayname(); }
47
48//! \brief Set the user's avatar URL.
49//!
50//! This API sets the given user's avatar URL. You must have permission to
51//! set this user's avatar URL, e.g. you need to have their `access_token`.
53public:
54 //! \param userId
55 //! The user whose avatar URL to set.
56 //!
57 //! \param avatarUrl
58 //! The new avatar URL for this user.
59 explicit SetAvatarUrlJob(const QString& userId, const QUrl& avatarUrl);
60};
61
62//! \brief Get the user's avatar URL.
63//!
64//! Get the user's avatar URL. This API may be used to fetch the user's
65//! own avatar URL or to query the URL of other users; either locally or
66//! on remote homeservers.
68public:
69 //! \param userId
70 //! The user whose avatar URL to get.
71 explicit GetAvatarUrlJob(const QString& userId);
72
73 //! \brief Construct a URL without creating a full-fledged job object
74 //!
75 //! This function can be used when a URL for GetAvatarUrlJob
76 //! is necessary but the job itself isn't.
78
79 // Result properties
80
81 //! The user's avatar URL if they have set one, otherwise not present.
82 QUrl avatarUrl() const { return loadFromJson<QUrl>("avatar_url"_L1); }
83};
84
85inline auto collectResponse(const GetAvatarUrlJob* job) { return job->avatarUrl(); }
86
87//! \brief Get this user's profile information.
88//!
89//! Get the combined profile information for this user. This API may be used
90//! to fetch the user's own profile information or other users; either
91//! locally or on remote homeservers.
93public:
94 //! \param userId
95 //! The user whose profile information to get.
97
98 //! \brief Construct a URL without creating a full-fledged job object
99 //!
100 //! This function can be used when a URL for GetUserProfileJob
101 //! is necessary but the job itself isn't.
103
104 // Result properties
105
106 //! The user's avatar URL if they have set one, otherwise not present.
107 QUrl avatarUrl() const { return loadFromJson<QUrl>("avatar_url"_L1); }
108
109 //! The user's display name if they have set one, otherwise not present.
110 QString displayname() const { return loadFromJson<QString>("displayname"_L1); }
111
112 struct Response {
113 //! The user's avatar URL if they have set one, otherwise not present.
115
116 //! The user's display name if they have set one, otherwise not present.
118 };
119};
120
122constexpr inline auto doCollectResponse<JobT> =
123 [](JobT* j) -> GetUserProfileJob::Response { return { j->avatarUrl(), j->displayname() }; };
124
125} // namespace Quotient
Get the user's avatar URL.
Definition profile.h:67
Get the user's display name.
Definition profile.h:28
Get this user's profile information.
Definition profile.h:92
Set the user's avatar URL.
Definition profile.h:52
Set the user's display name.
Definition profile.h:13
auto collectResponse(const GetAccountDataJob *job)
#define QUOTIENT_API