Csteam-works is a C# library for interacting with the Steam Web API, enabling easy retrieval of Steam information including games, players, and related data.
The library offers the following services:
GetSteamAppIdData(string searchKeyword)
: Retrieves a list of Steam applications based on a search keyword.GetSteamAppDetails(int appid, string currency = "vn")
: Fetches detailed information about a specific Steam application using its App ID, with options for currency specification.GetCurrentPlayerCount(int appId)
: Retrieves the current number of players for a specified Steam application.GetSteamTopGames(int count = 100)
: Gets a list of the top Steam games by player count, with a customizable number of results.
GetUserID(string key, string username)
: Resolves a Steam username to a Steam User ID using a provided API key.GetPlayerSummaries(string key, string steamId)
: Retrieves detailed summaries for a Steam player using their Steam ID.GetRecentlyPlayedGames(string key, string steamId)
: Retrieves a list of games recently played by a specified user.GetOwnedGames(string key, string steamId)
: Fetches a list of games owned by a specified user.GetUserStats(string key, string steamId)
: Gets comprehensive statistics about a user, including total playtime, most played games, and more.GetPlayerBadges(string key, string steamId)
: Retrieves badges earned by a player, including badge level, XP, and completion time.
- .NET 9.0 or later
- Your location access to Steam is not blocked ( if so then i suggest use proxy or vpn or something that you can connect to steam )
- A Steam Web API key (get one from Steam Developer Portal)
-
Install via NuGet (Recommended) (Coming soon): This is the easiest way to install the library. You can add it to your project directly through your IDE's NuGet package manager.
-
Manual Installation (Alternative):
git clone https://github.com/nupniichan/Csteam-works.git cd Csteam-works dotnet restore
Then, add the project as a reference to your own project.
using csteamworks.Services;
// Search for games by keyword
var steamAppInfo = new CsSteamApp();
var apps = await steamAppInfo.GetSteamAppIdData("Portal");
foreach (var app in apps)
{
Console.WriteLine($"App ID: {app.appid}, Name: {app.name}");
}
// Get detailed information for a specific game
var gameDetails = await steamAppInfo.GetSteamAppDetails(400); // Portal
Console.WriteLine($"Game: {gameDetails.Data.Name}");
Console.WriteLine($"Players online: {gameDetails.Data.CurrentPlayerCount}");
using csteamworks.Services;
var steamUserInfo = new CsSteamUser();
// Convert username to Steam ID
var userId = await steamUserInfo.GetUserID("YOUR_API_KEY", "username");
// Get user profile information
var playerSummary = await steamUserInfo.GetPlayerSummaries("YOUR_API_KEY", userId.steamid);
Console.WriteLine($"Player: {playerSummary.personaname}");
Console.WriteLine($"Status: {playerSummary.OnlineStatus}");
// Get comprehensive user statistics
var userStats = await steamUserInfo.GetUserStats("YOUR_API_KEY", userId.steamid);
Console.WriteLine($"Total games owned: {userStats.TotalGamesOwned}");
Console.WriteLine($"Total playtime: {userStats.TotalPlaytimeHours} hours");
Console.WriteLine($"Library played: {userStats.PercentageOfLibraryPlayed}%");
Remember to replace "YOUR_API_KEY"
with your actual Steam Web API key.
Csteam-works/
├── Models/
│ ├── App/ # Steam application models
│ │ ├── Components/ # Component models for applications
│ │ ├── Detail/ # Detailed app information models
│ │ ├── SteamApp.cs # Basic Steam app model
│ │ ├── OwnedGame.cs # User-owned game model
│ │ ├── Game.cs # Game information model
│ │ └── ...
│ ├── User/ # Steam user-related models
│ │ ├── SteamUser.cs # Basic user profile information
│ │ ├── SteamUserStats.cs # User statistics model
│ │ ├── SteamAppDetail.cs # Detailed app model for user context
│ │ └── ...
│ └── Response/ # API response models
│ ├── User/ # User API response models
│ └── App/ # App API response models
└── Services/
├── CsSteamApp.cs # Services for Steam applications
└── CsSteamUser.cs # Services for Steam users
Contributions are always welcome! Whether it's bug fixes, feature enhancements, or documentation improvements, feel free to create a pull or issue request!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
If there's any errors don't hestinate to create issue. I will read it and fix it as soon as possible
For any questions or issues, please open an issue on this GitHub repository.