Skip to main content

podcast_api/
api_methods.rs

1// Generated by listennotes/devtools/api-sdks/sync.py rust. Do not edit.
2use crate::{Client, Response, Result};
3use reqwest::Method;
4use serde_json::Value;
5
6#[rustfmt::skip]
7impl Client<'_> {
8    /// Full-text search
9    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-search).
10    pub async fn search(&self, parameters: &Value) -> Result<Response> {
11        self.request_api(Method::GET, "/search",
12            &[], &["q", "sort_by_date", "type", "offset", "len_min", "len_max", "episode_count_min", "episode_count_max", "update_freq_min", "update_freq_max", "genre_ids", "published_before", "published_after", "only_in", "language", "region", "ocid", "ncid", "safe_mode", "unique_podcasts", "interviews_only", "sponsored_only", "page_size"], parameters).await
13    }
14
15    /// Typeahead search
16    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-typeahead).
17    pub async fn typeahead(&self, parameters: &Value) -> Result<Response> {
18        self.request_api(Method::GET, "/typeahead",
19            &[], &["q", "show_podcasts", "show_genres", "safe_mode"], parameters).await
20    }
21
22    /// Find individual episodes by searching for their titles
23    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-search_episode_titles).
24    pub async fn search_episode_titles(&self, parameters: &Value) -> Result<Response> {
25        self.request_api(Method::GET, "/search_episode_titles",
26            &[], &["q", "podcast_id", "podcast_id_type"], parameters).await
27    }
28
29    /// Spell check on a search term
30    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-spellcheck).
31    pub async fn spellcheck(&self, parameters: &Value) -> Result<Response> {
32        self.request_api(Method::GET, "/spellcheck",
33            &[], &["q"], parameters).await
34    }
35
36    /// Fetch related search terms
37    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-related_searches).
38    pub async fn fetch_related_searches(&self, parameters: &Value) -> Result<Response> {
39        self.request_api(Method::GET, "/related_searches",
40            &[], &["q"], parameters).await
41    }
42
43    /// Fetch trending search terms
44    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-trending_searches).
45    pub async fn fetch_trending_searches(&self, parameters: &Value) -> Result<Response> {
46        self.request_api(Method::GET, "/trending_searches",
47            &[], &[], parameters).await
48    }
49
50    /// Fetch a list of best podcasts by genre
51    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-best_podcasts).
52    pub async fn fetch_best_podcasts(&self, parameters: &Value) -> Result<Response> {
53        self.request_api(Method::GET, "/best_podcasts",
54            &[], &["genre_id", "page", "region", "publisher_region", "language", "sort", "safe_mode"], parameters).await
55    }
56
57    /// Fetch detailed meta data and episodes for a podcast by id
58    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id).
59    pub async fn fetch_podcast_by_id(&self, id: &str, parameters: &Value) -> Result<Response> {
60        self.request_api(Method::GET, "/podcasts/{id}",
61            &[("id", id)], &["next_episode_pub_date", "sort"], parameters).await
62    }
63
64    /// Request to delete a podcast
65    /// See [full API documentation](https://www.listennotes.com/api/docs/#delete-api-v2-podcasts-id).
66    pub async fn delete_podcast(&self, id: &str, parameters: &Value) -> Result<Response> {
67        self.request_api(Method::DELETE, "/podcasts/{id}",
68            &[("id", id)], &["reason"], parameters).await
69    }
70
71    /// Fetch detailed meta data for an episode by id
72    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id).
73    pub async fn fetch_episode_by_id(&self, id: &str, parameters: &Value) -> Result<Response> {
74        self.request_api(Method::GET, "/episodes/{id}",
75            &[("id", id)], &["show_transcript"], parameters).await
76    }
77
78    /// Batch fetch basic meta data for episodes
79    /// See [full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-episodes).
80    pub async fn batch_fetch_episodes(&self, parameters: &Value) -> Result<Response> {
81        self.request_api(Method::POST, "/episodes",
82            &[], &[], parameters).await
83    }
84
85    /// Batch fetch basic meta data for podcasts
86    /// See [full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-podcasts).
87    pub async fn batch_fetch_podcasts(&self, parameters: &Value) -> Result<Response> {
88        self.request_api(Method::POST, "/podcasts",
89            &[], &[], parameters).await
90    }
91
92    /// Fetch a curated list of podcasts by id
93    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-curated_podcasts-id).
94    pub async fn fetch_curated_podcasts_list_by_id(&self, id: &str, parameters: &Value) -> Result<Response> {
95        self.request_api(Method::GET, "/curated_podcasts/{id}",
96            &[("id", id)], &[], parameters).await
97    }
98
99    /// Fetch a list of podcast genres
100    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-genres).
101    pub async fn fetch_podcast_genres(&self, parameters: &Value) -> Result<Response> {
102        self.request_api(Method::GET, "/genres",
103            &[], &["top_level_only"], parameters).await
104    }
105
106    /// Fetch a list of supported countries/regions for best podcasts
107    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-regions).
108    pub async fn fetch_podcast_regions(&self, parameters: &Value) -> Result<Response> {
109        self.request_api(Method::GET, "/regions",
110            &[], &[], parameters).await
111    }
112
113    /// Fetch a list of supported languages for podcasts
114    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-languages).
115    pub async fn fetch_podcast_languages(&self, parameters: &Value) -> Result<Response> {
116        self.request_api(Method::GET, "/languages",
117            &[], &[], parameters).await
118    }
119
120    /// Fetch a random podcast episode
121    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-just_listen).
122    pub async fn just_listen(&self, parameters: &Value) -> Result<Response> {
123        self.request_api(Method::GET, "/just_listen",
124            &[], &[], parameters).await
125    }
126
127    /// Fetch curated lists of podcasts
128    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-curated_podcasts).
129    pub async fn fetch_curated_podcasts_lists(&self, parameters: &Value) -> Result<Response> {
130        self.request_api(Method::GET, "/curated_podcasts",
131            &[], &["page"], parameters).await
132    }
133
134    /// Fetch recommendations for a podcast
135    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id-recommendations).
136    pub async fn fetch_recommendations_for_podcast(&self, id: &str, parameters: &Value) -> Result<Response> {
137        self.request_api(Method::GET, "/podcasts/{id}/recommendations",
138            &[("id", id)], &["safe_mode"], parameters).await
139    }
140
141    /// Fetch recommendations for an episode
142    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-recommendations).
143    pub async fn fetch_recommendations_for_episode(&self, id: &str, parameters: &Value) -> Result<Response> {
144        self.request_api(Method::GET, "/episodes/{id}/recommendations",
145            &[("id", id)], &["safe_mode"], parameters).await
146    }
147
148    /// Submit a podcast to Listen Notes database
149    /// See [full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-podcasts-submit).
150    pub async fn submit_podcast(&self, parameters: &Value) -> Result<Response> {
151        self.request_api(Method::POST, "/podcasts/submit",
152            &[], &[], parameters).await
153    }
154
155    /// Fetch a playlist's info and items (i.e., episodes or podcasts).
156    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-playlists-id).
157    pub async fn fetch_playlist_by_id(&self, id: &str, parameters: &Value) -> Result<Response> {
158        self.request_api(Method::GET, "/playlists/{id}",
159            &[("id", id)], &["type", "last_timestamp_ms", "sort"], parameters).await
160    }
161
162    /// Fetch a list of your playlists.
163    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-playlists).
164    pub async fn fetch_my_playlists(&self, parameters: &Value) -> Result<Response> {
165        self.request_api(Method::GET, "/playlists",
166            &[], &["sort", "page"], parameters).await
167    }
168
169    /// Fetch audience demographics for a podcast
170    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id-audience).
171    pub async fn fetch_audience_for_podcast(&self, id: &str, parameters: &Value) -> Result<Response> {
172        self.request_api(Method::GET, "/podcasts/{id}/audience",
173            &[("id", id)], &[], parameters).await
174    }
175
176    /// Fetch podcasts by a publisher's domain name
177    /// See [full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-podcasts-domains-domain_name).
178    pub async fn fetch_podcasts_by_domain(&self, domain_name: &str, parameters: &Value) -> Result<Response> {
179        self.request_api(Method::GET, "/podcasts/domains/{domain_name}",
180            &[("domain_name", domain_name)], &["page"], parameters).await
181    }
182
183    /// Create a playlist.
184    /// See [full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-playlists).
185    pub async fn create_playlist(&self, parameters: &Value) -> Result<Response> {
186        self.request_api(Method::POST, "/playlists",
187            &[], &[], parameters).await
188    }
189
190    /// Update playlist metadata.
191    /// See [full API documentation](https://www.listennotes.com/api/docs/#put-api-v2-playlists-id).
192    pub async fn update_playlist(&self, id: &str, parameters: &Value) -> Result<Response> {
193        self.request_api(Method::PUT, "/playlists/{id}",
194            &[("id", id)], &[], parameters).await
195    }
196
197    /// Delete a playlist.
198    /// See [full API documentation](https://www.listennotes.com/api/docs/#delete-api-v2-playlists-id).
199    pub async fn delete_playlist(&self, id: &str, parameters: &Value) -> Result<Response> {
200        self.request_api(Method::DELETE, "/playlists/{id}",
201            &[("id", id)], &[], parameters).await
202    }
203
204    /// Add an episode or podcast to a playlist.
205    /// See [full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-playlists-id-items).
206    pub async fn add_playlist_item(&self, id: &str, parameters: &Value) -> Result<Response> {
207        self.request_api(Method::POST, "/playlists/{id}/items",
208            &[("id", id)], &[], parameters).await
209    }
210
211    /// Remove an item from a playlist.
212    /// See [full API documentation](https://www.listennotes.com/api/docs/#delete-api-v2-playlists-id-items-item_id).
213    pub async fn delete_playlist_item(&self, id: &str, item_id: &str, parameters: &Value) -> Result<Response> {
214        self.request_api(Method::DELETE, "/playlists/{id}/items/{item_id}",
215            &[("id", id), ("item_id", item_id)], &[], parameters).await
216    }
217
218    /// Update notes for a playlist item.
219    /// See [full API documentation](https://www.listennotes.com/api/docs/#put-api-v2-playlists-id-items-item_id).
220    pub async fn update_playlist_item_notes(&self, id: &str, item_id: &str, parameters: &Value) -> Result<Response> {
221        self.request_api(Method::PUT, "/playlists/{id}/items/{item_id}",
222            &[("id", id), ("item_id", item_id)], &[], parameters).await
223    }
224
225}