aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/profile.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-09 08:52:25 +0200
committerGitHub <noreply@github.com>2020-06-09 08:52:25 +0200
commit370d9b3e46332d38df8798cda208c534c58be808 (patch)
treef3db0cd7463468ff52c74446acd608356f8b8ab6 /lib/csapi/profile.h
parente1f5d0aa2c33e6da6c3a609c8bc7e0b5867e748d (diff)
parent10d9ac4673e374a9ac17ff492591136520337c4c (diff)
downloadlibquotient-370d9b3e46332d38df8798cda208c534c58be808.tar.gz
libquotient-370d9b3e46332d38df8798cda208c534c58be808.zip
Merge pull request #405 from quotient-im/kitsune-basejob-store-json-response
Store JSON response in BaseJob + tweaks to the generated code
Diffstat (limited to 'lib/csapi/profile.h')
-rw-r--r--lib/csapi/profile.h47
1 files changed, 17 insertions, 30 deletions
diff --git a/lib/csapi/profile.h b/lib/csapi/profile.h
index 8279fe20..5b0d06d9 100644
--- a/lib/csapi/profile.h
+++ b/lib/csapi/profile.h
@@ -8,8 +8,6 @@
namespace Quotient {
-// Operations
-
/*! \brief Set the user's display name.
*
* This API sets the given user's display name. You must have permission to
@@ -19,8 +17,10 @@ class SetDisplayNameJob : public BaseJob {
public:
/*! \brief Set the user's display name.
*
+ *
* \param userId
* The user whose display name to set.
+ *
* \param displayname
* The new display name for this user.
*/
@@ -38,6 +38,7 @@ class GetDisplayNameJob : public BaseJob {
public:
/*! \brief Get the user's display name.
*
+ *
* \param userId
* The user whose display name to get.
*/
@@ -49,19 +50,14 @@ public:
* is necessary but the job itself isn't.
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
- ~GetDisplayNameJob() override;
// Result properties
/// The user's display name if they have set one, otherwise not present.
- const QString& displayname() const;
-
-protected:
- Status parseJson(const QJsonDocument& data) override;
-
-private:
- class Private;
- QScopedPointer<Private> d;
+ QString displayname() const
+ {
+ return loadFromJson<QString>("displayname"_ls);
+ }
};
/*! \brief Set the user's avatar URL.
@@ -73,8 +69,10 @@ class SetAvatarUrlJob : public BaseJob {
public:
/*! \brief Set the user's avatar URL.
*
+ *
* \param userId
* The user whose avatar URL to set.
+ *
* \param avatarUrl
* The new avatar URL for this user.
*/
@@ -92,6 +90,7 @@ class GetAvatarUrlJob : public BaseJob {
public:
/*! \brief Get the user's avatar URL.
*
+ *
* \param userId
* The user whose avatar URL to get.
*/
@@ -103,19 +102,11 @@ public:
* is necessary but the job itself isn't.
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
- ~GetAvatarUrlJob() override;
// Result properties
/// The user's avatar URL if they have set one, otherwise not present.
- const QString& avatarUrl() const;
-
-protected:
- Status parseJson(const QJsonDocument& data) override;
-
-private:
- class Private;
- QScopedPointer<Private> d;
+ QString avatarUrl() const { return loadFromJson<QString>("avatar_url"_ls); }
};
/*! \brief Get this user's profile information.
@@ -129,6 +120,7 @@ class GetUserProfileJob : public BaseJob {
public:
/*! \brief Get this user's profile information.
*
+ *
* \param userId
* The user whose profile information to get.
*/
@@ -140,22 +132,17 @@ public:
* is necessary but the job itself isn't.
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
- ~GetUserProfileJob() override;
// Result properties
/// The user's avatar URL if they have set one, otherwise not present.
- const QString& avatarUrl() const;
+ QString avatarUrl() const { return loadFromJson<QString>("avatar_url"_ls); }
/// The user's display name if they have set one, otherwise not present.
- const QString& displayname() const;
-
-protected:
- Status parseJson(const QJsonDocument& data) override;
-
-private:
- class Private;
- QScopedPointer<Private> d;
+ QString displayname() const
+ {
+ return loadFromJson<QString>("displayname"_ls);
+ }
};
} // namespace Quotient