@@ -59,11 +59,11 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
5959 *
6060 * @throws BadRequestException if any invalid track ids is provided or the playlist is not found
6161 */
62- fun addTracksToPlaylist (playlistId : String , vararg ids : String , position : Int? = null, userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Unit > {
62+ fun addTracksToPlaylist (playlistId : String , vararg ids : String , position : Int? = null): SpotifyRestAction <Unit > {
6363 val json = JSONObject ().put(" uris" , ids.map { " spotify:track:${it.encode()} " })
6464 if (position != null ) json.put(" position" , position)
6565 return toAction(Supplier {
66- post(EndpointBuilder (" /users/ ${userId.encode()} / playlists/${playlistId.encode()} /tracks" ).toString(), json.toString())
66+ post(EndpointBuilder (" /playlists/${playlistId.encode()} /tracks" ).toString(), json.toString())
6767 Unit
6868 })
6969 }
@@ -81,15 +81,15 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
8181 * @throws BadRequestException if the playlist is not found or parameters exceed the max length
8282 */
8383 fun changePlaylistDescription (playlistId : String , name : String? = null, public : Boolean? = null, collaborative : Boolean? = null,
84- description : String? = null, userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Unit > {
84+ description : String? = null): SpotifyRestAction <Unit > {
8585 val json = JSONObject ()
8686 if (name != null ) json.put(" name" , name)
8787 if (public != null ) json.put(" public" , public)
8888 if (collaborative != null ) json.put(" collaborative" , collaborative)
8989 if (description != null ) json.put(" description" , description)
9090 if (json.length() == 0 ) throw IllegalArgumentException (" At least one option must not be null" )
9191 return toAction(Supplier {
92- put(EndpointBuilder (" /users/ ${userId.encode()} / playlists/${playlistId.encode()} " ).toString(), json.toString())
92+ put(EndpointBuilder (" /playlists/${playlistId.encode()} " ).toString(), json.toString())
9393 Unit
9494 })
9595 }
@@ -133,9 +133,9 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
133133 * @param id playlist id
134134 * @param ownerId the owner of this playlist. Ignore if it's the authenticated user
135135 */
136- fun deletePlaylist (id : String , ownerId : String? = null ): SpotifyRestAction <Unit > {
136+ fun deletePlaylist (id : String ): SpotifyRestAction <Unit > {
137137 api as SpotifyClientAPI
138- return api.following.unfollowPlaylist(ownerId ? : api.userId, id)
138+ return api.following.unfollowPlaylist(id)
139139 }
140140
141141 /* *
@@ -157,14 +157,14 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
157157 * @throws BadRequestException if the playlist is not found or illegal filters are applied
158158 */
159159 fun reorderTracks (playlistId : String , reorderRangeStart : Int , reorderRangeLength : Int? = null, insertionPoint : Int ,
160- snapshotId : String? = null, userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Snapshot > {
160+ snapshotId : String? = null): SpotifyRestAction <Snapshot > {
161161 return toAction(Supplier {
162162 val json = JSONObject ()
163163 json.put(" range_start" , reorderRangeStart)
164164 json.put(" insert_before" , insertionPoint)
165165 if (reorderRangeLength != null ) json.put(" range_length" , reorderRangeLength)
166166 if (snapshotId != null ) json.put(" snapshot_id" , snapshotId)
167- put(EndpointBuilder (" /users/ ${userId.encode()} / playlists/${playlistId.encode()} /tracks" ).toString(), json.toString())
167+ put(EndpointBuilder (" /playlists/${playlistId.encode()} /tracks" ).toString(), json.toString())
168168 .toObject<Snapshot >(api)
169169 })
170170 }
@@ -179,11 +179,11 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
179179 *
180180 * @throws BadRequestException if playlist is not found or illegal tracks are provided
181181 */
182- fun setPlaylistTracks (playlistId : String , vararg trackIds : String , userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Unit > {
182+ fun setPlaylistTracks (playlistId : String , vararg trackIds : String ): SpotifyRestAction <Unit > {
183183 return toAction(Supplier {
184184 val json = JSONObject ()
185185 json.put(" uris" , trackIds.map { " spotify:track:${it.encode()} " })
186- put(EndpointBuilder (" /users/ ${userId.encode()} / playlists/${playlistId.encode()} /tracks" ).toString(),
186+ put(EndpointBuilder (" /playlists/${playlistId.encode()} /tracks" ).toString(),
187187 json.toString())
188188 Unit
189189 })
@@ -194,8 +194,8 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
194194 * @param userId The user’s Spotify user ID.
195195 * @param playlistId The Spotify ID for the playlist.
196196 */
197- fun removeAllPlaylistTracks (playlistId : String , userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Unit > {
198- return setPlaylistTracks(playlistId, userId = userId )
197+ fun removeAllPlaylistTracks (playlistId : String ): SpotifyRestAction <Unit > {
198+ return setPlaylistTracks(playlistId)
199199 }
200200
201201 /* *
@@ -216,7 +216,7 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
216216 */
217217 fun uploadPlaylistCover (playlistId : String , imagePath : String? = null,
218218 imageFile : File ? = null, image : BufferedImage ? = null, imageData : String? = null,
219- imageUrl : String? = null, userId : String = (api as SpotifyClientAPI ).userId ): SpotifyRestAction <Unit > {
219+ imageUrl : String? = null): SpotifyRestAction <Unit > {
220220 return toAction(Supplier {
221221 val data = imageData ? : when {
222222 image != null -> encode(image)
@@ -225,7 +225,7 @@ class ClientPlaylistAPI(api: SpotifyAPI) : PlaylistsAPI(api) {
225225 imagePath != null -> encode(ImageIO .read(URL (" file:///$imagePath " )))
226226 else -> throw IllegalArgumentException (" No cover image was specified" )
227227 }
228- put(EndpointBuilder (" /users/ ${userId.encode()} / playlists/${playlistId.encode()} /images" ).toString(),
228+ put(EndpointBuilder (" /playlists/${playlistId.encode()} /images" ).toString(),
229229 data, contentType = " image/jpeg" )
230230 Unit
231231 })
0 commit comments