libkazv
Loading...
Searching...
No Matches
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
11namespace Kazv::Api {
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}
39namespace nlohmann
40{
41using namespace Kazv;
42using namespace Kazv::Api;
43template<>
44struct 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
97struct Filter
98{
99
101 immer::array<std::string> eventFields;
102
104 std::optional<std::string> eventFormat;
105
108
111
114};
115
116}
117namespace nlohmann
118{
119using namespace Kazv;
120using namespace Kazv::Api;
121template<>
122struct 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
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 sync_filter.hpp:98
EventFilter presence
The presence updates to include.
Definition sync_filter.hpp:107
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
RoomFilter room
Filters to be applied to room data.
Definition sync_filter.hpp:113
EventFilter accountData
The user account data that isn't associated with rooms to include.
Definition sync_filter.hpp:110
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
Definition room_event_filter.hpp:13
Filters to be applied to room data.
Definition sync_filter.hpp:14
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:23
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:17
RoomEventFilter state
The state events to include for rooms.
Definition sync_filter.hpp:29
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:20
RoomEventFilter accountData
The per user account data to include for rooms.
Definition sync_filter.hpp:35
RoomEventFilter timeline
The message and state update events to include for rooms.
Definition sync_filter.hpp:32
std::optional< bool > includeLeave
Include rooms that the user has left in the sync, default false.
Definition sync_filter.hpp:26
static void to_json(json &jo, const Filter &pod)
Definition sync_filter.hpp:123
static void from_json(const json &jo, Filter &result)
Definition sync_filter.hpp:139
static void from_json(const json &jo, RoomFilter &result)
Definition sync_filter.hpp:65
static void to_json(json &jo, const RoomFilter &pod)
Definition sync_filter.hpp:45