| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/converters.h> |
| 8 | |
| 9 | namespace Quotient { |
| 10 | /// Used by clients to submit authentication information to the |
| 11 | /// interactive-authentication API |
| 12 | struct AuthenticationData { |
| 13 | /// The authentication type that the client is attempting to complete. |
| 14 | /// May be omitted if `session` is given, and the client is reissuing a |
| 15 | /// request which it believes has been completed out-of-band (for example, |
| 16 | /// via the [fallback mechanism](#fallback)). |
| 17 | QString type{}; |
| 18 | |
| 19 | /// The value of the session key given by the homeserver. |
| 20 | QString session{}; |
| 21 | |
| 22 | /// Keys dependent on the login type |
| 23 | QHash<QString, QJsonObject> authInfo{}; |
| 24 | }; |
| 25 | |
| 26 | template <> |
| 27 | struct JsonObjectConverter<AuthenticationData> { |
| 28 | static void dumpTo(QJsonObject& jo, const AuthenticationData& pod) |
| 29 | { |
| 30 | fillJson(json&: jo, data: pod.authInfo); |
| 31 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("type" ), value: pod.type); |
| 32 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("session" ), value: pod.session); |
| 33 | } |
| 34 | static void fillFrom(QJsonObject jo, AuthenticationData& pod) |
| 35 | { |
| 36 | fillFromJson(jv: jo.take(key: "type"_ls ), pod&: pod.type); |
| 37 | fillFromJson(jv: jo.take(key: "session"_ls ), pod&: pod.session); |
| 38 | fromJson(json: jo, pod&: pod.authInfo); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | } // namespace Quotient |
| 43 | |