libkazv
push_ruleset.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"
9 
10 namespace Kazv::Api {
11 
13 {
14 
15 
16  immer::array<PushRule> content;
17 
18 
19  immer::array<PushRule> override;
20 
21 
22  immer::array<PushRule> room;
23 
24 
25  immer::array<PushRule> sender;
26 
27 
28  immer::array<PushRule> underride;
29 };
30 
31 }
32 namespace nlohmann
33 {
34 using namespace Kazv;
35 using namespace Kazv::Api;
36 template<>
37 struct adl_serializer<PushRuleset> {
38  static void to_json(json& jo, const PushRuleset &pod)
39  {
40  if (! jo.is_object()) { jo = json::object(); }
41 
42 
43 
44  addToJsonIfNeeded(jo, "content"s, pod.content);
45 
46  addToJsonIfNeeded(jo, "override"s, pod.override);
47 
48  addToJsonIfNeeded(jo, "room"s, pod.room);
49 
50  addToJsonIfNeeded(jo, "sender"s, pod.sender);
51 
52  addToJsonIfNeeded(jo, "underride"s, pod.underride);
53  }
54  static void from_json(const json &jo, PushRuleset& result)
55  {
56 
57  if (jo.contains("content"s)) {
58  result.content = jo.at("content"s);
59  }
60  if (jo.contains("override"s)) {
61  result.override = jo.at("override"s);
62  }
63  if (jo.contains("room"s)) {
64  result.room = jo.at("room"s);
65  }
66  if (jo.contains("sender"s)) {
67  result.sender = jo.at("sender"s);
68  }
69  if (jo.contains("underride"s)) {
70  result.underride = jo.at("underride"s);
71  }
72 
73  }
74 };
75  }
76 
77  namespace Kazv::Api
78  {
79 } // 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_ruleset.hpp:13
immer::array< PushRule > underride
Definition: push_ruleset.hpp:28
immer::array< PushRule > sender
Definition: push_ruleset.hpp:25
immer::array< PushRule > override
Definition: push_ruleset.hpp:19
immer::array< PushRule > content
Definition: push_ruleset.hpp:16
immer::array< PushRule > room
Definition: push_ruleset.hpp:22
static void from_json(const json &jo, PushRuleset &result)
Definition: push_ruleset.hpp:54
static void to_json(json &jo, const PushRuleset &pod)
Definition: push_ruleset.hpp:38