diff options
Diffstat (limited to 'lib/jobs/generated')
40 files changed, 0 insertions, 2476 deletions
diff --git a/lib/jobs/generated/account-data.cpp b/lib/jobs/generated/account-data.cpp deleted file mode 100644 index 35ee94c0..00000000 --- a/lib/jobs/generated/account-data.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "account-data.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -SetAccountDataJob::SetAccountDataJob(const QString& userId, const QString& type, const QJsonObject& content) - : BaseJob(HttpVerb::Put, "SetAccountDataJob", - basePath % "/user/" % userId % "/account_data/" % type) -{ - setRequestData(Data(content)); -} - -SetAccountDataPerRoomJob::SetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type, const QJsonObject& content) - : BaseJob(HttpVerb::Put, "SetAccountDataPerRoomJob", - basePath % "/user/" % userId % "/rooms/" % roomId % "/account_data/" % type) -{ - setRequestData(Data(content)); -} - diff --git a/lib/jobs/generated/account-data.h b/lib/jobs/generated/account-data.h deleted file mode 100644 index 69ad9fb4..00000000 --- a/lib/jobs/generated/account-data.h +++ /dev/null @@ -1,27 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QJsonObject> - - -namespace QMatrixClient -{ - // Operations - - class SetAccountDataJob : public BaseJob - { - public: - explicit SetAccountDataJob(const QString& userId, const QString& type, const QJsonObject& content = {}); - }; - - class SetAccountDataPerRoomJob : public BaseJob - { - public: - explicit SetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type, const QJsonObject& content = {}); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/administrative_contact.cpp b/lib/jobs/generated/administrative_contact.cpp deleted file mode 100644 index bd74490c..00000000 --- a/lib/jobs/generated/administrative_contact.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "administrative_contact.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -GetAccount3PIDsJob::ThirdPartyIdentifier::operator QJsonObject() const -{ - QJsonObject o; - o.insert("medium", toJson(medium)); - o.insert("address", toJson(address)); - - return o; -} -namespace QMatrixClient -{ - template <> struct FromJson<GetAccount3PIDsJob::ThirdPartyIdentifier> - { - GetAccount3PIDsJob::ThirdPartyIdentifier operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - GetAccount3PIDsJob::ThirdPartyIdentifier result; - result.medium = - fromJson<QString>(o.value("medium")); - result.address = - fromJson<QString>(o.value("address")); - - return result; - } - }; -} // namespace QMatrixClient - -class GetAccount3PIDsJob::Private -{ - public: - QVector<ThirdPartyIdentifier> threepids; -}; - -QUrl GetAccount3PIDsJob::makeRequestUrl(QUrl baseUrl) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/account/3pid"); -} - -GetAccount3PIDsJob::GetAccount3PIDsJob() - : BaseJob(HttpVerb::Get, "GetAccount3PIDsJob", - basePath % "/account/3pid") - , d(new Private) -{ -} - -GetAccount3PIDsJob::~GetAccount3PIDsJob() = default; - -const QVector<GetAccount3PIDsJob::ThirdPartyIdentifier>& GetAccount3PIDsJob::threepids() const -{ - return d->threepids; -} - -BaseJob::Status GetAccount3PIDsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->threepids = fromJson<QVector<ThirdPartyIdentifier>>(json.value("threepids")); - return Success; -} - -Post3PIDsJob::ThreePidCredentials::operator QJsonObject() const -{ - QJsonObject o; - o.insert("client_secret", toJson(clientSecret)); - o.insert("id_server", toJson(idServer)); - o.insert("sid", toJson(sid)); - - return o; -} -namespace QMatrixClient -{ - template <> struct FromJson<Post3PIDsJob::ThreePidCredentials> - { - Post3PIDsJob::ThreePidCredentials operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - Post3PIDsJob::ThreePidCredentials result; - result.clientSecret = - fromJson<QString>(o.value("client_secret")); - result.idServer = - fromJson<QString>(o.value("id_server")); - result.sid = - fromJson<QString>(o.value("sid")); - - return result; - } - }; -} // namespace QMatrixClient - -Post3PIDsJob::Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind) - : BaseJob(HttpVerb::Post, "Post3PIDsJob", - basePath % "/account/3pid") -{ - QJsonObject _data; - _data.insert("three_pid_creds", toJson(threePidCreds)); - _data.insert("bind", toJson(bind)); - setRequestData(_data); -} - -QUrl RequestTokenTo3PIDJob::makeRequestUrl(QUrl baseUrl) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/account/3pid/email/requestToken"); -} - -RequestTokenTo3PIDJob::RequestTokenTo3PIDJob() - : BaseJob(HttpVerb::Post, "RequestTokenTo3PIDJob", - basePath % "/account/3pid/email/requestToken", false) -{ -} - diff --git a/lib/jobs/generated/administrative_contact.h b/lib/jobs/generated/administrative_contact.h deleted file mode 100644 index c8429d39..00000000 --- a/lib/jobs/generated/administrative_contact.h +++ /dev/null @@ -1,83 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QVector> - -#include "converters.h" - -namespace QMatrixClient -{ - // Operations - - class GetAccount3PIDsJob : public BaseJob - { - public: - // Inner data structures - - struct ThirdPartyIdentifier - { - QString medium; - QString address; - - operator QJsonObject() const; - }; - - // End of inner data structures - - /** Construct a URL out of baseUrl and usual parameters passed to - * GetAccount3PIDsJob. This function can be used when - * a URL for GetAccount3PIDsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); - - explicit GetAccount3PIDsJob(); - ~GetAccount3PIDsJob() override; - - const QVector<ThirdPartyIdentifier>& threepids() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class Post3PIDsJob : public BaseJob - { - public: - // Inner data structures - - struct ThreePidCredentials - { - QString clientSecret; - QString idServer; - QString sid; - - operator QJsonObject() const; - }; - - // End of inner data structures - - explicit Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind = {}); - }; - - class RequestTokenTo3PIDJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * RequestTokenTo3PIDJob. This function can be used when - * a URL for RequestTokenTo3PIDJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); - - explicit RequestTokenTo3PIDJob(); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/banning.cpp b/lib/jobs/generated/banning.cpp deleted file mode 100644 index f66b27b6..00000000 --- a/lib/jobs/generated/banning.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "banning.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -BanJob::BanJob(const QString& roomId, const QString& userId, const QString& reason) - : BaseJob(HttpVerb::Post, "BanJob", - basePath % "/rooms/" % roomId % "/ban") -{ - QJsonObject _data; - _data.insert("user_id", toJson(userId)); - if (!reason.isEmpty()) - _data.insert("reason", toJson(reason)); - setRequestData(_data); -} - -UnbanJob::UnbanJob(const QString& roomId, const QString& userId) - : BaseJob(HttpVerb::Post, "UnbanJob", - basePath % "/rooms/" % roomId % "/unban") -{ - QJsonObject _data; - _data.insert("user_id", toJson(userId)); - setRequestData(_data); -} - diff --git a/lib/jobs/generated/banning.h b/lib/jobs/generated/banning.h deleted file mode 100644 index 2d6fbd9b..00000000 --- a/lib/jobs/generated/banning.h +++ /dev/null @@ -1,26 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class BanJob : public BaseJob - { - public: - explicit BanJob(const QString& roomId, const QString& userId, const QString& reason = {}); - }; - - class UnbanJob : public BaseJob - { - public: - explicit UnbanJob(const QString& roomId, const QString& userId); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/content-repo.cpp b/lib/jobs/generated/content-repo.cpp deleted file mode 100644 index 95fc5aed..00000000 --- a/lib/jobs/generated/content-repo.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/****************************************************************************** - * 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; -}; - -BaseJob::Query queryToUploadContent(const QString& filename) -{ - BaseJob::Query _q; - if (!filename.isEmpty()) - _q.addQueryItem("filename", filename); - return _q; -} - -UploadContentJob::UploadContentJob(QIODevice* content, const QString& filename, const QString& contentType) - : BaseJob(HttpVerb::Post, "UploadContentJob", - basePath % "/upload", - queryToUploadContent(filename)) - , d(new Private) -{ - setRequestHeader("Content-Type", contentType.toLatin1()); - - 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; - QIODevice* content; -}; - -QUrl GetContentJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/download/" % serverName % "/" % mediaId); -} - -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; -} - -QIODevice* 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; - return Success; -} - -class GetContentOverrideNameJob::Private -{ - public: - QString contentType; - QString contentDisposition; - QIODevice* content; -}; - -QUrl GetContentOverrideNameJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, const QString& fileName) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName); -} - -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; -} - -QIODevice* 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; - return Success; -} - -class GetContentThumbnailJob::Private -{ - public: - QString contentType; - QIODevice* content; -}; - -BaseJob::Query queryToGetContentThumbnail(int width, int height, const QString& method) -{ - BaseJob::Query _q; - _q.addQueryItem("width", QString("%1").arg(width)); - _q.addQueryItem("height", QString("%1").arg(height)); - if (!method.isEmpty()) - _q.addQueryItem("method", method); - return _q; -} - -QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, int width, int height, const QString& method) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/thumbnail/" % serverName % "/" % mediaId, - queryToGetContentThumbnail(width, height, method)); -} - -GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width, int height, const QString& method) - : BaseJob(HttpVerb::Get, "GetContentThumbnailJob", - basePath % "/thumbnail/" % serverName % "/" % mediaId, - queryToGetContentThumbnail(width, height, method), - {}, false) - , d(new Private) -{ - setExpectedContentTypes({ "image/jpeg", "image/png" }); -} - -GetContentThumbnailJob::~GetContentThumbnailJob() = default; - -const QString& GetContentThumbnailJob::contentType() const -{ - return d->contentType; -} - -QIODevice* GetContentThumbnailJob::content() const -{ - return d->content; -} - -BaseJob::Status GetContentThumbnailJob::parseReply(QNetworkReply* reply) -{ - d->contentType = reply->rawHeader("Content-Type"); - d->content = reply; - return Success; -} - -class GetUrlPreviewJob::Private -{ - public: - qint64 matrixImageSize; - QString ogImage; -}; - -BaseJob::Query queryToGetUrlPreview(const QString& url, qint64 ts) -{ - BaseJob::Query _q; - _q.addQueryItem("url", url); - _q.addQueryItem("ts", QString("%1").arg(ts)); - return _q; -} - -QUrl GetUrlPreviewJob::makeRequestUrl(QUrl baseUrl, const QString& url, qint64 ts) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/preview_url", - queryToGetUrlPreview(url, ts)); -} - -GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, qint64 ts) - : BaseJob(HttpVerb::Get, "GetUrlPreviewJob", - basePath % "/preview_url", - queryToGetUrlPreview(url, ts)) - , d(new Private) -{ -} - -GetUrlPreviewJob::~GetUrlPreviewJob() = default; - -qint64 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<qint64>(json.value("matrix:image:size")); - d->ogImage = fromJson<QString>(json.value("og:image")); - return Success; -} - diff --git a/lib/jobs/generated/content-repo.h b/lib/jobs/generated/content-repo.h deleted file mode 100644 index e1e58f88..00000000 --- a/lib/jobs/generated/content-repo.h +++ /dev/null @@ -1,129 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QIODevice> - - -namespace QMatrixClient -{ - // Operations - - class UploadContentJob : public BaseJob - { - public: - explicit UploadContentJob(QIODevice* 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: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetContentJob. This function can be used when - * a URL for GetContentJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId); - - explicit GetContentJob(const QString& serverName, const QString& mediaId); - ~GetContentJob() override; - - const QString& contentType() const; - const QString& contentDisposition() const; - QIODevice* content() const; - - protected: - Status parseReply(QNetworkReply* reply) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class GetContentOverrideNameJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetContentOverrideNameJob. This function can be used when - * a URL for GetContentOverrideNameJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, const QString& fileName); - - explicit GetContentOverrideNameJob(const QString& serverName, const QString& mediaId, const QString& fileName); - ~GetContentOverrideNameJob() override; - - const QString& contentType() const; - const QString& contentDisposition() const; - QIODevice* content() const; - - protected: - Status parseReply(QNetworkReply* reply) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class GetContentThumbnailJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetContentThumbnailJob. This function can be used when - * a URL for GetContentThumbnailJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, int width = {}, int height = {}, const QString& method = {}); - - explicit GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width = {}, int height = {}, const QString& method = {}); - ~GetContentThumbnailJob() override; - - const QString& contentType() const; - QIODevice* content() const; - - protected: - Status parseReply(QNetworkReply* reply) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class GetUrlPreviewJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetUrlPreviewJob. This function can be used when - * a URL for GetUrlPreviewJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& url, qint64 ts = {}); - - explicit GetUrlPreviewJob(const QString& url, qint64 ts = {}); - ~GetUrlPreviewJob() override; - - qint64 matrixImageSize() const; - const QString& ogImage() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/create_room.cpp b/lib/jobs/generated/create_room.cpp deleted file mode 100644 index 6e582791..00000000 --- a/lib/jobs/generated/create_room.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/****************************************************************************** - * 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()(const QJsonValue& jv) - { - const auto& 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()(const QJsonValue& jv) - { - const auto& 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, bool guestCanJoin) - : 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)); - _data.insert("guest_can_join", toJson(guestCanJoin)); - 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/lib/jobs/generated/create_room.h b/lib/jobs/generated/create_room.h deleted file mode 100644 index b479615a..00000000 --- a/lib/jobs/generated/create_room.h +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QJsonObject> -#include <QtCore/QVector> - -#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 = {}, bool guestCanJoin = {}); - ~CreateRoomJob() override; - - const QString& roomId() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/directory.cpp b/lib/jobs/generated/directory.cpp deleted file mode 100644 index 6324a1f5..00000000 --- a/lib/jobs/generated/directory.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "directory.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0/directory"); - -SetRoomAliasJob::SetRoomAliasJob(const QString& roomAlias, const QString& roomId) - : BaseJob(HttpVerb::Put, "SetRoomAliasJob", - basePath % "/room/" % roomAlias) -{ - QJsonObject _data; - if (!roomId.isEmpty()) - _data.insert("room_id", toJson(roomId)); - setRequestData(_data); -} - -class GetRoomIdByAliasJob::Private -{ - public: - QString roomId; - QVector<QString> servers; -}; - -QUrl GetRoomIdByAliasJob::makeRequestUrl(QUrl baseUrl, const QString& roomAlias) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/room/" % roomAlias); -} - -GetRoomIdByAliasJob::GetRoomIdByAliasJob(const QString& roomAlias) - : BaseJob(HttpVerb::Get, "GetRoomIdByAliasJob", - basePath % "/room/" % roomAlias, false) - , d(new Private) -{ -} - -GetRoomIdByAliasJob::~GetRoomIdByAliasJob() = default; - -const QString& GetRoomIdByAliasJob::roomId() const -{ - return d->roomId; -} - -const QVector<QString>& GetRoomIdByAliasJob::servers() const -{ - return d->servers; -} - -BaseJob::Status GetRoomIdByAliasJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->roomId = fromJson<QString>(json.value("room_id")); - d->servers = fromJson<QVector<QString>>(json.value("servers")); - return Success; -} - -QUrl DeleteRoomAliasJob::makeRequestUrl(QUrl baseUrl, const QString& roomAlias) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/room/" % roomAlias); -} - -DeleteRoomAliasJob::DeleteRoomAliasJob(const QString& roomAlias) - : BaseJob(HttpVerb::Delete, "DeleteRoomAliasJob", - basePath % "/room/" % roomAlias) -{ -} - diff --git a/lib/jobs/generated/directory.h b/lib/jobs/generated/directory.h deleted file mode 100644 index 87591240..00000000 --- a/lib/jobs/generated/directory.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QVector> - - -namespace QMatrixClient -{ - // Operations - - class SetRoomAliasJob : public BaseJob - { - public: - explicit SetRoomAliasJob(const QString& roomAlias, const QString& roomId = {}); - }; - - class GetRoomIdByAliasJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetRoomIdByAliasJob. This function can be used when - * a URL for GetRoomIdByAliasJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias); - - explicit GetRoomIdByAliasJob(const QString& roomAlias); - ~GetRoomIdByAliasJob() override; - - const QString& roomId() const; - const QVector<QString>& servers() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class DeleteRoomAliasJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * DeleteRoomAliasJob. This function can be used when - * a URL for DeleteRoomAliasJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias); - - explicit DeleteRoomAliasJob(const QString& roomAlias); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/inviting.cpp b/lib/jobs/generated/inviting.cpp deleted file mode 100644 index d2ee2107..00000000 --- a/lib/jobs/generated/inviting.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "inviting.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -InviteUserJob::InviteUserJob(const QString& roomId, const QString& userId) - : BaseJob(HttpVerb::Post, "InviteUserJob", - basePath % "/rooms/" % roomId % "/invite") -{ - QJsonObject _data; - _data.insert("user_id", toJson(userId)); - setRequestData(_data); -} - diff --git a/lib/jobs/generated/inviting.h b/lib/jobs/generated/inviting.h deleted file mode 100644 index eaa884df..00000000 --- a/lib/jobs/generated/inviting.h +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class InviteUserJob : public BaseJob - { - public: - explicit InviteUserJob(const QString& roomId, const QString& userId); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/kicking.cpp b/lib/jobs/generated/kicking.cpp deleted file mode 100644 index bf2490b7..00000000 --- a/lib/jobs/generated/kicking.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "kicking.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -KickJob::KickJob(const QString& roomId, const QString& userId, const QString& reason) - : BaseJob(HttpVerb::Post, "KickJob", - basePath % "/rooms/" % roomId % "/kick") -{ - QJsonObject _data; - _data.insert("user_id", toJson(userId)); - if (!reason.isEmpty()) - _data.insert("reason", toJson(reason)); - setRequestData(_data); -} - diff --git a/lib/jobs/generated/kicking.h b/lib/jobs/generated/kicking.h deleted file mode 100644 index 3814bef7..00000000 --- a/lib/jobs/generated/kicking.h +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class KickJob : public BaseJob - { - public: - explicit KickJob(const QString& roomId, const QString& userId, const QString& reason = {}); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/leaving.cpp b/lib/jobs/generated/leaving.cpp deleted file mode 100644 index afc4adbd..00000000 --- a/lib/jobs/generated/leaving.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "leaving.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -QUrl LeaveRoomJob::makeRequestUrl(QUrl baseUrl, const QString& roomId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/rooms/" % roomId % "/leave"); -} - -LeaveRoomJob::LeaveRoomJob(const QString& roomId) - : BaseJob(HttpVerb::Post, "LeaveRoomJob", - basePath % "/rooms/" % roomId % "/leave") -{ -} - -QUrl ForgetRoomJob::makeRequestUrl(QUrl baseUrl, const QString& roomId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/rooms/" % roomId % "/forget"); -} - -ForgetRoomJob::ForgetRoomJob(const QString& roomId) - : BaseJob(HttpVerb::Post, "ForgetRoomJob", - basePath % "/rooms/" % roomId % "/forget") -{ -} - diff --git a/lib/jobs/generated/leaving.h b/lib/jobs/generated/leaving.h deleted file mode 100644 index 9bae2363..00000000 --- a/lib/jobs/generated/leaving.h +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class LeaveRoomJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * LeaveRoomJob. This function can be used when - * a URL for LeaveRoomJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - - explicit LeaveRoomJob(const QString& roomId); - }; - - class ForgetRoomJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * ForgetRoomJob. This function can be used when - * a URL for ForgetRoomJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - - explicit ForgetRoomJob(const QString& roomId); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/list_public_rooms.cpp b/lib/jobs/generated/list_public_rooms.cpp deleted file mode 100644 index 1e3c4ed8..00000000 --- a/lib/jobs/generated/list_public_rooms.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "list_public_rooms.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -GetPublicRoomsJob::PublicRoomsChunk::operator QJsonObject() const -{ - QJsonObject o; - o.insert("aliases", toJson(aliases)); - o.insert("canonical_alias", toJson(canonicalAlias)); - o.insert("name", toJson(name)); - o.insert("num_joined_members", toJson(numJoinedMembers)); - o.insert("room_id", toJson(roomId)); - o.insert("topic", toJson(topic)); - o.insert("world_readable", toJson(worldReadable)); - o.insert("guest_can_join", toJson(guestCanJoin)); - o.insert("avatar_url", toJson(avatarUrl)); - - return o; -} -namespace QMatrixClient -{ - template <> struct FromJson<GetPublicRoomsJob::PublicRoomsChunk> - { - GetPublicRoomsJob::PublicRoomsChunk operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - GetPublicRoomsJob::PublicRoomsChunk result; - result.aliases = - fromJson<QVector<QString>>(o.value("aliases")); - result.canonicalAlias = - fromJson<QString>(o.value("canonical_alias")); - result.name = - fromJson<QString>(o.value("name")); - result.numJoinedMembers = - fromJson<double>(o.value("num_joined_members")); - result.roomId = - fromJson<QString>(o.value("room_id")); - result.topic = - fromJson<QString>(o.value("topic")); - result.worldReadable = - fromJson<bool>(o.value("world_readable")); - result.guestCanJoin = - fromJson<bool>(o.value("guest_can_join")); - result.avatarUrl = - fromJson<QString>(o.value("avatar_url")); - - return result; - } - }; -} // namespace QMatrixClient - -class GetPublicRoomsJob::Private -{ - public: - QVector<PublicRoomsChunk> chunk; - QString nextBatch; - QString prevBatch; - double totalRoomCountEstimate; -}; - -BaseJob::Query queryToGetPublicRooms(double limit, const QString& since, const QString& server) -{ - BaseJob::Query _q; - _q.addQueryItem("limit", QString("%1").arg(limit)); - if (!since.isEmpty()) - _q.addQueryItem("since", since); - if (!server.isEmpty()) - _q.addQueryItem("server", server); - return _q; -} - -QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, double limit, const QString& since, const QString& server) -{ - return BaseJob::makeRequestUrl(baseUrl, - basePath % "/publicRooms", - queryToGetPublicRooms(limit, since, server)); -} - -GetPublicRoomsJob::GetPublicRoomsJob(double limit, const QString& since, const QString& server) - : BaseJob(HttpVerb::Get, "GetPublicRoomsJob", - basePath % "/publicRooms", - queryToGetPublicRooms(limit, since, server), - {}, false) - , d(new Private) -{ -} - -GetPublicRoomsJob::~GetPublicRoomsJob() = default; - -const QVector<GetPublicRoomsJob::PublicRoomsChunk>& GetPublicRoomsJob::chunk() const -{ - return d->chunk; -} - -const QString& GetPublicRoomsJob::nextBatch() const -{ - return d->nextBatch; -} - -const QString& GetPublicRoomsJob::prevBatch() const -{ - return d->prevBatch; -} - -double GetPublicRoomsJob::totalRoomCountEstimate() const -{ - return d->totalRoomCountEstimate; -} - -BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - if (!json.contains("chunk")) - return { JsonParseError, - "The key 'chunk' not found in the response" }; - d->chunk = fromJson<QVector<PublicRoomsChunk>>(json.value("chunk")); - d->nextBatch = fromJson<QString>(json.value("next_batch")); - d->prevBatch = fromJson<QString>(json.value("prev_batch")); - d->totalRoomCountEstimate = fromJson<double>(json.value("total_room_count_estimate")); - return Success; -} - -QueryPublicRoomsJob::Filter::operator QJsonObject() const -{ - QJsonObject o; - o.insert("generic_search_term", toJson(genericSearchTerm)); - - return o; -} -namespace QMatrixClient -{ - template <> struct FromJson<QueryPublicRoomsJob::Filter> - { - QueryPublicRoomsJob::Filter operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - QueryPublicRoomsJob::Filter result; - result.genericSearchTerm = - fromJson<QString>(o.value("generic_search_term")); - - return result; - } - }; -} // namespace QMatrixClient - -QueryPublicRoomsJob::PublicRoomsChunk::operator QJsonObject() const -{ - QJsonObject o; - o.insert("aliases", toJson(aliases)); - o.insert("canonical_alias", toJson(canonicalAlias)); - o.insert("name", toJson(name)); - o.insert("num_joined_members", toJson(numJoinedMembers)); - o.insert("room_id", toJson(roomId)); - o.insert("topic", toJson(topic)); - o.insert("world_readable", toJson(worldReadable)); - o.insert("guest_can_join", toJson(guestCanJoin)); - o.insert("avatar_url", toJson(avatarUrl)); - - return o; -} -namespace QMatrixClient -{ - template <> struct FromJson<QueryPublicRoomsJob::PublicRoomsChunk> - { - QueryPublicRoomsJob::PublicRoomsChunk operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - QueryPublicRoomsJob::PublicRoomsChunk result; - result.aliases = - fromJson<QVector<QString>>(o.value("aliases")); - result.canonicalAlias = - fromJson<QString>(o.value("canonical_alias")); - result.name = - fromJson<QString>(o.value("name")); - result.numJoinedMembers = - fromJson<double>(o.value("num_joined_members")); - result.roomId = - fromJson<QString>(o.value("room_id")); - result.topic = - fromJson<QString>(o.value("topic")); - result.worldReadable = - fromJson<bool>(o.value("world_readable")); - result.guestCanJoin = - fromJson<bool>(o.value("guest_can_join")); - result.avatarUrl = - fromJson<QString>(o.value("avatar_url")); - - return result; - } - }; -} // namespace QMatrixClient - -class QueryPublicRoomsJob::Private -{ - public: - QVector<PublicRoomsChunk> chunk; - QString nextBatch; - QString prevBatch; - double totalRoomCountEstimate; -}; - -BaseJob::Query queryToQueryPublicRooms(const QString& server) -{ - BaseJob::Query _q; - if (!server.isEmpty()) - _q.addQueryItem("server", server); - return _q; -} - -QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, double limit, const QString& since, const Filter& filter) - : BaseJob(HttpVerb::Post, "QueryPublicRoomsJob", - basePath % "/publicRooms", - queryToQueryPublicRooms(server)) - , d(new Private) -{ - QJsonObject _data; - _data.insert("limit", toJson(limit)); - if (!since.isEmpty()) - _data.insert("since", toJson(since)); - _data.insert("filter", toJson(filter)); - setRequestData(_data); -} - -QueryPublicRoomsJob::~QueryPublicRoomsJob() = default; - -const QVector<QueryPublicRoomsJob::PublicRoomsChunk>& QueryPublicRoomsJob::chunk() const -{ - return d->chunk; -} - -const QString& QueryPublicRoomsJob::nextBatch() const -{ - return d->nextBatch; -} - -const QString& QueryPublicRoomsJob::prevBatch() const -{ - return d->prevBatch; -} - -double QueryPublicRoomsJob::totalRoomCountEstimate() const -{ - return d->totalRoomCountEstimate; -} - -BaseJob::Status QueryPublicRoomsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - if (!json.contains("chunk")) - return { JsonParseError, - "The key 'chunk' not found in the response" }; - d->chunk = fromJson<QVector<PublicRoomsChunk>>(json.value("chunk")); - d->nextBatch = fromJson<QString>(json.value("next_batch")); - d->prevBatch = fromJson<QString>(json.value("prev_batch")); - d->totalRoomCountEstimate = fromJson<double>(json.value("total_room_count_estimate")); - return Success; -} - diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h deleted file mode 100644 index 5c281de3..00000000 --- a/lib/jobs/generated/list_public_rooms.h +++ /dev/null @@ -1,106 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QVector> - -#include "converters.h" - -namespace QMatrixClient -{ - // Operations - - class GetPublicRoomsJob : public BaseJob - { - public: - // Inner data structures - - struct PublicRoomsChunk - { - QVector<QString> aliases; - QString canonicalAlias; - QString name; - double numJoinedMembers; - QString roomId; - QString topic; - bool worldReadable; - bool guestCanJoin; - QString avatarUrl; - - operator QJsonObject() const; - }; - - // End of inner data structures - - /** Construct a URL out of baseUrl and usual parameters passed to - * GetPublicRoomsJob. This function can be used when - * a URL for GetPublicRoomsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, double limit = {}, const QString& since = {}, const QString& server = {}); - - explicit GetPublicRoomsJob(double limit = {}, const QString& since = {}, const QString& server = {}); - ~GetPublicRoomsJob() override; - - const QVector<PublicRoomsChunk>& chunk() const; - const QString& nextBatch() const; - const QString& prevBatch() const; - double totalRoomCountEstimate() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class QueryPublicRoomsJob : public BaseJob - { - public: - // Inner data structures - - struct Filter - { - QString genericSearchTerm; - - operator QJsonObject() const; - }; - - struct PublicRoomsChunk - { - QVector<QString> aliases; - QString canonicalAlias; - QString name; - double numJoinedMembers; - QString roomId; - QString topic; - bool worldReadable; - bool guestCanJoin; - QString avatarUrl; - - operator QJsonObject() const; - }; - - // End of inner data structures - - explicit QueryPublicRoomsJob(const QString& server = {}, double limit = {}, const QString& since = {}, const Filter& filter = {}); - ~QueryPublicRoomsJob() override; - - const QVector<PublicRoomsChunk>& chunk() const; - const QString& nextBatch() const; - const QString& prevBatch() const; - double totalRoomCountEstimate() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/login.cpp b/lib/jobs/generated/login.cpp deleted file mode 100644 index a4dab428..00000000 --- a/lib/jobs/generated/login.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "login.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class LoginJob::Private -{ - public: - QString userId; - QString accessToken; - QString homeServer; - QString deviceId; -}; - -LoginJob::LoginJob(const QString& type, const QString& user, const QString& medium, const QString& address, const QString& password, const QString& token, const QString& deviceId, const QString& initialDeviceDisplayName) - : BaseJob(HttpVerb::Post, "LoginJob", - basePath % "/login", false) - , d(new Private) -{ - QJsonObject _data; - _data.insert("type", toJson(type)); - if (!user.isEmpty()) - _data.insert("user", toJson(user)); - if (!medium.isEmpty()) - _data.insert("medium", toJson(medium)); - if (!address.isEmpty()) - _data.insert("address", toJson(address)); - if (!password.isEmpty()) - _data.insert("password", toJson(password)); - if (!token.isEmpty()) - _data.insert("token", toJson(token)); - if (!deviceId.isEmpty()) - _data.insert("device_id", toJson(deviceId)); - if (!initialDeviceDisplayName.isEmpty()) - _data.insert("initial_device_display_name", toJson(initialDeviceDisplayName)); - setRequestData(_data); -} - -LoginJob::~LoginJob() = default; - -const QString& LoginJob::userId() const -{ - return d->userId; -} - -const QString& LoginJob::accessToken() const -{ - return d->accessToken; -} - -const QString& LoginJob::homeServer() const -{ - return d->homeServer; -} - -const QString& LoginJob::deviceId() const -{ - return d->deviceId; -} - -BaseJob::Status LoginJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->userId = fromJson<QString>(json.value("user_id")); - d->accessToken = fromJson<QString>(json.value("access_token")); - d->homeServer = fromJson<QString>(json.value("home_server")); - d->deviceId = fromJson<QString>(json.value("device_id")); - return Success; -} - diff --git a/lib/jobs/generated/login.h b/lib/jobs/generated/login.h deleted file mode 100644 index 3ac955d4..00000000 --- a/lib/jobs/generated/login.h +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class LoginJob : public BaseJob - { - public: - explicit LoginJob(const QString& type, const QString& user = {}, const QString& medium = {}, const QString& address = {}, const QString& password = {}, const QString& token = {}, const QString& deviceId = {}, const QString& initialDeviceDisplayName = {}); - ~LoginJob() override; - - const QString& userId() const; - const QString& accessToken() const; - const QString& homeServer() const; - const QString& deviceId() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/logout.cpp b/lib/jobs/generated/logout.cpp deleted file mode 100644 index b943dcd3..00000000 --- a/lib/jobs/generated/logout.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "logout.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -QUrl LogoutJob::makeRequestUrl(QUrl baseUrl) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/logout"); -} - -LogoutJob::LogoutJob() - : BaseJob(HttpVerb::Post, "LogoutJob", - basePath % "/logout") -{ -} - diff --git a/lib/jobs/generated/logout.h b/lib/jobs/generated/logout.h deleted file mode 100644 index 7640ba55..00000000 --- a/lib/jobs/generated/logout.h +++ /dev/null @@ -1,27 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class LogoutJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * LogoutJob. This function can be used when - * a URL for LogoutJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); - - explicit LogoutJob(); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/notifications.cpp b/lib/jobs/generated/notifications.cpp deleted file mode 100644 index df6b10ba..00000000 --- a/lib/jobs/generated/notifications.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "notifications.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -namespace QMatrixClient -{ - template <> struct FromJson<GetNotificationsJob::Notification> - { - GetNotificationsJob::Notification operator()(const QJsonValue& jv) - { - const auto& o = jv.toObject(); - GetNotificationsJob::Notification result; - result.actions = - fromJson<QVector<QJsonObject>>(o.value("actions")); - result.event = - fromJson<EventPtr>(o.value("event")); - result.profileTag = - fromJson<QString>(o.value("profile_tag")); - result.read = - fromJson<bool>(o.value("read")); - result.roomId = - fromJson<QString>(o.value("room_id")); - result.ts = - fromJson<qint64>(o.value("ts")); - - return result; - } - }; -} // namespace QMatrixClient - -class GetNotificationsJob::Private -{ - public: - QString nextToken; - std::vector<Notification> notifications; -}; - -BaseJob::Query queryToGetNotifications(const QString& from, int limit, const QString& only) -{ - BaseJob::Query _q; - if (!from.isEmpty()) - _q.addQueryItem("from", from); - _q.addQueryItem("limit", QString("%1").arg(limit)); - if (!only.isEmpty()) - _q.addQueryItem("only", only); - return _q; -} - -QUrl GetNotificationsJob::makeRequestUrl(QUrl baseUrl, const QString& from, int limit, const QString& only) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/notifications", - queryToGetNotifications(from, limit, only)); -} - -GetNotificationsJob::GetNotificationsJob(const QString& from, int limit, const QString& only) - : BaseJob(HttpVerb::Get, "GetNotificationsJob", - basePath % "/notifications", - queryToGetNotifications(from, limit, only)) - , d(new Private) -{ -} - -GetNotificationsJob::~GetNotificationsJob() = default; - -const QString& GetNotificationsJob::nextToken() const -{ - return d->nextToken; -} - -const std::vector<GetNotificationsJob::Notification>& GetNotificationsJob::notifications() const -{ - return d->notifications; -} - -BaseJob::Status GetNotificationsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->nextToken = fromJson<QString>(json.value("next_token")); - if (!json.contains("notifications")) - return { JsonParseError, - "The key 'notifications' not found in the response" }; - d->notifications = fromJson<std::vector<Notification>>(json.value("notifications")); - return Success; -} - diff --git a/lib/jobs/generated/notifications.h b/lib/jobs/generated/notifications.h deleted file mode 100644 index 798b9576..00000000 --- a/lib/jobs/generated/notifications.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <vector> -#include "events/event.h" -#include <QtCore/QJsonObject> -#include <QtCore/QVector> - -#include "converters.h" - -namespace QMatrixClient -{ - // Operations - - class GetNotificationsJob : public BaseJob - { - public: - // Inner data structures - - struct Notification - { - QVector<QJsonObject> actions; - EventPtr event; - QString profileTag; - bool read; - QString roomId; - qint64 ts; - - }; - - // End of inner data structures - - /** Construct a URL out of baseUrl and usual parameters passed to - * GetNotificationsJob. This function can be used when - * a URL for GetNotificationsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, int limit = {}, const QString& only = {}); - - explicit GetNotificationsJob(const QString& from = {}, int limit = {}, const QString& only = {}); - ~GetNotificationsJob() override; - - const QString& nextToken() const; - const std::vector<Notification>& notifications() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/profile.cpp b/lib/jobs/generated/profile.cpp deleted file mode 100644 index d8ddbc14..00000000 --- a/lib/jobs/generated/profile.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "profile.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -SetDisplayNameJob::SetDisplayNameJob(const QString& userId, const QString& displayname) - : BaseJob(HttpVerb::Put, "SetDisplayNameJob", - basePath % "/profile/" % userId % "/displayname") -{ - QJsonObject _data; - if (!displayname.isEmpty()) - _data.insert("displayname", toJson(displayname)); - setRequestData(_data); -} - -class GetDisplayNameJob::Private -{ - public: - QString displayname; -}; - -QUrl GetDisplayNameJob::makeRequestUrl(QUrl baseUrl, const QString& userId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/profile/" % userId % "/displayname"); -} - -GetDisplayNameJob::GetDisplayNameJob(const QString& userId) - : BaseJob(HttpVerb::Get, "GetDisplayNameJob", - basePath % "/profile/" % userId % "/displayname", false) - , d(new Private) -{ -} - -GetDisplayNameJob::~GetDisplayNameJob() = default; - -const QString& GetDisplayNameJob::displayname() const -{ - return d->displayname; -} - -BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->displayname = fromJson<QString>(json.value("displayname")); - return Success; -} - -SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl) - : BaseJob(HttpVerb::Put, "SetAvatarUrlJob", - basePath % "/profile/" % userId % "/avatar_url") -{ - QJsonObject _data; - if (!avatarUrl.isEmpty()) - _data.insert("avatar_url", toJson(avatarUrl)); - setRequestData(_data); -} - -class GetAvatarUrlJob::Private -{ - public: - QString avatarUrl; -}; - -QUrl GetAvatarUrlJob::makeRequestUrl(QUrl baseUrl, const QString& userId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/profile/" % userId % "/avatar_url"); -} - -GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId) - : BaseJob(HttpVerb::Get, "GetAvatarUrlJob", - basePath % "/profile/" % userId % "/avatar_url", false) - , d(new Private) -{ -} - -GetAvatarUrlJob::~GetAvatarUrlJob() = default; - -const QString& GetAvatarUrlJob::avatarUrl() const -{ - return d->avatarUrl; -} - -BaseJob::Status GetAvatarUrlJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->avatarUrl = fromJson<QString>(json.value("avatar_url")); - return Success; -} - -class GetUserProfileJob::Private -{ - public: - QString avatarUrl; - QString displayname; -}; - -QUrl GetUserProfileJob::makeRequestUrl(QUrl baseUrl, const QString& userId) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/profile/" % userId); -} - -GetUserProfileJob::GetUserProfileJob(const QString& userId) - : BaseJob(HttpVerb::Get, "GetUserProfileJob", - basePath % "/profile/" % userId, false) - , d(new Private) -{ -} - -GetUserProfileJob::~GetUserProfileJob() = default; - -const QString& GetUserProfileJob::avatarUrl() const -{ - return d->avatarUrl; -} - -const QString& GetUserProfileJob::displayname() const -{ - return d->displayname; -} - -BaseJob::Status GetUserProfileJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->avatarUrl = fromJson<QString>(json.value("avatar_url")); - d->displayname = fromJson<QString>(json.value("displayname")); - return Success; -} - diff --git a/lib/jobs/generated/profile.h b/lib/jobs/generated/profile.h deleted file mode 100644 index 024130f5..00000000 --- a/lib/jobs/generated/profile.h +++ /dev/null @@ -1,96 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class SetDisplayNameJob : public BaseJob - { - public: - explicit SetDisplayNameJob(const QString& userId, const QString& displayname = {}); - }; - - class GetDisplayNameJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetDisplayNameJob. This function can be used when - * a URL for GetDisplayNameJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId); - - explicit GetDisplayNameJob(const QString& userId); - ~GetDisplayNameJob() override; - - const QString& displayname() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class SetAvatarUrlJob : public BaseJob - { - public: - explicit SetAvatarUrlJob(const QString& userId, const QString& avatarUrl = {}); - }; - - class GetAvatarUrlJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetAvatarUrlJob. This function can be used when - * a URL for GetAvatarUrlJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId); - - explicit GetAvatarUrlJob(const QString& userId); - ~GetAvatarUrlJob() override; - - const QString& avatarUrl() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - class GetUserProfileJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetUserProfileJob. This function can be used when - * a URL for GetUserProfileJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId); - - explicit GetUserProfileJob(const QString& userId); - ~GetUserProfileJob() override; - - const QString& avatarUrl() const; - const QString& displayname() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/receipts.cpp b/lib/jobs/generated/receipts.cpp deleted file mode 100644 index 83c38b6f..00000000 --- a/lib/jobs/generated/receipts.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "receipts.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -PostReceiptJob::PostReceiptJob(const QString& roomId, const QString& receiptType, const QString& eventId, const QJsonObject& receipt) - : BaseJob(HttpVerb::Post, "PostReceiptJob", - basePath % "/rooms/" % roomId % "/receipt/" % receiptType % "/" % eventId) -{ - setRequestData(Data(receipt)); -} - diff --git a/lib/jobs/generated/receipts.h b/lib/jobs/generated/receipts.h deleted file mode 100644 index 9eb7a489..00000000 --- a/lib/jobs/generated/receipts.h +++ /dev/null @@ -1,21 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QJsonObject> - - -namespace QMatrixClient -{ - // Operations - - class PostReceiptJob : public BaseJob - { - public: - explicit PostReceiptJob(const QString& roomId, const QString& receiptType, const QString& eventId, const QJsonObject& receipt = {}); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/redaction.cpp b/lib/jobs/generated/redaction.cpp deleted file mode 100644 index 0da35dfc..00000000 --- a/lib/jobs/generated/redaction.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "redaction.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class RedactEventJob::Private -{ - public: - QString eventId; -}; - -RedactEventJob::RedactEventJob(const QString& roomId, const QString& eventId, const QString& txnId, const QString& reason) - : BaseJob(HttpVerb::Put, "RedactEventJob", - basePath % "/rooms/" % roomId % "/redact/" % eventId % "/" % txnId) - , d(new Private) -{ - QJsonObject _data; - if (!reason.isEmpty()) - _data.insert("reason", toJson(reason)); - setRequestData(_data); -} - -RedactEventJob::~RedactEventJob() = default; - -const QString& RedactEventJob::eventId() const -{ - return d->eventId; -} - -BaseJob::Status RedactEventJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->eventId = fromJson<QString>(json.value("event_id")); - return Success; -} - diff --git a/lib/jobs/generated/redaction.h b/lib/jobs/generated/redaction.h deleted file mode 100644 index e3b3ff4f..00000000 --- a/lib/jobs/generated/redaction.h +++ /dev/null @@ -1,30 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class RedactEventJob : public BaseJob - { - public: - explicit RedactEventJob(const QString& roomId, const QString& eventId, const QString& txnId, const QString& reason = {}); - ~RedactEventJob() override; - - const QString& eventId() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/third_party_membership.cpp b/lib/jobs/generated/third_party_membership.cpp deleted file mode 100644 index b637d481..00000000 --- a/lib/jobs/generated/third_party_membership.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "third_party_membership.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -InviteBy3PIDJob::InviteBy3PIDJob(const QString& roomId, const QString& idServer, const QString& medium, const QString& address) - : BaseJob(HttpVerb::Post, "InviteBy3PIDJob", - basePath % "/rooms/" % roomId % "/invite") -{ - QJsonObject _data; - _data.insert("id_server", toJson(idServer)); - _data.insert("medium", toJson(medium)); - _data.insert("address", toJson(address)); - setRequestData(_data); -} - diff --git a/lib/jobs/generated/third_party_membership.h b/lib/jobs/generated/third_party_membership.h deleted file mode 100644 index c7b5214e..00000000 --- a/lib/jobs/generated/third_party_membership.h +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class InviteBy3PIDJob : public BaseJob - { - public: - explicit InviteBy3PIDJob(const QString& roomId, const QString& idServer, const QString& medium, const QString& address); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/typing.cpp b/lib/jobs/generated/typing.cpp deleted file mode 100644 index fa700290..00000000 --- a/lib/jobs/generated/typing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "typing.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -SetTypingJob::SetTypingJob(const QString& userId, const QString& roomId, bool typing, int timeout) - : BaseJob(HttpVerb::Put, "SetTypingJob", - basePath % "/rooms/" % roomId % "/typing/" % userId) -{ - QJsonObject _data; - _data.insert("typing", toJson(typing)); - _data.insert("timeout", toJson(timeout)); - setRequestData(_data); -} - diff --git a/lib/jobs/generated/typing.h b/lib/jobs/generated/typing.h deleted file mode 100644 index 0495ed0a..00000000 --- a/lib/jobs/generated/typing.h +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class SetTypingJob : public BaseJob - { - public: - explicit SetTypingJob(const QString& userId, const QString& roomId, bool typing, int timeout = {}); - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/versions.cpp b/lib/jobs/generated/versions.cpp deleted file mode 100644 index 3b03172c..00000000 --- a/lib/jobs/generated/versions.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "versions.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client"); - -class GetVersionsJob::Private -{ - public: - QVector<QString> versions; -}; - -QUrl GetVersionsJob::makeRequestUrl(QUrl baseUrl) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/versions"); -} - -GetVersionsJob::GetVersionsJob() - : BaseJob(HttpVerb::Get, "GetVersionsJob", - basePath % "/versions", false) - , d(new Private) -{ -} - -GetVersionsJob::~GetVersionsJob() = default; - -const QVector<QString>& GetVersionsJob::versions() const -{ - return d->versions; -} - -BaseJob::Status GetVersionsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->versions = fromJson<QVector<QString>>(json.value("versions")); - return Success; -} - diff --git a/lib/jobs/generated/versions.h b/lib/jobs/generated/versions.h deleted file mode 100644 index 18f6bb44..00000000 --- a/lib/jobs/generated/versions.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include <QtCore/QVector> - - -namespace QMatrixClient -{ - // Operations - - class GetVersionsJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetVersionsJob. This function can be used when - * a URL for GetVersionsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); - - explicit GetVersionsJob(); - ~GetVersionsJob() override; - - const QVector<QString>& versions() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient diff --git a/lib/jobs/generated/whoami.cpp b/lib/jobs/generated/whoami.cpp deleted file mode 100644 index 4c231b5f..00000000 --- a/lib/jobs/generated/whoami.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#include "whoami.h" - -#include "converters.h" - -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class GetTokenOwnerJob::Private -{ - public: - QString userId; -}; - -QUrl GetTokenOwnerJob::makeRequestUrl(QUrl baseUrl) -{ - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/account/whoami"); -} - -GetTokenOwnerJob::GetTokenOwnerJob() - : BaseJob(HttpVerb::Get, "GetTokenOwnerJob", - basePath % "/account/whoami") - , d(new Private) -{ -} - -GetTokenOwnerJob::~GetTokenOwnerJob() = default; - -const QString& GetTokenOwnerJob::userId() const -{ - return d->userId; -} - -BaseJob::Status GetTokenOwnerJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - if (!json.contains("user_id")) - return { JsonParseError, - "The key 'user_id' not found in the response" }; - d->userId = fromJson<QString>(json.value("user_id")); - return Success; -} - diff --git a/lib/jobs/generated/whoami.h b/lib/jobs/generated/whoami.h deleted file mode 100644 index 835232ee..00000000 --- a/lib/jobs/generated/whoami.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - - - -namespace QMatrixClient -{ - // Operations - - class GetTokenOwnerJob : public BaseJob - { - public: - /** Construct a URL out of baseUrl and usual parameters passed to - * GetTokenOwnerJob. This function can be used when - * a URL for GetTokenOwnerJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); - - explicit GetTokenOwnerJob(); - ~GetTokenOwnerJob() override; - - const QString& userId() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient |