Go to the documentation of this file.
46 if (! jo.is_object()) { jo = json::object(); }
49 jo[
"actions"s] = pod.actions;
51 jo[
"default"s] = pod.isDefault;
53 jo[
"enabled"s] = pod.enabled;
55 jo[
"rule_id"s] = pod.ruleId;
65 if (jo.contains(
"actions"s)) {
66 result.actions = jo.at(
"actions"s);
68 if (jo.contains(
"default"s)) {
69 result.isDefault = jo.at(
"default"s);
71 if (jo.contains(
"enabled"s)) {
72 result.enabled = jo.at(
"enabled"s);
74 if (jo.contains(
"rule_id"s)) {
75 result.ruleId = jo.at(
"rule_id"s);
77 if (jo.contains(
"conditions"s)) {
78 result.conditions = jo.at(
"conditions"s);
80 if (jo.contains(
"pattern"s)) {
81 result.pattern = jo.at(
"pattern"s);
Definition: push_rule.hpp:14
static void from_json(const json &jo, PushRule &result)
Definition: push_rule.hpp:62
immer::array< PushCondition > conditions
The conditions that must hold true for an event in order for a rule to be applied to an event.
Definition: push_rule.hpp:34
Definition: location.hpp:26
Definition: location.hpp:10
std::optional< std::string > pattern
The glob-style pattern to match against.
Definition: push_rule.hpp:38
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
immer::array< Variant > actions
The actions to perform when this rule is matched.
Definition: push_rule.hpp:20
std::string ruleId
The ID of this rule.
Definition: push_rule.hpp:29
bool enabled
Whether the push rule is enabled or not.
Definition: push_rule.hpp:26
static void to_json(json &jo, const PushRule &pod)
Definition: push_rule.hpp:44
bool isDefault
Whether this is a default rule, or has been set explicitly.
Definition: push_rule.hpp:23