aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/list_public_rooms.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-14 23:32:16 +0900
committerGitHub <noreply@github.com>2018-12-14 23:32:16 +0900
commitfcc8d2ca615fce6e42bf1cf6585d60f94a2db926 (patch)
treeb0dd17b632a5c5775f2221fd0b53b21a8c02ce58 /lib/csapi/list_public_rooms.cpp
parent50571a92b4e9f634c4daf546222fa082120db6c7 (diff)
parent12a0b95fdcfea15cd0ef313aec8868656629b986 (diff)
downloadlibquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.tar.gz
libquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.zip
Merge pull request #263 from QMatrixClient/kitsune-lazy-loading
Lazy loading members
Diffstat (limited to 'lib/csapi/list_public_rooms.cpp')
-rw-r--r--lib/csapi/list_public_rooms.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp
index 2fdb2005..71b3c541 100644
--- a/lib/csapi/list_public_rooms.cpp
+++ b/lib/csapi/list_public_rooms.cpp
@@ -43,7 +43,7 @@ const QString& GetRoomVisibilityOnDirectoryJob::visibility() const
BaseJob::Status GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
- d->visibility = fromJson<QString>(json.value("visibility"_ls));
+ fromJson(json.value("visibility"_ls), d->visibility);
return Success;
}
@@ -100,7 +100,7 @@ const PublicRoomsResponse& GetPublicRoomsJob::data() const
BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data)
{
- d->data = fromJson<PublicRoomsResponse>(data);
+ fromJson(data, d->data);
return Success;
}
@@ -108,12 +108,13 @@ namespace QMatrixClient
{
// Converters
- QJsonObject toJson(const QueryPublicRoomsJob::Filter& pod)
+ template <> struct JsonObjectConverter<QueryPublicRoomsJob::Filter>
{
- QJsonObject jo;
- addParam<IfNotEmpty>(jo, QStringLiteral("generic_search_term"), pod.genericSearchTerm);
- return jo;
- }
+ static void dumpTo(QJsonObject& jo, const QueryPublicRoomsJob::Filter& pod)
+ {
+ addParam<IfNotEmpty>(jo, QStringLiteral("generic_search_term"), pod.genericSearchTerm);
+ }
+ };
} // namespace QMatrixClient
class QueryPublicRoomsJob::Private
@@ -131,7 +132,7 @@ BaseJob::Query queryToQueryPublicRooms(const QString& server)
static const auto QueryPublicRoomsJobName = QStringLiteral("QueryPublicRoomsJob");
-QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable<int> limit, const QString& since, const Omittable<Filter>& filter, bool includeAllNetworks, const QString& thirdPartyInstanceId)
+QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable<int> limit, const QString& since, const Omittable<Filter>& filter, Omittable<bool> includeAllNetworks, const QString& thirdPartyInstanceId)
: BaseJob(HttpVerb::Post, QueryPublicRoomsJobName,
basePath % "/publicRooms",
queryToQueryPublicRooms(server))
@@ -155,7 +156,7 @@ const PublicRoomsResponse& QueryPublicRoomsJob::data() const
BaseJob::Status QueryPublicRoomsJob::parseJson(const QJsonDocument& data)
{
- d->data = fromJson<PublicRoomsResponse>(data);
+ fromJson(data, d->data);
return Success;
}