libkazv
Loading...
Searching...
No Matches
event_filter.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
16 std::optional<int> limit;
17
19 immer::array<std::string> notSenders;
20
22 immer::array<std::string> notTypes;
23
25 immer::array<std::string> senders;
26
28 immer::array<std::string> types;
29};
30
31}
32namespace nlohmann
33{
34using namespace Kazv;
35using namespace Kazv::Api;
36template<>
37struct adl_serializer<EventFilter> {
38 static void to_json(json& jo, const EventFilter &pod)
39 {
40 if (! jo.is_object()) { jo = json::object(); }
41
42
43
44 addToJsonIfNeeded(jo, "limit"s, pod.limit);
45
46 addToJsonIfNeeded(jo, "not_senders"s, pod.notSenders);
47
48 addToJsonIfNeeded(jo, "not_types"s, pod.notTypes);
49
50 addToJsonIfNeeded(jo, "senders"s, pod.senders);
51
52 addToJsonIfNeeded(jo, "types"s, pod.types);
53 }
54 static void from_json(const json &jo, EventFilter& result)
55 {
56
57 if (jo.contains("limit"s)) {
58 result.limit = jo.at("limit"s);
59 }
60 if (jo.contains("not_senders"s)) {
61 result.notSenders = jo.at("not_senders"s);
62 }
63 if (jo.contains("not_types"s)) {
64 result.notTypes = jo.at("not_types"s);
65 }
66 if (jo.contains("senders"s)) {
67 result.senders = jo.at("senders"s);
68 }
69 if (jo.contains("types"s)) {
70 result.types = jo.at("types"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 event_filter.hpp:13
immer::array< std::string > senders
A list of senders IDs to include. If this list is absent then all senders are included.
Definition event_filter.hpp:25
immer::array< std::string > notSenders
A list of sender IDs to exclude. If this list is absent then no senders are excluded....
Definition event_filter.hpp:19
std::optional< int > limit
The maximum number of events to return.
Definition event_filter.hpp:16
immer::array< std::string > notTypes
A list of event types to exclude. If this list is absent then no event types are excluded....
Definition event_filter.hpp:22
immer::array< std::string > types
A list of event types to include. If this list is absent then all event types are included....
Definition event_filter.hpp:28
static void from_json(const json &jo, EventFilter &result)
Definition event_filter.hpp:54
static void to_json(json &jo, const EventFilter &pod)
Definition event_filter.hpp:38