Documentation

Most methods, comments and various documentation are mostly from the Riot Games WebAPI documentation:

https://developer.riotgames.com/

Installation

  1. Enter PM> Install-Package RiotGamesWebAPI from the package manager console.
  2. You can also search for RiotGamesWebAPI from the NuGet Package Manager.

Quick Start

Required Namespaces

using PortableRiotGames;

Optional Namespaces

using PortableRiotGames.Fluent;
using PortableRiotGames.Infrastructure;
using PortableRiotGames.Interfaces;

  1. Import PortableRiotGames
  2. Obtain your Riot Games Developer API Key from https://developer.riotgames.com/
  3. Set the api key: RiotGamesWebAPI.SetDeveloperKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
  4. Set the default request region: RiotGamesWebAPI.SetDefaultRegion(the region you want);
  5. Begin exploring the riot games web api interfaces and methods.

Usage Patterns

Most Interfaces, methods and parameters follow the same naming as the web api. All request and response methods and parameters are fully documented so feel free to explore the code through intellisense.

Configurations

You start off the request configuration by calling RiotGamesWebAPI.

The fluent pattern follows the web api's method of organizing interfaces and methods.

RiotGamesWebAPI
  -Champion
  -Game
  -League
  -Stats
  -Summoner
  -Team

For example if I wanted to get rune pages for summoner it would look something like this.

var response = RiotGamesWebAPI.Summoner().GetRunes(20934774).GetResponse();

Or if I wanted to get ranked statistic summary for summoner:

var response = RiotGamesWebAPI.Stats().GetRanked(_summonerID).GetResponse();

Requests

All requests must have an API key set by:

RiotGamesWebAPI.SetDeveloperKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

Web API requests have required parameters and optional parameters.

Required parameters are enforced and must be supplied through method parameters. For example,

var response = RiotGamesAPI.Summoner()
                           .GetSummoners(20934774, 21267565)
                           .GetResponse();

As you may have noticed, GetSummoners require multiple summoner IDs.

Optional Parameters can be accessed through the fluent syntax after the method has been called.

var response = RiotGamesWebAPI.Champion()
                              .GetChampions()
                              .FreeToPlay()
                              .Regions(Region.NA)
                              .GetResponse();

After GetChampions() was called, everything between that and GetResponse() are optional parameters.

Responses

Response objects maybe contain more than one response. Each response comes from a request for a particular region. The library supports requesting from multiple regions at once.

You can specific a request to pull from more than one region like this:

var response = RiotGamesAPI.Summoner()
                           .GetSummoner("helloworld65")
                           .Regions(Region.NA,
                                    Region.EUNE,
                                    Region.EUW,
                                    Region.BR,
                                    Region.TR).GetResponse();

If the method you are requesting does not support the region. That region's particular response status will reflect as such with an error message and error code. It will not effect the request of other regions.

 

Response objects are fully documented so feel free to explore the hiearchies.

Response strings can be returned through the GetResponseString() method. The default format from Riot Games server is JSON.

Responses also support asynchronous calls such as GetResponseAsync() and GetResponseStringAsync()

Naming Patterns

  • API Interfaces are named the same way as the Web API interface names.
  • Interface methods are named the same way as the Web API method names.
  • Method parameters are named like Web API parameter names except the first letter is capitalized to follow C# code conventions.
  • Request objects are named methodnameRequest where methodname is the Web API's method name.
  • Response objects are named methodnameResponse where methodname is the Web API's method name.
  • Builder objects are named methodnameBuilder where methodname is the Web API's method name

Happy Coding!

 

Last edited Jan 5, 2014 at 5:38 AM by helloworld65, version 3