pub struct SteamClient {
pub options: SteamOptions,
/* private fields */
}Expand description
The main Steam client.
State fields are pub(crate) and read via accessor methods (steam_id(),
cell_id(), etc.). Direct field access was retired in the 0.2.x cycle to
stabilize the public surface for the road to 1.0.
Fields§
§options: SteamOptionsClient options (kept pub because it’s user-supplied configuration).
Implementations§
Source§impl SteamClient
impl SteamClient
Sourcepub fn try_poll_event(&mut self) -> Option<SteamEvent>
pub fn try_poll_event(&mut self) -> Option<SteamEvent>
Poll for events without blocking.
Returns queued events immediately without waiting for network I/O. Useful for draining the event queue in non-async contexts.
Sourcepub async fn poll_event_timeout(
&mut self,
timeout: Duration,
) -> Result<Option<SteamEvent>, SteamError>
pub async fn poll_event_timeout( &mut self, timeout: Duration, ) -> Result<Option<SteamEvent>, SteamError>
Poll for events with a timeout.
Waits for an event up to the specified duration. Returns None if
the timeout expires without receiving an event.
Sourcepub async fn wait_for<F>(
&mut self,
predicate: F,
) -> Result<SteamEvent, SteamError>
pub async fn wait_for<F>( &mut self, predicate: F, ) -> Result<SteamEvent, SteamError>
Wait for an event matching a predicate.
Polls for events until one matches the given predicate, then returns it. Non-matching events are discarded.
Sourcepub async fn wait_for_timeout<F>(
&mut self,
predicate: F,
timeout: Duration,
) -> Result<Option<SteamEvent>, SteamError>
pub async fn wait_for_timeout<F>( &mut self, predicate: F, timeout: Duration, ) -> Result<Option<SteamEvent>, SteamError>
Wait for an event matching a predicate with a timeout.
Sourcepub fn drain_queued_events(&mut self) -> Vec<SteamEvent>
pub fn drain_queued_events(&mut self) -> Vec<SteamEvent>
Drain all currently queued events without blocking.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn relog(&mut self) -> Result<(), SteamError>
pub async fn relog(&mut self) -> Result<(), SteamError>
Manually trigger a reconnection.
Closes the current connection (if any) and starts the reconnect sequence.
§Errors
NotLoggedOnif not currently logged in.Otherif no stored credentials are available for relog.
Sourcepub fn cancel_reconnect(&mut self)
pub fn cancel_reconnect(&mut self)
Cancel any pending reconnection attempts.
Sourcepub fn is_reconnecting(&self) -> bool
pub fn is_reconnecting(&self) -> bool
Check if currently attempting to reconnect.
Sourcepub fn reconnect_state(&self) -> ReconnectState
pub fn reconnect_state(&self) -> ReconnectState
Get the current reconnection state.
Source§impl SteamClient
impl SteamClient
Sourcepub fn is_logged_in(&self) -> bool
pub fn is_logged_in(&self) -> bool
Check if logged in.
Sourcepub fn public_ip(&self) -> Option<String>
pub fn public_ip(&self) -> Option<String>
Public IP address as seen by Steam, or None if not logged in.
Sourcepub fn cell_id(&self) -> Option<u32>
pub fn cell_id(&self) -> Option<u32>
Cell ID assigned for content servers, or None if not logged in.
Sourcepub fn vanity_url(&self) -> Option<String>
pub fn vanity_url(&self) -> Option<String>
Vanity URL slug, if the account has one.
Sourcepub fn account_info(&self) -> Option<AccountInfo>
pub fn account_info(&self) -> Option<AccountInfo>
Account info as received from Steam, or None if not yet received.
Sourcepub fn email_info(&self) -> Option<EmailInfo>
pub fn email_info(&self) -> Option<EmailInfo>
Email info for the logged-in account, or None if not yet received.
Sourcepub fn limitations(&self) -> Option<Limitations>
pub fn limitations(&self) -> Option<Limitations>
Account limitations (limited / community-banned / locked).
Sourcepub fn vac_status(&self) -> Option<VacStatus>
pub fn vac_status(&self) -> Option<VacStatus>
VAC ban status for the logged-in account.
Sourcepub fn licenses(&self) -> Vec<LicenseEntry>
pub fn licenses(&self) -> Vec<LicenseEntry>
Owned licenses (apps and packages). Populated after LicenseList event.
Returns a clone — the licenses Vec sits behind a RwLock.
Sourcepub fn playing_app_ids(&self) -> Vec<u32>
pub fn playing_app_ids(&self) -> Vec<u32>
App IDs currently set via games_played (the “Playing” status).
Sourcepub fn playing_blocked(&self) -> bool
pub fn playing_blocked(&self) -> bool
Whether Steam has blocked this client from setting a Playing status.
Sourcepub fn friend_relationship(&self, steam_id: SteamID) -> Option<u32>
pub fn friend_relationship(&self, steam_id: SteamID) -> Option<u32>
Friend relationship for a given SteamID, if any.
Sourcepub fn friend_list(&self) -> Vec<(SteamID, u32)>
pub fn friend_list(&self) -> Vec<(SteamID, u32)>
Snapshot of (SteamID, relationship) pairs for every known friend.
Returns a Vec rather than an iterator because the underlying friends
map sits behind a RwLock — the read guard can’t outlive the function.
Renamed from friends() to make room for the friends() service-handle
constructor (see SteamClient::friends).
Sourcepub fn persona(&self, steam_id: SteamID) -> Option<UserPersona>
pub fn persona(&self, steam_id: SteamID) -> Option<UserPersona>
Look up a cached persona by SteamID. Returns a clone — the persona map
sits behind a RwLock and we cannot hand out an internal reference.
Sourcepub fn connection_count(&self) -> u32
pub fn connection_count(&self) -> u32
Number of successful (re)connects in this client’s lifetime.
Source§impl SteamClient
impl SteamClient
Sourcepub fn builder() -> SteamClientBuilder
pub fn builder() -> SteamClientBuilder
Create a builder for constructing a SteamClient instance.
The builder allows injecting mock dependencies for testing.
For production use, prefer SteamClient::new() instead.
§Example
use steam_client::SteamClient;
// For testing with mocked dependencies
let (client, mocks) = SteamClient::builder()
.with_mock_http()
.with_mock_clock()
.build_with_mocks();
// Control the mock clock in tests
if let Some(clock) = mocks.clock {
clock.advance(std::time::Duration::from_secs(10));
}Sourcepub fn new(options: SteamOptions) -> Self
pub fn new(options: SteamOptions) -> Self
Create a new Steam client with the given options.
Sourcepub async fn log_on(
&mut self,
details: LogOnDetails,
) -> Result<LogOnResponse, SteamError>
pub async fn log_on( &mut self, details: LogOnDetails, ) -> Result<LogOnResponse, SteamError>
Log on to Steam.
Sourcepub async fn log_off(&mut self) -> Result<(), SteamError>
pub async fn log_off(&mut self) -> Result<(), SteamError>
Log off from Steam.
Sourcepub async fn log_on_with_password(
&mut self,
account_name: &str,
password: &str,
steam_guard_code: Option<&str>,
machine_auth_token: Option<&str>,
) -> Result<LogOnResponse, SteamError>
pub async fn log_on_with_password( &mut self, account_name: &str, password: &str, steam_guard_code: Option<&str>, machine_auth_token: Option<&str>, ) -> Result<LogOnResponse, SteamError>
Log on with username and password using steam-session.
This method handles the full password authentication flow including:
- RSA password encryption
- Starting an auth session with Steam
- Obtaining a refresh token
If Steam Guard is required, returns SteamError::SteamGuardRequired
with details about what code is needed. Use
[submit_steam_guard_code] to provide the code and complete
authentication.
On success, emits a RefreshToken event with the token that can be
saved for future logins.
§Example
let result = client.log_on_with_password("username", "password", None, None).await;
match result {
Ok(response) => tracing::info!("Logged in as {}", response.steam_id.steam3()),
Err(SteamError::SteamGuardRequired { guard_type, email_domain }) => {
tracing::info!("Need Steam Guard code: {:?}", guard_type);
// Get code from user, then call submit_steam_guard_code
}
Err(e) => tracing::info!("Login failed: {:?}", e),
}Sourcepub async fn submit_steam_guard_code(
&mut self,
code: &str,
) -> Result<LogOnResponse, SteamError>
pub async fn submit_steam_guard_code( &mut self, code: &str, ) -> Result<LogOnResponse, SteamError>
Submit a Steam Guard code to complete password authentication.
Call this after [log_on_with_password] returns
SteamError::SteamGuardRequired.
§Example
// After receiving SteamGuardRequired error:
let code = get_code_from_user();
let response = client.submit_steam_guard_code(&code).await?;
tracing::info!("Logged in as {}", response.steam_id.steam3());Log on to Steam using web session cookies.
The cookies themselves are never sent to the CM. Instead, they are used
to mint a short-lived web logon token via Steam’s
/chat/clientjstoken endpoint, and that token (together with the
account name and SteamID returned by the endpoint) is what authenticates
the CM logon.
§Arguments
cookies- Web session cookies for steamcommunity.com (must contain at leaststeamLoginSecure, e.g."sessionid=xxx; steamLoginSecure=yyy").
§Errors
SteamError::InvalidCredentialsif the cookies are not logged in or the endpoint returns no token.SteamError::NetworkError/SteamError::ProtocolErroron HTTP or parsing failures.
§Example
let cookies = "sessionid=...; steamLoginSecure=...";
let response = client.log_on_with_cookies(cookies).await?;
tracing::info!("Logged in as {}", response.steam_id);Sourcepub fn reset_connecting_state(&mut self)
pub fn reset_connecting_state(&mut self)
Force reset the connecting state. Use this if a connection attempt is cancelled externally (e.g. by a timeout).
Sourcepub async fn get_web_session(
&mut self,
) -> Result<(String, Vec<String>), SteamError>
pub async fn get_web_session( &mut self, ) -> Result<(String, Vec<String>), SteamError>
Get web session cookies for Steam web APIs.
This method fetches cookies that can be used to authenticate with Steam web services like steamcommunity.com and store.steampowered.com. It requires a valid login session with a refresh token (not available for web_logon_token or anonymous logins).
On success, this also queues a WebSession event with the session data.
§Returns
Ok((session_id, cookies))- The session ID and cookies for web authentication.Err(SteamError::NotLoggedOn)- If not logged in.Err(SteamError::Other)- If no login session is available (e.g., web_logon_token login).
§Example
let (session_id, cookies) = client.get_web_session().await?;
tracing::info!("Session ID: {}", session_id);
for cookie in &cookies {
tracing::info!("Cookie: {}", cookie);
}Sourcepub async fn send_unified_request_and_wait<T, R>(
&mut self,
method: &str,
request: &T,
) -> Result<R, SteamError>
pub async fn send_unified_request_and_wait<T, R>( &mut self, method: &str, request: &T, ) -> Result<R, SteamError>
Send a unified service method request and wait for the response.
This handles the common pattern of sending a request with job tracking, waiting for the response, decoding it, and mapping errors.
Sourcepub async fn send_request_and_wait<T, R>(
&mut self,
emsg: EMsg,
request: &T,
) -> Result<R, SteamError>
pub async fn send_request_and_wait<T, R>( &mut self, emsg: EMsg, request: &T, ) -> Result<R, SteamError>
Send a protobuf request and wait for the response.
This handles the common pattern of sending a request with job tracking, waiting for the response, decoding it, and mapping errors.
Sourcepub async fn poll_event(&mut self) -> Result<Option<SteamEvent>, SteamError>
pub async fn poll_event(&mut self) -> Result<Option<SteamEvent>, SteamError>
Poll for incoming events.
This method receives messages from the Steam connection and returns decoded events. Call this in a loop to process incoming messages. It also handles automatic reconnection when disconnected.
§Example
loop {
if let Some(event) = client.poll_event().await? {
match event {
SteamEvent::FriendMessage { sender, message, .. } => {
tracing::info!("{} says: {}", sender, message);
}
SteamEvent::PersonaState(persona) => {
tracing::info!("{} is now {:?}", persona.player_name, persona.persona_state);
}
SteamEvent::ReconnectAttempt { attempt, max_attempts, .. } => {
tracing::info!("Reconnecting... attempt {}/{}", attempt, max_attempts);
}
SteamEvent::Disconnected { will_reconnect, .. } => {
if !will_reconnect {
break; // Exit loop on permanent disconnect
}
}
_ => {}
}
}
}Sourcepub async fn poll_events(&mut self) -> Result<Vec<SteamEvent>, SteamError>
pub async fn poll_events(&mut self) -> Result<Vec<SteamEvent>, SteamError>
Poll all available events.
This is useful for processing all events at once, including all sub-messages from Multi messages.
Sourcepub fn format_rich_presence(
&self,
steam_id: SteamID,
language: &str,
) -> Option<String>
pub fn format_rich_presence( &self, steam_id: SteamID, language: &str, ) -> Option<String>
Format a user’s rich presence into a localized string.
§Arguments
steam_id- The user’s SteamIDlanguage- The language for localization (e.g., “english”)
Sourcepub fn get_app_name(&self, app_id: u32) -> Option<String>
pub fn get_app_name(&self, app_id: u32) -> Option<String>
Get an app’s name from cache.
Sourcepub async fn fetch_pending_app_info(&mut self) -> Result<(), SteamError>
pub async fn fetch_pending_app_info(&mut self) -> Result<(), SteamError>
Fetch info for apps that are currently in the pending queue.
This is used for proactive caching of app names and rich presence localization.
Sourcepub async fn update_friend_sessions(&mut self) -> Result<(), SteamError>
pub async fn update_friend_sessions(&mut self) -> Result<(), SteamError>
Fetch and update active friend message sessions.
This updates the local users cache with unread counts and last message
timestamps from active chat sessions.
Sourcepub fn csgo(&mut self) -> CSGOClient<'_>
pub fn csgo(&mut self) -> CSGOClient<'_>
Get the CS:GO service.
Source§impl SteamClient
impl SteamClient
pub fn into_stream(&mut self) -> SteamEventStream<'_>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn request_validation_email(&mut self) -> Result<(), SteamError>
pub async fn request_validation_email(&mut self) -> Result<(), SteamError>
Sourcepub async fn get_steam_guard_details(
&mut self,
) -> Result<SteamGuardDetails, SteamError>
pub async fn get_steam_guard_details( &mut self, ) -> Result<SteamGuardDetails, SteamError>
Sourcepub async fn get_privacy_settings(
&mut self,
) -> Result<PrivacySettings, SteamError>
pub async fn get_privacy_settings( &mut self, ) -> Result<PrivacySettings, SteamError>
Sourcepub fn get_account_limitations(&self) -> Result<AccountLimitations, SteamError>
pub fn get_account_limitations(&self) -> Result<AccountLimitations, SteamError>
Sourcepub fn get_vac_bans(&self) -> Result<VacBans, SteamError>
pub fn get_vac_bans(&self) -> Result<VacBans, SteamError>
Sourcepub async fn get_credential_change_times(
&mut self,
) -> Result<CredentialChangeTimes, SteamError>
pub async fn get_credential_change_times( &mut self, ) -> Result<CredentialChangeTimes, SteamError>
Sourcepub async fn get_auth_secret(&mut self) -> Result<(i32, Vec<u8>), SteamError>
pub async fn get_auth_secret(&mut self) -> Result<(i32, Vec<u8>), SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn create_encrypted_app_ticket(
&mut self,
appid: u32,
user_data: Option<&[u8]>,
) -> Result<Vec<u8>, SteamError>
pub async fn create_encrypted_app_ticket( &mut self, appid: u32, user_data: Option<&[u8]>, ) -> Result<Vec<u8>, SteamError>
Sourcepub async fn get_app_ownership_ticket(
&mut self,
appid: u32,
) -> Result<Vec<u8>, SteamError>
pub async fn get_app_ownership_ticket( &mut self, appid: u32, ) -> Result<Vec<u8>, SteamError>
Sourcepub async fn create_auth_session_ticket(
&mut self,
appid: u32,
) -> Result<AuthSessionTicket, SteamError>
pub async fn create_auth_session_ticket( &mut self, appid: u32, ) -> Result<AuthSessionTicket, SteamError>
Sourcepub async fn cancel_auth_session_ticket(
&mut self,
ticket: AuthSessionTicket,
) -> Result<(), SteamError>
pub async fn cancel_auth_session_ticket( &mut self, ticket: AuthSessionTicket, ) -> Result<(), SteamError>
Cancel an auth session ticket.
Call this when you’re done using a ticket to free resources.
§Arguments
ticket- The ticket to cancel
Sourcepub async fn activate_auth_session_tickets(
&mut self,
appid: u32,
tickets: Vec<AuthSessionTicket>,
) -> Result<Vec<AuthSessionResult>, SteamError>
pub async fn activate_auth_session_tickets( &mut self, appid: u32, tickets: Vec<AuthSessionTicket>, ) -> Result<Vec<AuthSessionResult>, SteamError>
Activate auth session tickets to validate players.
This is typically used by game servers to validate connecting players.
§Arguments
appid- The app IDtickets- Tickets to activate
Sourcepub async fn end_auth_sessions(
&mut self,
appid: u32,
steamids: Vec<SteamID>,
) -> Result<(), SteamError>
pub async fn end_auth_sessions( &mut self, appid: u32, steamids: Vec<SteamID>, ) -> Result<(), SteamError>
End auth sessions for specific users.
§Arguments
appid- The app IDsteamids- SteamIDs of users to end sessions for
Source§impl SteamClient
impl SteamClient
Sourcepub fn get_owned_apps(&self) -> Vec<OwnedApp>
pub fn get_owned_apps(&self) -> Vec<OwnedApp>
Get a list of owned apps for the logged-in user.
This information comes from the ClientLicenseList message received after login. The licenses property contains package info.
Sourcepub async fn get_product_info(
&mut self,
app_ids: Vec<u32>,
) -> Result<(), SteamError>
pub async fn get_product_info( &mut self, app_ids: Vec<u32>, ) -> Result<(), SteamError>
Request product/app info for one or more app IDs.
The response will arrive as a ProductInfoResponse event.
§Arguments
app_ids- The app IDs to get info for
Sourcepub async fn get_product_info_with_tokens(
&mut self,
apps: Vec<AppInfoRequest>,
packages: Vec<PackageInfoRequest>,
) -> Result<(), SteamError>
pub async fn get_product_info_with_tokens( &mut self, apps: Vec<AppInfoRequest>, packages: Vec<PackageInfoRequest>, ) -> Result<(), SteamError>
Request product info for apps and packages with optional access tokens.
The response will arrive as a ProductInfoResponse event.
§Arguments
apps- App info requests with optional tokenspackages- Package info requests with optional tokens
Sourcepub async fn get_package_info(
&mut self,
package_ids: Vec<u32>,
) -> Result<(), SteamError>
pub async fn get_package_info( &mut self, package_ids: Vec<u32>, ) -> Result<(), SteamError>
Request package info for one or more package IDs.
The response will arrive as a ProductInfoResponse event.
§Arguments
package_ids- The package IDs to get info for
Sourcepub async fn get_access_tokens(
&mut self,
app_ids: Vec<u32>,
package_ids: Vec<u32>,
) -> Result<(), SteamError>
pub async fn get_access_tokens( &mut self, app_ids: Vec<u32>, package_ids: Vec<u32>, ) -> Result<(), SteamError>
Request access tokens for app and/or package IDs.
Access tokens are needed to retrieve info for some restricted
apps/packages. The response will arrive as an AccessTokensResponse
event.
§Arguments
app_ids- The app IDs to get tokens forpackage_ids- The package IDs to get tokens for
Sourcepub async fn get_product_access_tokens(
&mut self,
app_ids: Vec<u32>,
) -> Result<(), SteamError>
pub async fn get_product_access_tokens( &mut self, app_ids: Vec<u32>, ) -> Result<(), SteamError>
Request access tokens for app IDs (needed for some operations).
§Arguments
app_ids- The app IDs to get tokens for
Sourcepub async fn get_product_changes(
&mut self,
since_change_number: u32,
) -> Result<(), SteamError>
pub async fn get_product_changes( &mut self, since_change_number: u32, ) -> Result<(), SteamError>
Get a list of apps/packages that have changed since a given change number.
The response will arrive as a ProductChangesResponse event.
Use change number 0 to get the current change number without any
changes.
§Arguments
since_change_number- Get changes since this change number
Sourcepub async fn get_player_count(&mut self, app_id: u32) -> Result<(), SteamError>
pub async fn get_player_count(&mut self, app_id: u32) -> Result<(), SteamError>
Get the number of players currently playing a game.
Use app ID 0 to get the total number of users connected to Steam.
§Arguments
app_id- The app ID to get player count for
Sourcepub async fn kick_playing_session(&mut self) -> Result<(), SteamError>
pub async fn kick_playing_session(&mut self) -> Result<(), SteamError>
Kick any other session logged into this account that is playing a game.
Use this if you receive a playingBlocked event and want to force
playing on this session.
Sourcepub async fn games_played(
&mut self,
app_ids: Vec<u32>,
) -> Result<(), SteamError>
pub async fn games_played( &mut self, app_ids: Vec<u32>, ) -> Result<(), SteamError>
Set the games currently being played.
§Arguments
app_ids- Up to 32 app IDs to set as playing (empty to stop)
Sourcepub async fn games_played_with_extra(
&mut self,
app_ids: Vec<u32>,
custom_game: Option<String>,
) -> Result<(), SteamError>
pub async fn games_played_with_extra( &mut self, app_ids: Vec<u32>, custom_game: Option<String>, ) -> Result<(), SteamError>
Set the games currently being played with a custom game name.
§Arguments
app_ids- Up to 32 app IDs to set as playing (empty to stop)custom_game- Optional custom/non-Steam game name
Sourcepub async fn redeem_key(&mut self, key: String) -> Result<(), SteamError>
pub async fn redeem_key(&mut self, key: String) -> Result<(), SteamError>
Sourcepub async fn request_free_license(
&mut self,
app_ids: Vec<u32>,
) -> Result<CMsgClientRequestFreeLicenseResponse, SteamError>
pub async fn request_free_license( &mut self, app_ids: Vec<u32>, ) -> Result<CMsgClientRequestFreeLicenseResponse, SteamError>
Request licenses for one or more free-on-demand apps.
§Arguments
app_ids- The app IDs to request licenses for
Sourcepub async fn auto_request_free_license(
&mut self,
free_app_list: Vec<u32>,
max_limit: usize,
) -> Result<CMsgClientRequestFreeLicenseResponse, SteamError>
pub async fn auto_request_free_license( &mut self, free_app_list: Vec<u32>, max_limit: usize, ) -> Result<CMsgClientRequestFreeLicenseResponse, SteamError>
Automatically requests any missing licenses from a given list (“free apps”).
§Arguments
free_app_list- List of all possibly free app IDs.max_limit- Maximum number to request in one go.
Sourcepub async fn get_legacy_game_key(
&mut self,
app_id: u32,
) -> Result<(), SteamError>
pub async fn get_legacy_game_key( &mut self, app_id: u32, ) -> Result<(), SteamError>
Sourcepub fn get_owned_packages(&self) -> Vec<u32>
pub fn get_owned_packages(&self) -> Vec<u32>
Get a list of package IDs owned by the user.
This filters out expired licenses.
Sourcepub fn owns_package(&self, package_id: u32) -> bool
pub fn owns_package(&self, package_id: u32) -> bool
Check if the user owns a specific package.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn get_content_servers(
&mut self,
appid: Option<u32>,
) -> Result<Vec<ContentServer>, SteamError>
pub async fn get_content_servers( &mut self, appid: Option<u32>, ) -> Result<Vec<ContentServer>, SteamError>
Get a list of currently available content servers.
§Arguments
appid- Optional app ID to filter servers that serve specific games
Sourcepub async fn get_depot_decryption_key(
&mut self,
appid: u32,
depotid: u32,
) -> Result<Vec<u8>, SteamError>
pub async fn get_depot_decryption_key( &mut self, appid: u32, depotid: u32, ) -> Result<Vec<u8>, SteamError>
Sourcepub async fn get_app_beta_decryption_keys(
&mut self,
appid: u32,
password: &str,
) -> Result<HashMap<String, Vec<u8>>, SteamError>
pub async fn get_app_beta_decryption_keys( &mut self, appid: u32, password: &str, ) -> Result<HashMap<String, Vec<u8>>, SteamError>
Request decryption keys for a beta branch of an app from its beta password.
§Arguments
appid- The app IDpassword- The beta password
Sourcepub async fn get_manifest_request_code(
&mut self,
appid: u32,
depotid: u32,
manifest_id: u64,
branch_name: Option<String>,
branch_password: Option<String>,
) -> Result<u64, SteamError>
pub async fn get_manifest_request_code( &mut self, appid: u32, depotid: u32, manifest_id: u64, branch_name: Option<String>, branch_password: Option<String>, ) -> Result<u64, SteamError>
Get a manifest request code for downloading a manifest.
§Arguments
appid- The app IDdepotid- The depot IDmanifest_id- The manifest IDbranch_name- The branch name (default: “public”)branch_password- Optional branch password
Sourcepub async fn get_cdn_auth_token(
&mut self,
appid: u32,
depotid: u32,
hostname: &str,
) -> Result<CdnAuthToken, SteamError>
pub async fn get_cdn_auth_token( &mut self, appid: u32, depotid: u32, hostname: &str, ) -> Result<CdnAuthToken, SteamError>
Get an auth token for a particular CDN server.
§Arguments
appid- The app IDdepotid- The depot IDhostname- The hostname of the CDN server
Sourcepub async fn get_manifest(
&mut self,
appid: u32,
depotid: u32,
manifest_id: u64,
branch_name: Option<String>,
branch_password: Option<String>,
server: &ContentServer,
_depot_key: &[u8],
) -> Result<DepotManifest, SteamError>
pub async fn get_manifest( &mut self, appid: u32, depotid: u32, manifest_id: u64, branch_name: Option<String>, branch_password: Option<String>, server: &ContentServer, _depot_key: &[u8], ) -> Result<DepotManifest, SteamError>
Get a manifest for a depot.
§Arguments
appid- The app IDdepotid- The depot IDmanifest_id- The manifest IDbranch_name- The branch name (default: “public”)branch_password- Optional branch passwordserver- Content server to download fromdepot_key- Depot decryption key
Sourcepub async fn download_chunk_raw(
&mut self,
appid: u32,
depotid: u32,
chunk: &FileChunk,
server: &ContentServer,
_depot_key: &[u8],
) -> Result<Vec<u8>, SteamError>
pub async fn download_chunk_raw( &mut self, appid: u32, depotid: u32, chunk: &FileChunk, server: &ContentServer, _depot_key: &[u8], ) -> Result<Vec<u8>, SteamError>
Download a raw (encrypted/compressed) chunk from a content server.
§Warning
This returns raw chunk data that is still encrypted and compressed. To use this data, you must:
- Decrypt using the depot key (AES-256-ECB, first 16 bytes are IV)
- Decompress (LZMA or ZIP depending on format)
- Verify CRC32 matches the chunk’s
crcfield
§Arguments
appid- The app ID (for CDN authentication)depotid- The depot IDchunk- The chunk to downloadserver- Content server to download from_depot_key- Depot decryption key (not used yet, for future decryption)
Source§impl SteamClient
impl SteamClient
Sourcepub async fn send_friend_message(
&mut self,
friend: SteamID,
message: &str,
) -> Result<SendMessageResult, SteamError>
pub async fn send_friend_message( &mut self, friend: SteamID, message: &str, ) -> Result<SendMessageResult, SteamError>
Sourcepub fn send_friend_message_async(
&mut self,
friend: SteamID,
message: &str,
) -> Result<Receiver<Result<SendMessageResult, SteamError>>, SteamError>
pub fn send_friend_message_async( &mut self, friend: SteamID, message: &str, ) -> Result<Receiver<Result<SendMessageResult, SteamError>>, SteamError>
Send a chat message to a friend without awaiting the server response.
This returns a receiver that will yield the result once the message is processed by the event loop.
Sourcepub async fn send_friend_message_with_options(
&mut self,
friend: SteamID,
message: &str,
entry_type: EChatEntryType,
contains_bbcode: bool,
) -> Result<SendMessageResult, SteamError>
pub async fn send_friend_message_with_options( &mut self, friend: SteamID, message: &str, entry_type: EChatEntryType, contains_bbcode: bool, ) -> Result<SendMessageResult, SteamError>
Send a chat message to a friend with custom options.
§Arguments
friend- The friend’s SteamIDmessage- The message to sendentry_type- The chat entry typecontains_bbcode- Whether the message contains BBCode
Sourcepub async fn send_friend_typing(
&mut self,
friend: SteamID,
) -> Result<(), SteamError>
pub async fn send_friend_typing( &mut self, friend: SteamID, ) -> Result<(), SteamError>
Sourcepub async fn get_active_friend_sessions(
&mut self,
) -> Result<Vec<FriendMessageSession>, SteamError>
pub async fn get_active_friend_sessions( &mut self, ) -> Result<Vec<FriendMessageSession>, SteamError>
Get active friend message sessions.
Returns a list of friends with active (recent) conversations.
Sourcepub async fn ack_friend_message(
&mut self,
friend: SteamID,
timestamp: u32,
) -> Result<(), SteamError>
pub async fn ack_friend_message( &mut self, friend: SteamID, timestamp: u32, ) -> Result<(), SteamError>
Acknowledge (mark as read) a friend message.
§Arguments
friend- The friend’s SteamIDtimestamp- Unix timestamp of the newest message to acknowledge
Sourcepub async fn get_chat_history(
&mut self,
friend: SteamID,
start_time: u32,
count: u32,
) -> Result<Vec<HistoryMessage>, SteamError>
pub async fn get_chat_history( &mut self, friend: SteamID, start_time: u32, count: u32, ) -> Result<Vec<HistoryMessage>, SteamError>
Sourcepub async fn get_recent_chat_history(
&mut self,
friend: SteamID,
) -> Result<Vec<HistoryMessage>, SteamError>
pub async fn get_recent_chat_history( &mut self, friend: SteamID, ) -> Result<Vec<HistoryMessage>, SteamError>
Sourcepub async fn get_chat_history_background(
&mut self,
friend: SteamID,
start_time: u32,
count: u32,
) -> Result<(), SteamError>
pub async fn get_chat_history_background( &mut self, friend: SteamID, start_time: u32, count: u32, ) -> Result<(), SteamError>
Get chat history with a friend in the background.
The results will be delivered via a ChatEvent::OfflineMessagesFetched
event.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn create_chat_room_group(
&mut self,
name: &str,
invitees: Vec<SteamID>,
) -> Result<ChatRoomGroup, SteamError>
pub async fn create_chat_room_group( &mut self, name: &str, invitees: Vec<SteamID>, ) -> Result<ChatRoomGroup, SteamError>
Create a new chat room group.
§Arguments
name- Name for the group (empty for ad-hoc group)invitees- Users to invite
Sourcepub async fn save_chat_room_group(
&mut self,
group_id: SteamID,
name: &str,
) -> Result<(), SteamError>
pub async fn save_chat_room_group( &mut self, group_id: SteamID, name: &str, ) -> Result<(), SteamError>
Save an unnamed “ad-hoc” group chat as a full chat room group.
§Arguments
group_id- The group IDname- Name for the saved group
Sourcepub async fn get_chat_room_groups(
&mut self,
) -> Result<HashMap<String, ChatRoomGroup>, SteamError>
pub async fn get_chat_room_groups( &mut self, ) -> Result<HashMap<String, ChatRoomGroup>, SteamError>
Get a list of chat room groups you’re in.
Sourcepub async fn set_session_active_chat_groups(
&mut self,
group_ids: Vec<SteamID>,
) -> Result<HashMap<String, ChatRoomGroup>, SteamError>
pub async fn set_session_active_chat_groups( &mut self, group_ids: Vec<SteamID>, ) -> Result<HashMap<String, ChatRoomGroup>, SteamError>
Set which groups are actively being chatted in.
Only active groups receive some events like member state changes.
§Arguments
group_ids- Group IDs to set as active
Sourcepub async fn get_chat_invite_link_info(
&mut self,
link_url: &str,
) -> Result<InviteLinkInfo, SteamError>
pub async fn get_chat_invite_link_info( &mut self, link_url: &str, ) -> Result<InviteLinkInfo, SteamError>
Get details from a chat group invite link.
§Arguments
link_url- The invite link URL (e.g., https://s.team/chat/XXXXX)
Sourcepub async fn join_chat_room_group(
&mut self,
group_id: SteamID,
invite_code: Option<&str>,
) -> Result<ChatRoomGroup, SteamError>
pub async fn join_chat_room_group( &mut self, group_id: SteamID, invite_code: Option<&str>, ) -> Result<ChatRoomGroup, SteamError>
Join a chat room group.
§Arguments
group_id- The group ID to joininvite_code- Optional invite code if joining via invite
Sourcepub async fn leave_chat_room_group(
&mut self,
group_id: SteamID,
) -> Result<(), SteamError>
pub async fn leave_chat_room_group( &mut self, group_id: SteamID, ) -> Result<(), SteamError>
Sourcepub async fn create_chat_room_invite_link(
&mut self,
group_id: SteamID,
seconds_valid: Option<u32>,
voice_chat_id: Option<String>,
) -> Result<String, SteamError>
pub async fn create_chat_room_invite_link( &mut self, group_id: SteamID, seconds_valid: Option<u32>, voice_chat_id: Option<String>, ) -> Result<String, SteamError>
Create an invite link for a chat room group.
§Arguments
group_id- The group IDseconds_valid- Duration in seconds the link is valid (default 3600)voice_chat_id- Optional voice chat ID to link directly to
Sourcepub async fn get_group_invite_links(
&mut self,
group_id: SteamID,
) -> Result<Vec<InviteLinkInfo>, SteamError>
pub async fn get_group_invite_links( &mut self, group_id: SteamID, ) -> Result<Vec<InviteLinkInfo>, SteamError>
Sourcepub async fn delete_invite_link(
&mut self,
group_id: SteamID,
invite_code: &str,
) -> Result<(), SteamError>
pub async fn delete_invite_link( &mut self, group_id: SteamID, invite_code: &str, ) -> Result<(), SteamError>
Revoke and delete an active invite link.
§Arguments
group_id- The group IDinvite_code- The invite code to delete
Sourcepub async fn send_chat_room_message(
&mut self,
group_id: SteamID,
chat_id: u64,
message: &str,
) -> Result<(), SteamError>
pub async fn send_chat_room_message( &mut self, group_id: SteamID, chat_id: u64, message: &str, ) -> Result<(), SteamError>
Send a message to a chat room.
§Arguments
group_id- The group IDchat_id- The chat room ID within the groupmessage- The message to send
Sourcepub async fn create_chat_room(
&mut self,
group_id: SteamID,
name: &str,
allow_voice: bool,
) -> Result<ChatRoom, SteamError>
pub async fn create_chat_room( &mut self, group_id: SteamID, name: &str, allow_voice: bool, ) -> Result<ChatRoom, SteamError>
Create a text/voice chat room in a group.
§Arguments
group_id- The group IDname- Name of the new channelallow_voice- Whether to allow voice chat
Sourcepub async fn rename_chat_room(
&mut self,
group_id: SteamID,
chat_id: u64,
name: &str,
) -> Result<(), SteamError>
pub async fn rename_chat_room( &mut self, group_id: SteamID, chat_id: u64, name: &str, ) -> Result<(), SteamError>
Rename a chat room in a group.
§Arguments
group_id- The group IDchat_id- The chat room IDname- The new name
Sourcepub async fn delete_chat_room(
&mut self,
group_id: SteamID,
chat_id: u64,
) -> Result<(), SteamError>
pub async fn delete_chat_room( &mut self, group_id: SteamID, chat_id: u64, ) -> Result<(), SteamError>
Sourcepub async fn get_chat_room_message_history(
&mut self,
group_id: SteamID,
chat_id: u64,
last_time: u32,
last_ordinal: u32,
max_count: u32,
) -> Result<Vec<ChatRoomMessage>, SteamError>
pub async fn get_chat_room_message_history( &mut self, group_id: SteamID, chat_id: u64, last_time: u32, last_ordinal: u32, max_count: u32, ) -> Result<Vec<ChatRoomMessage>, SteamError>
Get message history for a chat room.
§Arguments
group_id- The group IDchat_id- The chat room IDlast_time- Get messages before this time (0 for most recent)last_ordinal- Get messages before this ordinalmax_count- Maximum messages to return
Sourcepub async fn ack_chat_message(
&mut self,
group_id: SteamID,
chat_id: u64,
timestamp: u32,
) -> Result<(), SteamError>
pub async fn ack_chat_message( &mut self, group_id: SteamID, chat_id: u64, timestamp: u32, ) -> Result<(), SteamError>
Acknowledge (mark as read) a chat room message.
§Arguments
group_id- The group IDchat_id- The chat room IDtimestamp- The timestamp of the newest message acknowledged
Sourcepub async fn delete_chat_messages(
&mut self,
group_id: SteamID,
chat_id: u64,
messages: Vec<(u32, u32)>,
) -> Result<(), SteamError>
pub async fn delete_chat_messages( &mut self, group_id: SteamID, chat_id: u64, messages: Vec<(u32, u32)>, ) -> Result<(), SteamError>
Delete messages from a chat room.
§Arguments
group_id- The group IDchat_id- The chat room IDmessages- List of (server_timestamp, ordinal) tuples to delete
Sourcepub async fn get_clan_chat_group_info(
&mut self,
clan_id: SteamID,
) -> Result<ChatRoomGroup, SteamError>
pub async fn get_clan_chat_group_info( &mut self, clan_id: SteamID, ) -> Result<ChatRoomGroup, SteamError>
Sourcepub async fn kick_chat_room_member(
&mut self,
group_id: SteamID,
steamid: SteamID,
expiry: Option<u32>,
) -> Result<(), SteamError>
pub async fn kick_chat_room_member( &mut self, group_id: SteamID, steamid: SteamID, expiry: Option<u32>, ) -> Result<(), SteamError>
Kick a user from a chat room group.
§Arguments
group_id- The group IDsteamid- The user to kickexpiry- When the kick expires (Unix timestamp, None for permanent)
Sourcepub async fn ban_chat_room_member(
&mut self,
group_id: SteamID,
steamid: SteamID,
_expiry: Option<u32>,
) -> Result<(), SteamError>
pub async fn ban_chat_room_member( &mut self, group_id: SteamID, steamid: SteamID, _expiry: Option<u32>, ) -> Result<(), SteamError>
Ban a user from a chat room group.
§Arguments
group_id- The group IDsteamid- The user to banexpiry- When the ban expires (Unix timestamp, None for permanent)
Sourcepub async fn unban_chat_room_member(
&mut self,
group_id: SteamID,
steamid: SteamID,
) -> Result<(), SteamError>
pub async fn unban_chat_room_member( &mut self, group_id: SteamID, steamid: SteamID, ) -> Result<(), SteamError>
Sourcepub async fn get_group_ban_list(
&mut self,
group_id: SteamID,
) -> Result<Vec<ChatRoomBan>, SteamError>
pub async fn get_group_ban_list( &mut self, group_id: SteamID, ) -> Result<Vec<ChatRoomBan>, SteamError>
Sourcepub async fn set_group_user_role_state(
&mut self,
group_id: SteamID,
steamid: SteamID,
role_id: &str,
role_state: bool,
) -> Result<(), SteamError>
pub async fn set_group_user_role_state( &mut self, group_id: SteamID, steamid: SteamID, role_id: &str, role_state: bool, ) -> Result<(), SteamError>
Add or remove a role to a group user.
§Arguments
group_id- The group IDsteamid- The user SteamIDrole_id- The role IDrole_state- True to add role, false to remove
Sourcepub async fn invite_to_chat_room_group(
&mut self,
group_id: SteamID,
steamid: SteamID,
) -> Result<(), SteamError>
pub async fn invite_to_chat_room_group( &mut self, group_id: SteamID, steamid: SteamID, ) -> Result<(), SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn get_asset_class_info(
&mut self,
language: &str,
appid: u32,
classes: Vec<AssetClass>,
) -> Result<HashMap<u64, AssetClassInfo>, SteamError>
pub async fn get_asset_class_info( &mut self, language: &str, appid: u32, classes: Vec<AssetClass>, ) -> Result<HashMap<u64, AssetClassInfo>, SteamError>
Get asset class information for items in a specific app.
This fetches detailed information about items based on their class IDs.
§Arguments
language- Language code for descriptions (e.g., “english”, “german”)appid- App ID the items belong toclasses- List of asset classes to look up
§Example
let classes = vec![
AssetClass { classid: 123456789, instanceid: None },
AssetClass { classid: 987654321, instanceid: Some(0) },
];
let info = client.get_asset_class_info("english", 730, classes).await?;
for (classid, item) in info {
tracing::info!("{}: {}", classid, item.name);
}Sourcepub async fn get_trade_url(&mut self) -> Result<TradeUrl, SteamError>
pub async fn get_trade_url(&mut self) -> Result<TradeUrl, SteamError>
Sourcepub async fn change_trade_url(&mut self) -> Result<TradeUrl, SteamError>
pub async fn change_trade_url(&mut self) -> Result<TradeUrl, SteamError>
Sourcepub async fn get_emoticon_list(
&mut self,
) -> Result<HashMap<String, Emoticon>, SteamError>
pub async fn get_emoticon_list( &mut self, ) -> Result<HashMap<String, Emoticon>, SteamError>
Sourcepub async fn get_owned_profile_items(
&mut self,
language: Option<&str>,
) -> Result<OwnedProfileItems, SteamError>
pub async fn get_owned_profile_items( &mut self, language: Option<&str>, ) -> Result<OwnedProfileItems, SteamError>
Get a listing of profile items you own.
This returns all profile customization items you own, organized by category.
§Arguments
language- Language code for item descriptions (defaults to “english”)
§Example
let items = client.get_owned_profile_items(Some("english")).await?;
tracing::info!("You own {} profile backgrounds", items.profile_backgrounds.len());
tracing::info!("You own {} avatar frames", items.avatar_frames.len());Sourcepub async fn get_equipped_profile_items(
&mut self,
steam_id: SteamID,
language: Option<&str>,
) -> Result<EquippedProfileItems, SteamError>
pub async fn get_equipped_profile_items( &mut self, steam_id: SteamID, language: Option<&str>, ) -> Result<EquippedProfileItems, SteamError>
Get a user’s equipped profile items.
This returns the profile customization items currently equipped by a user.
§Arguments
steam_id- The Steam ID of the user to look uplanguage- Language code for item descriptions (defaults to “english”)
§Example
let items = client.get_equipped_profile_items(friend_id, Some("english")).await?;
if let Some(bg) = items.profile_background {
tracing::info!("Profile background: {}", bg.name.unwrap_or_default());
}Sourcepub async fn set_profile_background(
&mut self,
background_asset_id: u64,
) -> Result<(), SteamError>
pub async fn set_profile_background( &mut self, background_asset_id: u64, ) -> Result<(), SteamError>
Set your current profile background.
§Arguments
background_asset_id- The community item ID of the background to set
§Example
// Get owned items first
let items = client.get_owned_profile_items(None).await?;
if let Some(bg) = items.profile_backgrounds.first() {
client.set_profile_background(bg.communityitemid).await?;
}Source§impl SteamClient
impl SteamClient
Add new borrowers to your family sharing.
§Arguments
borrowers- SteamIDs of users to authorize as borrowers
Get a list of Steam accounts authorized to borrow your library.
§Arguments
include_canceled- Include canceled authorizationsinclude_pending- Include pending authorizations
Get a list of devices you have authorized for sharing.
§Arguments
include_canceled- Include canceled authorizations
Use local device authorizations to allow usage of shared licenses.
§Arguments
owner_steam_id- The SteamID of the library ownerdevice_token- The device token authorized by the owner
Deactivate family sharing authorizations.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn request_friends(&mut self) -> Result<(), SteamError>
pub async fn request_friends(&mut self) -> Result<(), SteamError>
Request the friends list from Steam.
This sends a ClientFriendsList message which should trigger a response from the server with the full friends list.
Sourcepub async fn request_friends_unified(
&mut self,
) -> Result<Vec<Friend>, SteamError>
pub async fn request_friends_unified( &mut self, ) -> Result<Vec<Friend>, SteamError>
Request friends list using Unified Messages (FriendsList.GetFriendsList#1).
This is the preferred method for Web Logons where ClientFriendsList (CM) is not supported.
Sourcepub async fn request_friends_unified_trigger(
&mut self,
) -> Result<(), SteamError>
pub async fn request_friends_unified_trigger( &mut self, ) -> Result<(), SteamError>
Request friends list using Unified Messages in the background.
The response will be automatically handled when it arrives, updating
internal state and emitting a FriendsList event. Use this to avoid
deadlocks in single-threaded event loops.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn set_persona(
&mut self,
state: EPersonaState,
name: Option<String>,
) -> Result<(), SteamError>
pub async fn set_persona( &mut self, state: EPersonaState, name: Option<String>, ) -> Result<(), SteamError>
Set your persona (online status and optionally name).
§Important: Invisible vs Offline
EPersonaState::Invisible(7): You remain connected to the CM and receive chats/invites, but you appear “Offline” to friends. Use this if you want to “appear offline”.EPersonaState::Offline(0): You are effectively disconnected from the Friends network. You will not receive friend messages or updates.
§Arguments
state- Your new online statename- Optional new profile name
Sourcepub async fn add_friend(
&mut self,
steam_id: SteamID,
) -> Result<AddFriendResult, SteamError>
pub async fn add_friend( &mut self, steam_id: SteamID, ) -> Result<AddFriendResult, SteamError>
Sourcepub async fn remove_friend(
&mut self,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn remove_friend( &mut self, steam_id: SteamID, ) -> Result<(), SteamError>
Remove a friend (or decline a friend invitation).
§Arguments
steam_id- The SteamID of the user to remove
Sourcepub async fn get_personas(
&mut self,
steam_ids: Vec<SteamID>,
) -> Result<(), SteamError>
pub async fn get_personas( &mut self, steam_ids: Vec<SteamID>, ) -> Result<(), SteamError>
Request persona information for one or more users.
§Arguments
steam_ids- The SteamIDs of users to get personas for
Sourcepub async fn get_personas_cached(
&mut self,
steam_ids: Vec<SteamID>,
force_refresh: bool,
) -> Result<HashMap<SteamID, UserPersona>, SteamError>
pub async fn get_personas_cached( &mut self, steam_ids: Vec<SteamID>, force_refresh: bool, ) -> Result<HashMap<SteamID, UserPersona>, SteamError>
Get persona information with caching.
Checks the local cache first, only queries Steam servers for
missing/expired entries. Results are returned from the cache and the
internal users HashMap.
§Arguments
steam_ids- The SteamIDs to get personas forforce_refresh- If true, bypass cache and fetch fresh data from Steam
§Returns
A map of SteamID to UserPersona for all requested IDs that were found.
§Note
The cache is automatically updated when PersonaState events are
received. Use force_refresh when you need guaranteed fresh data.
§Example
// Get personas, using cache when possible
let personas = client.get_personas_cached(friend_ids, false).await?;
for (steam_id, persona) in personas {
tracing::info!("{}: {}", steam_id.steam3(), persona.player_name);
}
// Force refresh from Steam servers
let fresh = client.get_personas_cached(friend_ids, true).await?;Sourcepub async fn block_user(&mut self, steam_id: SteamID) -> Result<(), SteamError>
pub async fn block_user(&mut self, steam_id: SteamID) -> Result<(), SteamError>
Sourcepub async fn unblock_user(
&mut self,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn unblock_user( &mut self, steam_id: SteamID, ) -> Result<(), SteamError>
Sourcepub async fn create_friends_group(
&mut self,
name: &str,
) -> Result<u32, SteamError>
pub async fn create_friends_group( &mut self, name: &str, ) -> Result<u32, SteamError>
Sourcepub async fn delete_friends_group(
&mut self,
group_id: u32,
) -> Result<(), SteamError>
pub async fn delete_friends_group( &mut self, group_id: u32, ) -> Result<(), SteamError>
Sourcepub async fn rename_friends_group(
&mut self,
group_id: u32,
name: &str,
) -> Result<(), SteamError>
pub async fn rename_friends_group( &mut self, group_id: u32, name: &str, ) -> Result<(), SteamError>
Rename a friends group (tag).
§Arguments
group_id- The ID of the group to renamename- The new name for the group
Sourcepub async fn add_friend_to_group(
&mut self,
group_id: u32,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn add_friend_to_group( &mut self, group_id: u32, steam_id: SteamID, ) -> Result<(), SteamError>
Add a friend to a friends group (tag).
§Arguments
group_id- The ID of the groupsteam_id- The SteamID of the friend to add
Sourcepub async fn remove_friend_from_group(
&mut self,
group_id: u32,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn remove_friend_from_group( &mut self, group_id: u32, steam_id: SteamID, ) -> Result<(), SteamError>
Remove a friend from a friends group (tag).
§Arguments
group_id- The ID of the groupsteam_id- The SteamID of the friend to remove
Sourcepub async fn set_nickname(
&mut self,
steam_id: SteamID,
nickname: &str,
) -> Result<(), SteamError>
pub async fn set_nickname( &mut self, steam_id: SteamID, nickname: &str, ) -> Result<(), SteamError>
Set a nickname for a friend.
§Arguments
steam_id- The SteamID of the friendnickname- The nickname to set (empty string to remove)
Sourcepub async fn get_nicknames(
&mut self,
) -> Result<HashMap<SteamID, String>, SteamError>
pub async fn get_nicknames( &mut self, ) -> Result<HashMap<SteamID, String>, SteamError>
Sourcepub async fn get_persona_name_history(
&mut self,
steam_ids: Vec<SteamID>,
) -> Result<HashMap<SteamID, Vec<PersonaNameHistory>>, SteamError>
pub async fn get_persona_name_history( &mut self, steam_ids: Vec<SteamID>, ) -> Result<HashMap<SteamID, Vec<PersonaNameHistory>>, SteamError>
Sourcepub async fn get_steam_levels(
&mut self,
steam_ids: Vec<SteamID>,
) -> Result<HashMap<SteamID, u32>, SteamError>
pub async fn get_steam_levels( &mut self, steam_ids: Vec<SteamID>, ) -> Result<HashMap<SteamID, u32>, SteamError>
Sourcepub async fn get_game_badge_level(
&mut self,
app_id: u32,
) -> Result<(u32, i32, i32), SteamError>
pub async fn get_game_badge_level( &mut self, app_id: u32, ) -> Result<(u32, i32, i32), SteamError>
Sourcepub async fn invite_to_group(
&mut self,
steam_id: SteamID,
group_id: SteamID,
) -> Result<(), SteamError>
pub async fn invite_to_group( &mut self, steam_id: SteamID, group_id: SteamID, ) -> Result<(), SteamError>
Invite a friend to a Steam group.
§Arguments
steam_id- The SteamID of the user to invitegroup_id- The SteamID of the group
Sourcepub async fn respond_to_group_invite(
&mut self,
group_id: SteamID,
accept: bool,
) -> Result<(), SteamError>
pub async fn respond_to_group_invite( &mut self, group_id: SteamID, accept: bool, ) -> Result<(), SteamError>
Respond to a Steam group invitation.
§Arguments
group_id- The SteamID of the groupaccept- True to join, false to decline
Sourcepub async fn invite_to_game(
&mut self,
steam_id: SteamID,
connect_string: &str,
) -> Result<(), SteamError>
pub async fn invite_to_game( &mut self, steam_id: SteamID, connect_string: &str, ) -> Result<(), SteamError>
Invite a friend to a game.
§Arguments
steam_id- The SteamID of the friend to inviteconnect_string- The connection string for the game
Sourcepub async fn create_quick_invite_link(
&mut self,
invite_limit: Option<u32>,
invite_duration: Option<u32>,
) -> Result<QuickInviteLink, SteamError>
pub async fn create_quick_invite_link( &mut self, invite_limit: Option<u32>, invite_duration: Option<u32>, ) -> Result<QuickInviteLink, SteamError>
Create a quick invite link.
Quick invite links allow others to add you as a friend without needing to know your SteamID or username.
§Arguments
invite_limit- Maximum number of uses (None = unlimited)invite_duration- Duration in seconds the link is valid (None = no expiry)
§Returns
Information about the created invite link.
§Example
// Create an invite link valid for 1 hour with max 5 uses
let link = client.create_quick_invite_link(Some(5), Some(3600)).await?;
tracing::info!("Share this link: {}", link.invite_link);Sourcepub async fn list_quick_invite_links(
&mut self,
) -> Result<Vec<QuickInviteLink>, SteamError>
pub async fn list_quick_invite_links( &mut self, ) -> Result<Vec<QuickInviteLink>, SteamError>
Sourcepub async fn revoke_quick_invite_link(
&mut self,
link: &str,
) -> Result<(), SteamError>
pub async fn revoke_quick_invite_link( &mut self, link: &str, ) -> Result<(), SteamError>
Sourcepub fn get_quick_invite_link_steam_id(
&self,
link: &str,
) -> Result<SteamID, SteamError>
pub fn get_quick_invite_link_steam_id( &self, link: &str, ) -> Result<SteamID, SteamError>
Sourcepub async fn check_quick_invite_link_validity(
&mut self,
link: &str,
) -> Result<QuickInviteLinkValidity, SteamError>
pub async fn check_quick_invite_link_validity( &mut self, link: &str, ) -> Result<QuickInviteLinkValidity, SteamError>
Sourcepub async fn redeem_quick_invite_link(
&mut self,
link: &str,
) -> Result<(), SteamError>
pub async fn redeem_quick_invite_link( &mut self, link: &str, ) -> Result<(), SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub fn friends(&mut self) -> FriendsHandle<'_>
pub fn friends(&mut self) -> FriendsHandle<'_>
Friends-service handle. Provides a topic-organized view of the friends API.
let friend = SteamID::from_steam_id64(76561198000000000);
client.friends().add(friend).await?;
let levels = client.friends().steam_levels(&[friend]).await?;Source§impl SteamClient
impl SteamClient
Sourcepub async fn server_query(
&mut self,
filter: &str,
) -> Result<Vec<GameServer>, SteamError>
pub async fn server_query( &mut self, filter: &str, ) -> Result<Vec<GameServer>, SteamError>
Query the GMS for a list of game server IPs and their current player counts.
§Arguments
filter- A filter string. See: https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Filter
§Example filters
\appid\730- CS2 servers\gametype\competitive- Competitive servers\map\de_dust2- Servers on de_dust2
Sourcepub async fn get_server_list(
&mut self,
filter: &str,
limit: u32,
) -> Result<Vec<GameServer>, SteamError>
pub async fn get_server_list( &mut self, filter: &str, limit: u32, ) -> Result<Vec<GameServer>, SteamError>
Get a list of servers including full game data.
§Arguments
filter- A filter stringlimit- Maximum number of servers to return (max ~20,000)
Sourcepub async fn get_server_steam_ids_by_ip(
&mut self,
ips: Vec<String>,
) -> Result<HashMap<String, SteamID>, SteamError>
pub async fn get_server_steam_ids_by_ip( &mut self, ips: Vec<String>, ) -> Result<HashMap<String, SteamID>, SteamError>
Get the associated SteamIDs for given server IPs.
§Arguments
ips- List of server IP:port strings (e.g., “192.168.1.1:27015”)
Sourcepub async fn get_server_ips_by_steam_id(
&mut self,
steamids: Vec<SteamID>,
) -> Result<HashMap<SteamID, String>, SteamError>
pub async fn get_server_ips_by_steam_id( &mut self, steamids: Vec<SteamID>, ) -> Result<HashMap<SteamID, String>, SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn send_to_gc(
&mut self,
appid: u32,
msg_type: u32,
payload: &[u8],
) -> Result<(), SteamError>
pub async fn send_to_gc( &mut self, appid: u32, msg_type: u32, payload: &[u8], ) -> Result<(), SteamError>
Send a message to a Game Coordinator.
You should be currently “in-game” for the specified app for the message to make it to the GC.
§Arguments
appid- The app ID to send the GC message to (e.g., 730 for CS:GO)msg_type- The GC-specific message type IDpayload- The message payload bytes
§Example
// Send a CS:GO GC message
client.send_to_gc(730, 4006, &payload).await?;Sourcepub async fn send_to_gc_proto(
&mut self,
appid: u32,
msg_type: u32,
payload: &[u8],
header: GCProtoHeader,
) -> Result<(), SteamError>
pub async fn send_to_gc_proto( &mut self, appid: u32, msg_type: u32, payload: &[u8], header: GCProtoHeader, ) -> Result<(), SteamError>
Send a protobuf message to a Game Coordinator.
§Arguments
appid- The app ID to send the GC message tomsg_type- The GC-specific message type IDpayload- The message payload bytesheader- The protobuf header
Sourcepub async fn send_to_gc_with_options(
&mut self,
appid: u32,
msg_type: u32,
payload: &[u8],
options: GCSendOptions,
) -> Result<(), SteamError>
pub async fn send_to_gc_with_options( &mut self, appid: u32, msg_type: u32, payload: &[u8], options: GCSendOptions, ) -> Result<(), SteamError>
Send a message to a Game Coordinator with options.
Sourcepub async fn request_players_profile(
&mut self,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn request_players_profile( &mut self, steam_id: SteamID, ) -> Result<(), SteamError>
Request CS:GO player profile.
Sends a ClientRequestPlayersProfile message to the GC.
The response will be emitting via AppsEvent::PlayersProfile.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn get_gift_details(
&self,
gift_id: &str,
cookies: &str,
) -> Result<GiftDetails, SteamError>
pub async fn get_gift_details( &self, gift_id: &str, cookies: &str, ) -> Result<GiftDetails, SteamError>
Get details about a gift in your inventory.
This validates the gift and returns information about it before redemption.
§Arguments
gift_id- The gift ID from the inventorycookies- Web session cookies (e.g., “sessionid=xxx;steamLoginSecure=yyy”)
§Example
let details = client.get_gift_details("1234567890", &cookies).await?;
tracing::info!("Gift: {} (Package {})", details.gift_name, details.package_id);
if details.owned {
tracing::info!("Warning: You already own this game!");
}Sourcepub async fn redeem_gift(
&self,
gift_id: &str,
cookies: &str,
) -> Result<(), SteamError>
pub async fn redeem_gift( &self, gift_id: &str, cookies: &str, ) -> Result<(), SteamError>
Redeem a gift from your inventory to your library.
This unpacks the gift and adds the game to your Steam library.
§Arguments
gift_id- The gift ID from the inventorycookies- Web session cookies (e.g., “sessionid=xxx;steamLoginSecure=yyy”)
§Example
// First validate the gift
let details = client.get_gift_details("1234567890", &cookies).await?;
if !details.owned {
client.redeem_gift("1234567890", &cookies).await?;
tracing::info!("Redeemed: {}", details.gift_name);
}Source§impl SteamClient
impl SteamClient
Sourcepub async fn mark_notifications_read(
&mut self,
notification_ids: Vec<String>,
) -> Result<(), SteamError>
pub async fn mark_notifications_read( &mut self, notification_ids: Vec<String>, ) -> Result<(), SteamError>
Sourcepub async fn mark_all_notifications_read(&mut self) -> Result<(), SteamError>
pub async fn mark_all_notifications_read(&mut self) -> Result<(), SteamError>
Sourcepub async fn request_notifications(&mut self) -> Result<(), SteamError>
pub async fn request_notifications(&mut self) -> Result<(), SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn get_published_file_details(
&mut self,
ids: Vec<u64>,
) -> Result<HashMap<u64, PublishedFileDetails>, SteamError>
pub async fn get_published_file_details( &mut self, ids: Vec<u64>, ) -> Result<HashMap<u64, PublishedFileDetails>, SteamError>
Sourcepub async fn get_published_file_detail(
&mut self,
id: u64,
) -> Result<Option<PublishedFileDetails>, SteamError>
pub async fn get_published_file_detail( &mut self, id: u64, ) -> Result<Option<PublishedFileDetails>, SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn upload_rich_presence(
&mut self,
appid: u32,
data: &HashMap<String, String>,
) -> Result<(), SteamError>
pub async fn upload_rich_presence( &mut self, appid: u32, data: &HashMap<String, String>, ) -> Result<(), SteamError>
Upload rich presence data for an app.
Rich presence is displayed to friends and on your profile. The data is a key-value map of strings.
§Arguments
appid- The app ID to set rich presence fordata- Key-value pairs of rich presence data
§Example
use std::collections::HashMap;
let mut presence = HashMap::new();
presence.insert("status".to_string(), "In Main Menu".to_string());
presence.insert("connect".to_string(), "+connect localhost:27015".to_string());
client.upload_rich_presence(730, &presence).await?;Sourcepub async fn request_rich_presence(
&mut self,
appid: u32,
steam_ids: &[SteamID],
) -> Result<(), SteamError>
pub async fn request_rich_presence( &mut self, appid: u32, steam_ids: &[SteamID], ) -> Result<(), SteamError>
Request rich presence data for users.
§Arguments
appid- The app ID to get rich presence forsteam_ids- SteamIDs of users to request rich presence for
§Example
let steam_ids = vec![steam_id_1, steam_id_2];
client.request_rich_presence(730, &steam_ids).await?;
// Rich presence data will arrive as SteamEvent::RichPresence eventsSourcepub async fn get_app_rich_presence_localization(
&mut self,
appid: i32,
language: &str,
) -> Result<(), SteamError>
pub async fn get_app_rich_presence_localization( &mut self, appid: i32, language: &str, ) -> Result<(), SteamError>
Get rich presence localization tokens for an app.
§Arguments
appid- The app ID to get localizations forlanguage- The language to get localizations for (e.g., “english”)
Sourcepub async fn clear_rich_presence(
&mut self,
appid: u32,
) -> Result<(), SteamError>
pub async fn clear_rich_presence( &mut self, appid: u32, ) -> Result<(), SteamError>
Clear rich presence for an app.
This removes all rich presence data for the specified app.
Source§impl SteamClient
impl SteamClient
Sourcepub async fn get_store_tag_names(
&mut self,
language: &str,
tag_ids: &[u32],
) -> Result<Vec<StoreTag>, SteamError>
pub async fn get_store_tag_names( &mut self, language: &str, tag_ids: &[u32], ) -> Result<Vec<StoreTag>, SteamError>
Source§impl SteamClient
impl SteamClient
Sourcepub async fn trade(&mut self, steam_id: SteamID) -> Result<(), SteamError>
pub async fn trade(&mut self, steam_id: SteamID) -> Result<(), SteamError>
Send a trade request to another user.
Note: Trading has been removed from the Steam UI in favor of trade offers. This still works between bots however.
§Arguments
steam_id- The SteamID of the user to trade with
Sourcepub async fn cancel_trade_request(
&mut self,
steam_id: SteamID,
) -> Result<(), SteamError>
pub async fn cancel_trade_request( &mut self, steam_id: SteamID, ) -> Result<(), SteamError>
Cancel an outstanding trade request we sent to another user.
§Arguments
steam_id- The SteamID of the user to cancel the trade with
Sourcepub async fn respond_to_trade(
&mut self,
trade_request_id: u32,
accept: bool,
) -> Result<(), SteamError>
pub async fn respond_to_trade( &mut self, trade_request_id: u32, accept: bool, ) -> Result<(), SteamError>
Respond to a trade request.
§Arguments
trade_request_id- The trade request ID from the TradeRequest eventaccept- Whether to accept or decline the trade
Source§impl SteamClient
impl SteamClient
Sourcepub async fn enable_two_factor(
&mut self,
) -> Result<TwoFactorSecrets, SteamError>
pub async fn enable_two_factor( &mut self, ) -> Result<TwoFactorSecrets, SteamError>
Enable TOTP two-factor authentication on this account.
This begins the 2FA setup process. Steam will send an SMS with
an activation code that must be passed to [finalize_two_factor].
§Returns
Returns TwoFactorSecrets containing the shared secret and other
data needed to generate TOTP codes. Save these securely!
§Example
let secrets = client.enable_two_factor().await?;
tracing::info!("Shared secret: {}", secrets.shared_secret);
tracing::info!("Revocation code: {}", secrets.revocation_code);
// Wait for SMS, then call finalize_two_factorSourcepub async fn finalize_two_factor(
&mut self,
shared_secret: &str,
activation_code: &str,
) -> Result<(), SteamError>
pub async fn finalize_two_factor( &mut self, shared_secret: &str, activation_code: &str, ) -> Result<(), SteamError>
Finalize the two-factor authentication setup.
After calling [enable_two_factor], Steam sends an SMS with an
activation code. Call this method with that code to complete the 2FA
setup.
§Arguments
shared_secret- The shared secret returned from [enable_two_factor]activation_code- The SMS activation code from Steam
§Example
// After receiving SMS code
client.finalize_two_factor(&secrets.shared_secret, "ABC123").await?;
tracing::info!("2FA enabled successfully!");Auto Trait Implementations§
impl Freeze for SteamClient
impl !RefUnwindSafe for SteamClient
impl Send for SteamClient
impl Sync for SteamClient
impl Unpin for SteamClient
impl UnsafeUnpin for SteamClient
impl !UnwindSafe for SteamClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more