libkazv
push_condition.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3  */
4 
5 #pragma once
6 
7 #include "types.hpp"
8 
9 
10 namespace Kazv::Api {
11 
12 struct PushCondition
13 {
14 
17  std::string kind;
18 
26  std::optional<std::string> key;
27 
30  std::optional<std::string> pattern;
31 
36  std::optional<std::string> is;
37 };
38 
39 }
40 namespace nlohmann
41 {
42 using namespace Kazv;
43 using namespace Kazv::Api;
44 template<>
45 struct adl_serializer<PushCondition> {
46  static void to_json(json& jo, const PushCondition &pod)
47  {
48  if (! jo.is_object()) { jo = json::object(); }
49 
50 
51  jo["kind"s] = pod.kind;
52 
53 
54  addToJsonIfNeeded(jo, "key"s, pod.key);
55 
56  addToJsonIfNeeded(jo, "pattern"s, pod.pattern);
57 
58  addToJsonIfNeeded(jo, "is"s, pod.is);
59  }
60  static void from_json(const json &jo, PushCondition& result)
61  {
62 
63  if (jo.contains("kind"s)) {
64  result.kind = jo.at("kind"s);
65  }
66  if (jo.contains("key"s)) {
67  result.key = jo.at("key"s);
68  }
69  if (jo.contains("pattern"s)) {
70  result.pattern = jo.at("pattern"s);
71  }
72  if (jo.contains("is"s)) {
73  result.is = jo.at("is"s);
74  }
75 
76  }
77 };
78  }
79 
80  namespace Kazv::Api
81  {
82 } // namespace Kazv::Api
Kazv::Api::PushCondition::is
std::optional< std::string > is
Required for room_member_count conditions.
Definition: push_condition.hpp:40
Kazv::Api::PushCondition::key
std::optional< std::string > key
Required for event_match conditions.
Definition: push_condition.hpp:30
Kazv::Api::PushCondition
Definition: push_condition.hpp:14
types.hpp
nlohmann
Definition: location.hpp:26
nlohmann::adl_serializer< PushCondition >::from_json
static void from_json(const json &jo, PushCondition &result)
Definition: push_condition.hpp:60
Kazv
Definition: location.hpp:10
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::Api::PushCondition::pattern
std::optional< std::string > pattern
Required for event_match conditions.
Definition: push_condition.hpp:34
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
Kazv::Api::PushCondition::kind
std::string kind
The kind of condition to apply.
Definition: push_condition.hpp:21
nlohmann::adl_serializer< PushCondition >::to_json
static void to_json(json &jo, const PushCondition &pod)
Definition: push_condition.hpp:46