-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] listen_notes #15178 #15289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d481cdd
Added actions
lcaresia 4ebba7c
Added actions
lcaresia 2d4bf90
Merge branch 'master' into issue-15178
lcaresia 76363b7
Merge branch 'master' into issue-15178
lcaresia e086487
Added actions
lcaresia 858cd19
Merge branch 'master' into issue-15178
lcaresia 04e1ae7
Merge branch 'master' into issue-15178
lcaresia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
components/listen_notes/actions/full-search/full-search.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import app from "../../listen_notes.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "listen_notes-full-search", | ||
| name: "Full Search", | ||
| description: "Full-text search on episodes, podcasts, or curated lists of podcasts. [See the documentation](https://www.listennotes.com/api/docs/#get-api-v2-search)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| q: { | ||
| propDefinition: [ | ||
| app, | ||
| "q", | ||
| ], | ||
| }, | ||
| sortByDate: { | ||
| propDefinition: [ | ||
| app, | ||
| "sortByDate", | ||
| ], | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| app, | ||
| "type", | ||
| ], | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| app, | ||
| "language", | ||
| ], | ||
| }, | ||
| offset: { | ||
| propDefinition: [ | ||
| app, | ||
| "offset", | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.fullSearch({ | ||
| $, | ||
| params: { | ||
| q: this.q, | ||
| sort_by_date: this.sortByDate, | ||
| type: this.type, | ||
| language: this.language, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.results.length} results`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
52 changes: 52 additions & 0 deletions
52
components/listen_notes/actions/get-episode-details/get-episode-details.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import app from "../../listen_notes.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "listen_notes-get-episode-details", | ||
| name: "Get Episode Details", | ||
| description: "Get the details of the selected episode. [See the documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| q: { | ||
| propDefinition: [ | ||
| app, | ||
| "q", | ||
| ], | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| app, | ||
| "language", | ||
| ], | ||
| }, | ||
| offset: { | ||
| propDefinition: [ | ||
| app, | ||
| "offset", | ||
| ], | ||
| }, | ||
| id: { | ||
| propDefinition: [ | ||
| app, | ||
| "id", | ||
| (c) => ({ | ||
| q: c.q, | ||
| language: c.language, | ||
| offset: c.offset, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.getEpisodeDetails({ | ||
| $, | ||
| id: this.id, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved details for the episode '${response.title}'`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
53 changes: 53 additions & 0 deletions
53
components/listen_notes/actions/get-podcast-details/get-podcast-details.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import app from "../../listen_notes.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "listen_notes-get-podcast-details", | ||
| name: "Get Podcast Details", | ||
| description: "Get the details of the selected podcast. [See the documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| q: { | ||
| propDefinition: [ | ||
| app, | ||
| "q", | ||
| ], | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| app, | ||
| "language", | ||
| ], | ||
| }, | ||
| offset: { | ||
| propDefinition: [ | ||
| app, | ||
| "offset", | ||
| ], | ||
| }, | ||
| id: { | ||
| propDefinition: [ | ||
| app, | ||
| "id", | ||
| (c) => ({ | ||
| q: c.q, | ||
| type: "podcast", | ||
| language: c.language, | ||
| offset: c.offset, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.getPodcastDetails({ | ||
| $, | ||
| id: this.id, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved details for the podcast '${response.title}'`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export default { | ||
| BOOLEAN_OPTIONS: [ | ||
| "0", | ||
| "1", | ||
| ], | ||
| TYPE_OPTIONS: [ | ||
| "episode", | ||
| "podcast", | ||
| "curated", | ||
| ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "listen_notes", | ||
| propDefinitions: { | ||
| id: { | ||
| type: "string", | ||
| label: "Podcast or Episode ID", | ||
| description: "The ID of the podcast or episode", | ||
| async options({ | ||
| q, type, language, offset, | ||
| }) { | ||
| const response = await this.listPodcasts({ | ||
| q, | ||
| type, | ||
| language, | ||
| offset, | ||
| }); | ||
| const ids = response.results; | ||
| return ids.map(({ | ||
| title_original, id, | ||
| }) => ({ | ||
| value: id, | ||
| label: title_original, | ||
| })); | ||
| }, | ||
| }, | ||
| q: { | ||
| type: "string", | ||
| label: "Query", | ||
| description: "Search term, e.g., person, place, topic... You can use double quotes to do verbatim match", | ||
| }, | ||
| offset: { | ||
| type: "string", | ||
| label: "Offset", | ||
| description: "The offset parameter is used to paginate through search results", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sortByDate: { | ||
| type: "string", | ||
| label: "Sort By Date", | ||
| description: "Sort by date. If 0, then sort by relevance. If 1, then sort by date", | ||
| options: constants.BOOLEAN_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "What type of contents do you want to search for?", | ||
| options: constants.TYPE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| language: { | ||
| type: "string", | ||
| label: "Language", | ||
| description: "Limit search results to a specific language. If not specified, it'll be any language", | ||
| async options() { | ||
| const response = await this.getLanguages(); | ||
| const languages = response.languages; | ||
| return languages.map((language) => ({ | ||
| value: language, | ||
| label: language, | ||
| })); | ||
| }, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://listen-api.listennotes.com/api/v2"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| ...headers, | ||
| "X-ListenAPI-Key": `${this.$auth.api_key}`, | ||
| }, | ||
| }); | ||
| }, | ||
| async fullSearch(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/search", | ||
| ...args, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async getPodcastDetails({ | ||
| id, | ||
| ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/podcasts/${id}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getEpisodeDetails({ | ||
| id, | ||
| ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/episodes/${id}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async listPodcasts({ | ||
| q, | ||
| language, | ||
| type, | ||
| offset, | ||
| ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: "/search", | ||
| params: { | ||
| q: q, | ||
| type: type, | ||
| language: language, | ||
| offset: offset, | ||
| }, | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getLanguages(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/languages", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| { | ||
| "name": "@pipedream/listen_notes", | ||
| "version": "0.0.2", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Listen Notes Components", | ||
| "main": "dist/app/listen_notes.app.mjs", | ||
| "main": "listen_notes.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "listen_notes" | ||
| ], | ||
| "files": ["dist"], | ||
| "homepage": "https://pipedream.com/apps/listen_notes", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.