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