libQuotient
A Qt library for building matrix clients
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/converters.h>
6 
7 namespace Quotient {
8 
9 struct QUOTIENT_API EventFilter {
10  //! The maximum number of events to return, must be an integer greater than 0.
11  //!
12  //! Servers should apply a default value, and impose a maximum value to avoid
13  //! resource exhaustion.
14  std::optional<int> limit{};
15 
16  //! A list of sender IDs to exclude. If this list is absent then no senders are excluded. A
17  //! matching sender will be excluded even if it is listed in the `'senders'` filter.
18  QStringList notSenders{};
19 
20  //! A list of event types to exclude. If this list is absent then no event types are excluded. A
21  //! matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be
22  //! used as a wildcard to match any sequence of characters.
23  QStringList notTypes{};
24 
25  //! A list of senders IDs to include. If this list is absent then all senders are included.
26  QStringList senders{};
27 
28  //! A list of event types to include. If this list is absent then all event types are included.
29  //! A `'*'` can be used as a wildcard to match any sequence of characters.
30  QStringList types{};
31 };
32 
33 template <>
34 struct JsonObjectConverter<EventFilter> {
35  static void dumpTo(QJsonObject& jo, const EventFilter& pod)
36  {
37  addParam<IfNotEmpty>(jo, "limit"_L1, pod.limit);
38  addParam<IfNotEmpty>(jo, "not_senders"_L1, pod.notSenders);
39  addParam<IfNotEmpty>(jo, "not_types"_L1, pod.notTypes);
40  addParam<IfNotEmpty>(jo, "senders"_L1, pod.senders);
41  addParam<IfNotEmpty>(jo, "types"_L1, pod.types);
42  }
43  static void fillFrom(const QJsonObject& jo, EventFilter& pod)
44  {
45  fillFromJson(jo.value("limit"_L1), pod.limit);
46  fillFromJson(jo.value("not_senders"_L1), pod.notSenders);
47  fillFromJson(jo.value("not_types"_L1), pod.notTypes);
48  fillFromJson(jo.value("senders"_L1), pod.senders);
49  fillFromJson(jo.value("types"_L1), pod.types);
50  }
51 };
52 
53 } // namespace Quotient