diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-02 13:32:47 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-02 13:32:47 +0900 |
commit | 0dd491fbd189baaabadcab2344a05e3cf3898287 (patch) | |
tree | 13b8ebe63ba8b156ddd6ddab8b0ad2845d7c9c42 /lib/csapi/list_public_rooms.cpp | |
parent | e7ac6f3480358fd989c8a3090590d665d18e1cec (diff) | |
download | libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.tar.gz libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.zip |
csapi: Use Omittable<> container instead of intrusive 'omitted' field
Also: use the latest feature of GTAD, +set/+on, to make gtad.yaml more compact.
Diffstat (limited to 'lib/csapi/list_public_rooms.cpp')
-rw-r--r-- | lib/csapi/list_public_rooms.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index b60d14fd..97beba1c 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -94,10 +94,10 @@ class GetPublicRoomsJob::Private QVector<PublicRoomsChunk> chunk; QString nextBatch; QString prevBatch; - qint64 totalRoomCountEstimate; + Omittable<qint64> totalRoomCountEstimate; }; -BaseJob::Query queryToGetPublicRooms(int limit, const QString& since, const QString& server) +BaseJob::Query queryToGetPublicRooms(Omittable<int> limit, const QString& since, const QString& server) { BaseJob::Query _q; _q.addQueryItem("limit", QString("%1").arg(limit)); @@ -108,14 +108,14 @@ BaseJob::Query queryToGetPublicRooms(int limit, const QString& since, const QStr return _q; } -QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, int limit, const QString& since, const QString& server) +QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable<int> limit, const QString& since, const QString& server) { return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/publicRooms", queryToGetPublicRooms(limit, since, server)); } -GetPublicRoomsJob::GetPublicRoomsJob(int limit, const QString& since, const QString& server) +GetPublicRoomsJob::GetPublicRoomsJob(Omittable<int> limit, const QString& since, const QString& server) : BaseJob(HttpVerb::Get, "GetPublicRoomsJob", basePath % "/publicRooms", queryToGetPublicRooms(limit, since, server), @@ -141,7 +141,7 @@ const QString& GetPublicRoomsJob::prevBatch() const return d->prevBatch; } -qint64 GetPublicRoomsJob::totalRoomCountEstimate() const +Omittable<qint64> GetPublicRoomsJob::totalRoomCountEstimate() const { return d->totalRoomCountEstimate; } @@ -166,9 +166,6 @@ namespace QMatrixClient QJsonObject toJson(const QueryPublicRoomsJob::Filter& pod) { QJsonObject _json; - if (pod.omitted) - return _json; - addToJson<IfNotEmpty>(_json, "generic_search_term", pod.genericSearchTerm); return _json; } @@ -209,7 +206,7 @@ class QueryPublicRoomsJob::Private QVector<PublicRoomsChunk> chunk; QString nextBatch; QString prevBatch; - qint64 totalRoomCountEstimate; + Omittable<qint64> totalRoomCountEstimate; }; BaseJob::Query queryToQueryPublicRooms(const QString& server) @@ -220,7 +217,7 @@ BaseJob::Query queryToQueryPublicRooms(const QString& server) return _q; } -QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, int limit, const QString& since, const Filter& filter) +QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable<int> limit, const QString& since, const Omittable<Filter>& filter) : BaseJob(HttpVerb::Post, "QueryPublicRoomsJob", basePath % "/publicRooms", queryToQueryPublicRooms(server)) @@ -250,7 +247,7 @@ const QString& QueryPublicRoomsJob::prevBatch() const return d->prevBatch; } -qint64 QueryPublicRoomsJob::totalRoomCountEstimate() const +Omittable<qint64> QueryPublicRoomsJob::totalRoomCountEstimate() const { return d->totalRoomCountEstimate; } |