mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Minor improvements to Spotify Node
This commit is contained in:
parent
e6d67dfcaf
commit
2063333ee5
|
@ -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.`,
|
description: `The track's Spotify URI or its ID. The track to add/delete from the playlist.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Position',
|
displayName: 'Additional Fields',
|
||||||
name: 'position',
|
name: 'additionalFields',
|
||||||
type: 'string',
|
type: 'collection',
|
||||||
default: '',
|
placeholder: 'Add Field',
|
||||||
required: false,
|
default: {},
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: [
|
resource: [
|
||||||
|
@ -461,9 +461,21 @@ export class Spotify implements INodeType {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
placeholder: '0',
|
options: [
|
||||||
description: `The track's new position in the playlist.`,
|
{
|
||||||
|
displayName: 'Position',
|
||||||
|
name: 'position',
|
||||||
|
type: 'number',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 0,
|
||||||
|
},
|
||||||
|
default: 0,
|
||||||
|
placeholder: '0',
|
||||||
|
description: `The new track's position in the playlist.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
// Track Operations
|
// Track Operations
|
||||||
// Get a Track, Get a Track's Audio Features
|
// Get a Track, Get a Track's Audio Features
|
||||||
|
@ -937,13 +949,15 @@ export class Spotify implements INodeType {
|
||||||
requestMethod = 'POST';
|
requestMethod = 'POST';
|
||||||
|
|
||||||
const trackId = this.getNodeParameter('trackID', i) as string;
|
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 = {
|
qs = {
|
||||||
uris: trackId,
|
uris: trackId,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (position.length > 0) qs.position = position;
|
if (additionalFields.position !== undefined) {
|
||||||
|
qs.position = additionalFields.position;
|
||||||
|
}
|
||||||
|
|
||||||
endpoint = `/playlists/${id}/tracks`;
|
endpoint = `/playlists/${id}/tracks`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue