1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/jobs/basejob.h>
8
9namespace Quotient {
10
11/*! \brief Set the user's display name.
12 *
13 * This API sets the given user's display name. You must have permission to
14 * set this user's display name, e.g. you need to have their `access_token`.
15 */
16class QUOTIENT_API SetDisplayNameJob : public BaseJob {
17public:
18 /*! \brief Set the user's display name.
19 *
20 * \param userId
21 * The user whose display name to set.
22 *
23 * \param displayname
24 * The new display name for this user.
25 */
26 explicit SetDisplayNameJob(const QString& userId,
27 const QString& displayname);
28};
29
30/*! \brief Get the user's display name.
31 *
32 * Get the user's display name. This API may be used to fetch the user's
33 * own displayname or to query the name of other users; either locally or
34 * on remote homeservers.
35 */
36class QUOTIENT_API GetDisplayNameJob : public BaseJob {
37public:
38 /*! \brief Get the user's display name.
39 *
40 * \param userId
41 * The user whose display name to get.
42 */
43 explicit GetDisplayNameJob(const QString& userId);
44
45 /*! \brief Construct a URL without creating a full-fledged job object
46 *
47 * This function can be used when a URL for GetDisplayNameJob
48 * is necessary but the job itself isn't.
49 */
50 static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
51
52 // Result properties
53
54 /// The user's display name if they have set one, otherwise not present.
55 QString displayname() const
56 {
57 return loadFromJson<QString>(keyName: "displayname"_ls);
58 }
59};
60
61/*! \brief Set the user's avatar URL.
62 *
63 * This API sets the given user's avatar URL. You must have permission to
64 * set this user's avatar URL, e.g. you need to have their `access_token`.
65 */
66class QUOTIENT_API SetAvatarUrlJob : public BaseJob {
67public:
68 /*! \brief Set the user's avatar URL.
69 *
70 * \param userId
71 * The user whose avatar URL to set.
72 *
73 * \param avatarUrl
74 * The new avatar URL for this user.
75 */
76 explicit SetAvatarUrlJob(const QString& userId, const QUrl& avatarUrl);
77};
78
79/*! \brief Get the user's avatar URL.
80 *
81 * Get the user's avatar URL. This API may be used to fetch the user's
82 * own avatar URL or to query the URL of other users; either locally or
83 * on remote homeservers.
84 */
85class QUOTIENT_API GetAvatarUrlJob : public BaseJob {
86public:
87 /*! \brief Get the user's avatar URL.
88 *
89 * \param userId
90 * The user whose avatar URL to get.
91 */
92 explicit GetAvatarUrlJob(const QString& userId);
93
94 /*! \brief Construct a URL without creating a full-fledged job object
95 *
96 * This function can be used when a URL for GetAvatarUrlJob
97 * is necessary but the job itself isn't.
98 */
99 static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
100
101 // Result properties
102
103 /// The user's avatar URL if they have set one, otherwise not present.
104 QUrl avatarUrl() const { return loadFromJson<QUrl>(keyName: "avatar_url"_ls); }
105};
106
107/*! \brief Get this user's profile information.
108 *
109 * Get the combined profile information for this user. This API may be used
110 * to fetch the user's own profile information or other users; either
111 * locally or on remote homeservers. This API may return keys which are not
112 * limited to `displayname` or `avatar_url`.
113 */
114class QUOTIENT_API GetUserProfileJob : public BaseJob {
115public:
116 /*! \brief Get this user's profile information.
117 *
118 * \param userId
119 * The user whose profile information to get.
120 */
121 explicit GetUserProfileJob(const QString& userId);
122
123 /*! \brief Construct a URL without creating a full-fledged job object
124 *
125 * This function can be used when a URL for GetUserProfileJob
126 * is necessary but the job itself isn't.
127 */
128 static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
129
130 // Result properties
131
132 /// The user's avatar URL if they have set one, otherwise not present.
133 QUrl avatarUrl() const { return loadFromJson<QUrl>(keyName: "avatar_url"_ls); }
134
135 /// The user's display name if they have set one, otherwise not present.
136 QString displayname() const
137 {
138 return loadFromJson<QString>(keyName: "displayname"_ls);
139 }
140};
141
142} // namespace Quotient
143