Skip to content

Commit

Permalink
LolClashV1: replace GetPlayersBySummonerIdAsync with `GetPlayersByP…
Browse files Browse the repository at this point in the history
…uidAsync`
  • Loading branch information
AoshiW committed Jan 22, 2025
1 parent 1cb2b19 commit 0eea710
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageIcon>logo.png</PackageIcon>

<!--<IsAotCompatible>true</IsAotCompatible>-->
<Version>0.5.0</Version>
<Version>0.6.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Kunc.RiotGames.Api/LolClashV1/ILolClashV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
public interface ILolClashV1
{
/// <summary>
/// Get players by summoner ID.
/// Get players by PUUID.
/// </summary>
/// <remarks>
/// This endpoint returns a list of active Clash players for a given summoner ID.
/// This endpoint returns a list of active Clash players for a given PUUID.
/// If a summoner registers for multiple tournaments at the same time (e.g., Saturday and Sunday) then both registrations would appear in this list.
/// </remarks>
/// <param name="region"></param>
/// <param name="summonerId"></param>
/// <param name="puuid"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PlayerDto[]> GetPlayersBySummonerIdAsync(string region, string summonerId, CancellationToken cancellationToken = default);
Task<PlayerDto[]> GetPlayersByPuuidAsync(string region, string puuid, CancellationToken cancellationToken = default);

/// <summary>
/// Get team by ID.
Expand Down
8 changes: 4 additions & 4 deletions src/Kunc.RiotGames.Api/LolClashV1/LolClashV1Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public LolClashV1Endpoint(IRiotGamesApiClient client)
}

/// <inheritdoc/>
public async Task<PlayerDto[]> GetPlayersBySummonerIdAsync(string region, string summonerId, CancellationToken cancellationToken = default)
public async Task<PlayerDto[]> GetPlayersByPuuidAsync(string region, string puuid, CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrEmpty(region);
ArgumentException.ThrowIfNullOrEmpty(summonerId);
ArgumentException.ThrowIfNullOrEmpty(puuid);

var request = new RiotRequestMessage()
{
HttpMethod = HttpMethod.Get,
Host = region,
MethodId = "/lol/clash/v1/players/by-summoner/{summonerId}",
Path = $"/lol/clash/v1/players/by-summoner/{summonerId}",
MethodId = "/lol/clash/v1/players/by-puuid/{puuid}",
Path = $"/lol/clash/v1/players/by-puuid/{puuid}",
};
var data = await _client.SendAndDeserializeAsync<PlayerDto[]>(request, RiotRequestOptions.Default, cancellationToken).ConfigureAwait(false);
return data!;
Expand Down
15 changes: 14 additions & 1 deletion tests/Kunc.RiotGames.Api.Tests/LolClashV1Test.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Kunc.RiotGames.Api.Tests;
using Microsoft.Extensions.Configuration;

namespace Kunc.RiotGames.Api.Tests;

[TestClass]
public class LolClashV1Test : ApiBase<TGame.LOL>
Expand All @@ -12,4 +14,15 @@ public async Task GetAllActiveOrUpcomingTournamentsAsync()
if (tournaments.Length == 0)
Assert.Inconclusive();
}

[TestMethod]
public async Task GetPlayersByPuuidAsync()
{
var summoner = GetConfiguration("Summoner").Get<AccountInfo>()!;

var players = await Api.LolClashV1.GetPlayersByPuuidAsync(summoner.Region, summoner.Puuid);

_ = players;
Assert.Inconclusive("This test is only to verify that the endpoint does not throw exception.");
}
}

0 comments on commit 0eea710

Please sign in to comment.