예제 #1
0
    public static async Task <MatchResults> GetMatchResults(int matchId)
    {
        MatchResults matchResults = await Try(
            $"MatchResults-{matchId}.json",
            () => Client.GetMatchResults(matchId));

        return(matchResults);
    }
예제 #2
0
    public static async Task <BitsMatchResult> GetBitsMatchResult(this IBitsClient client, int matchId)
    {
        Task <MatchResults>   matchResultsTask   = client.GetMatchResults(matchId);
        Task <MatchScores>    matchScoresTask    = client.GetMatchScores(matchId);
        Task <HeadResultInfo> headResultInfoTask = client.GetHeadResultInfo(matchId);
        Task <HeadInfo>       headInfoTask       = client.GetHeadInfo(matchId);

        await Task.WhenAll(matchResultsTask, matchScoresTask, headResultInfoTask, headInfoTask);

        MatchResults   matchResults   = await matchResultsTask;
        MatchScores    matchScores    = await matchScoresTask;
        HeadResultInfo headResultInfo = await headResultInfoTask;
        HeadInfo       headInfo       = await headInfoTask;

        return(new BitsMatchResult(matchResults, matchScores, headResultInfo, headInfo));
    }