listenbrainz-rs/examples/user_stats.rs

28 lines
860 B
Rust
Raw Permalink Normal View History

2021-01-19 22:45:43 +00:00
use listenbrainz::raw::Client;
2021-01-14 01:49:41 +00:00
fn main() {
let mut args = std::env::args().skip(1);
let subject = args.next().expect("No subject provided");
let user_name = args.next().expect("No username provided");
let client = Client::new();
2021-01-14 01:49:41 +00:00
match subject.as_str() {
"recordings" => {
let result = client.stats_user_recordings(&user_name, None, None, None);
println!("{:#?}", result);
}
"releases" => {
let result = client.stats_user_releases(&user_name, None, None, None);
println!("{:#?}", result);
}
"artists" => {
let result = client.stats_user_artists(&user_name, None, None, None);
println!("{:#?}", result);
}
_ => {
eprintln!(r"Subject must be one of recordings, releases, artists");
}
}
}