-
Notifications
You must be signed in to change notification settings - Fork 45
/
AppointmentObject.h
269 lines (223 loc) · 8.3 KB
/
AppointmentObject.h
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
// 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 APPOINTMENTOBJECT_H
#define APPOINTMENTOBJECT_H
#include "TodaySchema.h"
namespace graphql::today::object {
namespace implements {
template <class I>
concept AppointmentIs = std::is_same_v<I, Node> || std::is_same_v<I, UnionType>;
} // namespace implements
namespace methods::AppointmentHas {
template <class TImpl>
concept getIdWithParams = requires (TImpl impl, service::FieldParams params)
{
{ service::AwaitableScalar<response::IdType> { impl.getId(std::move(params)) } };
};
template <class TImpl>
concept getId = requires (TImpl impl)
{
{ service::AwaitableScalar<response::IdType> { impl.getId() } };
};
template <class TImpl>
concept getWhenWithParams = requires (TImpl impl, service::FieldParams params)
{
{ service::AwaitableScalar<std::optional<response::Value>> { impl.getWhen(std::move(params)) } };
};
template <class TImpl>
concept getWhen = requires (TImpl impl)
{
{ service::AwaitableScalar<std::optional<response::Value>> { impl.getWhen() } };
};
template <class TImpl>
concept getSubjectWithParams = requires (TImpl impl, service::FieldParams params)
{
{ service::AwaitableScalar<std::optional<std::string>> { impl.getSubject(std::move(params)) } };
};
template <class TImpl>
concept getSubject = requires (TImpl impl)
{
{ service::AwaitableScalar<std::optional<std::string>> { impl.getSubject() } };
};
template <class TImpl>
concept getIsNowWithParams = requires (TImpl impl, service::FieldParams params)
{
{ service::AwaitableScalar<bool> { impl.getIsNow(std::move(params)) } };
};
template <class TImpl>
concept getIsNow = requires (TImpl impl)
{
{ service::AwaitableScalar<bool> { impl.getIsNow() } };
};
template <class TImpl>
concept getForceErrorWithParams = requires (TImpl impl, service::FieldParams params)
{
{ service::AwaitableScalar<std::optional<std::string>> { impl.getForceError(std::move(params)) } };
};
template <class TImpl>
concept getForceError = requires (TImpl impl)
{
{ service::AwaitableScalar<std::optional<std::string>> { impl.getForceError() } };
};
template <class TImpl>
concept beginSelectionSet = requires (TImpl impl, const service::SelectionSetParams params)
{
{ impl.beginSelectionSet(params) };
};
template <class TImpl>
concept endSelectionSet = requires (TImpl impl, const service::SelectionSetParams params)
{
{ impl.endSelectionSet(params) };
};
} // namespace methods::AppointmentHas
class [[nodiscard("unnecessary construction")]] Appointment final
: public service::Object
{
private:
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolveId(service::ResolverParams&& params) const;
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolveWhen(service::ResolverParams&& params) const;
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolveSubject(service::ResolverParams&& params) const;
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolveIsNow(service::ResolverParams&& params) const;
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolveForceError(service::ResolverParams&& params) const;
[[nodiscard("unnecessary call")]] service::AwaitableResolver resolve_typename(service::ResolverParams&& params) const;
struct [[nodiscard("unnecessary construction")]] Concept
{
virtual ~Concept() = default;
virtual void beginSelectionSet(const service::SelectionSetParams& params) const = 0;
virtual void endSelectionSet(const service::SelectionSetParams& params) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<response::IdType> getId(service::FieldParams&& params) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<std::optional<response::Value>> getWhen(service::FieldParams&& params) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<std::optional<std::string>> getSubject(service::FieldParams&& params) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<bool> getIsNow(service::FieldParams&& params) const = 0;
[[nodiscard("unnecessary call")]] virtual service::AwaitableScalar<std::optional<std::string>> getForceError(service::FieldParams&& params) const = 0;
};
template <class T>
struct [[nodiscard("unnecessary construction")]] Model final
: Concept
{
explicit Model(std::shared_ptr<T> pimpl) noexcept
: _pimpl { std::move(pimpl) }
{
}
[[nodiscard("unnecessary call")]] service::AwaitableScalar<response::IdType> getId(service::FieldParams&& params) const override
{
if constexpr (methods::AppointmentHas::getIdWithParams<T>)
{
return { _pimpl->getId(std::move(params)) };
}
else if constexpr (methods::AppointmentHas::getId<T>)
{
return { _pimpl->getId() };
}
else
{
throw service::unimplemented_method(R"ex(Appointment::getId)ex");
}
}
[[nodiscard("unnecessary call")]] service::AwaitableScalar<std::optional<response::Value>> getWhen(service::FieldParams&& params) const override
{
if constexpr (methods::AppointmentHas::getWhenWithParams<T>)
{
return { _pimpl->getWhen(std::move(params)) };
}
else if constexpr (methods::AppointmentHas::getWhen<T>)
{
return { _pimpl->getWhen() };
}
else
{
throw service::unimplemented_method(R"ex(Appointment::getWhen)ex");
}
}
[[nodiscard("unnecessary call")]] service::AwaitableScalar<std::optional<std::string>> getSubject(service::FieldParams&& params) const override
{
if constexpr (methods::AppointmentHas::getSubjectWithParams<T>)
{
return { _pimpl->getSubject(std::move(params)) };
}
else if constexpr (methods::AppointmentHas::getSubject<T>)
{
return { _pimpl->getSubject() };
}
else
{
throw service::unimplemented_method(R"ex(Appointment::getSubject)ex");
}
}
[[nodiscard("unnecessary call")]] service::AwaitableScalar<bool> getIsNow(service::FieldParams&& params) const override
{
if constexpr (methods::AppointmentHas::getIsNowWithParams<T>)
{
return { _pimpl->getIsNow(std::move(params)) };
}
else if constexpr (methods::AppointmentHas::getIsNow<T>)
{
return { _pimpl->getIsNow() };
}
else
{
throw service::unimplemented_method(R"ex(Appointment::getIsNow)ex");
}
}
[[nodiscard("unnecessary call")]] service::AwaitableScalar<std::optional<std::string>> getForceError(service::FieldParams&& params) const override
{
if constexpr (methods::AppointmentHas::getForceErrorWithParams<T>)
{
return { _pimpl->getForceError(std::move(params)) };
}
else if constexpr (methods::AppointmentHas::getForceError<T>)
{
return { _pimpl->getForceError() };
}
else
{
throw service::unimplemented_method(R"ex(Appointment::getForceError)ex");
}
}
void beginSelectionSet(const service::SelectionSetParams& params) const override
{
if constexpr (methods::AppointmentHas::beginSelectionSet<T>)
{
_pimpl->beginSelectionSet(params);
}
}
void endSelectionSet(const service::SelectionSetParams& params) const override
{
if constexpr (methods::AppointmentHas::endSelectionSet<T>)
{
_pimpl->endSelectionSet(params);
}
}
private:
const std::shared_ptr<T> _pimpl;
};
explicit Appointment(std::unique_ptr<const Concept> pimpl) noexcept;
// Interfaces which this type implements
friend Node;
// Unions which include this type
friend UnionType;
template <class I>
[[nodiscard("unnecessary call")]] static constexpr bool implements() noexcept
{
return implements::AppointmentIs<I>;
}
[[nodiscard("unnecessary call")]] service::TypeNames getTypeNames() const noexcept;
[[nodiscard("unnecessary call")]] service::ResolverMap getResolvers() const noexcept;
void beginSelectionSet(const service::SelectionSetParams& params) const override;
void endSelectionSet(const service::SelectionSetParams& params) const override;
const std::unique_ptr<const Concept> _pimpl;
public:
template <class T>
explicit Appointment(std::shared_ptr<T> pimpl) noexcept
: Appointment { std::unique_ptr<const Concept> { std::make_unique<Model<T>>(std::move(pimpl)) } }
{
}
[[nodiscard("unnecessary call")]] static constexpr std::string_view getObjectType() noexcept
{
return { R"gql(Appointment)gql" };
}
};
} // namespace graphql::today::object
#endif // APPOINTMENTOBJECT_H