#steam #api-bindings #api #api-key

steam-rs

Safe Rust bindings for the Steam Web API

11 unstable releases

new 0.5.0 Jan 28, 2025
0.4.4 Feb 17, 2024
0.4.0 Dec 12, 2023
0.3.1 Aug 6, 2023
0.0.0 Jul 26, 2023

#1129 in Web programming

Download history 3/week @ 2024-10-10 3/week @ 2024-10-17 6/week @ 2024-10-24 1/week @ 2024-10-31 4/week @ 2024-11-21 10/week @ 2024-11-28 7/week @ 2024-12-05 36/week @ 2024-12-12 11/week @ 2024-12-19 4/week @ 2024-12-26 2/week @ 2025-01-02 5/week @ 2025-01-09 4/week @ 2025-01-16 73/week @ 2025-01-23

84 downloads per month

MIT license

130KB
2.5K SLoC

steam-rs

Crate at crates.io Documentation at docs.rs MIT licensed CI

Provides safe and convenient Rust bindings for the Steam Web API.

[!IMPORTANT] As this project is still a work-in-progress, not all API endpoints are currently supported. Most unsupported endpoints require a Steamworks Publisher API key, something that none of the developers of this project currently have. For a list of all supported API interfaces and endpoints, please see ENDPOINTS.md.

[!NOTE] This project is in early stages of development, so bug reports, suggestions, and pull requests are highly appreciated!

Usage

use std::env;
use steam_rs::{Steam, SteamId};

#[tokio::main]
async fn main() {
    // Get the Steam API Key as an environment variable
    let steam_api_key = env::var("STEAM_API_KEY").expect("Missing an API key");

    // Initialize the Steam API client
    let steam = Steam::new(steam_api_key);

    // Request the recently played games of SteamID `76561197960434622`
    let steam_id = SteamId::new(76561197960434622);
    let recently_played_games = steam.get_recently_played_games(steam_id, None).await.unwrap();

    // Print the total count of the user's recently played games
    println!("{}", recently_played_games.total_count);
}

Acknowledgements

The following resources were used in the developement in this crate:

Special thanks to @marcohoovy for developing the custom macros and error types used in this project.

Dependencies

~4–11MB
~120K SLoC