aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/openid_token.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-09 08:52:25 +0200
committerGitHub <noreply@github.com>2020-06-09 08:52:25 +0200
commit370d9b3e46332d38df8798cda208c534c58be808 (patch)
treef3db0cd7463468ff52c74446acd608356f8b8ab6 /lib/csapi/definitions/openid_token.h
parente1f5d0aa2c33e6da6c3a609c8bc7e0b5867e748d (diff)
parent10d9ac4673e374a9ac17ff492591136520337c4c (diff)
downloadlibquotient-370d9b3e46332d38df8798cda208c534c58be808.tar.gz
libquotient-370d9b3e46332d38df8798cda208c534c58be808.zip
Merge pull request #405 from quotient-im/kitsune-basejob-store-json-response
Store JSON response in BaseJob + tweaks to the generated code
Diffstat (limited to 'lib/csapi/definitions/openid_token.h')
-rw-r--r--lib/csapi/definitions/openid_token.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/csapi/definitions/openid_token.h b/lib/csapi/definitions/openid_token.h
new file mode 100644
index 00000000..5e68c376
--- /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 OpenidToken {
+ /// 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<OpenidToken> {
+ static void dumpTo(QJsonObject& jo, const OpenidToken& 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, OpenidToken& 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