use dotenvy::dotenv;
use ferrispot::{client::SpotifyClientBuilder, model::id::Id, prelude::*};
#[tokio::main]
async fn main() {
dotenv().ok();
env_logger::init();
let spotify_client =
SpotifyClientBuilder::new(std::env::var("CLIENT_ID").expect("Spotify client ID not in environment"))
.client_secret(std::env::var("CLIENT_SECRET").expect("Spotify client secret not in environment"))
.build_async()
.await
.expect("failed to build Spotify client");
let one_track = spotify_client
.track(Id::from_bare("2PoYyfBkedDBPGAh0ZUoHW").unwrap())
.send_async()
.await
.unwrap();
println!(
"{} - {} ({})",
one_track.name(),
one_track.artists().first().unwrap().name(),
one_track.album().name()
);
spotify_client.refresh_access_token().await.unwrap();
}