v42-RiotSharp 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package v42-RiotSharp --version 3.0.1
NuGet\Install-Package v42-RiotSharp -Version 3.0.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="v42-RiotSharp" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add v42-RiotSharp --version 3.0.1
#r "nuget: v42-RiotSharp, 3.0.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 v42-RiotSharp as a Cake Addin
#addin nuget:?package=v42-RiotSharp&version=3.0.1

// Install v42-RiotSharp as a Cake Tool
#tool nuget:?package=v42-RiotSharp&version=3.0.1

RiotSharp

Join the chat at https://gitter.im/BenFradet/RiotSharp NuGet version Build status Stories in Ready

C# Wrapper for the Riot Games API

Documentation can be found here.

Features

  • No need to worry about the 10 requests per 10s or the 500 requests per 10m rate limits, they are already implemented in the wrapper
  • LINQ support
  • Synchronous and asynchronous API
  • Caching for the Static API

Installation

Install RiotSharp through NuGet:

PM> Install-Package RiotSharp

or

  1. Clone the repo (https://github.com/BenFradet/RiotSharp.git) or download the zip file.

  2. Build the RiotSharp project and add the library to your own application.

Build your own latest NuGet package

You can build your own NuGet package of the latest version with the following command:

msbuild /t:pack /p:Configuration=Release

Execute it from the Visual Studio developer command prompt from inside the RiotSharp project folder. Then copy the Riotsharp.*.nupkg file from the bin folder into your local NuGet feed. Create local NuGet feed

Usage

Main API

In order to use the api you need an api key which you can get here.

Entry point to the api if you do not own a production API key:

var api = RiotApi.GetDevelopmentInstance("YOUR_API_KEY");

If you do own a production API key you can specify your own rate limits:

var api = RiotApi.GetInstance("YOUR_API_KEY",
  yourRateLimitPer10s, yourRateLimitPer10m);

To get a summoner:

try
{
  var summoner = api.GetSummonerByName(Region.euw, "StopOFlop");
}
catch (RiotSharpException ex)
{
  // Handle the exception however you want.
}

You can find a list of all the available operations in RiotApi in the documentation.

Tournament API

You first have to apply for a tournament API key here.

Entry point for the tournament API:

var tournamentApi = TournamentRiotApi.GetInstance("TOURNAMENT_API_KEY");

Next up, create a provider. The url will receive callbacks with match results.

var provider = tournamentApi.CreateProvider(Region.euw, url);

And create a tournament:

var tournament = tournamentApi.CreateTournament(provider.Id, "TOURNAMENT_NAME");

Now you can create tournament codes (which you can use to join games):

var tournamentCode = tournamentApi.CreateTournamentCode(tournament.Id,
    teamSize, allowedSummonerIds, TournamentSpectatorType.All,
    TournamentPickType.TournamentDraft, TournamentMapType.SummonnersRift,
    string.Empty);

The tournament code can now be entered in the client to join a game with the specified settings. Please note that you should save the provider and tournament IDs if you wish to create more tournament codes later on. You should not create a separate provider and tournament ID for every tournament code. Make sure to read Riot's guidelines on this topic.

To create a Tournament object for an existing tournament, use the following syntax:

var tournament = new Tournament { Id = id };

You can then create codes in two ways:

tournament.CreateTournamentCode(teamSize, allowedSummonerIds,
    TournamentSpectatorType.All, TournamentPickType.TournamentDraft,
    TournamentMapType.SummonnersRift, string.Empty);

or, alternatively, if you do not wish to create a separate Tournament object, you can call the CreateTournamentCode method directly from the API as shown previously.

You can find a list of all the available operations in TournamentRiotApi in the documentation.

Static API

You can retrieve static information about the game thanks to the static API, there is no rate limiting on this API and RiotSharp caches as much data as possible to make as few calls as possible.

First, as with the others APIs you need to obtain an instance of the API:

var staticApi = StaticRiotApi.GetInstance("API_KEY");

Then, you can, for example, retrieve data about champions:

var champions = staticApi.GetChampions(Region.euw, ChampionData.all).Champions.Values;
foreach (var champion in champions)
{
    Console.WriteLine(champ.Name);
    Console.WriteLine(champ.Lore);
}

Additionally, you can use the regular api and static api to, for example, retrieve champion masteries for the summoner:

try
{
    var championMasteries =  api.GetChampionMasteries(RiotSharp.Misc.Region.na, summoner.Id);
}
catch (RiotSharpException ex)
{
  // Handle the exception however you want.
}

foreach (var championMastery in championMasteries)
{
    var id = championMastery.ChampionId;
    var name = staticApi.GetChampion(RiotSharp.Misc.Region.euw, id).Name;
    var level = championMastery.ChampionLevel;
    var points = championMastery.ChampionPoints;

    Console.WriteLine($" •  **Level {level} {name}** {points} Points");
}

You can find a list of all the available operations in StaticRiotApi in the Documentation.

Status API

You can also retrieve information available on status.leagueoflegends.com with the Status API. This API is not constrained to the rate limiting and you do not have to supply an API key.

var statusApi = StatusRiotApi.GetInstance();
var shardStatuses = statusApi.GetShardStatus(Region.euw);
foreach (var service in shardStatuses.Services)
{
    Console.WriteLine(service.Name);
    foreach (var incident in service.Incidents)
    {
        incident.Updates.ForEach(u => Console.WriteLine("  " + u.Content));
    }
}

You can find a list of all the available operations in StatusRiotApi in the documentation.

For a full description check the RiotSharpTest project.

Contribution

Simply send a pull request! The up-for-grabs label is a great place to start.

When adding new features, please provide the related unit tests within the pull request. To run the unit tests you need to modify the App.config file and fill out the appropriate values so the tests can run.

Moreover, the documentation is far from perfect so every bit of help is more than welcome.

Libraries used

This wrapper uses Json.NET.

License

This wrapper is under the MIT license.

Disclaimer

RiotSharp isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
4.0.0 8,818 8/1/2019
3.0.8 1,252 1/23/2019
3.0.7 694 12/13/2018
3.0.6 669 12/7/2018
3.0.5 639 12/5/2018
3.0.4 940 8/20/2018
3.0.3 811 8/16/2018
3.0.2 921 7/9/2018
3.0.1 904 7/9/2018

Migrated back to dotnet standard 1.3