diff options
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r-- | lib/csapi/definitions/event_filter.cpp | 37 | ||||
-rw-r--r-- | lib/csapi/definitions/event_filter.h | 32 | ||||
-rw-r--r-- | lib/csapi/definitions/room_event_filter.cpp | 31 | ||||
-rw-r--r-- | lib/csapi/definitions/room_event_filter.h | 31 | ||||
-rw-r--r-- | lib/csapi/definitions/sync_filter.cpp | 72 | ||||
-rw-r--r-- | lib/csapi/definitions/sync_filter.h | 52 |
6 files changed, 255 insertions, 0 deletions
diff --git a/lib/csapi/definitions/event_filter.cpp b/lib/csapi/definitions/event_filter.cpp new file mode 100644 index 00000000..b16b082d --- /dev/null +++ b/lib/csapi/definitions/event_filter.cpp @@ -0,0 +1,37 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "event_filter.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const Filter& pod) +{ + QJsonObject _json; + addToJson<IfNotEmpty>(_json, "limit", pod.limit); + addToJson<IfNotEmpty>(_json, "not_senders", pod.notSenders); + addToJson<IfNotEmpty>(_json, "not_types", pod.notTypes); + addToJson<IfNotEmpty>(_json, "senders", pod.senders); + addToJson<IfNotEmpty>(_json, "types", pod.types); + return _json; +} + +Filter FromJson<Filter>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + Filter result; + result.limit = + fromJson<int>(_json.value("limit")); + result.notSenders = + fromJson<QStringList>(_json.value("not_senders")); + result.notTypes = + fromJson<QStringList>(_json.value("not_types")); + result.senders = + fromJson<QStringList>(_json.value("senders")); + result.types = + fromJson<QStringList>(_json.value("types")); + + return result; +} + diff --git a/lib/csapi/definitions/event_filter.h b/lib/csapi/definitions/event_filter.h new file mode 100644 index 00000000..407ef7c5 --- /dev/null +++ b/lib/csapi/definitions/event_filter.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "converters.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct Filter + { + Omittable<int> limit; + QStringList notSenders; + QStringList notTypes; + QStringList senders; + QStringList types; + }; + + QJsonObject toJson(const Filter& pod); + + template <> struct FromJson<Filter> + { + Filter operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/csapi/definitions/room_event_filter.cpp b/lib/csapi/definitions/room_event_filter.cpp new file mode 100644 index 00000000..68e56f4c --- /dev/null +++ b/lib/csapi/definitions/room_event_filter.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "room_event_filter.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const RoomEventFilter& pod) +{ + QJsonObject _json; + addToJson<IfNotEmpty>(_json, "not_rooms", pod.notRooms); + addToJson<IfNotEmpty>(_json, "rooms", pod.rooms); + addToJson<IfNotEmpty>(_json, "contains_url", pod.containsUrl); + return _json; +} + +RoomEventFilter FromJson<RoomEventFilter>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + RoomEventFilter result; + result.notRooms = + fromJson<QStringList>(_json.value("not_rooms")); + result.rooms = + fromJson<QStringList>(_json.value("rooms")); + result.containsUrl = + fromJson<bool>(_json.value("contains_url")); + + return result; +} + diff --git a/lib/csapi/definitions/room_event_filter.h b/lib/csapi/definitions/room_event_filter.h new file mode 100644 index 00000000..b503ec3a --- /dev/null +++ b/lib/csapi/definitions/room_event_filter.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "csapi/definitions/event_filter.h" +#include "converters.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct RoomEventFilter : Filter + { + QStringList notRooms; + QStringList rooms; + bool containsUrl; + }; + + QJsonObject toJson(const RoomEventFilter& pod); + + template <> struct FromJson<RoomEventFilter> + { + RoomEventFilter operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/csapi/definitions/sync_filter.cpp b/lib/csapi/definitions/sync_filter.cpp new file mode 100644 index 00000000..7ca389b4 --- /dev/null +++ b/lib/csapi/definitions/sync_filter.cpp @@ -0,0 +1,72 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "sync_filter.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const RoomFilter& pod) +{ + QJsonObject _json; + addToJson<IfNotEmpty>(_json, "not_rooms", pod.notRooms); + addToJson<IfNotEmpty>(_json, "rooms", pod.rooms); + addToJson<IfNotEmpty>(_json, "ephemeral", pod.ephemeral); + addToJson<IfNotEmpty>(_json, "include_leave", pod.includeLeave); + addToJson<IfNotEmpty>(_json, "state", pod.state); + addToJson<IfNotEmpty>(_json, "timeline", pod.timeline); + addToJson<IfNotEmpty>(_json, "account_data", pod.accountData); + return _json; +} + +RoomFilter FromJson<RoomFilter>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + RoomFilter result; + result.notRooms = + fromJson<QStringList>(_json.value("not_rooms")); + result.rooms = + fromJson<QStringList>(_json.value("rooms")); + result.ephemeral = + fromJson<RoomEventFilter>(_json.value("ephemeral")); + result.includeLeave = + fromJson<bool>(_json.value("include_leave")); + result.state = + fromJson<RoomEventFilter>(_json.value("state")); + result.timeline = + fromJson<RoomEventFilter>(_json.value("timeline")); + result.accountData = + fromJson<RoomEventFilter>(_json.value("account_data")); + + return result; +} + +QJsonObject QMatrixClient::toJson(const SyncFilter& pod) +{ + QJsonObject _json; + addToJson<IfNotEmpty>(_json, "event_fields", pod.eventFields); + addToJson<IfNotEmpty>(_json, "event_format", pod.eventFormat); + addToJson<IfNotEmpty>(_json, "presence", pod.presence); + addToJson<IfNotEmpty>(_json, "account_data", pod.accountData); + addToJson<IfNotEmpty>(_json, "room", pod.room); + return _json; +} + +SyncFilter FromJson<SyncFilter>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + SyncFilter result; + result.eventFields = + fromJson<QStringList>(_json.value("event_fields")); + result.eventFormat = + fromJson<QString>(_json.value("event_format")); + result.presence = + fromJson<Filter>(_json.value("presence")); + result.accountData = + fromJson<Filter>(_json.value("account_data")); + result.room = + fromJson<RoomFilter>(_json.value("room")); + + return result; +} + diff --git a/lib/csapi/definitions/sync_filter.h b/lib/csapi/definitions/sync_filter.h new file mode 100644 index 00000000..f7428c0d --- /dev/null +++ b/lib/csapi/definitions/sync_filter.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "csapi/definitions/room_event_filter.h" +#include "converters.h" +#include "csapi/definitions/event_filter.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct RoomFilter + { + QStringList notRooms; + QStringList rooms; + Omittable<RoomEventFilter> ephemeral; + bool includeLeave; + Omittable<RoomEventFilter> state; + Omittable<RoomEventFilter> timeline; + Omittable<RoomEventFilter> accountData; + }; + + QJsonObject toJson(const RoomFilter& pod); + + template <> struct FromJson<RoomFilter> + { + RoomFilter operator()(const QJsonValue& jv); + }; + + struct SyncFilter + { + QStringList eventFields; + QString eventFormat; + Omittable<Filter> presence; + Omittable<Filter> accountData; + Omittable<RoomFilter> room; + }; + + QJsonObject toJson(const SyncFilter& pod); + + template <> struct FromJson<SyncFilter> + { + SyncFilter operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient |