aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/jobs/generated/account-data.cpp4
-rw-r--r--lib/jobs/generated/administrative_contact.cpp36
-rw-r--r--lib/jobs/generated/administrative_contact.h2
-rw-r--r--lib/jobs/generated/create_room.cpp38
-rw-r--r--lib/jobs/generated/create_room.h2
-rw-r--r--lib/jobs/generated/list_public_rooms.cpp116
-rw-r--r--lib/jobs/generated/list_public_rooms.h32
-rw-r--r--lib/jobs/generated/pusher.cpp59
-rw-r--r--lib/jobs/generated/pusher.h3
-rw-r--r--lib/jobs/generated/receipts.cpp2
-rw-r--r--lib/jobs/generated/room_send.cpp2
-rw-r--r--lib/jobs/generated/tags.cpp2
-rw-r--r--lib/jobs/generated/users.cpp19
-rw-r--r--lib/jobs/generated/users.h1
14 files changed, 195 insertions, 123 deletions
diff --git a/lib/jobs/generated/account-data.cpp b/lib/jobs/generated/account-data.cpp
index 35ee94c0..ac45cb85 100644
--- a/lib/jobs/generated/account-data.cpp
+++ b/lib/jobs/generated/account-data.cpp
@@ -16,13 +16,13 @@ SetAccountDataJob::SetAccountDataJob(const QString& userId, const QString& type,
: BaseJob(HttpVerb::Put, "SetAccountDataJob",
basePath % "/user/" % userId % "/account_data/" % type)
{
- setRequestData(Data(content));
+ setRequestData(Data(toJson(content)));
}
SetAccountDataPerRoomJob::SetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type, const QJsonObject& content)
: BaseJob(HttpVerb::Put, "SetAccountDataPerRoomJob",
basePath % "/user/" % userId % "/rooms/" % roomId % "/account_data/" % type)
{
- setRequestData(Data(content));
+ setRequestData(Data(toJson(content)));
}
diff --git a/lib/jobs/generated/administrative_contact.cpp b/lib/jobs/generated/administrative_contact.cpp
index 1af57941..78eb21fe 100644
--- a/lib/jobs/generated/administrative_contact.cpp
+++ b/lib/jobs/generated/administrative_contact.cpp
@@ -10,16 +10,17 @@ 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
{
+ QJsonObject toJson(const GetAccount3PIDsJob::ThirdPartyIdentifier& pod)
+ {
+ QJsonObject o;
+ o.insert("medium", toJson(pod.medium));
+ o.insert("address", toJson(pod.address));
+
+ return o;
+ }
+
template <> struct FromJson<GetAccount3PIDsJob::ThirdPartyIdentifier>
{
GetAccount3PIDsJob::ThirdPartyIdentifier operator()(QJsonValue jv)
@@ -69,17 +70,18 @@ BaseJob::Status GetAccount3PIDsJob::parseJson(const QJsonDocument& data)
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
{
+ 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()(QJsonValue jv)
diff --git a/lib/jobs/generated/administrative_contact.h b/lib/jobs/generated/administrative_contact.h
index c8429d39..bd70f07b 100644
--- a/lib/jobs/generated/administrative_contact.h
+++ b/lib/jobs/generated/administrative_contact.h
@@ -24,7 +24,6 @@ namespace QMatrixClient
QString medium;
QString address;
- operator QJsonObject() const;
};
// End of inner data structures
@@ -60,7 +59,6 @@ namespace QMatrixClient
QString idServer;
QString sid;
- operator QJsonObject() const;
};
// End of inner data structures
diff --git a/lib/jobs/generated/create_room.cpp b/lib/jobs/generated/create_room.cpp
index de7807b5..008bc697 100644
--- a/lib/jobs/generated/create_room.cpp
+++ b/lib/jobs/generated/create_room.cpp
@@ -10,17 +10,18 @@ using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-CreateRoomJob::Invite3pid::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("id_server", toJson(idServer));
- o.insert("medium", toJson(medium));
- o.insert("address", toJson(address));
-
- return o;
-}
namespace QMatrixClient
{
+ 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()(QJsonValue jv)
@@ -39,17 +40,18 @@ namespace QMatrixClient
};
} // namespace QMatrixClient
-CreateRoomJob::StateEvent::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("type", toJson(type));
- o.insert("state_key", toJson(stateKey));
- o.insert("content", toJson(content));
-
- return o;
-}
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()(QJsonValue jv)
diff --git a/lib/jobs/generated/create_room.h b/lib/jobs/generated/create_room.h
index b479615a..fdb11ada 100644
--- a/lib/jobs/generated/create_room.h
+++ b/lib/jobs/generated/create_room.h
@@ -26,7 +26,6 @@ namespace QMatrixClient
QString medium;
QString address;
- operator QJsonObject() const;
};
struct StateEvent
@@ -35,7 +34,6 @@ namespace QMatrixClient
QString stateKey;
QJsonObject content;
- operator QJsonObject() const;
};
// End of inner data structures
diff --git a/lib/jobs/generated/list_public_rooms.cpp b/lib/jobs/generated/list_public_rooms.cpp
index 39653300..2ae7f5d3 100644
--- a/lib/jobs/generated/list_public_rooms.cpp
+++ b/lib/jobs/generated/list_public_rooms.cpp
@@ -10,23 +10,67 @@ using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-GetPublicRoomsJob::PublicRoomsChunk::operator QJsonObject() const
+class GetRoomVisibilityOnDirectoryJob::Private
{
- 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;
+ public:
+ QString visibility;
+};
+
+QUrl GetRoomVisibilityOnDirectoryJob::makeRequestUrl(QUrl baseUrl, const QString& roomId)
+{
+ return BaseJob::makeRequestUrl(baseUrl,
+ basePath % "/directory/list/room/" % roomId);
+}
+
+GetRoomVisibilityOnDirectoryJob::GetRoomVisibilityOnDirectoryJob(const QString& roomId)
+ : BaseJob(HttpVerb::Get, "GetRoomVisibilityOnDirectoryJob",
+ basePath % "/directory/list/room/" % roomId, false)
+ , d(new Private)
+{
+}
+
+GetRoomVisibilityOnDirectoryJob::~GetRoomVisibilityOnDirectoryJob() = default;
+
+const QString& GetRoomVisibilityOnDirectoryJob::visibility() const
+{
+ return d->visibility;
+}
+
+BaseJob::Status GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data)
+{
+ auto json = data.object();
+ d->visibility = fromJson<QString>(json.value("visibility"));
+ return Success;
}
+
+SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob(const QString& roomId, const QString& visibility)
+ : BaseJob(HttpVerb::Put, "SetRoomVisibilityOnDirectoryJob",
+ basePath % "/directory/list/room/" % roomId)
+{
+ QJsonObject _data;
+ if (!visibility.isEmpty())
+ _data.insert("visibility", toJson(visibility));
+ setRequestData(_data);
+}
+
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;
+ }
+
template <> struct FromJson<GetPublicRoomsJob::PublicRoomsChunk>
{
GetPublicRoomsJob::PublicRoomsChunk operator()(QJsonValue jv)
@@ -128,15 +172,16 @@ BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data)
return Success;
}
-QueryPublicRoomsJob::Filter::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("generic_search_term", toJson(genericSearchTerm));
-
- return o;
-}
namespace QMatrixClient
{
+ 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()(QJsonValue jv)
@@ -151,23 +196,24 @@ namespace QMatrixClient
};
} // 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
{
+ 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;
+ }
+
template <> struct FromJson<QueryPublicRoomsJob::PublicRoomsChunk>
{
QueryPublicRoomsJob::PublicRoomsChunk operator()(QJsonValue jv)
diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h
index 5c281de3..c8adccb4 100644
--- a/lib/jobs/generated/list_public_rooms.h
+++ b/lib/jobs/generated/list_public_rooms.h
@@ -14,6 +14,35 @@ namespace QMatrixClient
{
// Operations
+ class GetRoomVisibilityOnDirectoryJob : public BaseJob
+ {
+ public:
+ /** Construct a URL out of baseUrl and usual parameters passed to
+ * GetRoomVisibilityOnDirectoryJob. This function can be used when
+ * a URL for GetRoomVisibilityOnDirectoryJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId);
+
+ explicit GetRoomVisibilityOnDirectoryJob(const QString& roomId);
+ ~GetRoomVisibilityOnDirectoryJob() override;
+
+ const QString& visibility() const;
+
+ protected:
+ Status parseJson(const QJsonDocument& data) override;
+
+ private:
+ class Private;
+ QScopedPointer<Private> d;
+ };
+
+ class SetRoomVisibilityOnDirectoryJob : public BaseJob
+ {
+ public:
+ explicit SetRoomVisibilityOnDirectoryJob(const QString& roomId, const QString& visibility = {});
+ };
+
class GetPublicRoomsJob : public BaseJob
{
public:
@@ -31,7 +60,6 @@ namespace QMatrixClient
bool guestCanJoin;
QString avatarUrl;
- operator QJsonObject() const;
};
// End of inner data structures
@@ -68,7 +96,6 @@ namespace QMatrixClient
{
QString genericSearchTerm;
- operator QJsonObject() const;
};
struct PublicRoomsChunk
@@ -83,7 +110,6 @@ namespace QMatrixClient
bool guestCanJoin;
QString avatarUrl;
- operator QJsonObject() const;
};
// End of inner data structures
diff --git a/lib/jobs/generated/pusher.cpp b/lib/jobs/generated/pusher.cpp
index 4fddac45..2937c124 100644
--- a/lib/jobs/generated/pusher.cpp
+++ b/lib/jobs/generated/pusher.cpp
@@ -10,15 +10,16 @@ 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
{
+ QJsonObject toJson(const GetPushersJob::PusherData& pod)
+ {
+ QJsonObject o;
+ o.insert("url", toJson(pod.url));
+
+ return o;
+ }
+
template <> struct FromJson<GetPushersJob::PusherData>
{
GetPushersJob::PusherData operator()(QJsonValue jv)
@@ -33,22 +34,23 @@ namespace QMatrixClient
};
} // 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
{
+ 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>
{
GetPushersJob::Pusher operator()(QJsonValue jv)
@@ -110,15 +112,16 @@ BaseJob::Status GetPushersJob::parseJson(const QJsonDocument& data)
return Success;
}
-PostPusherJob::PusherData::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("url", toJson(url));
-
- return o;
-}
namespace QMatrixClient
{
+ QJsonObject toJson(const PostPusherJob::PusherData& pod)
+ {
+ QJsonObject o;
+ o.insert("url", toJson(pod.url));
+
+ return o;
+ }
+
template <> struct FromJson<PostPusherJob::PusherData>
{
PostPusherJob::PusherData operator()(QJsonValue jv)
diff --git a/lib/jobs/generated/pusher.h b/lib/jobs/generated/pusher.h
index 36576996..23cd3fb6 100644
--- a/lib/jobs/generated/pusher.h
+++ b/lib/jobs/generated/pusher.h
@@ -23,7 +23,6 @@ namespace QMatrixClient
{
QString url;
- operator QJsonObject() const;
};
struct Pusher
@@ -37,7 +36,6 @@ namespace QMatrixClient
QString lang;
PusherData data;
- operator QJsonObject() const;
};
// End of inner data structures
@@ -71,7 +69,6 @@ namespace QMatrixClient
{
QString url;
- operator QJsonObject() const;
};
// End of inner data structures
diff --git a/lib/jobs/generated/receipts.cpp b/lib/jobs/generated/receipts.cpp
index 83c38b6f..945e8673 100644
--- a/lib/jobs/generated/receipts.cpp
+++ b/lib/jobs/generated/receipts.cpp
@@ -16,6 +16,6 @@ PostReceiptJob::PostReceiptJob(const QString& roomId, const QString& receiptType
: BaseJob(HttpVerb::Post, "PostReceiptJob",
basePath % "/rooms/" % roomId % "/receipt/" % receiptType % "/" % eventId)
{
- setRequestData(Data(receipt));
+ setRequestData(Data(toJson(receipt)));
}
diff --git a/lib/jobs/generated/room_send.cpp b/lib/jobs/generated/room_send.cpp
index c9a3280d..9637a205 100644
--- a/lib/jobs/generated/room_send.cpp
+++ b/lib/jobs/generated/room_send.cpp
@@ -23,7 +23,7 @@ SendMessageJob::SendMessageJob(const QString& roomId, const QString& eventType,
basePath % "/rooms/" % roomId % "/send/" % eventType % "/" % txnId)
, d(new Private)
{
- setRequestData(Data(body));
+ setRequestData(Data(toJson(body)));
}
SendMessageJob::~SendMessageJob() = default;
diff --git a/lib/jobs/generated/tags.cpp b/lib/jobs/generated/tags.cpp
index dc4faf04..ef3b5f34 100644
--- a/lib/jobs/generated/tags.cpp
+++ b/lib/jobs/generated/tags.cpp
@@ -49,7 +49,7 @@ SetRoomTagJob::SetRoomTagJob(const QString& userId, const QString& roomId, const
: BaseJob(HttpVerb::Put, "SetRoomTagJob",
basePath % "/user/" % userId % "/rooms/" % roomId % "/tags/" % tag)
{
- setRequestData(Data(body));
+ setRequestData(Data(toJson(body)));
}
QUrl DeleteRoomTagJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId, const QString& tag)
diff --git a/lib/jobs/generated/users.cpp b/lib/jobs/generated/users.cpp
index 33da4b43..b222cac5 100644
--- a/lib/jobs/generated/users.cpp
+++ b/lib/jobs/generated/users.cpp
@@ -10,17 +10,18 @@ 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
{
+ 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;
+ }
+
template <> struct FromJson<SearchUserDirectoryJob::User>
{
SearchUserDirectoryJob::User operator()(QJsonValue jv)
diff --git a/lib/jobs/generated/users.h b/lib/jobs/generated/users.h
index 7be250a5..ce7f5aba 100644
--- a/lib/jobs/generated/users.h
+++ b/lib/jobs/generated/users.h
@@ -25,7 +25,6 @@ namespace QMatrixClient
QString displayName;
QString avatarUrl;
- operator QJsonObject() const;
};
// End of inner data structures