Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Add Items to a Playlist",
description: "Add one or more items to a user’s playlist. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist).",
key: "spotify-add-items-to-playlist",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create a Playlist",
description: "Create a playlist for a Spotify user. The playlist will be empty until you add tracks. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/create-playlist).",
key: "spotify-create-playlist",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Get Album Tracks",
description: "Get all tracks in an album. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/get-an-albums-tracks)",
key: "spotify-get-album-tracks",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Get All Tracks by Artist",
description: "Get Spotify tracks information related with an artist's. [see docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-albums).",
key: "spotify-get-all-tracks-by-artist",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Get an Artist's Top Tracks",
description: "Get Spotify catalog information about an artist’s top tracks by country. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-artists-top-tracks).",
key: "spotify-get-artist-top-tracks",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Get Audio Features for a Track",
description: "Get audio feature information for a single track identified by its unique Spotify ID. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-features).",
key: "spotify-get-audio-features-for-a-track",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Get a Category's Playlists",
description: "Get a list of Spotify playlists tagged with a particular category. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-categories-playlists).",
key: "spotify-get-categorys-playlist",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
description:
"Get the object currently being played on the user's Spotify account. [See the documentation](https://developer.spotify.com/documentation/web-api/reference/get-the-users-currently-playing-track)",
key: "spotify-get-currently-playing-track",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Get a Playlist's Items",
description: "Get full details of the items of a playlist owned by a Spotify user. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks).",
key: "spotify-get-playlist-items",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/spotify/actions/get-playlist/get-playlist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
name: "Get a Playlist",
description: "Get a playlist owned by a Spotify user. [See the documentation](https://developer.spotify.com/documentation/web-api/reference/get-playlist).",
key: "spotify-get-playlist",
version: "0.0.4",
version: "0.0.5",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Get Recommendations",
description: "Create a list of recommendations based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recommendations).",
key: "spotify-get-recommendations",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/spotify/actions/get-track/get-track.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Get a Track",
description: "Get a track by its name or ID. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/search)",
key: "spotify-get-track",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Remove Items from a Playlist",
description: "Remove one or more items from a user’s playlist. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-tracks-playlist)",
key: "spotify-remove-items-from-playlist",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Remove User's Saved Tracks",
description: "Remove one or more tracks from the current user’s ‘Your Music’ library. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-tracks-user)",
key: "spotify-remove-user-saved-tracks",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/spotify/actions/save-track/save-track.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Save Tracks for User",
description: "Save one or more tracks to the current user’s \"Your Music\" library. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/save-tracks-user).",
key: "spotify-save-track",
version: "0.1.3",
version: "0.1.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
88 changes: 88 additions & 0 deletions components/spotify/actions/search/search.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { ConfigurationError } from "@pipedream/platform";
import spotify from "../../spotify.app.mjs";
import {
ITEM_TYPES_LIST, ITEM_TYPES,
} from "../../consts.mjs";

export default {
key: "spotify-search",
name: "Search",
description: "Search for items on Spotify (tracks, albums, artists, playlists, shows, or episodes). [See the docs here](https://developer.spotify.com/documentation/web-api/reference/search)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
spotify,
query: {
type: "string",
label: "Search Query",
description: "Search query keywords and optional field filters. [See the Spotify docs for query syntax](https://developer.spotify.com/documentation/web-api/reference/search)",
},
type: {
type: "string[]",
label: "Search Type",
description: "Type(s) of items to search for",
options: ITEM_TYPES_LIST,
default: [
ITEM_TYPES.TRACK,
],
},
market: {
propDefinition: [
spotify,
"market",
],
optional: true,
},
limit: {
propDefinition: [
spotify,
"limit",
],
description: "The maximum number of results to return per type.",
default: 20,
max: 50,
},
offset: {
propDefinition: [
spotify,
"offset",
],
},
includeExternal: {
type: "string",
label: "Include External",
description: "If `audio` is specified, the response will include any relevant audio content that is hosted externally.",
optional: true,
options: [
"audio",
],
},
},
async run({ $ }) {
if (!this.query || this.query.trim().length === 0) {
throw new ConfigurationError("Search `query` cannot be empty");
}

if (!this.type) {
throw new ConfigurationError("Select at least one search type");
}

const res = await this.spotify.search({
q: this.query,
type: this.type.join(","),
market: this.market,
limit: this.limit,
offset: this.offset,
include_external: this.includeExternal,
});

$.export("$summary", `Successfully retrieved results matching query: "${this.query}"`);

return res;
},
};
27 changes: 27 additions & 0 deletions components/spotify/consts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ export const ITEM_TYPES = {
EPISODE: "episode",
};

export const ITEM_TYPES_LIST = [
{
label: "Album",
value: ITEM_TYPES.ALBUM,
},
{
label: "Artist",
value: ITEM_TYPES.ARTIST,
},
{
label: "Playlist",
value: ITEM_TYPES.PLAYLIST,
},
{
label: "Track",
value: ITEM_TYPES.TRACK,
},
{
label: "Show",
value: ITEM_TYPES.SHOW,
},
{
label: "Episode",
value: ITEM_TYPES.EPISODE,
},
];

export const ITEM_TYPES_RESULT_NAME = {
[ITEM_TYPES.ALBUM]: "albums",
[ITEM_TYPES.ARTIST]: "artists",
Expand Down
2 changes: 1 addition & 1 deletion components/spotify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/spotify",
"version": "0.7.3",
"version": "0.7.4",
"description": "Pipedream Spotify Components",
"main": "spotify.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/spotify/sources/new-playlist/new-playlist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "spotify-new-playlist",
name: "New Playlist",
description: "Emit new event when a new playlist is created or followed by the current Spotify user.",
version: "0.1.2",
version: "0.1.3",
props: {
...common.props,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "spotify-new-saved-track",
name: "New Saved Track",
description: "Emit new event for each new track saved to the current Spotify user's Music Library.",
version: "0.1.2",
version: "0.1.3",
props: {
...common.props,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "spotify-new-track-by-artist",
name: "New Track by Artist",
description: "Emit new event for each new Spotify track related with an artist. [see docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-albums)",
version: "0.1.2",
version: "0.1.3",
props: {
...common.props,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "spotify-new-track-in-playlist",
name: "New Track in Playlist",
description: "Emit new event for each new Spotify track added to a playlist",
version: "0.1.2",
version: "0.1.3",
props: {
...common.props,
db: "$.service.db",
Expand Down
4 changes: 4 additions & 0 deletions components/spotify/spotify.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ export default {
const { data } = await this._makeRequest("GET", "/recommendations", params);
return data;
},
async search(params) {
const { data } = await this._makeRequest("GET", "/search", params);
return data;
},
async fetchChunksOfAlbumsIds({
artistId,
market,
Expand Down
Loading