Пример #1
0
        public async Task Generate(string league)
        {
            // 1. Load a specific league
            var leagueList = await _client.GetAsync <LeagueList>($"lol/league/v4/{ league }/by-queue/RANKED_SOLO_5x5");

            // 2. Load unique games
            foreach (var summoner in leagueList.Entries)
            {
                var account = await GetAccount(summoner);

                var matches = await _client.GetAsync <MatchList>($"lol/match/v4/matchlists/by-account/{ account.AccountId }?queue=420");

                foreach (var match in matches.Matches)
                {
                    if (await _gameRepository.GameResultExists(match.GameId))
                    {
                        continue;
                    }

                    // 3. Load the game, store picks and winner for model creation
                    var matchDetails = await _client.GetAsync <Match>($"lol/match/v4/matches/{ match.GameId }");

                    var game = _riotModelMapper.TranslateMatchToGame(matchDetails);
                    if (game != null)
                    {
                        await _gameRepository.InsertGameResult(game);
                    }
                }
            }
        }
Пример #2
0
        public async Task <SuggestionRelationResult> GetSuggestion(string songId, Guid modeId, Guid userId)
        {
            var dictionary = new Dictionary <string, object>
            {
                { "songId", songId },
                { "modeId", modeId },
                { "userId", userId }
            };
            var result = await _restClientWrapper.GetAsync <SuggestionRelationResult>(dictionary, "Suggestion");

            return(result);
        }
Пример #3
0
        private async Task <Realm> LoadCurrentPatch()
        {
            var response = await _client.GetAsync <Realm>("realms/na.json");

            return(response);
        }