Minor improvements to Spotify Node

This commit is contained in:
Jan Oberhauser 2021-05-15 20:01:25 -05:00
parent e6d67dfcaf
commit 2063333ee5

View file

@ -446,11 +446,11 @@ export class Spotify implements INodeType {
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,
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
@ -461,9 +461,21 @@ export class Spotify implements INodeType {
],
},
},
placeholder: '0',
description: `The track's new position in the playlist.`,
options: [
{
displayName: 'Position',
name: 'position',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 0,
placeholder: '0',
description: `The new track's position in the playlist.`,
},
],
},
// -----------------------------------------------------
// Track Operations
// Get a Track, Get a Track's Audio Features
@ -937,13 +949,15 @@ export class Spotify implements INodeType {
requestMethod = 'POST';
const trackId = this.getNodeParameter('trackID', i) as string;
const position = this.getNodeParameter('position', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
qs = {
uris: trackId,
};
if (position.length > 0) qs.position = position;
if (additionalFields.position !== undefined) {
qs.position = additionalFields.position;
}
endpoint = `/playlists/${id}/tracks`;