1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/csapi/definitions/event_filter.h>
8
9#include <Quotient/converters.h>
10
11namespace Quotient {
12
13struct RoomEventFilter : EventFilter {
14 /// If `true`, enables per-[thread](/client-server-api/#threading)
15 /// notification counts. Only applies to the `/sync` endpoint. Defaults to
16 /// `false`.
17 Omittable<bool> unreadThreadNotifications{};
18
19 /// If `true`, enables lazy-loading of membership events. See
20 /// [Lazy-loading room
21 /// members](/client-server-api/#lazy-loading-room-members) for more
22 /// information. Defaults to `false`.
23 Omittable<bool> lazyLoadMembers{};
24
25 /// If `true`, sends all membership events for all events, even if they have
26 /// already been sent to the client. Does not apply unless
27 /// `lazy_load_members` is `true`. See [Lazy-loading room
28 /// members](/client-server-api/#lazy-loading-room-members) for more
29 /// information. Defaults to `false`.
30 Omittable<bool> includeRedundantMembers{};
31
32 /// A list of room IDs to exclude. If this list is absent then no rooms are
33 /// excluded. A matching room will be excluded even if it is listed in the
34 /// `'rooms'` filter.
35 QStringList notRooms{};
36
37 /// A list of room IDs to include. If this list is absent then all rooms are
38 /// included.
39 QStringList rooms{};
40
41 /// If `true`, includes only events with a `url` key in their content. If
42 /// `false`, excludes those events. If omitted, `url` key is not considered
43 /// for filtering.
44 Omittable<bool> containsUrl{};
45};
46
47template <>
48struct JsonObjectConverter<RoomEventFilter> {
49 static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod)
50 {
51 fillJson<EventFilter>(json&: jo, data: pod);
52 addParam<IfNotEmpty>(container&: jo, QStringLiteral("unread_thread_notifications"),
53 value: pod.unreadThreadNotifications);
54 addParam<IfNotEmpty>(container&: jo, QStringLiteral("lazy_load_members"),
55 value: pod.lazyLoadMembers);
56 addParam<IfNotEmpty>(container&: jo, QStringLiteral("include_redundant_members"),
57 value: pod.includeRedundantMembers);
58 addParam<IfNotEmpty>(container&: jo, QStringLiteral("not_rooms"), value: pod.notRooms);
59 addParam<IfNotEmpty>(container&: jo, QStringLiteral("rooms"), value: pod.rooms);
60 addParam<IfNotEmpty>(container&: jo, QStringLiteral("contains_url"),
61 value: pod.containsUrl);
62 }
63 static void fillFrom(const QJsonObject& jo, RoomEventFilter& pod)
64 {
65 fillFromJson<EventFilter>(jv: jo, pod);
66 fillFromJson(jv: jo.value(key: "unread_thread_notifications"_ls),
67 pod&: pod.unreadThreadNotifications);
68 fillFromJson(jv: jo.value(key: "lazy_load_members"_ls), pod&: pod.lazyLoadMembers);
69 fillFromJson(jv: jo.value(key: "include_redundant_members"_ls),
70 pod&: pod.includeRedundantMembers);
71 fillFromJson(jv: jo.value(key: "not_rooms"_ls), pod&: pod.notRooms);
72 fillFromJson(jv: jo.value(key: "rooms"_ls), pod&: pod.rooms);
73 fillFromJson(jv: jo.value(key: "contains_url"_ls), pod&: pod.containsUrl);
74 }
75};
76
77} // namespace Quotient
78