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.cpp28
-rw-r--r--lib/csapi/definitions/auth_data.h54
-rw-r--r--lib/csapi/definitions/client_device.cpp33
-rw-r--r--lib/csapi/definitions/client_device.h67
-rw-r--r--lib/csapi/definitions/cross_signing_key.h47
-rw-r--r--lib/csapi/definitions/device_keys.cpp36
-rw-r--r--lib/csapi/definitions/device_keys.h81
-rw-r--r--lib/csapi/definitions/event_filter.cpp36
-rw-r--r--lib/csapi/definitions/event_filter.h72
-rw-r--r--lib/csapi/definitions/openid_token.h48
-rw-r--r--lib/csapi/definitions/public_rooms_response.cpp73
-rw-r--r--lib/csapi/definitions/public_rooms_response.h119
-rw-r--r--lib/csapi/definitions/push_condition.cpp33
-rw-r--r--lib/csapi/definitions/push_condition.h74
-rw-r--r--lib/csapi/definitions/push_rule.cpp39
-rw-r--r--lib/csapi/definitions/push_rule.h77
-rw-r--r--lib/csapi/definitions/push_ruleset.cpp36
-rw-r--r--lib/csapi/definitions/push_ruleset.h50
-rw-r--r--lib/csapi/definitions/request_email_validation.h47
-rw-r--r--lib/csapi/definitions/request_msisdn_validation.h47
-rw-r--r--lib/csapi/definitions/request_token_response.h45
-rw-r--r--lib/csapi/definitions/room_event_filter.cpp30
-rw-r--r--lib/csapi/definitions/room_event_filter.h80
-rw-r--r--lib/csapi/definitions/sync_filter.cpp70
-rw-r--r--lib/csapi/definitions/sync_filter.h145
-rw-r--r--lib/csapi/definitions/third_party_signed.h44
-rw-r--r--lib/csapi/definitions/user_identifier.cpp25
-rw-r--r--lib/csapi/definitions/user_identifier.h40
-rw-r--r--lib/csapi/definitions/wellknown/full.h45
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.cpp24
-rw-r--r--lib/csapi/definitions/wellknown/homeserver.h34
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.cpp24
-rw-r--r--lib/csapi/definitions/wellknown/identity_server.h34
33 files changed, 885 insertions, 852 deletions
diff --git a/lib/csapi/definitions/auth_data.cpp b/lib/csapi/definitions/auth_data.cpp
deleted file mode 100644
index f8639432..00000000
--- a/lib/csapi/definitions/auth_data.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "auth_data.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const AuthenticationData& pod)
-{
- QJsonObject jo = toJson(pod.authInfo);
- addParam<>(jo, QStringLiteral("type"), pod.type);
- addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session);
- return jo;
-}
-
-AuthenticationData FromJsonObject<AuthenticationData>::operator()(QJsonObject jo) const
-{
- AuthenticationData result;
- result.type =
- fromJson<QString>(jo.take("type"_ls));
- result.session =
- fromJson<QString>(jo.take("session"_ls));
-
- result.authInfo = fromJson<QHash<QString, QJsonObject>>(jo);
- return result;
-}
-
diff --git a/lib/csapi/definitions/auth_data.h b/lib/csapi/definitions/auth_data.h
index 661d3e5f..a9972323 100644
--- a/lib/csapi/definitions/auth_data.h
+++ b/lib/csapi/definitions/auth_data.h
@@ -6,29 +6,37 @@
#include "converters.h"
-#include <QtCore/QJsonObject>
-#include <QtCore/QHash>
-
-namespace QMatrixClient
-{
- // Data structures
-
- /// Used by clients to submit authentication information to the interactive-authentication API
- struct AuthenticationData
+namespace Quotient {
+/// Used by clients to submit authentication information to the
+/// interactive-authentication API
+struct AuthenticationData {
+ /// The authentication type that the client is attempting to complete.
+ /// May be omitted if `session` is given, and the client is reissuing a
+ /// request which it believes has been completed out-of-band (for example,
+ /// via the [fallback mechanism](#fallback)).
+ QString type;
+
+ /// The value of the session key given by the homeserver.
+ QString session;
+
+ /// Keys dependent on the login type
+ QHash<QString, QJsonObject> authInfo;
+};
+
+template <>
+struct JsonObjectConverter<AuthenticationData> {
+ static void dumpTo(QJsonObject& jo, const AuthenticationData& pod)
{
- /// The login type that the client is attempting to complete.
- QString type;
- /// The value of the session key given by the homeserver.
- QString session;
- /// Keys dependent on the login type
- QHash<QString, QJsonObject> authInfo;
- };
-
- QJsonObject toJson(const AuthenticationData& pod);
-
- template <> struct FromJsonObject<AuthenticationData>
+ fillJson(jo, pod.authInfo);
+ addParam<IfNotEmpty>(jo, QStringLiteral("type"), pod.type);
+ addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session);
+ }
+ static void fillFrom(QJsonObject jo, AuthenticationData& pod)
{
- AuthenticationData operator()(QJsonObject jo) const;
- };
+ fromJson(jo.take("type"_ls), pod.type);
+ fromJson(jo.take("session"_ls), pod.session);
+ fromJson(jo, pod.authInfo);
+ }
+};
-} // namespace QMatrixClient
+} // namespace Quotient
diff --git a/lib/csapi/definitions/client_device.cpp b/lib/csapi/definitions/client_device.cpp
deleted file mode 100644
index 4a192f85..00000000
--- a/lib/csapi/definitions/client_device.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "client_device.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const Device& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-Device FromJsonObject<Device>::operator()(const QJsonObject& jo) const
-{
- Device result;
- result.deviceId =
- fromJson<QString>(jo.value("device_id"_ls));
- result.displayName =
- fromJson<QString>(jo.value("display_name"_ls));
- result.lastSeenIp =
- fromJson<QString>(jo.value("last_seen_ip"_ls));
- result.lastSeenTs =
- fromJson<qint64>(jo.value("last_seen_ts"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/client_device.h b/lib/csapi/definitions/client_device.h
index 9f10888a..a5ab1bfc 100644
--- a/lib/csapi/definitions/client_device.h
+++ b/lib/csapi/definitions/client_device.h
@@ -6,34 +6,43 @@
#include "converters.h"
-#include "converters.h"
-
-namespace QMatrixClient
-{
- // Data structures
-
- /// A client device
- struct Device
+namespace Quotient {
+/// A client device
+struct Device {
+ /// Identifier of this device.
+ QString deviceId;
+
+ /// Display name set by the user for this device. Absent if no name has been
+ /// set.
+ QString displayName;
+
+ /// The IP address where this device was last seen. (May be a few minutes
+ /// out of date, for efficiency reasons).
+ QString lastSeenIp;
+
+ /// The timestamp (in milliseconds since the unix epoch) when this devices
+ /// was last seen. (May be a few minutes out of date, for efficiency
+ /// reasons).
+ Omittable<qint64> lastSeenTs;
+};
+
+template <>
+struct JsonObjectConverter<Device> {
+ static void dumpTo(QJsonObject& jo, const Device& pod)
{
- /// Identifier of this device.
- QString deviceId;
- /// Display name set by the user for this device. Absent if no name has been
- /// set.
- QString displayName;
- /// The IP address where this device was last seen. (May be a few minutes out
- /// of date, for efficiency reasons).
- QString lastSeenIp;
- /// The timestamp (in milliseconds since the unix epoch) when this devices
- /// was last seen. (May be a few minutes out of date, for efficiency
- /// reasons).
- Omittable<qint64> lastSeenTs;
- };
-
- QJsonObject toJson(const Device& pod);
-
- template <> struct FromJsonObject<Device>
+ 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)
{
- Device operator()(const QJsonObject& jo) const;
- };
-
-} // namespace QMatrixClient
+ 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/cross_signing_key.h b/lib/csapi/definitions/cross_signing_key.h
new file mode 100644
index 00000000..0cec8161
--- /dev/null
+++ b/lib/csapi/definitions/cross_signing_key.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+/// Cross signing key
+struct CrossSigningKey {
+ /// The ID of the user the key belongs to.
+ QString userId;
+
+ /// What the key is used for.
+ QStringList usage;
+
+ /// The public key. The object must have exactly one property, whose name
+ /// is in the form `<algorithm>:<unpadded_base64_public_key>`, and whose
+ /// value is the unpadded base64 public key.
+ QHash<QString, QString> keys;
+
+ /// Signatures of the key, calculated using the process described at
+ /// [Signing JSON](/appendices/#signing-json). Optional for the master key.
+ /// Other keys must be signed by the user\'s master key.
+ QJsonObject signatures;
+};
+
+template <>
+struct JsonObjectConverter<CrossSigningKey> {
+ static void dumpTo(QJsonObject& jo, const CrossSigningKey& pod)
+ {
+ addParam<>(jo, QStringLiteral("user_id"), pod.userId);
+ addParam<>(jo, QStringLiteral("usage"), pod.usage);
+ addParam<>(jo, QStringLiteral("keys"), pod.keys);
+ addParam<IfNotEmpty>(jo, QStringLiteral("signatures"), pod.signatures);
+ }
+ static void fillFrom(const QJsonObject& jo, CrossSigningKey& pod)
+ {
+ fromJson(jo.value("user_id"_ls), pod.userId);
+ fromJson(jo.value("usage"_ls), pod.usage);
+ fromJson(jo.value("keys"_ls), pod.keys);
+ fromJson(jo.value("signatures"_ls), pod.signatures);
+ }
+};
+
+} // namespace Quotient
diff --git a/lib/csapi/definitions/device_keys.cpp b/lib/csapi/definitions/device_keys.cpp
deleted file mode 100644
index a0e0ca42..00000000
--- a/lib/csapi/definitions/device_keys.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "device_keys.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const DeviceKeys& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-DeviceKeys FromJsonObject<DeviceKeys>::operator()(const QJsonObject& jo) const
-{
- DeviceKeys result;
- result.userId =
- fromJson<QString>(jo.value("user_id"_ls));
- result.deviceId =
- fromJson<QString>(jo.value("device_id"_ls));
- result.algorithms =
- fromJson<QStringList>(jo.value("algorithms"_ls));
- result.keys =
- fromJson<QHash<QString, QString>>(jo.value("keys"_ls));
- result.signatures =
- fromJson<QHash<QString, QHash<QString, QString>>>(jo.value("signatures"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/device_keys.h b/lib/csapi/definitions/device_keys.h
index 6023e7e8..84ecefae 100644
--- a/lib/csapi/definitions/device_keys.h
+++ b/lib/csapi/definitions/device_keys.h
@@ -6,40 +6,51 @@
#include "converters.h"
-#include <QtCore/QHash>
-
-namespace QMatrixClient
-{
- // Data structures
-
- /// Device identity keys
- struct DeviceKeys
+namespace Quotient {
+/// Device identity keys
+struct DeviceKeys {
+ /// The ID of the user the device belongs to. Must match the user ID used
+ /// when logging in.
+ QString userId;
+
+ /// The ID of the device these keys belong to. Must match the device ID used
+ /// when logging in.
+ QString deviceId;
+
+ /// The encryption algorithms supported by this device.
+ QStringList algorithms;
+
+ /// Public identity keys. The names of the properties should be in the
+ /// format `<algorithm>:<device_id>`. The keys themselves should be
+ /// encoded as specified by the key algorithm.
+ QHash<QString, QString> keys;
+
+ /// Signatures for the device key object. A map from user ID, to a map from
+ /// `<algorithm>:<device_id>` to the signature.
+ ///
+ /// The signature is calculated using the process described at [Signing
+ /// JSON](/appendices/#signing-json).
+ QHash<QString, QHash<QString, QString>> signatures;
+};
+
+template <>
+struct JsonObjectConverter<DeviceKeys> {
+ static void dumpTo(QJsonObject& jo, const DeviceKeys& pod)
{
- /// The ID of the user the device belongs to. Must match the user ID used
- /// when logging in.
- QString userId;
- /// The ID of the device these keys belong to. Must match the device ID used
- /// when logging in.
- QString deviceId;
- /// The encryption algorithms supported by this device.
- QStringList algorithms;
- /// Public identity keys. The names of the properties should be in the
- /// format ``<algorithm>:<device_id>``. The keys themselves should be
- /// encoded as specified by the key algorithm.
- QHash<QString, QString> keys;
- /// Signatures for the device key object. A map from user ID, to a map from
- /// ``<algorithm>:<device_id>`` to the signature.
- ///
- /// The signature is calculated using the process described at `Signing
- /// JSON`_.
- QHash<QString, QHash<QString, QString>> signatures;
- };
-
- QJsonObject toJson(const DeviceKeys& pod);
-
- template <> struct FromJsonObject<DeviceKeys>
+ 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)
{
- DeviceKeys operator()(const QJsonObject& jo) const;
- };
-
-} // namespace QMatrixClient
+ 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 cc444db0..00000000
--- a/lib/csapi/definitions/event_filter.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "event_filter.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const EventFilter& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-EventFilter FromJsonObject<EventFilter>::operator()(const QJsonObject& jo) const
-{
- EventFilter result;
- result.limit =
- fromJson<int>(jo.value("limit"_ls));
- result.notSenders =
- fromJson<QStringList>(jo.value("not_senders"_ls));
- result.notTypes =
- fromJson<QStringList>(jo.value("not_types"_ls));
- result.senders =
- fromJson<QStringList>(jo.value("senders"_ls));
- result.types =
- fromJson<QStringList>(jo.value("types"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/event_filter.h b/lib/csapi/definitions/event_filter.h
index 5c6a5b27..c55d4f92 100644
--- a/lib/csapi/definitions/event_filter.h
+++ b/lib/csapi/definitions/event_filter.h
@@ -6,31 +6,51 @@
#include "converters.h"
-#include "converters.h"
-
-namespace QMatrixClient
-{
- // Data structures
-
- struct EventFilter
+namespace Quotient {
+
+struct EventFilter {
+ /// The maximum number of events to return.
+ Omittable<int> limit;
+
+ /// A list of sender IDs to exclude. If this list is absent then no senders
+ /// are excluded. A matching sender will be excluded even if it is listed in
+ /// the `'senders'` filter.
+ QStringList notSenders;
+
+ /// A list of event types to exclude. If this list is absent then no event
+ /// types are excluded. A matching type will be excluded even if it is
+ /// listed in the `'types'` filter. A '*' can be used as a wildcard to match
+ /// any sequence of characters.
+ QStringList notTypes;
+
+ /// A list of senders IDs to include. If this list is absent then all
+ /// senders are included.
+ QStringList senders;
+
+ /// A list of event types to include. If this list is absent then all event
+ /// types are included. A `'*'` can be used as a wildcard to match any
+ /// sequence of characters.
+ QStringList types;
+};
+
+template <>
+struct JsonObjectConverter<EventFilter> {
+ static void dumpTo(QJsonObject& jo, const EventFilter& pod)
{
- /// The maximum number of events to return.
- Omittable<int> limit;
- /// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the ``'senders'`` filter.
- QStringList notSenders;
- /// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the ``'types'`` filter. A '*' can be used as a wildcard to match any sequence of characters.
- QStringList notTypes;
- /// A list of senders IDs to include. If this list is absent then all senders are included.
- QStringList senders;
- /// A list of event types to include. If this list is absent then all event types are included. A ``'*'`` can be used as a wildcard to match any sequence of characters.
- QStringList types;
- };
-
- QJsonObject toJson(const EventFilter& pod);
-
- template <> struct FromJsonObject<EventFilter>
+ 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)
{
- EventFilter operator()(const QJsonObject& jo) const;
- };
-
-} // namespace QMatrixClient
+ 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..9b026dea
--- /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 OpenIdCredentials {
+ /// 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<OpenIdCredentials> {
+ static void dumpTo(QJsonObject& jo, const OpenIdCredentials& 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, OpenIdCredentials& 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 2f52501d..00000000
--- a/lib/csapi/definitions/public_rooms_response.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "public_rooms_response.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const PublicRoomsChunk& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-PublicRoomsChunk FromJsonObject<PublicRoomsChunk>::operator()(const QJsonObject& jo) const
-{
- PublicRoomsChunk result;
- result.aliases =
- fromJson<QStringList>(jo.value("aliases"_ls));
- result.canonicalAlias =
- fromJson<QString>(jo.value("canonical_alias"_ls));
- result.name =
- fromJson<QString>(jo.value("name"_ls));
- result.numJoinedMembers =
- fromJson<int>(jo.value("num_joined_members"_ls));
- result.roomId =
- fromJson<QString>(jo.value("room_id"_ls));
- result.topic =
- fromJson<QString>(jo.value("topic"_ls));
- result.worldReadable =
- fromJson<bool>(jo.value("world_readable"_ls));
- result.guestCanJoin =
- fromJson<bool>(jo.value("guest_can_join"_ls));
- result.avatarUrl =
- fromJson<QString>(jo.value("avatar_url"_ls));
-
- return result;
-}
-
-QJsonObject QMatrixClient::toJson(const PublicRoomsResponse& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-PublicRoomsResponse FromJsonObject<PublicRoomsResponse>::operator()(const QJsonObject& jo) const
-{
- PublicRoomsResponse result;
- result.chunk =
- fromJson<QVector<PublicRoomsChunk>>(jo.value("chunk"_ls));
- result.nextBatch =
- fromJson<QString>(jo.value("next_batch"_ls));
- result.prevBatch =
- fromJson<QString>(jo.value("prev_batch"_ls));
- result.totalRoomCountEstimate =
- fromJson<int>(jo.value("total_room_count_estimate"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/public_rooms_response.h b/lib/csapi/definitions/public_rooms_response.h
index 88c805ba..7c7d9cc6 100644
--- a/lib/csapi/definitions/public_rooms_response.h
+++ b/lib/csapi/definitions/public_rooms_response.h
@@ -6,67 +6,76 @@
#include "converters.h"
-#include <QtCore/QVector>
-#include "converters.h"
+namespace Quotient {
-namespace QMatrixClient
-{
- // Data structures
+struct PublicRoomsChunk {
+ /// The canonical alias of the room, if any.
+ QString canonicalAlias;
- struct PublicRoomsChunk
- {
- /// Aliases of the room. May be empty.
- QStringList aliases;
- /// The canonical alias of the room, if any.
- QString canonicalAlias;
- /// The name of the room, if any.
- QString name;
- /// The number of members joined to the room.
- int numJoinedMembers;
- /// The ID of the room.
- QString roomId;
- /// The topic of the room, if any.
- QString topic;
- /// Whether the room may be viewed by guest users without joining.
- bool worldReadable;
- /// Whether guest users may join the room and participate in it.
- /// If they can, they will be subject to ordinary power level
- /// rules like any other user.
- bool guestCanJoin;
- /// The URL for the room's avatar, if one is set.
- QString avatarUrl;
- };
+ /// The name of the room, if any.
+ QString name;
- QJsonObject toJson(const PublicRoomsChunk& pod);
+ /// The number of members joined to the room.
+ int numJoinedMembers;
- template <> struct FromJsonObject<PublicRoomsChunk>
- {
- PublicRoomsChunk operator()(const QJsonObject& jo) const;
- };
+ /// The ID of the room.
+ QString roomId;
- /// A list of the rooms on the server.
- struct PublicRoomsResponse
- {
- /// A paginated chunk of public rooms.
- QVector<PublicRoomsChunk> chunk;
- /// A pagination token for the response. The absence of this token
- /// means there are no more results to fetch and the client should
- /// stop paginating.
- QString nextBatch;
- /// A pagination token that allows fetching previous results. The
- /// absence of this token means there are no results before this
- /// batch, i.e. this is the first batch.
- QString prevBatch;
- /// An estimate on the total number of public rooms, if the
- /// server has an estimate.
- Omittable<int> totalRoomCountEstimate;
- };
+ /// The topic of the room, if any.
+ QString topic;
+
+ /// Whether the room may be viewed by guest users without joining.
+ bool worldReadable;
- QJsonObject toJson(const PublicRoomsResponse& pod);
+ /// Whether guest users may join the room and participate in it.
+ /// If they can, they will be subject to ordinary power level
+ /// rules like any other user.
+ bool guestCanJoin;
- template <> struct FromJsonObject<PublicRoomsResponse>
+ /// The URL for the room's avatar, if one is set.
+ QUrl avatarUrl;
+
+ /// The `type` of room (from
+ /// [`m.room.create`](/client-server-api/#mroomcreate)), if any.
+ QString roomType;
+
+ /// The room's join rule. When not present, the room is assumed to
+ /// be `public`. Note that rooms with `invite` join rules are not
+ /// expected here, but rooms with `knock` rules are given their
+ /// near-public nature.
+ QString joinRule;
+};
+
+template <>
+struct JsonObjectConverter<PublicRoomsChunk> {
+ static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod)
+ {
+ 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);
+ addParam<IfNotEmpty>(jo, QStringLiteral("room_type"), pod.roomType);
+ addParam<IfNotEmpty>(jo, QStringLiteral("join_rule"), pod.joinRule);
+ }
+ static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod)
{
- PublicRoomsResponse operator()(const QJsonObject& jo) const;
- };
+ 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);
+ fromJson(jo.value("room_type"_ls), pod.roomType);
+ fromJson(jo.value("join_rule"_ls), pod.joinRule);
+ }
+};
-} // namespace QMatrixClient
+} // namespace Quotient
diff --git a/lib/csapi/definitions/push_condition.cpp b/lib/csapi/definitions/push_condition.cpp
deleted file mode 100644
index 045094bc..00000000
--- a/lib/csapi/definitions/push_condition.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_condition.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const PushCondition& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-PushCondition FromJsonObject<PushCondition>::operator()(const QJsonObject& jo) const
-{
- PushCondition result;
- result.kind =
- fromJson<QString>(jo.value("kind"_ls));
- result.key =
- fromJson<QString>(jo.value("key"_ls));
- result.pattern =
- fromJson<QString>(jo.value("pattern"_ls));
- result.is =
- fromJson<QString>(jo.value("is"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/push_condition.h b/lib/csapi/definitions/push_condition.h
index defcebb3..6a048ba8 100644
--- a/lib/csapi/definitions/push_condition.h
+++ b/lib/csapi/definitions/push_condition.h
@@ -6,34 +6,50 @@
#include "converters.h"
-
-namespace QMatrixClient
-{
- // Data structures
-
- struct PushCondition
+namespace Quotient {
+
+struct PushCondition {
+ /// The kind of condition to apply. See
+ /// [conditions](/client-server-api/#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
+ /// match against.
+ QString pattern;
+
+ /// Required for `room_member_count` conditions. A decimal integer
+ /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
+ /// rooms where the member count is strictly less than the given number and
+ /// so forth. If no prefix is present, this parameter defaults to ==.
+ QString is;
+};
+
+template <>
+struct JsonObjectConverter<PushCondition> {
+ static void dumpTo(QJsonObject& jo, const PushCondition& pod)
{
- QString kind;
- /// Required for ``event_match`` conditions. The dot-separated field of the
- /// event to match.
- QString key;
- /// Required for ``event_match`` conditions. The glob-style pattern to
- /// match against. Patterns with no special glob characters should be
- /// treated as having asterisks prepended and appended when testing the
- /// condition.
- QString pattern;
- /// Required for ``room_member_count`` conditions. A decimal integer
- /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
- /// rooms where the member count is strictly less than the given number and
- /// so forth. If no prefix is present, this parameter defaults to ==.
- QString is;
- };
-
- QJsonObject toJson(const PushCondition& pod);
-
- template <> struct FromJsonObject<PushCondition>
+ 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)
{
- PushCondition operator()(const QJsonObject& jo) const;
- };
-
-} // namespace QMatrixClient
+ 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 baddd187..00000000
--- a/lib/csapi/definitions/push_rule.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_rule.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const PushRule& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-PushRule FromJsonObject<PushRule>::operator()(const QJsonObject& jo) const
-{
- PushRule result;
- result.actions =
- fromJson<QVector<QVariant>>(jo.value("actions"_ls));
- result.isDefault =
- fromJson<bool>(jo.value("default"_ls));
- result.enabled =
- fromJson<bool>(jo.value("enabled"_ls));
- result.ruleId =
- fromJson<QString>(jo.value("rule_id"_ls));
- result.conditions =
- fromJson<QVector<PushCondition>>(jo.value("conditions"_ls));
- result.pattern =
- fromJson<QString>(jo.value("pattern"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/push_rule.h b/lib/csapi/definitions/push_rule.h
index 5f52876d..135537c1 100644
--- a/lib/csapi/definitions/push_rule.h
+++ b/lib/csapi/definitions/push_rule.h
@@ -7,39 +7,52 @@
#include "converters.h"
#include "csapi/definitions/push_condition.h"
-#include "converters.h"
-#include <QtCore/QVector>
-#include <QtCore/QVariant>
-#include <QtCore/QJsonObject>
-namespace QMatrixClient
-{
- // Data structures
+namespace Quotient {
+
+struct PushRule {
+ /// The actions to perform when this rule is matched.
+ QVector<QVariant> actions;
+
+ /// Whether this is a default rule, or has been set explicitly.
+ bool isDefault;
+
+ /// Whether the push rule is enabled or not.
+ bool enabled;
- struct PushRule
+ /// The ID of this rule.
+ QString ruleId;
+
+ /// The conditions that must hold true for an event in order for a rule to
+ /// be applied to an event. A rule with no conditions always matches. Only
+ /// applicable to `underride` and `override` rules.
+ QVector<PushCondition> conditions;
+
+ /// The glob-style pattern to match against. Only applicable to `content`
+ /// rules.
+ QString pattern;
+};
+
+template <>
+struct JsonObjectConverter<PushRule> {
+ static void dumpTo(QJsonObject& jo, const PushRule& pod)
{
- /// The actions to perform when this rule is matched.
- QVector<QVariant> actions;
- /// Whether this is a default rule, or has been set explicitly.
- bool isDefault;
- /// Whether the push rule is enabled or not.
- bool enabled;
- /// The ID of this rule.
- QString ruleId;
- /// The conditions that must hold true for an event in order for a rule to be
- /// applied to an event. A rule with no conditions always matches. Only
- /// applicable to ``underride`` and ``override`` rules.
- QVector<PushCondition> conditions;
- /// The glob-style pattern to match against. Only applicable to ``content``
- /// rules.
- QString pattern;
- };
-
- QJsonObject toJson(const PushRule& pod);
-
- template <> struct FromJsonObject<PushRule>
+ 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)
{
- PushRule operator()(const QJsonObject& jo) const;
- };
-
-} // namespace QMatrixClient
+ 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 14b7a4b6..00000000
--- a/lib/csapi/definitions/push_ruleset.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "push_ruleset.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const PushRuleset& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-PushRuleset FromJsonObject<PushRuleset>::operator()(const QJsonObject& jo) const
-{
- PushRuleset result;
- result.content =
- fromJson<QVector<PushRule>>(jo.value("content"_ls));
- result.override =
- fromJson<QVector<PushRule>>(jo.value("override"_ls));
- result.room =
- fromJson<QVector<PushRule>>(jo.value("room"_ls));
- result.sender =
- fromJson<QVector<PushRule>>(jo.value("sender"_ls));
- result.underride =
- fromJson<QVector<PushRule>>(jo.value("underride"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/push_ruleset.h b/lib/csapi/definitions/push_ruleset.h
index a274b72a..ba780a33 100644
--- a/lib/csapi/definitions/push_ruleset.h
+++ b/lib/csapi/definitions/push_ruleset.h
@@ -6,28 +6,40 @@
#include "converters.h"
-#include <QtCore/QVector>
-#include "converters.h"
#include "csapi/definitions/push_rule.h"
-namespace QMatrixClient
-{
- // Data structures
+namespace Quotient {
- struct PushRuleset
- {
- QVector<PushRule> content;
- QVector<PushRule> override;
- QVector<PushRule> room;
- QVector<PushRule> sender;
- QVector<PushRule> underride;
- };
+struct PushRuleset {
+ QVector<PushRule> content;
- QJsonObject toJson(const PushRuleset& pod);
+ QVector<PushRule> override;
- template <> struct FromJsonObject<PushRuleset>
- {
- PushRuleset operator()(const QJsonObject& jo) const;
- };
+ QVector<PushRule> room;
+
+ QVector<PushRule> sender;
-} // namespace QMatrixClient
+ QVector<PushRule> underride;
+};
+
+template <>
+struct JsonObjectConverter<PushRuleset> {
+ 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..b1781e27
--- /dev/null
+++ b/lib/csapi/definitions/request_email_validation.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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..4600b48c
--- /dev/null
+++ b/lib/csapi/definitions/request_msisdn_validation.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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..d5fbbadb
--- /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).
+ QUrl 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 f6f1e5cb..00000000
--- a/lib/csapi/definitions/room_event_filter.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "room_event_filter.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const RoomEventFilter& pod)
-{
- QJsonObject jo;
- addParam<IfNotEmpty>(jo, QStringLiteral("not_rooms"), pod.notRooms);
- addParam<IfNotEmpty>(jo, QStringLiteral("rooms"), pod.rooms);
- addParam<IfNotEmpty>(jo, QStringLiteral("contains_url"), pod.containsUrl);
- return jo;
-}
-
-RoomEventFilter FromJsonObject<RoomEventFilter>::operator()(const QJsonObject& jo) const
-{
- RoomEventFilter result;
- result.notRooms =
- fromJson<QStringList>(jo.value("not_rooms"_ls));
- result.rooms =
- fromJson<QStringList>(jo.value("rooms"_ls));
- result.containsUrl =
- fromJson<bool>(jo.value("contains_url"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/room_event_filter.h b/lib/csapi/definitions/room_event_filter.h
index 697fe661..293e5492 100644
--- a/lib/csapi/definitions/room_event_filter.h
+++ b/lib/csapi/definitions/room_event_filter.h
@@ -7,27 +7,71 @@
#include "converters.h"
#include "csapi/definitions/event_filter.h"
-#include "converters.h"
-namespace QMatrixClient
-{
- // Data structures
+namespace Quotient {
- struct RoomEventFilter : EventFilter
- {
- /// 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.
- QStringList notRooms;
- /// A list of room IDs to include. If this list is absent then all rooms are included.
- QStringList rooms;
- /// If ``true``, includes only events with a ``url`` key in their content. If ``false``, excludes those events. Defaults to ``false``.
- bool containsUrl;
- };
+struct RoomEventFilter : EventFilter {
+ /// If `true`, enables per-[thread](/client-server-api/#threading)
+ /// notification counts. Only applies to the `/sync` endpoint. Defaults to
+ /// `false`.
+ Omittable<bool> unreadThreadNotifications;
+
+ /// If `true`, enables lazy-loading of membership events. See
+ /// [Lazy-loading room
+ /// members](/client-server-api/#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](/client-server-api/#lazy-loading-room-members) for more
+ /// information. Defaults to `false`.
+ Omittable<bool> includeRedundantMembers;
- QJsonObject toJson(const RoomEventFilter& pod);
+ /// 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.
+ QStringList notRooms;
- template <> struct FromJsonObject<RoomEventFilter>
+ /// A list of room IDs to include. If this list is absent then all rooms are
+ /// included.
+ QStringList rooms;
+
+ /// If `true`, includes only events with a `url` key in their content. If
+ /// `false`, excludes those events. If omitted, `url` key is not considered
+ /// for filtering.
+ Omittable<bool> containsUrl;
+};
+
+template <>
+struct JsonObjectConverter<RoomEventFilter> {
+ static void dumpTo(QJsonObject& jo, const RoomEventFilter& pod)
+ {
+ fillJson<EventFilter>(jo, pod);
+ addParam<IfNotEmpty>(jo, QStringLiteral("unread_thread_notifications"),
+ pod.unreadThreadNotifications);
+ 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)
{
- RoomEventFilter operator()(const QJsonObject& jo) const;
- };
+ fillFromJson<EventFilter>(jo, pod);
+ fromJson(jo.value("unread_thread_notifications"_ls),
+ pod.unreadThreadNotifications);
+ 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 QMatrixClient
+} // namespace Quotient
diff --git a/lib/csapi/definitions/sync_filter.cpp b/lib/csapi/definitions/sync_filter.cpp
deleted file mode 100644
index bd87804c..00000000
--- a/lib/csapi/definitions/sync_filter.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "sync_filter.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const RoomFilter& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-RoomFilter FromJsonObject<RoomFilter>::operator()(const QJsonObject& jo) const
-{
- RoomFilter result;
- result.notRooms =
- fromJson<QStringList>(jo.value("not_rooms"_ls));
- result.rooms =
- fromJson<QStringList>(jo.value("rooms"_ls));
- result.ephemeral =
- fromJson<RoomEventFilter>(jo.value("ephemeral"_ls));
- result.includeLeave =
- fromJson<bool>(jo.value("include_leave"_ls));
- result.state =
- fromJson<RoomEventFilter>(jo.value("state"_ls));
- result.timeline =
- fromJson<RoomEventFilter>(jo.value("timeline"_ls));
- result.accountData =
- fromJson<RoomEventFilter>(jo.value("account_data"_ls));
-
- return result;
-}
-
-QJsonObject QMatrixClient::toJson(const Filter& pod)
-{
- QJsonObject jo;
- 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);
- return jo;
-}
-
-Filter FromJsonObject<Filter>::operator()(const QJsonObject& jo) const
-{
- Filter result;
- result.eventFields =
- fromJson<QStringList>(jo.value("event_fields"_ls));
- result.eventFormat =
- fromJson<QString>(jo.value("event_format"_ls));
- result.presence =
- fromJson<EventFilter>(jo.value("presence"_ls));
- result.accountData =
- fromJson<EventFilter>(jo.value("account_data"_ls));
- result.room =
- fromJson<RoomFilter>(jo.value("room"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/sync_filter.h b/lib/csapi/definitions/sync_filter.h
index ca275a9a..62e17962 100644
--- a/lib/csapi/definitions/sync_filter.h
+++ b/lib/csapi/definitions/sync_filter.h
@@ -6,59 +6,110 @@
#include "converters.h"
-#include "csapi/definitions/room_event_filter.h"
-#include "converters.h"
#include "csapi/definitions/event_filter.h"
+#include "csapi/definitions/room_event_filter.h"
-namespace QMatrixClient
-{
- // Data structures
+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;
- /// Filters to be applied to room data.
- struct RoomFilter
+ /// 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)
{
- /// 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.
- Omittable<RoomEventFilter> ephemeral;
- /// Include rooms that the user has left in the sync, default false
- bool includeLeave;
- /// The state events to include for rooms.
- Omittable<RoomEventFilter> state;
- /// The message and state update events to include for rooms.
- Omittable<RoomEventFilter> timeline;
- /// The per user account data to include for rooms.
- Omittable<RoomEventFilter> accountData;
- };
-
- QJsonObject toJson(const RoomFilter& pod);
-
- template <> struct FromJsonObject<RoomFilter>
+ 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)
{
- RoomFilter operator()(const QJsonObject& jo) const;
- };
+ 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;
+};
- struct Filter
+template <>
+struct JsonObjectConverter<Filter> {
+ static void dumpTo(QJsonObject& jo, const Filter& pod)
{
- /// List of event fields to include. If this list is absent then all fields are included. The entries may include '.' charaters 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 receieved over federation. The default is 'client'.
- QString eventFormat;
- /// The presence updates to include.
- Omittable<EventFilter> presence;
- /// The user account data that isn't associated with rooms to include.
- Omittable<EventFilter> accountData;
- /// Filters to be applied to room data.
- Omittable<RoomFilter> room;
- };
-
- QJsonObject toJson(const Filter& pod);
-
- template <> struct FromJsonObject<Filter>
+ 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)
{
- Filter operator()(const QJsonObject& jo) const;
- };
+ 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 QMatrixClient
+} // 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..7097bda4
--- /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 80a6d450..00000000
--- a/lib/csapi/definitions/user_identifier.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "user_identifier.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const UserIdentifier& pod)
-{
- QJsonObject jo = toJson(pod.additionalProperties);
- addParam<>(jo, QStringLiteral("type"), pod.type);
- return jo;
-}
-
-UserIdentifier FromJsonObject<UserIdentifier>::operator()(QJsonObject jo) const
-{
- UserIdentifier result;
- result.type =
- fromJson<QString>(jo.take("type"_ls));
-
- result.additionalProperties = fromJson<QVariantHash>(jo);
- return result;
-}
-
diff --git a/lib/csapi/definitions/user_identifier.h b/lib/csapi/definitions/user_identifier.h
index 42614436..cb585a6a 100644
--- a/lib/csapi/definitions/user_identifier.h
+++ b/lib/csapi/definitions/user_identifier.h
@@ -6,26 +6,30 @@
#include "converters.h"
-#include <QtCore/QVariant>
-
-namespace QMatrixClient
-{
- // Data structures
+namespace Quotient {
+/// Identification information for a user
+struct UserIdentifier {
+ /// The type of identification. See [Identifier
+ /// types](/client-server-api/#identifier-types) for supported values and
+ /// additional property descriptions.
+ QString type;
/// Identification information for a user
- struct UserIdentifier
- {
- /// The type of identification. See `Identifier types`_ for supported values and additional property descriptions.
- QString type;
- /// Identification information for a user
- QVariantHash additionalProperties;
- };
+ QVariantHash additionalProperties;
+};
- QJsonObject toJson(const UserIdentifier& pod);
-
- template <> struct FromJsonObject<UserIdentifier>
+template <>
+struct JsonObjectConverter<UserIdentifier> {
+ 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)
{
- UserIdentifier operator()(QJsonObject jo) const;
- };
+ fromJson(jo.take("type"_ls), pod.type);
+ fromJson(jo, pod.additionalProperties);
+ }
+};
-} // namespace QMatrixClient
+} // namespace Quotient
diff --git a/lib/csapi/definitions/wellknown/full.h b/lib/csapi/definitions/wellknown/full.h
new file mode 100644
index 00000000..a0ef2076
--- /dev/null
+++ b/lib/csapi/definitions/wellknown/full.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+#include "csapi/definitions/wellknown/homeserver.h"
+#include "csapi/definitions/wellknown/identity_server.h"
+
+namespace Quotient {
+/// Used by clients to determine the homeserver, identity server, and other
+/// optional components they should be interacting with.
+struct DiscoveryInformation {
+ /// Used by clients to determine the homeserver, identity server, and other
+ /// optional components they should be interacting with.
+ HomeserverInformation homeserver;
+
+ /// Used by clients to determine the homeserver, identity server, and other
+ /// optional components they should be interacting with.
+ Omittable<IdentityServerInformation> identityServer;
+
+ /// Application-dependent keys using Java package naming convention.
+ QHash<QString, QJsonObject> additionalProperties;
+};
+
+template <>
+struct JsonObjectConverter<DiscoveryInformation> {
+ 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 f1482ee4..00000000
--- a/lib/csapi/definitions/wellknown/homeserver.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "homeserver.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const HomeserverInformation& pod)
-{
- QJsonObject jo;
- addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
- return jo;
-}
-
-HomeserverInformation FromJsonObject<HomeserverInformation>::operator()(const QJsonObject& jo) const
-{
- HomeserverInformation result;
- result.baseUrl =
- fromJson<QString>(jo.value("base_url"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/wellknown/homeserver.h b/lib/csapi/definitions/wellknown/homeserver.h
index 09d6ba63..b7db4182 100644
--- a/lib/csapi/definitions/wellknown/homeserver.h
+++ b/lib/csapi/definitions/wellknown/homeserver.h
@@ -6,23 +6,23 @@
#include "converters.h"
-
-namespace QMatrixClient
-{
- // Data structures
-
- /// Used by clients to discover homeserver information.
- struct HomeserverInformation
+namespace Quotient {
+/// Used by clients to discover homeserver information.
+struct HomeserverInformation {
+ /// The base URL for the homeserver for client-server connections.
+ QUrl baseUrl;
+};
+
+template <>
+struct JsonObjectConverter<HomeserverInformation> {
+ static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod)
{
- /// The base URL for the homeserver for client-server connections.
- QString baseUrl;
- };
-
- QJsonObject toJson(const HomeserverInformation& pod);
-
- template <> struct FromJsonObject<HomeserverInformation>
+ addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod)
{
- HomeserverInformation operator()(const QJsonObject& jo) const;
- };
+ fromJson(jo.value("base_url"_ls), pod.baseUrl);
+ }
+};
-} // namespace QMatrixClient
+} // 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 f9d7bc37..00000000
--- a/lib/csapi/definitions/wellknown/identity_server.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "identity_server.h"
-
-using namespace QMatrixClient;
-
-QJsonObject QMatrixClient::toJson(const IdentityServerInformation& pod)
-{
- QJsonObject jo;
- addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
- return jo;
-}
-
-IdentityServerInformation FromJsonObject<IdentityServerInformation>::operator()(const QJsonObject& jo) const
-{
- IdentityServerInformation result;
- result.baseUrl =
- fromJson<QString>(jo.value("base_url"_ls));
-
- return result;
-}
-
diff --git a/lib/csapi/definitions/wellknown/identity_server.h b/lib/csapi/definitions/wellknown/identity_server.h
index cb8ffcee..885e3d34 100644
--- a/lib/csapi/definitions/wellknown/identity_server.h
+++ b/lib/csapi/definitions/wellknown/identity_server.h
@@ -6,23 +6,23 @@
#include "converters.h"
-
-namespace QMatrixClient
-{
- // Data structures
-
- /// Used by clients to discover identity server information.
- struct IdentityServerInformation
+namespace Quotient {
+/// Used by clients to discover identity server information.
+struct IdentityServerInformation {
+ /// The base URL for the identity server for client-server connections.
+ QUrl baseUrl;
+};
+
+template <>
+struct JsonObjectConverter<IdentityServerInformation> {
+ static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod)
{
- /// The base URL for the identity server for client-server connections.
- QString baseUrl;
- };
-
- QJsonObject toJson(const IdentityServerInformation& pod);
-
- template <> struct FromJsonObject<IdentityServerInformation>
+ addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl);
+ }
+ static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod)
{
- IdentityServerInformation operator()(const QJsonObject& jo) const;
- };
+ fromJson(jo.value("base_url"_ls), pod.baseUrl);
+ }
+};
-} // namespace QMatrixClient
+} // namespace Quotient