libQuotient
A Qt library for building matrix clients
push_condition.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 PushCondition {
10  //! The kind of condition to apply. See [conditions](/client-server-api/#conditions-1) for
11  //! more information on the allowed kinds and how they work.
12  QString kind;
13 
14  //! Required for `event_match`, `event_property_is` and `event_property_contains`
15  //! conditions. The dot-separated field of the event to match.
16  //!
17  //! Required for `sender_notification_permission` conditions. The field in
18  //! the power level event the user needs a minimum power level for. Fields
19  //! must be specified under the `notifications` property in the power level
20  //! event's `content`.
21  QString key{};
22 
23  //! Required for `event_match` conditions. The [glob-style
24  //! pattern](/appendices#glob-style-matching) to match against.
25  QString pattern{};
26 
27  //! Required for `room_member_count` conditions. A decimal integer
28  //! optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
29  //! rooms where the member count is strictly less than the given number and
30  //! so forth. If no prefix is present, this parameter defaults to ==.
31  QString is{};
32 
33  //! Required for `event_property_is` and `event_property_contains` conditions.
34  //! A non-compound [canonical JSON](/appendices#canonical-json) value to match
35  //! against.
36  QVariant value{};
37 };
38 
39 template <>
40 struct JsonObjectConverter<PushCondition> {
41  static void dumpTo(QJsonObject& jo, const PushCondition& pod)
42  {
43  addParam<>(jo, "kind"_L1, pod.kind);
44  addParam<IfNotEmpty>(jo, "key"_L1, pod.key);
45  addParam<IfNotEmpty>(jo, "pattern"_L1, pod.pattern);
46  addParam<IfNotEmpty>(jo, "is"_L1, pod.is);
47  addParam<IfNotEmpty>(jo, "value"_L1, pod.value);
48  }
49  static void fillFrom(const QJsonObject& jo, PushCondition& pod)
50  {
51  fillFromJson(jo.value("kind"_L1), pod.kind);
52  fillFromJson(jo.value("key"_L1), pod.key);
53  fillFromJson(jo.value("pattern"_L1), pod.pattern);
54  fillFromJson(jo.value("is"_L1), pod.is);
55  fillFromJson(jo.value("value"_L1), pod.value);
56  }
57 };
58 
59 } // namespace Quotient