libkazv
sync_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"
10 
11 namespace Kazv::Api {
13 struct RoomFilter
14 {
15 
17  immer::array<std::string> notRooms;
18 
20  immer::array<std::string> rooms;
21 
24 
26  std::optional<bool> includeLeave;
27 
30 
33 
36 };
37 
38 }
39 namespace nlohmann
40 {
41 using namespace Kazv;
42 using namespace Kazv::Api;
43 template<>
44 struct adl_serializer<RoomFilter> {
45  static void to_json(json& jo, const RoomFilter &pod)
46  {
47  if (! jo.is_object()) { jo = json::object(); }
48 
49 
50 
51  addToJsonIfNeeded(jo, "not_rooms"s, pod.notRooms);
52 
53  addToJsonIfNeeded(jo, "rooms"s, pod.rooms);
54 
55  addToJsonIfNeeded(jo, "ephemeral"s, pod.ephemeral);
56 
57  addToJsonIfNeeded(jo, "include_leave"s, pod.includeLeave);
58 
59  addToJsonIfNeeded(jo, "state"s, pod.state);
60 
61  addToJsonIfNeeded(jo, "timeline"s, pod.timeline);
62 
63  addToJsonIfNeeded(jo, "account_data"s, pod.accountData);
64  }
65  static void from_json(const json &jo, RoomFilter& result)
66  {
67 
68  if (jo.contains("not_rooms"s)) {
69  result.notRooms = jo.at("not_rooms"s);
70  }
71  if (jo.contains("rooms"s)) {
72  result.rooms = jo.at("rooms"s);
73  }
74  if (jo.contains("ephemeral"s)) {
75  result.ephemeral = jo.at("ephemeral"s);
76  }
77  if (jo.contains("include_leave"s)) {
78  result.includeLeave = jo.at("include_leave"s);
79  }
80  if (jo.contains("state"s)) {
81  result.state = jo.at("state"s);
82  }
83  if (jo.contains("timeline"s)) {
84  result.timeline = jo.at("timeline"s);
85  }
86  if (jo.contains("account_data"s)) {
87  result.accountData = jo.at("account_data"s);
88  }
89 
90  }
91 };
92  }
93 
94  namespace Kazv::Api
95  {
96 
97 struct Filter
98 {
99 
101  immer::array<std::string> eventFields;
102 
104  std::optional<std::string> eventFormat;
105 
108 
111 
114 };
115 
116 }
117 namespace nlohmann
118 {
119 using namespace Kazv;
120 using namespace Kazv::Api;
121 template<>
122 struct adl_serializer<Filter> {
123  static void to_json(json& jo, const Filter &pod)
124  {
125  if (! jo.is_object()) { jo = json::object(); }
126 
127 
128 
129  addToJsonIfNeeded(jo, "event_fields"s, pod.eventFields);
130 
131  addToJsonIfNeeded(jo, "event_format"s, pod.eventFormat);
132 
133  addToJsonIfNeeded(jo, "presence"s, pod.presence);
134 
135  addToJsonIfNeeded(jo, "account_data"s, pod.accountData);
136 
137  addToJsonIfNeeded(jo, "room"s, pod.room);
138  }
139  static void from_json(const json &jo, Filter& result)
140  {
141 
142  if (jo.contains("event_fields"s)) {
143  result.eventFields = jo.at("event_fields"s);
144  }
145  if (jo.contains("event_format"s)) {
146  result.eventFormat = jo.at("event_format"s);
147  }
148  if (jo.contains("presence"s)) {
149  result.presence = jo.at("presence"s);
150  }
151  if (jo.contains("account_data"s)) {
152  result.accountData = jo.at("account_data"s);
153  }
154  if (jo.contains("room"s)) {
155  result.room = jo.at("room"s);
156  }
157 
158  }
159 };
160  }
161 
162  namespace Kazv::Api
163  {
164 } // namespace Kazv::Api
Kazv::Api::RoomFilter::notRooms
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: sync_filter.hpp:21
types.hpp
nlohmann::adl_serializer< RoomFilter >::to_json
static void to_json(json &jo, const RoomFilter &pod)
Definition: sync_filter.hpp:45
nlohmann
Definition: location.hpp:26
Kazv::Api::Filter::eventFields
immer::array< std::string > eventFields
List of event fields to include. If this list is absent then all fields are included....
Definition: sync_filter.hpp:101
room_event_filter.hpp
nlohmann::adl_serializer< Filter >::from_json
static void from_json(const json &jo, Filter &result)
Definition: sync_filter.hpp:139
Kazv
Definition: location.hpp:10
Kazv::Api::Filter
Definition: sync_filter.hpp:97
Kazv::Api::RoomFilter
Filters to be applied to room data.
Definition: sync_filter.hpp:15
Kazv::Api::Filter::eventFormat
std::optional< std::string > eventFormat
The format to use for events. 'client' will return the events in a format suitable for clients....
Definition: sync_filter.hpp:104
Kazv::Api::Filter::room
RoomFilter room
Filters to be applied to room data.
Definition: sync_filter.hpp:113
Kazv::Api::Filter::presence
EventFilter presence
The presence updates to include.
Definition: sync_filter.hpp:107
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
nlohmann::adl_serializer< Filter >::to_json
static void to_json(json &jo, const Filter &pod)
Definition: sync_filter.hpp:123
Kazv::Api
Definition: location.hpp:10
Kazv::Api::RoomEventFilter
Definition: room_event_filter.hpp:14
nlohmann::adl_serializer< RoomFilter >::from_json
static void from_json(const json &jo, RoomFilter &result)
Definition: sync_filter.hpp:65
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
Kazv::Api::RoomFilter::includeLeave
std::optional< bool > includeLeave
Include rooms that the user has left in the sync, default false.
Definition: sync_filter.hpp:30
Kazv::Api::RoomFilter::state
RoomEventFilter state
The state events to include for rooms.
Definition: sync_filter.hpp:33
Kazv::Api::RoomFilter::ephemeral
RoomEventFilter ephemeral
The events that aren't recorded in the room history, e.g. typing and receipts, to include for rooms.
Definition: sync_filter.hpp:27
Kazv::Api::RoomFilter::rooms
immer::array< std::string > rooms
A list of room IDs to include. If this list is absent then all rooms are included....
Definition: sync_filter.hpp:24
Kazv::Api::RoomFilter::accountData
RoomEventFilter accountData
The per user account data to include for rooms.
Definition: sync_filter.hpp:39
Kazv::Api::RoomFilter::timeline
RoomEventFilter timeline
The message and state update events to include for rooms.
Definition: sync_filter.hpp:36
Kazv::Api::EventFilter
Definition: event_filter.hpp:14
event_filter.hpp
Kazv::Api::Filter::accountData
EventFilter accountData
The user account data that isn't associated with rooms to include.
Definition: sync_filter.hpp:110