A GraphQL Client for .NET Standard over HTTP.
The Library will try to follow the following standards and documents: GraphQL Specification GraphQL HomePage
var heroRequest = new GraphQLRequest {
Query = @"
{
hero {
name
}
}"
};
var heroAndFriendsRequest = new GraphQLRequest {
Query = @"
query HeroNameAndFriends($episode: Episode) {
hero(episode: $episode) {
name
friends {
name
}
}
}",
OperationName = "HeroNameAndFriends",
Variables = new {
episode = "JEDI"
}
};
var graphQLClient = new GraphQLClient("https://swapi.apis.guru/");
var graphQLResponse = await graphQLClient.PostAsync(heroRequest);
var graphQLResponse = await graphQLClient.PostAsync(heroRequest);
var dynamicHeroName = graphQLResponse.Data.hero.name.Value; //Value of data->hero->name
var graphQLResponse = await graphQLClient.PostAsync(heroRequest);
var personType = graphQLResponse.GetDataFieldAs<Person>("hero"); //data->hero is casted as Person
var name = personType.Name;
StarWars Example Server (GitHub) StarWars Example Server (EndPoint)
GitHub GraphQL API Docs GitHub GraphQL Explorer GitHub GraphQL Endpoint