INNER CODE UNIT · Rust
new_api_client
aome510/spotify-player · spotify_player/src/client/mod.rs:94
pub fn new_api_client() -> Result<WebApiClient> {
let configs = config::get_config();
let id = configs.app_config.get_client_id()?;
let ncspot_only_get_endpoints = configs.app_config.ncspot_only_get_endpoints.clone();
let mut scopes = auth::OAUTH_SCOPES
.iter()
.map(ToString::to_string)
.collect::<HashSet<_>>();
// `user-personalized` scope is not supported by the Web API client and only available to the official Spotify client
scopes.remove("user-personalized");
let build_config = |cache_file: &str| rspotify::Config {
token_cached: true,
cache_path: configs.cache_folder.join(cache_file),
..Default::default()
};
let build_oauth = |redirect_uri: String| rspotify::OAuth {