From b1dd0e7ea87842fb5ff9deb14beb3474136b06f3 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 7 Dec 2017 11:40:46 +0900 Subject: New generated jobs for: room directory, 3PIDs, redactions, typing notifications and others Closes #128 (the issue has the full list of jobs arriving herewith). --- jobs/generated/administrative_contact.cpp | 119 ++++++++++++++ jobs/generated/administrative_contact.h | 70 +++++++++ jobs/generated/directory.cpp | 71 +++++++++ jobs/generated/directory.h | 46 ++++++ jobs/generated/list_public_rooms.cpp | 253 ++++++++++++++++++++++++++++++ jobs/generated/list_public_rooms.h | 101 ++++++++++++ jobs/generated/receipts.cpp | 24 +++ jobs/generated/receipts.h | 23 +++ jobs/generated/redaction.cpp | 50 ++++++ jobs/generated/redaction.h | 32 ++++ jobs/generated/third_party_membership.cpp | 28 ++++ jobs/generated/third_party_membership.h | 22 +++ jobs/generated/typing.cpp | 27 ++++ jobs/generated/typing.h | 22 +++ jobs/generated/versions.cpp | 45 ++++++ jobs/generated/versions.h | 33 ++++ jobs/generated/whoami.cpp | 48 ++++++ jobs/generated/whoami.h | 32 ++++ 18 files changed, 1046 insertions(+) create mode 100644 jobs/generated/administrative_contact.cpp create mode 100644 jobs/generated/administrative_contact.h create mode 100644 jobs/generated/directory.cpp create mode 100644 jobs/generated/directory.h create mode 100644 jobs/generated/list_public_rooms.cpp create mode 100644 jobs/generated/list_public_rooms.h create mode 100644 jobs/generated/receipts.cpp create mode 100644 jobs/generated/receipts.h create mode 100644 jobs/generated/redaction.cpp create mode 100644 jobs/generated/redaction.h create mode 100644 jobs/generated/third_party_membership.cpp create mode 100644 jobs/generated/third_party_membership.h create mode 100644 jobs/generated/typing.cpp create mode 100644 jobs/generated/typing.h create mode 100644 jobs/generated/versions.cpp create mode 100644 jobs/generated/versions.h create mode 100644 jobs/generated/whoami.cpp create mode 100644 jobs/generated/whoami.h (limited to 'jobs/generated') 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 + +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 operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + GetAccount3PIDsJob::ThirdPartyIdentifier result; + result.medium = + fromJson(o.value("medium")); + result.address = + fromJson(o.value("address")); + + return result; + } + }; +} // namespace QMatrixClient + +class GetAccount3PIDsJob::Private +{ + public: + QVector threepids; +}; + +GetAccount3PIDsJob::GetAccount3PIDsJob() + : BaseJob(HttpVerb::Get, "GetAccount3PIDsJob", + basePath % "/account/3pid", + Query { } + ), d(new Private) +{ } + +GetAccount3PIDsJob::~GetAccount3PIDsJob() +{ + delete d; +} + +const QVector& GetAccount3PIDsJob::threepids() const +{ + return d->threepids; +} + +BaseJob::Status GetAccount3PIDsJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->threepids = fromJson>(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 operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + Post3PIDsJob::ThreePidCredentials result; + result.clientSecret = + fromJson(o.value("client_secret")); + result.idServer = + fromJson(o.value("id_server")); + result.sid = + fromJson(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 + +#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& 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 + +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 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& GetRoomIdByAliasJob::servers() const +{ + return d->servers; +} + +BaseJob::Status GetRoomIdByAliasJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->roomId = fromJson(json.value("room_id")); + d->servers = fromJson>(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 +#include + + +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& 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 + +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 operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + GetPublicRoomsJob::PublicRoomsChunk result; + result.aliases = + fromJson>(o.value("aliases")); + result.canonicalAlias = + fromJson(o.value("canonical_alias")); + result.name = + fromJson(o.value("name")); + result.numJoinedMembers = + fromJson(o.value("num_joined_members")); + result.roomId = + fromJson(o.value("room_id")); + result.topic = + fromJson(o.value("topic")); + result.worldReadable = + fromJson(o.value("world_readable")); + result.guestCanJoin = + fromJson(o.value("guest_can_join")); + result.avatarUrl = + fromJson(o.value("avatar_url")); + + return result; + } + }; +} // namespace QMatrixClient + +class GetPublicRoomsJob::Private +{ + public: + QVector 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::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>(json.value("chunk")); + d->nextBatch = fromJson(json.value("next_batch")); + d->prevBatch = fromJson(json.value("prev_batch")); + d->totalRoomCountEstimate = fromJson(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 operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + QueryPublicRoomsJob::Filter result; + result.genericSearchTerm = + fromJson(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 operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + QueryPublicRoomsJob::PublicRoomsChunk result; + result.aliases = + fromJson>(o.value("aliases")); + result.canonicalAlias = + fromJson(o.value("canonical_alias")); + result.name = + fromJson(o.value("name")); + result.numJoinedMembers = + fromJson(o.value("num_joined_members")); + result.roomId = + fromJson(o.value("room_id")); + result.topic = + fromJson(o.value("topic")); + result.worldReadable = + fromJson(o.value("world_readable")); + result.guestCanJoin = + fromJson(o.value("guest_can_join")); + result.avatarUrl = + fromJson(o.value("avatar_url")); + + return result; + } + }; +} // namespace QMatrixClient + +class QueryPublicRoomsJob::Private +{ + public: + QVector 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::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>(json.value("chunk")); + d->nextBatch = fromJson(json.value("next_batch")); + d->prevBatch = fromJson(json.value("prev_batch")); + d->totalRoomCountEstimate = fromJson(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 +#include + +#include "converters.h" + +namespace QMatrixClient +{ + // Operations + + class GetPublicRoomsJob : public BaseJob + { + public: + // Inner data structures + + struct PublicRoomsChunk + { + QVector 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& 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 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& 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 + +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 +#include + + +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 + +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(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 + + +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 + +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 + + +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 + +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 + + +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 + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client"); + +class GetVersionsJob::Private +{ + public: + QVector versions; +}; + +GetVersionsJob::GetVersionsJob() + : BaseJob(HttpVerb::Get, "GetVersionsJob", + basePath % "/versions", + Query { }, Data { }, false + ), d(new Private) +{ } + +GetVersionsJob::~GetVersionsJob() +{ + delete d; +} + +const QVector& GetVersionsJob::versions() const +{ + return d->versions; +} + +BaseJob::Status GetVersionsJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->versions = fromJson>(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 +#include + + +namespace QMatrixClient +{ + // Operations + + class GetVersionsJob : public BaseJob + { + public: + explicit GetVersionsJob(); + ~GetVersionsJob() override; + + const QVector& 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 + +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(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 + + +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 -- cgit v1.2.3