diff options
Diffstat (limited to 'lib/jobs/generated')
-rw-r--r-- | lib/jobs/generated/list_joined_rooms.cpp | 50 | ||||
-rw-r--r-- | lib/jobs/generated/list_joined_rooms.h | 38 | ||||
-rw-r--r-- | lib/jobs/generated/pusher.cpp | 153 | ||||
-rw-r--r-- | lib/jobs/generated/pusher.h | 81 | ||||
-rw-r--r-- | lib/jobs/generated/room_send.cpp | 42 | ||||
-rw-r--r-- | lib/jobs/generated/room_send.h | 31 | ||||
-rw-r--r-- | lib/jobs/generated/tags.cpp | 66 | ||||
-rw-r--r-- | lib/jobs/generated/tags.h | 57 | ||||
-rw-r--r-- | lib/jobs/generated/to_device.cpp | 23 | ||||
-rw-r--r-- | lib/jobs/generated/to_device.h | 21 | ||||
-rw-r--r-- | lib/jobs/generated/users.cpp | 85 | ||||
-rw-r--r-- | lib/jobs/generated/users.h | 46 |
12 files changed, 693 insertions, 0 deletions
diff --git a/lib/jobs/generated/list_joined_rooms.cpp b/lib/jobs/generated/list_joined_rooms.cpp new file mode 100644 index 00000000..f902f94c --- /dev/null +++ b/lib/jobs/generated/list_joined_rooms.cpp @@ -0,0 +1,50 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "list_joined_rooms.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class GetJoinedRoomsJob::Private +{ + public: + QVector<QString> joinedRooms; +}; + +QUrl GetJoinedRoomsJob::makeRequestUrl(QUrl baseUrl) +{ + return BaseJob::makeRequestUrl(baseUrl, + basePath % "/joined_rooms"); +} + +GetJoinedRoomsJob::GetJoinedRoomsJob() + : BaseJob(HttpVerb::Get, "GetJoinedRoomsJob", + basePath % "/joined_rooms") + , d(new Private) +{ +} + +GetJoinedRoomsJob::~GetJoinedRoomsJob() = default; + +const QVector<QString>& GetJoinedRoomsJob::joinedRooms() const +{ + return d->joinedRooms; +} + +BaseJob::Status GetJoinedRoomsJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + if (!json.contains("joined_rooms")) + return { JsonParseError, + "The key 'joined_rooms' not found in the response" }; + d->joinedRooms = fromJson<QVector<QString>>(json.value("joined_rooms")); + return Success; +} + diff --git a/lib/jobs/generated/list_joined_rooms.h b/lib/jobs/generated/list_joined_rooms.h new file mode 100644 index 00000000..768f5166 --- /dev/null +++ b/lib/jobs/generated/list_joined_rooms.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QVector> + + +namespace QMatrixClient +{ + // Operations + + class GetJoinedRoomsJob : public BaseJob + { + public: + /** Construct a URL out of baseUrl and usual parameters passed to + * GetJoinedRoomsJob. This function can be used when + * a URL for GetJoinedRoomsJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl); + + explicit GetJoinedRoomsJob(); + ~GetJoinedRoomsJob() override; + + const QVector<QString>& joinedRooms() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer<Private> d; + }; +} // namespace QMatrixClient diff --git a/lib/jobs/generated/pusher.cpp b/lib/jobs/generated/pusher.cpp new file mode 100644 index 00000000..4fddac45 --- /dev/null +++ b/lib/jobs/generated/pusher.cpp @@ -0,0 +1,153 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "pusher.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +GetPushersJob::PusherData::operator QJsonObject() const +{ + QJsonObject o; + o.insert("url", toJson(url)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<GetPushersJob::PusherData> + { + GetPushersJob::PusherData operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + GetPushersJob::PusherData result; + result.url = + fromJson<QString>(o.value("url")); + + return result; + } + }; +} // namespace QMatrixClient + +GetPushersJob::Pusher::operator QJsonObject() const +{ + QJsonObject o; + o.insert("pushkey", toJson(pushkey)); + o.insert("kind", toJson(kind)); + o.insert("app_id", toJson(appId)); + o.insert("app_display_name", toJson(appDisplayName)); + o.insert("device_display_name", toJson(deviceDisplayName)); + o.insert("profile_tag", toJson(profileTag)); + o.insert("lang", toJson(lang)); + o.insert("data", toJson(data)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<GetPushersJob::Pusher> + { + GetPushersJob::Pusher operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + GetPushersJob::Pusher result; + result.pushkey = + fromJson<QString>(o.value("pushkey")); + result.kind = + fromJson<QString>(o.value("kind")); + result.appId = + fromJson<QString>(o.value("app_id")); + result.appDisplayName = + fromJson<QString>(o.value("app_display_name")); + result.deviceDisplayName = + fromJson<QString>(o.value("device_display_name")); + result.profileTag = + fromJson<QString>(o.value("profile_tag")); + result.lang = + fromJson<QString>(o.value("lang")); + result.data = + fromJson<GetPushersJob::PusherData>(o.value("data")); + + return result; + } + }; +} // namespace QMatrixClient + +class GetPushersJob::Private +{ + public: + QVector<Pusher> pushers; +}; + +QUrl GetPushersJob::makeRequestUrl(QUrl baseUrl) +{ + return BaseJob::makeRequestUrl(baseUrl, + basePath % "/pushers"); +} + +GetPushersJob::GetPushersJob() + : BaseJob(HttpVerb::Get, "GetPushersJob", + basePath % "/pushers") + , d(new Private) +{ +} + +GetPushersJob::~GetPushersJob() = default; + +const QVector<GetPushersJob::Pusher>& GetPushersJob::pushers() const +{ + return d->pushers; +} + +BaseJob::Status GetPushersJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->pushers = fromJson<QVector<Pusher>>(json.value("pushers")); + return Success; +} + +PostPusherJob::PusherData::operator QJsonObject() const +{ + QJsonObject o; + o.insert("url", toJson(url)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<PostPusherJob::PusherData> + { + PostPusherJob::PusherData operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + PostPusherJob::PusherData result; + result.url = + fromJson<QString>(o.value("url")); + + return result; + } + }; +} // namespace QMatrixClient + +PostPusherJob::PostPusherJob(const QString& pushkey, const QString& kind, const QString& appId, const QString& appDisplayName, const QString& deviceDisplayName, const QString& lang, const PusherData& data, const QString& profileTag, bool append) + : BaseJob(HttpVerb::Post, "PostPusherJob", + basePath % "/pushers/set") +{ + QJsonObject _data; + _data.insert("pushkey", toJson(pushkey)); + _data.insert("kind", toJson(kind)); + _data.insert("app_id", toJson(appId)); + _data.insert("app_display_name", toJson(appDisplayName)); + _data.insert("device_display_name", toJson(deviceDisplayName)); + if (!profileTag.isEmpty()) + _data.insert("profile_tag", toJson(profileTag)); + _data.insert("lang", toJson(lang)); + _data.insert("data", toJson(data)); + _data.insert("append", toJson(append)); + setRequestData(_data); +} + diff --git a/lib/jobs/generated/pusher.h b/lib/jobs/generated/pusher.h new file mode 100644 index 00000000..36576996 --- /dev/null +++ b/lib/jobs/generated/pusher.h @@ -0,0 +1,81 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QVector> + +#include "converters.h" + +namespace QMatrixClient +{ + // Operations + + class GetPushersJob : public BaseJob + { + public: + // Inner data structures + + struct PusherData + { + QString url; + + operator QJsonObject() const; + }; + + struct Pusher + { + QString pushkey; + QString kind; + QString appId; + QString appDisplayName; + QString deviceDisplayName; + QString profileTag; + QString lang; + PusherData data; + + operator QJsonObject() const; + }; + + // End of inner data structures + + /** Construct a URL out of baseUrl and usual parameters passed to + * GetPushersJob. This function can be used when + * a URL for GetPushersJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl); + + explicit GetPushersJob(); + ~GetPushersJob() override; + + const QVector<Pusher>& pushers() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer<Private> d; + }; + + class PostPusherJob : public BaseJob + { + public: + // Inner data structures + + struct PusherData + { + QString url; + + operator QJsonObject() const; + }; + + // End of inner data structures + + explicit PostPusherJob(const QString& pushkey, const QString& kind, const QString& appId, const QString& appDisplayName, const QString& deviceDisplayName, const QString& lang, const PusherData& data, const QString& profileTag = {}, bool append = {}); + }; +} // namespace QMatrixClient diff --git a/lib/jobs/generated/room_send.cpp b/lib/jobs/generated/room_send.cpp new file mode 100644 index 00000000..c9a3280d --- /dev/null +++ b/lib/jobs/generated/room_send.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "room_send.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class SendMessageJob::Private +{ + public: + QString eventId; +}; + +SendMessageJob::SendMessageJob(const QString& roomId, const QString& eventType, const QString& txnId, const QJsonObject& body) + : BaseJob(HttpVerb::Put, "SendMessageJob", + basePath % "/rooms/" % roomId % "/send/" % eventType % "/" % txnId) + , d(new Private) +{ + setRequestData(Data(body)); +} + +SendMessageJob::~SendMessageJob() = default; + +const QString& SendMessageJob::eventId() const +{ + return d->eventId; +} + +BaseJob::Status SendMessageJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->eventId = fromJson<QString>(json.value("event_id")); + return Success; +} + diff --git a/lib/jobs/generated/room_send.h b/lib/jobs/generated/room_send.h new file mode 100644 index 00000000..d20ce523 --- /dev/null +++ b/lib/jobs/generated/room_send.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QJsonObject> + + +namespace QMatrixClient +{ + // Operations + + class SendMessageJob : public BaseJob + { + public: + explicit SendMessageJob(const QString& roomId, const QString& eventType, const QString& txnId, const QJsonObject& body = {}); + ~SendMessageJob() 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/tags.cpp b/lib/jobs/generated/tags.cpp new file mode 100644 index 00000000..dc4faf04 --- /dev/null +++ b/lib/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/lib/jobs/generated/tags.h b/lib/jobs/generated/tags.h new file mode 100644 index 00000000..7a375527 --- /dev/null +++ b/lib/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 diff --git a/lib/jobs/generated/to_device.cpp b/lib/jobs/generated/to_device.cpp new file mode 100644 index 00000000..cfb860c7 --- /dev/null +++ b/lib/jobs/generated/to_device.cpp @@ -0,0 +1,23 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "to_device.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +SendToDeviceJob::SendToDeviceJob(const QString& eventType, const QString& txnId, const QJsonObject& messages) + : BaseJob(HttpVerb::Put, "SendToDeviceJob", + basePath % "/sendToDevice/" % eventType % "/" % txnId) +{ + QJsonObject _data; + _data.insert("messages", toJson(messages)); + setRequestData(_data); +} + diff --git a/lib/jobs/generated/to_device.h b/lib/jobs/generated/to_device.h new file mode 100644 index 00000000..0de8fb0a --- /dev/null +++ b/lib/jobs/generated/to_device.h @@ -0,0 +1,21 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QJsonObject> + + +namespace QMatrixClient +{ + // Operations + + class SendToDeviceJob : public BaseJob + { + public: + explicit SendToDeviceJob(const QString& eventType, const QString& txnId, const QJsonObject& messages = {}); + }; +} // namespace QMatrixClient diff --git a/lib/jobs/generated/users.cpp b/lib/jobs/generated/users.cpp new file mode 100644 index 00000000..33da4b43 --- /dev/null +++ b/lib/jobs/generated/users.cpp @@ -0,0 +1,85 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "users.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +SearchUserDirectoryJob::User::operator QJsonObject() const +{ + QJsonObject o; + o.insert("user_id", toJson(userId)); + o.insert("display_name", toJson(displayName)); + o.insert("avatar_url", toJson(avatarUrl)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<SearchUserDirectoryJob::User> + { + SearchUserDirectoryJob::User operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + SearchUserDirectoryJob::User result; + result.userId = + fromJson<QString>(o.value("user_id")); + result.displayName = + fromJson<QString>(o.value("display_name")); + result.avatarUrl = + fromJson<QString>(o.value("avatar_url")); + + return result; + } + }; +} // namespace QMatrixClient + +class SearchUserDirectoryJob::Private +{ + public: + QVector<User> results; + bool limited; +}; + +SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm, double limit) + : BaseJob(HttpVerb::Post, "SearchUserDirectoryJob", + basePath % "/user_directory/search") + , d(new Private) +{ + QJsonObject _data; + _data.insert("search_term", toJson(searchTerm)); + _data.insert("limit", toJson(limit)); + setRequestData(_data); +} + +SearchUserDirectoryJob::~SearchUserDirectoryJob() = default; + +const QVector<SearchUserDirectoryJob::User>& SearchUserDirectoryJob::results() const +{ + return d->results; +} + +bool SearchUserDirectoryJob::limited() const +{ + return d->limited; +} + +BaseJob::Status SearchUserDirectoryJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + if (!json.contains("results")) + return { JsonParseError, + "The key 'results' not found in the response" }; + d->results = fromJson<QVector<User>>(json.value("results")); + if (!json.contains("limited")) + return { JsonParseError, + "The key 'limited' not found in the response" }; + d->limited = fromJson<bool>(json.value("limited")); + return Success; +} + diff --git a/lib/jobs/generated/users.h b/lib/jobs/generated/users.h new file mode 100644 index 00000000..7be250a5 --- /dev/null +++ b/lib/jobs/generated/users.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QVector> + +#include "converters.h" + +namespace QMatrixClient +{ + // Operations + + class SearchUserDirectoryJob : public BaseJob + { + public: + // Inner data structures + + struct User + { + QString userId; + QString displayName; + QString avatarUrl; + + operator QJsonObject() const; + }; + + // End of inner data structures + + explicit SearchUserDirectoryJob(const QString& searchTerm, double limit = {}); + ~SearchUserDirectoryJob() override; + + const QVector<User>& results() const; + bool limited() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer<Private> d; + }; +} // namespace QMatrixClient |