From e6d67dfcafa144aef1f32eef19f5c0fe7b407b55 Mon Sep 17 00:00:00 2001 From: DerEnderKeks Date: Sun, 16 May 2021 02:55:13 +0200 Subject: [PATCH] :sparkles: Add position parameter for playlist add operation of Spotify node (#1794) --- .../nodes-base/nodes/Spotify/Spotify.node.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Spotify/Spotify.node.ts b/packages/nodes-base/nodes/Spotify/Spotify.node.ts index 762713bd2a..58210e4e9e 100644 --- a/packages/nodes-base/nodes/Spotify/Spotify.node.ts +++ b/packages/nodes-base/nodes/Spotify/Spotify.node.ts @@ -445,6 +445,25 @@ export class Spotify implements INodeType { placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU', description: `The track's Spotify URI or its ID. The track to add/delete from the playlist.`, }, + { + displayName: 'Position', + name: 'position', + type: 'string', + default: '', + required: false, + displayOptions: { + show: { + resource: [ + 'playlist', + ], + operation: [ + 'add', + ], + }, + }, + placeholder: '0', + description: `The track's new position in the playlist.`, + }, // ----------------------------------------------------- // Track Operations // Get a Track, Get a Track's Audio Features @@ -918,15 +937,17 @@ export class Spotify implements INodeType { requestMethod = 'POST'; const trackId = this.getNodeParameter('trackID', i) as string; + const position = this.getNodeParameter('position', i) as string; qs = { uris: trackId, }; + if (position.length > 0) qs.position = position; + endpoint = `/playlists/${id}/tracks`; responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs); - } } else if (operation === 'getUserPlaylists') { requestMethod = 'GET';