コード例 #1
0
ファイル: AnilistClient.cs プロジェクト: Mikibot/Miki.Anilist
        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();
        }
コード例 #2
0
        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();
        }