libkazv
room_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"
9 
10 namespace Kazv::Api {
11 
13 {
14 
18  std::optional<bool> lazyLoadMembers;
19 
25  std::optional<bool> includeRedundantMembers;
26 
28  immer::array<std::string> notRooms;
29 
31  immer::array<std::string> rooms;
32 
34  std::optional<bool> containsUrl;
35 };
36 
37 }
38 namespace nlohmann
39 {
40 using namespace Kazv;
41 using namespace Kazv::Api;
42 template<>
43 struct adl_serializer<RoomEventFilter> {
44  static void to_json(json& jo, const RoomEventFilter &pod)
45  {
46  if (! jo.is_object()) { jo = json::object(); }
47  jo = static_cast<const EventFilter &>(pod);
48 
49 
50  addToJsonIfNeeded(jo, "lazy_load_members"s, pod.lazyLoadMembers);
51 
52  addToJsonIfNeeded(jo, "include_redundant_members"s, pod.includeRedundantMembers);
53 
54  addToJsonIfNeeded(jo, "not_rooms"s, pod.notRooms);
55 
56  addToJsonIfNeeded(jo, "rooms"s, pod.rooms);
57 
58  addToJsonIfNeeded(jo, "contains_url"s, pod.containsUrl);
59  }
60  static void from_json(const json &jo, RoomEventFilter& result)
61  {
62  static_cast<EventFilter &>(result) = jo;
63  if (jo.contains("lazy_load_members"s)) {
64  result.lazyLoadMembers = jo.at("lazy_load_members"s);
65  }
66  if (jo.contains("include_redundant_members"s)) {
67  result.includeRedundantMembers = jo.at("include_redundant_members"s);
68  }
69  if (jo.contains("not_rooms"s)) {
70  result.notRooms = jo.at("not_rooms"s);
71  }
72  if (jo.contains("rooms"s)) {
73  result.rooms = jo.at("rooms"s);
74  }
75  if (jo.contains("contains_url"s)) {
76  result.containsUrl = jo.at("contains_url"s);
77  }
78 
79  }
80 };
81  }
82 
83  namespace Kazv::Api
84  {
85 } // 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
Definition: room_event_filter.hpp:13
std::optional< bool > containsUrl
If true, includes only events with a url key in their content. If false, excludes those events....
Definition: room_event_filter.hpp:34
immer::array< std::string > notRooms
A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room wil...
Definition: room_event_filter.hpp:28
std::optional< bool > lazyLoadMembers
If true, enables lazy-loading of membership events.
Definition: room_event_filter.hpp:18
immer::array< std::string > rooms
A list of room IDs to include. If this list is absent then all rooms are included.
Definition: room_event_filter.hpp:31
std::optional< bool > includeRedundantMembers
If true, sends all membership events for all events, even if they have already been sent to the clien...
Definition: room_event_filter.hpp:25
static void to_json(json &jo, const RoomEventFilter &pod)
Definition: room_event_filter.hpp:44
static void from_json(const json &jo, RoomEventFilter &result)
Definition: room_event_filter.hpp:60