4 releases (2 breaking)
new 0.3.1 | Mar 25, 2024 |
---|---|
0.3.0 | Nov 15, 2023 |
0.2.0 | Aug 16, 2022 |
0.1.0 | Aug 8, 2022 |
#1610 in Web programming
28 downloads per month
17KB
255 lines
steamr 🦀
steamr is a simple Rust library to help you to interact with Valve's Steam API. It uses the reqwest crate under the hood.
Requirements
You need a valid API key to use this library. Visit https://steamcommunity.com/dev/apikey to obtain yours.
Example
use steamr::client::SteamClient;
use steamr::errors::SteamError;
use steamr::games::get_owned_games;
fn main() -> Result<(), SteamError> {
// Create a new client that will be used to communicate with Steam's API.
let api_key = String::from("your-api-key");
let steam_client = SteamClient::new(api_key);
// Get a list of all games from the user with the provided Steam ID (given that they are publicly visible)
let steam_id = "some-steam-id";
let steam_lib = get_owned_games(&steam_client, &steam_id)?;
// Print out the games that were played for more than an hour.
steam_lib.games.iter()
.filter(|g| g.playtime_forever > 60)
.for_each(|g| println!("{}", g.name));
Ok(())
}
Dependencies
~4–17MB
~235K SLoC