@@ -59,7 +59,7 @@ var SpotifyWebApi = (function() {
5959 data = req . responseText ? JSON . parse ( req . responseText ) : '' ;
6060 } catch ( e ) { }
6161
62- if ( req . status === 200 || req . status === 201 ) {
62+ if ( req . status >= 200 && req . status < 300 ) {
6363 if ( resolve ) {
6464 resolve ( data ) ;
6565 }
@@ -230,6 +230,126 @@ var SpotifyWebApi = (function() {
230230 return _checkParamsAndPerformRequest ( requestData , options , callback ) ;
231231 } ;
232232
233+ /**
234+ * Adds the current user as a follower of one or more other Spotify users.
235+ * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on
236+ * the Spotify Developer site for more information about the endpoint.
237+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
238+ * one is the error object (null if no error), and the second is the value if the request succeeded.
239+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
240+ */
241+ Constr . prototype . followUsers = function ( userIds , callback ) {
242+ var requestData = {
243+ url : _baseUri + '/me/following/' ,
244+ type : 'PUT' ,
245+ params : {
246+ ids : userIds . join ( ',' ) ,
247+ type : 'user'
248+ }
249+ } ;
250+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
251+ } ;
252+
253+ /**
254+ * Adds the current user as a follower of one or more artists.
255+ * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on
256+ * the Spotify Developer site for more information about the endpoint.
257+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
258+ * one is the error object (null if no error), and the second is the value if the request succeeded.
259+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
260+ */
261+ Constr . prototype . followArtists = function ( artistIds , callback ) {
262+ var requestData = {
263+ url : _baseUri + '/me/following/' ,
264+ type : 'PUT' ,
265+ params : {
266+ ids : artistIds . join ( ',' ) ,
267+ type : 'artist'
268+ }
269+ } ;
270+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
271+ } ;
272+
273+ /**
274+ * Removes the current user as a follower of one or more other Spotify users.
275+ * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on
276+ * the Spotify Developer site for more information about the endpoint.
277+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
278+ * one is the error object (null if no error), and the second is the value if the request succeeded.
279+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
280+ */
281+ Constr . prototype . unfollowUsers = function ( userIds , callback ) {
282+ var requestData = {
283+ url : _baseUri + '/me/following/' ,
284+ type : 'DELETE' ,
285+ params : {
286+ ids : userIds . join ( ',' ) ,
287+ type : 'user'
288+ }
289+ } ;
290+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
291+ } ;
292+
293+ /**
294+ * Removes the current user as a follower of one or more artists.
295+ * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on
296+ * the Spotify Developer site for more information about the endpoint.
297+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
298+ * one is the error object (null if no error), and the second is the value if the request succeeded.
299+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
300+ */
301+ Constr . prototype . unfollowArtists = function ( artistIds , callback ) {
302+ var requestData = {
303+ url : _baseUri + '/me/following/' ,
304+ type : 'DELETE' ,
305+ params : {
306+ ids : artistIds . join ( ',' ) ,
307+ type : 'artist'
308+ }
309+ } ;
310+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
311+ } ;
312+
313+ /**
314+ * Checks to see if the current user is following one or more other Spotify users.
315+ * See [Check if Current User Follows](https://developer.spotify.com/web-api/check-current-user-follows/) on
316+ * the Spotify Developer site for more information about the endpoint.
317+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
318+ * one is the error object (null if no error), and the second is the value if the request succeeded.
319+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
320+ */
321+ Constr . prototype . isFollowingUsers = function ( userIds , callback ) {
322+ var requestData = {
323+ url : _baseUri + '/me/following/contains' ,
324+ type : 'GET' ,
325+ params : {
326+ ids : userIds . join ( ',' ) ,
327+ type : 'user'
328+ }
329+ } ;
330+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
331+ } ;
332+
333+ /**
334+ * Checks to see if the current user is following one or more artists.
335+ * See [Check if Current User Follows](https://developer.spotify.com/web-api/check-current-user-follows/) on
336+ * the Spotify Developer site for more information about the endpoint.
337+ * @param {function(Object, Object) } callback An optional callback that receives 2 parameters. The first
338+ * one is the error object (null if no error), and the second is the value if the request succeeded.
339+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
340+ */
341+ Constr . prototype . isFollowingArtists = function ( artistIds , callback ) {
342+ var requestData = {
343+ url : _baseUri + '/me/following/contains' ,
344+ type : 'GET' ,
345+ params : {
346+ ids : artistIds . join ( ',' ) ,
347+ type : 'artist'
348+ }
349+ } ;
350+ return _checkParamsAndPerformRequest ( requestData , callback ) ;
351+ } ;
352+
233353 /**
234354 * Fetches information about a specific user.
235355 * See [Get a User's Profile](https://developer.spotify.com/web-api/get-users-profile/) on
0 commit comments