Repository navigation
Expand file tree
/
Copy pathapi_methods.go
More file actions
225 lines (192 loc) · 12.7 KB
/
Copy pathapi_methods.go
File metadata and controls
225 lines (192 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// Code generated by listennotes/devtools/api-sdks/sync.py go. DO NOT EDIT.
package listennotes
import "net/http"
// HTTPClient exposes the supported Listen API operations.
type HTTPClient interface {
Search(args map[string]string) (*Response, error)
Typeahead(args map[string]string) (*Response, error)
SearchEpisodeTitles(args map[string]string) (*Response, error)
SpellCheck(args map[string]string) (*Response, error)
FetchRelatedSearches(args map[string]string) (*Response, error)
FetchTrendingSearches(args map[string]string) (*Response, error)
FetchBestPodcasts(args map[string]string) (*Response, error)
FetchPodcastByID(id string, args map[string]string) (*Response, error)
DeletePodcast(id string, args map[string]string) (*Response, error)
FetchEpisodeByID(id string, args map[string]string) (*Response, error)
BatchFetchEpisodes(args map[string]string) (*Response, error)
BatchFetchPodcasts(args map[string]string) (*Response, error)
FetchCuratedPodcastsListByID(id string, args map[string]string) (*Response, error)
FetchPodcastGenres(args map[string]string) (*Response, error)
FetchPodcastRegions(args map[string]string) (*Response, error)
FetchPodcastLanguages(args map[string]string) (*Response, error)
JustListen(args map[string]string) (*Response, error)
FetchCuratedPodcastsLists(args map[string]string) (*Response, error)
FetchRecommendationsForPodcast(id string, args map[string]string) (*Response, error)
FetchRecommendationsForEpisode(id string, args map[string]string) (*Response, error)
SubmitPodcast(args map[string]string) (*Response, error)
FetchPlaylistByID(id string, args map[string]string) (*Response, error)
FetchMyPlaylists(args map[string]string) (*Response, error)
FetchAudienceForPodcast(id string, args map[string]string) (*Response, error)
FetchPodcastsByDomain(domainName string, args map[string]string) (*Response, error)
CreatePlaylist(args map[string]string) (*Response, error)
UpdatePlaylist(id string, args map[string]string) (*Response, error)
DeletePlaylist(id string, args map[string]string) (*Response, error)
AddPlaylistItem(id string, args map[string]string) (*Response, error)
DeletePlaylistItem(id string, itemID string, args map[string]string) (*Response, error)
UpdatePlaylistItemNotes(id string, itemID string, args map[string]string) (*Response, error)
}
// Search: Full-text search
// See https://www.listennotes.com/api/docs/#get-api-v2-search.
func (c *standardHTTPClient) Search(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/search", nil, []string{"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"}, args)
}
// Typeahead: Typeahead search
// See https://www.listennotes.com/api/docs/#get-api-v2-typeahead.
func (c *standardHTTPClient) Typeahead(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/typeahead", nil, []string{"q", "show_podcasts", "show_genres", "safe_mode"}, args)
}
// SearchEpisodeTitles: Find individual episodes by searching for their titles
// See https://www.listennotes.com/api/docs/#get-api-v2-search_episode_titles.
func (c *standardHTTPClient) SearchEpisodeTitles(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/search_episode_titles", nil, []string{"q", "podcast_id", "podcast_id_type"}, args)
}
// SpellCheck: Spell check on a search term
// See https://www.listennotes.com/api/docs/#get-api-v2-spellcheck.
func (c *standardHTTPClient) SpellCheck(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/spellcheck", nil, []string{"q"}, args)
}
// FetchRelatedSearches: Fetch related search terms
// See https://www.listennotes.com/api/docs/#get-api-v2-related_searches.
func (c *standardHTTPClient) FetchRelatedSearches(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/related_searches", nil, []string{"q"}, args)
}
// FetchTrendingSearches: Fetch trending search terms
// See https://www.listennotes.com/api/docs/#get-api-v2-trending_searches.
func (c *standardHTTPClient) FetchTrendingSearches(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/trending_searches", nil, nil, args)
}
// FetchBestPodcasts: Fetch a list of best podcasts by genre
// See https://www.listennotes.com/api/docs/#get-api-v2-best_podcasts.
func (c *standardHTTPClient) FetchBestPodcasts(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/best_podcasts", nil, []string{"genre_id", "page", "region", "publisher_region", "language", "sort", "safe_mode"}, args)
}
// FetchPodcastByID: Fetch detailed meta data and episodes for a podcast by id
// See https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id.
func (c *standardHTTPClient) FetchPodcastByID(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/podcasts/{id}", []pathParam{{"id", id}}, []string{"next_episode_pub_date", "sort"}, args)
}
// DeletePodcast: Request to delete a podcast
// See https://www.listennotes.com/api/docs/#delete-api-v2-podcasts-id.
func (c *standardHTTPClient) DeletePodcast(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodDelete, "/podcasts/{id}", []pathParam{{"id", id}}, []string{"reason"}, args)
}
// FetchEpisodeByID: Fetch detailed meta data for an episode by id
// See https://www.listennotes.com/api/docs/#get-api-v2-episodes-id.
func (c *standardHTTPClient) FetchEpisodeByID(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/episodes/{id}", []pathParam{{"id", id}}, []string{"show_transcript"}, args)
}
// BatchFetchEpisodes: Batch fetch basic meta data for episodes
// See https://www.listennotes.com/api/docs/#post-api-v2-episodes.
func (c *standardHTTPClient) BatchFetchEpisodes(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPost, "/episodes", nil, nil, args)
}
// BatchFetchPodcasts: Batch fetch basic meta data for podcasts
// See https://www.listennotes.com/api/docs/#post-api-v2-podcasts.
func (c *standardHTTPClient) BatchFetchPodcasts(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPost, "/podcasts", nil, nil, args)
}
// FetchCuratedPodcastsListByID: Fetch a curated list of podcasts by id
// See https://www.listennotes.com/api/docs/#get-api-v2-curated_podcasts-id.
func (c *standardHTTPClient) FetchCuratedPodcastsListByID(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/curated_podcasts/{id}", []pathParam{{"id", id}}, nil, args)
}
// FetchPodcastGenres: Fetch a list of podcast genres
// See https://www.listennotes.com/api/docs/#get-api-v2-genres.
func (c *standardHTTPClient) FetchPodcastGenres(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/genres", nil, []string{"top_level_only"}, args)
}
// FetchPodcastRegions: Fetch a list of supported countries/regions for best podcasts
// See https://www.listennotes.com/api/docs/#get-api-v2-regions.
func (c *standardHTTPClient) FetchPodcastRegions(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/regions", nil, nil, args)
}
// FetchPodcastLanguages: Fetch a list of supported languages for podcasts
// See https://www.listennotes.com/api/docs/#get-api-v2-languages.
func (c *standardHTTPClient) FetchPodcastLanguages(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/languages", nil, nil, args)
}
// JustListen: Fetch a random podcast episode
// See https://www.listennotes.com/api/docs/#get-api-v2-just_listen.
func (c *standardHTTPClient) JustListen(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/just_listen", nil, nil, args)
}
// FetchCuratedPodcastsLists: Fetch curated lists of podcasts
// See https://www.listennotes.com/api/docs/#get-api-v2-curated_podcasts.
func (c *standardHTTPClient) FetchCuratedPodcastsLists(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/curated_podcasts", nil, []string{"page"}, args)
}
// FetchRecommendationsForPodcast: Fetch recommendations for a podcast
// See https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id-recommendations.
func (c *standardHTTPClient) FetchRecommendationsForPodcast(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/podcasts/{id}/recommendations", []pathParam{{"id", id}}, []string{"safe_mode"}, args)
}
// FetchRecommendationsForEpisode: Fetch recommendations for an episode
// See https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-recommendations.
func (c *standardHTTPClient) FetchRecommendationsForEpisode(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/episodes/{id}/recommendations", []pathParam{{"id", id}}, []string{"safe_mode"}, args)
}
// SubmitPodcast: Submit a podcast to Listen Notes database
// See https://www.listennotes.com/api/docs/#post-api-v2-podcasts-submit.
func (c *standardHTTPClient) SubmitPodcast(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPost, "/podcasts/submit", nil, nil, args)
}
// FetchPlaylistByID: Fetch a playlist's info and items (i.e., episodes or podcasts).
// See https://www.listennotes.com/api/docs/#get-api-v2-playlists-id.
func (c *standardHTTPClient) FetchPlaylistByID(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/playlists/{id}", []pathParam{{"id", id}}, []string{"type", "last_timestamp_ms", "sort"}, args)
}
// FetchMyPlaylists: Fetch a list of your playlists.
// See https://www.listennotes.com/api/docs/#get-api-v2-playlists.
func (c *standardHTTPClient) FetchMyPlaylists(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/playlists", nil, []string{"sort", "page"}, args)
}
// FetchAudienceForPodcast: Fetch audience demographics for a podcast
// See https://www.listennotes.com/api/docs/#get-api-v2-podcasts-id-audience.
func (c *standardHTTPClient) FetchAudienceForPodcast(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/podcasts/{id}/audience", []pathParam{{"id", id}}, nil, args)
}
// FetchPodcastsByDomain: Fetch podcasts by a publisher's domain name
// See https://www.listennotes.com/api/docs/#get-api-v2-podcasts-domains-domain_name.
func (c *standardHTTPClient) FetchPodcastsByDomain(domainName string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodGet, "/podcasts/domains/{domain_name}", []pathParam{{"domain_name", domainName}}, []string{"page"}, args)
}
// CreatePlaylist: Create a playlist.
// See https://www.listennotes.com/api/docs/#post-api-v2-playlists.
func (c *standardHTTPClient) CreatePlaylist(args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPost, "/playlists", nil, nil, args)
}
// UpdatePlaylist: Update playlist metadata.
// See https://www.listennotes.com/api/docs/#put-api-v2-playlists-id.
func (c *standardHTTPClient) UpdatePlaylist(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPut, "/playlists/{id}", []pathParam{{"id", id}}, nil, args)
}
// DeletePlaylist: Delete a playlist.
// See https://www.listennotes.com/api/docs/#delete-api-v2-playlists-id.
func (c *standardHTTPClient) DeletePlaylist(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodDelete, "/playlists/{id}", []pathParam{{"id", id}}, nil, args)
}
// AddPlaylistItem: Add an episode or podcast to a playlist.
// See https://www.listennotes.com/api/docs/#post-api-v2-playlists-id-items.
func (c *standardHTTPClient) AddPlaylistItem(id string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPost, "/playlists/{id}/items", []pathParam{{"id", id}}, nil, args)
}
// DeletePlaylistItem: Remove an item from a playlist.
// See https://www.listennotes.com/api/docs/#delete-api-v2-playlists-id-items-item_id.
func (c *standardHTTPClient) DeletePlaylistItem(id string, itemID string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodDelete, "/playlists/{id}/items/{item_id}", []pathParam{{"id", id}, {"item_id", itemID}}, nil, args)
}
// UpdatePlaylistItemNotes: Update notes for a playlist item.
// See https://www.listennotes.com/api/docs/#put-api-v2-playlists-id-items-item_id.
func (c *standardHTTPClient) UpdatePlaylistItemNotes(id string, itemID string, args map[string]string) (*Response, error) {
return c.requestAPI(http.MethodPut, "/playlists/{id}/items/{item_id}", []pathParam{{"id", id}, {"item_id", itemID}}, nil, args)
}