aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/whoami.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-07 19:46:40 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-07 19:46:40 +0200
commit32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 (patch)
tree9a966d7dc0bf628f610d5de1ad64c8d29b6b26f8 /lib/csapi/whoami.cpp
parenta0430b1fb722a77ad7cbd28f181727d46d92b3a2 (diff)
downloadlibquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.tar.gz
libquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.zip
Update generated files according to gtad/* changes
Diffstat (limited to 'lib/csapi/whoami.cpp')
-rw-r--r--lib/csapi/whoami.cpp30
1 files changed, 4 insertions, 26 deletions
diff --git a/lib/csapi/whoami.cpp b/lib/csapi/whoami.cpp
index 8d4681e4..73f0298e 100644
--- a/lib/csapi/whoami.cpp
+++ b/lib/csapi/whoami.cpp
@@ -4,42 +4,20 @@
#include "whoami.h"
-#include "converters.h"
-
#include <QtCore/QStringBuilder>
using namespace Quotient;
-static const auto basePath = QStringLiteral("/_matrix/client/r0");
-
-class GetTokenOwnerJob::Private {
-public:
- QString userId;
-};
-
QUrl GetTokenOwnerJob::makeRequestUrl(QUrl baseUrl)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/account/whoami");
+ QStringLiteral("/_matrix/client/r0")
+ % "/account/whoami");
}
GetTokenOwnerJob::GetTokenOwnerJob()
: BaseJob(HttpVerb::Get, QStringLiteral("GetTokenOwnerJob"),
- basePath % "/account/whoami")
- , d(new Private)
-{}
-
-GetTokenOwnerJob::~GetTokenOwnerJob() = default;
-
-const QString& GetTokenOwnerJob::userId() const { return d->userId; }
-
-BaseJob::Status GetTokenOwnerJob::parseJson(const QJsonDocument& data)
+ QStringLiteral("/_matrix/client/r0") % "/account/whoami")
{
- auto json = data.object();
- if (!json.contains("user_id"_ls))
- return { IncorrectResponse,
- "The key 'user_id' not found in the response" };
- fromJson(json.value("user_id"_ls), d->userId);
-
- return Success;
+ addExpectedKey("user_id");
}