5 #include <Quotient/events/event.h>
6 #include <Quotient/jobs/basejob.h>
21 QVector<QVariant> actions;
54 explicit GetNotificationsJob(
const QString& from = {}, std::optional<
int> limit = std::nullopt,
55 const QString& only = {});
61 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& from = {},
62 std::optional<
int> limit = std::nullopt,
const QString& only = {});
69 QString nextToken()
const {
return loadFromJson<QString>(
"next_token"_L1); }
72 std::vector<Notification> notifications()
74 return takeFromJson<std::vector<Notification>>(
"notifications"_L1);
84 std::vector<Notification> notifications{};
88 template <std::derived_from<GetNotificationsJob> JobT>
89 constexpr inline auto doCollectResponse<JobT> =
90 [](JobT* j) -> GetNotificationsJob::Response {
return { j->nextToken(), j->notifications() }; };
93 struct QUOTIENT_API JsonObjectConverter<GetNotificationsJob::Notification> {
94 static void fillFrom(
const QJsonObject& jo, GetNotificationsJob::Notification& result)
96 fillFromJson(jo.value(
"actions"_L1), result.actions);
97 fillFromJson(jo.value(
"event"_L1), result.event);
98 fillFromJson(jo.value(
"read"_L1), result.read);
99 fillFromJson(jo.value(
"room_id"_L1), result.roomId);
100 fillFromJson(jo.value(
"ts"_L1), result.ts);
101 fillFromJson(jo.value(
"profile_tag"_L1), result.profileTag);