예제 #1
0
        static void Main(string[] args)
        {
            SetHeaders();

            //CompetitionList competitionList = GetCompetitionList().Result;
            //List<Competition> competitions = competitionList.Competitions;
            //competitions.ForEach(c => Console.WriteLine(c.Name));

            //AreaList areaList = GetAreaList().Result;
            //List<Area> areas = areaList.Areas;
            //areas.ForEach(a => Console.WriteLine(a.Name));

            //TeamsList teamsList = GetTeamsList().Result;
            //List<Team> teams = teamsList.Teams;
            //teams.ForEach(t => Console.WriteLine($"{t.Name}, {t.Id}"));

            //Team team = GetTeam(563).Result;
            //List<Player> players = team.Squad;
            //Console.WriteLine(team.Name);
            //players.ForEach(p => Console.WriteLine($"{p.Name}, {p.Position}"));

            //MatchList matchList = GetMatchList().Result;
            //List<Match> matches = matchList.Matches;
            //matches.ForEach(m => Console.WriteLine($"{m.HomeTeam.Name} vs {m.AwayTeam.Name}"));

            StandingsList   standingsList = GetStandingsListForLeague(2021).Result;
            List <Table>    tables        = standingsList.Standings;
            Table           total         = tables.Find(t => t.Type.Equals(Type.TOTAL));
            List <Standing> standings     = total.table;

            standings.ForEach(s => Console.WriteLine($"{s.Position}, {s.Team.Name}"));
        }
예제 #2
0
        static async Task <StandingsList> GetStandingsListForLeague(int id)
        {
            var msg = await client.GetStringAsync($"https://api.football-data.org/v2/competitions/{id}/standings");

            StandingsList standingsList = JsonConvert.DeserializeObject <StandingsList>(msg);

            return(standingsList);
        }