Replies: 3 comments 3 replies
-
You need to convert async fn create_playlist(spotify: &AuthCodeSpotify, track_id_list: Vec<TrackId>) {
let id = UserId::from_id(USER_ID).expect("Error creating UserId");
let new_playlist = spotify
.user_playlist_create(&id, "test_list", Some(false), None, Some("test list"))
.await
.expect("error creating playlist");
let playable_id_list = track_id_list
.iter()
.map(|track| track as &dyn PlayableId);
spotify
.playlist_add_items(&new_playlist.id, playable_id_list, None)
.await
.expect("error adding items");
} Note that |
Beta Was this translation helpful? Give feedback.
-
I have the basics of the program working now. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Good evening. It took me a little bit to figure out what I was looking at
in this email. Looks like coincidentally to my question you realized one of
the links was not working properly or incorrect and you put the fix in or
pull request for it I guess I should say. So then I read everything
carefully again and I realized I was assuming something false regarding my
program and the specific API for the search function. I see I can structure
my query to include the additional filters one of them being year. For some
reason in my head I was confusing the return type parameter of the search
method with the string thinking I could only include certain things in the
request string if that makes any sense at all. So I'm going to take a look
at the link and try and put myself together a search query with the year.
Thank you for the time and the effort and the response!
Ron Brilhante
…On July 28, 2022 5:22:49 AM Mario ***@***.***> wrote:
It seems like our link to the reference documentation was broken. Here's
the new one:
https://developer.spotify.com/documentation/web-api/reference/#/operations/search.
It seems like the year parameter would work?
I've fixed this in #353.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I'm having trouble figuring out what exactly I need to pass to this method. I have looked at the docs and examples and the source code. I think it wants a trait object but I'm unsure how to accomplish this. I have a Vec of TrackId's I was trying to pass in, but it's not happy, lol.
the error:
type mismatch resolving
<&Vec<TrackId> as IntoIterator>::Item == &dyn PlayableId
E0271expected trait object
dyn PlayableId
, found structTrackId
Note: expected reference
&dyn PlayableId
found reference&TrackId
Note: required by a bound in
playlist_add_items
this is the code causing the issue:
async fn create_playlist(spotify: &AuthCodeSpotify, track_id_list: Vec) {
let id = UserId::from_id(USER_ID).expect("Error creating UserId");
let new_playlist = spotify
.user_playlist_create(&id, "test_list", Some(false), None, Some("test list"))
.await
.expect("error creating playlist");
spotify
.playlist_add_items(&new_playlist.id, &track_id_list, None)
.await
.expect("error adding items");
}
Any suggestions would be welcome. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions