diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-03 19:17:10 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-03 19:17:10 +0900 |
commit | 23dc9a3259108f8e0c55e535b9341042f1ff77f5 (patch) | |
tree | 59e6c68b14fc73f0aab6d72807ce85ec241947d8 /jobs/generated/list_public_rooms.cpp | |
parent | e000929c0b06752703056b890ff0b5a4deae1c6a (diff) | |
download | libquotient-23dc9a3259108f8e0c55e535b9341042f1ff77f5.tar.gz libquotient-23dc9a3259108f8e0c55e535b9341042f1ff77f5.zip |
jobs/generated: Generate job-specific makeRequestUrl() methods
Diffstat (limited to 'jobs/generated/list_public_rooms.cpp')
-rw-r--r-- | jobs/generated/list_public_rooms.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/jobs/generated/list_public_rooms.cpp b/jobs/generated/list_public_rooms.cpp index a2c0e406..39653300 100644 --- a/jobs/generated/list_public_rooms.cpp +++ b/jobs/generated/list_public_rooms.cpp @@ -66,18 +66,31 @@ class GetPublicRoomsJob::Private double totalRoomCountEstimate; }; -GetPublicRoomsJob::GetPublicRoomsJob(double limit, const QString& since, const QString& server) - : BaseJob(HttpVerb::Get, "GetPublicRoomsJob", - basePath % "/publicRooms", false) - , d(new Private) +BaseJob::Query queryToGetPublicRooms(double limit, const QString& since, const QString& server) { - QUrlQuery _q; + BaseJob::Query _q; _q.addQueryItem("limit", QString("%1").arg(limit)); if (!since.isEmpty()) _q.addQueryItem("since", since); if (!server.isEmpty()) _q.addQueryItem("server", server); - setRequestQuery(_q); + return _q; +} + +QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, double limit, const QString& since, const QString& server) +{ + return BaseJob::makeRequestUrl(baseUrl, + basePath % "/publicRooms", + queryToGetPublicRooms(limit, since, server)); +} + +GetPublicRoomsJob::GetPublicRoomsJob(double limit, const QString& since, const QString& server) + : BaseJob(HttpVerb::Get, "GetPublicRoomsJob", + basePath % "/publicRooms", + queryToGetPublicRooms(limit, since, server), + {}, false) + , d(new Private) +{ } GetPublicRoomsJob::~GetPublicRoomsJob() = default; @@ -194,15 +207,20 @@ class QueryPublicRoomsJob::Private double totalRoomCountEstimate; }; +BaseJob::Query queryToQueryPublicRooms(const QString& server) +{ + BaseJob::Query _q; + if (!server.isEmpty()) + _q.addQueryItem("server", server); + return _q; +} + QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, double limit, const QString& since, const Filter& filter) : BaseJob(HttpVerb::Post, "QueryPublicRoomsJob", - basePath % "/publicRooms") + basePath % "/publicRooms", + queryToQueryPublicRooms(server)) , d(new Private) { - QUrlQuery _q; - if (!server.isEmpty()) - _q.addQueryItem("server", server); - setRequestQuery(_q); QJsonObject _data; _data.insert("limit", toJson(limit)); if (!since.isEmpty()) |