forked from ramsayleung/rspotify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
albums.rs
27 lines (24 loc) · 1.04 KB
/
albums.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
extern crate rspotify;
use rspotify::client::Spotify;
use rspotify::oauth2::SpotifyClientCredentials;
#[tokio::main]
async fn main() {
// Set client_id and client_secret in .env file or
// export CLIENT_ID="your client_id"
// export CLIENT_SECRET="secret"
let client_credential = SpotifyClientCredentials::default().build();
// 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 birdy_uri1 = String::from("spotify:album:41MnTivkwTO3UUJ8DrqEJJ");
let birdy_uri2 = String::from("spotify:album:6JWc4iAiJ9FjyK0B59ABb4");
let birdy_uri3 = String::from("spotify:album:6UXCm6bOO4gFlDQZV5yL37");
let track_uris = vec![birdy_uri1, birdy_uri2, birdy_uri3];
let albums = spotify.albums(track_uris).await;
println!("{:?}", albums);
}