Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Matcheryt/SharpOfClans

Repository files navigation

Sharp Of Clans build status docs status Nuget

A Clash Of Clans API Wrapper for .NET 5.0

Inspired by CocNET and RiotSharp

This project is licensed under the MIT license.

If you have any questions regarding the library's endpoint structure, please refer to the Clash of Clans API documentation.

Remarks

As of now, this library does not have neither rate limiting nor caching. However, these functionality may be implemented in a future version.

Adding to your project

You can install Sharp of Clans via the package manager with the following command:

Install-Package SharpOfClans

For different installation ways, please refer to the Sharp of Clans nuget page.

Using the library

Make sure you're importing the library with using:

using SharpOfClans;

After that, you can get an instance of the entrypoint's class.

// Replace 'cocApiToken' with your CoC API Token
var cocApiToken = "token";
var clashApi = ClashApi.GetInstance(cocApiToken);

You can then use clashApi to access the API's endpoints, for example:

// Get a player with specific tag through the players endpoint
var player = await clashApi.Players.GetPlayerAsync("#L22YL908");

// Write player's name to the console
Console.WriteLine($"The player's name is {player.Name}.");

Documentation

You can find more documentation on SharpOfClans' documentation page.

Dependencies

Credits

This is the first library I developed, hence I had no idea of how one should be structured. For that reason I referred to the RiotSharp library to get an idea of how a library should be structured, so thanks Ben!

Disclaimer

This material is unofficial and is not endorsed by Supercell. For more information see Supercell's Fan Content Policy: www.supercell.com/fan-content-policy.