26 std::optional<std::string>
key;
36 std::optional<std::string>
is;
48 if (! jo.is_object()) { jo = json::object(); }
51 jo[
"kind"s] = pod.
kind;
63 if (jo.contains(
"kind"s)) {
64 result.
kind = jo.at(
"kind"s);
66 if (jo.contains(
"key"s)) {
67 result.
key = jo.at(
"key"s);
69 if (jo.contains(
"pattern"s)) {
70 result.
pattern = jo.at(
"pattern"s);
72 if (jo.contains(
"is"s)) {
73 result.
is = jo.at(
"is"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_condition.hpp:13
std::string kind
The kind of condition to apply.
Definition: push_condition.hpp:17
std::optional< std::string > key
Required for event_match conditions.
Definition: push_condition.hpp:26
std::optional< std::string > is
Required for room_member_count conditions.
Definition: push_condition.hpp:36
std::optional< std::string > pattern
Required for event_match conditions.
Definition: push_condition.hpp:30
static void to_json(json &jo, const PushCondition &pod)
Definition: push_condition.hpp:46
static void from_json(const json &jo, PushCondition &result)
Definition: push_condition.hpp:60