| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/converters.h> |
| 8 | |
| 9 | namespace Quotient { |
| 10 | |
| 11 | struct PushCondition { |
| 12 | /// The kind of condition to apply. See |
| 13 | /// [conditions](/client-server-api/#conditions) for more information on the |
| 14 | /// allowed kinds and how they work. |
| 15 | QString kind; |
| 16 | |
| 17 | /// Required for `event_match` conditions. The dot-separated field of the |
| 18 | /// event to match. |
| 19 | /// |
| 20 | /// Required for `sender_notification_permission` conditions. The field in |
| 21 | /// the power level event the user needs a minimum power level for. Fields |
| 22 | /// must be specified under the `notifications` property in the power level |
| 23 | /// event's `content`. |
| 24 | QString key{}; |
| 25 | |
| 26 | /// Required for `event_match` conditions. The [glob-style |
| 27 | /// pattern](/appendices#glob-style-matching) to match against. |
| 28 | QString pattern{}; |
| 29 | |
| 30 | /// Required for `room_member_count` conditions. A decimal integer |
| 31 | /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches |
| 32 | /// rooms where the member count is strictly less than the given number and |
| 33 | /// so forth. If no prefix is present, this parameter defaults to ==. |
| 34 | QString is{}; |
| 35 | }; |
| 36 | |
| 37 | template <> |
| 38 | struct JsonObjectConverter<PushCondition> { |
| 39 | static void dumpTo(QJsonObject& jo, const PushCondition& pod) |
| 40 | { |
| 41 | addParam<>(container&: jo, QStringLiteral("kind" ), value: pod.kind); |
| 42 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("key" ), value: pod.key); |
| 43 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("pattern" ), value: pod.pattern); |
| 44 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("is" ), value: pod.is); |
| 45 | } |
| 46 | static void fillFrom(const QJsonObject& jo, PushCondition& pod) |
| 47 | { |
| 48 | fillFromJson(jv: jo.value(key: "kind"_ls ), pod&: pod.kind); |
| 49 | fillFromJson(jv: jo.value(key: "key"_ls ), pod&: pod.key); |
| 50 | fillFromJson(jv: jo.value(key: "pattern"_ls ), pod&: pod.pattern); |
| 51 | fillFromJson(jv: jo.value(key: "is"_ls ), pod&: pod.is); |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | } // namespace Quotient |
| 56 | |