diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-07 19:46:40 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-07 19:46:40 +0200 |
commit | 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 (patch) | |
tree | 9a966d7dc0bf628f610d5de1ad64c8d29b6b26f8 /lib/csapi/capabilities.h | |
parent | a0430b1fb722a77ad7cbd28f181727d46d92b3a2 (diff) | |
download | libquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.tar.gz libquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.zip |
Update generated files according to gtad/* changes
Diffstat (limited to 'lib/csapi/capabilities.h')
-rw-r--r-- | lib/csapi/capabilities.h | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/lib/csapi/capabilities.h b/lib/csapi/capabilities.h index 9f46ab2e..da50c8c1 100644 --- a/lib/csapi/capabilities.h +++ b/lib/csapi/capabilities.h @@ -4,17 +4,10 @@ #pragma once -#include "converters.h" - #include "jobs/basejob.h" -#include <QtCore/QHash> -#include <QtCore/QJsonObject> - namespace Quotient { -// Operations - /*! \brief Gets information about the server's capabilities. * * Gets information about the server's supported feature set @@ -61,20 +54,45 @@ public: * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl); - ~GetCapabilitiesJob() override; // Result properties /// The custom capabilities the server supports, using the /// Java package naming convention. - const Capabilities& capabilities() const; + Capabilities capabilities() const + { + return loadFromJson<Capabilities>("capabilities"_ls); + } +}; -protected: - Status parseJson(const QJsonDocument& data) override; +template <> +struct JsonObjectConverter<GetCapabilitiesJob::ChangePasswordCapability> { + static void fillFrom(const QJsonObject& jo, + GetCapabilitiesJob::ChangePasswordCapability& result) + { + fromJson(jo.value("enabled"_ls), result.enabled); + } +}; + +template <> +struct JsonObjectConverter<GetCapabilitiesJob::RoomVersionsCapability> { + static void fillFrom(const QJsonObject& jo, + GetCapabilitiesJob::RoomVersionsCapability& result) + { + fromJson(jo.value("default"_ls), result.defaultVersion); + fromJson(jo.value("available"_ls), result.available); + } +}; -private: - class Private; - QScopedPointer<Private> d; +template <> +struct JsonObjectConverter<GetCapabilitiesJob::Capabilities> { + static void fillFrom(QJsonObject jo, + GetCapabilitiesJob::Capabilities& result) + { + fromJson(jo.take("m.change_password"_ls), result.changePassword); + fromJson(jo.take("m.room_versions"_ls), result.roomVersions); + fromJson(jo, result.additionalProperties); + } }; } // namespace Quotient |