Skip to main content

SteamClient

Struct SteamClient 

Source
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: SteamOptions

Client options (kept pub because it’s user-supplied configuration).

Implementations§

Source§

impl SteamClient

Source

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.

Source

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.

Source

pub async fn wait_for<F>( &mut self, predicate: F, ) -> Result<SteamEvent, SteamError>
where F: Fn(&SteamEvent) -> bool,

Wait for an event matching a predicate.

Polls for events until one matches the given predicate, then returns it. Non-matching events are discarded.

Source

pub async fn wait_for_timeout<F>( &mut self, predicate: F, timeout: Duration, ) -> Result<Option<SteamEvent>, SteamError>
where F: Fn(&SteamEvent) -> bool,

Wait for an event matching a predicate with a timeout.

Source

pub fn drain_queued_events(&mut self) -> Vec<SteamEvent>

Drain all currently queued events without blocking.

Source§

impl SteamClient

Source

pub async fn relog(&mut self) -> Result<(), SteamError>

Manually trigger a reconnection.

Closes the current connection (if any) and starts the reconnect sequence.

§Errors
  • NotLoggedOn if not currently logged in.
  • Other if no stored credentials are available for relog.
Source

pub fn cancel_reconnect(&mut self)

Cancel any pending reconnection attempts.

Source

pub fn is_reconnecting(&self) -> bool

Check if currently attempting to reconnect.

Source

pub fn reconnect_state(&self) -> ReconnectState

Get the current reconnection state.

Source§

impl SteamClient

Source

pub fn is_logged_in(&self) -> bool

Check if logged in.

Source

pub fn steam_id(&self) -> Option<SteamID>

The logged-in SteamID, or None if not logged in.

Source

pub fn public_ip(&self) -> Option<String>

Public IP address as seen by Steam, or None if not logged in.

Source

pub fn cell_id(&self) -> Option<u32>

Cell ID assigned for content servers, or None if not logged in.

Source

pub fn vanity_url(&self) -> Option<String>

Vanity URL slug, if the account has one.

Source

pub fn account_info(&self) -> Option<AccountInfo>

Account info as received from Steam, or None if not yet received.

Source

pub fn email_info(&self) -> Option<EmailInfo>

Email info for the logged-in account, or None if not yet received.

Source

pub fn limitations(&self) -> Option<Limitations>

Account limitations (limited / community-banned / locked).

Source

pub fn vac_status(&self) -> Option<VacStatus>

VAC ban status for the logged-in account.

Source

pub fn wallet(&self) -> Option<WalletInfo>

Wallet information for the logged-in account.

Source

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.

Source

pub fn playing_app_ids(&self) -> Vec<u32>

App IDs currently set via games_played (the “Playing” status).

Source

pub fn playing_blocked(&self) -> bool

Whether Steam has blocked this client from setting a Playing status.

Source

pub fn friend_relationship(&self, steam_id: SteamID) -> Option<u32>

Friend relationship for a given SteamID, if any.

Source

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).

Source

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.

Source

pub fn connection_count(&self) -> u32

Number of successful (re)connects in this client’s lifetime.

Source§

impl SteamClient

Source

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));
}
Source

pub fn new(options: SteamOptions) -> Self

Create a new Steam client with the given options.

Source

pub async fn log_on( &mut self, details: LogOnDetails, ) -> Result<LogOnResponse, SteamError>

Log on to Steam.

Source

pub async fn log_off(&mut self) -> Result<(), SteamError>

Log off from Steam.

Source

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),
}
Source

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());
Source

pub async fn log_on_with_cookies( &mut self, cookies: &str, ) -> Result<LogOnResponse, SteamError>

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 least steamLoginSecure, e.g. "sessionid=xxx; steamLoginSecure=yyy").
§Errors
  • SteamError::InvalidCredentials if the cookies are not logged in or the endpoint returns no token.
  • SteamError::NetworkError / SteamError::ProtocolError on 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);
Source

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).

Source

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);
}
Source

pub async fn send_unified_request_and_wait<T, R>( &mut self, method: &str, request: &T, ) -> Result<R, SteamError>
where T: Message, R: Message + Default,

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.

Source

pub async fn send_request_and_wait<T, R>( &mut self, emsg: EMsg, request: &T, ) -> Result<R, SteamError>
where T: Message, R: Message + Default,

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.

Source

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
                }
            }
            _ => {}
        }
    }
}
Source

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.

Source

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 SteamID
  • language - The language for localization (e.g., “english”)
Source

pub fn get_app_name(&self, app_id: u32) -> Option<String>

Get an app’s name from cache.

Source

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.

Source

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.

Source

pub fn csgo(&mut self) -> CSGOClient<'_>

Get the CS:GO service.

Source§

impl SteamClient

Source

pub fn into_stream(&mut self) -> SteamEventStream<'_>

Source§

impl SteamClient

Source

pub async fn request_validation_email(&mut self) -> Result<(), SteamError>

Request a validation email be sent to the account’s email address.

§Example
client.request_validation_email().await?;
tracing::info!("Validation email sent!");
Source

pub async fn get_steam_guard_details( &mut self, ) -> Result<SteamGuardDetails, SteamError>

Get Steam Guard status and details.

§Returns

Returns Steam Guard status including whether mobile authenticator is enabled.

§Note

This requires the unified message infrastructure.

Source

pub async fn get_privacy_settings( &mut self, ) -> Result<PrivacySettings, SteamError>

Get the account’s profile privacy settings.

§Returns

Returns the privacy settings for various profile sections.

§Note

The request is sent via unified messages and awaited asynchronously.

Source

pub fn get_account_limitations(&self) -> Result<AccountLimitations, SteamError>

Get account limitations.

§Returns

Returns account limitations like community ban status, etc.

Source

pub fn get_vac_bans(&self) -> Result<VacBans, SteamError>

Get VAC ban status.

§Returns

Returns VAC ban status.

Source

pub async fn get_credential_change_times( &mut self, ) -> Result<CredentialChangeTimes, SteamError>

Get credential change times (password, email changes).

§Returns

Returns timestamps for when credentials were last changed.

§Note

This requires the unified message infrastructure.

Source

pub async fn get_auth_secret(&mut self) -> Result<(i32, Vec<u8>), SteamError>

Get account authentication secret.

§Returns

Returns the secret ID and secret key.

Source§

impl SteamClient

Source

pub async fn create_encrypted_app_ticket( &mut self, appid: u32, user_data: Option<&[u8]>, ) -> Result<Vec<u8>, SteamError>

Request an encrypted app ticket for a particular app.

The app must be set up on the Steam backend for encrypted app tickets.

§Arguments
  • appid - The Steam AppID of the app you want a ticket for
  • user_data - Optional user data if the app expects it
§Returns

The encrypted app ticket as raw bytes.

Source

pub async fn get_app_ownership_ticket( &mut self, appid: u32, ) -> Result<Vec<u8>, SteamError>

Request an app ownership ticket for a particular app.

§Arguments
  • appid - The Steam AppID of the app you want a ticket for
§Returns

The ownership ticket as raw bytes.

Source

pub async fn create_auth_session_ticket( &mut self, appid: u32, ) -> Result<AuthSessionTicket, SteamError>

Create an auth session ticket for game server authentication.

This ticket can be sent to a game server which will validate it with Steam to verify your identity and ownership.

§Arguments
  • appid - The Steam AppID of the game
§Returns

An AuthSessionTicket that can be used for authentication.

Source

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
Source

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 ID
  • tickets - Tickets to activate
Source

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 ID
  • steamids - SteamIDs of users to end sessions for
Source§

impl SteamClient

Source

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.

Source

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
Source

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 tokens
  • packages - Package info requests with optional tokens
Source

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
Source

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 for
  • package_ids - The package IDs to get tokens for
Source

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
Source

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
Source

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
Source

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.

Source

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)
Source

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
Source

pub async fn redeem_key(&mut self, key: String) -> Result<(), SteamError>

Redeem a product code on this account.

§Arguments
  • key - The product code to redeem
Source

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
Source

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.
Source

pub async fn get_legacy_game_key( &mut self, app_id: u32, ) -> Result<(), SteamError>

Get a legacy CD key for a game.

§Arguments
  • app_id - The app ID to get the key for
Source

pub fn get_owned_packages(&self) -> Vec<u32>

Get a list of package IDs owned by the user.

This filters out expired licenses.

Source

pub fn owns_package(&self, package_id: u32) -> bool

Check if the user owns a specific package.

Source§

impl SteamClient

Source

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
Source

pub async fn get_depot_decryption_key( &mut self, appid: u32, depotid: u32, ) -> Result<Vec<u8>, SteamError>

Request the decryption key for a particular depot.

§Arguments
  • appid - The app ID
  • depotid - The depot ID
§Returns

The depot decryption key (32 bytes).

Source

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 ID
  • password - The beta password
Source

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 ID
  • depotid - The depot ID
  • manifest_id - The manifest ID
  • branch_name - The branch name (default: “public”)
  • branch_password - Optional branch password
Source

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 ID
  • depotid - The depot ID
  • hostname - The hostname of the CDN server
Source

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 ID
  • depotid - The depot ID
  • manifest_id - The manifest ID
  • branch_name - The branch name (default: “public”)
  • branch_password - Optional branch password
  • server - Content server to download from
  • depot_key - Depot decryption key
Source

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:

  1. Decrypt using the depot key (AES-256-ECB, first 16 bytes are IV)
  2. Decompress (LZMA or ZIP depending on format)
  3. Verify CRC32 matches the chunk’s crc field
§Arguments
  • appid - The app ID (for CDN authentication)
  • depotid - The depot ID
  • chunk - The chunk to download
  • server - Content server to download from
  • _depot_key - Depot decryption key (not used yet, for future decryption)
Source§

impl SteamClient

Source

pub async fn send_friend_message( &mut self, friend: SteamID, message: &str, ) -> Result<SendMessageResult, SteamError>

Send a chat message to a friend.

§Arguments
  • friend - The friend’s SteamID
  • message - The message to send
§Example
client.send_friend_message(friend_id, "Hello!").await?;
Source

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.

Source

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 SteamID
  • message - The message to send
  • entry_type - The chat entry type
  • contains_bbcode - Whether the message contains BBCode
Source

pub async fn send_friend_typing( &mut self, friend: SteamID, ) -> Result<(), SteamError>

Send a typing indicator to a friend.

§Arguments
  • friend - The friend’s SteamID
Source

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.

Source

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 SteamID
  • timestamp - Unix timestamp of the newest message to acknowledge
Source

pub async fn get_chat_history( &mut self, friend: SteamID, start_time: u32, count: u32, ) -> Result<Vec<HistoryMessage>, SteamError>

Get chat history with a friend.

§Arguments
  • friend - The friend’s SteamID
  • start_time - Unix timestamp to get messages from (0 to get most recent)
  • count - Maximum number of messages to retrieve
§Returns

A list of messages in the conversation.

Source

pub async fn get_recent_chat_history( &mut self, friend: SteamID, ) -> Result<Vec<HistoryMessage>, SteamError>

Get the chat history for the most recent messages with a friend.

§Arguments
  • friend - The friend’s SteamID
§Returns

A list of recent messages in the conversation (up to 20).

Source

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

Source

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
Source

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 ID
  • name - Name for the saved group
Source

pub async fn get_chat_room_groups( &mut self, ) -> Result<HashMap<String, ChatRoomGroup>, SteamError>

Get a list of chat room groups you’re in.

Source

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

Get details from a chat group invite link.

§Arguments
  • link_url - The invite link URL (e.g., https://s.team/chat/XXXXX)
Source

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 join
  • invite_code - Optional invite code if joining via invite
Source

pub async fn leave_chat_room_group( &mut self, group_id: SteamID, ) -> Result<(), SteamError>

Leave a chat room group.

§Arguments
  • group_id - The group ID to leave

Create an invite link for a chat room group.

§Arguments
  • group_id - The group ID
  • seconds_valid - Duration in seconds the link is valid (default 3600)
  • voice_chat_id - Optional voice chat ID to link directly to

Get all active invite links for a chat group.

§Arguments
  • group_id - The group ID

Revoke and delete an active invite link.

§Arguments
  • group_id - The group ID
  • invite_code - The invite code to delete
Source

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 ID
  • chat_id - The chat room ID within the group
  • message - The message to send
Source

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 ID
  • name - Name of the new channel
  • allow_voice - Whether to allow voice chat
Source

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 ID
  • chat_id - The chat room ID
  • name - The new name
Source

pub async fn delete_chat_room( &mut self, group_id: SteamID, chat_id: u64, ) -> Result<(), SteamError>

Delete a chat room from a group.

§Arguments
  • group_id - The group ID
  • chat_id - The chat room ID
Source

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 ID
  • chat_id - The chat room ID
  • last_time - Get messages before this time (0 for most recent)
  • last_ordinal - Get messages before this ordinal
  • max_count - Maximum messages to return
Source

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 ID
  • chat_id - The chat room ID
  • timestamp - The timestamp of the newest message acknowledged
Source

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 ID
  • chat_id - The chat room ID
  • messages - List of (server_timestamp, ordinal) tuples to delete
Source

pub async fn get_clan_chat_group_info( &mut self, clan_id: SteamID, ) -> Result<ChatRoomGroup, SteamError>

Get the chat room group info for a clan (Steam group).

§Arguments
  • clan_id - The clan’s SteamID
Source

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 ID
  • steamid - The user to kick
  • expiry - When the kick expires (Unix timestamp, None for permanent)
Source

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 ID
  • steamid - The user to ban
  • expiry - When the ban expires (Unix timestamp, None for permanent)
Source

pub async fn unban_chat_room_member( &mut self, group_id: SteamID, steamid: SteamID, ) -> Result<(), SteamError>

Unban a user from a chat room group.

§Arguments
  • group_id - The group ID
  • steamid - The user to unban
Source

pub async fn get_group_ban_list( &mut self, group_id: SteamID, ) -> Result<Vec<ChatRoomBan>, SteamError>

Get the ban list for a chat room group.

§Arguments
  • group_id - The group ID
Source

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 ID
  • steamid - The user SteamID
  • role_id - The role ID
  • role_state - True to add role, false to remove
Source

pub async fn invite_to_chat_room_group( &mut self, group_id: SteamID, steamid: SteamID, ) -> Result<(), SteamError>

Invite a user to a chat room group.

§Arguments
  • group_id - The group ID
  • steamid - The user to invite
Source§

impl SteamClient

Source

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 to
  • classes - 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);
}
Source

pub async fn get_trade_url(&mut self) -> Result<TradeUrl, SteamError>

Get your account’s trade URL.

The trade URL can be shared with others to initiate trade offers.

§Example
let trade_url = client.get_trade_url().await?;
tracing::info!("Trade URL: {}", trade_url.url);
tracing::info!("Token: {}", trade_url.token);
Source

pub async fn change_trade_url(&mut self) -> Result<TradeUrl, SteamError>

Generate a new trade URL for your account.

This invalidates the old trade URL and creates a new one.

§Example
let new_url = client.change_trade_url().await?;
tracing::info!("New trade URL: {}", new_url.url);
Source

pub async fn get_emoticon_list( &mut self, ) -> Result<HashMap<String, Emoticon>, SteamError>

Get the list of emoticons your account can use.

§Example
let emoticons = client.get_emoticon_list().await?;
for (name, emoticon) in emoticons {
    tracing::info!(":{}: - used {} times", name, emoticon.use_count);
}
Source

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());
Source

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 up
  • language - 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());
}
Source

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

Source

pub async fn add_authorized_borrowers( &mut self, borrowers: Vec<SteamID>, ) -> Result<(), SteamError>

Add new borrowers to your family sharing.

§Arguments
  • borrowers - SteamIDs of users to authorize as borrowers
Source

pub async fn remove_authorized_borrowers( &mut self, borrowers: Vec<SteamID>, ) -> Result<(), SteamError>

Remove borrowers from your family sharing.

§Arguments
  • borrowers - SteamIDs of borrowers to remove
Source

pub async fn get_authorized_borrowers( &mut self, include_canceled: bool, include_pending: bool, ) -> Result<Vec<AuthorizedBorrower>, SteamError>

Get a list of Steam accounts authorized to borrow your library.

§Arguments
  • include_canceled - Include canceled authorizations
  • include_pending - Include pending authorizations
Source

pub async fn get_authorized_sharing_devices( &mut self, include_canceled: bool, ) -> Result<Vec<AuthorizedDevice>, SteamError>

Get a list of devices you have authorized for sharing.

§Arguments
  • include_canceled - Include canceled authorizations
Source

pub async fn authorize_local_sharing_device( &mut self, device_name: &str, ) -> Result<u64, SteamError>

Authorize the local device for library sharing.

§Arguments
  • device_name - Name for this device
§Returns

The device token for the newly authorized device.

Source

pub async fn deauthorize_sharing_device( &mut self, device_token: u64, ) -> Result<(), SteamError>

Deauthorize a sharing device.

§Arguments
  • device_token - The device token to deauthorize
Source

pub async fn use_sharing_authorization( &mut self, owner_steam_id: SteamID, device_token: u64, ) -> Result<(), SteamError>

Use local device authorizations to allow usage of shared licenses.

§Arguments
  • owner_steam_id - The SteamID of the library owner
  • device_token - The device token authorized by the owner
Source

pub async fn deactivate_sharing_authorization( &mut self, ) -> Result<(), SteamError>

Deactivate family sharing authorizations.

Source§

impl SteamClient

Source

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.

Source

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.

Source

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

Source

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 state
  • name - Optional new profile name
Source

pub async fn add_friend( &mut self, steam_id: SteamID, ) -> Result<AddFriendResult, SteamError>

Add a friend (or accept a friend invitation).

§Arguments
  • steam_id - The SteamID of the user to add
Source

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
Source

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
Source

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 for
  • force_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?;
Source

pub async fn block_user(&mut self, steam_id: SteamID) -> Result<(), SteamError>

Block a user.

§Arguments
  • steam_id - The SteamID of the user to block
Source

pub async fn unblock_user( &mut self, steam_id: SteamID, ) -> Result<(), SteamError>

Unblock a user.

§Arguments
  • steam_id - The SteamID of the user to unblock
Source

pub async fn create_friends_group( &mut self, name: &str, ) -> Result<u32, SteamError>

Create a friends group (tag).

§Arguments
  • name - The name for the new group
§Returns

The group ID of the newly created group.

Source

pub async fn delete_friends_group( &mut self, group_id: u32, ) -> Result<(), SteamError>

Delete a friends group (tag).

§Arguments
  • group_id - The ID of the group to delete
Source

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 rename
  • name - The new name for the group
Source

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 group
  • steam_id - The SteamID of the friend to add
Source

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 group
  • steam_id - The SteamID of the friend to remove
Source

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 friend
  • nickname - The nickname to set (empty string to remove)
Source

pub async fn get_nicknames( &mut self, ) -> Result<HashMap<SteamID, String>, SteamError>

Get nicknames for all friends.

§Returns

A map of SteamID to nickname. Get nicknames for all friends.

§Returns

A map of SteamID to nickname. Get nicknames for all friends.

§Returns

A map of SteamID to nickname.

Source

pub async fn get_persona_name_history( &mut self, steam_ids: Vec<SteamID>, ) -> Result<HashMap<SteamID, Vec<PersonaNameHistory>>, SteamError>

Get persona name history for one or more users.

§Arguments
  • steam_ids - The SteamIDs to get name history for
§Returns

A map of SteamID to list of historical names (with timestamps).

Source

pub async fn get_steam_levels( &mut self, steam_ids: Vec<SteamID>, ) -> Result<HashMap<SteamID, u32>, SteamError>

Get Steam levels for multiple users.

§Arguments
  • steam_ids - The SteamIDs to get levels for
§Returns

A map of SteamID to Steam level.

Source

pub async fn get_game_badge_level( &mut self, app_id: u32, ) -> Result<(u32, i32, i32), SteamError>

Get the level of your game badge (and also your Steam level).

§Arguments
  • app_id - AppID of game in question
§Returns

A tuple containing (steam_level, regular_badge_level, foil_badge_level).

Source

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 invite
  • group_id - The SteamID of the group
Source

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 group
  • accept - True to join, false to decline
Source

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 invite
  • connect_string - The connection string for the game

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);

List all quick invite links for this account.

§Returns

A list of all active invite links.

Revoke a quick invite link.

§Arguments
  • link - The invite link URL or just the token

Get the SteamID of the owner of an invite link.

This is a synchronous operation that parses the link locally.

§Arguments
  • link - The invite link URL
§Returns

The SteamID of the link owner.

Check if a quick invite link is valid.

§Arguments
  • link - The invite link URL
§Returns

Validity information including the owner’s SteamID.

Redeem a quick invite link (add the link owner as a friend).

§Arguments
  • link - The invite link URL
Source§

impl SteamClient

Source

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

Source

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
Source

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 string
  • limit - Maximum number of servers to return (max ~20,000)
Source

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”)
Source

pub async fn get_server_ips_by_steam_id( &mut self, steamids: Vec<SteamID>, ) -> Result<HashMap<SteamID, String>, SteamError>

Get the associated IPs for given server SteamIDs.

§Arguments
  • steamids - List of server SteamIDs
Source§

impl SteamClient

Source

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 ID
  • payload - The message payload bytes
§Example
// Send a CS:GO GC message
client.send_to_gc(730, 4006, &payload).await?;
Source

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 to
  • msg_type - The GC-specific message type ID
  • payload - The message payload bytes
  • header - The protobuf header
Source

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.

Source

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

Source

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 inventory
  • cookies - 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!");
}
Source

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 inventory
  • cookies - 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

Source

pub async fn mark_notifications_read( &mut self, notification_ids: Vec<String>, ) -> Result<(), SteamError>

Mark specific notifications as read by their IDs.

§Arguments
  • notification_ids - The IDs of notifications to mark as read
§Example
client.mark_notifications_read(vec!["123".to_string(), "456".to_string()]).await?;
Source

pub async fn mark_all_notifications_read(&mut self) -> Result<(), SteamError>

Mark all notifications as read.

§Example
client.mark_all_notifications_read().await?;
Source

pub async fn request_notifications(&mut self) -> Result<(), SteamError>

Request notification counts from Steam.

This requests item announcements, comment notifications, and offline messages. The responses will arrive via [poll_event] as notification events.

§Example
client.request_notifications().await?;
// Handle NewItems, NewComments events from poll_event
Source§

impl SteamClient

Source

pub async fn get_published_file_details( &mut self, ids: Vec<u64>, ) -> Result<HashMap<u64, PublishedFileDetails>, SteamError>

Get details for Workshop/UGC files.

§Arguments
  • ids - List of published file IDs to get details for
§Returns

A map of file ID to file details.

Source

pub async fn get_published_file_detail( &mut self, id: u64, ) -> Result<Option<PublishedFileDetails>, SteamError>

Get details for a single Workshop/UGC file.

§Arguments
  • id - Published file ID to get details for
Source§

impl SteamClient

Source

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 for
  • data - 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?;
Source

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 for
  • steam_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 events
Source

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 for
  • language - The language to get localizations for (e.g., “english”)
Source

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

Source

pub async fn get_store_tag_names( &mut self, language: &str, tag_ids: &[u32], ) -> Result<Vec<StoreTag>, SteamError>

Get localized names for store tags.

§Arguments
  • language - The language to get names for (e.g., “english”).
  • tag_ids - The tag IDs to request.
§Returns

Returns a list of store tags with localized names.

Source§

impl SteamClient

Source

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
Source

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
Source

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 event
  • accept - Whether to accept or decline the trade
Source§

impl SteamClient

Source

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_factor
Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more