Skip to main content

steam_client/
lib.rs

1//! Steam client for Rust.
2//!
3//! This crate provides a Steam client for individual and anonymous user account
4//! types.
5//!
6//! # Example
7//!
8//! ```rust,no_run
9//! use steam_client::{AuthEvent, LogOnDetails, SteamClient, SteamEvent, TokenStore};
10//!
11//! #[tokio::main]
12//! async fn main() {
13//!     let mut client = SteamClient::new(Default::default());
14//!     let token_store = TokenStore::new("steam_tokens.json");
15//!
16//!     // Load previous session if available
17//!     let logon_details = token_store.load(None).unwrap_or_default();
18//!     client.log_on(logon_details).await.unwrap();
19//!
20//!     // In your event loop, save the token when refreshed
21//!     // while let Some(event) = client.next().await {
22//!     //     match event {
23//!     //         SteamEvent::Auth(AuthEvent::RefreshToken(token)) => {
24//!     //             // Use actual account name and steam_id from client state or event
25//!     //             // token_store.save("account_name".into(), token, 0).unwrap();
26//!     //         }
27//!     //         _ => {}
28//!     //     }
29//!     // }
30//! }
31//! ```
32
33// Core modules (at root level)
34mod connection;
35mod error;
36mod options;
37mod protocol;
38mod types;
39
40// Organized submodules
41pub mod cache;
42pub mod client;
43pub mod internal;
44pub mod persistence;
45pub mod services;
46pub mod utils;
47
48// ============================================================================
49// Public Re-exports
50// ============================================================================
51
52// Core types
53// Client
54pub use client::{AccountEvent, AppChange, AppInfoData, AppsEvent, AuthEvent, CSGOEvent, ChatEvent, ConnectionEvent, ContentEvent, CsgoClientHello, CsgoCommendation, CsgoPartyEntry, CsgoRanking, CsgoWelcome, FriendEntry, FriendsEvent, LicenseEntry, MessageHandler, MockHandles, NotificationsEvent, PackageChange, PackageInfoData, SteamClient, SteamClientBuilder, SteamEvent, SteamEventStream, SystemEvent, UserPersona};
55pub use error::SteamError;
56// Internal (exposed for testing)
57pub use internal::{HeartbeatManager, JobManager, JobResponse, MessageSender, MockMessageSender, ReconnectManager, ReconnectState, SentMessage, SessionInfo};
58pub use options::{HeartbeatOptions, ReconnectConfig, SteamOptions};
59pub use persistence::TokenStore;
60// Services
61pub use services::{
62    // Account
63    AccountInfo,
64    AccountLimitations,
65    // Friends
66    AddFriendResult,
67    // Apps
68    AppInfo,
69    AppInfoRequest,
70    // Economy
71    AssetClass,
72    AssetClassInfo,
73    // App auth
74    AuthSessionResult,
75    AuthSessionTicket,
76    // Family sharing
77    AuthorizedBorrower,
78    AuthorizedDevice,
79    // CDN
80    CdnAuthToken,
81    // Chat
82    ChatMessage,
83    // Chat room
84    ChatRole,
85    ChatRoom,
86    ChatRoomGroup,
87    ChatRoomMember,
88    ChatRoomMessage,
89    ContentServer,
90    DepotManifest,
91    EmailInfo,
92    Emoticon,
93    EquippedProfileItems,
94    FileChunk,
95    Friend,
96    FriendMessageSession,
97    FriendsGroup,
98    // GC
99    GCMessage,
100    GCProtoHeader,
101    GCSendOptions,
102    // Game servers
103    GameServer,
104    HistoryMessage,
105    // Idler
106    IdlerHandle,
107    InviteLinkInfo,
108    ManifestFile,
109    // Notifications
110    Notification,
111    NotificationType,
112    OwnedApp,
113    OwnedProfileItems,
114    PackageInfo,
115    PackageInfoRequest,
116    PrivacySettings,
117    ProfileItem,
118    // Published files
119    PublishedFileDetails,
120    // Rich presence
121    RichPresenceData,
122    RolePermissions,
123    SendMessageResult,
124    SteamGuardDetails,
125    // Trading
126    TradeRestrictions,
127    TradeUrl,
128    // Two-factor
129    TwoFactorSecrets,
130    VacBans,
131    VoteData,
132    WalletInfo,
133};
134// Re-export commonly used types from other crates
135pub use steam_enums::{EAccountType, EAppType, EChatEntryType, EClanRelationship, ECurrencyCode, EFriendRelationship, ELicenseType, EPaymentMethod, EPersonaState, EPlatformType, EResult, EServerType, EUniverse};
136pub use steamid::SteamID;
137pub use types::{LogOnDetails, LogOnResponse};
138// Utils (exposed for advanced usage)
139pub use utils::{Clock, HttpClient, HttpResponse, MockClock, MockHttpClient, MockRequest, MockRng, ReqwestHttpClient, Rng, SystemClock, ThreadRng};