From 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jun 2020 19:46:40 +0200 Subject: Update generated files according to gtad/* changes --- lib/csapi/admin.h | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'lib/csapi/admin.h') diff --git a/lib/csapi/admin.h b/lib/csapi/admin.h index 75ae1eb0..6ad7d08d 100644 --- a/lib/csapi/admin.h +++ b/lib/csapi/admin.h @@ -4,17 +4,10 @@ #pragma once -#include "converters.h" - #include "jobs/basejob.h" -#include -#include - namespace Quotient { -// Operations - /*! \brief Gets information about a particular user. * * Gets information about a particular user. @@ -65,6 +58,7 @@ public: // Construction/destruction /*! \brief Gets information about a particular user. + * * * \param userId * The user to look up. @@ -77,22 +71,44 @@ public: * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId); - ~GetWhoIsJob() override; // Result properties /// The Matrix user ID of the user. - const QString& userId() const; + QString userId() const { return loadFromJson("user_id"_ls); } - /// Each key is an identitfier for one of the user's devices. - const QHash& devices() const; + /// Each key is an identifier for one of the user's devices. + QHash devices() const + { + return loadFromJson>("devices"_ls); + } +}; + +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + GetWhoIsJob::ConnectionInfo& result) + { + fromJson(jo.value("ip"_ls), result.ip); + fromJson(jo.value("last_seen"_ls), result.lastSeen); + fromJson(jo.value("user_agent"_ls), result.userAgent); + } +}; -protected: - Status parseJson(const QJsonDocument& data) override; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, GetWhoIsJob::SessionInfo& result) + { + fromJson(jo.value("connections"_ls), result.connections); + } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, GetWhoIsJob::DeviceInfo& result) + { + fromJson(jo.value("sessions"_ls), result.sessions); + } }; } // namespace Quotient -- cgit v1.2.3