libkazv
openid_token.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3  */
4 
5 #pragma once
6 
7 #include "types.hpp"
8 
9 
10 namespace Kazv::Api {
11 
12 struct OpenIdCredentials
13 {
14 
18  std::string accessToken;
19 
21  std::string tokenType;
22 
25  std::string matrixServerName;
26 
29  int expiresIn;
30 };
31 
32 }
33 namespace nlohmann
34 {
35 using namespace Kazv;
36 using namespace Kazv::Api;
37 template<>
38 struct adl_serializer<OpenIdCredentials> {
39  static void to_json(json& jo, const OpenIdCredentials &pod)
40  {
41  if (! jo.is_object()) { jo = json::object(); }
42 
43 
44  jo["access_token"s] = pod.accessToken;
45 
46  jo["token_type"s] = pod.tokenType;
47 
48  jo["matrix_server_name"s] = pod.matrixServerName;
49 
50  jo["expires_in"s] = pod.expiresIn;
51 
52  }
53  static void from_json(const json &jo, OpenIdCredentials& result)
54  {
55 
56  if (jo.contains("access_token"s)) {
57  result.accessToken = jo.at("access_token"s);
58  }
59  if (jo.contains("token_type"s)) {
60  result.tokenType = jo.at("token_type"s);
61  }
62  if (jo.contains("matrix_server_name"s)) {
63  result.matrixServerName = jo.at("matrix_server_name"s);
64  }
65  if (jo.contains("expires_in"s)) {
66  result.expiresIn = jo.at("expires_in"s);
67  }
68 
69  }
70 };
71  }
72 
73  namespace Kazv::Api
74  {
75 } // namespace Kazv::Api
nlohmann::adl_serializer< OpenIdCredentials >::to_json
static void to_json(json &jo, const OpenIdCredentials &pod)
Definition: openid_token.hpp:39
types.hpp
nlohmann
Definition: location.hpp:26
Kazv
Definition: location.hpp:10
Kazv::Api::OpenIdCredentials::accessToken
std::string accessToken
An access token the consumer may use to verify the identity of the person who generated the token.
Definition: openid_token.hpp:22
Kazv::Api::OpenIdCredentials::tokenType
std::string tokenType
The string Bearer.
Definition: openid_token.hpp:25
Kazv::Api::OpenIdCredentials::matrixServerName
std::string matrixServerName
The homeserver domain the consumer should use when attempting to verify the user's identity.
Definition: openid_token.hpp:29
nlohmann::adl_serializer< OpenIdCredentials >::from_json
static void from_json(const json &jo, OpenIdCredentials &result)
Definition: openid_token.hpp:53
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::Api::OpenIdCredentials
Definition: openid_token.hpp:14
Kazv::Api::OpenIdCredentials::expiresIn
int expiresIn
The number of seconds before this token expires and a new one must be generated.
Definition: openid_token.hpp:33