From f8ab310cc1988ba413c803047beba16db9222d86 Mon Sep 17 00:00:00 2001 From: Enzo Ferey Date: Mon, 15 May 2023 12:43:18 +0200 Subject: [PATCH] Update to new endpoint structure. --- __tests__/spotify-web-api.js | 4 ++-- src/spotify-web-api.js | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/__tests__/spotify-web-api.js b/__tests__/spotify-web-api.js index 8222a0d4..a79f3fbe 100644 --- a/__tests__/spotify-web-api.js +++ b/__tests__/spotify-web-api.js @@ -3121,7 +3121,7 @@ describe('Spotify Web API', () => { ) { expect(method).toBe(superagent.get); expect(uri).toBe( - 'https://api.spotify.com/v1/users/spotify_germany/playlists/2nKFnGNFvHX9hG5Kv7Bm3G/followers/contains' + 'https://api.spotify.com/v1/playlists/2nKFnGNFvHX9hG5Kv7Bm3G/followers/contains' ); expect(options.query).toEqual({ ids: 'thelinmichael,ella' @@ -3137,7 +3137,7 @@ describe('Spotify Web API', () => { }); api - .areFollowingPlaylist('spotify_germany', '2nKFnGNFvHX9hG5Kv7Bm3G', [ + .areFollowingPlaylist('2nKFnGNFvHX9hG5Kv7Bm3G', [ 'thelinmichael', 'ella' ]) diff --git a/src/spotify-web-api.js b/src/spotify-web-api.js index 2a756da8..99f7b0c9 100644 --- a/src/spotify-web-api.js +++ b/src/spotify-web-api.js @@ -1340,19 +1340,16 @@ SpotifyWebApi.prototype = { /** * Check if users are following a playlist. - * @param {string} userId The playlist's owner's user ID * @param {string} playlistId The playlist's ID - * @param {String[]} User IDs of the following users + * @param {String[]} followerIds IDs of the following users * @param {requestCallback} [callback] Optional callback method to be called instead of the promise. * @returns {Promise|undefined} A promise that if successful returns an array of booleans. If rejected, * it contains an error object. Not returned if a callback is given. */ - areFollowingPlaylist: function(userId, playlistId, followerIds, callback) { + areFollowingPlaylist: function(playlistId, followerIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath( - '/v1/users/' + - encodeURIComponent(userId) + - '/playlists/' + + '/v1/playlists/' + playlistId + '/followers/contains' )