@@ -274,6 +274,31 @@ var SpotifyWebApi = (function() {
274
274
return _checkParamsAndPerformRequest ( requestData , callback ) ;
275
275
} ;
276
276
277
+ /**
278
+ * Add the current user as a follower of one playlist.
279
+ * See [Follow a Playlist](https://developer.spotify.com/web-api/follow-playlist/) on
280
+ * the Spotify Developer site for more information about the endpoint.
281
+ * @param {string } ownerId The id of the playlist owner. If you know the Spotify URI of
282
+ * the playlist, it is easy to find the owner's user id
283
+ * (e.g. spotify:user:<here_is_the_owner_id>:playlist:xxxx)
284
+ * @param {string } playlistId The id of the playlist. If you know the Spotify URI it is easy
285
+ * to find the playlist id (e.g. spotify:user:xxxx:playlist:<here_is_the_playlist_id>)
286
+ * @param {Object } options A JSON object with options that can be passed. For instance,
287
+ * whether you want the playlist to be followed privately ({public: false})
288
+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
289
+ * one is the error object (null if no error), and the second is an empty value if the request succeeded.
290
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
291
+ */
292
+ Constr . prototype . followPlaylist = function ( ownerId , playlistId , options , callback ) {
293
+ var requestData = {
294
+ url : _baseUri + '/users/' + ownerId + '/playlists/' + playlistId + '/followers' ,
295
+ type : 'PUT' ,
296
+ postData : { }
297
+ } ;
298
+
299
+ return _checkParamsAndPerformRequest ( requestData , options , callback ) ;
300
+ } ;
301
+
277
302
/**
278
303
* Removes the current user as a follower of one or more other Spotify users.
279
304
* See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on
@@ -318,6 +343,27 @@ var SpotifyWebApi = (function() {
318
343
return _checkParamsAndPerformRequest ( requestData , callback ) ;
319
344
} ;
320
345
346
+ /**
347
+ * Remove the current user as a follower of one playlist.
348
+ * See [Unfollow a Playlist](https://developer.spotify.com/web-api/unfollow-playlist/) on
349
+ * the Spotify Developer site for more information about the endpoint.
350
+ * @param {string } ownerId The id of the playlist owner. If you know the Spotify URI of
351
+ * the playlist, it is easy to find the owner's user id
352
+ * (e.g. spotify:user:<here_is_the_owner_id>:playlist:xxxx)
353
+ * @param {string } playlistId The id of the playlist. If you know the Spotify URI it is easy
354
+ * to find the playlist id (e.g. spotify:user:xxxx:playlist:<here_is_the_playlist_id>)
355
+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
356
+ * one is the error object (null if no error), and the second is an empty value if the request succeeded.
357
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
358
+ */
359
+ Constr . prototype . unfollowPlaylist = function ( ownerId , playlistId , callback ) {
360
+ var requestData = {
361
+ url : _baseUri + '/users/' + ownerId + '/playlists/' + playlistId + '/followers' ,
362
+ type : 'DELETE'
363
+ } ;
364
+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
365
+ } ;
366
+
321
367
/**
322
368
* Checks to see if the current user is following one or more other Spotify users.
323
369
* See [Check if Current User Follows](https://developer.spotify.com/web-api/check-current-user-follows/) on
0 commit comments