This gist demonstrates a solution to generating a strongly-typed client for a GraphQL service.
- Create a .csproj project (e.g. MyCompany.GraphQL.Queries)
- Add some queries using .graphql files
- Add the .ps1 script above
- Install quicktype
- Add a reference to Newtonsoft.Json to the project (required by the generated query files, though that may change in the future to System.Text.Json)
- Add a client wrapper that can utilise the query types and deserialize into them (see TypedGraphQLClient.cs)
- Use it elsewhere.