From 0f21709b26f8fba8b924e1bd8b3c9258d846e8a0 Mon Sep 17 00:00:00 2001 From: Ramsay Date: Sat, 13 May 2023 18:26:24 -0700 Subject: [PATCH 1/4] Change type of position parameter. --- CHANGELOG.md | 3 +++ src/clients/oauth.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c53274..77a790f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.12 (unreleased ) +- ([]()) Change type of `position` parameter in `playlist_add_items` endpoint from `Opinion` to `Opinion` + ## 0.11.7 (2023.04.26) - ([#399](https://github.com/ramsayleung/rspotify/pull/399)) Add a new variant `Collectionyourepisodes` for `Type` enum. diff --git a/src/clients/oauth.rs b/src/clients/oauth.rs index 80d74a4c..7cbce274 100644 --- a/src/clients/oauth.rs +++ b/src/clients/oauth.rs @@ -301,12 +301,12 @@ pub trait OAuthClient: BaseClient { &self, playlist_id: PlaylistId<'_>, items: impl IntoIterator> + Send + 'a, - position: Option, + position: Option, ) -> ClientResult { let uris = items.into_iter().map(|id| id.uri()).collect::>(); 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()); From 7d7edabafe7c7a22e11eb58d95573b7b6986cadb Mon Sep 17 00:00:00 2001 From: Ramsay Date: Sat, 13 May 2023 18:34:49 -0700 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a790f4..e386fa97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.12 (unreleased ) -- ([]()) Change type of `position` parameter in `playlist_add_items` endpoint from `Opinion` to `Opinion` +**Breaking changes** +- ([#409](https://github.com/ramsayleung/rspotify/pull/409)) Change type of `position` parameter in `playlist_add_items` endpoint from `Opinion` to `Opinion` ## 0.11.7 (2023.04.26) From 103dbefc018adfe85b7d86ddb9758944077b805b Mon Sep 17 00:00:00 2001 From: Ramsay Date: Sat, 13 May 2023 20:25:33 -0700 Subject: [PATCH 3/4] Update the comments. --- src/clients/oauth.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clients/oauth.rs b/src/clients/oauth.rs index 7cbce274..1ebae943 100644 --- a/src/clients/oauth.rs +++ b/src/clients/oauth.rs @@ -294,7 +294,7 @@ 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>( From 2789b511b9c848a1c913b661eeb5583e2be1b5d2 Mon Sep 17 00:00:00 2001 From: Ramsay Date: Sat, 13 May 2023 20:47:58 -0700 Subject: [PATCH 4/4] Fix cargo fmt error. --- src/clients/oauth.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clients/oauth.rs b/src/clients/oauth.rs index 1ebae943..065a3a70 100644 --- a/src/clients/oauth.rs +++ b/src/clients/oauth.rs @@ -294,7 +294,7 @@ 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 items, a zero-based index + /// - 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>(