| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/csapi/definitions/wellknown/homeserver.h> |
| 8 | #include <Quotient/csapi/definitions/wellknown/identity_server.h> |
| 9 | |
| 10 | #include <Quotient/converters.h> |
| 11 | |
| 12 | namespace Quotient { |
| 13 | /// Used by clients to determine the homeserver, identity server, and other |
| 14 | /// optional components they should be interacting with. |
| 15 | struct DiscoveryInformation { |
| 16 | /// Used by clients to determine the homeserver, identity server, and other |
| 17 | /// optional components they should be interacting with. |
| 18 | HomeserverInformation homeserver; |
| 19 | |
| 20 | /// Used by clients to determine the homeserver, identity server, and other |
| 21 | /// optional components they should be interacting with. |
| 22 | Omittable<IdentityServerInformation> identityServer{}; |
| 23 | |
| 24 | /// Application-dependent keys using Java package naming convention. |
| 25 | QHash<QString, QJsonObject> additionalProperties{}; |
| 26 | }; |
| 27 | |
| 28 | template <> |
| 29 | struct JsonObjectConverter<DiscoveryInformation> { |
| 30 | static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod) |
| 31 | { |
| 32 | fillJson(json&: jo, data: pod.additionalProperties); |
| 33 | addParam<>(container&: jo, QStringLiteral("m.homeserver" ), value: pod.homeserver); |
| 34 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("m.identity_server" ), |
| 35 | value: pod.identityServer); |
| 36 | } |
| 37 | static void fillFrom(QJsonObject jo, DiscoveryInformation& pod) |
| 38 | { |
| 39 | fillFromJson(jv: jo.take(key: "m.homeserver"_ls ), pod&: pod.homeserver); |
| 40 | fillFromJson(jv: jo.take(key: "m.identity_server"_ls ), pod&: pod.identityServer); |
| 41 | fromJson(json: jo, pod&: pod.additionalProperties); |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | } // namespace Quotient |
| 46 | |