1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/******************************************************************************
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#pragma once
#include "converters.h"
#include "csapi/definitions/event_filter.h"
#include "csapi/definitions/room_event_filter.h"
namespace Quotient {
/// Filters to be applied to room data.
struct RoomFilter {
/// A list of room IDs to exclude. If this list is absent then no rooms are
/// excluded. A matching room will be excluded even if it is listed in the
/// `'rooms'` filter. This filter is applied before the filters in
/// `ephemeral`, `state`, `timeline` or `account_data`
QStringList notRooms;
/// A list of room IDs to include. If this list is absent then all rooms are
/// included. This filter is applied before the filters in `ephemeral`,
/// `state`, `timeline` or `account_data`
QStringList rooms;
/// The events that aren't recorded in the room history, e.g. typing and
/// receipts, to include for rooms.
RoomEventFilter ephemeral;
/// Include rooms that the user has left in the sync, default false
Omittable<bool> includeLeave;
/// The state events to include for rooms.
RoomEventFilter state;
/// The message and state update events to include for rooms.
RoomEventFilter timeline;
/// The per user account data to include for rooms.
RoomEventFilter accountData;
};
template <>
struct JsonObjectConverter<RoomFilter> {
static void dumpTo(QJsonObject& jo, const RoomFilter& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
addParam<IfNotEmpty>(jo, QStringLiteral("ephemeral"), pod.ephemeral);
addParam<IfNotEmpty>(jo, QStringLiteral("include_leave"),
pod.includeLeave);
addParam<IfNotEmpty>(jo, QStringLiteral("state"), pod.state);
addParam<IfNotEmpty>(jo, QStringLiteral("timeline"), pod.timeline);
addParam<IfNotEmpty>(jo, QStringLiteral("account_data"),
pod.accountData);
}
static void fillFrom(const QJsonObject& jo, RoomFilter& pod)
{
fromJson(jo.value("not_rooms"_ls), pod.notRooms);
fromJson(jo.value("rooms"_ls), pod.rooms);
fromJson(jo.value("ephemeral"_ls), pod.ephemeral);
fromJson(jo.value("include_leave"_ls), pod.includeLeave);
fromJson(jo.value("state"_ls), pod.state);
fromJson(jo.value("timeline"_ls), pod.timeline);
fromJson(jo.value("account_data"_ls), pod.accountData);
}
};
struct Filter {
/// List of event fields to include. If this list is absent then all fields
/// are included. The entries may include '.' characters to indicate
/// sub-fields. So ['content.body'] will include the 'body' field of the
/// 'content' object. A literal '.' character in a field name may be escaped
/// using a '\\'. A server may include more fields than were requested.
QStringList eventFields;
/// The format to use for events. 'client' will return the events in a
/// format suitable for clients. 'federation' will return the raw event as
/// received over federation. The default is 'client'.
QString eventFormat;
/// The presence updates to include.
EventFilter presence;
/// The user account data that isn't associated with rooms to include.
EventFilter accountData;
/// Filters to be applied to room data.
RoomFilter room;
};
template <>
struct JsonObjectConverter<Filter> {
static void dumpTo(QJsonObject& jo, const Filter& pod)
{
addParam<IfNotEmpty>(jo, QStringLiteral("event_fields"),
pod.eventFields);
addParam<IfNotEmpty>(jo, QStringLiteral("event_format"),
pod.eventFormat);
addParam<IfNotEmpty>(jo, QStringLiteral("presence"), pod.presence);
addParam<IfNotEmpty>(jo, QStringLiteral("account_data"),
pod.accountData);
addParam<IfNotEmpty>(jo, QStringLiteral("room"), pod.room);
}
static void fillFrom(const QJsonObject& jo, Filter& pod)
{
fromJson(jo.value("event_fields"_ls), pod.eventFields);
fromJson(jo.value("event_format"_ls), pod.eventFormat);
fromJson(jo.value("presence"_ls), pod.presence);
fromJson(jo.value("account_data"_ls), pod.accountData);
fromJson(jo.value("room"_ls), pod.room);
}
};
} // namespace Quotient
|