66 "fmt"
77 "net/http"
88 "net/url"
9- "strings"
109)
1110
1211// HTTPClient is the client interface
@@ -19,8 +18,8 @@ type HTTPClient interface {
1918 FetchBestPodcasts (args map [string ]string ) (* Response , error )
2019 FetchPodcastByID (id string , args map [string ]string ) (* Response , error )
2120 FetchEpisodeByID (id string , args map [string ]string ) (* Response , error )
22- BatchFetchEpisodes (ids [] string , args map [string ]string ) (* Response , error )
23- BatchFetchPodcasts (ids [] string , args map [string ]string ) (* Response , error )
21+ BatchFetchEpisodes (args map [string ]string ) (* Response , error )
22+ BatchFetchPodcasts (args map [string ]string ) (* Response , error )
2423 FetchCuratedPodcastsListByID (id string , args map [string ]string ) (* Response , error )
2524 FetchPodcastGenres (args map [string ]string ) (* Response , error )
2625 FetchPodcastRegions (args map [string ]string ) (* Response , error )
@@ -98,16 +97,20 @@ func (c *standardHTTPClient) FetchEpisodeByID(id string, args map[string]string)
9897 return c .get (fmt .Sprintf ("episodes/%s" , id ), args )
9998}
10099
101- func (c * standardHTTPClient ) BatchFetchEpisodes (ids []string , args map [string ]string ) (* Response , error ) {
102- return c .post ("episodes" , args , url.Values {
103- "ids" : []string {strings .Join (ids , "," )},
104- })
100+ func (c * standardHTTPClient ) BatchFetchEpisodes (args map [string ]string ) (* Response , error ) {
101+ values := url.Values {}
102+ for k , v := range args {
103+ values .Set (k , v )
104+ }
105+ return c .post ("episodes" , args , values )
105106}
106107
107- func (c * standardHTTPClient ) BatchFetchPodcasts (ids []string , args map [string ]string ) (* Response , error ) {
108- return c .post ("podcasts" , args , url.Values {
109- "ids" : []string {strings .Join (ids , "," )},
110- })
108+ func (c * standardHTTPClient ) BatchFetchPodcasts (args map [string ]string ) (* Response , error ) {
109+ values := url.Values {}
110+ for k , v := range args {
111+ values .Set (k , v )
112+ }
113+ return c .post ("podcasts" , args , values )
111114}
112115
113116func (c * standardHTTPClient ) FetchCuratedPodcastsListByID (id string , args map [string ]string ) (* Response , error ) {
0 commit comments