forked from microsoft/cppgraphqlgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedInputClient.h
More file actions
209 lines (161 loc) · 5.12 KB
/
Copy pathNestedInputClient.h
File metadata and controls
209 lines (161 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// WARNING! Do not edit this file manually, your changes will be overwritten.
#pragma once
#ifndef NESTEDINPUTCLIENT_H
#define NESTEDINPUTCLIENT_H
#include "graphqlservice/GraphQLClient.h"
#include "graphqlservice/GraphQLParse.h"
#include "graphqlservice/GraphQLResponse.h"
#include "graphqlservice/internal/Version.h"
#include <optional>
#include <string>
#include <vector>
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");
namespace graphql::nestedinput {
/// # Operation: query testQuery
/// ```graphql
/// query testQuery($stream: InputABCD!) {
/// control {
/// test(new: $stream) {
/// id
/// }
/// }
/// }
/// ```
namespace client {
// Return the original text of the request document.
[[nodiscard("unnecessary call")]] const std::string& GetRequestText() noexcept;
// Return a pre-parsed, pre-validated request object.
[[nodiscard("unnecessary call")]] const peg::ast& GetRequestObject() noexcept;
} // namespace client
struct [[nodiscard("unnecessary construction")]] InputA
{
explicit InputA() noexcept;
explicit InputA(
bool aArg) noexcept;
InputA(const InputA& other);
InputA(InputA&& other) noexcept;
~InputA();
InputA& operator=(const InputA& other);
InputA& operator=(InputA&& other) noexcept;
bool a;
};
struct [[nodiscard("unnecessary construction")]] InputB
{
explicit InputB() noexcept;
explicit InputB(
double bArg) noexcept;
InputB(const InputB& other);
InputB(InputB&& other) noexcept;
~InputB();
InputB& operator=(const InputB& other);
InputB& operator=(InputB&& other) noexcept;
double b;
};
struct InputBC;
struct [[nodiscard("unnecessary construction")]] InputABCD
{
explicit InputABCD() noexcept;
explicit InputABCD(
std::string dArg,
InputA aArg,
InputB bArg,
std::vector<InputBC> bcArg,
int valueArg) noexcept;
InputABCD(const InputABCD& other);
InputABCD(InputABCD&& other) noexcept;
~InputABCD();
InputABCD& operator=(const InputABCD& other);
InputABCD& operator=(InputABCD&& other) noexcept;
std::string d;
InputA a;
InputB b;
std::vector<InputBC> bc;
int value;
};
struct [[nodiscard("unnecessary construction")]] InputBC
{
explicit InputBC() noexcept;
explicit InputBC(
response::IdType cArg,
InputB bArg) noexcept;
InputBC(const InputBC& other);
InputBC(InputBC&& other) noexcept;
~InputBC();
InputBC& operator=(const InputBC& other);
InputBC& operator=(InputBC&& other) noexcept;
response::IdType c;
InputB b;
};
namespace client {
namespace query::testQuery {
using graphql::nestedinput::client::GetRequestText;
using graphql::nestedinput::client::GetRequestObject;
// Return the name of this operation in the shared request document.
[[nodiscard("unnecessary call")]] const std::string& GetOperationName() noexcept;
using graphql::nestedinput::InputA;
using graphql::nestedinput::InputB;
using graphql::nestedinput::InputABCD;
using graphql::nestedinput::InputBC;
struct [[nodiscard("unnecessary construction")]] Variables
{
InputABCD stream {};
};
[[nodiscard("unnecessary conversion")]] response::Value serializeVariables(Variables&& variables);
struct [[nodiscard("unnecessary construction")]] Response
{
struct [[nodiscard("unnecessary construction")]] control_Control
{
struct [[nodiscard("unnecessary construction")]] test_Output
{
std::optional<bool> id {};
};
std::optional<test_Output> test {};
};
control_Control control {};
};
class ResponseVisitor
: public std::enable_shared_from_this<ResponseVisitor>
{
public:
ResponseVisitor() noexcept;
~ResponseVisitor();
void add_value(std::shared_ptr<const response::Value>&&);
void reserve(std::size_t count);
void start_object();
void add_member(std::string&& key);
void end_object();
void start_array();
void end_array();
void add_null();
void add_string(std::string&& value);
void add_enum(std::string&& value);
void add_id(response::IdType&& value);
void add_bool(bool value);
void add_int(int value);
void add_float(double value);
void complete();
Response response();
private:
struct impl;
std::unique_ptr<impl> _pimpl;
};
[[nodiscard("unnecessary conversion")]] Response parseResponse(response::Value&& response);
struct Traits
{
[[nodiscard("unnecessary call")]] static const std::string& GetRequestText() noexcept;
[[nodiscard("unnecessary call")]] static const peg::ast& GetRequestObject() noexcept;
[[nodiscard("unnecessary call")]] static const std::string& GetOperationName() noexcept;
using Variables = testQuery::Variables;
[[nodiscard("unnecessary conversion")]] static response::Value serializeVariables(Variables&& variables);
using Response = testQuery::Response;
using ResponseVisitor = testQuery::ResponseVisitor;
[[nodiscard("unnecessary conversion")]] static Response parseResponse(response::Value&& response);
};
} // namespace query::testQuery
} // namespace client
} // namespace graphql::nestedinput
#endif // NESTEDINPUTCLIENT_H