-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
87 lines (63 loc) · 3.12 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Linq;
using System.Threading.Tasks;
using RLSApi.Data;
using RLSApi.Net.Requests;
namespace RLSApi.Example
{
internal class Program
{
private static void Main(string[] args) => Run().GetAwaiter().GetResult();
private static async Task Run()
{
// Grabs RLS api key from environment variables.
var apiKey = Environment.GetEnvironmentVariable("RLS_API_KEY");
// Initialize RLSClient.
var client = new RLSClient(apiKey);
// Retrieve a single player.
var player = await client.GetPlayerAsync(RlsPlatform.Steam, "76561198033338223");
var playerSeasonEight = player.RankedSeasons.FirstOrDefault(x => x.Key == RlsSeason.Eight);
if (playerSeasonEight.Value != null)
{
Console.WriteLine($"# Player: {player.DisplayName}");
foreach (var playerRank in playerSeasonEight.Value)
{
Console.WriteLine($"{playerRank.Key}: {playerRank.Value.RankPoints} rating");
}
}
// Retrieve multiple players.
var players = await client.GetPlayersAsync(new[]
{
new PlayerBatchRequest(RlsPlatform.Steam, "76561198033338223"),
new PlayerBatchRequest(RlsPlatform.Ps4, "Wizwonk"),
new PlayerBatchRequest(RlsPlatform.Xbox, "Loubleezy")
});
Console.WriteLine("Finished multiple players.");
// Search for players.
var players2 = await client.SearchPlayerAsync("AeonLucid");
Console.WriteLine("Finished search for players.");
// Retrieve the top 100 players of a ranked playlist.
var topPlayers = await client.GetLeaderboardRankedAsync(RlsPlaylistRanked.Standard);
Console.WriteLine("Finished top 100 players of a ranked playlist.");
// Retrieve the top 100 players of a stat type.
var topPlayers2 = await client.GetLeaderboardStatAsync(RlsStatType.Wins);
Console.WriteLine("Finished top 100 players of a stat type.");
// Retrieve platform data.
var platforms = await client.GetPlatformsAsync();
Console.WriteLine("Finished platform data.");
// Retrieve seasons data.
var seasons = await client.GetSeasonsAsync();
Console.WriteLine("Finished seasons data.");
// Retrieve playlist (& population) data.
var playlists = await client.GetPlaylistsAsync();
Console.WriteLine("Finished playlists data.");
// Retrieve tiers data.
var tiers = await client.GetTiersAsync();
Console.WriteLine("Finished tiers data.");
// Retrieve tier data of a specific season.
var tiers2 = await client.GetTiersAsync(RlsSeason.One);
Console.WriteLine("Finished tier data of a specific season.");
Console.WriteLine("Finished.");
}
}
}