Stastny.CRAPI 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Stastny.CRAPI --version 0.2.1
NuGet\Install-Package Stastny.CRAPI -Version 0.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Stastny.CRAPI" Version="0.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Stastny.CRAPI --version 0.2.1
#r "nuget: Stastny.CRAPI, 0.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Stastny.CRAPI as a Cake Addin
#addin nuget:?package=Stastny.CRAPI&version=0.2.1

// Install Stastny.CRAPI as a Cake Tool
#tool nuget:?package=Stastny.CRAPI&version=0.2.1

C# wrapper for CR API

This C# wrapper was made to help people with using CR API. Wrapper is written in C# and can be used in any C# application.

You need developer key to use API. You can get the key by following instructions listed on CR API website

How to use this wrapper

You have to get your own API key. Get your API KEY here

Classes are divided into 3 groups:

  • Main classes, like Player, Clan and ClashRoyale. These classes have methods, that can be used to get some output (example: Player.GetPlayer(string tag) method returns instance of Player). Instances of these classes have some basic information about object (like Player.name)
  • Sub classes, like PlayerClan or ClanBadge. These classes are related to one of main classes - PlayerClan is related to class Player, or ClanBadge is related to class Clan. These classes contains additional information. For example Player.clan returns PlayClan class, that contains summary of player's clan (information that you can get from ingame profile window, detailed information are in Clan class)
  • Independent classes, like Card. These classes are something between Main classes and Sub classes. They are independent, but you cannot get them directly. They are returned alongside with some Main Class. For example, Player class contains deck property, that is array of Card.

Note: All classes are in namespace CRAPI

To start, initialize Wrapper class. Wrapper wr = new Wrapper(your_dev_key);. You can get clans and players by calling methods on Wrapper class. See example usage.

Example usage

You have to add using: using CRAPI;

// Initialize wrapper with your dev key
Wrapper wr = new Wrapper("your dev key");

// Get player with ID 80RGVCV9C
Player player = wr.GetPlayer("80RGVCV9C");
// Get clan with ID 22Y802
Clan clan = wr.GetClan("22Y802");

Console.WriteLine(player.name);
Console.WriteLine(clan.name);

// Write cards in player's deck
foreach (Card card in player.currentDeck)
    Console.WriteLine(card);

Console.WriteLine("\n");

// Write best player's name and best clan's name
Console.WriteLine(wr.GetTopPlayers()[0]);
Console.WriteLine(wr.GetTopClans()[0]);

Documentation

Documentation is still in TODO phase. Everything you need is commented inside classes. Open .cs files to see code.

Exceptions

When something goes wrong, this wrapper throws an exception. This exception is thrown ONLY in .Get methods, that access API. The exception thrown is WebException. This exception means, that either user don't have connection to the Internet, or something inside API gone wrong (their servers may be down).

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.3 1,099 8/12/2018
0.7.2 900 8/9/2018
0.7.1 1,064 6/3/2018
0.7.0 1,012 5/29/2018
0.6.3 1,001 5/29/2018
0.6.2 1,028 5/23/2018
0.6.1 991 5/12/2018
0.6.0 1,007 5/12/2018
0.5.5 1,009 3/26/2018
0.5.2 988 3/3/2018
0.5.1 990 3/1/2018
0.5.0 1,010 2/27/2018
0.4.3 1,002 2/19/2018
0.4.1 1,049 2/3/2018
0.4.0 1,010 1/30/2018
0.3.6 1,097 1/24/2018
0.3.4 1,001 1/15/2018
0.3.3 1,108 1/11/2018
0.3.2 1,341 1/5/2018
0.3.0 1,105 1/2/2018
0.2.9 1,013 1/1/2018
0.2.6 1,094 12/26/2017
0.2.5 1,039 12/26/2017
0.2.1 960 12/25/2017
0.2.0 958 12/25/2017
0.1.0 1,039 11/30/2017

Added new features and fixed compatibility with API. Added auth. Added project url and summary.