| 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 | |
| 11 | struct OpenIdCredentials { |
| 12 | /// An access token the consumer may use to verify the identity of |
| 13 | /// the person who generated the token. This is given to the federation |
| 14 | /// API `GET /openid/userinfo` to verify the user's identity. |
| 15 | QString accessToken; |
| 16 | |
| 17 | /// The string `Bearer`. |
| 18 | QString tokenType; |
| 19 | |
| 20 | /// The homeserver domain the consumer should use when attempting to |
| 21 | /// verify the user's identity. |
| 22 | QString matrixServerName; |
| 23 | |
| 24 | /// The number of seconds before this token expires and a new one must |
| 25 | /// be generated. |
| 26 | int expiresIn; |
| 27 | }; |
| 28 | |
| 29 | template <> |
| 30 | struct JsonObjectConverter<OpenIdCredentials> { |
| 31 | static void dumpTo(QJsonObject& jo, const OpenIdCredentials& pod) |
| 32 | { |
| 33 | addParam<>(container&: jo, QStringLiteral("access_token" ), value: pod.accessToken); |
| 34 | addParam<>(container&: jo, QStringLiteral("token_type" ), value: pod.tokenType); |
| 35 | addParam<>(container&: jo, QStringLiteral("matrix_server_name" ), |
| 36 | value: pod.matrixServerName); |
| 37 | addParam<>(container&: jo, QStringLiteral("expires_in" ), value: pod.expiresIn); |
| 38 | } |
| 39 | static void fillFrom(const QJsonObject& jo, OpenIdCredentials& pod) |
| 40 | { |
| 41 | fillFromJson(jv: jo.value(key: "access_token"_ls ), pod&: pod.accessToken); |
| 42 | fillFromJson(jv: jo.value(key: "token_type"_ls ), pod&: pod.tokenType); |
| 43 | fillFromJson(jv: jo.value(key: "matrix_server_name"_ls ), pod&: pod.matrixServerName); |
| 44 | fillFromJson(jv: jo.value(key: "expires_in"_ls ), pod&: pod.expiresIn); |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | } // namespace Quotient |
| 49 | |