From 879e0bd17abedcc93d005eb7b66f6e9aa762200a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 7 Dec 2017 11:40:46 +0900 Subject: New generated jobs for: room directory, 3PIDs, redactions, typing notifications and others Closes #128 (the issue has the full list of jobs arriving herewith). --- jobs/generated/whoami.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 jobs/generated/whoami.cpp (limited to 'jobs/generated/whoami.cpp') diff --git a/jobs/generated/whoami.cpp b/jobs/generated/whoami.cpp new file mode 100644 index 00000000..dce091ec --- /dev/null +++ b/jobs/generated/whoami.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#include "whoami.h" + +#include "converters.h" + +#include + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class GetTokenOwnerJob::Private +{ + public: + QString userId; +}; + +GetTokenOwnerJob::GetTokenOwnerJob() + : BaseJob(HttpVerb::Get, "GetTokenOwnerJob", + basePath % "/account/whoami", + Query { } + ), d(new Private) +{ } + +GetTokenOwnerJob::~GetTokenOwnerJob() +{ + delete d; +} + +const QString& GetTokenOwnerJob::userId() const +{ + return d->userId; +} + +BaseJob::Status GetTokenOwnerJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + if (!json.contains("user_id")) + return { JsonParseError, + "The key 'user_id' not found in the response" }; + d->userId = fromJson(json.value("user_id")); + return Success; +} + -- cgit v1.2.3