Skip to content

Commit

Permalink
Merge pull request #409 from ramsayleung/ramsay_fix_playlist_add_item
Browse files Browse the repository at this point in the history
ramsayleung authored May 22, 2023
2 parents 7b00487 + 7bc84d1 commit d666850
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 0.12(unreleased)
## 0.12 (unreleased )
**New features**
- ([#390](https://github.com/ramsayleung/rspotify/pull/390)) The `scopes!` macro supports to split the scope by whitespace.

**Breaking changes**
- ([#409](https://github.com/ramsayleung/rspotify/pull/409)) Change type of `position` parameter in `playlist_add_items` endpoint from `Opinion<Duration>` to `Opinion<u32>`

## 0.11.7 (2023.04.26)

- ([#399](https://github.com/ramsayleung/rspotify/pull/399)) Add a new variant `Collectionyourepisodes` for `Type` enum.
6 changes: 3 additions & 3 deletions src/clients/oauth.rs
Original file line number Diff line number Diff line change
@@ -294,19 +294,19 @@ pub trait OAuthClient: BaseClient {
/// Parameters:
/// - playlist_id - the id of the playlist
/// - track_ids - a list of track URIs, URLs or IDs
/// - position - the position to add the tracks
/// - position - the position to add the items, a zero-based index
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist)
async fn playlist_add_items<'a>(
&self,
playlist_id: PlaylistId<'_>,
items: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a,
position: Option<chrono::Duration>,
position: Option<u32>,
) -> ClientResult<PlaylistResult> {
let uris = items.into_iter().map(|id| id.uri()).collect::<Vec<_>>();
let params = JsonBuilder::new()
.required("uris", uris)
.optional("position", position.map(|p| p.num_milliseconds()))
.optional("position", position)
.build();

let url = format!("playlists/{}/tracks", playlist_id.id());

0 comments on commit d666850

Please sign in to comment.