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
60
+
61
+ using namespace benchmark ;
19
62
20
63
template <>
21
- Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse<Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
64
+ query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
22
65
{
23
- Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
66
+ query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
24
67
25
68
if (response.type () == response::Type::Map)
26
69
{
@@ -40,9 +83,9 @@ Response::appointments_AppointmentConnection::pageInfo_PageInfo ModifiedResponse
40
83
}
41
84
42
85
template <>
43
- Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
86
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
44
87
{
45
- Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
88
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
46
89
47
90
if (response.type () == response::Type::Map)
48
91
{
@@ -77,9 +120,9 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appoin
77
120
}
78
121
79
122
template <>
80
- Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
123
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
81
124
{
82
- Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
125
+ query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
83
126
84
127
if (response.type () == response::Type::Map)
85
128
{
@@ -89,7 +132,7 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResp
89
132
{
90
133
if (member.first == R"js( node)js" sv)
91
134
{
92
- result.node = ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move (member.second ));
135
+ result.node = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move (member.second ));
93
136
continue ;
94
137
}
95
138
}
@@ -99,9 +142,9 @@ Response::appointments_AppointmentConnection::edges_AppointmentEdge ModifiedResp
99
142
}
100
143
101
144
template <>
102
- Response::appointments_AppointmentConnection ModifiedResponse<Response::appointments_AppointmentConnection>::parse(response::Value&& response)
145
+ query::Query:: Response::appointments_AppointmentConnection ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection>::parse(response::Value&& response)
103
146
{
104
- Response::appointments_AppointmentConnection result;
147
+ query::Query:: Response::appointments_AppointmentConnection result;
105
148
106
149
if (response.type () == response::Type::Map)
107
150
{
@@ -111,12 +154,12 @@ Response::appointments_AppointmentConnection ModifiedResponse<Response::appointm
111
154
{
112
155
if (member.first == R"js( pageInfo)js" sv)
113
156
{
114
- result.pageInfo = ModifiedResponse<Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse (std::move (member.second ));
157
+ result.pageInfo = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse (std::move (member.second ));
115
158
continue ;
116
159
}
117
160
if (member.first == R"js( edges)js" sv)
118
161
{
119
- result.edges = ModifiedResponse<Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move (member.second ));
162
+ result.edges = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move (member.second ));
120
163
continue ;
121
164
}
122
165
}
@@ -127,44 +170,11 @@ Response::appointments_AppointmentConnection ModifiedResponse<Response::appointm
127
170
128
171
namespace query ::Query {
129
172
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
173
+ const std::string& GetOperationName () noexcept
157
174
{
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 ;
175
+ static const auto s_name = R"gql( )gql" s;
163
176
164
- return ast;
165
- }();
166
-
167
- return s_request;
177
+ return s_name;
168
178
}
169
179
170
180
Response parseResponse (response::Value&& response)
@@ -179,7 +189,7 @@ Response parseResponse(response::Value&& response)
179
189
{
180
190
if (member.first == R"js( appointments)js" sv)
181
191
{
182
- result.appointments = ModifiedResponse<Response::appointments_AppointmentConnection>::parse (std::move (member.second ));
192
+ result.appointments = ModifiedResponse<query::Query:: Response::appointments_AppointmentConnection>::parse (std::move (member.second ));
183
193
continue ;
184
194
}
185
195
}
0 commit comments