5 #include <Quotient/csapi/definitions/push_condition.h>
7 #include <Quotient/converters.h>
13 QVector<QVariant> actions;
27 QVector<PushCondition> conditions{};
35 struct JsonObjectConverter<PushRule> {
36 static void dumpTo(QJsonObject& jo,
const PushRule& pod)
38 addParam<>(jo, QStringLiteral(
"actions"), pod.actions);
39 addParam<>(jo, QStringLiteral(
"default"), pod.isDefault);
40 addParam<>(jo, QStringLiteral(
"enabled"), pod.enabled);
41 addParam<>(jo, QStringLiteral(
"rule_id"), pod.ruleId);
42 addParam<IfNotEmpty>(jo, QStringLiteral(
"conditions"), pod.conditions);
43 addParam<IfNotEmpty>(jo, QStringLiteral(
"pattern"), pod.pattern);
45 static void fillFrom(
const QJsonObject& jo, PushRule& pod)
47 fillFromJson(jo.value(
"actions"_ls), pod.actions);
48 fillFromJson(jo.value(
"default"_ls), pod.isDefault);
49 fillFromJson(jo.value(
"enabled"_ls), pod.enabled);
50 fillFromJson(jo.value(
"rule_id"_ls), pod.ruleId);
51 fillFromJson(jo.value(
"conditions"_ls), pod.conditions);
52 fillFromJson(jo.value(
"pattern"_ls), pod.pattern);