diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/playlists/main.rs (renamed from examples/access_token/main.rs) | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/access_token/main.rs b/examples/playlists/main.rs index d9b4d79..fed5b73 100644 --- a/examples/access_token/main.rs +++ b/examples/playlists/main.rs @@ -3,6 +3,7 @@ use std::error::Error; use anyhow::Context; use config::Config; use deez::auth::{request_access_token, AuthPromptHandler}; +use deez::client::DeezerClient; use serde::Deserialize; #[derive(Deserialize)] @@ -19,7 +20,7 @@ struct Settings async fn main() -> Result<(), Box<dyn Error + Send + Sync>> { let settings = Config::builder() - .add_source(config::File::with_name("examples/access_token/Settings")) + .add_source(config::File::with_name("examples/playlists/Settings")) .build() .with_context(|| "Failed to read settings")? .try_deserialize::<Settings>() @@ -48,5 +49,15 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> access_token.expires.as_secs() ); + let client = DeezerClient::new(access_token); + + let me = client.get_me().await?; + + println!("{:#?}", me); + + let playlists = client.get_user_playlists(me.id).await?; + + println!("Playlists: {:#?}", playlists); + Ok(()) } |