aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/knocking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csapi/knocking.cpp')
-rw-r--r--lib/csapi/knocking.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/csapi/knocking.cpp b/lib/csapi/knocking.cpp
new file mode 100644
index 00000000..4b561300
--- /dev/null
+++ b/lib/csapi/knocking.cpp
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "knocking.h"
+
+#include <QtCore/QStringBuilder>
+
+using namespace Quotient;
+
+auto queryToKnockRoom(const QStringList& serverName)
+{
+ BaseJob::Query _q;
+ addParam<IfNotEmpty>(_q, QStringLiteral("server_name"), serverName);
+ return _q;
+}
+
+KnockRoomJob::KnockRoomJob(const QString& roomIdOrAlias,
+ const QStringList& serverName, const QString& reason)
+ : BaseJob(HttpVerb::Post, QStringLiteral("KnockRoomJob"),
+ QStringLiteral("/_matrix/client/r0") % "/knock/" % roomIdOrAlias,
+ queryToKnockRoom(serverName))
+{
+ QJsonObject _data;
+ addParam<IfNotEmpty>(_data, QStringLiteral("reason"), reason);
+ setRequestData(std::move(_data));
+ addExpectedKey("room_id");
+}