diff options
Diffstat (limited to 'lib/csapi/message_pagination.cpp')
-rw-r--r-- | lib/csapi/message_pagination.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/csapi/message_pagination.cpp b/lib/csapi/message_pagination.cpp index 1eb2aa07..c59a51ab 100644 --- a/lib/csapi/message_pagination.cpp +++ b/lib/csapi/message_pagination.cpp @@ -23,11 +23,11 @@ class GetRoomEventsJob::Private BaseJob::Query queryToGetRoomEvents(const QString& from, const QString& to, const QString& dir, Omittable<int> limit, const QString& filter) { BaseJob::Query _q; - addParam<>(_q, "from", from); - addParam<IfNotEmpty>(_q, "to", to); - addParam<>(_q, "dir", dir); - addParam<IfNotEmpty>(_q, "limit", limit); - addParam<IfNotEmpty>(_q, "filter", filter); + addParam<>(_q, QStringLiteral("from"), from); + addParam<IfNotEmpty>(_q, QStringLiteral("to"), to); + addParam<>(_q, QStringLiteral("dir"), dir); + addParam<IfNotEmpty>(_q, QStringLiteral("limit"), limit); + addParam<IfNotEmpty>(_q, QStringLiteral("filter"), filter); return _q; } @@ -38,8 +38,10 @@ QUrl GetRoomEventsJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const queryToGetRoomEvents(from, to, dir, limit, filter)); } +static const auto GetRoomEventsJobName = QStringLiteral("GetRoomEventsJob"); + GetRoomEventsJob::GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to, Omittable<int> limit, const QString& filter) - : BaseJob(HttpVerb::Get, "GetRoomEventsJob", + : BaseJob(HttpVerb::Get, GetRoomEventsJobName, basePath % "/rooms/" % roomId % "/messages", queryToGetRoomEvents(from, to, dir, limit, filter)) , d(new Private) @@ -66,9 +68,9 @@ RoomEvents&& GetRoomEventsJob::chunk() BaseJob::Status GetRoomEventsJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->begin = fromJson<QString>(json.value("start")); - d->end = fromJson<QString>(json.value("end")); - d->chunk = fromJson<RoomEvents>(json.value("chunk")); + d->begin = fromJson<QString>(json.value("start"_ls)); + d->end = fromJson<QString>(json.value("end"_ls)); + d->chunk = fromJson<RoomEvents>(json.value("chunk"_ls)); return Success; } |