Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit f793a20

Browse files
committed
Add GetCapitalRaidSeasonsAsync example
1 parent 5b0fc85 commit f793a20

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/ClashOfClans.App/ClashOfClans.App.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="ClashOfClans" Version="8.4.2" />
11-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
10+
<PackageReference Include="ClashOfClans" Version="8.5.0-rc1" />
11+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

src/ClashOfClans.App/Examples/ClansExamples.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,23 @@ public async Task RetrieveInformationAboutClansCurrentClanWarLeagueGroup()
129129

130130
static string Statistics(ClanWarLeagueWarClan clan) => $"{clan.Name} [{clan.Stars}\u2605/{clan.DestructionPercentage:0.00}%/{clan.Attacks}]";
131131
}
132+
133+
/// <summary>
134+
/// Retrieve clan's capital raid seasons
135+
/// </summary>
136+
public async Task RetrieveClansCapitalRaidSeasons()
137+
{
138+
var query = new Query
139+
{
140+
Limit = 1
141+
};
142+
var coc = new ClashOfClansClient(token);
143+
var capitalRaidSeasons = (ClanCapitalRaidSeasons)await coc.Clans.GetCapitalRaidSeasonsAsync(clanTag, query);
144+
145+
if (capitalRaidSeasons.SingleOrDefault() is ClanCapitalRaidSeason crs)
146+
{
147+
Console.WriteLine($"CapitalTotalLoot {crs.CapitalTotalLoot}, TotalAttacks {crs.TotalAttacks}");
148+
}
149+
}
132150
}
133151
}

src/ClashOfClans.App/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static async Task Main(string[] args)
2727
await clansExamples.RetrieveClansClanWarLog();
2828
await clansExamples.RetrieveInformationAboutClansCurrentClanWar();
2929
await clansExamples.RetrieveInformationAboutClansCurrentClanWarLeagueGroup();
30+
await clansExamples.RetrieveClansCapitalRaidSeasons();
3031

3132
// Access player specific information
3233
var playersExamples = new PlayersExamples(token, playerTag);

0 commit comments

Comments
 (0)