aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/notifications.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-24 19:20:10 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-29 21:59:39 +0900
commit4244cee8d5e0f760cccd2b45ad587670573ef03c (patch)
tree4806108543f1402247e6cce1dba987a98d6fe83b /lib/csapi/notifications.cpp
parentf5c2e47fa1ab84fdaffe03c30ba973d7dea5ac05 (diff)
downloadlibquotient-4244cee8d5e0f760cccd2b45ad587670573ef03c.tar.gz
libquotient-4244cee8d5e0f760cccd2b45ad587670573ef03c.zip
Prepare for CS API 0.4.0
This commit consists of two parts: upgrading the API infrastructure and trivial but sweeping update to the generated files. 1. The API infrastructure (converters.h, *.mustache and some other non-generated files) now can deal with top-level JSON arrays and response inlining; better supports property maps; and gets some formatting fixes in generated code. 2. Generated files now use QJsonValue instead of QJsonObject as a default type to (un)marshall Matrix API data structures, to match the change in the infrastructure above This commit is still using the old Matrix API definitions, before CS API 0.4.0. Getting to CS API 0.4.0 will come next.
Diffstat (limited to 'lib/csapi/notifications.cpp')
-rw-r--r--lib/csapi/notifications.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/csapi/notifications.cpp b/lib/csapi/notifications.cpp
index f98cddd2..78cd6f49 100644
--- a/lib/csapi/notifications.cpp
+++ b/lib/csapi/notifications.cpp
@@ -16,24 +16,23 @@ namespace QMatrixClient
{
// Converters
- template <> struct FromJson<GetNotificationsJob::Notification>
+ template <> struct FromJsonObject<GetNotificationsJob::Notification>
{
- GetNotificationsJob::Notification operator()(const QJsonValue& jv)
+ GetNotificationsJob::Notification operator()(const QJsonObject& jo) const
{
- const auto& _json = jv.toObject();
GetNotificationsJob::Notification result;
result.actions =
- fromJson<QVector<QVariant>>(_json.value("actions"_ls));
+ fromJson<QVector<QVariant>>(jo.value("actions"_ls));
result.event =
- fromJson<EventPtr>(_json.value("event"_ls));
+ fromJson<EventPtr>(jo.value("event"_ls));
result.profileTag =
- fromJson<QString>(_json.value("profile_tag"_ls));
+ fromJson<QString>(jo.value("profile_tag"_ls));
result.read =
- fromJson<bool>(_json.value("read"_ls));
+ fromJson<bool>(jo.value("read"_ls));
result.roomId =
- fromJson<QString>(_json.value("room_id"_ls));
+ fromJson<QString>(jo.value("room_id"_ls));
result.ts =
- fromJson<qint64>(_json.value("ts"_ls));
+ fromJson<qint64>(jo.value("ts"_ls));
return result;
}