aboutsummaryrefslogtreecommitdiff
path: root/jobs/generated
diff options
context:
space:
mode:
Diffstat (limited to 'jobs/generated')
-rw-r--r--jobs/generated/content-repo.cpp212
-rw-r--r--jobs/generated/content-repo.h102
-rw-r--r--jobs/generated/create_room.cpp114
-rw-r--r--jobs/generated/create_room.h56
4 files changed, 484 insertions, 0 deletions
diff --git a/jobs/generated/content-repo.cpp b/jobs/generated/content-repo.cpp
new file mode 100644
index 00000000..ec6683bb
--- /dev/null
+++ b/jobs/generated/content-repo.cpp
@@ -0,0 +1,212 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "content-repo.h"
+
+#include "converters.h"
+
+#include <QtNetwork/QNetworkReply>
+#include <QtCore/QStringBuilder>
+
+using namespace QMatrixClient;
+
+static const auto basePath = QStringLiteral("/_matrix/media/r0");
+
+class UploadContentJob::Private
+{
+ public:
+ QString contentUri;
+};
+
+UploadContentJob::UploadContentJob(QByteArray content, const QString& filename, const QString& contentType)
+ : BaseJob(HttpVerb::Post, "UploadContentJob",
+ basePath % "/upload")
+ , d(new Private)
+{
+ setRequestHeader("Content-Type", contentType.toLatin1());
+
+ QUrlQuery _q;
+ if (!filename.isEmpty())
+ _q.addQueryItem("filename", filename);
+ setRequestQuery(_q);
+ setRequestData(Data(content));
+}
+
+UploadContentJob::~UploadContentJob() = default;
+
+const QString& UploadContentJob::contentUri() const
+{
+ return d->contentUri;
+}
+
+BaseJob::Status UploadContentJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ if (!json.contains("content_uri"))
+ return { JsonParseError,
+ "The key 'content_uri' not found in the response" };
+ d->contentUri = fromJson<QString>(json.value("content_uri"));
+ return Success;
+}
+
+class GetContentJob::Private
+{
+ public:
+ QString contentType;
+ QString contentDisposition;
+ QByteArray content;
+};
+
+GetContentJob::GetContentJob(const QString& serverName, const QString& mediaId)
+ : BaseJob(HttpVerb::Get, "GetContentJob",
+ basePath % "/download/" % serverName % "/" % mediaId, false)
+ , d(new Private)
+{
+ setExpectedContentTypes({ "*/*" });
+}
+
+GetContentJob::~GetContentJob() = default;
+
+const QString& GetContentJob::contentType() const
+{
+ return d->contentType;
+}
+
+const QString& GetContentJob::contentDisposition() const
+{
+ return d->contentDisposition;
+}
+
+QByteArray GetContentJob::content() const
+{
+ return d->content;
+}
+
+BaseJob::Status GetContentJob::parseReply(QNetworkReply* reply)
+{
+ d->contentType = reply->rawHeader("Content-Type");
+ d->contentDisposition = reply->rawHeader("Content-Disposition");
+ d->content = reply->readAll();
+ return Success;
+}
+
+class GetContentOverrideNameJob::Private
+{
+ public:
+ QString contentType;
+ QString contentDisposition;
+ QByteArray content;
+};
+
+GetContentOverrideNameJob::GetContentOverrideNameJob(const QString& serverName, const QString& mediaId, const QString& fileName)
+ : BaseJob(HttpVerb::Get, "GetContentOverrideNameJob",
+ basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName, false)
+ , d(new Private)
+{
+ setExpectedContentTypes({ "*/*" });
+}
+
+GetContentOverrideNameJob::~GetContentOverrideNameJob() = default;
+
+const QString& GetContentOverrideNameJob::contentType() const
+{
+ return d->contentType;
+}
+
+const QString& GetContentOverrideNameJob::contentDisposition() const
+{
+ return d->contentDisposition;
+}
+
+QByteArray GetContentOverrideNameJob::content() const
+{
+ return d->content;
+}
+
+BaseJob::Status GetContentOverrideNameJob::parseReply(QNetworkReply* reply)
+{
+ d->contentType = reply->rawHeader("Content-Type");
+ d->contentDisposition = reply->rawHeader("Content-Disposition");
+ d->content = reply->readAll();
+ return Success;
+}
+
+class GetContentThumbnailJob::Private
+{
+ public:
+ QString contentType;
+ QByteArray content;
+};
+
+GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width, int height, const QString& method)
+ : BaseJob(HttpVerb::Get, "GetContentThumbnailJob",
+ basePath % "/thumbnail/" % serverName % "/" % mediaId, false)
+ , d(new Private)
+{
+ QUrlQuery _q;
+ _q.addQueryItem("width", QString("%1").arg(width));
+ _q.addQueryItem("height", QString("%1").arg(height));
+ if (!method.isEmpty())
+ _q.addQueryItem("method", method);
+ setRequestQuery(_q);
+ setExpectedContentTypes({ "image/jpeg", "image/png" });
+}
+
+GetContentThumbnailJob::~GetContentThumbnailJob() = default;
+
+const QString& GetContentThumbnailJob::contentType() const
+{
+ return d->contentType;
+}
+
+QByteArray GetContentThumbnailJob::content() const
+{
+ return d->content;
+}
+
+BaseJob::Status GetContentThumbnailJob::parseReply(QNetworkReply* reply)
+{
+ d->contentType = reply->rawHeader("Content-Type");
+ d->content = reply->readAll();
+ return Success;
+}
+
+class GetUrlPreviewJob::Private
+{
+ public:
+ double matrixImageSize;
+ QString ogImage;
+};
+
+GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, double ts)
+ : BaseJob(HttpVerb::Get, "GetUrlPreviewJob",
+ basePath % "/preview_url")
+ , d(new Private)
+{
+ QUrlQuery _q;
+ _q.addQueryItem("url", url);
+ _q.addQueryItem("ts", QString("%1").arg(ts));
+ setRequestQuery(_q);
+}
+
+GetUrlPreviewJob::~GetUrlPreviewJob() = default;
+
+double GetUrlPreviewJob::matrixImageSize() const
+{
+ return d->matrixImageSize;
+}
+
+const QString& GetUrlPreviewJob::ogImage() const
+{
+ return d->ogImage;
+}
+
+BaseJob::Status GetUrlPreviewJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ d->matrixImageSize = fromJson<double>(json.value("matrix:image:size"));
+ d->ogImage = fromJson<QString>(json.value("og:image"));
+ return Success;
+}
+
diff --git a/jobs/generated/content-repo.h b/jobs/generated/content-repo.h
new file mode 100644
index 00000000..1d844651
--- /dev/null
+++ b/jobs/generated/content-repo.h
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "../basejob.h"
+
+#include <QtCore/QByteArray>
+#include <QtCore/QString>
+
+
+namespace QMatrixClient
+{
+ // Operations
+
+ class UploadContentJob : public BaseJob
+ {
+ public:
+ explicit UploadContentJob(QByteArray content, const QString& filename = {}, const QString& contentType = {});
+ ~UploadContentJob() override;
+
+ const QString& contentUri() const;
+
+ protected:
+ Status parseJson(const QJsonDocument& data) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+
+ class GetContentJob : public BaseJob
+ {
+ public:
+ explicit GetContentJob(const QString& serverName, const QString& mediaId);
+ ~GetContentJob() override;
+
+ const QString& contentType() const;
+ const QString& contentDisposition() const;
+ QByteArray content() const;
+
+ protected:
+ Status parseReply(QNetworkReply* reply) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+
+ class GetContentOverrideNameJob : public BaseJob
+ {
+ public:
+ explicit GetContentOverrideNameJob(const QString& serverName, const QString& mediaId, const QString& fileName);
+ ~GetContentOverrideNameJob() override;
+
+ const QString& contentType() const;
+ const QString& contentDisposition() const;
+ QByteArray content() const;
+
+ protected:
+ Status parseReply(QNetworkReply* reply) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+
+ class GetContentThumbnailJob : public BaseJob
+ {
+ public:
+ explicit GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width = {}, int height = {}, const QString& method = {});
+ ~GetContentThumbnailJob() override;
+
+ const QString& contentType() const;
+ QByteArray content() const;
+
+ protected:
+ Status parseReply(QNetworkReply* reply) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+
+ class GetUrlPreviewJob : public BaseJob
+ {
+ public:
+ explicit GetUrlPreviewJob(const QString& url, double ts = {});
+ ~GetUrlPreviewJob() override;
+
+ double matrixImageSize() const;
+ const QString& ogImage() const;
+
+ protected:
+ Status parseJson(const QJsonDocument& data) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+} // namespace QMatrixClient
diff --git a/jobs/generated/create_room.cpp b/jobs/generated/create_room.cpp
new file mode 100644
index 00000000..be06873a
--- /dev/null
+++ b/jobs/generated/create_room.cpp
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#include "create_room.h"
+
+#include <QtCore/QStringBuilder>
+
+using namespace QMatrixClient;
+
+static const auto basePath = QStringLiteral("/_matrix/client/r0");
+
+CreateRoomJob::Invite3pid::operator QJsonObject() const
+{
+ QJsonObject o;
+ o.insert("id_server", toJson(idServer));
+ o.insert("medium", toJson(medium));
+ o.insert("address", toJson(address));
+
+ return o;
+}
+namespace QMatrixClient
+{
+ template <> struct FromJson<CreateRoomJob::Invite3pid>
+ {
+ CreateRoomJob::Invite3pid operator()(QJsonValue jv)
+ {
+ QJsonObject o = jv.toObject();
+ CreateRoomJob::Invite3pid result;
+ result.idServer =
+ fromJson<QString>(o.value("id_server"));
+ result.medium =
+ fromJson<QString>(o.value("medium"));
+ result.address =
+ fromJson<QString>(o.value("address"));
+
+ return result;
+ }
+ };
+} // namespace QMatrixClient
+
+CreateRoomJob::StateEvent::operator QJsonObject() const
+{
+ QJsonObject o;
+ o.insert("type", toJson(type));
+ o.insert("state_key", toJson(stateKey));
+ o.insert("content", toJson(content));
+
+ return o;
+}
+namespace QMatrixClient
+{
+ template <> struct FromJson<CreateRoomJob::StateEvent>
+ {
+ CreateRoomJob::StateEvent operator()(QJsonValue jv)
+ {
+ QJsonObject o = jv.toObject();
+ CreateRoomJob::StateEvent result;
+ result.type =
+ fromJson<QString>(o.value("type"));
+ result.stateKey =
+ fromJson<QString>(o.value("state_key"));
+ result.content =
+ fromJson<QJsonObject>(o.value("content"));
+
+ return result;
+ }
+ };
+} // namespace QMatrixClient
+
+class CreateRoomJob::Private
+{
+ public:
+ QString roomId;
+};
+
+CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QVector<QString>& invite, const QVector<Invite3pid>& invite3pid, const QJsonObject& creationContent, const QVector<StateEvent>& initialState, const QString& preset, bool isDirect)
+ : BaseJob(HttpVerb::Post, "CreateRoomJob",
+ basePath % "/createRoom")
+ , d(new Private)
+{
+ QJsonObject _data;
+ if (!visibility.isEmpty())
+ _data.insert("visibility", toJson(visibility));
+ if (!roomAliasName.isEmpty())
+ _data.insert("room_alias_name", toJson(roomAliasName));
+ if (!name.isEmpty())
+ _data.insert("name", toJson(name));
+ if (!topic.isEmpty())
+ _data.insert("topic", toJson(topic));
+ _data.insert("invite", toJson(invite));
+ _data.insert("invite_3pid", toJson(invite3pid));
+ _data.insert("creation_content", toJson(creationContent));
+ _data.insert("initial_state", toJson(initialState));
+ if (!preset.isEmpty())
+ _data.insert("preset", toJson(preset));
+ _data.insert("is_direct", toJson(isDirect));
+ setRequestData(_data);
+}
+
+CreateRoomJob::~CreateRoomJob() = default;
+
+const QString& CreateRoomJob::roomId() const
+{
+ return d->roomId;
+}
+
+BaseJob::Status CreateRoomJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ d->roomId = fromJson<QString>(json.value("room_id"));
+ return Success;
+}
+
diff --git a/jobs/generated/create_room.h b/jobs/generated/create_room.h
new file mode 100644
index 00000000..a92cb106
--- /dev/null
+++ b/jobs/generated/create_room.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "../basejob.h"
+
+#include <QtCore/QVector>
+#include <QtCore/QJsonObject>
+#include <QtCore/QString>
+
+#include "converters.h"
+
+namespace QMatrixClient
+{
+ // Operations
+
+ class CreateRoomJob : public BaseJob
+ {
+ public:
+ // Inner data structures
+
+ struct Invite3pid
+ {
+ QString idServer;
+ QString medium;
+ QString address;
+
+ operator QJsonObject() const;
+ };
+
+ struct StateEvent
+ {
+ QString type;
+ QString stateKey;
+ QJsonObject content;
+
+ operator QJsonObject() const;
+ };
+
+ // End of inner data structures
+
+ explicit CreateRoomJob(const QString& visibility = {}, const QString& roomAliasName = {}, const QString& name = {}, const QString& topic = {}, const QVector<QString>& invite = {}, const QVector<Invite3pid>& invite3pid = {}, const QJsonObject& creationContent = {}, const QVector<StateEvent>& initialState = {}, const QString& preset = {}, bool isDirect = {});
+ ~CreateRoomJob() override;
+
+ const QString& roomId() const;
+
+ protected:
+ Status parseJson(const QJsonDocument& data) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+} // namespace QMatrixClient