libkazv
Loading...
Searching...
No Matches
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
10namespace Kazv::Api {
11
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}
40namespace nlohmann
41{
42using namespace Kazv;
43using namespace Kazv::Api;
44template<>
45struct 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
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