示例#1
0
        /// <summary>
        /// Get recent games by summoner ID asynchronously
        /// </summary>
        /// <param name="summonerId">ID of the summoner for which to retrieve recent games.</param>
        /// <param name="region">Region where to retrieve the data</param>
        /// <returns>The Summoners Recent Games</returns>
        public async Task <RecentGamesResult> GetGamesBySummonerAsync(long summonerId, string region = null)
        {
            var recentGamesResult = JsonWebRequest <RecentGamesResult> .CreateRequestAsync(GetApiUri(api : "game", region : region, summonerId : summonerId));

            var result = await recentGamesResult;

            return(result);
        }
示例#2
0
        /// <summary>
        /// Retrieves leagues data for summoner asynchronously, including leagues for all of summoner's teams
        /// </summary>
        /// <param name="summonerId">Summoner ID</param>
        /// <param name="region">The region of the leagues</param>
        /// <returns>A dictonary with the key as league name, and the value the League DTO</returns>
        public async Task <LeagueResult> GetLeagueBySummonerAsync(long summonerId, string region = null)
        {
            var recentGamesResult = JsonWebRequest <LeagueResult> .CreateRequestAsync(GetApiUri(api : "league", region : region, summonerId : summonerId, version : "v2.1"));

            var result = await recentGamesResult;

            return(result);
        }
示例#3
0
        /// <summary>
        /// Get player stats summaries by summoner ID asynchronously. One summary is returned per queue type
        /// </summary>
        /// <param name="summonerId">ID of the summoner for which to retrieve player stats.</param>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <param name="season">If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.</param>
        /// <returns>Player stats summary result</returns>
        public async Task <PlayerStatsSummaryResult> GetPlayerStatsSummaryAsync(long summonerId, string region = null, string season = null)
        {
            var recentGamesResult = JsonWebRequest <PlayerStatsSummaryResult> .CreateRequestAsync(GetApiUri(api : "stats", region : region, summonerId : summonerId, season : season));

            var result = await recentGamesResult;

            return(result);
        }
示例#4
0
        /// <summary>
        /// Retrieves teams for given summoner ID aynchronously
        /// </summary>
        /// <param name="summonerId">ID of the summoner for which to retrieve player stats.</param>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <returns>A task with the summoner teams in the result</returns>
        public async Task <TeamResult> GetSummonerTeamsAsync(long summonerId, string region = null)
        {
            var recentGamesResult = JsonWebRequest <TeamResult> .CreateRequestAsync(GetApiUri(api : "team", version : "v2.1", region : region, summonerId : summonerId));

            var result = await recentGamesResult;

            return(result);
        }
示例#5
0
        /// <summary>
        /// Get rune pages by summoner ID asynchronously
        /// </summary>
        /// <param name="summonerId">ID of the summoner for which to retrieve rune pages.</param>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <returns>Task containing the rune pages result</returns>
        public async Task <RunePagesResult> GetSummonerRunesAsync(long summonerId, string region = null)
        {
            var recentGamesResult = JsonWebRequest <RunePagesResult> .CreateRequestAsync(GetApiUri(api : "summoner", method : "runes", region : region, summonerId : summonerId));

            var result = await recentGamesResult;

            return(result);
        }
示例#6
0
        /// <summary>
        /// Get list of summoner names by summoner IDs asynchronously
        /// </summary>
        /// <param name="summonerIds">Comma-separated list of summoner IDs associated with summoner names to retrieve. Maximum allowed at once is 40.</param>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <returns>The task containing a list of summoner name information </returns>
        public async Task <SummonerNameListResult> GetSummonersAsync(string summonerIds, string region = null)
        {
            var recentGamesResult = JsonWebRequest <SummonerNameListResult> .CreateRequestAsync(GetApiUri(api : "summoner", method : "name", summonerIds : summonerIds, region : region));

            var result = await recentGamesResult;

            return(result);
        }
示例#7
0
        /// <summary>
        /// Get summoner by summoner ID asynchronously
        /// </summary>
        /// <param name="summonerId">ID of the summoner to retrieve</param>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <returns>A Summoner task</returns>
        public async Task <SummonerDto> GetSummonerAsync(long summonerId, string region = null)
        {
            var recentGamesResult = JsonWebRequest <SummonerDto> .CreateRequestAsync(GetApiUri(api : "summoner", summonerId : summonerId, region : region));

            var result = await recentGamesResult;

            return(result);
        }
示例#8
0
        /// <summary>
        /// Retrieve all champions asynchronously
        /// </summary>
        /// <param name="region">The region of the leagues</param>
        /// <param name="freeToPlay">Optional filter param to retrieve only free to play champions.</param>
        /// <returns>Champion list task containing the result</returns>
        public async Task <ChampionsResult> GetChampionsAsync(string region = null, bool freeToPlay = false)
        {
            if (ApiCache.Instance.CachingEnabled && ApiCache.Instance.Champions.Count > 0)
            {
                return(new ChampionsResult {
                    Champions = ApiCache.Instance.Champions
                });
            }

            var championsRequest = JsonWebRequest <ChampionsResult> .CreateRequestAsync(GetApiUri(api : "champion", freeToPlay : freeToPlay));

            var result = await championsRequest;

            if (ApiCache.Instance.CachingEnabled)
            {
                ApiCache.Instance.Champions = result.Champions;
            }
            return(result);
        }