diff options
Diffstat (limited to 'lib/csapi/whoami.cpp')
-rw-r--r-- | lib/csapi/whoami.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/csapi/whoami.cpp b/lib/csapi/whoami.cpp index ce024c33..fb7f54dc 100644 --- a/lib/csapi/whoami.cpp +++ b/lib/csapi/whoami.cpp @@ -8,45 +8,40 @@ #include <QtCore/QStringBuilder> -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); class GetTokenOwnerJob::Private { - public: - QString userId; +public: + QString userId; }; QUrl GetTokenOwnerJob::makeRequestUrl(QUrl baseUrl) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/account/whoami"); + basePath % "/account/whoami"); } static const auto GetTokenOwnerJobName = QStringLiteral("GetTokenOwnerJob"); GetTokenOwnerJob::GetTokenOwnerJob() - : BaseJob(HttpVerb::Get, GetTokenOwnerJobName, - basePath % "/account/whoami") + : BaseJob(HttpVerb::Get, GetTokenOwnerJobName, basePath % "/account/whoami") , d(new Private) -{ -} +{} GetTokenOwnerJob::~GetTokenOwnerJob() = default; -const QString& GetTokenOwnerJob::userId() const -{ - return d->userId; -} +const QString& GetTokenOwnerJob::userId() const { return d->userId; } BaseJob::Status GetTokenOwnerJob::parseJson(const QJsonDocument& data) { auto json = data.object(); if (!json.contains("user_id"_ls)) return { IncorrectResponse, - "The key 'user_id' not found in the response" }; + "The key 'user_id' not found in the response" }; fromJson(json.value("user_id"_ls), d->userId); + return Success; } - |