aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/profile.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-03 17:29:52 +0900
committerGitHub <noreply@github.com>2019-08-03 17:29:52 +0900
commit66e116b7b1e848e80577a0229c8995db0a54932e (patch)
tree763340439a0f4034e9c829d76cb1ffe9766b83c5 /lib/csapi/profile.cpp
parent5b236dfe895c7766002559570aa29c9033009228 (diff)
parentc05ade838f0fce81f2bbe80a3295618a8a26ff52 (diff)
downloadlibquotient-66e116b7b1e848e80577a0229c8995db0a54932e.tar.gz
libquotient-66e116b7b1e848e80577a0229c8995db0a54932e.zip
Merge pull request #295 from marcdeop/140_impose_coding_standard
140 impose coding standard
Diffstat (limited to 'lib/csapi/profile.cpp')
-rw-r--r--lib/csapi/profile.cpp70
1 files changed, 29 insertions, 41 deletions
diff --git a/lib/csapi/profile.cpp b/lib/csapi/profile.cpp
index 4ed3ad9b..630452f6 100644
--- a/lib/csapi/profile.cpp
+++ b/lib/csapi/profile.cpp
@@ -14,9 +14,10 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
static const auto SetDisplayNameJobName = QStringLiteral("SetDisplayNameJob");
-SetDisplayNameJob::SetDisplayNameJob(const QString& userId, const QString& displayname)
+SetDisplayNameJob::SetDisplayNameJob(const QString& userId,
+ const QString& displayname)
: BaseJob(HttpVerb::Put, SetDisplayNameJobName,
- basePath % "/profile/" % userId % "/displayname")
+ basePath % "/profile/" % userId % "/displayname")
{
QJsonObject _data;
addParam<IfNotEmpty>(_data, QStringLiteral("displayname"), displayname);
@@ -25,36 +26,33 @@ SetDisplayNameJob::SetDisplayNameJob(const QString& userId, const QString& displ
class GetDisplayNameJob::Private
{
- public:
- QString displayname;
+public:
+ QString displayname;
};
QUrl GetDisplayNameJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
- return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/profile/" % userId % "/displayname");
+ return BaseJob::makeRequestUrl(
+ std::move(baseUrl), basePath % "/profile/" % userId % "/displayname");
}
static const auto GetDisplayNameJobName = QStringLiteral("GetDisplayNameJob");
GetDisplayNameJob::GetDisplayNameJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetDisplayNameJobName,
- basePath % "/profile/" % userId % "/displayname", false)
+ basePath % "/profile/" % userId % "/displayname", false)
, d(new Private)
-{
-}
+{}
GetDisplayNameJob::~GetDisplayNameJob() = default;
-const QString& GetDisplayNameJob::displayname() const
-{
- return d->displayname;
-}
+const QString& GetDisplayNameJob::displayname() const { return d->displayname; }
BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("displayname"_ls), d->displayname);
+
return Success;
}
@@ -62,7 +60,7 @@ static const auto SetAvatarUrlJobName = QStringLiteral("SetAvatarUrlJob");
SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl)
: BaseJob(HttpVerb::Put, SetAvatarUrlJobName,
- basePath % "/profile/" % userId % "/avatar_url")
+ basePath % "/profile/" % userId % "/avatar_url")
{
QJsonObject _data;
addParam<IfNotEmpty>(_data, QStringLiteral("avatar_url"), avatarUrl);
@@ -71,78 +69,68 @@ SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl
class GetAvatarUrlJob::Private
{
- public:
- QString avatarUrl;
+public:
+ QString avatarUrl;
};
QUrl GetAvatarUrlJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
- return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/profile/" % userId % "/avatar_url");
+ return BaseJob::makeRequestUrl(
+ std::move(baseUrl), basePath % "/profile/" % userId % "/avatar_url");
}
static const auto GetAvatarUrlJobName = QStringLiteral("GetAvatarUrlJob");
GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetAvatarUrlJobName,
- basePath % "/profile/" % userId % "/avatar_url", false)
+ basePath % "/profile/" % userId % "/avatar_url", false)
, d(new Private)
-{
-}
+{}
GetAvatarUrlJob::~GetAvatarUrlJob() = default;
-const QString& GetAvatarUrlJob::avatarUrl() const
-{
- return d->avatarUrl;
-}
+const QString& GetAvatarUrlJob::avatarUrl() const { return d->avatarUrl; }
BaseJob::Status GetAvatarUrlJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("avatar_url"_ls), d->avatarUrl);
+
return Success;
}
class GetUserProfileJob::Private
{
- public:
- QString avatarUrl;
- QString displayname;
+public:
+ QString avatarUrl;
+ QString displayname;
};
QUrl GetUserProfileJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/profile/" % userId);
+ basePath % "/profile/" % userId);
}
static const auto GetUserProfileJobName = QStringLiteral("GetUserProfileJob");
GetUserProfileJob::GetUserProfileJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetUserProfileJobName,
- basePath % "/profile/" % userId, false)
+ basePath % "/profile/" % userId, false)
, d(new Private)
-{
-}
+{}
GetUserProfileJob::~GetUserProfileJob() = default;
-const QString& GetUserProfileJob::avatarUrl() const
-{
- return d->avatarUrl;
-}
+const QString& GetUserProfileJob::avatarUrl() const { return d->avatarUrl; }
-const QString& GetUserProfileJob::displayname() const
-{
- return d->displayname;
-}
+const QString& GetUserProfileJob::displayname() const { return d->displayname; }
BaseJob::Status GetUserProfileJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("avatar_url"_ls), d->avatarUrl);
fromJson(json.value("displayname"_ls), d->displayname);
+
return Success;
}
-