rspotify 0.10.0

Spotify API wrapper
Documentation
extern crate rspotify;

use rspotify::client::Spotify;
use rspotify::oauth2::{SpotifyClientCredentials, SpotifyOAuth};
use rspotify::util::get_token_without_cache;

#[tokio::main]
async fn main() {
    // Set client_id and client_secret in .env file or
    // export CLIENT_ID="your client_id"
    // export CLIENT_SECRET="secret"
    // export REDIRECT_URI=your-direct-uri

    // Or set client_id, client_secret,redirect_uri explictly
    // let oauth = SpotifyOAuth::default()
    //     .client_id("this-is-my-client-id")
    //     .client_secret("this-is-my-client-secret")
    //     .redirect_uri("http://localhost:8888/callback")
    //     .build();

    let mut oauth = SpotifyOAuth::default().scope("user-follow-read").build();
    match get_token_without_cache(&mut oauth).await {
        Some(token_info) => {
            let client_credential = SpotifyClientCredentials::default()
                .token_info(token_info.to_owned())
                .build();
            // Or set client_id and client_secret explictly
            // let client_credential = SpotifyClientCredentials::default()
            //     .client_id("this-is-my-client-id")
            //     .client_secret("this-is-my-client-secret")
            //     .build();
            let spotify = Spotify::default()
                .client_credentials_manager(client_credential)
                .build();
            let mut artist_ids = vec![];
            let artist_id1 = String::from("74ASZWbe4lXaubB36ztrGX");
            let artist_id2 = String::from("08td7MxkoHQkXnWAYD8d6Q");
            artist_ids.push(artist_id1);
            artist_ids.push(artist_id2);
            let result = spotify.user_artist_check_follow(&artist_ids).await;
            println!("result:{:?}", result);
            // refresh token without cache
            match oauth
                .refresh_access_token_without_cache(&token_info.refresh_token.unwrap())
                .await
            {
                Some(refresh_token) => {
                    println!("refresh token: {:?}", refresh_token);
                }
                None => println!("refresh token failed"),
            }
        }
        None => println!("auth failed"),
    };
}