listenbrainz-rs/examples/user_stats.rs

28 lines
859 B
Rust
Raw Normal View History

2021-01-14 01:49:41 +00:00
use listenbrainz::Client;
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 mut client = Client::new();
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");
}
}
}