3 releases (breaking)
0.6.0 | Feb 7, 2024 |
---|---|
0.5.0 | Jun 10, 2022 |
0.4.0 | Nov 12, 2021 |
#8 in #valve
26 downloads per month
Used in steam-trading
15MB
3.5K
SLoC
Tappet
Pure Rust bindings to the Steam Web API and XPAW Steam API, where the latter contains some undocumented albeit useful endpoints of the Steam Web API.
This library was heavily inspired by Rust Github API Wrapper.
Internally, Steam-Web-API uses a reqwest client for simplicity's sake, but this may change in the future.
Missing IDE Auto Completion for endpoints
Since this library makes heavy use of procedural macros to generate the strongly typed bindings, you may not get auto completion for endpoints if your IDE doesn't support proc-macro completion.
Lacking features
- Partner API not available;
- Not so popular interfaces not available;
- Responses for all endpoints;
Getting Started
Add the following to your Cargo.toml
[dependencies]
tappet = "^0.4"
Or if you want the blocking client:
tappet = { version = "^0.4", default-features = false, features = ["blocking"] }
Then in your lib.rs
or main.rs
file add:
use tappet::{Executor, SteamAPI};
Example Usage
use tappet::{Executor, SteamAPI};
// if using blocking client
// use tappet::blocking::{Executor, SteamAPI};
#[tokio::main]
async fn main() -> Result<()> {
let client = SteamAPI::new(std::env!("STEAM_API"));
// You choose between the already structured response
let response: tappet::response_types::GetPlayerBansBase = client
.get()
.ISteamUser()
.GetPlayerBans(vec!["76561197984835396".to_string()])
.execute_with_response()
.await?;
// or the raw response from reqwest
let response: reqwest::Response = client
.get()
.ISteamUser()
.GetPlayerSummaries(vec!["76561197984835396".to_string()])
.execute()
.await?;
}
Reuse with different bots
// the bot you want to recover pending trade offers
let bot_api_key: &str = "..."
let response: GetTradeOffersResponse = api_client
.get()
.IEconService()
.GetTradeOffers(true, false, u32::MAX, None, None, None, None)
.inject_custom_key(bot_api_key)
.execute_with_response()
.await?;
Not all endpoints have the structured endpoint response. You can contribute!
Dependencies
~35–51MB
~803K SLoC