Join Glenn Block for an in-depth discussion in this video Create OrderStatuses GraphQL enum, part of API Development in .NET with GraphQL.
- [Instructor] Okay, now let's go create our order status' enum. So we're going to right click on schema, add a new class, and we're going to call this order status enum. And we're going to pull in our graph QL types. Name spacing in from line one. We'll make this public.
And we're going to use a new type that we haven't used up until now which is enumeration graph type. Now, the way this works is, previously, you saw that we defined an actual order status' enum for our model. Graph QL has a first class concept of enum. So this is what we're defining right now. And what we basically have to do is populate each value that will be available to the graph QL clients for the enum. So we're going to give it a name. And we'll go and start adding in our values.
So we're going to give it a value of created. And you'll see that I have to provide it an additional value. This is the value that corresponds to the enum value so if you remember what I defined the original enum, I basically had defined created as two. So we're going to plug in all those values now. So now I'm going to put processing.
Completed. Canceled. And finally, closed.
Okay, now we can continue.
- Creating a new GraphQL project
- Exposing a new GraphQL API
- Enabling and creating mutations
- Updating and configuring the schema
- Enabling subscriptions
- New GraphQL.NET schema classes
- Creating the OrderEventType