-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74b026b
commit c596ede
Showing
8 changed files
with
199 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
use rspotify::client::Spotify; | ||
use rspotify::oauth2::SpotifyClientCredentials; | ||
use rspotify::client::SpotifyBuilder; | ||
use rspotify::oauth2::ClientCredentialsBuilder; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
// Set client_id and client_secret in .env file or | ||
// export RSPOTIFY_CLIENT_ID="your client_id" | ||
// export RSPOTIFY_CLIENT_SECRET="secret" | ||
let client_credential = SpotifyClientCredentials::default().build(); | ||
let creds = ClientCredentialsBuilder::from_env().build().unwrap(); | ||
|
||
// 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 spotify = SpotifyBuilder::default() | ||
.credentials(creds) | ||
.build() | ||
.unwrap(); | ||
let birdy_uri = "spotify:album:0sNOF9WDwhWunNAHPD3Baj"; | ||
let albums = spotify.album(birdy_uri).await; | ||
println!("{:?}", albums); | ||
|
||
println!("Response: {:#?}", albums); | ||
} |
Oops, something went wrong.