SteamModelsDotNetCore 1.2.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SteamModelsDotNetCore --version 1.2.1
NuGet\Install-Package SteamModelsDotNetCore -Version 1.2.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="SteamModelsDotNetCore" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SteamModelsDotNetCore --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SteamModelsDotNetCore, 1.2.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 SteamModelsDotNetCore as a Cake Addin
#addin nuget:?package=SteamModelsDotNetCore&version=1.2.1
// Install SteamModelsDotNetCore as a Cake Tool
#tool nuget:?package=SteamModelsDotNetCore&version=1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SteamModels-DotNet
.NET Models for the Steam API. Available on NuGet.
Usage
The Steam API results can be deserialized into the .NET model classes provided by SteamModels.
Example with SteamUser
:
public class SteamService
{
private readonly string _playerDetailsUrl = "http://steamcommunity.com/id/{0}/?xml=1";
private string _username;
public SteamUser GetSteamUserDetails(string name)
{
HttpClient client = new HttpClient();
this._username = NormalizeUsername(name);
var playerDetailsResponse = client.GetStreamAsync(this._username);
XmlSerializer serializer = new XmlSerializer(typeof(SteamUser));
SteamUser user = (SteamUser)serializer.Deserialize(playerDetailsResponse.Result);
return user;
}
public string NormalizeUsername(string name)
{
return name.Contains("http://") ? name : string.Format(_playerDetailsUrl, name);
}
}
Example with SteamNews
:
public class SteamService
{
private readonly string _steamAppNewsUrl = "http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid={0}&maxlength=300&format=json";
public async Task<SteamNews> GetSteamAppNewsJSON(int appid)
{
HttpClient client = new HttpClient();
var steamnews = await client.GetStringAsync(string.format(this._steamAppNewsUrl, appid));
SteamNews news = JsonConvert.DeserializeObject<SteamNews>(steamnews);
return news;
}
}
Example with SteamUserStats
:
public class SteamService
{
private readonly string _steamUserStatsUrl = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid={0}&key={1}&steamid={2}&format=json";
public static SteamUserStats GetStatsForGame(string username)
{
HttpClient client = new HttpClient();
var statsForGameResponse = client.GetStringAsync(string.Format(_steamUserStatsUrl, SteamInfo.Config.gameId, SteamInfo.Config.steamApiKey, username));
SteamUserStats statsForUser = JsonConvert.DeserializeObject<SteamUserStats>(statsForGameResponse.Result);
return statsForUser;
}
}
Example with CSGOPlayerStats
, which is a superset of SteamUserStats
with specific parsing for some CS:GO stats, like HS%, Accuracy, Top Weapon, Total Kills, etc:
public class SteamService
{
private readonly string _steamUserStatsUrl = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid={0}&key={1}&steamid={2}&format=json";
public static CSGOPlayerStats GetStatsForGame(string username)
{
HttpClient client = new HttpClient();
var statsForGameResponse = client.GetStringAsync(string.Format(_steamUserStatsUrl, 730, SteamInfo.Config.steamApiKey, username));
CSGOPlayerStats statsForUser = JsonConvert.DeserializeObject<CSGOPlayerStats>(statsForGameResponse.Result);
return statsForUser;
}
}
Example with SteamGroup
private static readonly string _groupMembersUrl = "https://steamcommunity.com/gid/{0}/memberslistxml/?xml=1";
public static SteamGroup GetSteamGroup(string groupid)
{
HttpClient client = new HttpClient();
var playerDetailsResponse = client.GetStreamAsync(string.Format(_groupMembersUrl, groupid));
XmlSerializer serializer = new XmlSerializer(typeof(SteamGroup));
SteamGroup group = (SteamGroup)serializer.Deserialize(playerDetailsResponse.Result);
return group;
}
Product | Versions 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 | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Making the SteamGroup a public class and exposing members a list of SteamID64.