libQuotient
A Qt library for building matrix clients
openid_token.h
Go to the documentation of this file.
1 // THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2 
3 #pragma once
4 
5 #include <Quotient/converters.h>
6 
7 namespace Quotient {
8 
9 struct QUOTIENT_API OpenIdCredentials {
10  //! An access token the consumer may use to verify the identity of
11  //! the person who generated the token. This is given to the federation
12  //! API `GET /openid/userinfo` to verify the user's identity.
13  QString accessToken;
14 
15  //! The string `Bearer`.
16  QString tokenType;
17 
18  //! The homeserver domain the consumer should use when attempting to
19  //! verify the user's identity.
20  QString matrixServerName;
21 
22  //! The number of seconds before this token expires and a new one must
23  //! be generated.
24  int expiresIn;
25 };
26 
27 template <>
28 struct JsonObjectConverter<OpenIdCredentials> {
29  static void dumpTo(QJsonObject& jo, const OpenIdCredentials& pod)
30  {
31  addParam<>(jo, "access_token"_L1, pod.accessToken);
32  addParam<>(jo, "token_type"_L1, pod.tokenType);
33  addParam<>(jo, "matrix_server_name"_L1, pod.matrixServerName);
34  addParam<>(jo, "expires_in"_L1, pod.expiresIn);
35  }
36  static void fillFrom(const QJsonObject& jo, OpenIdCredentials& pod)
37  {
38  fillFromJson(jo.value("access_token"_L1), pod.accessToken);
39  fillFromJson(jo.value("token_type"_L1), pod.tokenType);
40  fillFromJson(jo.value("matrix_server_name"_L1), pod.matrixServerName);
41  fillFromJson(jo.value("expires_in"_L1), pod.expiresIn);
42  }
43 };
44 
45 } // namespace Quotient