From 2063333ee5617f213f286caa0ef5749562eb150c Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sat, 15 May 2021 20:01:25 -0500 Subject: [PATCH] :zap: Minor improvements to Spotify Node --- .../nodes-base/nodes/Spotify/Spotify.node.ts | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/packages/nodes-base/nodes/Spotify/Spotify.node.ts b/packages/nodes-base/nodes/Spotify/Spotify.node.ts index 58210e4e9e..696e1fff33 100644 --- a/packages/nodes-base/nodes/Spotify/Spotify.node.ts +++ b/packages/nodes-base/nodes/Spotify/Spotify.node.ts @@ -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`;