46 if (! jo.is_object()) { jo = json::object(); }
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)) {
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)) {
80 if (jo.contains(
"pattern"s)) {
81 result.
pattern = jo.at(
"pattern"s);
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
Definition: push_rule.hpp:13
std::optional< std::string > pattern
The glob-style pattern to match against.
Definition: push_rule.hpp:34
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:30
immer::array< Variant > actions
The actions to perform when this rule is matched.
Definition: push_rule.hpp:16
bool enabled
Whether the push rule is enabled or not.
Definition: push_rule.hpp:22
bool isDefault
Whether this is a default rule, or has been set explicitly.
Definition: push_rule.hpp:19
std::string ruleId
The ID of this rule.
Definition: push_rule.hpp:25
static void from_json(const json &jo, PushRule &result)
Definition: push_rule.hpp:62
static void to_json(json &jo, const PushRule &pod)
Definition: push_rule.hpp:44