@@ -17,6 +17,7 @@ import com.adamratzman.spotify.models.serialization.toObject
17
17
import com.adamratzman.spotify.utils.Market
18
18
import com.adamratzman.spotify.utils.catch
19
19
import com.adamratzman.spotify.utils.encodeUrl
20
+ import com.adamratzman.spotify.utils.getSpotifyId
20
21
21
22
/* *
22
23
* Endpoints for retrieving information about one or more shows and their episodes from the Spotify catalog.
@@ -42,7 +43,7 @@ public open class ShowApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
42
43
public suspend fun getShow (id : String , market : Market ): Show ? {
43
44
return catch {
44
45
get(
45
- endpointBuilder(" /shows/${ShowUri (id).id.encodeUrl()} " ).with (" market" , market.name ).toString()
46
+ endpointBuilder(" /shows/${ShowUri (id).id.encodeUrl()} " ).with (" market" , market.getSpotifyId() ).toString()
46
47
).toObject(Show .serializer(), api, json)
47
48
}
48
49
}
@@ -70,7 +71,7 @@ public open class ShowApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
70
71
return bulkStatelessRequest(50 , ids.toList()) { chunk ->
71
72
get(
72
73
endpointBuilder(" /shows" ).with (" ids" , chunk.joinToString(" ," ) { ShowUri (it).id.encodeUrl() })
73
- .with (" market" , market.name ).toString()
74
+ .with (" market" , market.getSpotifyId() ).toString()
74
75
).toObject(ShowList .serializer(), api, json).shows
75
76
}.flatten()
76
77
}
@@ -99,6 +100,6 @@ public open class ShowApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
99
100
market : Market
100
101
): PagingObject <SimpleEpisode > = get(
101
102
endpointBuilder(" /shows/${ShowUri (id).id.encodeUrl()} /episodes" ).with (" limit" , limit)
102
- .with (" offset" , offset).with (" market" , market.name ).toString()
103
+ .with (" offset" , offset).with (" market" , market.getSpotifyId() ).toString()
103
104
).toNonNullablePagingObject(SimpleEpisode .serializer(), null , api, json)
104
105
}
0 commit comments