Skip to content

Commit 29c0273

Browse files
authored
[Components] listen_notes #15178 (#15289)
* Added actions * Added actions * Added actions
1 parent a174d83 commit 29c0273

File tree

8 files changed

+387
-19
lines changed

8 files changed

+387
-19
lines changed

components/listen_notes/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import app from "../../listen_notes.app.mjs";
2+
3+
export default {
4+
key: "listen_notes-full-search",
5+
name: "Full Search",
6+
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)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
q: {
12+
propDefinition: [
13+
app,
14+
"q",
15+
],
16+
},
17+
sortByDate: {
18+
propDefinition: [
19+
app,
20+
"sortByDate",
21+
],
22+
},
23+
type: {
24+
propDefinition: [
25+
app,
26+
"type",
27+
],
28+
},
29+
language: {
30+
propDefinition: [
31+
app,
32+
"language",
33+
],
34+
},
35+
offset: {
36+
propDefinition: [
37+
app,
38+
"offset",
39+
],
40+
},
41+
},
42+
43+
async run({ $ }) {
44+
const response = await this.app.fullSearch({
45+
$,
46+
params: {
47+
q: this.q,
48+
sort_by_date: this.sortByDate,
49+
type: this.type,
50+
language: this.language,
51+
},
52+
});
53+
$.export("$summary", `Successfully retrieved ${response.results.length} results`);
54+
return response;
55+
},
56+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import app from "../../listen_notes.app.mjs";
2+
3+
export default {
4+
key: "listen_notes-get-episode-details",
5+
name: "Get Episode Details",
6+
description: "Get the details of the selected episode. [See the documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
q: {
12+
propDefinition: [
13+
app,
14+
"q",
15+
],
16+
optional: true,
17+
},
18+
language: {
19+
propDefinition: [
20+
app,
21+
"language",
22+
],
23+
},
24+
offset: {
25+
propDefinition: [
26+
app,
27+
"offset",
28+
],
29+
},
30+
id: {
31+
propDefinition: [
32+
app,
33+
"id",
34+
(c) => ({
35+
q: c.q,
36+
language: c.language,
37+
offset: c.offset,
38+
}),
39+
],
40+
},
41+
showTranscript: {
42+
propDefinition: [
43+
app,
44+
"showTranscript",
45+
],
46+
},
47+
},
48+
49+
async run({ $ }) {
50+
const response = await this.app.getEpisodeDetails({
51+
$,
52+
id: this.id,
53+
params: {
54+
show_transcript: this.showTranscript,
55+
},
56+
});
57+
$.export("$summary", `Successfully retrieved details for the episode '${response.title}'`);
58+
return response;
59+
},
60+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import app from "../../listen_notes.app.mjs";
2+
3+
export default {
4+
key: "listen_notes-get-podcast-details",
5+
name: "Get Podcast Details",
6+
description: "Get the details of the selected podcast. [See the documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
q: {
12+
propDefinition: [
13+
app,
14+
"q",
15+
],
16+
optional: true,
17+
},
18+
language: {
19+
propDefinition: [
20+
app,
21+
"language",
22+
],
23+
},
24+
offset: {
25+
propDefinition: [
26+
app,
27+
"offset",
28+
],
29+
},
30+
id: {
31+
propDefinition: [
32+
app,
33+
"id",
34+
(c) => ({
35+
q: c.q,
36+
type: "podcast",
37+
language: c.language,
38+
offset: c.offset,
39+
}),
40+
],
41+
},
42+
nextEpisodePubDate: {
43+
propDefinition: [
44+
app,
45+
"nextEpisodePubDate",
46+
],
47+
},
48+
sort: {
49+
propDefinition: [
50+
app,
51+
"sort",
52+
],
53+
},
54+
},
55+
56+
async run({ $ }) {
57+
const response = await this.app.getPodcastDetails({
58+
$,
59+
id: this.id,
60+
params: {
61+
next_episode_pub_date: this.nextEpisodePubDate,
62+
sort: this.sort,
63+
},
64+
});
65+
$.export("$summary", `Successfully retrieved details for the podcast '${response.title}'`);
66+
return response;
67+
},
68+
};

components/listen_notes/app/listen_notes.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export default {
2+
SEARCH_SORTING_OPTIONS: [
3+
{
4+
value: "0",
5+
label: "Sort by Relevance",
6+
},
7+
{
8+
value: "1",
9+
label: "Sort by Date",
10+
},
11+
],
12+
EPISODES_SORTING_OPTIONS: [
13+
{
14+
value: "recent_first",
15+
label: "Recent First",
16+
},
17+
{
18+
value: "oldest_first",
19+
label: "Oldest First",
20+
},
21+
],
22+
TRANSCRIPT_OPTIONS: [
23+
{
24+
value: "0",
25+
label: "Don't include transcript",
26+
},
27+
{
28+
value: "1",
29+
label: "Include transcript",
30+
},
31+
],
32+
TYPE_OPTIONS: [
33+
"episode",
34+
"podcast",
35+
"curated",
36+
],
37+
};

0 commit comments

Comments
 (0)