diff options
author | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
commit | d911b207f49e936b3e992200796110f0749ed150 (patch) | |
tree | 96d20ebb4d074a4c1755e21cb316a52d584daee3 /lib/csapi/definitions/wellknown | |
parent | 8ad8a74152c5701b6ca1f9a00487ba9257a439b4 (diff) | |
parent | 56c2f2e2b809b9077393eb617828f33d144f5634 (diff) | |
download | libquotient-d911b207f49e936b3e992200796110f0749ed150.tar.gz libquotient-d911b207f49e936b3e992200796110f0749ed150.zip |
New upstream version 0.7.0
Diffstat (limited to 'lib/csapi/definitions/wellknown')
-rw-r--r-- | lib/csapi/definitions/wellknown/full.h | 45 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.cpp | 24 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.h | 34 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.cpp | 24 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.h | 34 |
5 files changed, 79 insertions, 82 deletions
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 |