use spotify_rs::ClientCredsClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenvy::from_path("spotify-rs/examples/.env")?;
let client_id = dotenvy::var("CLIENT_ID")?;
let client_secret = dotenvy::var("CLIENT_SECRET")?;
let spotify = ClientCredsClient::authenticate(client_id, client_secret).await?;
let album = spotify_rs::album("78bpIziExqiI9qztvNFlQu")
.market("GB")
.get(&spotify)
.await?;
let artist_names: Vec<String> = album.artists.into_iter().map(|a| a.name).collect();
println!(
"The name of the album is {}, by {}",
album.name,
artist_names.join(", ")
);
Ok(())
}