diff --git a/RiotSharp.AspNetCore/IServiceCollectionExtension.cs b/RiotSharp.AspNetCore/IServiceCollectionExtension.cs index 706dc37d..6281c1e9 100644 --- a/RiotSharp.AspNetCore/IServiceCollectionExtension.cs +++ b/RiotSharp.AspNetCore/IServiceCollectionExtension.cs @@ -58,8 +58,8 @@ public static IServiceCollection AddRiotSharp(this IServiceCollection serviceCol serviceCollection.AddSingleton(serviceProvider => new StaticDataEndpoints(serviceProvider.GetRequiredService())); - serviceCollection.AddSingleton(serviceProvider => - new RiotApi(rateLimitedRequester, serviceProvider.GetRequiredService())); + //serviceCollection.AddSingleton(serviceProvider => + //new RiotApi(rateLimitedRequester, serviceProvider.GetRequiredService())); } if (riotSharpOptions.TournamentApi.ApiKey != null) diff --git a/RiotSharp.AspNetCore/RiotSharp.AspNetCore.csproj b/RiotSharp.AspNetCore/RiotSharp.AspNetCore.csproj index 32f34094..8e991c60 100644 --- a/RiotSharp.AspNetCore/RiotSharp.AspNetCore.csproj +++ b/RiotSharp.AspNetCore/RiotSharp.AspNetCore.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.1 RiotSharp.AspNetCore 0.1.0 0.1.0 diff --git a/RiotSharp.Test/CommonTestBase.cs b/RiotSharp.Test/CommonTestBase.cs index 1a2ea03c..0215ca16 100644 --- a/RiotSharp.Test/CommonTestBase.cs +++ b/RiotSharp.Test/CommonTestBase.cs @@ -14,13 +14,13 @@ public class CommonTestBase public static string ApiKey = Configuration["ApiKey"]; public static string FaultyApiKey = "deadbeef-dead-beef-dead-beefdeadbeef"; - public static Region Summoner1And2Region = (Region)Enum.Parse(typeof(Region), "Na"); + public static Region Summoner1And2Region = (Region)Enum.Parse(typeof(Region), "Eun1"); public static long InvalidSummonerId = -1; - public static string Summoner1Id = "fhOx2QJ2VKSaaD9nVJ4XJSzMBPW2es7FboigIwW5ss97coA"; - public static string Summoner1AccountId = "6GwG-_gvthMjC4bMSh-K_n89fXmwAO2r_xW_bydQX6jsQdI"; - public static string Summoner1Name = "toothlessG"; - public static string Summoner1Puuid = "R2RjsXCUB-zJ9T5cZVr1ZI4vVqa3sOR61xRmU71bsJ3o_TCRR_ttdVphhKaD4y57xcvB2AdrNWqGKw"; + public static string Summoner1Id = "79Ks2KwGjbX3ar0InA4SZoo5VhBffkYmvjHIFfCNzWqtiZM"; + public static string Summoner1AccountId = "IjeB_hkeO8eS9-g36yTJvXPuHu7ge6rLRhYkIfJSVVLiqQ"; + public static string Summoner1Name = "Feeding King"; + public static string Summoner1Puuid = "NrPw06OU-eP-iQEh-V1oXcA3IeIA9ofQf5e-1dgt7uY5TT_FFDTaGQgiDKNaDqat8IXTpRTUuj5mIA"; public static long Summoner2Id = 31815991; public static long Summoner2AccountId = 46532395; diff --git a/RiotSharp.Test/EndpointTests/ChampionEndpointTests.cs b/RiotSharp.Test/EndpointTests/ChampionEndpointTests.cs new file mode 100644 index 00000000..112a9998 --- /dev/null +++ b/RiotSharp.Test/EndpointTests/ChampionEndpointTests.cs @@ -0,0 +1,34 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using RiotSharp.Caching; +using RiotSharp.Endpoints.ChampionEndpoint; +using RiotSharp.Endpoints.Interfaces; +using RiotSharp.Http.Interfaces; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace RiotSharp.Test.EndpointTests +{ + [TestClass] + public class ChampionEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("ChampionRotation"), TestCategory("Async")] + public void GetChampionRotationAsync_Test() + { + EnsureCredibility(() => + { + var championRotation = Api.Champion.GetChampionRotationAsync(Region.Eun1).Result; + + Assert.IsTrue(championRotation.FreeChampionIds.Count == 15); + Assert.IsTrue(championRotation.FreeChampionIdsForNewPlayers.Count == 10); + Assert.IsTrue(championRotation.MaxNewPlayerLevel > 0); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/ChampionMasteryEndpoint.cs b/RiotSharp.Test/EndpointTests/ChampionMasteryEndpoint.cs new file mode 100644 index 00000000..6791e2bd --- /dev/null +++ b/RiotSharp.Test/EndpointTests/ChampionMasteryEndpoint.cs @@ -0,0 +1,56 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests +{ + [TestClass] + public class ChampionMasteryEndpoint : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetChampionMasteryAsync_Test() + { + EnsureCredibility(() => + { + var championMastery = Api.ChampionMastery.GetChampionMasteryAsync(Summoner1And2Region, + Summoner1Id, RiotApiTestBase.Summoner1MasteryChampionId).Result; + + Assert.AreEqual(RiotApiTestBase.Summoner1MasteryChampionId, + championMastery.ChampionId); + Assert.AreEqual(RiotApiTestBase.Summoner1MasteryChampionLevel, + championMastery.ChampionLevel); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetChampionsMasteriesAsync_Test() + { + EnsureCredibility(() => + { + var allChampionsMastery = Api.ChampionMastery.GetChampionMasteriesAsync( + Summoner1And2Region, Summoner1Id).Result; + + Assert.IsNotNull(allChampionsMastery.Find(championMastery => + championMastery.ChampionId == RiotApiTestBase.Summoner1MasteryChampionId)); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetTotalChampionMasteryScoreAsync_Test() + { + EnsureCredibility(() => + { + var totalChampionMasteryScore = Api.ChampionMastery.GetTotalChampionMasteryScoreAsync( + Summoner1And2Region, Summoner1Id).Result; + + Assert.IsTrue(totalChampionMasteryScore > -1); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/LeagueEndpointTest.cs b/RiotSharp.Test/EndpointTests/LeagueEndpointTest.cs new file mode 100644 index 00000000..47b92a6b --- /dev/null +++ b/RiotSharp.Test/EndpointTests/LeagueEndpointTest.cs @@ -0,0 +1,92 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests +{ + [TestClass] + public class LeagueEndpointTest : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetLeagueEntriesBySummonerAsync_Test() + { + EnsureCredibility(() => + { + // TODO: tests for other sumoners + var leagues = Api.League.GetLeagueEntriesBySummonerAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.SummonerIds[0]); + + Assert.IsTrue(leagues.Result.Count > 0); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetLeagueByIdAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.League.GetLeagueByIdAsync(RiotApiTestBase.SummonersRegion, "5ae26d6d-c07a-3d29-ae0f-1ac9ca4a4f4a"); + + Assert.IsTrue(leagues.Result.Queue != null); + Assert.AreEqual(Tier.Challenger, leagues.Result.Tier); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetLeagueEntriesAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.League.GetLeagueEntriesAsync(RiotApiTestBase.SummonersRegion, + RiotSharp.Misc.Queue.RankedSolo5x5, + Tier.Bronze, + Division.I); + + Assert.IsTrue(leagues.Result.Count > 0); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetLeagueGrandmastersByQueueAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.League.GetLeagueGrandmastersByQueueAsync(RiotApiTestBase.SummonersRegion, RiotSharp.Misc.Queue.RankedSolo5x5); + + Assert.IsTrue(leagues.Result.Queue != null); + }); + } + + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetChallengerLeagueAsync_Test() + { + EnsureCredibility(() => + { + var league = Api.League.GetChallengerLeagueAsync(Summoner1And2Region, RiotApiTestBase.Queue); + + Assert.IsTrue(league.Result.Entries.Count > 0); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMasterLeagueAsync_Test() + { + EnsureCredibility(() => + { + var league = Api.League.GetMasterLeagueAsync(Summoner1And2Region, RiotApiTestBase.Queue); + + Assert.IsTrue(league.Result.Entries.Count > 0); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/LoRTests/LoRRankedEndpointTests.cs b/RiotSharp.Test/EndpointTests/LoRTests/LoRRankedEndpointTests.cs new file mode 100644 index 00000000..bdb7cc33 --- /dev/null +++ b/RiotSharp.Test/EndpointTests/LoRTests/LoRRankedEndpointTests.cs @@ -0,0 +1,27 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests.LoRTests +{ + [TestClass] + public class LoRRankedEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("LoR"), TestCategory("Async")] + public void GetLoRRankedLeaderboardsAsync_Test() + { + EnsureCredibility(() => + { + var leaderboards = Api.LoR_Leaderboards.GetLoRRankedLeaderboardsAsync(Region.Europe).Result; + + Assert.IsTrue(leaderboards.Players.Count == 6); + Assert.AreEqual(0, leaderboards.Players[0].Rank); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/MatchEndpointTests.cs b/RiotSharp.Test/EndpointTests/MatchEndpointTests.cs index cee33669..88a72266 100644 --- a/RiotSharp.Test/EndpointTests/MatchEndpointTests.cs +++ b/RiotSharp.Test/EndpointTests/MatchEndpointTests.cs @@ -3,23 +3,31 @@ using RiotSharp.Caching; using RiotSharp.Endpoints.Interfaces; using RiotSharp.Endpoints.MatchEndpoint; +using RiotSharp.Endpoints.MatchEndpoint.Enums; using RiotSharp.Http.Interfaces; using RiotSharp.Misc; using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; namespace RiotSharp.Test.EndpointTests { [TestClass] - public class MatchEndpointTests + public class MatchEndpointTests : CommonTestBase { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + private Mock _rateLimitedRequester; private IMatchEndpoint _matchEndpoint; private const string ResponsePath = "./Resources/MatchEndpoint/MatchList_EUW_Response.txt"; + // The maximum time range allowed is one week, otherwise a 400 error code is returned. + private static readonly DateTime BeginTime = DateTime.Now.AddDays(-6); + private static DateTime EndTime => DateTime.Now; + [TestInitialize] public void Initialize() { @@ -28,7 +36,7 @@ public void Initialize() } [TestMethod] - public void GetMatchListAsync_Test() + public void GetMatchListAsync2_Test() { _rateLimitedRequester.Setup(moq => moq.CreateGetRequestAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).ReturnsAsync(File.ReadAllText(ResponsePath)); @@ -42,6 +50,183 @@ public void GetMatchListAsync_Test() Assert.AreEqual(matchReference.Region, Region.Euw); } } - + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchAsync_RunesMasteries_Test() + { + EnsureCredibility(() => + { + var match = Api.Match.GetMatchAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.RunesMasteriesGameId).Result; + + Assert.AreEqual(RiotApiTestBase.RunesMasteriesGameId, match.GameId); + Assert.IsNotNull(match.ParticipantIdentities); + Assert.IsNotNull(match.Participants); + Assert.IsNotNull(match.Teams); + /*foreach (var participant in match.Participants) + { + //Assert.IsNotNull(participant.Runes); // List of legacy Rune information. Not included for matches played with Runes Reforged. + //Assert.IsNotNull(participant.Masteries); // List of legacy Mastery information. Not included for matches played with Runes Reforged. + //foreach (var rune in participant.Runes) + //{ + // Assert.IsTrue(rune.RuneId != 0); + // Assert.IsTrue(rune.Rank != 0); + //} + //foreach (var mastery in participant.Masteries) + //{ + // Assert.IsTrue(mastery.MasteryId != 0); + // Assert.IsTrue(mastery.Rank != 0); + //} + }*/ + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchAsync_Perks_Test() + { + EnsureCredibility(() => + { + var match = Api.Match.GetMatchAsync(RiotSharp.Misc.Region.Euw, RiotApiTestBase.PerksGameId).Result; + + Assert.AreEqual(RiotApiTestBase.PerksGameId, match.GameId); + Assert.IsNotNull(match.ParticipantIdentities); + Assert.IsNotNull(match.Participants); + Assert.IsNotNull(match.Teams); + foreach (var participant in match.Participants) + { + Assert.IsTrue(participant.Stats.Perk0 != 0); + Assert.IsTrue(participant.Stats.Perk1 != 0); + Assert.IsTrue(participant.Stats.Perk2 != 0); + Assert.IsTrue(participant.Stats.Perk3 != 0); + Assert.IsTrue(participant.Stats.Perk4 != 0); + Assert.IsTrue(participant.Stats.Perk5 != 0); + Assert.IsTrue(participant.Stats.StatPerk0 != 0); + Assert.IsTrue(participant.Stats.StatPerk1 != 0); + Assert.IsTrue(participant.Stats.StatPerk2 != 0); + } + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchTimelineAsync_Test() + { + EnsureCredibility(() => + { + var matchTimeline = Api.Match.GetMatchTimelineAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.GameId).Result; + + Assert.IsNotNull(matchTimeline.Frames); + Assert.IsTrue(matchTimeline.Frames.First().Timestamp == TimeSpan.FromMilliseconds(144)); + Assert.IsTrue(matchTimeline.FrameInterval == TimeSpan.FromMilliseconds(60000)); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_Test() + { + EnsureCredibility(() => + { + var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.Summoners1Region, + RiotApiTestBase.Summoner1AccountId).Result.Matches; + + Assert.IsTrue(matches.Any()); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_ChampionIds_Test() + { + EnsureCredibility(() => + { + var matches = Api.Match.GetMatchListAsync(Region.Eun1, + RiotApiTestBase.Summoner1AccountId, new List { RiotApiTestBase.ChampionId }).Result.Matches; + + foreach (var match in matches) + { + Assert.AreEqual(RiotApiTestBase.ChampionId.ToString(), + match.ChampionID.ToString()); + } + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_Queues_Test() + { + EnsureData(() => + { + EnsureCredibility(() => + { + var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, + RiotApiTestBase.AccountIds[1], null, + new List { RiotApiTestBase.QueueId }, + null, BeginTime, EndTime, 1, 10).Result.Matches; + + foreach (var match in matches) + { + Assert.AreEqual(RiotApiTestBase.QueueId, match.Queue); + } + }); + }, "No Matches found fot the test summoner (404)."); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_Seasons_Test() + { + EnsureData(() => + { + EnsureCredibility(() => + { + var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.Summoners1Region, + Summoner1AccountId, null, null, + new List { }).Result.Matches; + + Assert.IsTrue(matches.Any()); + + foreach (var match in matches) + { + Assert.AreEqual(Season.Season2019.ToString(), match.Season.ToString()); + } + }); + }, "No Matches found fot the test summoner (404)."); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_DateTimes_Test() + { + EnsureCredibility(() => + { + var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, + RiotApiTestBase.AccountIds[0], null, null, null, BeginTime, EndTime).Result.Matches; + + foreach (var match in matches) + { + Assert.IsTrue(DateTime.Compare(match.Timestamp, BeginTime) >= 0); + Assert.IsTrue(DateTime.Compare(match.Timestamp, EndTime) <= 0); + } + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetMatchListAsync_Index_Test() + { + EnsureCredibility(() => + { + const int beginIndex = 0; + const int endIndex = 32; + + var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.Summoners1Region, + RiotApiTestBase.Summoner1AccountId, null, null, null, null, null, beginIndex, endIndex).Result.Matches; + + Assert.IsTrue(matches.Count <= endIndex - beginIndex); + }); + } + } } diff --git a/RiotSharp.Test/EndpointTests/SummonerEndpointTests.cs b/RiotSharp.Test/EndpointTests/SummonerEndpointTests.cs new file mode 100644 index 00000000..ed8f5879 --- /dev/null +++ b/RiotSharp.Test/EndpointTests/SummonerEndpointTests.cs @@ -0,0 +1,66 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests +{ + [TestClass] + public class SummonerEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetSummonerBySummonerIdAsync_ExistingId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.Summoner.GetSummonerBySummonerIdAsync(Summoner1And2Region, + Summoner1Id); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetSummonerByAccountIdAsync_ExistingAccountId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.Summoner.GetSummonerByAccountIdAsync(Summoner1And2Region, + Summoner1AccountId); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetSummonerByNameAsync_ExistingName_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.Summoner.GetSummonerByNameAsync(Summoner1And2Region, + Summoner1Name); + + Assert.AreEqual(Summoner1Id, summoner.Result.Id); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetSummonerBySummonerPuuidAsync_ExistingId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.Summoner.GetSummonerByPuuidAsync(Summoner1And2Region, + Summoner1Puuid); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTLeagueEndpointTests.cs b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTLeagueEndpointTests.cs new file mode 100644 index 00000000..2fc24ddd --- /dev/null +++ b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTLeagueEndpointTests.cs @@ -0,0 +1,88 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests.TFTEndpoints +{ + [TestClass] + public class TFTLeagueEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTChallengerLeagueAsync_Test() + { + EnsureCredibility(() => + { + var league = Api.TftLeague.GetTFTChallengerLeagueAsync(Region.Eun1); + + Assert.IsTrue(league.Result.Entries.Count > 0); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTGrandmasterLeagueAsync_Test() + { + EnsureCredibility(() => + { + var league = Api.TftLeague.GetTFTGrandmasterLeagueAsync(Region.Eun1); + + Assert.IsTrue(league.Result.Entries.Count > 0); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTMasterLeagueAsync_Test() + { + EnsureCredibility(() => + { + var league = Api.TftLeague.GetTFTMasterLeagueAsync(Region.Eun1); + + Assert.IsTrue(league.Result.Entries.Count > 0); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTLeagueEntriesBySummonerAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.TftLeague.GetTFTLeagueEntriesBySummonerIdAsync(Region.Eun1, RiotApiTestBase.Summoner1Id); + + Assert.IsNotNull(leagues.Result); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTLeagueEntriesByTierAndDivisionAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.TftLeague.GetTFTLeagueEntriesByTierAndDivisionAsync(Region.Eun1, Tier.Gold, Division.II); + + Assert.IsNotNull(leagues.Result); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTLeagueByLeagueIdAsync_Test() + { + EnsureCredibility(() => + { + var leagues = Api.TftLeague.GetTFTLeaguesByLeagueIdAsync(Region.Eun1, RiotApiTestBase.TftLeagueId); + + Assert.IsTrue(leagues.Result.Queue != null); + Assert.AreEqual(Tier.Silver, leagues.Result.Tier); + }); + } + } +} diff --git a/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTMatchEndpointTests.cs b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTMatchEndpointTests.cs new file mode 100644 index 00000000..5e35d25b --- /dev/null +++ b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTMatchEndpointTests.cs @@ -0,0 +1,40 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests.TFTEndpoints +{ + [TestClass] + public class TFTMatchEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTMatchListBySummonerPuuidAsync_Test() + { + EnsureCredibility(() => + { + var matchList = Api.TftMatch.GetTftMatchListByPuuidAsync(Region.Europe, "NrPw06OU-eP-iQEh-V1oXcA3IeIA9ofQf5e-1dgt7uY5TT_FFDTaGQgiDKNaDqat8IXTpRTUuj5mIA"); + + Assert.IsTrue(matchList.Result.Count > 0); + }); + } + + [TestMethod] + [TestCategory("TFT"), TestCategory("Async")] + public void GetTFTMatchByMatchIdAsync_Test() + { + EnsureCredibility(() => + { + var matchList = Api.TftMatch.GetTftMatchByMatchIdAsync(Region.Europe, "EUN1_2365690165"); + + Assert.IsNotNull(matchList.Result); + }); + } + } + +} \ No newline at end of file diff --git a/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTSummonerEndpointTests.cs b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTSummonerEndpointTests.cs new file mode 100644 index 00000000..139d7d08 --- /dev/null +++ b/RiotSharp.Test/EndpointTests/TFTEndpoints/TFTSummonerEndpointTests.cs @@ -0,0 +1,66 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Test.EndpointTests.TFTEndpoints +{ + [TestClass] + public class TFTSummonerEndpointTests : CommonTestBase + { + private static readonly RiotApi Api = RiotApi.GetDevelopmentInstance(ApiKey); + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetTftSummonerBySummonerIdAsync_ExistingId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.TftSummoner.GetTFTSummonerBySummonerIdAsync(Summoner1And2Region, + Summoner1Id); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetTftSummonerByAccountIdAsync_ExistingAccountId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.TftSummoner.GetTFTSummonerByAccountIDAsync(Summoner1And2Region, + Summoner1AccountId); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetTftSummonerByNameAsync_ExistingName_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.TftSummoner.GetTFTSummonerByNameAsync(Summoner1And2Region, + Summoner1Name); + + Assert.AreEqual(Summoner1Id, summoner.Result.Id); + }); + } + + [TestMethod] + [TestCategory("RiotApi"), TestCategory("Async")] + public void GetTftSummonerBySummonerPuuidAsync_ExistingId_ReturnsSummoner() + { + EnsureCredibility(() => + { + var summoner = Api.TftSummoner.GetTFTSummonerByAccountPuuidAsync(Summoner1And2Region, + Summoner1Puuid); + + Assert.AreEqual(Summoner1Name, summoner.Result.Name); + }); + } + } +} diff --git a/RiotSharp.Test/Misc/CultureInfoExtensionsTest.cs b/RiotSharp.Test/Misc/CultureInfoExtensionsTest.cs index c37dbba2..22f3287f 100644 --- a/RiotSharp.Test/Misc/CultureInfoExtensionsTest.cs +++ b/RiotSharp.Test/Misc/CultureInfoExtensionsTest.cs @@ -21,14 +21,14 @@ public class CultureInfoExtensionsTest { Language.ro_RO, new CultureInfo("ro") }, { Language.ru_RU, new CultureInfo("ru") }, { Language.th_TH, new CultureInfo("th") }, { Language.tr_TR, new CultureInfo("tr") }, { Language.vn_VN, new CultureInfo("vn") }, { Language.zh_CN, new CultureInfo("zh") }, - + }; private static Dictionary directlySupportedCultureInfos = new Dictionary { { Language.cs_CZ, new CultureInfo("cs-CZ") }, { Language.de_DE, new CultureInfo("de-DE") }, { Language.el_GR, new CultureInfo("el-GR") }, { Language.en_AU, new CultureInfo("en-AU") }, { Language.en_GB, new CultureInfo("en-GB") }, { Language.en_PH, new CultureInfo("en-PH") }, - { Language.en_PL, new CultureInfo("en-PL") }, { Language.en_SG, new CultureInfo("en-SG") }, + { Language.en_SG, new CultureInfo("en-SG") }, { Language.zh_TW, new CultureInfo("zh-TW") }, { Language.en_US, new CultureInfo("en-US") }, { Language.es_AR, new CultureInfo("es-AR") }, { Language.es_ES, new CultureInfo("es-ES") }, { Language.es_MX, new CultureInfo("es-MX") }, { Language.fr_FR, new CultureInfo("fr-FR") }, { Language.hu_HU, new CultureInfo("hu-HU") }, @@ -38,8 +38,7 @@ public class CultureInfoExtensionsTest { Language.pt_BR, new CultureInfo("pt-BR") }, { Language.ro_RO, new CultureInfo("ro-RO") }, { Language.ru_RU, new CultureInfo("ru-RU") }, { Language.th_TH, new CultureInfo("th-TH") }, { Language.tr_TR, new CultureInfo("tr-TR") }, { Language.vn_VN, new CultureInfo("vn-VN") }, - { Language.zh_CN, new CultureInfo("zh-CN") }, { Language.zh_MY, new CultureInfo("zh-MY") }, - { Language.zh_TW, new CultureInfo("zh-TW") } + { Language.zh_CN, new CultureInfo("zh-CN") }, { Language.zh_MY, new CultureInfo("zh-MY") } }; private static CultureInfo unsupportedNeutralCultureInfo = new CultureInfo("et"); private static CultureInfo unsupportedCultureInfo = new CultureInfo("et-ET"); @@ -48,7 +47,7 @@ public class CultureInfoExtensionsTest public void ToLanguage_SupportedNeutralCultureInfo_ReturnsLanguage() { foreach(var supportedNeutralCulture in supportedNeutralCultureInfos) - { + { // Act var language = supportedNeutralCulture.Value.ToLanguage(); diff --git a/RiotSharp.Test/RiotApiTest.cs b/RiotSharp.Test/RiotApiTest.cs index ffb1a212..37d2d1d7 100644 --- a/RiotSharp.Test/RiotApiTest.cs +++ b/RiotSharp.Test/RiotApiTest.cs @@ -15,340 +15,7 @@ public class RiotApiTest : CommonTestBase private static readonly DateTime BeginTime = DateTime.Now.AddDays(-6); private static DateTime EndTime => DateTime.Now; - #region Summoner Tests - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetSummonerBySummonerIdAsync_ExistingId_ReturnsSummoner() - { - EnsureCredibility(() => - { - var summoner = Api.Summoner.GetSummonerBySummonerIdAsync(Summoner1And2Region, - Summoner1Id); - - Assert.AreEqual(Summoner1Name, summoner.Result.Name); - }); - } - - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetSummonerByAccountIdAsync_ExistingAccountId_ReturnsSummoner() - { - EnsureCredibility(() => - { - var summoner = Api.Summoner.GetSummonerByAccountIdAsync(Summoner1And2Region, - Summoner1AccountId); - - Assert.AreEqual(Summoner1Name, summoner.Result.Name); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetSummonerByNameAsync_ExistingName_ReturnsSummoner() - { - EnsureCredibility(() => - { - var summoner = Api.Summoner.GetSummonerByNameAsync(Summoner1And2Region, - Summoner1Name); - - Assert.AreEqual(Summoner1Id, summoner.Result.Id); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetSummonerBySummonerPuuidAsync_ExistingId_ReturnsSummoner() - { - EnsureCredibility(() => - { - var summoner = Api.Summoner.GetSummonerByPuuidAsync(Summoner1And2Region, - Summoner1Puuid); - - Assert.AreEqual(Summoner1Name, summoner.Result.Name); - }); - } - #endregion - - #region Champion Tests - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetChampionRotationAsync_Test() - { - EnsureCredibility(() => - { - var championRotation = Api.Champion.GetChampionRotationAsync(Summoner1And2Region).Result; - - Assert.IsTrue(championRotation.FreeChampionIds.Count() == 14); - Assert.IsTrue(championRotation.FreeChampionIdsForNewPlayers.Count() == 10); - Assert.IsTrue(championRotation.MaxNewPlayerLevel > 0); - }); - } - #endregion - - #region League Tests - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetLeagueEntriesBySummonerAsync_Test() - { - EnsureCredibility(() => - { - // TODO: Properly implement encrypted SummonerId tests - return; - var leagues = Api.League.GetLeagueEntriesBySummonerAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.SummonerIds.FirstOrDefault()); - - Assert.IsTrue(leagues.Result.Count > 0); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetLeagueByIdAsync_Test() - { - EnsureCredibility(() => - { - // TODO: Properly implement League id test - return; - var leagues = Api.League.GetLeagueByIdAsync(RiotApiTestBase.SummonersRegion, "LEAGUE-ID-HERE"); - - Assert.IsTrue(leagues.Result.Queue != null); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetLeagueEntriesAsync_Test() - { - EnsureCredibility(() => - { - var leagues = Api.League.GetLeagueEntriesAsync(RiotApiTestBase.SummonersRegion, - Endpoints.LeagueEndpoint.Enums.Division.I, - Endpoints.LeagueEndpoint.Enums.Tier.Bronze, - RiotSharp.Misc.Queue.RankedSolo5x5); - - Assert.IsTrue(leagues.Result.Count > 0); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetLeagueGrandmastersByQueueAsync_Test() - { - EnsureCredibility(() => - { - var leagues = Api.League.GetLeagueGrandmastersByQueueAsync(RiotApiTestBase.SummonersRegion, RiotSharp.Misc.Queue.RankedSolo5x5); - - Assert.IsTrue(leagues.Result.Queue != null); - }); - } - - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetChallengerLeagueAsync_Test() - { - EnsureCredibility(() => - { - var league = Api.League.GetChallengerLeagueAsync(Summoner1And2Region, RiotApiTestBase.Queue); - - Assert.IsTrue(league.Result.Entries.Count > 0); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMasterLeagueAsync_Test() - { - EnsureCredibility(() => - { - var league = Api.League.GetMasterLeagueAsync(Summoner1And2Region, RiotApiTestBase.Queue); - - Assert.IsTrue(league.Result.Entries.Count > 0); - }); - } - #endregion - - #region Match Tests - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchAsync_RunesMasteries_Test() - { - EnsureCredibility(() => - { - var match = Api.Match.GetMatchAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.RunesMasteriesGameId).Result; - - Assert.AreEqual(RiotApiTestBase.RunesMasteriesGameId, match.GameId); - Assert.IsNotNull(match.ParticipantIdentities); - Assert.IsNotNull(match.Participants); - Assert.IsNotNull(match.Teams); - foreach (var participant in match.Participants) - { - Assert.IsNotNull(participant.Runes); - Assert.IsNotNull(participant.Masteries); - foreach (var rune in participant.Runes) - { - Assert.IsTrue(rune.RuneId != 0); - Assert.IsTrue(rune.Rank != 0); - } - foreach (var mastery in participant.Masteries) - { - Assert.IsTrue(mastery.MasteryId != 0); - Assert.IsTrue(mastery.Rank != 0); - } - } - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchAsync_Perks_Test() - { - EnsureCredibility(() => - { - var match = Api.Match.GetMatchAsync(RiotSharp.Misc.Region.Euw, RiotApiTestBase.PerksGameId).Result; - - Assert.AreEqual(RiotApiTestBase.PerksGameId, match.GameId); - Assert.IsNotNull(match.ParticipantIdentities); - Assert.IsNotNull(match.Participants); - Assert.IsNotNull(match.Teams); - foreach (var participant in match.Participants) - { - Assert.IsTrue(participant.Stats.Perk0 != 0); - Assert.IsTrue(participant.Stats.Perk1 != 0); - Assert.IsTrue(participant.Stats.Perk2 != 0); - Assert.IsTrue(participant.Stats.Perk3 != 0); - Assert.IsTrue(participant.Stats.Perk4 != 0); - Assert.IsTrue(participant.Stats.Perk5 != 0); - Assert.IsTrue(participant.Stats.StatPerk0 != 0); - Assert.IsTrue(participant.Stats.StatPerk1 != 0); - Assert.IsTrue(participant.Stats.StatPerk2 != 0); - } - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchTimelineAsync_Test() - { - EnsureCredibility(() => - { - var matchTimeline = Api.Match.GetMatchTimelineAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.GameId).Result; - - Assert.IsNotNull(matchTimeline.Frames); - Assert.IsTrue(matchTimeline.Frames.First().Timestamp == TimeSpan.FromMilliseconds(144)); - Assert.IsTrue(matchTimeline.FrameInterval == TimeSpan.FromMilliseconds(60000)); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_Test() - { - EnsureCredibility(() => - { - var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, - RiotApiTestBase.Summoner1AccountId).Result.Matches; - - Assert.IsTrue(matches.Any()); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_ChampionIds_Test() - { - EnsureCredibility(() => - { - var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, - RiotApiTestBase.Summoner1AccountId, new List { RiotApiTestBase.ChampionId }).Result.Matches; - - foreach (var match in matches) - { - Assert.AreEqual(RiotApiTestBase.ChampionId.ToString(), - match.ChampionID.ToString()); - } - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_Queues_Test() - { - EnsureData(() => - { - EnsureCredibility(() => - { - var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, - RiotApiTestBase.AccountIds.First(), null, - new List { RiotApiTestBase.QueueId }).Result.Matches; - - foreach (var match in matches) - { - Assert.AreEqual(RiotApiTestBase.QueueId, match.Queue); - } - }); - }, "No Matches found fot the test summoner (404)."); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_Seasons_Test() - { - EnsureData(() => - { - EnsureCredibility(() => - { - var matches = Api.Match.GetMatchListAsync(Summoner3Region, - Summoner3AccountId, null, null, - new List { }).Result.Matches; - - Assert.IsTrue(matches.Any()); - - foreach (var match in matches) - { - Assert.AreEqual(Season.Season2018.ToString(), match.Season.ToString()); - } - }); - }, "No Matches found fot the test summoner (404)."); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_DateTimes_Test() - { - EnsureCredibility(() => - { - var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, - RiotApiTestBase.AccountIds.First(), null, null, null, BeginTime, EndTime).Result.Matches; - - foreach (var match in matches) - { - Assert.IsTrue(DateTime.Compare(match.Timestamp, BeginTime) >= 0); - Assert.IsTrue(DateTime.Compare(match.Timestamp, EndTime) <= 0); - } - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetMatchListAsync_Index_Test() - { - EnsureCredibility(() => - { - const int beginIndex = 0; - const int endIndex = 32; - - var matches = Api.Match.GetMatchListAsync(RiotApiTestBase.SummonersRegion, - RiotApiTestBase.Summoner1AccountId, null, null, null, null, null, beginIndex, endIndex).Result.Matches; - - Assert.IsTrue(matches.Count <= endIndex - beginIndex); - }); - } - #endregion #region Spectator Tests [Ignore] // Needs to be manually adjusted for testing @@ -397,51 +64,7 @@ public void GetFeaturedGamesAsync_Test() } #endregion - #region Champion Mastery Tests - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetChampionMasteryAsync_Test() - { - EnsureCredibility(() => - { - var championMastery = Api.ChampionMastery.GetChampionMasteryAsync(Summoner1And2Region, - Summoner1Id, RiotApiTestBase.Summoner1MasteryChampionId).Result; - - Assert.AreEqual(RiotApiTestBase.Summoner1MasteryChampionId, - championMastery.ChampionId); - Assert.AreEqual(RiotApiTestBase.Summoner1MasteryChampionLevel, - championMastery.ChampionLevel); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetChampionsMasteriesAsync_Test() - { - EnsureCredibility(() => - { - var allChampionsMastery = Api.ChampionMastery.GetChampionMasteriesAsync( - Summoner1And2Region, Summoner1Id).Result; - - Assert.IsNotNull(allChampionsMastery.Find(championMastery => - championMastery.ChampionId == RiotApiTestBase.Summoner1MasteryChampionId)); - }); - } - - [TestMethod] - [TestCategory("RiotApi"), TestCategory("Async")] - public void GetTotalChampionMasteryScoreAsync_Test() - { - EnsureCredibility(() => - { - var totalChampionMasteryScore = Api.ChampionMastery.GetTotalChampionMasteryScoreAsync( - Summoner1And2Region, Summoner1Id).Result; - Assert.IsTrue(totalChampionMasteryScore > -1); - }); - } - #endregion #region Third Party Tests [TestMethod] diff --git a/RiotSharp.Test/RiotApiTestBase.cs b/RiotSharp.Test/RiotApiTestBase.cs index bedd37c0..bb2198d7 100644 --- a/RiotSharp.Test/RiotApiTestBase.cs +++ b/RiotSharp.Test/RiotApiTestBase.cs @@ -7,60 +7,50 @@ namespace RiotSharp.Test { internal class RiotApiTestBase : CommonTestBase { - public static long RunesMasteriesGameId = 2510454764; // Game from a patch where the old masteries and runes were active (Platform NA1) + public static long RunesMasteriesGameId = 3518102254; // Game from a patch where the old masteries and runes were active (Platform NA1) public static long PerksGameId = 3857603699; // Game from a patch with reforged runes (Platform EUW) - public static long GameId = 2510454764; - public static int ChampionId = 38; + public static long GameId = 3518102254; + public static int ChampionId = 497; public static Platform Summoner1Platform = (Platform) Enum.Parse(typeof(Platform), "NA1"); - public static int Summoner1MasteryChampionId = 98; + public static int Summoner1MasteryChampionId = 497; public static int Summoner1MasteryChampionLevel = 7; public static long UnrankedSummonerId = 76723437; + public static string TftLeagueId = "a8750230-0e29-11ea-ade7-a6f857269bfa"; public static List AccountIds = new List { - "6GwG-_gvthMjC4bMSh-K_n89fXmwAO2r_xW_bydQX6jsQdI", - "sfezrcI0J4ujlyNhM-CF_ImoIheDW-CHL3Jr-yegcZ5Rkm8", - "K36_BOxYJ6zc22ROFJz3lNpUnUM0fXlbRM6bxNIcjrK53Gw", - "h36GnnMLKm0Nuu4gKUgzGOpKUNfn8YOMufZWL8FGq1kY550" + "h1O1kZfsBNz5koxxRagxoddngVBXRYGUUm5PUVBihvjE7w", + "39_s8uzR2RkzRT3_0qgMfLBPhamNxw0l79n-nlsy8cdHh9A", + "4EsSNLw0tijFP1ckk1pYxBjhAYywCuBdgTWaa-2UtVwbkRCtelop_Xn1", + "JRqk5qeN_ABHsoG_uO8iMooed5EGV69rrJQ0JI39FeiDUAA", + "idJeoVA3X-ypIlRAJge29A82gR2FfVWJ5y5Oa9hgB_HBY9A", + }; public static List SummonerIds = new List { - "Ki6Ed6nkLuc3kCYQhqG922A3baTTdAwRX7LOlVfLl29Ka30", - "pU48DLZmrnwJaowPfWj1eIL-wmh5S7EEi2_8Qthdc5w07Hs", - "EJSU56nc6omjP9doWiuBErFDpqbSsuEIslJEIvY-mRi-fHw", - "e9LoFSVipdsgZtPX-CLPA5rbd4z4_6rOm65YA451J2P8atU", - "alGEcJUa85NZOlCbwYwKTTXRLiTEiuCVtfYIAkTclMKoamk", - "XD6QLPpYK7jPPuiJ6XLle3gY9-nfWEzknMRJKltpzJiFp4Q", - "T4Pdm6UMGtllvS_NcPBoMBGdVv0-6DWf5olYUPfBLusGFnw", - "YC2q7TM2hWbCS9y-HaFiPDpzQT7TynVydJN1OExcKnO3HR8", - "7Ux5zHUPUeXcfFOTb6MMzijl0iSIt5yMqlWOnR0CxriH6Qk", - "v7tt3i1nryKVQvqknf8RK5_5WZTW4iWKtccIiAhLLyLLPpw", - "AFd-eTKqedjdKxaYlzSV00_gGPQNDvuKkdwG1PMvHafpjq0" + "HW96gOrX-QhzSo57KbITsibEBbTYRstm5d4RfRrsa1gBNDE", + "r8pDRHnmw1MqZWWvaOCNl-rntPATTWRzCERTn45JHHK1oCnj", + "ff3si8hPRgvXu0knr-tbzSd_hBhbR8bKE9TN5XjWkBWQC7Dl", + "vBsQ_rxBLUHiU8JxcksbaH3eX9AjJLZU4EuV0ZHdKMiocfzt" }; public static List SummonerNames = new List { - "Imaqtpie", - "C9 Ray", - "C9 Gun", - "C9 Winter", - "Fox Brandini", - "P1 Shady", - "clg imaqtpie69", - "Anivia Kid", - "Butler Delta", - "Contractz", - "LL Stylish" + "Hi Im DEPA", + "From Iron", + "Adrian Seira", + "Liquid Impact" }; - public static Region SummonersRegion = (Region) Enum.Parse(typeof(Region), "Na"); + public static Region Summoners1Region = (Region)Enum.Parse(typeof(Region), "Eun1"); + public static Region SummonersRegion = (Region) Enum.Parse(typeof(Region), "Euw"); public static string Queue = "RANKED_SOLO_5x5"; // Normal 5v5 Draft Pick games - public static int QueueId = 400; - public static Season Season = (Season) Enum.Parse(typeof(Season), "Season2015"); + public static int QueueId = 850; + public static Season Season = (Season) Enum.Parse(typeof(Season), "Season2020"); public static readonly string ThirdPartyCode = "test-third-party-code"; } } diff --git a/RiotSharp.Test/RiotSharp.Test.csproj b/RiotSharp.Test/RiotSharp.Test.csproj index 07bd9b88..7cfbd3be 100644 --- a/RiotSharp.Test/RiotSharp.Test.csproj +++ b/RiotSharp.Test/RiotSharp.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp1.0 + netcoreapp3.1 diff --git a/RiotSharp.Test/StatusRiotApiTestBase.cs b/RiotSharp.Test/StatusRiotApiTestBase.cs index 748e79b6..417c7bfe 100644 --- a/RiotSharp.Test/StatusRiotApiTestBase.cs +++ b/RiotSharp.Test/StatusRiotApiTestBase.cs @@ -5,6 +5,6 @@ namespace RiotSharp.Test { public class StatusRiotApiTestBase : CommonTestBase { - public static Platform Platform = (Platform)Enum.Parse(typeof(Platform), "NA1"); + public static Platform Platform = (Platform)Enum.Parse(typeof(Platform), "EUN1"); } } diff --git a/RiotSharp.Test/appsettings.json b/RiotSharp.Test/appsettings.json index 83ed0cda..6079c207 100644 --- a/RiotSharp.Test/appsettings.json +++ b/RiotSharp.Test/appsettings.json @@ -1,4 +1,4 @@ { - "ApiKey": "RGAPI-c53bdafc-a9a8-4580-a30a-2c54e9403aba", + "ApiKey": "keyhere", "TournamentApiKey": "TOURNAMENT_API_KEY" -} \ No newline at end of file +} \ No newline at end of file diff --git a/RiotSharp.sln b/RiotSharp.sln index 4f0081cf..645dac55 100644 --- a/RiotSharp.sln +++ b/RiotSharp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2006 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29418.71 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{E359C2A1-C147-4221-B9A1-C86DBD8B94EF}" ProjectSection(SolutionItems) = preProject @@ -30,10 +30,6 @@ Global {B4768473-9B66-419F-8CD1-15EAB4F71A75}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4768473-9B66-419F-8CD1-15EAB4F71A75}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4768473-9B66-419F-8CD1-15EAB4F71A75}.Release|Any CPU.Build.0 = Release|Any CPU - {22B1700C-4B99-4504-B4E8-24B9EEEBCF72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22B1700C-4B99-4504-B4E8-24B9EEEBCF72}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22B1700C-4B99-4504-B4E8-24B9EEEBCF72}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22B1700C-4B99-4504-B4E8-24B9EEEBCF72}.Release|Any CPU.Build.0 = Release|Any CPU {97CE2F8F-50FC-45FC-B043-C0F8B64E24B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {97CE2F8F-50FC-45FC-B043-C0F8B64E24B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {97CE2F8F-50FC-45FC-B043-C0F8B64E24B6}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/RiotSharp/Endpoints/ChampionEndpoint/ChampionEndpoint.cs b/RiotSharp/Endpoints/ChampionEndpoint/ChampionEndpoint.cs index e0d77763..7214f207 100644 --- a/RiotSharp/Endpoints/ChampionEndpoint/ChampionEndpoint.cs +++ b/RiotSharp/Endpoints/ChampionEndpoint/ChampionEndpoint.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Newtonsoft.Json; +using RiotSharp.Caching; using RiotSharp.Endpoints.Interfaces; using RiotSharp.Http.Interfaces; using RiotSharp.Misc; @@ -19,6 +20,7 @@ public class ChampionEndpoint : IChampionEndpoint private readonly IRateLimitedRequester _requester; + /// /// Initializes a new instance of the class. /// @@ -29,11 +31,11 @@ public ChampionEndpoint(IRateLimitedRequester requester) } /// - public async Task GetChampionRotationAsync(Region region) + public async Task GetChampionRotationAsync(Region region) { var json = await _requester.CreateGetRequestAsync(PlatformRootUrl + ChampionRotationUrl, region ).ConfigureAwait(false); - return JsonConvert.DeserializeObject(json); + return JsonConvert.DeserializeObject(json); } } } diff --git a/RiotSharp/Endpoints/ChampionEndpoint/ChampionList.cs b/RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionList.cs similarity index 90% rename from RiotSharp/Endpoints/ChampionEndpoint/ChampionList.cs rename to RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionList.cs index 54f3c4ce..e218c8ed 100644 --- a/RiotSharp/Endpoints/ChampionEndpoint/ChampionList.cs +++ b/RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionList.cs @@ -3,7 +3,7 @@ namespace RiotSharp.Endpoints.ChampionEndpoint { - class ChampionList + class NotUsedChampionList { /// /// List of Champions. diff --git a/RiotSharp/Endpoints/ChampionEndpoint/ChampionRotation.cs b/RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionRotation.cs similarity index 95% rename from RiotSharp/Endpoints/ChampionEndpoint/ChampionRotation.cs rename to RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionRotation.cs index 9823ecc8..0b2834cb 100644 --- a/RiotSharp/Endpoints/ChampionEndpoint/ChampionRotation.cs +++ b/RiotSharp/Endpoints/ChampionEndpoint/NotUsedChampionRotation.cs @@ -6,7 +6,7 @@ namespace RiotSharp.Endpoints.ChampionEndpoint /// /// Class representing Champions in the current rotation in the API. /// - public class ChampionRotation + public class NotUsedChampionRotation { /// diff --git a/RiotSharp/Endpoints/Interfaces/IChampionEndpoint.cs b/RiotSharp/Endpoints/Interfaces/IChampionEndpoint.cs index 8179680b..a9497d8b 100644 --- a/RiotSharp/Endpoints/Interfaces/IChampionEndpoint.cs +++ b/RiotSharp/Endpoints/Interfaces/IChampionEndpoint.cs @@ -15,6 +15,6 @@ public interface IChampionEndpoint /// /// Region in which you wish to look for champion rotation. /// An object containing id's of champions in rotation as well as max new player level. - Task GetChampionRotationAsync(Region region); + Task GetChampionRotationAsync(Region region); } } diff --git a/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs b/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs index f2eb9d20..e03de741 100644 --- a/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs +++ b/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs @@ -31,10 +31,10 @@ public interface ILeagueEndpoint /// /// The region /// The division - /// The tier ( to ) + /// The tier ( to ) /// Ranked queue. (Supported: , , ) /// List of matching s - Task> GetLeagueEntriesAsync(Region region, LeagueEndpoint.Enums.Division division, LeagueEndpoint.Enums.Tier tier, string rankedQueue, int page = 1); + Task> GetLeagueEntriesAsync(Region region, string rankedQueue, Tier tier, Division division, int page = 1); /// /// Used to retrieve a list of for the given . diff --git a/RiotSharp/Endpoints/LeagueEndpoint/League.cs b/RiotSharp/Endpoints/LeagueEndpoint/League.cs index 8a2d2afc..85611079 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/League.cs +++ b/RiotSharp/Endpoints/LeagueEndpoint/League.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using RiotSharp.Endpoints.LeagueEndpoint.Enums; +using RiotSharp.Misc; namespace RiotSharp.Endpoints.LeagueEndpoint { diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs index 02daf8a6..d3ef11b1 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs +++ b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs @@ -57,10 +57,10 @@ public async Task> GetLeagueEntriesBySummonerAsync(Region regi } /// - public async Task> GetLeagueEntriesAsync(Region region, Enums.Division division, Enums.Tier tier, string rankedQueue, int page = 1) + public async Task> GetLeagueEntriesAsync(Region region, string rankedQueue, Tier tier, Division division, int page = 1) { var json = await _requester.CreateGetRequestAsync( - LeagueRootUrl + string.Format(LeagueEntriesByDivTierQueue, division, tier.ToString().ToUpperInvariant(), rankedQueue), + LeagueRootUrl + string.Format(LeagueEntriesByDivTierQueue, rankedQueue, tier.ToString().ToUpperInvariant(), division.ToString().ToUpperInvariant()), region, new List { page.ToString() }).ConfigureAwait(false); diff --git a/RiotSharp/Endpoints/LeagueEndpoint/MiniSeries.cs b/RiotSharp/Endpoints/LeagueEndpoint/MiniSeries.cs index 01997dc4..8f602e81 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/MiniSeries.cs +++ b/RiotSharp/Endpoints/LeagueEndpoint/MiniSeries.cs @@ -1,5 +1,5 @@ using Newtonsoft.Json; -using RiotSharp.Endpoints.LeagueEndpoint.Enums.Converters; +using RiotSharp.Misc.Converters; namespace RiotSharp.Endpoints.LeagueEndpoint { diff --git a/RiotSharp/Endpoints/LoREndpoint/Interfaces/ILoRRankedEndpoint.cs b/RiotSharp/Endpoints/LoREndpoint/Interfaces/ILoRRankedEndpoint.cs new file mode 100644 index 00000000..711d2aed --- /dev/null +++ b/RiotSharp/Endpoints/LoREndpoint/Interfaces/ILoRRankedEndpoint.cs @@ -0,0 +1,22 @@ +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.LoREndpoint.Interfaces +{ + /// + /// The LoR Ranked Leaderboards endpoint + /// + public interface ILoRRankedEndpoint + { + /// + /// Get the leaderboards list from Legends of Runnetera asynchronously. + /// + /// in which you wish to look for a challenger league. + /// A which contains top players for this specific region + Task GetLoRRankedLeaderboardsAsync(Region region); + + } +} diff --git a/RiotSharp/Endpoints/LoREndpoint/LoRLeaderboard.cs b/RiotSharp/Endpoints/LoREndpoint/LoRLeaderboard.cs new file mode 100644 index 00000000..7faebdf6 --- /dev/null +++ b/RiotSharp/Endpoints/LoREndpoint/LoRLeaderboard.cs @@ -0,0 +1,21 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Endpoints.LoREndpoint +{ + /// + /// Class containing list of top players in LoR + /// + public class LoRLeaderboard + { + internal LoRLeaderboard() { } + + /// + /// List of top LoR players + /// + [JsonProperty("players")] + public List Players { get; set; } + } +} diff --git a/RiotSharp/Endpoints/LoREndpoint/LoRPlayer.cs b/RiotSharp/Endpoints/LoREndpoint/LoRPlayer.cs new file mode 100644 index 00000000..332f9934 --- /dev/null +++ b/RiotSharp/Endpoints/LoREndpoint/LoRPlayer.cs @@ -0,0 +1,27 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Endpoints.LoREndpoint +{ + /// + /// LoRPlayer class containing all properties to define a player in LoR + /// + public class LoRPlayer + { + internal LoRPlayer() { } + + /// + /// Player name + /// + [JsonProperty("name")] + public string Name { get; set; } + + /// + /// Player Rank + /// + [JsonProperty("rank")] + public int Rank { get; set; } + } +} diff --git a/RiotSharp/Endpoints/LoREndpoint/LoRRankedEndpoint.cs b/RiotSharp/Endpoints/LoREndpoint/LoRRankedEndpoint.cs new file mode 100644 index 00000000..e8cd40c8 --- /dev/null +++ b/RiotSharp/Endpoints/LoREndpoint/LoRRankedEndpoint.cs @@ -0,0 +1,40 @@ +using Newtonsoft.Json; +using RiotSharp.Endpoints.LoREndpoint.Interfaces; +using RiotSharp.Http.Interfaces; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.LoREndpoint +{ + /// + /// Implementation of the + /// + /// + public class LoRRankedEndpoint : ILoRRankedEndpoint + { + private const string LeaderboardRootUrl = "/lor/ranked/v1"; + private const string LeaderboardListUrl = "/leaderboards"; + + private readonly IRateLimitedRequester _requester; + + /// + /// Initializes a new instance of the class. + /// + /// The requester. + public LoRRankedEndpoint(IRateLimitedRequester requester) + { + _requester = requester; + } + + /// + public async Task GetLoRRankedLeaderboardsAsync(Region region) + { + var json = await _requester.CreateGetRequestAsync(LeaderboardRootUrl + LeaderboardListUrl, + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject(json); + } + } +} diff --git a/RiotSharp/Endpoints/MatchEndpoint/Enums/Season.cs b/RiotSharp/Endpoints/MatchEndpoint/Enums/Season.cs index 5259e936..00dba43c 100644 --- a/RiotSharp/Endpoints/MatchEndpoint/Enums/Season.cs +++ b/RiotSharp/Endpoints/MatchEndpoint/Enums/Season.cs @@ -77,7 +77,17 @@ public enum Season /// /// Season 2019. /// - Season2019 = 13 + Season2019 = 13, + + /// + /// Pre season 2020. + /// + PreSeason2020 = 14, + + /// + /// Season 2020 + /// + Season2020 = 15 } static class SeasonExtension @@ -114,6 +124,10 @@ public static string ToCustomString(this Season season) return "PRESEASON2019"; case Season.Season2019: return "SEASON2019"; + case Season.PreSeason2020: + return "PRESEASON2020"; + case Season.Season2020: + return "SEASON2020"; default: return string.Empty; } diff --git a/RiotSharp/Endpoints/MatchEndpoint/Participant.cs b/RiotSharp/Endpoints/MatchEndpoint/Participant.cs index 6cbbc737..b5bdcfe2 100644 --- a/RiotSharp/Endpoints/MatchEndpoint/Participant.cs +++ b/RiotSharp/Endpoints/MatchEndpoint/Participant.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using RiotSharp.Endpoints.LeagueEndpoint.Enums; +using RiotSharp.Misc; namespace RiotSharp.Endpoints.MatchEndpoint { diff --git a/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTLeagueEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTLeagueEndpoint.cs new file mode 100644 index 00000000..896fa0fa --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTLeagueEndpoint.cs @@ -0,0 +1,59 @@ +using RiotSharp.Endpoints.LeagueEndpoint; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint.Interfaces +{ + public interface ITFTLeagueEndpoint + { + /// + /// Get the challenger tft league asynchronously. + /// + /// in which you wish to look for a tft challenger league. + /// A which contains all the tft challengers for this specific region. + Task GetTFTChallengerLeagueAsync(Region region); + + /// + /// Used to retrieve a list of for the given . + /// + /// The region + /// The encrypted summoner id + Task> GetTFTLeagueEntriesBySummonerIdAsync(Region region, string encryptedSummonerId); + + /// + /// Used to retrieve a list of TFT for the given , . + /// + /// The region + /// The division + /// The tier ( to ) + /// List of matching s + Task> GetTFTLeagueEntriesByTierAndDivisionAsync(Region region, Tier tier, Division division, int page = 1); + + /// + /// Get the grandmaster tft league asynchronously. + /// + /// in which you wish to look for a tft grandmaster league. + /// A which contains all the tft grandmasters for this specific region. + Task GetTFTGrandmasterLeagueAsync(Region region); + + /// + /// Used to retrieve information about the provided . + /// + /// Warning: Consistently looking up league ids that don't exist will result in a blacklist. + /// + /// The region + /// The league id + /// The for this specific region and queue. + Task GetTFTLeaguesByLeagueIdAsync(Region region, string leagueId); + + /// + /// Get the master tft league asynchronously. + /// + /// in which you wish to look for a tft master league. + /// A which contains all the tft masters for this specific region. + Task GetTFTMasterLeagueAsync(Region region); + } +} diff --git a/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTMatchEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTMatchEndpoint.cs new file mode 100644 index 00000000..9f612585 --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTMatchEndpoint.cs @@ -0,0 +1,31 @@ +using RiotSharp.Endpoints.MatchEndpoint; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint.Interfaces +{ + /// + /// The AMERICAS routing value serves NA, BR, LAN, LAS, and OCE. The ASIA routing value serves KR and JP. The EUROPE routing value serves EUNE, EUW, TR, and RU. + /// + public interface ITFTMatchEndpoint + { + /// + /// Get the list of matches id of a specific summoner asynchronously. + /// + /// Region in which the summoner is. + /// Profile UUID for which you want to retrieve the match list. + /// A list of Match Ids references object. + Task> GetTftMatchListByPuuidAsync(Region region, string puuid); + + /// + /// Get match information about a specific match asynchronously. + /// + /// Region in which the match took place. + /// The match ID to be retrieved. + /// A match object containing information about the match. + Task GetTftMatchByMatchIdAsync(Region region, string matchId); + } +} diff --git a/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTSummonerEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTSummonerEndpoint.cs new file mode 100644 index 00000000..bffa2f8e --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/Interfaces/ITFTSummonerEndpoint.cs @@ -0,0 +1,47 @@ +using RiotSharp.Endpoints.SummonerEndpoint; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint.Interfaces +{ + /// + /// The TFT Summoner Endpoint. + /// + public interface ITFTSummonerEndpoint + { + /// + /// Get a summoner by account id asynchronously. + /// + /// Region in which you wish to look for a summoner. + /// Account id of the summoner you're looking for. + /// A summoner. + Task GetTFTSummonerByAccountIDAsync(Region region, string accountId); + + /// + /// Get a summoner by name asynchronously. + /// + /// Region in which you wish to look for a summoner. + /// Name of the summoner you're looking for. + /// A summoner. + Task GetTFTSummonerByNameAsync(Region region, string summonerName); + + /// + /// Get a summoner by puuid asynchronously. + /// + /// Region in which you wish to look for a summoner. + /// PUUID of the summoner you're looking for. + /// A summoner. + Task GetTFTSummonerByAccountPuuidAsync(Region region, string puuid); + + /// + /// Get a summoner by summoner id asynchronously. + /// + /// Region in which you wish to look for a summoner. + /// Id of the summoner you're looking for. + /// A summoner. + Task GetTFTSummonerBySummonerIdAsync(Region region, string summonerId); + } +} diff --git a/RiotSharp/Endpoints/TFTEndpoint/TFTLeagueEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/TFTLeagueEndpoint.cs new file mode 100644 index 00000000..f3a5092f --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/TFTLeagueEndpoint.cs @@ -0,0 +1,87 @@ +using Newtonsoft.Json; +using RiotSharp.Endpoints.LeagueEndpoint; +using RiotSharp.Endpoints.TFTEndpoint.Interfaces; +using RiotSharp.Http.Interfaces; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint +{ + /// + /// Implementation of + /// + public class TFTLeagueEndpoint : ITFTLeagueEndpoint + { + private const string TftLeagueRootUrl = "/tft/league/v1"; + private const string TftLeagueChallengerUrl = "/challenger"; + private const string TftLeagueMasterUrl = "/master"; + private const string TftLeagueEntriesBySummonerUrl = "/entries/by-summoner/{0}"; + private const string TftLeagueGrandmastersUrl = "/grandmaster"; + private const string TftLeagueEntriesByDivTierUrl = "/entries/{0}/{1}"; + private const string TftLeagueLeagueByIdUrl = "/leagues/{0}"; + + private readonly IRateLimitedRequester _requester; + + /// + /// Initializes a new instance of the class. + /// + /// The requester. + public TFTLeagueEndpoint(IRateLimitedRequester requester) + { + _requester = requester; + } + + /// + public async Task GetTFTChallengerLeagueAsync(Region region) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + TftLeagueChallengerUrl, + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject(json); + } + + /// + public async Task GetTFTGrandmasterLeagueAsync(Region region) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + TftLeagueGrandmastersUrl, + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject(json); + } + + /// + public async Task> GetTFTLeagueEntriesBySummonerIdAsync(Region region, string encryptedSummonerId) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + string.Format(TftLeagueEntriesBySummonerUrl, encryptedSummonerId), + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject>(json); + } + + /// + public async Task> GetTFTLeagueEntriesByTierAndDivisionAsync(Region region, Tier tier, Division division, int page = 1) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + + string.Format(TftLeagueEntriesByDivTierUrl, tier.ToString().ToUpperInvariant(), division.ToString().ToUpperInvariant()), + region, + new List { page.ToString() }).ConfigureAwait(false); + return JsonConvert.DeserializeObject>(json); + } + + /// + public async Task GetTFTLeaguesByLeagueIdAsync(Region region, string leagueId) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + string.Format(TftLeagueLeagueByIdUrl, leagueId), + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject(json); + } + + /// + public async Task GetTFTMasterLeagueAsync(Region region) + { + var json = await _requester.CreateGetRequestAsync(TftLeagueRootUrl + TftLeagueMasterUrl, + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject(json); + } + } +} diff --git a/RiotSharp/Endpoints/TFTEndpoint/TFTMatchEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/TFTMatchEndpoint.cs new file mode 100644 index 00000000..0c0ae330 --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/TFTMatchEndpoint.cs @@ -0,0 +1,62 @@ +using Newtonsoft.Json; +using RiotSharp.Caching; +using RiotSharp.Endpoints.MatchEndpoint; +using RiotSharp.Endpoints.TFTEndpoint.Interfaces; +using RiotSharp.Http.Interfaces; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint +{ + /// + /// Implementation of + /// + public class TFTMatchEndpoint : ITFTMatchEndpoint + { + private const string TftMatchRootUrl = "/tft/match/v1"; + private const string TftMatchesByPuuidUrl = "/matches/by-puuid/{0}/ids"; + private const string TftMatchByMatchIdUrl = "/matches/{0}"; + private const string MatchCache = "match-{0}_{1}"; + private const string MatchTimeLineCacheKey = "match-timeline-{0}_{1}"; + private static readonly TimeSpan MatchTtl = TimeSpan.FromDays(60); + + private readonly IRateLimitedRequester _requester; + private readonly ICache _cache; + + /// + /// Initializes a new instance of the class. + /// + /// The requester. + public TFTMatchEndpoint(IRateLimitedRequester requester, ICache cache) + { + _requester = requester; + _cache = cache; + } + + /// + public async Task GetTftMatchByMatchIdAsync(Region region, string matchId) + { + var matchInCache = _cache.Get(string.Format(MatchCache, region, matchId)); + if (matchInCache != null) + { + return matchInCache; + } + var json = await _requester.CreateGetRequestAsync(TftMatchRootUrl + string.Format(TftMatchByMatchIdUrl, matchId), + region).ConfigureAwait(false); + var match = JsonConvert.DeserializeObject(json); + _cache.Add(string.Format(MatchCache, region, matchId), match, MatchTtl); + return match; + } + + /// + public async Task> GetTftMatchListByPuuidAsync(Region region, string puuid) + { + var json = await _requester.CreateGetRequestAsync(TftMatchRootUrl + string.Format(TftMatchesByPuuidUrl, puuid), + region).ConfigureAwait(false); + return JsonConvert.DeserializeObject>(json); + } + } +} diff --git a/RiotSharp/Endpoints/TFTEndpoint/TFTSummonerEndpoint.cs b/RiotSharp/Endpoints/TFTEndpoint/TFTSummonerEndpoint.cs new file mode 100644 index 00000000..949daebd --- /dev/null +++ b/RiotSharp/Endpoints/TFTEndpoint/TFTSummonerEndpoint.cs @@ -0,0 +1,113 @@ +using Newtonsoft.Json; +using RiotSharp.Caching; +using RiotSharp.Endpoints.SummonerEndpoint; +using RiotSharp.Endpoints.TFTEndpoint.Interfaces; +using RiotSharp.Http.Interfaces; +using RiotSharp.Misc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace RiotSharp.Endpoints.TFTEndpoint +{ + /// + /// Implementation of + /// + /// + public class TFTSummonerEndpoint : ITFTSummonerEndpoint + { + private const string TftSummonerRootUrl = "/tft/summoner/v1/summoners"; + private const string TftSummonerByAccountIdUrl = "/by-account/{0}"; + private const string TftSummonerByNameUrl = "/by-name/{0}"; + private const string TftSummonerByPuuid = "/by-puuid/{0}"; + private const string TftSummonerBySummonerIdUrl = "/{0}"; + private const string TftSummonerCache = "summoner-{0}_{1}"; + private static readonly TimeSpan TftSummonerTtl = TimeSpan.FromDays(30); + + private readonly IRateLimitedRequester _requester; + private readonly ICache _cache; + + /// + public TFTSummonerEndpoint(IRateLimitedRequester requester, ICache cache) + { + _requester = requester; + _cache = cache; + } + + /// + public async Task GetTFTSummonerByAccountIDAsync(Region region, string accountId) + { + var summonerInCache = _cache.Get(string.Format(TftSummonerCache, region, accountId)); + if (summonerInCache != null) + { + return summonerInCache; + } + var jsonResponse = await _requester.CreateGetRequestAsync( + string.Format(TftSummonerRootUrl + TftSummonerByAccountIdUrl, accountId), region).ConfigureAwait(false); + var summoner = JsonConvert.DeserializeObject(jsonResponse); + if (summoner != null) + { + summoner.Region = region; + } + _cache.Add(string.Format(TftSummonerCache, region, accountId), summoner, TftSummonerTtl); + return summoner; + } + + /// + public async Task GetTFTSummonerByAccountPuuidAsync(Region region, string puuid) + { + var summonerInCache = _cache.Get(string.Format(TftSummonerCache, region, puuid)); + if (summonerInCache != null) + { + return summonerInCache; + } + var jsonResponse = await _requester.CreateGetRequestAsync(string.Format(TftSummonerRootUrl + TftSummonerByPuuid, puuid), region).ConfigureAwait(false); + var summoner = JsonConvert.DeserializeObject(jsonResponse); + if (summoner != null) + { + summoner.Region = region; + } + _cache.Add(string.Format(TftSummonerCache, region, puuid), summoner, TftSummonerTtl); + return summoner; + } + + /// + public async Task GetTFTSummonerByNameAsync(Region region, string summonerName) + { + var summonerInCache = _cache.Get(string.Format(TftSummonerCache, region, summonerName)); + if (summonerInCache != null) + { + return summonerInCache; + } + var jsonResponse = await _requester.CreateGetRequestAsync( + string.Format(TftSummonerRootUrl + TftSummonerByNameUrl, summonerName), region).ConfigureAwait(false); + var summoner = JsonConvert.DeserializeObject(jsonResponse); + if (summoner != null) + { + summoner.Region = region; + } + _cache.Add(string.Format(TftSummonerCache, region, summonerName), summoner, TftSummonerTtl); + return summoner; + } + + /// + public async Task GetTFTSummonerBySummonerIdAsync(Region region, string summonerId) + { + var summonerInCache = _cache.Get(string.Format(TftSummonerCache, region, summonerId)); + if (summonerInCache != null) + { + return summonerInCache; + } + var jsonResponse = await _requester.CreateGetRequestAsync( + string.Format(TftSummonerRootUrl + TftSummonerBySummonerIdUrl, summonerId), region).ConfigureAwait(false); + var summoner = JsonConvert.DeserializeObject(jsonResponse); + if (summoner != null) + { + summoner.Region = region; + } + _cache.Add(string.Format(TftSummonerCache, region, summonerId), summoner, TftSummonerTtl); + return summoner; + } + } +} diff --git a/RiotSharp/Http/RequesterBase.cs b/RiotSharp/Http/RequesterBase.cs index fc337de0..7c7bbc8e 100644 --- a/RiotSharp/Http/RequesterBase.cs +++ b/RiotSharp/Http/RequesterBase.cs @@ -141,7 +141,7 @@ private string GetPlatform(Region region) { case Region.Br: return "br1"; - case Region.Eune: + case Region.Eun1: return "eun1"; case Region.Euw: return "euw1"; diff --git a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/CharArrayConverter.cs b/RiotSharp/Misc/Converters/CharArrayConverter.cs similarity index 84% rename from RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/CharArrayConverter.cs rename to RiotSharp/Misc/Converters/CharArrayConverter.cs index eb81c7ba..2870161d 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/CharArrayConverter.cs +++ b/RiotSharp/Misc/Converters/CharArrayConverter.cs @@ -1,9 +1,11 @@ -using System; -using System.Reflection; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; -namespace RiotSharp.Endpoints.LeagueEndpoint.Enums.Converters +namespace RiotSharp.Misc.Converters { class CharArrayConverter : JsonConverter { diff --git a/RiotSharp/Misc/Converters/PlatformConverter.cs b/RiotSharp/Misc/Converters/PlatformConverter.cs index a9f4d9b0..0f226718 100644 --- a/RiotSharp/Misc/Converters/PlatformConverter.cs +++ b/RiotSharp/Misc/Converters/PlatformConverter.cs @@ -79,7 +79,7 @@ public static Region ConvertToRegion(this Platform platform) case Platform.OC1: return Region.Oce; case Platform.EUN1: - return Region.Eune; + return Region.Eun1; case Platform.TR1: return Region.Tr; case Platform.RU: diff --git a/RiotSharp/Misc/Converters/RegionConverter.cs b/RiotSharp/Misc/Converters/RegionConverter.cs index d0677478..f07c4253 100644 --- a/RiotSharp/Misc/Converters/RegionConverter.cs +++ b/RiotSharp/Misc/Converters/RegionConverter.cs @@ -25,7 +25,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist return Region.Br; case "EUNE": case "eune": - return Region.Eune; + return Region.Eun1; case "EUW": case "euw": return Region.Euw; diff --git a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/TierConverter.cs b/RiotSharp/Misc/Converters/TierConverter.cs similarity index 81% rename from RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/TierConverter.cs rename to RiotSharp/Misc/Converters/TierConverter.cs index e90f7414..07b91328 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Converters/TierConverter.cs +++ b/RiotSharp/Misc/Converters/TierConverter.cs @@ -1,9 +1,11 @@ -using System; -using System.Reflection; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; -namespace RiotSharp.Endpoints.LeagueEndpoint.Enums.Converters +namespace RiotSharp.Misc.Converters { class TierConverter : JsonConverter { @@ -19,7 +21,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist var str = token.Value(); if (str == null) return null; - if(Enum.TryParse(str, true, out var result)) + if (Enum.TryParse(str, true, out var result)) { return result; } diff --git a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Division.cs b/RiotSharp/Misc/Division.cs similarity index 72% rename from RiotSharp/Endpoints/LeagueEndpoint/Enums/Division.cs rename to RiotSharp/Misc/Division.cs index 0c249706..75f2bf35 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Division.cs +++ b/RiotSharp/Misc/Division.cs @@ -1,4 +1,8 @@ -namespace RiotSharp.Endpoints.LeagueEndpoint.Enums +using System; +using System.Collections.Generic; +using System.Text; + +namespace RiotSharp.Misc { public enum Division { @@ -11,4 +15,4 @@ public enum Division /// Division IV IV } -} \ No newline at end of file +} diff --git a/RiotSharp/Misc/GameMode.cs b/RiotSharp/Misc/GameMode.cs index cc702dff..f3ecb97c 100644 --- a/RiotSharp/Misc/GameMode.cs +++ b/RiotSharp/Misc/GameMode.cs @@ -1,68 +1,98 @@ namespace RiotSharp.Misc { /// - /// Mode of the game (Game API). + /// Mode of the game (Game API). (http://static.developer.riotgames.com/docs/lol/gameModes.json) /// public static class GameMode { /// - /// Classic Summoner's Rift and Twisted Treeline games. + /// Classic Summoner's Rift and Twisted Treeline games /// public const string Classic = "CLASSIC"; /// - /// Dominion/Crystal Scar games. + /// Dominion/Crystal Scar games /// public const string Dominion = "ODIN"; /// - /// ARAM games. + /// ARAM games /// public const string Aram = "ARAM"; /// - /// Tutorial games. + /// Tutorial games /// public const string Tutorial = "TUTORIAL"; /// - /// One for All games. + /// URF games + /// + public const string Urf = "URF"; + + /// + /// Doom Bot games + /// + public const string DoomBot = "DOOMBOTSTEEMO"; + + /// + /// One for All games /// public const string OneForAll = "ONEFORALL"; /// - /// Snowdown Showdown games. + /// Ascension games /// - public const string FirstBlood = "FIRSTBLOOD"; + public const string Ascension = "Ascension games"; /// - /// Ascension mode games. + /// Snowdown Showdown games /// - public const string Ascension = "ASCENSION"; + public const string Snowdown = "FIRSTBLOOD"; /// - /// Introduction game mode. + /// Legend of the Poro King games /// - public const string Intro = "INTRO"; + public const string PoroKing = "KINGPORO"; /// - /// King Poro game mode. + /// Nexus Siege games /// - public const string KingPoro = "KINGPORO"; + public const string NexusSiege = "SIEGE"; /// - /// Nexus Siege game mode. + /// Blood Hunt Assassin games /// - public const string Siege = "SIEGE"; + public const string BloodHunt = "ASSASSINATE"; /// - /// Assassinate game mode. + /// All Random Summoner's Rift games /// - public const string Assassinate = "ASSASSINATE"; + public const string ARSR = "ARSR"; /// - /// Darkstar game mode. + /// Dark Star: Singularity games /// public const string Darkstar = "DARKSTAR"; + + /// + /// Star Guardian Invasion games + /// + public const string Starguardian = "STARGUARDIAN"; + + /// + /// PROJECT: Hunters games + /// + public const string Project = "PROJECT"; + + /// + /// Nexus Blitz games + /// + public const string NexusBlitz = "GAMEMODEX"; + + /// + /// Odyssey: Extraction games + /// + public const string Oddysey = "ODDYSEY"; } } diff --git a/RiotSharp/Misc/Language.cs b/RiotSharp/Misc/Language.cs index b3057a8a..b461953f 100644 --- a/RiotSharp/Misc/Language.cs +++ b/RiotSharp/Misc/Language.cs @@ -1,168 +1,149 @@ namespace RiotSharp.Misc { /// - /// Language for the data retrieved (Static API). + /// Language for the data retrieved (Static API) (https://ddragon.leagueoflegends.com/cdn/languages.json) /// public enum Language { /// - /// American English. + /// Czech (Czech Republic) /// - en_US, + cs_CZ, /// - /// British English. + /// Greek (Greece) /// - en_GB, + el_GR, /// - /// Polish English. + /// Polish (Poland) /// + pl_PL, en_PL, /// - /// Australian English. - /// - en_AU, - - /// - /// Filipino English. - /// - en_PH, - - /// - /// Singaporean English. - /// - en_SG, - - /// - /// Polish. + /// Romanian (Romania) /// - pl_PL, + ro_RO, /// - /// Czech. + /// Hungarian (Hungary) /// - cs_CZ, + hu_HU, /// - /// Hungarian. + /// English (United Kingdom) /// - hu_HU, + en_GB, /// - /// German. + /// German (Germany) /// de_DE, /// - /// Spanish. + /// Spanish (Spain) /// es_ES, /// - /// Argentinian Spanish. + /// Italian (Italy) /// - es_AR, - - /// - /// Latam Spanish. - /// - es_MX, + it_IT, /// - /// French. + /// French (France) /// fr_FR, /// - /// Italian. + /// Japanese (Japan) /// - it_IT, + ja_JP, /// - /// Romanian. + /// Korean (Korea) /// - ro_RO, + ko_KR, /// - /// Greek. + /// Spanish (Mexico) /// - el_GR, + es_MX, /// - /// Portuguese + /// Spanish (Argentina) /// - pt_PT, + es_AR, /// - /// Brazilian Portuguese. + /// Portuguese (Brazil) /// pt_BR, /// - /// Turkish. + /// English (United States) /// - tr_TR, + en_US, /// - /// Russian. + /// English (Australia) /// - ru_RU, + en_AU, /// - /// Chinese. + /// Russian (Russia) /// - zh_CN, + ru_RU, /// - /// Taiwanese Chinese. + /// Turkish (Turkey) /// - zh_TW, + tr_TR, /// - /// Korean. + /// Malay (Malaysia) /// - ko_KR, + ms_MY, /// - /// Bulgarian. + /// English (Republic of the Philippines) /// - bg_BG, + en_PH, /// - /// Indonesian. + /// English (Singapore) /// - id_ID, + en_SG, /// - /// Malaysian. + /// Thai (Thailand) /// - ms_MY, + th_TH, /// - /// Malaysian Chinese. + /// Vietnamese (Viet Nam) /// - zh_MY, + vn_VN, /// - /// Dutch. + /// Indonesian (Indonesia) /// - nl_NL, + id_ID, /// - /// Thaï. + /// Chinese (Malaysia) /// - th_TH, + zh_MY, /// - /// Vietnamese. + /// Chinese (China) /// - vn_VN, + zh_CN, /// - /// Japanese. + /// Chinese (Taiwan) /// - ja_JP + zh_TW } } diff --git a/RiotSharp/Misc/MapType.cs b/RiotSharp/Misc/MapType.cs index e24a6f29..1f7a0d1b 100644 --- a/RiotSharp/Misc/MapType.cs +++ b/RiotSharp/Misc/MapType.cs @@ -10,48 +10,73 @@ namespace RiotSharp.Misc public enum MapType { /// - /// Summoner's Rift Summer Variant + /// Original Summer variant /// SummonersRiftSummerVariant = 1, /// - /// Summoner's Rift Autumn Variant + /// Original Autumn variant /// SummonersRiftAutumnVariant = 2, /// - /// The Proving Grounds Tutorial Map + /// Tutorial Map /// TheProvingGrounds = 3, /// - /// Twisted Treeline Original Version + /// Original Version /// TwistedTreelineOriginal = 4, /// - ///The Crystal Scar Dominion Map + /// Dominion map /// TheCrystalScar = 8, /// - /// Twisted Treeline Current Version + /// Last TT map /// - TwistedTreelineCurrent = 10, + TwistedTreeline = 10, /// - /// Summoner's Rift Current Version + /// Current Version /// SummonersRift = 11, /// - /// Howling Abyss ARAM Map + /// ARAM map /// HowlingAbyss = 12, /// - /// Darkstar Map + /// Alternate ARAM map /// - CosmicRuins = 16 + ButchersBridge = 14, + + /// + /// Dark Star: Singularity map + /// + CosmicRuins = 16, + + /// + /// Star Guardian Invasion map + /// + ValoranCityPark = 18, + + /// + /// PROJECT: Hunters map + /// + Substructure43 = 19, + + /// + /// Odyssey: Extraction map + /// + CrashSite = 20, + + /// + /// Nexus Blitz map + /// + NexusBltiz = 21 } -} +} \ No newline at end of file diff --git a/RiotSharp/Misc/Platform.cs b/RiotSharp/Misc/Platform.cs index 296433e1..c5731e0d 100644 --- a/RiotSharp/Misc/Platform.cs +++ b/RiotSharp/Misc/Platform.cs @@ -10,59 +10,59 @@ namespace RiotSharp.Misc public enum Platform { /// - /// North America. + /// Brasil /// - NA1, + BR1, /// - /// Brasil. + /// Europe North-East /// - BR1, + EUN1, /// - /// Latin America North. + /// Europe West /// - LA1, + EUW1, /// - /// Latin America South. + /// Japan /// - LA2, + JP1, /// - /// Oceania. + /// Korea /// - OC1, + KR, /// - /// North-eastern Europe. + /// Latin America North /// - EUN1, + LA1, /// - /// Turkey. + /// Latin America South /// - TR1, + LA2, /// - /// Russia. + /// North America /// - RU, + NA1, /// - /// Western Europe. + /// Oceania /// - EUW1, + OC1, /// - /// Korea. + /// Turkey /// - KR, + TR1, /// - /// Japan. + /// Rusia /// - JP1, + RU, /// /// No Platform (e.g. platformId of bot players). diff --git a/RiotSharp/Misc/Region.cs b/RiotSharp/Misc/Region.cs index e2ac9d68..caa70a29 100644 --- a/RiotSharp/Misc/Region.cs +++ b/RiotSharp/Misc/Region.cs @@ -17,7 +17,7 @@ public enum Region /// /// North-eastern europe. /// - Eune, + Eun1, /// /// Western europe. diff --git a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Tier.cs b/RiotSharp/Misc/Tier.cs similarity index 88% rename from RiotSharp/Endpoints/LeagueEndpoint/Enums/Tier.cs rename to RiotSharp/Misc/Tier.cs index 8afc7ee1..7eef5dd9 100644 --- a/RiotSharp/Endpoints/LeagueEndpoint/Enums/Tier.cs +++ b/RiotSharp/Misc/Tier.cs @@ -1,7 +1,10 @@ using Newtonsoft.Json; -using RiotSharp.Endpoints.LeagueEndpoint.Enums.Converters; +using RiotSharp.Misc.Converters; +using System; +using System.Collections.Generic; +using System.Text; -namespace RiotSharp.Endpoints.LeagueEndpoint.Enums +namespace RiotSharp.Misc { /// /// Tier of the league (League API). @@ -48,7 +51,7 @@ public enum Tier /// Iron tier. /// Iron, - + /// /// Unranked. /// diff --git a/RiotSharp/RiotApi.cs b/RiotSharp/RiotApi.cs index 397bf56c..953871d1 100644 --- a/RiotSharp/RiotApi.cs +++ b/RiotSharp/RiotApi.cs @@ -6,11 +6,15 @@ using RiotSharp.Endpoints.Interfaces; using RiotSharp.Endpoints.Interfaces.Static; using RiotSharp.Endpoints.LeagueEndpoint; +using RiotSharp.Endpoints.LoREndpoint; +using RiotSharp.Endpoints.LoREndpoint.Interfaces; using RiotSharp.Endpoints.MatchEndpoint; using RiotSharp.Endpoints.SpectatorEndpoint; using RiotSharp.Endpoints.StaticDataEndpoint; using RiotSharp.Endpoints.StatusEndpoint; using RiotSharp.Endpoints.SummonerEndpoint; +using RiotSharp.Endpoints.TFTEndpoint; +using RiotSharp.Endpoints.TFTEndpoint.Interfaces; using RiotSharp.Endpoints.ThirdPartyEndpoint; using RiotSharp.Http; using RiotSharp.Http.Interfaces; @@ -27,7 +31,7 @@ public class RiotApi : IRiotApi #region Private Fields private static RiotApi _instance; - private readonly ICache _cache; + private readonly ICache _cache; #endregion #region Endpoints @@ -58,6 +62,18 @@ public class RiotApi : IRiotApi /// public IStatusEndpoint Status { get; } + + /// + public ILoRRankedEndpoint LoR_Leaderboards { get; } + + /// + public ITFTLeagueEndpoint TftLeague { get; } + + /// + public ITFTMatchEndpoint TftMatch { get; } + + /// + public ITFTSummonerEndpoint TftSummoner { get; } #endregion /// @@ -133,6 +149,10 @@ private RiotApi(string apiKey, IDictionary rateLimits, ICache cac Spectator = new SpectatorEndpoint(requester); ChampionMastery = new ChampionMasteryEndpoint(requester); ThirdParty = new ThirdPartyEndpoint(requester); + LoR_Leaderboards = new LoRRankedEndpoint(requester); + TftLeague = new TFTLeagueEndpoint(requester); + TftMatch = new TFTMatchEndpoint(requester, _cache); + TftSummoner = new TFTSummonerEndpoint(requester, _cache); StaticData = new StaticDataEndpoints(Requesters.StaticApiRequester, _cache); Status = new StatusEndpoint(Requesters.StaticApiRequester); @@ -158,7 +178,7 @@ public RiotApi(IRateLimitedRequester rateLimitedRequester, IRequester requester, throw new ArgumentNullException(nameof(staticEndpointProvider)); _cache = cache ?? new PassThroughCache(); - + Summoner = new SummonerEndpoint(rateLimitedRequester, _cache); Champion = new ChampionEndpoint(rateLimitedRequester); League = new LeagueEndpoint(rateLimitedRequester); @@ -166,6 +186,10 @@ public RiotApi(IRateLimitedRequester rateLimitedRequester, IRequester requester, Spectator = new SpectatorEndpoint(rateLimitedRequester); ChampionMastery = new ChampionMasteryEndpoint(rateLimitedRequester); ThirdParty = new ThirdPartyEndpoint(rateLimitedRequester); + LoR_Leaderboards = new LoRRankedEndpoint(rateLimitedRequester); + TftLeague = new TFTLeagueEndpoint(rateLimitedRequester); + TftMatch = new TFTMatchEndpoint(rateLimitedRequester, _cache); + TftSummoner = new TFTSummonerEndpoint(rateLimitedRequester, _cache); StaticData = new StaticDataEndpoints(staticEndpointProvider); Status = new StatusEndpoint(requester); diff --git a/RiotSharp/RiotSharp.csproj b/RiotSharp/RiotSharp.csproj index ff36978b..248b35a4 100644 --- a/RiotSharp/RiotSharp.csproj +++ b/RiotSharp/RiotSharp.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.1 RiotSharp 4.0.0 4.0.0