diff --git a/RiotSharp/Endpoints/ClashEndpoint/ClashEndpoint.cs b/RiotSharp/Endpoints/ClashEndpoint/ClashEndpoint.cs
index 87aa9e5f..d311ea91 100644
--- a/RiotSharp/Endpoints/ClashEndpoint/ClashEndpoint.cs
+++ b/RiotSharp/Endpoints/ClashEndpoint/ClashEndpoint.cs
@@ -15,13 +15,15 @@ namespace RiotSharp.Endpoints.ClashEndpoint
///
public class ClashEndpoint : IClashEndpoint
{
- private const string ClashPlayersRootUrl = "/lol/clash/v1/players";
- private const string ClashPlayersBySummonerId = "/by-summoner/{0}";
+ private const string ClashRootUrl = "/lol/clash/v1";
+ private const string ClashPlayersBySummonerId = "/players/by-summoner/{0}";
+ private const string ClashTeamById = "/teams/{0}";
- private const string ClashPlayerCache = "clash-player-{0}_{1}";
- private static readonly TimeSpan ClashPlayersTtl = TimeSpan.FromDays(5);
-
+ private const string ClashPlayerCacheKey = "clash-player-{0}_{1}";
+ private const string ClashTeamCacheKey = "clash-team-{0}_{1}";
+ private static readonly TimeSpan ClashPlayersTtl = TimeSpan.FromDays(5);
+
private readonly IRateLimitedRequester _requester;
private readonly ICache _cache;
@@ -39,7 +41,7 @@ public ClashEndpoint(IRateLimitedRequester requester, ICache cache)
///
public async Task> GetClashPlayersBySummonerIdAsync(Region region, string summonerId)
{
- var cacheKey = string.Format(ClashPlayerCache, region, summonerId);
+ var cacheKey = string.Format(ClashPlayerCacheKey, region, summonerId);
var cachePLayerList = _cache.Get>(cacheKey);
if (cachePLayerList != null)
@@ -48,7 +50,7 @@ public async Task> GetClashPlayersBySummonerIdAsync(Region reg
}
var json = await _requester
- .CreateGetRequestAsync(ClashPlayersRootUrl + string.Format(ClashPlayersBySummonerId, summonerId), region)
+ .CreateGetRequestAsync(ClashRootUrl + string.Format(ClashPlayersBySummonerId, summonerId), region)
.ConfigureAwait(false);
var clashPlayers = JsonConvert.DeserializeObject>(json);
@@ -56,5 +58,26 @@ public async Task> GetClashPlayersBySummonerIdAsync(Region reg
return clashPlayers;
}
+
+
+ ///
+ public async Task GetClashTeamByTeamIdAsync(Region region, string teamId)
+ {
+ var cacheKey = string.Format(ClashTeamCacheKey, region, teamId);
+ var cacheTeam = _cache.Get(cacheKey);
+
+ if (cacheTeam != null)
+ {
+ return cacheTeam;
+ }
+
+ var json = await _requester.CreateGetRequestAsync(ClashRootUrl + string.Format(ClashTeamById, teamId), region)
+ .ConfigureAwait(false);
+
+ var clashTeam = JsonConvert.DeserializeObject(json);
+ _cache.Add(cacheKey, clashTeam, ClashPlayersTtl);
+
+ return clashTeam;
+ }
}
}
\ No newline at end of file
diff --git a/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeam.cs b/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeam.cs
new file mode 100644
index 00000000..42a068fc
--- /dev/null
+++ b/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeam.cs
@@ -0,0 +1,57 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
+
+namespace RiotSharp.Endpoints.ClashEndpoint.Models
+{
+ public class ClashTeam
+ {
+ ///
+ /// Clash team id
+ ///
+ [JsonProperty("id")]
+ public string Id { get; set; }
+
+ ///
+ /// Clash tournament id
+ ///
+ [JsonProperty("tournamentId")]
+ public int TournamentId { get; set; }
+
+ ///
+ /// Clash team name
+ ///
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ ///
+ /// clash team icon id
+ ///
+ [JsonProperty("iconId")]
+ public int IconId { get; set; }
+
+ ///
+ /// clash team tier
+ ///
+ [JsonProperty("tier")]
+ public int Tier { get; set; }
+
+ ///
+ /// Summoner Id of the team captain
+ ///
+ [JsonProperty("captain")]
+ public string CaptainId { get; set; }
+
+ ///
+ /// The team name 3 character long abbreviation
+ ///
+ [JsonProperty("abbreviation")]
+ public string Abbreviation { get; set; }
+
+ ///
+ /// List containing infos about team players
+ ///
+ [JsonProperty("players")]
+ public List Players { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeamPlayer.cs b/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeamPlayer.cs
new file mode 100644
index 00000000..601089e8
--- /dev/null
+++ b/RiotSharp/Endpoints/ClashEndpoint/Models/ClashTeamPlayer.cs
@@ -0,0 +1,29 @@
+using Newtonsoft.Json;
+using RiotSharp.Endpoints.ClashEndpoint.Enums;
+
+namespace RiotSharp.Endpoints.ClashEndpoint.Models
+{
+ ///
+ /// Model Representing a player in the clash team
+ ///
+ public class ClashTeamPlayer
+ {
+ ///
+ /// Summoner Id
+ ///
+ [JsonProperty("summonerId")]
+ public string SummonerId { get; set; }
+
+ ///
+ /// Position In a game
+ ///
+ [JsonProperty("position")]
+ public PositionType Position { get; set; }
+
+ ///
+ /// hierarchy role in the team
+ ///
+ [JsonProperty("role")]
+ public RoleType Role { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/RiotSharp/Endpoints/Interfaces/IClashEndpoint.cs b/RiotSharp/Endpoints/Interfaces/IClashEndpoint.cs
index ef73d42a..80152630 100644
--- a/RiotSharp/Endpoints/Interfaces/IClashEndpoint.cs
+++ b/RiotSharp/Endpoints/Interfaces/IClashEndpoint.cs
@@ -19,5 +19,15 @@ public interface IClashEndpoint
/// Summoner Id for which you need to retrieve clash player list
/// A List of currently active clash players
Task> GetClashPlayersBySummonerIdAsync(Region region, string summonerId);
+
+
+ ///
+ /// Gets Clash Team By Team Id
+ /// Returned Object also contains info about all team players
+ ///
+ /// Region in which team is registered on clash
+ /// Clash team id
+ /// Returns Clash Team model object containing all team info
+ Task GetClashTeamByTeamIdAsync(Region region, string teamId);
}
}
\ No newline at end of file