From 6de6d54dcadb637ed140d16e4f678678657019a4 Mon Sep 17 00:00:00 2001
From: Sylwester <34380926+vizo92@users.noreply.github.com>
Date: Thu, 9 May 2019 12:21:04 +0200
Subject: [PATCH 1/7] add leagueID property
---
RiotSharp/Endpoints/LeagueEndpoint/League.cs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/League.cs b/RiotSharp/Endpoints/LeagueEndpoint/League.cs
index 8f7ceb71..ae5dea2c 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/League.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/League.cs
@@ -35,5 +35,11 @@ internal League() { }
///
[JsonProperty("tier")]
public Tier Tier { get; set; }
+
+ ///
+ /// League ID
+ ///
+ [JsonProperty("leagueId")]
+ public string LeagueID { get; set; }
}
}
From af97332a74da7b56f4559a949a3cc73cbcb7989e Mon Sep 17 00:00:00 2001
From: Sylwester <34380926+vizo92@users.noreply.github.com>
Date: Thu, 9 May 2019 12:32:02 +0200
Subject: [PATCH 2/7] add grandmaster league
---
RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
index 475e5ec4..b4e90af0 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
@@ -14,6 +14,7 @@ public class LeagueEndpoint : ILeagueEndpoint
{
private const string LeagueRootUrl = "/lol/league/v4";
private const string LeagueChallengerUrl = "/challengerleagues/by-queue/{0}";
+ private const string LeagueGrandMasterUrl = "/grandmasterleagues/by-queue/{0};
private const string LeagueMasterUrl = "/masterleagues/by-queue/{0}";
private const string LeaguePositionBySummonerUrl = "/positions/by-summoner/{0}";
@@ -52,5 +53,13 @@ public async Task GetMasterLeagueAsync(Region region, string queue)
region).ConfigureAwait(false);
return JsonConvert.DeserializeObject(json);
}
+
+ ///
+ public async Task GetGrandMasterLeagueAsync(Region region, string queue)
+ {
+ var json = await _requester.CreateGetRequestAsync(LeagueRootUrl + string.Format(LeagueGrandMasterUrl, queue),
+ region).ConfigureAwait(false);
+ return JsonConvert.DeserializeObject(json);
+ }
}
}
From 732ac9d5c9b5867282385c2b834724aa6e8e3724 Mon Sep 17 00:00:00 2001
From: Sylwester <34380926+vizo92@users.noreply.github.com>
Date: Thu, 9 May 2019 12:32:16 +0200
Subject: [PATCH 3/7] Update LeagueEndpoint.cs
---
RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
index b4e90af0..0c677eb6 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
@@ -14,7 +14,7 @@ public class LeagueEndpoint : ILeagueEndpoint
{
private const string LeagueRootUrl = "/lol/league/v4";
private const string LeagueChallengerUrl = "/challengerleagues/by-queue/{0}";
- private const string LeagueGrandMasterUrl = "/grandmasterleagues/by-queue/{0};
+ private const string LeagueGrandMasterUrl = "/grandmasterleagues/by-queue/{0}";
private const string LeagueMasterUrl = "/masterleagues/by-queue/{0}";
private const string LeaguePositionBySummonerUrl = "/positions/by-summoner/{0}";
From 18bc15d1b2eac1a85e03788a78a04c5db6f610e3 Mon Sep 17 00:00:00 2001
From: Sylwester Kwiatkowski
Date: Thu, 9 May 2019 13:01:49 +0200
Subject: [PATCH 4/7] league methods and fields fixed to the current version
---
.../LeagueEndpoint/LeagueEndpoint.cs | 14 ++-
.../LeagueEndpoint/LeaguePosition.cs | 88 +++++++++----------
2 files changed, 55 insertions(+), 47 deletions(-)
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
index 0c677eb6..c5781293 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/LeagueEndpoint.cs
@@ -16,7 +16,8 @@ public class LeagueEndpoint : ILeagueEndpoint
private const string LeagueChallengerUrl = "/challengerleagues/by-queue/{0}";
private const string LeagueGrandMasterUrl = "/grandmasterleagues/by-queue/{0}";
private const string LeagueMasterUrl = "/masterleagues/by-queue/{0}";
- private const string LeaguePositionBySummonerUrl = "/positions/by-summoner/{0}";
+ private const string LeagueEntriesBySummoner = "/entries/by-summoner/{0}";
+ private const string LeagueEntries = "/entries/{0}/{1}/{2}";
private readonly IRateLimitedRequester _requester;
@@ -30,11 +31,18 @@ public LeagueEndpoint(IRateLimitedRequester requester)
}
///
- public async Task> GetLeaguePositionsAsync(Region region, string summonerId)
+ public async Task> GetLeagueEntriesAsync(Region region, string queue, string tier, string division)
{
var json = await _requester.CreateGetRequestAsync(
- LeagueRootUrl + string.Format(LeaguePositionBySummonerUrl, summonerId), region).ConfigureAwait(false);
+ LeagueRootUrl + string.Format(LeagueEntries, queue, tier, division), region).ConfigureAwait(false);
+ return JsonConvert.DeserializeObject>(json);
+ }
+ ///
+ public async Task> GetLeagueEntriesBySummonerIdAsync(Region region, string summonerId)
+ {
+ var json = await _requester.CreateGetRequestAsync(
+ LeagueRootUrl + string.Format(LeagueEntriesBySummoner, summonerId), region).ConfigureAwait(false);
return JsonConvert.DeserializeObject>(json);
}
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
index 03895bf4..583b2a00 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
@@ -11,13 +11,6 @@ internal LeaguePosition()
{
}
- ///
- /// The name of the league of the participant.
- /// Only when it's called from the GetLeaguePositions()
- ///
- [JsonProperty("leagueName")]
- public string LeagueName { get; set; }
-
///
/// The queue type of the league.
/// Only for the GetLeaguePositions() -> don't exist when it's an entry from a League
@@ -27,23 +20,10 @@ internal LeaguePosition()
public string QueueType { get; set; }
///
- /// The rank of the participant in a league.
- ///
- [JsonProperty("rank")]
- public string Rank { get; set; }
-
- ///
- /// The league tier of the participant.
- /// Only when it's called from the GetLeaguePositions()
+ /// The name of the summoner.
///
- [JsonProperty("tier")]
- public string Tier { get; set; }
-
- ///
- /// Specifies if the participant is fresh blood.
- ///
- [JsonProperty("freshBlood")]
- public bool FreshBlood { get; set; }
+ [JsonProperty("summonerName")]
+ public string summonerName { get; set; }
///
/// Specifies if the participant is on a hot streak.
@@ -52,22 +32,22 @@ internal LeaguePosition()
public bool HotStreak { get; set; }
///
- /// Specifies if the participant is inactive.
+ /// Mini series data for the participant. Only present if the participant is currently in a mini series.
///
- [JsonProperty("inactive")]
- public bool Inactive { get; set; }
+ [JsonProperty("miniSeries")]
+ public MiniSeries MiniSeries { get; set; }
///
- /// Specifies if the participant is a veteran.
+ /// The number of wins for the participant.
///
- [JsonProperty("veteran")]
- public bool Veteran { get; set; }
+ [JsonProperty("wins")]
+ public int Wins { get; set; }
///
- /// The league points of the participant.
+ /// Specifies if the participant is a veteran.
///
- [JsonProperty("leaguePoints")]
- public int LeaguePoints { get; set; }
+ [JsonProperty("veteran")]
+ public bool Veteran { get; set; }
///
/// The number of losses for the participant.
@@ -76,27 +56,47 @@ internal LeaguePosition()
public int Losses { get; set; }
///
- /// Mini series data for the participant. Only present if the participant is currently in a mini series.
+ /// The rank of the participant in a league.
///
- [JsonProperty("miniSeries")]
- public MiniSeries MiniSeries { get; set; }
+ [JsonProperty("rank")]
+ public string Rank { get; set; }
+
+ ///
+ /// The id of the league of the participant.
+ /// Only when it's called from the GetLeaguePositions() 'this method is deprecated)
+ ///
+ [JsonProperty("leagueId")]
+ public string LeagueID { get; set; }
+
+ ///
+ /// Specifies if the participant is inactive.
+ ///
+ [JsonProperty("inactive")]
+ public bool Inactive { get; set; }
+
+ ///
+ /// The league tier of the participant.
+ /// Only when it's called from the GetLeaguePositions()
+ ///
+ [JsonProperty("tier")]
+ public string Tier { get; set; }
///
- /// The ID of the participant (i.e., summoner or team) represented by this entry.
+ /// Specifies if the participant is fresh blood.
///
- [JsonProperty("playerOrTeamId")]
- public string PlayerOrTeamId { get; set; }
+ [JsonProperty("freshBlood")]
+ public bool FreshBlood { get; set; }
///
- /// The name of the the participant (i.e., summoner or team) represented by this entry.
+ /// Player's summonerId (Encrypted)
///
- [JsonProperty("playerOrTeamName")]
- public string PlayerOrTeamName { get; set; }
+ [JsonProperty("summonerId")]
+ public string summonerId { get; set; }
///
- /// The number of wins for the participant.
+ /// The league points of the participant.
///
- [JsonProperty("wins")]
- public int Wins { get; set; }
+ [JsonProperty("leaguePoints")]
+ public int LeaguePoints { get; set; }
}
}
From c5a21a2f374f3e14a532d4b91742b9dec270a426 Mon Sep 17 00:00:00 2001
From: Sylwester Kwiatkowski
Date: Thu, 9 May 2019 13:18:26 +0200
Subject: [PATCH 5/7] fix with current version of the api
---
.../Endpoints/Interfaces/ILeagueEndpoint.cs | 24 ++++++++++++++++---
.../LeagueEndpoint/LeaguePosition.cs | 2 +-
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs b/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs
index 9afe8ede..e469e58f 100644
--- a/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs
+++ b/RiotSharp/Endpoints/Interfaces/ILeagueEndpoint.cs
@@ -11,12 +11,22 @@ namespace RiotSharp.Endpoints.Interfaces
public interface ILeagueEndpoint
{
///
- /// Retrieves the league positions for the specified summoner asynchronously.
+ /// Get all the league entries.
///
- /// in which you wish to look for the league positions of the summoner.
+ /// in which you wish to look for the league entries of the league.
+ /// The queue name e.g. "RANKED_SOLO_5x5"
+ /// The division number e.g. 'IV'
+ /// The tier name e.g. "DIAMOND"
+ /// of the summoner in the leagues.
+ Task> GetLeagueEntriesAsync(Region region, string queue, string tier, string division);
+
+ ///
+ /// Get league entries in all queues for a given summoner ID.
+ ///
+ /// in which you wish to look for the league entries of the summoner.
/// The summoner id.
/// of the summoner in the leagues.
- Task> GetLeaguePositionsAsync(Region region, string summonerId);
+ Task> GetLeagueEntriesBySummonerIdAsync(Region region, string summonerId);
///
/// Get the challenger league for a particular queue asynchronously.
@@ -33,5 +43,13 @@ public interface ILeagueEndpoint
/// Queue in which you wish to look for a master league.
/// A which contains all the masters for this specific region and queue.
Task GetMasterLeagueAsync(Region region, string queue);
+
+ ///
+ /// Get the grandmaster league for a particular queue asynchronously.
+ ///
+ /// in which you wish to look for a grand master league.
+ /// Queue in which you wish to look for a grand master league.
+ /// A which contains all the grand masters for this specific region and queue.
+ Task GetGrandMasterLeagueAsync(Region region, string queue);
}
}
diff --git a/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs b/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
index 583b2a00..82540bc0 100644
--- a/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
+++ b/RiotSharp/Endpoints/LeagueEndpoint/LeaguePosition.cs
@@ -23,7 +23,7 @@ internal LeaguePosition()
/// The name of the summoner.
///
[JsonProperty("summonerName")]
- public string summonerName { get; set; }
+ public string SummonerName { get; set; }
///
/// Specifies if the participant is on a hot streak.
From 70d8111d79a6dbd9f5c4dc9ce9bfdd1e3128e798 Mon Sep 17 00:00:00 2001
From: Sylwester Kwiatkowski
Date: Thu, 9 May 2019 13:41:03 +0200
Subject: [PATCH 6/7] championMastery update
---
.../Endpoints/ChampionMasteryEndpoint/ChampionMastery.cs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/RiotSharp/Endpoints/ChampionMasteryEndpoint/ChampionMastery.cs b/RiotSharp/Endpoints/ChampionMasteryEndpoint/ChampionMastery.cs
index 5968e0c5..4789e88b 100644
--- a/RiotSharp/Endpoints/ChampionMasteryEndpoint/ChampionMastery.cs
+++ b/RiotSharp/Endpoints/ChampionMasteryEndpoint/ChampionMastery.cs
@@ -61,5 +61,11 @@ public class ChampionMastery
///
[JsonProperty("summonerId")]
public string SummonerId { get; set; }
+
+ ///
+ /// Player ID for this entry.
+ ///
+ [JsonProperty("tokensEarned")]
+ public int TokensEarned { get; set; }
}
}
From 9730f4af203b1cb70e8d69498fd2d871d04f25ff Mon Sep 17 00:00:00 2001
From: Sylwester Kwiatkowski
Date: Sat, 11 May 2019 12:29:29 +0200
Subject: [PATCH 7/7] fixed unit tests for leagues
---
RiotSharp.Test/RiotApiTest.cs | 30 +++++++++++++++++++++++++++---
RiotSharp.Test/RiotApiTestBase.cs | 2 ++
RiotSharp.sln | 4 ----
3 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/RiotSharp.Test/RiotApiTest.cs b/RiotSharp.Test/RiotApiTest.cs
index 3d77a2b1..c35c2dec 100644
--- a/RiotSharp.Test/RiotApiTest.cs
+++ b/RiotSharp.Test/RiotApiTest.cs
@@ -92,13 +92,25 @@ public void GetChampionRotationAsync_Test()
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
- public void GetLeaguePositionsAsync_BySummoner_Test()
+ public void GetLeagueEntriesAsync_Test()
{
EnsureCredibility(() =>
{
- var leagues = Api.League.GetLeaguePositionsAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.SummonerIds.FirstOrDefault());
+ var entries = Api.League.GetLeagueEntriesAsync(RiotApiTestBase.SummonersRegion, RiotApiTestBase.Queue, RiotApiTestBase.Tier, RiotApiTestBase.Division);
- Assert.IsTrue(leagues.Result.Count > 0);
+ Assert.IsTrue(entries.Result.Count > 0);
+ });
+ }
+
+ [TestMethod]
+ [TestCategory("RiotApi"), TestCategory("Async")]
+ public void GetLeagueEntriesBySummonerIdAsync_Test()
+ {
+ EnsureCredibility(() =>
+ {
+ var entries = Api.League.GetLeagueEntriesBySummonerIdAsync(Summoner1And2Region, Summoner1Id);
+
+ Assert.IsTrue(entries.Result.Count > 0);
});
}
@@ -125,6 +137,18 @@ public void GetMasterLeagueAsync_Test()
Assert.IsTrue(league.Result.Entries.Count > 0);
});
}
+
+ [TestMethod]
+ [TestCategory("RiotApi"), TestCategory("Async")]
+ public void GetGrandMasterLeagueAsync_Test()
+ {
+ EnsureCredibility(() =>
+ {
+ var league = Api.League.GetGrandMasterLeagueAsync(Summoner1And2Region, RiotApiTestBase.Queue);
+
+ Assert.IsTrue(league.Result.Entries.Count > 0);
+ });
+ }
#endregion
#region Match Tests
diff --git a/RiotSharp.Test/RiotApiTestBase.cs b/RiotSharp.Test/RiotApiTestBase.cs
index bedd37c0..ccab7224 100644
--- a/RiotSharp.Test/RiotApiTestBase.cs
+++ b/RiotSharp.Test/RiotApiTestBase.cs
@@ -57,6 +57,8 @@ internal class RiotApiTestBase : CommonTestBase
public static Region SummonersRegion = (Region) Enum.Parse(typeof(Region), "Na");
public static string Queue = "RANKED_SOLO_5x5";
+ public static string Tier = "DIAMOND";
+ public static string Division = "II";
// Normal 5v5 Draft Pick games
public static int QueueId = 400;
diff --git a/RiotSharp.sln b/RiotSharp.sln
index 4f0081cf..bcbad2ee 100644
--- a/RiotSharp.sln
+++ b/RiotSharp.sln
@@ -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