mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
✨ Add position parameter for playlist add operation of Spotify node (#1794)
This commit is contained in:
parent
3e98612881
commit
e6d67dfcaf
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue