Add position parameter for playlist add operation of Spotify node (#1794)

This commit is contained in:
DerEnderKeks 2021-05-16 02:55:13 +02:00 committed by GitHub
parent 3e98612881
commit e6d67dfcaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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';