aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/capabilities.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-11 21:07:21 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-11 21:07:21 +0900
commit63e2c0338e07cbc1939a5ad0f8047a9edab9b97c (patch)
treeb34779450d848ad431f1c82f50df77c38e37b56a /lib/csapi/capabilities.cpp
parente98ec84ab31b2dc656597ac5c87a8299b6c8aed8 (diff)
parent7337876aac42552da6d926b38d7466cf2e51b7d8 (diff)
downloadlibquotient-63e2c0338e07cbc1939a5ad0f8047a9edab9b97c.tar.gz
libquotient-63e2c0338e07cbc1939a5ad0f8047a9edab9b97c.zip
Merge branch 'kitsune-update-matrix-api'
Diffstat (limited to 'lib/csapi/capabilities.cpp')
-rw-r--r--lib/csapi/capabilities.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/csapi/capabilities.cpp b/lib/csapi/capabilities.cpp
new file mode 100644
index 00000000..a8e79f6b
--- /dev/null
+++ b/lib/csapi/capabilities.cpp
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "capabilities.h"
+
+#include "converters.h"
+
+#include <QtCore/QStringBuilder>
+
+using namespace QMatrixClient;
+
+static const auto basePath = QStringLiteral("/_matrix/client/r0");
+
+namespace QMatrixClient
+{
+ // Converters
+
+ 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.isDefault);
+ fromJson(jo.value("available"_ls), result.available);
+ }
+ };
+} // namespace QMatrixClient
+
+class GetCapabilitiesJob::Private
+{
+ public:
+ Omittable<ChangePasswordCapability> changePassword;
+ Omittable<RoomVersionsCapability> roomVersions;
+};
+
+QUrl GetCapabilitiesJob::makeRequestUrl(QUrl baseUrl)
+{
+ return BaseJob::makeRequestUrl(std::move(baseUrl),
+ basePath % "/capabilities");
+}
+
+static const auto GetCapabilitiesJobName = QStringLiteral("GetCapabilitiesJob");
+
+GetCapabilitiesJob::GetCapabilitiesJob()
+ : BaseJob(HttpVerb::Get, GetCapabilitiesJobName,
+ basePath % "/capabilities")
+ , d(new Private)
+{
+}
+
+GetCapabilitiesJob::~GetCapabilitiesJob() = default;
+
+const Omittable<GetCapabilitiesJob::ChangePasswordCapability>& GetCapabilitiesJob::changePassword() const
+{
+ return d->changePassword;
+}
+
+const Omittable<GetCapabilitiesJob::RoomVersionsCapability>& GetCapabilitiesJob::roomVersions() const
+{
+ return d->roomVersions;
+}
+
+BaseJob::Status GetCapabilitiesJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ fromJson(json.value("m.change_password"_ls), d->changePassword);
+ fromJson(json.value("m.room_versions"_ls), d->roomVersions);
+ return Success;
+}
+