diff options
Diffstat (limited to 'jobs/generated')
-rw-r--r-- | jobs/generated/tags.cpp | 66 | ||||
-rw-r--r-- | jobs/generated/tags.h | 57 |
2 files changed, 123 insertions, 0 deletions
diff --git a/jobs/generated/tags.cpp b/jobs/generated/tags.cpp new file mode 100644 index 00000000..dc4faf04 --- /dev/null +++ b/jobs/generated/tags.cpp @@ -0,0 +1,66 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "tags.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class GetRoomTagsJob::Private +{ + public: + QJsonObject tags; +}; + +QUrl GetRoomTagsJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId) +{ + return BaseJob::makeRequestUrl(baseUrl, + basePath % "/user/" % userId % "/rooms/" % roomId % "/tags"); +} + +GetRoomTagsJob::GetRoomTagsJob(const QString& userId, const QString& roomId) + : BaseJob(HttpVerb::Get, "GetRoomTagsJob", + basePath % "/user/" % userId % "/rooms/" % roomId % "/tags") + , d(new Private) +{ +} + +GetRoomTagsJob::~GetRoomTagsJob() = default; + +const QJsonObject& GetRoomTagsJob::tags() const +{ + return d->tags; +} + +BaseJob::Status GetRoomTagsJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->tags = fromJson<QJsonObject>(json.value("tags")); + return Success; +} + +SetRoomTagJob::SetRoomTagJob(const QString& userId, const QString& roomId, const QString& tag, const QJsonObject& body) + : BaseJob(HttpVerb::Put, "SetRoomTagJob", + basePath % "/user/" % userId % "/rooms/" % roomId % "/tags/" % tag) +{ + setRequestData(Data(body)); +} + +QUrl DeleteRoomTagJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId, const QString& tag) +{ + return BaseJob::makeRequestUrl(baseUrl, + basePath % "/user/" % userId % "/rooms/" % roomId % "/tags/" % tag); +} + +DeleteRoomTagJob::DeleteRoomTagJob(const QString& userId, const QString& roomId, const QString& tag) + : BaseJob(HttpVerb::Delete, "DeleteRoomTagJob", + basePath % "/user/" % userId % "/rooms/" % roomId % "/tags/" % tag) +{ +} + diff --git a/jobs/generated/tags.h b/jobs/generated/tags.h new file mode 100644 index 00000000..7a375527 --- /dev/null +++ b/jobs/generated/tags.h @@ -0,0 +1,57 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QJsonObject> + + +namespace QMatrixClient +{ + // Operations + + class GetRoomTagsJob : public BaseJob + { + public: + /** Construct a URL out of baseUrl and usual parameters passed to + * GetRoomTagsJob. This function can be used when + * a URL for GetRoomTagsJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId); + + explicit GetRoomTagsJob(const QString& userId, const QString& roomId); + ~GetRoomTagsJob() override; + + const QJsonObject& tags() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer<Private> d; + }; + + class SetRoomTagJob : public BaseJob + { + public: + explicit SetRoomTagJob(const QString& userId, const QString& roomId, const QString& tag, const QJsonObject& body = {}); + }; + + class DeleteRoomTagJob : public BaseJob + { + public: + /** Construct a URL out of baseUrl and usual parameters passed to + * DeleteRoomTagJob. This function can be used when + * a URL for DeleteRoomTagJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId, const QString& tag); + + explicit DeleteRoomTagJob(const QString& userId, const QString& roomId, const QString& tag); + }; +} // namespace QMatrixClient |