Beispiel #1
0
        public IEnumerable<MatchHistory> GetPages()
        {
            MatchHistory history = api.GetMatchHistory();
            yield return history;

            while(history.ResultsRemaining > 0)
            {
                MatchHistoryRequest request = new MatchHistoryRequest()
                {
                    StartAtMatchId = history.GetLastMatchId() - 1
                };
                history = api.GetMatchHistory(request);
                yield return history;
            }
        }
Beispiel #2
0
        public IEnumerable <MatchHistory> GetPages()
        {
            MatchHistory history = api.GetMatchHistory();

            yield return(history);

            while (history.ResultsRemaining > 0)
            {
                MatchHistoryRequest request = new MatchHistoryRequest()
                {
                    StartAtMatchId = history.GetLastMatchId() - 1
                };
                history = api.GetMatchHistory(request);
                yield return(history);
            }
        }
Beispiel #3
0
        public MatchHistory GetMatchHistory(MatchHistoryRequest request)
        {
            logger.Debug("Calling GetMatchHistory with {0}", request);
            string url = "https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=A41B14673A53F4C0A5281A6C47637C9E";

            Uri uri = new Uri(url)
                .AddQuery("player_name", request.PlayerName)
                .AddQuery("start_at_match_id", request.StartAtMatchId)
                .AddQuery("date_min", request.MinDate)
                .AddQuery("date_max", request.MaxDate);

            string json = webClient.Get(uri);

            MatchHistoryEnvelope envelope = JsonConvert.DeserializeObject<MatchHistoryEnvelope>(json);
            MatchHistory history = envelope.Result;
            logger.Debug("Got {0} results starting at {1}; Remaining: {2}; Total:{3}",
                history.NumResults,
                history.Matches.Count == 0 ? "N/A" : history.Matches[0].Id.ToString(),
                history.ResultsRemaining,
                history.TotalResults);
            return history;
        }
Beispiel #4
0
        public MatchHistory GetMatchHistory(MatchHistoryRequest request)
        {
            logger.Debug("Calling GetMatchHistory with {0}", request);
            string url = "https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=" + KEY;

            Uri uri = new Uri(url)
                      .AddQuery("player_name", request.PlayerName)
                      .AddQuery("start_at_match_id", request.StartAtMatchId)
                      .AddQuery("date_min", request.MinDate)
                      .AddQuery("date_max", request.MaxDate);

            string json = webClient.Get(uri);

            MatchHistoryEnvelope envelope = JsonConvert.DeserializeObject <MatchHistoryEnvelope>(json);
            MatchHistory         history  = envelope.Result;

            logger.Debug("Got {0} results starting at {1}; Remaining: {2}; Total:{3}",
                         history.NumResults,
                         history.Matches.Count == 0 ? "N/A" : history.Matches[0].Id.ToString(),
                         history.ResultsRemaining,
                         history.TotalResults);
            return(history);
        }