mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
🐛 Fix Spotify pagination bug (#2061)
* Fixed missing value Fixed infinite amount of interval triggered nodes executions * Fixed inifite loop on Spotify Node * Hide Limit parameter * Logic operator fix * Spotify getFollowingArtists returnAll fix * ⚡ Small improvements to #2054 * 👕 Fix lint issue Co-authored-by: Лебедев Иван <11215636+X-pech@users.noreply.github.com> Co-authored-by: X-pech <lisgml@gmail.com>
This commit is contained in:
@@ -71,7 +71,7 @@ export async function spotifyApiRequestAllItems(this: IHookFunctions | IExecuteF
|
|||||||
}
|
}
|
||||||
} while (
|
} while (
|
||||||
(responseData['next'] !== null && responseData['next'] !== undefined) ||
|
(responseData['next'] !== null && responseData['next'] !== undefined) ||
|
||||||
responseData[propertyName.split('.')[0]].next !== null
|
(responseData[propertyName.split('.')[0]].next !== null && responseData[propertyName.split('.')[0]].next !== undefined)
|
||||||
);
|
);
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
|
|||||||
@@ -715,6 +715,7 @@ export class Spotify implements INodeType {
|
|||||||
'myData',
|
'myData',
|
||||||
'playlist',
|
'playlist',
|
||||||
'track',
|
'track',
|
||||||
|
'player',
|
||||||
],
|
],
|
||||||
operation: [
|
operation: [
|
||||||
'getTracks',
|
'getTracks',
|
||||||
@@ -724,6 +725,7 @@ export class Spotify implements INodeType {
|
|||||||
'getLikedTracks',
|
'getLikedTracks',
|
||||||
'getFollowingArtists',
|
'getFollowingArtists',
|
||||||
'search',
|
'search',
|
||||||
|
'recentlyPlayed',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -779,6 +781,9 @@ export class Spotify implements INodeType {
|
|||||||
'getFollowingArtists',
|
'getFollowingArtists',
|
||||||
'recentlyPlayed',
|
'recentlyPlayed',
|
||||||
],
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
@@ -908,6 +913,7 @@ export class Spotify implements INodeType {
|
|||||||
|
|
||||||
endpoint = `/me/player/pause`;
|
endpoint = `/me/player/pause`;
|
||||||
|
|
||||||
|
|
||||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||||
|
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
@@ -917,15 +923,22 @@ export class Spotify implements INodeType {
|
|||||||
|
|
||||||
endpoint = `/me/player/recently-played`;
|
endpoint = `/me/player/recently-played`;
|
||||||
|
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
qs = {
|
propertyName = 'items';
|
||||||
limit,
|
|
||||||
};
|
|
||||||
|
|
||||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
if (!returnAll) {
|
||||||
|
|
||||||
responseData = responseData.items;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
|
|
||||||
|
qs = {
|
||||||
|
limit,
|
||||||
|
};
|
||||||
|
|
||||||
|
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||||
|
|
||||||
|
responseData = responseData.items;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (operation === 'currentlyPlaying') {
|
} else if (operation === 'currentlyPlaying') {
|
||||||
requestMethod = 'GET';
|
requestMethod = 'GET';
|
||||||
@@ -1384,8 +1397,14 @@ export class Spotify implements INodeType {
|
|||||||
|
|
||||||
endpoint = `/me/following`;
|
endpoint = `/me/following`;
|
||||||
|
|
||||||
|
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
propertyName = 'artists.items';
|
propertyName = 'artists.items';
|
||||||
|
|
||||||
|
qs = {
|
||||||
|
type: 'artist',
|
||||||
|
};
|
||||||
|
|
||||||
if (!returnAll) {
|
if (!returnAll) {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs = {
|
qs = {
|
||||||
|
|||||||
Reference in New Issue
Block a user