INNER CODE UNIT · Rust
new
aome510/spotify-player · spotify_player/src/client/mod.rs:166
pub async fn new() -> Result<Self> {
let configs = config::get_config();
let auth_config = AuthConfig::new(configs)?;
let mut api_client = new_api_client()?;
auth::prompt_for_user_token(&mut api_client, false)
.await
.context("authenticate Spotify Web API client")?;
Ok(Self {
spotify: Arc::new(spotify::Spotify::new()),
http: reqwest::Client::new(),
auth_config,
api_client,
#[cfg(feature = "streaming")]
stream_conn: Arc::new(Mutex::new(None)),
})