add method to get vanity url by steamid

This commit is contained in:
Robin Appelman 2020-07-13 23:34:32 +02:00
commit 1ca978544a
2 changed files with 69 additions and 1 deletions

20
examples/get.rs Normal file
View file

@ -0,0 +1,20 @@
use std::env::args;
use steam_resolve_vanity::get_vanity_url;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = args();
let binary = args.next().unwrap(); // first argument is binary
if let Some(steam_id) = args.next() {
if let Some(vanity) = get_vanity_url(steam_id.parse()?).await? {
println!("{}", vanity);
} else {
println!("No vanity found for steamid");
}
} else {
eprintln!("usage {} <vanity>", binary);
}
Ok(())
}