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