Utilities in RiotBlossom

Public utilities are also offered for use in RiotBlossom!

Mappers and converters are included to get the raw or converted values of the aforementioned types in the previous section.

These are used internally for projecting values when making requests to the Riot APIs.

  • LeagueDivisionMapper
  • LeagueQueueMapper
  • LeagueTierMapper
  • LorRegionMapper
  • TftLeagueQueueMapper
  • PlatformMapper
  • PlatformToRegionConverter
  • PrettyPrinter
  • RegionMapper
  • ValRegionMapper

LeagueDivisionMapper

Maps a LeagueDivision enum to a string representation used for the Riot API.

// => "I"
LeagueDivisionMapper.GetValue(LeagueDivision.I);

LeagueQueueMapper

Maps a LeagueQueue enum to a string representation used for the Riot API.

// => "RANKED_SOLO_5x5"
LeagueQueueMapper.GetValue(LeagueQueue.RankedSolo5x5);

LeagueTierMapper

Maps a LeagueTier enum to a string representation used for the Riot API.

// => "IRON"
LeagueTierMapper.GetValue(LeagueTier.Iron);

LorRegionMapper

Maps a LorRegion enum to a string representation used for the Riot API. Can also be done the other way around!

// => "sea"
LorRegionMapper.GetId(LorRegion.SouthEastAsia);
// => LorRegion.SouthEastAsia
LorRegionMapper.FromId("sea");

TftLeagueQueueMapper

Maps a TftLeagueQueue enum to a string representation used for the Riot API.

// => "RANKED_TFT_TURBO"
TftLeagueQueueMapper.GetValue(TftLeagueQueue.RankedTftTurbo);

PlatformMapper

Maps a Platform enum to a string representation used for the Riot API. Can also be done the other way around!

// => "na1"
PlatformMapper.GetId(Platform.NorthAmerica);
// => Platform.Japan
PlatformMapper.FromId("jp1");

PlatformToRegionConverter

Converter for the Platform and Region enums.

// => Region.Americas
PlatformToRegionConverter.ToRegion(Platform.NorthAmerica);

PrettyPrinter

Generates a pretty string representation of a data object. This is used for all data transfer objects served by RiotBlossom! :3

PrettyPrinter is useful for printing objects from the System.Collections namespace. Look at how pretty it is!!! :3

var itemDictionary = await client.CommunityDragon.GetItemDictionaryAsync();
string pp = PrettyPrinter.GetString(itemDictionary);
Console.WriteLine(pp);
IEnumerable`1[KeyValuePair`2] [
  {
    "Key": 1001,
    "Value": {
      "Id": 1001,
      "Name": "Boots",
      "Description": "<mainText><stats><attention> 25</attention> Move Speed</stats></mainText><br>",
      "Active": false,
      "InStore": true,
      "From": [],
      "To": [
        3111,
        3006,
        3009,
        3020,
        3047,
        3117,
        3158
      ],
      "Categories": [
        "Boots"
      ],
      "MaxStacks": 1,
      "RequiredChampion": "",
      "RequiredAlly": "",
      "RequiredBuffCurrencyName": "",
      "RequiredBuffCurrencyCost": 0,
      "SpecialRecipe": 0,
      "IsEnchantment": false,
      "Price": 300,
      "PriceTotal": 300,
      "IconPath": "/lol-game-data/assets/ASSETS/Items/Icons2D/1001_Class_T1_BootsofSpeed.png"
    }
  }
]

There is also a method overload that allows you to set the type label prefix! <3

PrettyPrinter.GetString(itemDictionary, "Items")

RegionMapper

Maps a Region enum to a string representation used for the Riot API. Can also be used the other way around!

// => "sea"
RegionMapper.GetId(Region.SouthEastAsia);
// => Region.Asia
RegionMapper.FromId("asia");

ValRegionMapper

Maps a ValRegion enum to a string representation used for the Riot API. Can also be used the other way around!

// => "ap"
ValRegionMapper.GetId(ValRegion.AsiaPacific);
// => ValRegion.LatinAmerica
ValRegionMapper.FromId("latam");