aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-03 19:37:50 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-03 19:37:50 +0900
commit66b08e3570d272d4dd81823cdf303ce7eae17609 (patch)
tree539eb44a9c9e9caae78dd2b01942a106aa342da0
parent32a912ff71bc86d862d89e0a01a35ce7b001de7c (diff)
downloadlibquotient-66b08e3570d272d4dd81823cdf303ce7eae17609.tar.gz
libquotient-66b08e3570d272d4dd81823cdf303ce7eae17609.zip
csapi: GetTurnServerJob
-rw-r--r--lib/csapi/gtad.yaml5
-rw-r--r--lib/csapi/voip.cpp50
-rw-r--r--lib/csapi/voip.h40
3 files changed, 93 insertions, 2 deletions
diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml
index fada9c83..2e3b3c51 100644
--- a/lib/csapi/gtad.yaml
+++ b/lib/csapi/gtad.yaml
@@ -57,7 +57,7 @@ analyzer:
- file: *ByteStream
- +set: { avoidCopy: }
+on:
- - object: { type: QJsonObject, imports: <QtCore/QJsonObject> }
+ - object: &QJsonObject { type: QJsonObject, imports: <QtCore/QJsonObject> }
- $ref:
- +set: { moveOnly: }
+on:
@@ -101,7 +101,8 @@ analyzer:
- "string|null": *QString
- //: { type: QVariant, imports: <QtCore/QVariant> }
- schema: # Properties of inline structure definitions
- *UseOmittable
+ - TurnServerCredentials: *QJsonObject # Because it's used as is
+ - //: *UseOmittable
#operations:
diff --git a/lib/csapi/voip.cpp b/lib/csapi/voip.cpp
new file mode 100644
index 00000000..f84c140d
--- /dev/null
+++ b/lib/csapi/voip.cpp
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "voip.h"
+
+#include "converters.h"
+
+#include <QtCore/QStringBuilder>
+
+using namespace QMatrixClient;
+
+static const auto basePath = QStringLiteral("/_matrix/client/r0");
+
+class GetTurnServerJob::Private
+{
+ public:
+ QJsonObject data;
+};
+
+QUrl GetTurnServerJob::makeRequestUrl(QUrl baseUrl)
+{
+ return BaseJob::makeRequestUrl(std::move(baseUrl),
+ basePath % "/voip/turnServer");
+}
+
+GetTurnServerJob::GetTurnServerJob()
+ : BaseJob(HttpVerb::Get, "GetTurnServerJob",
+ basePath % "/voip/turnServer")
+ , d(new Private)
+{
+}
+
+GetTurnServerJob::~GetTurnServerJob() = default;
+
+const QJsonObject& GetTurnServerJob::data() const
+{
+ return d->data;
+}
+
+BaseJob::Status GetTurnServerJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ if (!json.contains("data"))
+ return { JsonParseError,
+ "The key 'data' not found in the response" };
+ d->data = fromJson<QJsonObject>(json.value("data"));
+ return Success;
+}
+
diff --git a/lib/csapi/voip.h b/lib/csapi/voip.h
new file mode 100644
index 00000000..fafbaf4a
--- /dev/null
+++ b/lib/csapi/voip.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "jobs/basejob.h"
+
+#include <QtCore/QJsonObject>
+
+namespace QMatrixClient
+{
+ // Operations
+
+ class GetTurnServerJob : public BaseJob
+ {
+ public:
+ explicit GetTurnServerJob();
+
+ /** Construct a URL out of baseUrl and usual parameters passed to
+ * GetTurnServerJob. This function can be used when
+ * a URL for GetTurnServerJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl);
+
+ ~GetTurnServerJob() override;
+
+ // Result properties
+
+ const QJsonObject& data() const;
+
+ protected:
+ Status parseJson(const QJsonDocument& data) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+} // namespace QMatrixClient