百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SteamWebAPI

> 编程语言
开源

为 C# 提供了访问 Steam Web API 功能的库。

184 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

为 C# 提供了访问 Steam Web API 功能的库。

This project is no longer actively maintained. You are advised to use a different library.

Steam Web API library

Description

This is a .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes. The primary goal of this project is to support Steam Friends functionality. Other possible functionality like purchasing games and item trading may follow later. In short, it will contain everything needed to write a custom, cross-platform Steam Friends messenger in C#.

Reference

Enumerations

LoginStatus

Enumeration of possible authentication results.

csharp
public enum LoginStatus
{
	LoginFailed,
	LoginSuccessful,
	SteamGuard
}

UserStatus

Status of a user.

csharp
public enum UserStatus
{
	Offline = 0,
	Online = 1,
	Busy = 2,
	Away = 3,
	Snooze = 4
}

ProfileVisibility

Visibility of a user's profile.

csharp
public enum ProfileVisibility
{
	Private = 1,
	Public = 3,
	FriendsOnly = 8
}

AvatarSize

Available sizes of user avatars.

csharp
public enum AvatarSize
{
	Small,
	Medium,
	Large
}

UpdateType

Available update types.

csharp
public enum UpdateType
{
    UserUpdate,
    Message,
	Emote,
    TypingNotification
}

SteamAPISession

This is the main class you will be using. It manages the session of a single Steam user and all requests are issued through methods in this class. Below follows a description of every method.

LoginStatus Authenticate( String username, String password, String emailauthcode = "" )

Authenticate with a username and password. Sends the SteamGuard e-mail if it has been set up and an e-mail code has not been passed.

LoginStatus Authenticate( String accessToken )

Authenticate with an access token previously retrieved with a username and password (and SteamGuard code).

List<Friend> GetFriends( String steamId = null )

Fetch basic info for all friends of a given user.

List<User> GetUserInfo( List<String> steamids )

List<User> GetUserInfo( List<Friend> friends )

User GetUserInfo( String steamid = null )

Retrieve information about the specified users. Pass null for self.

Bitmap GetUserAvatar( User user, AvatarSize size = AvatarSize.Small )

Retrieve the avatar of the specified user as bitmap.

List<Group> GetGroups( String steamid = null )

Fetch basic group info for a given user.

List<GroupInfo> GetGroupInfo( List<String> steamids )

List<GroupInfo> GetGroupInfo( List<Group> groups )

GroupInfo GetGroupInfo( String steamid )

Retrieve information about the specified groups.

Bitmap GetGroupAvatar( Group group, AvatarSize size = AvatarSize.Small )

Retrieve the avatar of the specified group as bitmap.

bool SendTypingNotification( User user )

Let a user know you're typing a message. Should be called periodically.

bool SendMessage( User user, String message )

Send a text message to the specified user.

List<Update> Poll()

Check for updates and new messages.

ServerInfo GetServerInfo()

Returns info about the server, as specified in the ServerInfo class. This is the only call besides Authenticate that does not require a valid user session.

Subclasses

Friend

Structure containing basic friend info.

csharp
public class Friend
{
    public String steamid;
    public bool blocked;
    public DateTime friendSince;
}

User

Structure containing extensive user info.

csharp
public class User
{
	public String steamid;
	public ProfileVisibility profileVisibility;
	public int profileState;
	public String nickname;
	public DateTime lastLogoff;
	public String profileUrl;
	public String avatarUrl;
	public UserStatus status;
	public String realName;
	public String primaryGroupId;
	public DateTime joinDate;
	public String locationCountryCode;
	public String locationStateCode;
	public int locationCityId;
}

Note that some of these fields can be empty!

Group

Basic group info.

csharp
public class Group
{
    public String steamid;
    public bool inviteonly;
}

GroupInfo

Structure containing extensive group info.

csharp
public class GroupInfo
{
    public String steamid;
    public DateTime creationDate;
    public String name;
    public String headline;
    public String summary;
    public String abbreviation;
    public String profileUrl;
    internal String avatarUrl;
    public String locationCountryCode;
    public String locationStateCode;
    public int locationCityId;
    public int favoriteAppId;
    public int members;
    public int usersOnline;
    public int usersInChat;
    public int usersInGame;
    public String owner;
}

Update

Structure containing information about a single update.

csharp
public class Update
{
    public DateTime timestamp;
    public String origin;
    public bool localMessage;
    public UpdateType type;
    public String message;
    public UserStatus status;
    public String nick;
}

ServerInfo

Structure containing server info.

csharp
public class ServerInfo
{
    public DateTime serverTime;
    public String serverTimeString;
}

Example

Here's how to log in with a username and password, ask for the SteamGuard code if necessary and display the amount of friends the user has.

…

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言