diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 11:40:46 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 12:53:02 +0900 |
commit | b1dd0e7ea87842fb5ff9deb14beb3474136b06f3 (patch) | |
tree | 1d25030a5355f1e065cfa00272672c9b9cc07b46 | |
parent | 0c5a042104eaa6f8efb0dfc1c0eacca161d5787f (diff) | |
download | libquotient-b1dd0e7ea87842fb5ff9deb14beb3474136b06f3.tar.gz libquotient-b1dd0e7ea87842fb5ff9deb14beb3474136b06f3.zip |
New generated jobs for: room directory, 3PIDs, redactions, typing notifications and others
Closes #128 (the issue has the full list of jobs arriving herewith).
-rw-r--r-- | jobs/generated/administrative_contact.cpp | 119 | ||||
-rw-r--r-- | jobs/generated/administrative_contact.h | 70 | ||||
-rw-r--r-- | jobs/generated/directory.cpp | 71 | ||||
-rw-r--r-- | jobs/generated/directory.h | 46 | ||||
-rw-r--r-- | jobs/generated/list_public_rooms.cpp | 253 | ||||
-rw-r--r-- | jobs/generated/list_public_rooms.h | 101 | ||||
-rw-r--r-- | jobs/generated/receipts.cpp | 24 | ||||
-rw-r--r-- | jobs/generated/receipts.h | 23 | ||||
-rw-r--r-- | jobs/generated/redaction.cpp | 50 | ||||
-rw-r--r-- | jobs/generated/redaction.h | 32 | ||||
-rw-r--r-- | jobs/generated/third_party_membership.cpp | 28 | ||||
-rw-r--r-- | jobs/generated/third_party_membership.h | 22 | ||||
-rw-r--r-- | jobs/generated/typing.cpp | 27 | ||||
-rw-r--r-- | jobs/generated/typing.h | 22 | ||||
-rw-r--r-- | jobs/generated/versions.cpp | 45 | ||||
-rw-r--r-- | jobs/generated/versions.h | 33 | ||||
-rw-r--r-- | jobs/generated/whoami.cpp | 48 | ||||
-rw-r--r-- | jobs/generated/whoami.h | 32 |
18 files changed, 1046 insertions, 0 deletions
diff --git a/jobs/generated/administrative_contact.cpp b/jobs/generated/administrative_contact.cpp new file mode 100644 index 00000000..705c5d54 --- /dev/null +++ b/jobs/generated/administrative_contact.cpp @@ -0,0 +1,119 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#include "administrative_contact.h" + +#include "converters.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()(QJsonValue jv) + { + QJsonObject 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; +}; + +GetAccount3PIDsJob::GetAccount3PIDsJob() + : BaseJob(HttpVerb::Get, "GetAccount3PIDsJob", + basePath % "/account/3pid", + Query { } + ), d(new Private) +{ } + +GetAccount3PIDsJob::~GetAccount3PIDsJob() +{ + delete d; +} + +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()(QJsonValue jv) + { + QJsonObject 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", + Query { } + ) +{ + QJsonObject _data; + _data.insert("three_pid_creds", toJson(threePidCreds)); + _data.insert("bind", toJson(bind)); + setRequestData(_data); +} + +RequestTokenTo3PIDJob::RequestTokenTo3PIDJob() + : BaseJob(HttpVerb::Post, "RequestTokenTo3PIDJob", + basePath % "/account/3pid/email/requestToken", + Query { }, Data { }, false + ) +{ } + diff --git a/jobs/generated/administrative_contact.h b/jobs/generated/administrative_contact.h new file mode 100644 index 00000000..fa6beba9 --- /dev/null +++ b/jobs/generated/administrative_contact.h @@ -0,0 +1,70 @@ +/****************************************************************************** + * 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 + + explicit GetAccount3PIDsJob(); + ~GetAccount3PIDsJob() override; + + const QVector<ThirdPartyIdentifier>& threepids() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + 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: + explicit RequestTokenTo3PIDJob(); + }; +} // namespace QMatrixClient diff --git a/jobs/generated/directory.cpp b/jobs/generated/directory.cpp new file mode 100644 index 00000000..dcec75ac --- /dev/null +++ b/jobs/generated/directory.cpp @@ -0,0 +1,71 @@ +/****************************************************************************** + * 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, + Query { } + ) +{ + QJsonObject _data; + if (!roomId.isEmpty()) + _data.insert("room_id", toJson(roomId)); + setRequestData(_data); +} + +class GetRoomIdByAliasJob::Private +{ + public: + QString roomId; + QVector<QString> servers; +}; + +GetRoomIdByAliasJob::GetRoomIdByAliasJob(const QString& roomAlias) + : BaseJob(HttpVerb::Get, "GetRoomIdByAliasJob", + basePath % "/room/" % roomAlias, + Query { }, Data { }, false + ), d(new Private) +{ } + +GetRoomIdByAliasJob::~GetRoomIdByAliasJob() +{ + delete d; +} + +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; +} + +DeleteRoomAliasJob::DeleteRoomAliasJob(const QString& roomAlias) + : BaseJob(HttpVerb::Delete, "DeleteRoomAliasJob", + basePath % "/room/" % roomAlias, + Query { } + ) +{ } + diff --git a/jobs/generated/directory.h b/jobs/generated/directory.h new file mode 100644 index 00000000..1dd4e7ed --- /dev/null +++ b/jobs/generated/directory.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QVector> +#include <QtCore/QString> + + +namespace QMatrixClient +{ + // Operations + + class SetRoomAliasJob : public BaseJob + { + public: + explicit SetRoomAliasJob(const QString& roomAlias, const QString& roomId = {}); + }; + + class GetRoomIdByAliasJob : public BaseJob + { + public: + 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; + Private* d; + }; + + class DeleteRoomAliasJob : public BaseJob + { + public: + explicit DeleteRoomAliasJob(const QString& roomAlias); + }; +} // namespace QMatrixClient diff --git a/jobs/generated/list_public_rooms.cpp b/jobs/generated/list_public_rooms.cpp new file mode 100644 index 00000000..8a96966f --- /dev/null +++ b/jobs/generated/list_public_rooms.cpp @@ -0,0 +1,253 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#include "list_public_rooms.h" + +#include "converters.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()(QJsonValue jv) + { + QJsonObject 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; +}; + +GetPublicRoomsJob::GetPublicRoomsJob(double limit, const QString& since, const QString& server) + : BaseJob(HttpVerb::Get, "GetPublicRoomsJob", + basePath % "/publicRooms", + Query { + { "limit", toJson(limit).toString() }, + { "since", toJson(since).toString() }, + { "server", toJson(server).toString() } + }, Data { }, false + ), d(new Private) +{ } + +GetPublicRoomsJob::~GetPublicRoomsJob() +{ + delete d; +} + +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()(QJsonValue jv) + { + QJsonObject 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()(QJsonValue jv) + { + QJsonObject 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; +}; + +QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, double limit, const QString& since, const Filter& filter) + : BaseJob(HttpVerb::Post, "QueryPublicRoomsJob", + basePath % "/publicRooms", + Query { + { "server", toJson(server).toString() } + } + ), 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() +{ + delete d; +} + +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/jobs/generated/list_public_rooms.h b/jobs/generated/list_public_rooms.h new file mode 100644 index 00000000..74dd8626 --- /dev/null +++ b/jobs/generated/list_public_rooms.h @@ -0,0 +1,101 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QVector> +#include <QtCore/QString> + +#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 + + 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; + 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; + Private* d; + }; +} // namespace QMatrixClient diff --git a/jobs/generated/receipts.cpp b/jobs/generated/receipts.cpp new file mode 100644 index 00000000..2820b583 --- /dev/null +++ b/jobs/generated/receipts.cpp @@ -0,0 +1,24 @@ +/****************************************************************************** + * 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, + Query { } + ) +{ + setRequestData(Data(receipt)); +} + diff --git a/jobs/generated/receipts.h b/jobs/generated/receipts.h new file mode 100644 index 00000000..6f36d7fc --- /dev/null +++ b/jobs/generated/receipts.h @@ -0,0 +1,23 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QJsonObject> +#include <QtCore/QString> + + +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/jobs/generated/redaction.cpp b/jobs/generated/redaction.cpp new file mode 100644 index 00000000..a9b8ed7e --- /dev/null +++ b/jobs/generated/redaction.cpp @@ -0,0 +1,50 @@ +/****************************************************************************** + * 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, + Query { } + ), d(new Private) +{ + QJsonObject _data; + if (!reason.isEmpty()) + _data.insert("reason", toJson(reason)); + setRequestData(_data); +} + +RedactEventJob::~RedactEventJob() +{ + delete d; +} + +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/jobs/generated/redaction.h b/jobs/generated/redaction.h new file mode 100644 index 00000000..600e0daa --- /dev/null +++ b/jobs/generated/redaction.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QString> + + +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; + Private* d; + }; +} // namespace QMatrixClient diff --git a/jobs/generated/third_party_membership.cpp b/jobs/generated/third_party_membership.cpp new file mode 100644 index 00000000..7a2aa4f4 --- /dev/null +++ b/jobs/generated/third_party_membership.cpp @@ -0,0 +1,28 @@ +/****************************************************************************** + * 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", + Query { } + ) +{ + QJsonObject _data; + _data.insert("id_server", toJson(idServer)); + _data.insert("medium", toJson(medium)); + _data.insert("address", toJson(address)); + setRequestData(_data); +} + diff --git a/jobs/generated/third_party_membership.h b/jobs/generated/third_party_membership.h new file mode 100644 index 00000000..6c1193ed --- /dev/null +++ b/jobs/generated/third_party_membership.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QString> + + +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/jobs/generated/typing.cpp b/jobs/generated/typing.cpp new file mode 100644 index 00000000..44bbb131 --- /dev/null +++ b/jobs/generated/typing.cpp @@ -0,0 +1,27 @@ +/****************************************************************************** + * 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, + Query { } + ) +{ + QJsonObject _data; + _data.insert("typing", toJson(typing)); + _data.insert("timeout", toJson(timeout)); + setRequestData(_data); +} + diff --git a/jobs/generated/typing.h b/jobs/generated/typing.h new file mode 100644 index 00000000..e20bca1a --- /dev/null +++ b/jobs/generated/typing.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QString> + + +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/jobs/generated/versions.cpp b/jobs/generated/versions.cpp new file mode 100644 index 00000000..66b31290 --- /dev/null +++ b/jobs/generated/versions.cpp @@ -0,0 +1,45 @@ +/****************************************************************************** + * 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; +}; + +GetVersionsJob::GetVersionsJob() + : BaseJob(HttpVerb::Get, "GetVersionsJob", + basePath % "/versions", + Query { }, Data { }, false + ), d(new Private) +{ } + +GetVersionsJob::~GetVersionsJob() +{ + delete d; +} + +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/jobs/generated/versions.h b/jobs/generated/versions.h new file mode 100644 index 00000000..eab8cf9e --- /dev/null +++ b/jobs/generated/versions.h @@ -0,0 +1,33 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QString> +#include <QtCore/QVector> + + +namespace QMatrixClient +{ + // Operations + + class GetVersionsJob : public BaseJob + { + public: + explicit GetVersionsJob(); + ~GetVersionsJob() override; + + const QVector<QString>& versions() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + Private* d; + }; +} // namespace QMatrixClient diff --git a/jobs/generated/whoami.cpp b/jobs/generated/whoami.cpp new file mode 100644 index 00000000..dce091ec --- /dev/null +++ b/jobs/generated/whoami.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * 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; +}; + +GetTokenOwnerJob::GetTokenOwnerJob() + : BaseJob(HttpVerb::Get, "GetTokenOwnerJob", + basePath % "/account/whoami", + Query { } + ), d(new Private) +{ } + +GetTokenOwnerJob::~GetTokenOwnerJob() +{ + delete d; +} + +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/jobs/generated/whoami.h b/jobs/generated/whoami.h new file mode 100644 index 00000000..1b04f337 --- /dev/null +++ b/jobs/generated/whoami.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QString> + + +namespace QMatrixClient +{ + // Operations + + class GetTokenOwnerJob : public BaseJob + { + public: + explicit GetTokenOwnerJob(); + ~GetTokenOwnerJob() override; + + const QString& userId() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + Private* d; + }; +} // namespace QMatrixClient |