14
14
using namespace std ::literals;
15
15
16
16
namespace graphql ::client {
17
+ namespace benchmark {
17
18
18
- using namespace query ::Query;
19
+ const std::string& GetRequestText () noexcept
20
+ {
21
+ static const auto s_request = R"gql(
22
+ # Copyright (c) Microsoft Corporation. All rights reserved.
23
+ # Licensed under the MIT License.
24
+
25
+ query {
26
+ appointments {
27
+ pageInfo {
28
+ hasNextPage
29
+ }
30
+ edges {
31
+ node {
32
+ id
33
+ when
34
+ subject
35
+ isNow
36
+ }
37
+ }
38
+ }
39
+ }
40
+ )gql" s;
41
+
42
+ return s_request;
43
+ }
44
+
45
+ const peg::ast& GetRequestObject () noexcept
46
+ {
47
+ static const auto s_request = []() noexcept {
48
+ auto ast = peg::parseString (GetRequestText ());
49
+
50
+ // This has already been validated against the schema by clientgen.
51
+ ast.validated = true ;
52
+
53
+ return ast;
54
+ }();
55
+
56
+ return s_request;
57
+ }
58
+
59
+ } // namespace benchmark
19
60
20
61
template <>
21
- Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse<Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
62
+ query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
22
63
{
23
- Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
64
+ query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
24
65
25
66
if (response.type () == response::Type::Map)
26
67
{
@@ -40,9 +81,9 @@ Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse
40
81
}
41
82
42
83
template <>
43
- Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
84
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
44
85
{
45
- Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
86
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
46
87
47
88
if (response.type () == response::Type::Map)
48
89
{
@@ -77,9 +118,9 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appoin
77
118
}
78
119
79
120
template <>
80
- Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
121
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
81
122
{
82
- Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
123
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
83
124
84
125
if (response.type () == response::Type::Map)
85
126
{
@@ -89,7 +130,7 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResp
89
130
{
90
131
if (member.first == R"js( node)js" sv)
91
132
{
92
- result.node = ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move (member.second ));
133
+ result.node = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move (member.second ));
93
134
continue ;
94
135
}
95
136
}
@@ -99,9 +140,9 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResp
99
140
}
100
141
101
142
template <>
102
- Response::appointments_AppointmentConnection ModifiedResponse<Response::appointments_AppointmentConnection>::parse(response::Value&& response)
143
+ query::Query:: Response::appointments_AppointmentConnection ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection>::parse(response::Value&& response)
103
144
{
104
- Response::appointments_AppointmentConnection result;
145
+ query::Query:: Response::appointments_AppointmentConnection result;
105
146
106
147
if (response.type () == response::Type::Map)
107
148
{
@@ -111,12 +152,12 @@ Response::appointments_AppointmentConnection ModifiedResponse<Response::appointm
111
152
{
112
153
if (member.first == R"js( pageInfo)js" sv)
113
154
{
114
- result.pageInfo = ModifiedResponse<Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse (std::move (member.second ));
155
+ result.pageInfo = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse (std::move (member.second ));
115
156
continue ;
116
157
}
117
158
if (member.first == R"js( edges)js" sv)
118
159
{
119
- result.edges = ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move (member.second ));
160
+ result.edges = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move (member.second ));
120
161
continue ;
121
162
}
122
163
}
@@ -127,44 +168,11 @@ Response::appointments_AppointmentConnection ModifiedResponse<Response::appointm
127
168
128
169
namespace query ::Query {
129
170
130
- const std::string& GetRequestText () noexcept
131
- {
132
- static const auto s_request = R"gql(
133
- # Copyright (c) Microsoft Corporation. All rights reserved.
134
- # Licensed under the MIT License.
135
-
136
- query {
137
- appointments {
138
- pageInfo {
139
- hasNextPage
140
- }
141
- edges {
142
- node {
143
- id
144
- when
145
- subject
146
- isNow
147
- }
148
- }
149
- }
150
- }
151
- )gql" s;
152
-
153
- return s_request;
154
- }
155
-
156
- const peg::ast& GetRequestObject () noexcept
171
+ const std::string& GetOperationName () noexcept
157
172
{
158
- static const auto s_request = []() noexcept {
159
- auto ast = peg::parseString (GetRequestText ());
160
-
161
- // This has already been validated against the schema by clientgen.
162
- ast.validated = true ;
173
+ static const auto s_name = R"gql( )gql" s;
163
174
164
- return ast;
165
- }();
166
-
167
- return s_request;
175
+ return s_name;
168
176
}
169
177
170
178
Response parseResponse (response::Value&& response)
@@ -179,7 +187,7 @@ Response parseResponse(response::Value&& response)
179
187
{
180
188
if (member.first == R"js( appointments)js" sv)
181
189
{
182
- result.appointments = ModifiedResponse<Response::appointments_AppointmentConnection>::parse (std::move (member.second ));
190
+ result.appointments = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection>::parse (std::move (member.second ));
183
191
continue ;
184
192
}
185
193
}
0 commit comments