aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r--lib/csapi/definitions/auth_data.cpp23
-rw-r--r--lib/csapi/definitions/auth_data.h20
-rw-r--r--lib/csapi/definitions/client_device.cpp23
-rw-r--r--lib/csapi/definitions/client_device.h20
-rw-r--r--lib/csapi/definitions/device_keys.cpp27
-rw-r--r--lib/csapi/definitions/device_keys.h23
-rw-r--r--lib/csapi/definitions/event_filter.cpp27
-rw-r--r--lib/csapi/definitions/event_filter.h20
-rw-r--r--lib/csapi/definitions/openid_token.h48
-rw-r--r--lib/csapi/definitions/public_rooms_response.cpp56
-rw-r--r--lib/csapi/definitions/public_rooms_response.h51
-rw-r--r--lib/csapi/definitions/push_condition.cpp25
-rw-r--r--lib/csapi/definitions/push_condition.h25
-rw-r--r--lib/csapi/definitions/push_rule.cpp28
-rw-r--r--lib/csapi/definitions/push_rule.h26
-rw-r--r--lib/csapi/definitions/push_ruleset.cpp27
-rw-r--r--lib/csapi/definitions/push_ruleset.h22
-rw-r--r--lib/csapi/definitions/request_email_validation.h48
-rw-r--r--lib/csapi/definitions/request_msisdn_validation.h48
-rw-r--r--lib/csapi/definitions/request_token_response.h45
-rw-r--r--lib/csapi/definitions/room_event_filter.cpp25
-rw-r--r--lib/csapi/definitions/room_event_filter.h38
-rw-r--r--lib/csapi/definitions/sync_filter.cpp68
-rw-r--r--lib/csapi/definitions/sync_filter.h97
-rw-r--r--lib/csapi/definitions/third_party_signed.h44
-rw-r--r--lib/csapi/definitions/user_identifier.cpp21
-rw-r--r--lib/csapi/definitions/user_identifier.h17
-rw-r--r--lib/csapi/definitions/wellknown/full.cpp24
-rw-r--r--lib/csapi/definitions/wellknown/full.h21
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.cpp19
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.h13
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.cpp19
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.h13
33 files changed, 513 insertions, 538 deletions
diff --git a/lib/csapi/definitions/auth_data.cpp b/lib/csapi/definitions/auth_data.cpp
deleted file mode 100644
index edeb7111..00000000
--- a/lib/csapi/definitions/auth_data.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "auth_data.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<AuthenticationData>::dumpTo(
- QJsonObject& jo, const AuthenticationData& pod)
-{
- fillJson(jo, pod.authInfo);
- addParam<>(jo, QStringLiteral("type"), pod.type);
- addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session);
-}
-
-void JsonObjectConverter<AuthenticationData>::fillFrom(QJsonObject jo,
- AuthenticationData& result)
-{
- fromJson(jo.take("type"_ls), result.type);
- fromJson(jo.take("session"_ls), result.session);
- fromJson(jo, result.authInfo);
-}
diff --git a/lib/csapi/definitions/auth_data.h b/lib/csapi/definitions/auth_data.h
index e564f7f3..e92596d0 100644
--- a/lib/csapi/definitions/auth_data.h
+++ b/lib/csapi/definitions/auth_data.h
@@ -6,13 +6,7 @@
#include "converters.h"
-#include <QtCore/QHash>
-#include <QtCore/QJsonObject>
-
namespace Quotient {
-
-// Data structures
-
/// Used by clients to submit authentication information to the
/// interactive-authentication API
struct AuthenticationData {
@@ -28,8 +22,18 @@ struct AuthenticationData {
template <>
struct JsonObjectConverter<AuthenticationData> {
- static void dumpTo(QJsonObject& jo, const AuthenticationData& pod);
- static void fillFrom(QJsonObject jo, AuthenticationData& pod);
+ static void dumpTo(QJsonObject& jo, const AuthenticationData& pod)
+ {
+ fillJson(jo, pod.authInfo);
+ addParam<>(jo, QStringLiteral("type"), pod.type);
+ addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session);
+ }
+ static void fillFrom(QJsonObject jo, AuthenticationData& pod)
+ {
+ fromJson(jo.take("type"_ls), pod.type);
+ fromJson(jo.take("session"_ls), pod.session);
+ fromJson(jo, pod.authInfo);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/client_device.cpp b/lib/csapi/definitions/client_device.cpp
deleted file mode 100644
index 09544138..00000000
--- a/lib/csapi/definitions/client_device.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "client_device.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<Device>::dumpTo(QJsonObject& jo, const Device& pod)
-{
- addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
- addParam<IfNotEmpty>(jo, QStringLiteral("display_name"), pod.displayName);
- addParam<IfNotEmpty>(jo, QStringLiteral("last_seen_ip"), pod.lastSeenIp);
- addParam<IfNotEmpty>(jo, QStringLiteral("last_seen_ts"), pod.lastSeenTs);
-}
-
-void JsonObjectConverter<Device>::fillFrom(const QJsonObject& jo, Device& result)
-{
- fromJson(jo.value("device_id"_ls), result.deviceId);
- fromJson(jo.value("display_name"_ls), result.displayName);
- fromJson(jo.value("last_seen_ip"_ls), result.lastSeenIp);
- fromJson(jo.value("last_seen_ts"_ls), result.lastSeenTs);
-}
diff --git a/lib/csapi/definitions/client_device.h b/lib/csapi/definitions/client_device.h
index 2cf75950..a5ab1bfc 100644
--- a/lib/csapi/definitions/client_device.h
+++ b/lib/csapi/definitions/client_device.h
@@ -7,9 +7,6 @@
#include "converters.h"
namespace Quotient {
-
-// Data structures
-
/// A client device
struct Device {
/// Identifier of this device.
@@ -31,8 +28,21 @@ struct Device {
template <>
struct JsonObjectConverter<Device> {
- static void dumpTo(QJsonObject& jo, const Device& pod);
- static void fillFrom(const QJsonObject& jo, Device& pod);
+ static void dumpTo(QJsonObject& jo, const Device& pod)
+ {
+ addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
+ addParam<IfNotEmpty>(jo, QStringLiteral("display_name"),
+ pod.displayName);
+ addParam<IfNotEmpty>(jo, QStringLiteral("last_seen_ip"), pod.lastSeenIp);
+ addParam<IfNotEmpty>(jo, QStringLiteral("last_seen_ts"), pod.lastSeenTs);
+ }
+ static void fillFrom(const QJsonObject& jo, Device& pod)
+ {
+ fromJson(jo.value("device_id"_ls), pod.deviceId);
+ fromJson(jo.value("display_name"_ls), pod.displayName);
+ fromJson(jo.value("last_seen_ip"_ls), pod.lastSeenIp);
+ fromJson(jo.value("last_seen_ts"_ls), pod.lastSeenTs);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/device_keys.cpp b/lib/csapi/definitions/device_keys.cpp
deleted file mode 100644
index 0583840d..00000000
--- a/lib/csapi/definitions/device_keys.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "device_keys.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<DeviceKeys>::dumpTo(QJsonObject& jo,
- const DeviceKeys& pod)
-{
- addParam<>(jo, QStringLiteral("user_id"), pod.userId);
- addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
- addParam<>(jo, QStringLiteral("algorithms"), pod.algorithms);
- addParam<>(jo, QStringLiteral("keys"), pod.keys);
- addParam<>(jo, QStringLiteral("signatures"), pod.signatures);
-}
-
-void JsonObjectConverter<DeviceKeys>::fillFrom(const QJsonObject& jo,
- DeviceKeys& result)
-{
- fromJson(jo.value("user_id"_ls), result.userId);
- fromJson(jo.value("device_id"_ls), result.deviceId);
- fromJson(jo.value("algorithms"_ls), result.algorithms);
- fromJson(jo.value("keys"_ls), result.keys);
- fromJson(jo.value("signatures"_ls), result.signatures);
-}
diff --git a/lib/csapi/definitions/device_keys.h b/lib/csapi/definitions/device_keys.h
index a067b4f3..3065f218 100644
--- a/lib/csapi/definitions/device_keys.h
+++ b/lib/csapi/definitions/device_keys.h
@@ -6,12 +6,7 @@
#include "converters.h"
-#include <QtCore/QHash>
-
namespace Quotient {
-
-// Data structures
-
/// Device identity keys
struct DeviceKeys {
/// The ID of the user the device belongs to. Must match the user ID used
@@ -40,8 +35,22 @@ struct DeviceKeys {
template <>
struct JsonObjectConverter<DeviceKeys> {
- static void dumpTo(QJsonObject& jo, const DeviceKeys& pod);
- static void fillFrom(const QJsonObject& jo, DeviceKeys& pod);
+ static void dumpTo(QJsonObject& jo, const DeviceKeys& pod)
+ {
+ addParam<>(jo, QStringLiteral("user_id"), pod.userId);
+ addParam<>(jo, QStringLiteral("device_id"), pod.deviceId);
+ addParam<>(jo, QStringLiteral("algorithms"), pod.algorithms);
+ addParam<>(jo, QStringLiteral("keys"), pod.keys);
+ addParam<>(jo, QStringLiteral("signatures"), pod.signatures);
+ }
+ static void fillFrom(const QJsonObject& jo, DeviceKeys& pod)
+ {
+ fromJson(jo.value("user_id"_ls), pod.userId);
+ fromJson(jo.value("device_id"_ls), pod.deviceId);
+ fromJson(jo.value("algorithms"_ls), pod.algorithms);
+ fromJson(jo.value("keys"_ls), pod.keys);
+ fromJson(jo.value("signatures"_ls), pod.signatures);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/event_filter.cpp b/lib/csapi/definitions/event_filter.cpp
deleted file mode 100644
index b21e08b5..00000000
--- a/lib/csapi/definitions/event_filter.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "event_filter.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<EventFilter>::dumpTo(QJsonObject& jo,
- const EventFilter& pod)
-{
- addParam<IfNotEmpty>(jo, QStringLiteral("limit"), pod.limit);
- addParam<IfNotEmpty>(jo, QStringLiteral("not_senders"), pod.notSenders);
- addParam<IfNotEmpty>(jo, QStringLiteral("not_types"), pod.notTypes);
- addParam<IfNotEmpty>(jo, QStringLiteral("senders"), pod.senders);
- addParam<IfNotEmpty>(jo, QStringLiteral("types"), pod.types);
-}
-
-void JsonObjectConverter<EventFilter>::fillFrom(const QJsonObject& jo,
- EventFilter& result)
-{
- fromJson(jo.value("limit"_ls), result.limit);
- fromJson(jo.value("not_senders"_ls), result.notSenders);
- fromJson(jo.value("not_types"_ls), result.notTypes);
- fromJson(jo.value("senders"_ls), result.senders);
- fromJson(jo.value("types"_ls), result.types);
-}
diff --git a/lib/csapi/definitions/event_filter.h b/lib/csapi/definitions/event_filter.h
index 3958b125..67497412 100644
--- a/lib/csapi/definitions/event_filter.h
+++ b/lib/csapi/definitions/event_filter.h
@@ -8,8 +8,6 @@
namespace Quotient {
-// Data structures
-
struct EventFilter {
/// The maximum number of events to return.
Omittable<int> limit;
@@ -37,8 +35,22 @@ struct EventFilter {
template <>
struct JsonObjectConverter<EventFilter> {
- static void dumpTo(QJsonObject& jo, const EventFilter& pod);
- static void fillFrom(const QJsonObject& jo, EventFilter& pod);
+ static void dumpTo(QJsonObject& jo, const EventFilter& pod)
+ {
+ addParam<IfNotEmpty>(jo, QStringLiteral("limit"), pod.limit);
+ addParam<IfNotEmpty>(jo, QStringLiteral("not_senders"), pod.notSenders);
+ addParam<IfNotEmpty>(jo, QStringLiteral("not_types"), pod.notTypes);
+ addParam<IfNotEmpty>(jo, QStringLiteral("senders"), pod.senders);
+ addParam<IfNotEmpty>(jo, QStringLiteral("types"), pod.types);
+ }
+ static void fillFrom(const QJsonObject& jo, EventFilter& pod)
+ {
+ fromJson(jo.value("limit"_ls), pod.limit);
+ fromJson(jo.value("not_senders"_ls), pod.notSenders);
+ fromJson(jo.value("not_types"_ls), pod.notTypes);
+ fromJson(jo.value("senders"_ls), pod.senders);
+ fromJson(jo.value("types"_ls), pod.types);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/openid_token.h b/lib/csapi/definitions/openid_token.h
new file mode 100644
index 00000000..5e68c376
--- /dev/null
+++ b/lib/csapi/definitions/openid_token.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+
+struct OpenidToken {
+ /// An access token the consumer may use to verify the identity of
+ /// the person who generated the token. This is given to the federation
+ /// API ``GET /openid/userinfo`` to verify the user's identity.
+ QString accessToken;
+
+ /// The string ``Bearer``.
+ QString tokenType;
+
+ /// The homeserver domain the consumer should use when attempting to
+ /// verify the user's identity.
+ QString matrixServerName;
+
+ /// The number of seconds before this token expires and a new one must
+ /// be generated.
+ int expiresIn;
+};
+
+template <>
+struct JsonObjectConverter<OpenidToken> {
+ static void dumpTo(QJsonObject& jo, const OpenidToken& pod)
+ {
+ addParam<>(jo, QStringLiteral("access_token"), pod.accessToken);
+ addParam<>(jo, QStringLiteral("token_type"), pod.tokenType);
+ addParam<>(jo, QStringLiteral("matrix_server_name"),
+ pod.matrixServerName);
+ addParam<>(jo, QStringLiteral("expires_in"), pod.expiresIn);
+ }
+ static void fillFrom(const QJsonObject& jo, OpenidToken& pod)
+ {
+ fromJson(jo.value("access_token"_ls), pod.accessToken);
+ fromJson(jo.value("token_type"_ls), pod.tokenType);
+ fromJson(jo.value("matrix_server_name"_ls), pod.matrixServerName);
+ fromJson(jo.value("expires_in"_ls), pod.expiresIn);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/public_rooms_response.cpp b/lib/csapi/definitions/public_rooms_response.cpp
deleted file mode 100644
index b6009718..00000000
--- a/lib/csapi/definitions/public_rooms_response.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "public_rooms_response.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<PublicRoomsChunk>::dumpTo(QJsonObject& jo,
- const PublicRoomsChunk& pod)
-{
- addParam<IfNotEmpty>(jo, QStringLiteral("aliases"), pod.aliases);
- addParam<IfNotEmpty>(jo, QStringLiteral("canonical_alias"),
- pod.canonicalAlias);
- addParam<IfNotEmpty>(jo, QStringLiteral("name"), pod.name);
- addParam<>(jo, QStringLiteral("num_joined_members"), pod.numJoinedMembers);
- addParam<>(jo, QStringLiteral("room_id"), pod.roomId);
- addParam<IfNotEmpty>(jo, QStringLiteral("topic"), pod.topic);
- addParam<>(jo, QStringLiteral("world_readable"), pod.worldReadable);
- addParam<>(jo, QStringLiteral("guest_can_join"), pod.guestCanJoin);
- addParam<IfNotEmpty>(jo, QStringLiteral("avatar_url"), pod.avatarUrl);
-}
-
-void JsonObjectConverter<PublicRoomsChunk>::fillFrom(const QJsonObject& jo,
- PublicRoomsChunk& result)
-{
- fromJson(jo.value("aliases"_ls), result.aliases);
- fromJson(jo.value("canonical_alias"_ls), result.canonicalAlias);
- fromJson(jo.value("name"_ls), result.name);
- fromJson(jo.value("num_joined_members"_ls), result.numJoinedMembers);
- fromJson(jo.value("room_id"_ls), result.roomId);
- fromJson(jo.value("topic"_ls), result.topic);
- fromJson(jo.value("world_readable"_ls), result.worldReadable);
- fromJson(jo.value("guest_can_join"_ls), result.guestCanJoin);
- fromJson(jo.value("avatar_url"_ls), result.avatarUrl);
-}
-
-void JsonObjectConverter<PublicRoomsResponse>::dumpTo(
- QJsonObject& jo, const PublicRoomsResponse& pod)
-{
- addParam<>(jo, QStringLiteral("chunk"), pod.chunk);
- addParam<IfNotEmpty>(jo, QStringLiteral("next_batch"), pod.nextBatch);
- addParam<IfNotEmpty>(jo, QStringLiteral("prev_batch"), pod.prevBatch);
- addParam<IfNotEmpty>(jo, QStringLiteral("total_room_count_estimate"),
- pod.totalRoomCountEstimate);
-}
-
-void JsonObjectConverter<PublicRoomsResponse>::fillFrom(
- const QJsonObject& jo, PublicRoomsResponse& result)
-{
- fromJson(jo.value("chunk"_ls), result.chunk);
- fromJson(jo.value("next_batch"_ls), result.nextBatch);
- fromJson(jo.value("prev_batch"_ls), result.prevBatch);
- fromJson(jo.value("total_room_count_estimate"_ls),
- result.totalRoomCountEstimate);
-}
diff --git a/lib/csapi/definitions/public_rooms_response.h b/lib/csapi/definitions/public_rooms_response.h
index 36aa52b9..8f30e607 100644
--- a/lib/csapi/definitions/public_rooms_response.h
+++ b/lib/csapi/definitions/public_rooms_response.h
@@ -6,12 +6,8 @@
#include "converters.h"
-#include <QtCore/QVector>
-
namespace Quotient {
-// Data structures
-
struct PublicRoomsChunk {
/// Aliases of the room. May be empty.
QStringList aliases;
@@ -45,9 +41,34 @@ struct PublicRoomsChunk {
template <>
struct JsonObjectConverter<PublicRoomsChunk> {
- static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod);
- static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod);
+ static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod)
+ {
+ addParam<IfNotEmpty>(jo, QStringLiteral("aliases"), pod.aliases);
+ addParam<IfNotEmpty>(jo, QStringLiteral("canonical_alias"),
+ pod.canonicalAlias);
+ addParam<IfNotEmpty>(jo, QStringLiteral("name"), pod.name);
+ addParam<>(jo, QStringLiteral("num_joined_members"),
+ pod.numJoinedMembers);
+ addParam<>(jo, QStringLiteral("room_id"), pod.roomId);
+ addParam<IfNotEmpty>(jo, QStringLiteral("topic"), pod.topic);
+ addParam<>(jo, QStringLiteral("world_readable"), pod.worldReadable);
+ addParam<>(jo, QStringLiteral("guest_can_join"), pod.guestCanJoin);
+ addParam<IfNotEmpty>(jo, QStringLiteral("avatar_url"), pod.avatarUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod)
+ {
+ fromJson(jo.value("aliases"_ls), pod.aliases);
+ fromJson(jo.value("canonical_alias"_ls), pod.canonicalAlias);
+ fromJson(jo.value("name"_ls), pod.name);
+ fromJson(jo.value("num_joined_members"_ls), pod.numJoinedMembers);
+ fromJson(jo.value("room_id"_ls), pod.roomId);
+ fromJson(jo.value("topic"_ls), pod.topic);
+ fromJson(jo.value("world_readable"_ls), pod.worldReadable);
+ fromJson(jo.value("guest_can_join"_ls), pod.guestCanJoin);
+ fromJson(jo.value("avatar_url"_ls), pod.avatarUrl);
+ }
};
+
/// A list of the rooms on the server.
struct PublicRoomsResponse {
/// A paginated chunk of public rooms.
@@ -70,8 +91,22 @@ struct PublicRoomsResponse {
template <>
struct JsonObjectConverter<PublicRoomsResponse> {
- static void dumpTo(QJsonObject& jo, const PublicRoomsResponse& pod);
- static void fillFrom(const QJsonObject& jo, PublicRoomsResponse& pod);
+ static void dumpTo(QJsonObject& jo, const PublicRoomsResponse& pod)
+ {
+ addParam<>(jo, QStringLiteral("chunk"), pod.chunk);
+ addParam<IfNotEmpty>(jo, QStringLiteral("next_batch"), pod.nextBatch);
+ addParam<IfNotEmpty>(jo, QStringLiteral("prev_batch"), pod.prevBatch);
+ addParam<IfNotEmpty>(jo, QStringLiteral("total_room_count_estimate"),
+ pod.totalRoomCountEstimate);
+ }
+ static void fillFrom(const QJsonObject& jo, PublicRoomsResponse& pod)
+ {
+ fromJson(jo.value("chunk"_ls), pod.chunk);
+ fromJson(jo.value("next_batch"_ls), pod.nextBatch);
+ fromJson(jo.value("prev_batch"_ls), pod.prevBatch);
+ fromJson(jo.value("total_room_count_estimate"_ls),
+ pod.totalRoomCountEstimate);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/push_condition.cpp b/lib/csapi/definitions/push_condition.cpp
deleted file mode 100644
index 343b4f1a..00000000
--- a/lib/csapi/definitions/push_condition.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_condition.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<PushCondition>::dumpTo(QJsonObject& jo,
- const PushCondition& pod)
-{
- addParam<>(jo, QStringLiteral("kind"), pod.kind);
- addParam<IfNotEmpty>(jo, QStringLiteral("key"), pod.key);
- addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
- addParam<IfNotEmpty>(jo, QStringLiteral("is"), pod.is);
-}
-
-void JsonObjectConverter<PushCondition>::fillFrom(const QJsonObject& jo,
- PushCondition& result)
-{
- fromJson(jo.value("kind"_ls), result.kind);
- fromJson(jo.value("key"_ls), result.key);
- fromJson(jo.value("pattern"_ls), result.pattern);
- fromJson(jo.value("is"_ls), result.is);
-}
diff --git a/lib/csapi/definitions/push_condition.h b/lib/csapi/definitions/push_condition.h
index 189153b3..a6decf1b 100644
--- a/lib/csapi/definitions/push_condition.h
+++ b/lib/csapi/definitions/push_condition.h
@@ -8,13 +8,18 @@
namespace Quotient {
-// Data structures
-
struct PushCondition {
+ /// The kind of condition to apply. See `conditions <#conditions>`_ for
+ /// more information on the allowed kinds and how they work.
QString kind;
/// Required for ``event_match`` conditions. The dot-separated field of the
/// event to match.
+ ///
+ /// Required for ``sender_notification_permission`` conditions. The field in
+ /// the power level event the user needs a minimum power level for. Fields
+ /// must be specified under the ``notifications`` property in the power
+ /// level event's ``content``.
QString key;
/// Required for ``event_match`` conditions. The glob-style pattern to
@@ -32,8 +37,20 @@ struct PushCondition {
template <>
struct JsonObjectConverter<PushCondition> {
- static void dumpTo(QJsonObject& jo, const PushCondition& pod);
- static void fillFrom(const QJsonObject& jo, PushCondition& pod);
+ static void dumpTo(QJsonObject& jo, const PushCondition& pod)
+ {
+ addParam<>(jo, QStringLiteral("kind"), pod.kind);
+ addParam<IfNotEmpty>(jo, QStringLiteral("key"), pod.key);
+ addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
+ addParam<IfNotEmpty>(jo, QStringLiteral("is"), pod.is);
+ }
+ static void fillFrom(const QJsonObject& jo, PushCondition& pod)
+ {
+ fromJson(jo.value("kind"_ls), pod.kind);
+ fromJson(jo.value("key"_ls), pod.key);
+ fromJson(jo.value("pattern"_ls), pod.pattern);
+ fromJson(jo.value("is"_ls), pod.is);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/push_rule.cpp b/lib/csapi/definitions/push_rule.cpp
deleted file mode 100644
index eae7e446..00000000
--- a/lib/csapi/definitions/push_rule.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_rule.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<PushRule>::dumpTo(QJsonObject& jo, const PushRule& pod)
-{
- addParam<>(jo, QStringLiteral("actions"), pod.actions);
- addParam<>(jo, QStringLiteral("default"), pod.isDefault);
- addParam<>(jo, QStringLiteral("enabled"), pod.enabled);
- addParam<>(jo, QStringLiteral("rule_id"), pod.ruleId);
- addParam<IfNotEmpty>(jo, QStringLiteral("conditions"), pod.conditions);
- addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
-}
-
-void JsonObjectConverter<PushRule>::fillFrom(const QJsonObject& jo,
- PushRule& result)
-{
- fromJson(jo.value("actions"_ls), result.actions);
- fromJson(jo.value("default"_ls), result.isDefault);
- fromJson(jo.value("enabled"_ls), result.enabled);
- fromJson(jo.value("rule_id"_ls), result.ruleId);
- fromJson(jo.value("conditions"_ls), result.conditions);
- fromJson(jo.value("pattern"_ls), result.pattern);
-}
diff --git a/lib/csapi/definitions/push_rule.h b/lib/csapi/definitions/push_rule.h
index c09d063f..43749bae 100644
--- a/lib/csapi/definitions/push_rule.h
+++ b/lib/csapi/definitions/push_rule.h
@@ -8,14 +8,8 @@
#include "csapi/definitions/push_condition.h"
-#include <QtCore/QJsonObject>
-#include <QtCore/QVariant>
-#include <QtCore/QVector>
-
namespace Quotient {
-// Data structures
-
struct PushRule {
/// The actions to perform when this rule is matched.
QVector<QVariant> actions;
@@ -41,8 +35,24 @@ struct PushRule {
template <>
struct JsonObjectConverter<PushRule> {
- static void dumpTo(QJsonObject& jo, const PushRule& pod);
- static void fillFrom(const QJsonObject& jo, PushRule& pod);
+ static void dumpTo(QJsonObject& jo, const PushRule& pod)
+ {
+ addParam<>(jo, QStringLiteral("actions"), pod.actions);
+ addParam<>(jo, QStringLiteral("default"), pod.isDefault);
+ addParam<>(jo, QStringLiteral("enabled"), pod.enabled);
+ addParam<>(jo, QStringLiteral("rule_id"), pod.ruleId);
+ addParam<IfNotEmpty>(jo, QStringLiteral("conditions"), pod.conditions);
+ addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
+ }
+ static void fillFrom(const QJsonObject& jo, PushRule& pod)
+ {
+ fromJson(jo.value("actions"_ls), pod.actions);
+ fromJson(jo.value("default"_ls), pod.isDefault);
+ fromJson(jo.value("enabled"_ls), pod.enabled);
+ fromJson(jo.value("rule_id"_ls), pod.ruleId);
+ fromJson(jo.value("conditions"_ls), pod.conditions);
+ fromJson(jo.value("pattern"_ls), pod.pattern);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/push_ruleset.cpp b/lib/csapi/definitions/push_ruleset.cpp
deleted file mode 100644
index a2db35d9..00000000
--- a/lib/csapi/definitions/push_ruleset.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_ruleset.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<PushRuleset>::dumpTo(QJsonObject& jo,
- const PushRuleset& pod)
-{
- addParam<IfNotEmpty>(jo, QStringLiteral("content"), pod.content);
- addParam<IfNotEmpty>(jo, QStringLiteral("override"), pod.override);
- addParam<IfNotEmpty>(jo, QStringLiteral("room"), pod.room);
- addParam<IfNotEmpty>(jo, QStringLiteral("sender"), pod.sender);
- addParam<IfNotEmpty>(jo, QStringLiteral("underride"), pod.underride);
-}
-
-void JsonObjectConverter<PushRuleset>::fillFrom(const QJsonObject& jo,
- PushRuleset& result)
-{
- fromJson(jo.value("content"_ls), result.content);
- fromJson(jo.value("override"_ls), result.override);
- fromJson(jo.value("room"_ls), result.room);
- fromJson(jo.value("sender"_ls), result.sender);
- fromJson(jo.value("underride"_ls), result.underride);
-}
diff --git a/lib/csapi/definitions/push_ruleset.h b/lib/csapi/definitions/push_ruleset.h
index 98a21408..ba780a33 100644
--- a/lib/csapi/definitions/push_ruleset.h
+++ b/lib/csapi/definitions/push_ruleset.h
@@ -8,12 +8,8 @@
#include "csapi/definitions/push_rule.h"
-#include <QtCore/QVector>
-
namespace Quotient {
-// Data structures
-
struct PushRuleset {
QVector<PushRule> content;
@@ -28,8 +24,22 @@ struct PushRuleset {
template <>
struct JsonObjectConverter<PushRuleset> {
- static void dumpTo(QJsonObject& jo, const PushRuleset& pod);
- static void fillFrom(const QJsonObject& jo, PushRuleset& pod);
+ static void dumpTo(QJsonObject& jo, const PushRuleset& pod)
+ {
+ addParam<IfNotEmpty>(jo, QStringLiteral("content"), pod.content);
+ addParam<IfNotEmpty>(jo, QStringLiteral("override"), pod.override);
+ addParam<IfNotEmpty>(jo, QStringLiteral("room"), pod.room);
+ addParam<IfNotEmpty>(jo, QStringLiteral("sender"), pod.sender);
+ addParam<IfNotEmpty>(jo, QStringLiteral("underride"), pod.underride);
+ }
+ static void fillFrom(const QJsonObject& jo, PushRuleset& pod)
+ {
+ fromJson(jo.value("content"_ls), pod.content);
+ fromJson(jo.value("override"_ls), pod.override);
+ fromJson(jo.value("room"_ls), pod.room);
+ fromJson(jo.value("sender"_ls), pod.sender);
+ fromJson(jo.value("underride"_ls), pod.underride);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/request_email_validation.h b/lib/csapi/definitions/request_email_validation.h
new file mode 100644
index 00000000..e6ab261d
--- /dev/null
+++ b/lib/csapi/definitions/request_email_validation.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+#include "csapi/./definitions/../../identity/definitions/request_email_validation.h"
+
+namespace Quotient {
+
+struct EmailValidationData : RequestEmailValidation {
+ /// The hostname of the identity server to communicate with. May optionally
+ /// include a port. This parameter is ignored when the homeserver handles
+ /// 3PID verification.
+ ///
+ /// This parameter is deprecated with a plan to be removed in a future
+ /// specification version for ``/account/password`` and ``/register``
+ /// requests.
+ QString idServer;
+
+ /// An access token previously registered with the identity server. Servers
+ /// can treat this as optional to distinguish between r0.5-compatible
+ /// clients and this specification version.
+ ///
+ /// Required if an ``id_server`` is supplied.
+ QString idAccessToken;
+};
+
+template <>
+struct JsonObjectConverter<EmailValidationData> {
+ static void dumpTo(QJsonObject& jo, const EmailValidationData& pod)
+ {
+ fillJson<RequestEmailValidation>(jo, pod);
+ addParam<IfNotEmpty>(jo, QStringLiteral("id_server"), pod.idServer);
+ addParam<IfNotEmpty>(jo, QStringLiteral("id_access_token"),
+ pod.idAccessToken);
+ }
+ static void fillFrom(const QJsonObject& jo, EmailValidationData& pod)
+ {
+ fillFromJson<RequestEmailValidation>(jo, pod);
+ fromJson(jo.value("id_server"_ls), pod.idServer);
+ fromJson(jo.value("id_access_token"_ls), pod.idAccessToken);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/request_msisdn_validation.h b/lib/csapi/definitions/request_msisdn_validation.h
new file mode 100644
index 00000000..6f161f00
--- /dev/null
+++ b/lib/csapi/definitions/request_msisdn_validation.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+#include "csapi/./definitions/../../identity/definitions/request_msisdn_validation.h"
+
+namespace Quotient {
+
+struct MsisdnValidationData : RequestMsisdnValidation {
+ /// The hostname of the identity server to communicate with. May optionally
+ /// include a port. This parameter is ignored when the homeserver handles
+ /// 3PID verification.
+ ///
+ /// This parameter is deprecated with a plan to be removed in a future
+ /// specification version for ``/account/password`` and ``/register``
+ /// requests.
+ QString idServer;
+
+ /// An access token previously registered with the identity server. Servers
+ /// can treat this as optional to distinguish between r0.5-compatible
+ /// clients and this specification version.
+ ///
+ /// Required if an ``id_server`` is supplied.
+ QString idAccessToken;
+};
+
+template <>
+struct JsonObjectConverter<MsisdnValidationData> {
+ static void dumpTo(QJsonObject& jo, const MsisdnValidationData& pod)
+ {
+ fillJson<RequestMsisdnValidation>(jo, pod);
+ addParam<IfNotEmpty>(jo, QStringLiteral("id_server"), pod.idServer);
+ addParam<IfNotEmpty>(jo, QStringLiteral("id_access_token"),
+ pod.idAccessToken);
+ }
+ static void fillFrom(const QJsonObject& jo, MsisdnValidationData& pod)
+ {
+ fillFromJson<RequestMsisdnValidation>(jo, pod);
+ fromJson(jo.value("id_server"_ls), pod.idServer);
+ fromJson(jo.value("id_access_token"_ls), pod.idAccessToken);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/request_token_response.h b/lib/csapi/definitions/request_token_response.h
new file mode 100644
index 00000000..00222839
--- /dev/null
+++ b/lib/csapi/definitions/request_token_response.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+
+struct RequestTokenResponse {
+ /// The session ID. Session IDs are opaque strings that must consist
+ /// entirely of the characters ``[0-9a-zA-Z.=_-]``. Their length must not
+ /// exceed 255 characters and they must not be empty.
+ QString sid;
+
+ /// An optional field containing a URL where the client must submit the
+ /// validation token to, with identical parameters to the Identity Service
+ /// API's ``POST /validate/email/submitToken`` endpoint (without the
+ /// requirement for an access token). The homeserver must send this token to
+ /// the user (if applicable), who should then be prompted to provide it to
+ /// the client.
+ ///
+ /// If this field is not present, the client can assume that verification
+ /// will happen without the client's involvement provided the homeserver
+ /// advertises this specification version in the ``/versions`` response
+ /// (ie: r0.5.0).
+ QString submitUrl;
+};
+
+template <>
+struct JsonObjectConverter<RequestTokenResponse> {
+ static void dumpTo(QJsonObject& jo, const RequestTokenResponse& pod)
+ {
+ addParam<>(jo, QStringLiteral("sid"), pod.sid);
+ addParam<IfNotEmpty>(jo, QStringLiteral("submit_url"), pod.submitUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, RequestTokenResponse& pod)
+ {
+ fromJson(jo.value("sid"_ls), pod.sid);
+ fromJson(jo.value("submit_url"_ls), pod.submitUrl);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/room_event_filter.cpp b/lib/csapi/definitions/room_event_filter.cpp
deleted file mode 100644
index 5613d8d2..00000000
--- a/lib/csapi/definitions/room_event_filter.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "room_event_filter.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<RoomEventFilter>::dumpTo(QJsonObject& jo,
- const RoomEventFilter& pod)
-{
- fillJson<EventFilter>(jo, pod);
- addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
- addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
- addParam<IfNotEmpty>(jo, QStringLiteral("contains_url"), pod.containsUrl);
-}
-
-void JsonObjectConverter<RoomEventFilter>::fillFrom(const QJsonObject& jo,
- RoomEventFilter& result)
-{
- fillFromJson<EventFilter>(jo, result);
- fromJson(jo.value("not_rooms"_ls), result.notRooms);
- fromJson(jo.value("rooms"_ls), result.rooms);
- fromJson(jo.value("contains_url"_ls), result.containsUrl);
-}
diff --git a/lib/csapi/definitions/room_event_filter.h b/lib/csapi/definitions/room_event_filter.h
index 756f9ada..11e87fde 100644
--- a/lib/csapi/definitions/room_event_filter.h
+++ b/lib/csapi/definitions/room_event_filter.h
@@ -10,9 +10,19 @@
namespace Quotient {
-// Data structures
-
struct RoomEventFilter : EventFilter {
+ /// If ``true``, enables lazy-loading of membership events. See
+ /// `Lazy-loading room members <#lazy-loading-room-members>`_
+ /// for more information. Defaults to ``false``.
+ Omittable<bool> lazyLoadMembers;
+
+ /// If ``true``, sends all membership events for all events, even if they
+ /// have already been sent to the client. Does not apply unless
+ /// ``lazy_load_members`` is ``true``. See `Lazy-loading room members
+ /// <#lazy-loading-room-members>`_ for more information. Defaults to
+ /// ``false``.
+ Omittable<bool> includeRedundantMembers;
+
/// 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.
@@ -30,8 +40,28 @@ struct RoomEventFilter : EventFilter {
template <>
struct JsonObjectConverter<RoomEventFilter> {
- static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod);
- static void fillFrom(const QJsonObject& jo, RoomEventFilter& pod);
+ static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod)
+ {
+ fillJson<EventFilter>(jo, pod);
+ addParam<IfNotEmpty>(jo, QStringLiteral("lazy_load_members"),
+ pod.lazyLoadMembers);
+ addParam<IfNotEmpty>(jo, QStringLiteral("include_redundant_members"),
+ pod.includeRedundantMembers);
+ addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
+ addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
+ addParam<IfNotEmpty>(jo, QStringLiteral("contains_url"),
+ pod.containsUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, RoomEventFilter& pod)
+ {
+ fillFromJson<EventFilter>(jo, pod);
+ fromJson(jo.value("lazy_load_members"_ls), pod.lazyLoadMembers);
+ fromJson(jo.value("include_redundant_members"_ls),
+ pod.includeRedundantMembers);
+ fromJson(jo.value("not_rooms"_ls), pod.notRooms);
+ fromJson(jo.value("rooms"_ls), pod.rooms);
+ fromJson(jo.value("contains_url"_ls), pod.containsUrl);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/sync_filter.cpp b/lib/csapi/definitions/sync_filter.cpp
deleted file mode 100644
index 15c4bdc1..00000000
--- a/lib/csapi/definitions/sync_filter.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "sync_filter.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<StateFilter>::dumpTo(QJsonObject& jo,
- const StateFilter& pod)
-{
- fillJson<RoomEventFilter>(jo, pod);
- addParam<IfNotEmpty>(jo, QStringLiteral("lazy_load_members"),
- pod.lazyLoadMembers);
- addParam<IfNotEmpty>(jo, QStringLiteral("include_redundant_members"),
- pod.includeRedundantMembers);
-}
-
-void JsonObjectConverter<StateFilter>::fillFrom(const QJsonObject& jo,
- StateFilter& result)
-{
- fillFromJson<RoomEventFilter>(jo, result);
- fromJson(jo.value("lazy_load_members"_ls), result.lazyLoadMembers);
- fromJson(jo.value("include_redundant_members"_ls),
- result.includeRedundantMembers);
-}
-
-void JsonObjectConverter<RoomFilter>::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);
-}
-
-void JsonObjectConverter<RoomFilter>::fillFrom(const QJsonObject& jo,
- RoomFilter& result)
-{
- fromJson(jo.value("not_rooms"_ls), result.notRooms);
- fromJson(jo.value("rooms"_ls), result.rooms);
- fromJson(jo.value("ephemeral"_ls), result.ephemeral);
- fromJson(jo.value("include_leave"_ls), result.includeLeave);
- fromJson(jo.value("state"_ls), result.state);
- fromJson(jo.value("timeline"_ls), result.timeline);
- fromJson(jo.value("account_data"_ls), result.accountData);
-}
-
-void JsonObjectConverter<Filter>::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);
-}
-
-void JsonObjectConverter<Filter>::fillFrom(const QJsonObject& jo, Filter& result)
-{
- fromJson(jo.value("event_fields"_ls), result.eventFields);
- fromJson(jo.value("event_format"_ls), result.eventFormat);
- fromJson(jo.value("presence"_ls), result.presence);
- fromJson(jo.value("account_data"_ls), result.accountData);
- fromJson(jo.value("room"_ls), result.room);
-}
diff --git a/lib/csapi/definitions/sync_filter.h b/lib/csapi/definitions/sync_filter.h
index ad8d055d..9c8f08d5 100644
--- a/lib/csapi/definitions/sync_filter.h
+++ b/lib/csapi/definitions/sync_filter.h
@@ -10,40 +10,6 @@
#include "csapi/definitions/room_event_filter.h"
namespace Quotient {
-
-// Data structures
-
-/// The state events to include for rooms.
-struct StateFilter : RoomEventFilter {
- /// If ``true``, the only ``m.room.member`` events returned in
- /// the ``state`` section of the ``/sync`` response are those
- /// which are definitely necessary for a client to display
- /// the ``sender`` of the timeline events in that response.
- /// If ``false``, ``m.room.member`` events are not filtered.
- /// By default, servers should suppress duplicate redundant
- /// lazy-loaded ``m.room.member`` events from being sent to a given
- /// client across multiple calls to ``/sync``, given that most clients
- /// cache membership events (see ``include_redundant_members``
- /// to change this behaviour).
- Omittable<bool> lazyLoadMembers;
-
- /// If ``true``, the ``state`` section of the ``/sync`` response will
- /// always contain the ``m.room.member`` events required to display
- /// the ``sender`` of the timeline events in that response, assuming
- /// ``lazy_load_members`` is enabled. This means that redundant
- /// duplicate member events may be returned across multiple calls to
- /// ``/sync``. This is useful for naive clients who never track
- /// membership data. If ``false``, duplicate ``m.room.member`` events
- /// may be suppressed by the server across multiple calls to ``/sync``.
- /// If ``lazy_load_members`` is ``false`` this field is ignored.
- Omittable<bool> includeRedundantMembers;
-};
-
-template <>
-struct JsonObjectConverter<StateFilter> {
- static void dumpTo(QJsonObject& jo, const StateFilter& pod);
- static void fillFrom(const QJsonObject& jo, StateFilter& pod);
-};
/// 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
@@ -59,30 +25,50 @@ struct RoomFilter {
/// The events that aren't recorded in the room history, e.g. typing and
/// receipts, to include for rooms.
- Omittable<RoomEventFilter> ephemeral;
+ RoomEventFilter ephemeral;
/// Include rooms that the user has left in the sync, default false
Omittable<bool> includeLeave;
/// The state events to include for rooms.
- Omittable<StateFilter> state;
+ RoomEventFilter state;
/// The message and state update events to include for rooms.
- Omittable<RoomEventFilter> timeline;
+ RoomEventFilter timeline;
/// The per user account data to include for rooms.
- Omittable<RoomEventFilter> accountData;
+ RoomEventFilter accountData;
};
template <>
struct JsonObjectConverter<RoomFilter> {
- static void dumpTo(QJsonObject& jo, const RoomFilter& pod);
- static void fillFrom(const QJsonObject& jo, RoomFilter& pod);
+ 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 '.' charaters to indicate
+ /// 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.
@@ -90,23 +76,40 @@ struct Filter {
/// The format to use for events. 'client' will return the events in a
/// format suitable for clients. 'federation' will return the raw event as
- /// receieved over federation. The default is 'client'.
+ /// received over federation. The default is 'client'.
QString eventFormat;
/// The presence updates to include.
- Omittable<EventFilter> presence;
+ EventFilter presence;
/// The user account data that isn't associated with rooms to include.
- Omittable<EventFilter> accountData;
+ EventFilter accountData;
/// Filters to be applied to room data.
- Omittable<RoomFilter> room;
+ RoomFilter room;
};
template <>
struct JsonObjectConverter<Filter> {
- static void dumpTo(QJsonObject& jo, const Filter& pod);
- static void fillFrom(const QJsonObject& jo, Filter& pod);
+ 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
diff --git a/lib/csapi/definitions/third_party_signed.h b/lib/csapi/definitions/third_party_signed.h
new file mode 100644
index 00000000..526545d0
--- /dev/null
+++ b/lib/csapi/definitions/third_party_signed.h
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+/// A signature of an ``m.third_party_invite`` token to prove that this user
+/// owns a third party identity which has been invited to the room.
+struct ThirdPartySigned {
+ /// The Matrix ID of the user who issued the invite.
+ QString sender;
+
+ /// The Matrix ID of the invitee.
+ QString mxid;
+
+ /// The state key of the m.third_party_invite event.
+ QString token;
+
+ /// A signatures object containing a signature of the entire signed object.
+ QHash<QString, QHash<QString, QString>> signatures;
+};
+
+template <>
+struct JsonObjectConverter<ThirdPartySigned> {
+ static void dumpTo(QJsonObject& jo, const ThirdPartySigned& pod)
+ {
+ addParam<>(jo, QStringLiteral("sender"), pod.sender);
+ addParam<>(jo, QStringLiteral("mxid"), pod.mxid);
+ addParam<>(jo, QStringLiteral("token"), pod.token);
+ addParam<>(jo, QStringLiteral("signatures"), pod.signatures);
+ }
+ static void fillFrom(const QJsonObject& jo, ThirdPartySigned& pod)
+ {
+ fromJson(jo.value("sender"_ls), pod.sender);
+ fromJson(jo.value("mxid"_ls), pod.mxid);
+ fromJson(jo.value("token"_ls), pod.token);
+ fromJson(jo.value("signatures"_ls), pod.signatures);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/user_identifier.cpp b/lib/csapi/definitions/user_identifier.cpp
deleted file mode 100644
index 9e9b4fe9..00000000
--- a/lib/csapi/definitions/user_identifier.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "user_identifier.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<UserIdentifier>::dumpTo(QJsonObject& jo,
- const UserIdentifier& pod)
-{
- fillJson(jo, pod.additionalProperties);
- addParam<>(jo, QStringLiteral("type"), pod.type);
-}
-
-void JsonObjectConverter<UserIdentifier>::fillFrom(QJsonObject jo,
- UserIdentifier& result)
-{
- fromJson(jo.take("type"_ls), result.type);
- fromJson(jo, result.additionalProperties);
-}
diff --git a/lib/csapi/definitions/user_identifier.h b/lib/csapi/definitions/user_identifier.h
index 72a81677..dadf6f97 100644
--- a/lib/csapi/definitions/user_identifier.h
+++ b/lib/csapi/definitions/user_identifier.h
@@ -6,12 +6,7 @@
#include "converters.h"
-#include <QtCore/QVariant>
-
namespace Quotient {
-
-// Data structures
-
/// Identification information for a user
struct UserIdentifier {
/// The type of identification. See `Identifier types`_ for supported
@@ -24,8 +19,16 @@ struct UserIdentifier {
template <>
struct JsonObjectConverter<UserIdentifier> {
- static void dumpTo(QJsonObject& jo, const UserIdentifier& pod);
- static void fillFrom(QJsonObject jo, UserIdentifier& pod);
+ static void dumpTo(QJsonObject& jo, const UserIdentifier& pod)
+ {
+ fillJson(jo, pod.additionalProperties);
+ addParam<>(jo, QStringLiteral("type"), pod.type);
+ }
+ static void fillFrom(QJsonObject jo, UserIdentifier& pod)
+ {
+ fromJson(jo.take("type"_ls), pod.type);
+ fromJson(jo, pod.additionalProperties);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/wellknown/full.cpp b/lib/csapi/definitions/wellknown/full.cpp
deleted file mode 100644
index 595db0e5..00000000
--- a/lib/csapi/definitions/wellknown/full.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "full.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<DiscoveryInformation>::dumpTo(
- QJsonObject& jo, const DiscoveryInformation& pod)
-{
- fillJson(jo, pod.additionalProperties);
- addParam<>(jo, QStringLiteral("m.homeserver"), pod.homeserver);
- addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"),
- pod.identityServer);
-}
-
-void JsonObjectConverter<DiscoveryInformation>::fillFrom(
- QJsonObject jo, DiscoveryInformation& result)
-{
- fromJson(jo.take("m.homeserver"_ls), result.homeserver);
- fromJson(jo.take("m.identity_server"_ls), result.identityServer);
- fromJson(jo, result.additionalProperties);
-}
diff --git a/lib/csapi/definitions/wellknown/full.h b/lib/csapi/definitions/wellknown/full.h
index 88d7da79..a0ef2076 100644
--- a/lib/csapi/definitions/wellknown/full.h
+++ b/lib/csapi/definitions/wellknown/full.h
@@ -9,13 +9,7 @@
#include "csapi/definitions/wellknown/homeserver.h"
#include "csapi/definitions/wellknown/identity_server.h"
-#include <QtCore/QHash>
-#include <QtCore/QJsonObject>
-
namespace Quotient {
-
-// Data structures
-
/// Used by clients to determine the homeserver, identity server, and other
/// optional components they should be interacting with.
struct DiscoveryInformation {
@@ -33,8 +27,19 @@ struct DiscoveryInformation {
template <>
struct JsonObjectConverter<DiscoveryInformation> {
- static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod);
- static void fillFrom(QJsonObject jo, DiscoveryInformation& pod);
+ static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod)
+ {
+ fillJson(jo, pod.additionalProperties);
+ addParam<>(jo, QStringLiteral("m.homeserver"), pod.homeserver);
+ addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"),
+ pod.identityServer);
+ }
+ static void fillFrom(QJsonObject jo, DiscoveryInformation& pod)
+ {
+ fromJson(jo.take("m.homeserver"_ls), pod.homeserver);
+ fromJson(jo.take("m.identity_server"_ls), pod.identityServer);
+ fromJson(jo, pod.additionalProperties);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/wellknown/homeserver.cpp b/lib/csapi/definitions/wellknown/homeserver.cpp
deleted file mode 100644
index 7b87aa95..00000000
--- a/lib/csapi/definitions/wellknown/homeserver.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "homeserver.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<HomeserverInformation>::dumpTo(
- QJsonObject& jo, const HomeserverInformation& pod)
-{
- addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
-}
-
-void JsonObjectConverter<HomeserverInformation>::fillFrom(
- const QJsonObject& jo, HomeserverInformation& result)
-{
- fromJson(jo.value("base_url"_ls), result.baseUrl);
-}
diff --git a/lib/csapi/definitions/wellknown/homeserver.h b/lib/csapi/definitions/wellknown/homeserver.h
index 7607c8b5..5cfaca24 100644
--- a/lib/csapi/definitions/wellknown/homeserver.h
+++ b/lib/csapi/definitions/wellknown/homeserver.h
@@ -7,9 +7,6 @@
#include "converters.h"
namespace Quotient {
-
-// Data structures
-
/// Used by clients to discover homeserver information.
struct HomeserverInformation {
/// The base URL for the homeserver for client-server connections.
@@ -18,8 +15,14 @@ struct HomeserverInformation {
template <>
struct JsonObjectConverter<HomeserverInformation> {
- static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod);
- static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod);
+ static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod)
+ {
+ addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod)
+ {
+ fromJson(jo.value("base_url"_ls), pod.baseUrl);
+ }
};
} // namespace Quotient
diff --git a/lib/csapi/definitions/wellknown/identity_server.cpp b/lib/csapi/definitions/wellknown/identity_server.cpp
deleted file mode 100644
index 3b2a5720..00000000
--- a/lib/csapi/definitions/wellknown/identity_server.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "identity_server.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<IdentityServerInformation>::dumpTo(
- QJsonObject& jo, const IdentityServerInformation& pod)
-{
- addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
-}
-
-void JsonObjectConverter<IdentityServerInformation>::fillFrom(
- const QJsonObject& jo, IdentityServerInformation& result)
-{
- fromJson(jo.value("base_url"_ls), result.baseUrl);
-}
diff --git a/lib/csapi/definitions/wellknown/identity_server.h b/lib/csapi/definitions/wellknown/identity_server.h
index d272e527..3bd07bd1 100644
--- a/lib/csapi/definitions/wellknown/identity_server.h
+++ b/lib/csapi/definitions/wellknown/identity_server.h
@@ -7,9 +7,6 @@
#include "converters.h"
namespace Quotient {
-
-// Data structures
-
/// Used by clients to discover identity server information.
struct IdentityServerInformation {
/// The base URL for the identity server for client-server connections.
@@ -18,8 +15,14 @@ struct IdentityServerInformation {
template <>
struct JsonObjectConverter<IdentityServerInformation> {
- static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod);
- static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod);
+ static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod)
+ {
+ addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod)
+ {
+ fromJson(jo.value("base_url"_ls), pod.baseUrl);
+ }
};
} // namespace Quotient