public AnilistClient() { graph = new GraphQLClient("https://graphql.anilist.co"); getMediaByNameQuery = graph.CreateQuery() .WithSchema <AnilistMedia, IQueryBuilder>(x => x.WithDynamicParameter <string>("search") .WithDynamicParameter <MediaFormat[]>("format_not_in")) .Compile(); getMediaByIdQuery = graph.CreateQuery() .WithSchema <AnilistMedia, IQueryBuilder>(x => x.WithDynamicParameter <int>("id", true)) .Compile(); }
static void Main(string[] args) { GraphQLClient client = new GraphQLClient("https://fakerql.com/graphql"); IGraphQLQuery query = client.CreateQuery() .WithType("allUsers", x => x.WithDynamicParameter <long>("count") .WithObject("id") .WithObject("firstName") ) .Compile(); var users = query.ExecuteAsync <UserCollection>(("count", 5)).Result; Console.WriteLine(string.Join(",", users.allUsers.Select(x => x.firstName))); Console.Read(); }