5 #include <Quotient/csapi/definitions/event_filter.h>
6 #include <Quotient/csapi/definitions/room_event_filter.h>
8 #include <Quotient/converters.h>
16 QStringList notRooms{};
24 RoomEventFilter ephemeral{};
27 std::optional<
bool> includeLeave{};
30 RoomEventFilter state{};
33 RoomEventFilter timeline{};
36 RoomEventFilter accountData{};
40 struct JsonObjectConverter<RoomFilter> {
41 static void dumpTo(QJsonObject& jo,
const RoomFilter& pod)
43 addParam<IfNotEmpty>(jo,
"not_rooms"_L1, pod.notRooms);
44 addParam<IfNotEmpty>(jo,
"rooms"_L1, pod.rooms);
45 addParam<IfNotEmpty>(jo,
"ephemeral"_L1, pod.ephemeral);
46 addParam<IfNotEmpty>(jo,
"include_leave"_L1, pod.includeLeave);
47 addParam<IfNotEmpty>(jo,
"state"_L1, pod.state);
48 addParam<IfNotEmpty>(jo,
"timeline"_L1, pod.timeline);
49 addParam<IfNotEmpty>(jo,
"account_data"_L1, pod.accountData);
51 static void fillFrom(
const QJsonObject& jo, RoomFilter& pod)
53 fillFromJson(jo.value(
"not_rooms"_L1), pod.notRooms);
54 fillFromJson(jo.value(
"rooms"_L1), pod.rooms);
55 fillFromJson(jo.value(
"ephemeral"_L1), pod.ephemeral);
56 fillFromJson(jo.value(
"include_leave"_L1), pod.includeLeave);
57 fillFromJson(jo.value(
"state"_L1), pod.state);
58 fillFromJson(jo.value(
"timeline"_L1), pod.timeline);
59 fillFromJson(jo.value(
"account_data"_L1), pod.accountData);
68 QStringList eventFields{};
73 QString eventFormat{};
76 EventFilter presence{};
79 EventFilter accountData{};
86 struct JsonObjectConverter<Filter> {
87 static void dumpTo(QJsonObject& jo,
const Filter& pod)
89 addParam<IfNotEmpty>(jo,
"event_fields"_L1, pod.eventFields);
90 addParam<IfNotEmpty>(jo,
"event_format"_L1, pod.eventFormat);
91 addParam<IfNotEmpty>(jo,
"presence"_L1, pod.presence);
92 addParam<IfNotEmpty>(jo,
"account_data"_L1, pod.accountData);
93 addParam<IfNotEmpty>(jo,
"room"_L1, pod.room);
95 static void fillFrom(
const QJsonObject& jo, Filter& pod)
97 fillFromJson(jo.value(
"event_fields"_L1), pod.eventFields);
98 fillFromJson(jo.value(
"event_format"_L1), pod.eventFormat);
99 fillFromJson(jo.value(
"presence"_L1), pod.presence);
100 fillFromJson(jo.value(
"account_data"_L1), pod.accountData);
101 fillFromJson(jo.value(
"room"_L1), pod.room);