Exemplo n.º 1
0
        /// <summary>
        /// Get league entries mapped by summoner ID for a given list of summoner IDs.
        /// Implementation Notes :
        /// Returns all league entries for specified summoners and summoners' teams.
        /// </summary>
        /// <param name="region">The region of the leagues.</param>
        /// <param name="summonerIds">Comma-separated list of summoner IDs. Maximum allowed at once is 10.</param>
        /// <returns>Map[string, List[LeagueDto]] LeagueDto - This object contains league information.</returns>
        public Dictionary <string, IEnumerable <LeagueDto> > GetSummonerLeagueEntriesByIds(RiotApiConfig.Regions region, params long[] summonerIds)
        {
            //https://eune.api.pvp.net/api/lol/eune/v2.5/league/by-summoner/22293716,41488614/entry?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v2.5/league/by-summoner/{string.Join(",", summonerIds)}/entry?api_key={this.ApiKey}";
            //make the call
            var dto = MakeCallToRiotApi <Dictionary <string, IEnumerable <LeagueDto> > >(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get leagues mapped by team ID for a given list of team IDs.
        /// Implementation Notes :
        /// Returns all leagues for specified teams.Entries for each requested team will be included in the returned leagues data,
        /// whether or not the team is inactive.However, no entries for other inactive teams in the leagues will be included.
        /// </summary>
        /// <param name="region">The region of the leagues.</param>
        /// <param name="teamIds">Comma-separated list of team IDs. Maximum allowed at once is 10.</param>
        /// <returns>Map[string, List[LeagueDto]] LeagueDto - This object contains league information.</returns>
        public Dictionary <string, IEnumerable <LeagueDto> > GetTeamLeaguesbyIds(RiotApiConfig.Regions region, params string[] teamIds)
        {
            //https://eune.api.pvp.net/api/lol/eune/v2.5/league/by-team/TEAM-18cc5c20-b4f9-11e4-80a9-782bcb46f3e4,TEAM-b999b8d0-18d8-11e5-8e2b-782bcb46f3e4?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v2.5/league/by-team/{string.Join(",", teamIds)}?api_key={this.ApiKey}";
            //make the call
            var dto = MakeCallToRiotApi <Dictionary <string, IEnumerable <LeagueDto> > >(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get master tier leagues.
        /// </summary>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <param name="type">Game queue type.</param>
        /// <returns>LeagueDto - This object contains league information.</returns>
        public LeagueDto GetMasterTierLeagues(RiotApiConfig.Regions region, Enums.GameQueueType type)
        {
            //https://eune.api.pvp.net/api/lol/eune/v2.5/league/master?type=RANKED_TEAM_5x5&api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v2.5/league/master?type={type}&api_key={this.ApiKey}";
            //make the call
            var dto = MakeCallToRiotApi <LeagueDto>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get recent games by summoner ID.
        /// </summary>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <param name="summonerId">ID of the summoner for which to retrieve recent games.</param>
        /// <returns>RecentGamesDto - This object contains recent games information.</returns>
        public RecentGamesDto GetRecentGamesBySummonerId(RiotApiConfig.Regions region, long summonerId)
        {
            //https://eune.api.pvp.net/api/lol/eune/v1.3/game/by-summoner/41488614/recent?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v1.3/game/by-summoner/{summonerId}/recent?api_key={this.ApiKey}";
            //make the call
            var dto = MakeCallToRiotApi <RecentGamesDto>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get summoner names mapped by summoner ID for a given list of summoner IDs.
        /// </summary>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <param name="summonerIds">Comma-separated list of summoner IDs associated with summoner names to retrieve. Maximum allowed at once is 40.</param>
        /// <returns>Return Value: Map[string, string]</returns>
        public Dictionary <string, string> GetSummonerNamesBySummonerId(RiotApiConfig.Regions region, params string[] summonerIds)
        {
            //https://eune.api.pvp.net/api/lol/eune/v1.4/summoner/41488614,41468510/name?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v1.4/summoner/{string.Join(",", summonerIds)}/name?api_key={this.ApiKey}";
            //make the call
            var dto = MakeCallToRiotApi <Dictionary <string, string> >(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get shard status.Returns the data available on the status.leagueoflegends.com website for the given region.
        /// Rate Limit Notes
        /// Requests to this API will not be counted in your Rate Limit.
        /// </summary>
        /// <param name="region">The region for which to fetch data.</param>
        /// <returns>Return Value: ShardStatus</returns>
        public ShardStatusDto GetShardStatusByRegion(RiotApiConfig.Regions region)
        {
            //http://status.leagueoflegends.com/shards/eune
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.StatusUrl;
            //compose url
            var baseUrl     = $"http://{endPoint}/";
            var apiCallPath = $"shards/{region.ToString().ToLower()}";
            //make the call
            var dto = MakeCallToRiotApi <ShardStatusDto>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Retrieve match list by summoner ID
        /// Implementation Notes
        /// A number of optional parameters are provided for filtering.It is up to the caller to ensure that the combination
        /// of filter parameters provided is valid for the requested summoner, otherwise, no matches may be returned.
        /// The maximum range for begin and end index is 20. If the range is more than 20, the end index will be modified to enforce
        /// the 20 game limit.If only one of the index parameters is specified, the other will be computed accordingly using the maximum range.
        /// If the beginTimestamp parameter is specified on its own, endTimestamp is assumed to be the current time.
        /// If the endTimestamp parameter is specified on its own, beginTimestamp is assumed to be the start of the summoner's match history.
        /// There is no limit on the allowed timestamp range.
        /// </summary>
        /// <param name="region">The region of the summoner.</param>
        /// <param name="summonerId">The ID of the summoner.</param>
        /// <param name="championIds">Comma-separated list of champion IDs to use for fetching games.</param>
        /// <param name="rankedQueues">Comma-separated list of ranked queue types to use for fetching games. Non-ranked queue types will be ignored.</param>
        /// <param name="seasons">Comma-separated list of seasons to use for fetching games.</param>
        /// <param name="beginTime">The begin time to use for fetching games specified as epoch milliseconds.</param>
        /// <param name="endTime">The end time to use for fetching games specified as epoch milliseconds.</param>
        /// <param name="beginIndex">The begin index to use for fetching games.</param>
        /// <param name="endIndex">The end index to use for fetching games.</param>
        /// <returns>MatchList - This object contains match list information</returns>
        public MatchListDto GetMatchListBySummonerId(RiotApiConfig.Regions region, long summonerId, string championIds = null,
                                                     string rankedQueues = null, string seasons = null, long?beginTime = null, long?endTime = null,
                                                     int?beginIndex      = null, int?endIndex   = null)
        {
            //https://eune.api.pvp.net/api/lol/eune/v2.2/matchlist/by-summoner/22293716?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v2.2/matchlist/by-summoner/{summonerId}?api_key={this.ApiKey}";

            //add additional parameters
            if (!string.IsNullOrEmpty(championIds))
            {
                apiCallPath += $"&championIds={championIds}";
            }
            if (!string.IsNullOrEmpty(rankedQueues))
            {
                apiCallPath += $"&rankedQueues={rankedQueues}";
            }
            if (!string.IsNullOrEmpty(seasons))
            {
                apiCallPath += $"&seasons={seasons}";
            }
            if (beginTime.HasValue)
            {
                apiCallPath += $"&beginTime={beginTime}";
            }
            if (endTime.HasValue)
            {
                apiCallPath += $"&endTime={endTime}";
            }
            if (beginIndex.HasValue)
            {
                apiCallPath += $"&beginIndex={beginIndex}";
            }
            if (endIndex.HasValue)
            {
                apiCallPath += $"&endIndex={endIndex}";
            }
            //make the call
            var dto = MakeCallToRiotApi <MatchListDto>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Retrieve match by match ID.
        /// Implementation Notes
        /// Not all matches have timeline data.If timeline data is requested, but doesn't exist, then the response won't include it.
        /// </summary>
        /// <param name="region">The region of the summoner.</param>
        /// <param name="matchId">The ID of the match.</param>
        /// <param name="includeTimeline">Flag indicating whether or not to include match timeline data</param>
        /// <returns>MatchDetail - This object contains match detail information</returns>
        public MatchDetail GetMatchById(RiotApiConfig.Regions region, long matchId, bool?includeTimeline = null)
        {
            //https://eune.api.pvp.net/api/lol/eune/v2.2/match/1?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v2.2/match/{matchId}?api_key={this.ApiKey}";

            //add additional parameters
            if (includeTimeline.HasValue)
            {
                apiCallPath += $"&includeTimeline={includeTimeline}";
            }
            //make the call
            var dto = MakeCallToRiotApi <MatchDetail>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Get player stats summaries by summoner ID.
        /// </summary>
        /// <param name="region">Region where to retrieve the data.</param>
        /// <param name="summonerId">ID of the summoner for which to retrieve player stats.</param>
        /// <param name="season">If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.</param>
        /// <returns>PlayerStatsSummaryListDto - This object contains a collection of player stats summary information.</returns>
        public PlayerStatsSummaryListDto GetPlayerStatsBySummonerId(RiotApiConfig.Regions region, long summonerId, string season = null)
        {
            //https://eune.api.pvp.net/api/lol/eune/v1.3/stats/by-summoner/22293716/summary?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(region);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/{region.ToString().ToLower()}/v1.3/stats/by-summoner/{summonerId}/summary?api_key={this.ApiKey}";

            //add additional parameters
            if (!string.IsNullOrEmpty(season))
            {
                apiCallPath += $"&season={season}";
            }
            //make the call
            var dto = MakeCallToRiotApi <PlayerStatsSummaryListDto>(baseUrl, apiCallPath);

            return(dto);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Retrieve map data.
        /// Rate Limit Notes
        /// Requests to this API will not be counted in your Rate Limit.
        /// </summary>
        /// <param name="region">Region from which to retrieve data.<</param>
        /// <param name="locale">Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.</param>
        /// <param name="version">Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.</param>
        /// <returns>MapDataDto - This object contains map data.</returns>
        public MapDataDto GetMapData(RiotApiConfig.Regions region, string locale = null, string version = null)
        {
            //https://global.api.pvp.net/api/lol/static-data/eune/v1.2/map?api_key=
            //find the appropriate end point depending the region
            var endPoint = RiotApiConfig.GetRegionalEndPointByRegion(RiotApiConfig.Regions.Global);
            //compose url
            var baseUrl     = $"https://{endPoint.Host}/";
            var apiCallPath = $"api/lol/static-data/{region.ToString().ToLower()}/v1.2/map?api_key={this.ApiKey}";

            //add additional parameters
            if (!string.IsNullOrEmpty(locale))
            {
                apiCallPath += $"&locale={locale}";
            }
            if (!string.IsNullOrEmpty(version))
            {
                apiCallPath += $"&version={version}";
            }
            //make the call
            var dto = MakeCallToRiotApi <MapDataDto>(baseUrl, apiCallPath);

            return(dto);
        }