first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,78 @@
import get from 'lodash/get';
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
JsonObject,
IHttpRequestMethods,
IHttpRequestOptions,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
/**
* Make an API request to Spotify
*
*/
export async function spotifyApiRequest(
this: IHookFunctions | IExecuteFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: object,
query?: IDataObject,
uri?: string,
): Promise<any> {
const options: IHttpRequestOptions = {
method,
headers: {
'User-Agent': 'n8n',
'Content-Type': 'text/plain',
Accept: ' application/json',
},
qs: query,
url: uri ?? `https://api.spotify.com/v1${endpoint}`,
json: true,
};
if (Object.keys(body).length > 0) {
options.body = body;
}
try {
return await this.helpers.httpRequestWithAuthentication.call(this, 'spotifyOAuth2Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function spotifyApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions,
propertyName: string,
method: IHttpRequestMethods,
endpoint: string,
body: object,
query?: IDataObject,
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
let uri: string | undefined;
do {
responseData = await spotifyApiRequest.call(this, method, endpoint, body, query, uri);
returnData.push.apply(returnData, get(responseData, propertyName));
uri = responseData.next || responseData[propertyName.split('.')[0]].next;
//remove the query as the query parameters are already included in the next, else api throws error.
query = {};
if (uri?.includes('offset=1000') && endpoint === '/search') {
// The search endpoint has a limit of 1000 so step before it returns a 404
return returnData;
}
} while (
(responseData.next !== null && responseData.next !== undefined) ||
(responseData[propertyName.split('.')[0]].next !== null &&
responseData[propertyName.split('.')[0]].next !== undefined)
);
return returnData;
}
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.spotify",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Miscellaneous"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/spotify/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.spotify/"
}
]
},
"alias": ["Music", "Song"]
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,95 @@
{
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,66 @@
{
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"followers": {
"type": "object",
"properties": {
"href": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"genres": {
"type": "array",
"items": {
"type": "string"
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,98 @@
{
"type": "object",
"properties": {
"album_group": {
"type": "string"
},
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,192 @@
{
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,66 @@
{
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"followers": {
"type": "object",
"properties": {
"href": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"genres": {
"type": "array",
"items": {
"type": "string"
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,200 @@
{
"type": "object",
"properties": {
"added_at": {
"type": "string"
},
"track": {
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"version": 1
}
@@ -0,0 +1,66 @@
{
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"followers": {
"type": "object",
"properties": {
"href": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"genres": {
"type": "array",
"items": {
"type": "string"
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,183 @@
{
"type": "object",
"properties": {
"actions": {
"type": "object",
"properties": {
"disallows": {
"type": "object",
"properties": {
"resuming": {
"type": "boolean"
}
}
}
}
},
"currently_playing_type": {
"type": "string"
},
"is_playing": {
"type": "boolean"
},
"item": {
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"is_local": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"progress_ms": {
"type": "integer"
},
"timestamp": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,194 @@
{
"type": "object",
"properties": {
"played_at": {
"type": "string"
},
"track": {
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"snapshot_id": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,106 @@
{
"type": "object",
"properties": {
"collaborative": {
"type": "boolean"
},
"description": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"followers": {
"type": "object",
"properties": {
"href": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"owner": {
"type": "object",
"properties": {
"display_name": {
"type": "null"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"primary_color": {
"type": "null"
},
"public": {
"type": "boolean"
},
"snapshot_id": {
"type": "string"
},
"tracks": {
"type": "object",
"properties": {
"href": {
"type": "string"
},
"limit": {
"type": "integer"
},
"next": {
"type": "null"
},
"offset": {
"type": "integer"
},
"previous": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,302 @@
{
"type": "object",
"properties": {
"collaborative": {
"type": "boolean"
},
"description": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"followers": {
"type": "object",
"properties": {
"href": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"owner": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"public": {
"type": "boolean"
},
"snapshot_id": {
"type": "string"
},
"tracks": {
"type": "object",
"properties": {
"href": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"added_at": {
"type": "string"
},
"added_by": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"is_local": {
"type": "boolean"
},
"primary_color": {
"type": "null"
},
"track": {
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"type": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"episode": {
"type": "boolean"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"is_local": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track": {
"type": "boolean"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"video_thumbnail": {
"type": "object",
"properties": {
"url": {
"type": "null"
}
}
}
}
}
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"previous": {
"type": "null"
},
"total": {
"type": "integer"
}
}
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,233 @@
{
"type": "object",
"properties": {
"added_at": {
"type": "string"
},
"added_by": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"is_local": {
"type": "boolean"
},
"primary_color": {
"type": "null"
},
"track": {
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"episode": {
"type": "boolean"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track": {
"type": "boolean"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"video_thumbnail": {
"type": "object",
"properties": {
"url": {
"type": "null"
}
}
}
},
"version": 1
}
@@ -0,0 +1,80 @@
{
"type": "object",
"properties": {
"collaborative": {
"type": "boolean"
},
"description": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"owner": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"public": {
"type": "boolean"
},
"snapshot_id": {
"type": "string"
},
"tracks": {
"type": "object",
"properties": {
"href": {
"type": "string"
},
"total": {
"type": "integer"
}
}
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,88 @@
{
"type": "object",
"properties": {
"collaborative": {
"type": "boolean"
},
"description": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
}
},
"name": {
"type": "string"
},
"owner": {
"type": "object",
"properties": {
"display_name": {
"type": "string"
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"snapshot_id": {
"type": "string"
},
"tracks": {
"type": "object",
"properties": {
"href": {
"type": "string"
},
"total": {
"type": "integer"
}
}
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,186 @@
{
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,57 @@
{
"type": "object",
"properties": {
"acousticness": {
"type": "number"
},
"analysis_url": {
"type": "string"
},
"danceability": {
"type": "number"
},
"duration_ms": {
"type": "integer"
},
"energy": {
"type": "number"
},
"id": {
"type": "string"
},
"key": {
"type": "integer"
},
"liveness": {
"type": "number"
},
"loudness": {
"type": "number"
},
"mode": {
"type": "integer"
},
"speechiness": {
"type": "number"
},
"tempo": {
"type": "number"
},
"time_signature": {
"type": "integer"
},
"track_href": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
},
"valence": {
"type": "number"
}
},
"version": 1
}
@@ -0,0 +1,192 @@
{
"type": "object",
"properties": {
"album": {
"type": "object",
"properties": {
"album_type": {
"type": "string"
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"height": {
"type": "integer"
},
"url": {
"type": "string"
},
"width": {
"type": "integer"
}
}
}
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"release_date": {
"type": "string"
},
"release_date_precision": {
"type": "string"
},
"total_tracks": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
},
"artists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"available_markets": {
"type": "array",
"items": {
"type": "string"
}
},
"disc_number": {
"type": "integer"
},
"duration_ms": {
"type": "integer"
},
"explicit": {
"type": "boolean"
},
"external_ids": {
"type": "object",
"properties": {
"isrc": {
"type": "string"
}
}
},
"external_urls": {
"type": "object",
"properties": {
"spotify": {
"type": "string"
}
}
},
"href": {
"type": "string"
},
"id": {
"type": "string"
},
"is_local": {
"type": "boolean"
},
"is_playable": {
"type": "boolean"
},
"name": {
"type": "string"
},
"popularity": {
"type": "integer"
},
"track_number": {
"type": "integer"
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,62 @@
import type { IExecuteFunctions, IHookFunctions } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import { spotifyApiRequest } from '../GenericFunctions';
describe('Spotify -> GenericFunctions', () => {
let mockThis: IHookFunctions | IExecuteFunctions;
beforeEach(() => {
mockThis = {
helpers: {
httpRequestWithAuthentication: jest.fn(),
},
getNode: jest.fn().mockReturnValue({}),
} as unknown as IHookFunctions | IExecuteFunctions;
});
it('should make a request with the correct options', async () => {
const method = 'GET';
const endpoint = '/me';
const body = {};
const query = { limit: 10 };
const response = { data: 'test' };
(mockThis.helpers.httpRequestWithAuthentication as jest.Mock).mockResolvedValue(response);
const result = await spotifyApiRequest.call(mockThis, method, endpoint, body, query);
expect(mockThis.helpers.httpRequestWithAuthentication).toHaveBeenCalledWith(
'spotifyOAuth2Api',
{
method,
headers: {
'User-Agent': 'n8n',
'Content-Type': 'text/plain',
Accept: ' application/json',
},
qs: query,
url: `https://api.spotify.com/v1${endpoint}`,
json: true,
},
);
expect(result).toEqual(response);
});
it('should throw a NodeApiError on request failure', async () => {
const method = 'GET';
const endpoint = '/me';
const body = {};
const query = { limit: 10 };
const error = new Error('Request failed');
(mockThis.helpers.httpRequestWithAuthentication as jest.Mock).mockRejectedValue(error);
await expect(spotifyApiRequest.call(mockThis, method, endpoint, body, query)).rejects.toThrow(
NodeApiError,
);
expect(mockThis.getNode).toHaveBeenCalled();
});
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,28 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
import {
getAlbum,
getAlbumTracks,
getArtist,
getNewReleases,
searchForAlbum,
} from './apiResponses';
describe('Spotify', () => {
describe('Run workflow', () => {
beforeAll(() => {
const mock = nock('https://api.spotify.com/v1');
mock
.get('/search')
.query({ q: 'From Xero', type: 'album', limit: 2 })
.reply(200, searchForAlbum);
mock.get('/browse/new-releases').query({ limit: 2 }).reply(200, getNewReleases);
mock.get('/albums/4R6FV9NSzhPihHR0h4pI93/tracks').reply(200, getAlbumTracks);
mock.get('/albums/4R6FV9NSzhPihHR0h4pI93').reply(200, getAlbum);
mock.get('/artists/12Chz98pHFMPJEknJQMWvI').reply(200, getArtist);
});
new NodeTestHarness().setupTests();
});
});
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 66 65"><use xlink:href="#a" x=".5" y=".5"/><symbol id="a" overflow="visible"><path fill="#1ed760" fill-rule="nonzero" stroke="none" d="M32 0C14.3 0 0 14.337 0 32c0 17.7 14.337 32 32 32 17.7 0 32-14.337 32-32S49.663 0 32 0m14.68 46.184c-.573.956-1.797 1.223-2.753.65-7.532-4.588-16.975-5.62-28.14-3.097-1.07.23-2.14-.42-2.37-1.5s.42-2.14 1.5-2.37c12.196-2.8 22.67-1.606 31.082 3.556a2 2 0 0 1 .688 2.753zm3.9-8.717c-.726 1.185-2.256 1.53-3.44.84-8.602-5.276-21.716-6.805-31.885-3.747-1.338.382-2.714-.344-3.097-1.644-.382-1.338.344-2.714 1.682-3.097 11.622-3.517 26.074-1.835 35.976 4.244 1.147.688 1.5 2.217.765 3.403zm.344-9.1c-10.323-6.117-27.336-6.7-37.2-3.708-1.568.497-3.25-.42-3.747-1.988s.42-3.25 1.988-3.747c11.317-3.44 30.127-2.753 41.98 4.282 1.415.84 1.873 2.676 1.032 4.1-.765 1.453-2.638 1.912-4.053 1.07z"/></symbol></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB