
spotify-rs
spotify-rs is a Rust wrapper for the Spotify API.
It has full API coverage and supports all the authorisation flows (except for the implicit grant flow).
Usage example:
use spotify_rs::{AuthCodeClient, AuthCodeFlow, RedirectUrl};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let redirect_url = RedirectUrl::new("redirect_url".to_owned())?;
let auto_refresh = true;
let scopes = vec!["user-library-read", "playlist-read-private"];
let auth_code_flow = AuthCodeFlow::new("client_id", "client_secret", scopes);
let (client, url) = AuthCodeClient::new(auth_code_flow, redirect_url, auto_refresh);
let mut spotify = client.authenticate("auth_code", "csrf_token").await?;
let album = spotify.album("album_id").get().await?;
let album_gb = spotify.album("album_id").market("GB").get().await?;
let user_playlists = spotify.current_user_playlists().limit(5).get().await?;
Ok(())
}
License
spotify-rs is dual-licensed under Apache 2.0 and MIT terms.