Exemple #1
0
        static async Task Main(string[] args)
        {
            var service = new PokemonService("https://graphql-pokemon.now.sh");

            IEnumerable <Pokemon> pokemons;

            if (args != null && args.Length > 0)
            {
                if (args.Length == 1)
                {
                    pokemons = new List <Pokemon> {
                        await service.GetPokemon(args[0])
                    };
                }
                else
                {
                    pokemons = await service.GetPokemonBatch(args);
                }
            }
            else
            {
                pokemons = await service.GetAllPokemons();
            }

            foreach (var pokemon in pokemons)
            {
                Console.WriteLine(pokemon);
            }
        }
Exemple #2
0
        static async Task Main(string[] args)
        {
            var service = new PokemonService("https://graphql-pokemon.now.sh");

            IEnumerable <Pokemon> pokemons;

            if (args != null && args.Length > 0)
            {
                pokemons = await Task.WhenAll(args.Select(name => service.GetPokemon(name)));
            }
            else
            {
                pokemons = await service.GetAllPokemons();
            }

            foreach (var pokemon in pokemons)
            {
                Console.WriteLine(pokemon);
            }
        }