diff options
Diffstat (limited to 'lib/jobs')
-rw-r--r-- | lib/jobs/generated/administrative_contact.cpp | 32 | ||||
-rw-r--r-- | lib/jobs/generated/administrative_contact.h | 2 | ||||
-rw-r--r-- | lib/jobs/generated/create_room.cpp | 43 | ||||
-rw-r--r-- | lib/jobs/generated/create_room.h | 2 | ||||
-rw-r--r-- | lib/jobs/generated/list_public_rooms.cpp | 54 | ||||
-rw-r--r-- | lib/jobs/generated/list_public_rooms.h | 3 | ||||
-rw-r--r-- | lib/jobs/generated/notifications.cpp | 8 | ||||
-rw-r--r-- | lib/jobs/generated/notifications.h | 4 | ||||
-rw-r--r-- | lib/jobs/generated/pusher.cpp | 47 | ||||
-rw-r--r-- | lib/jobs/generated/pusher.h | 3 | ||||
-rw-r--r-- | lib/jobs/generated/users.cpp | 12 | ||||
-rw-r--r-- | lib/jobs/generated/users.h | 1 |
12 files changed, 28 insertions, 183 deletions
diff --git a/lib/jobs/generated/administrative_contact.cpp b/lib/jobs/generated/administrative_contact.cpp index b003c92d..ec7c77c3 100644 --- a/lib/jobs/generated/administrative_contact.cpp +++ b/lib/jobs/generated/administrative_contact.cpp @@ -12,14 +12,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { - QJsonObject toJson(const GetAccount3PIDsJob::ThirdPartyIdentifier& pod) - { - QJsonObject o; - o.insert("medium", toJson(pod.medium)); - o.insert("address", toJson(pod.address)); - - return o; - } + // Converters template <> struct FromJson<GetAccount3PIDsJob::ThirdPartyIdentifier> { @@ -31,7 +24,7 @@ namespace QMatrixClient fromJson<QString>(o.value("medium")); result.address = fromJson<QString>(o.value("address")); - + return result; } }; @@ -72,32 +65,17 @@ BaseJob::Status GetAccount3PIDsJob::parseJson(const QJsonDocument& data) namespace QMatrixClient { + // Converters + QJsonObject toJson(const Post3PIDsJob::ThreePidCredentials& pod) { QJsonObject o; o.insert("client_secret", toJson(pod.clientSecret)); o.insert("id_server", toJson(pod.idServer)); o.insert("sid", toJson(pod.sid)); - + return o; } - - 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) diff --git a/lib/jobs/generated/administrative_contact.h b/lib/jobs/generated/administrative_contact.h index bd70f07b..9cb09a3c 100644 --- a/lib/jobs/generated/administrative_contact.h +++ b/lib/jobs/generated/administrative_contact.h @@ -23,7 +23,6 @@ namespace QMatrixClient { QString medium; QString address; - }; // End of inner data structures @@ -58,7 +57,6 @@ namespace QMatrixClient QString clientSecret; QString idServer; QString sid; - }; // End of inner data structures diff --git a/lib/jobs/generated/create_room.cpp b/lib/jobs/generated/create_room.cpp index 4fc75974..a417c2b1 100644 --- a/lib/jobs/generated/create_room.cpp +++ b/lib/jobs/generated/create_room.cpp @@ -12,62 +12,27 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { + // Converters + QJsonObject toJson(const CreateRoomJob::Invite3pid& pod) { QJsonObject o; o.insert("id_server", toJson(pod.idServer)); o.insert("medium", toJson(pod.medium)); o.insert("address", toJson(pod.address)); - + return o; } - 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 - -namespace QMatrixClient -{ QJsonObject toJson(const CreateRoomJob::StateEvent& pod) { QJsonObject o; o.insert("type", toJson(pod.type)); o.insert("state_key", toJson(pod.stateKey)); o.insert("content", toJson(pod.content)); - + return o; } - - 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 diff --git a/lib/jobs/generated/create_room.h b/lib/jobs/generated/create_room.h index fdb11ada..526463b0 100644 --- a/lib/jobs/generated/create_room.h +++ b/lib/jobs/generated/create_room.h @@ -25,7 +25,6 @@ namespace QMatrixClient QString idServer; QString medium; QString address; - }; struct StateEvent @@ -33,7 +32,6 @@ namespace QMatrixClient QString type; QString stateKey; QJsonObject content; - }; // End of inner data structures diff --git a/lib/jobs/generated/list_public_rooms.cpp b/lib/jobs/generated/list_public_rooms.cpp index 9b4174cb..03664def 100644 --- a/lib/jobs/generated/list_public_rooms.cpp +++ b/lib/jobs/generated/list_public_rooms.cpp @@ -55,21 +55,7 @@ SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob(const QString& namespace QMatrixClient { - QJsonObject toJson(const GetPublicRoomsJob::PublicRoomsChunk& pod) - { - QJsonObject o; - o.insert("aliases", toJson(pod.aliases)); - o.insert("canonical_alias", toJson(pod.canonicalAlias)); - o.insert("name", toJson(pod.name)); - o.insert("num_joined_members", toJson(pod.numJoinedMembers)); - o.insert("room_id", toJson(pod.roomId)); - o.insert("topic", toJson(pod.topic)); - o.insert("world_readable", toJson(pod.worldReadable)); - o.insert("guest_can_join", toJson(pod.guestCanJoin)); - o.insert("avatar_url", toJson(pod.avatarUrl)); - - return o; - } + // Converters template <> struct FromJson<GetPublicRoomsJob::PublicRoomsChunk> { @@ -95,7 +81,7 @@ namespace QMatrixClient fromJson<bool>(o.value("guest_can_join")); result.avatarUrl = fromJson<QString>(o.value("avatar_url")); - + return result; } }; @@ -174,43 +160,13 @@ BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) namespace QMatrixClient { + // Converters + QJsonObject toJson(const QueryPublicRoomsJob::Filter& pod) { QJsonObject o; o.insert("generic_search_term", toJson(pod.genericSearchTerm)); - - return o; - } - 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 - -namespace QMatrixClient -{ - QJsonObject toJson(const QueryPublicRoomsJob::PublicRoomsChunk& pod) - { - QJsonObject o; - o.insert("aliases", toJson(pod.aliases)); - o.insert("canonical_alias", toJson(pod.canonicalAlias)); - o.insert("name", toJson(pod.name)); - o.insert("num_joined_members", toJson(pod.numJoinedMembers)); - o.insert("room_id", toJson(pod.roomId)); - o.insert("topic", toJson(pod.topic)); - o.insert("world_readable", toJson(pod.worldReadable)); - o.insert("guest_can_join", toJson(pod.guestCanJoin)); - o.insert("avatar_url", toJson(pod.avatarUrl)); - return o; } @@ -238,7 +194,7 @@ namespace QMatrixClient fromJson<bool>(o.value("guest_can_join")); result.avatarUrl = fromJson<QString>(o.value("avatar_url")); - + return result; } }; diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index 1e44e8b2..8e8fddca 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -59,7 +59,6 @@ namespace QMatrixClient bool worldReadable; bool guestCanJoin; QString avatarUrl; - }; // End of inner data structures @@ -95,7 +94,6 @@ namespace QMatrixClient struct Filter { QString genericSearchTerm; - }; struct PublicRoomsChunk @@ -109,7 +107,6 @@ namespace QMatrixClient bool worldReadable; bool guestCanJoin; QString avatarUrl; - }; // End of inner data structures diff --git a/lib/jobs/generated/notifications.cpp b/lib/jobs/generated/notifications.cpp index df6b10ba..04ad0175 100644 --- a/lib/jobs/generated/notifications.cpp +++ b/lib/jobs/generated/notifications.cpp @@ -12,6 +12,8 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { + // Converters + template <> struct FromJson<GetNotificationsJob::Notification> { GetNotificationsJob::Notification operator()(const QJsonValue& jv) @@ -30,7 +32,7 @@ namespace QMatrixClient fromJson<QString>(o.value("room_id")); result.ts = fromJson<qint64>(o.value("ts")); - + return result; } }; @@ -76,9 +78,9 @@ const QString& GetNotificationsJob::nextToken() const return d->nextToken; } -const std::vector<GetNotificationsJob::Notification>& GetNotificationsJob::notifications() const +std::vector<GetNotificationsJob::Notification>&& GetNotificationsJob::notifications() { - return d->notifications; + return std::move(d->notifications); } BaseJob::Status GetNotificationsJob::parseJson(const QJsonDocument& data) diff --git a/lib/jobs/generated/notifications.h b/lib/jobs/generated/notifications.h index 798b9576..d66e15be 100644 --- a/lib/jobs/generated/notifications.h +++ b/lib/jobs/generated/notifications.h @@ -6,7 +6,6 @@ #include "../basejob.h" -#include <vector> #include "events/event.h" #include <QtCore/QJsonObject> #include <QtCore/QVector> @@ -30,7 +29,6 @@ namespace QMatrixClient bool read; QString roomId; qint64 ts; - }; // End of inner data structures @@ -46,7 +44,7 @@ namespace QMatrixClient ~GetNotificationsJob() override; const QString& nextToken() const; - const std::vector<Notification>& notifications() const; + std::vector<Notification>&& notifications(); protected: Status parseJson(const QJsonDocument& data) override; diff --git a/lib/jobs/generated/pusher.cpp b/lib/jobs/generated/pusher.cpp index 7d5e80d1..dea7cf8b 100644 --- a/lib/jobs/generated/pusher.cpp +++ b/lib/jobs/generated/pusher.cpp @@ -12,13 +12,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { - QJsonObject toJson(const GetPushersJob::PusherData& pod) - { - QJsonObject o; - o.insert("url", toJson(pod.url)); - - return o; - } + // Converters template <> struct FromJson<GetPushersJob::PusherData> { @@ -28,28 +22,10 @@ namespace QMatrixClient GetPushersJob::PusherData result; result.url = fromJson<QString>(o.value("url")); - + return result; } }; -} // namespace QMatrixClient - -namespace QMatrixClient -{ - QJsonObject toJson(const GetPushersJob::Pusher& pod) - { - QJsonObject o; - o.insert("pushkey", toJson(pod.pushkey)); - o.insert("kind", toJson(pod.kind)); - o.insert("app_id", toJson(pod.appId)); - o.insert("app_display_name", toJson(pod.appDisplayName)); - o.insert("device_display_name", toJson(pod.deviceDisplayName)); - o.insert("profile_tag", toJson(pod.profileTag)); - o.insert("lang", toJson(pod.lang)); - o.insert("data", toJson(pod.data)); - - return o; - } template <> struct FromJson<GetPushersJob::Pusher> { @@ -73,7 +49,7 @@ namespace QMatrixClient fromJson<QString>(o.value("lang")); result.data = fromJson<GetPushersJob::PusherData>(o.value("data")); - + return result; } }; @@ -114,26 +90,15 @@ BaseJob::Status GetPushersJob::parseJson(const QJsonDocument& data) namespace QMatrixClient { + // Converters + QJsonObject toJson(const PostPusherJob::PusherData& pod) { QJsonObject o; o.insert("url", toJson(pod.url)); - + return o; } - - template <> struct FromJson<PostPusherJob::PusherData> - { - PostPusherJob::PusherData operator()(const QJsonValue& jv) - { - const auto& 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) diff --git a/lib/jobs/generated/pusher.h b/lib/jobs/generated/pusher.h index 23cd3fb6..06a2c832 100644 --- a/lib/jobs/generated/pusher.h +++ b/lib/jobs/generated/pusher.h @@ -22,7 +22,6 @@ namespace QMatrixClient struct PusherData { QString url; - }; struct Pusher @@ -35,7 +34,6 @@ namespace QMatrixClient QString profileTag; QString lang; PusherData data; - }; // End of inner data structures @@ -68,7 +66,6 @@ namespace QMatrixClient struct PusherData { QString url; - }; // End of inner data structures diff --git a/lib/jobs/generated/users.cpp b/lib/jobs/generated/users.cpp index f82a2a64..fd2944e4 100644 --- a/lib/jobs/generated/users.cpp +++ b/lib/jobs/generated/users.cpp @@ -12,15 +12,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { - QJsonObject toJson(const SearchUserDirectoryJob::User& pod) - { - QJsonObject o; - o.insert("user_id", toJson(pod.userId)); - o.insert("display_name", toJson(pod.displayName)); - o.insert("avatar_url", toJson(pod.avatarUrl)); - - return o; - } + // Converters template <> struct FromJson<SearchUserDirectoryJob::User> { @@ -34,7 +26,7 @@ namespace QMatrixClient fromJson<QString>(o.value("display_name")); result.avatarUrl = fromJson<QString>(o.value("avatar_url")); - + return result; } }; diff --git a/lib/jobs/generated/users.h b/lib/jobs/generated/users.h index bfa688c8..50b8b648 100644 --- a/lib/jobs/generated/users.h +++ b/lib/jobs/generated/users.h @@ -24,7 +24,6 @@ namespace QMatrixClient QString userId; QString displayName; QString avatarUrl; - }; // End of inner data structures |