FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/samples/learn/schema/StarWarsSchema.h at main · wravery/cppgraphqlgen · GitHub
wravery
cppgraphqlgen
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
samples
/
learn
/
schema
/
StarWarsSchema.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
116 lines (89 loc) · 3.31 KB
Breadcrumbs
cppgraphqlgen
/
samples
/
learn
/
schema
/
StarWarsSchema.h
Copy path
File metadata and controls
116 lines (89 loc) · 3.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
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
STARWARSSCHEMA_H
#
define
STARWARSSCHEMA_H
#
include
"
graphqlservice/internal/Schema.h
"
//
Check if the library version is compatible with schemagen 4.5.0
static_assert
(graphql::internal::MajorVersion ==
4
,
"
regenerate with schemagen: major version mismatch
"
);
static_assert
(graphql::internal::MinorVersion ==
5
,
"
regenerate with schemagen: minor version mismatch
"
);
#
include
<
array
>
#
include
<
memory
>
#
include
<
string
>
#
include
<
string_view
>
namespace
graphql
{
namespace
learn
{
enum
class
[[nodiscard("unnecessary conversion")]]
Episode
{
NEW_HOPE
,
EMPIRE
,
JEDI
};
[[nodiscard("unnecessary call")]]
constexpr
auto
getEpisodeNames
()
noexcept
{
using
namespace
std
::literals
;
return
std::array<std::string_view,
3
> {
R"gql(
NEW_HOPE
)gql"
sv,
R"gql(
EMPIRE
)gql"
sv,
R"gql(
JEDI
)gql"
sv
};
}
[[nodiscard("unnecessary call")]]
constexpr
auto
getEpisodeValues
()
noexcept
{
using
namespace
std
::literals
;
return
std::array<std::pair<std::string_view, Episode>,
3
> {
std::make_pair
(
R"gql(
JEDI
)gql"
sv, Episode::
JEDI
),
std::make_pair
(
R"gql(
EMPIRE
)gql"
sv, Episode::
EMPIRE
),
std::make_pair
(
R"gql(
NEW_HOPE
)gql"
sv, Episode::
NEW_HOPE
)
};
}
struct
[[nodiscard("unnecessary construction")]]
ReviewInput
{
explicit
ReviewInput
()
noexcept
;
explicit
ReviewInput
(
int
starsArg,
std::optional<std::string> commentaryArg)
noexcept
;
ReviewInput
(
const
ReviewInput& other);
ReviewInput
(ReviewInput&& other)
noexcept
;
~ReviewInput
();
ReviewInput&
operator
=(
const
ReviewInput& other);
ReviewInput&
operator
=(ReviewInput&& other)
noexcept
;
int
stars;
std::optional<std::string> commentary;
};
namespace
object
{
class
Character
;
class
Human
;
class
Droid
;
class
Query
;
class
Review
;
class
Mutation
;
}
//
namespace object
class
[[nodiscard("unnecessary construction")]]
Operations
final
: public service::Request
{
public:
explicit
Operations
(std::shared_ptr<object::Query> query, std::shared_ptr<object::Mutation> mutation);
template
<
class
TQuery
,
class
TMutation
>
explicit
Operations
(std::shared_ptr<TQuery> query, std::shared_ptr<TMutation> mutation)
: Operations {
std::make_shared<object::Query>(
std::move
(query)),
std::make_shared<object::Mutation>(
std::move
(mutation))
}
{
}
private:
std::shared_ptr<object::Query> _query;
std::shared_ptr<object::Mutation> _mutation;
};
void
AddCharacterDetails
(
const
std::shared_ptr<schema::InterfaceType>& typeCharacter,
const
std::shared_ptr<schema::Schema>& schema);
void
AddHumanDetails
(
const
std::shared_ptr<schema::ObjectType>& typeHuman,
const
std::shared_ptr<schema::Schema>& schema);
void
AddDroidDetails
(
const
std::shared_ptr<schema::ObjectType>& typeDroid,
const
std::shared_ptr<schema::Schema>& schema);
void
AddQueryDetails
(
const
std::shared_ptr<schema::ObjectType>& typeQuery,
const
std::shared_ptr<schema::Schema>& schema);
void
AddReviewDetails
(
const
std::shared_ptr<schema::ObjectType>& typeReview,
const
std::shared_ptr<schema::Schema>& schema);
void
AddMutationDetails
(
const
std::shared_ptr<schema::ObjectType>& typeMutation,
const
std::shared_ptr<schema::Schema>& schema);
std::shared_ptr<schema::Schema>
GetSchema
();
}
//
namespace learn
}
//
namespace graphql
#
endif
//
STARWARSSCHEMA_H
Back
|
FazBrowse Home
|
New Git URL