Tutorial: Get started with RiotBlossom using .NET Core CLI

This totes awesome tutorial will show you how to install RiotBlossom and make a request to the Riot Games API using .NET Core CLI!

You will learn how to:

  • Create a console project
  • Setup RiotBlossom
  • Fetching data from summoner-v4
  • Run the app

Prerequisites

Create a console project

Open your preferred shell and enter the following command:

dotnet new console

This command will create source files within the current directory.

Setup RiotBlossom

We will first need to install RiotBlossom from nuget.org, an online NuGet package repository for .NET apps.

dotnet add package BlossomiShymae.RiotBlossom

With the package added, we can now fetch data from summoner-v4!

Fetching data from summoner-v4

Open Program.cs to modify and save the code to something like this:

using BlossomiShymae.RiotBlossom.Core;
using BlossomiShymae.RiotBlossom.Type;

string key = Environment.GetEnvironmentVariable("RIOT_API_KEY")
    ?? throw new InvalidOperationException("RIOT_API_KEY must be set!");
var client = RiotBlossomCore.CreateClient(key);

var summoner = await client.Riot.Summoner
    .GetByNameAsync(Platform.NorthAmerica, "uwuie time");

Console.WriteLine(summoner);

Run the app

Run the following command:

dotnet run

It should result in something similar to this:

SummonerDto {
  "AccountId": "0WvZHECxpBFNlntYzcCNyDkGeaqA6vthcLsklngrPVYofWE",
  "ProfileIconId": 5367,
  "RevisionDate": 1675651090000,
  "Name": "uwuie time",
  "Id": "Ao5ffQ2dOV-99YKs_iB0g2EGzGD159jXIk2Z5MjvMafLwbQ",
  "Puuid": "Bd1zj7cFt3MlCZl2GI-5N94D2PHRsfpsjl-6ZM9LjXIm90Bz4JAdwR6Kw4fzbSPFfLoQI5p9hGIhfA",
  "SummonerLevel": 936
}

Yay! You just learned how to get started with RiotBlossom in a .NET Core console application!

Lux