@@ -43,7 +43,7 @@ class ArtistsAPI(api: SpotifyAPI) : SpotifyEndpoint(api) {
4343 *
4444 * @throws BadRequestException if [artistId] is not found, or filter parameters are illegal
4545 */
46- fun getArtistAlbums (artistId : String , market : Market ? = null, limit : Int = 20, offset : Int = 0, vararg include : AlbumInclusionStrategy ): SpotifyRestAction <LinkedResult <SimpleAlbum >> {
46+ fun getArtistAlbums (artistId : String , market : Market ? = null, limit : Int = 20, offset : Int = 0, include : List < AlbumInclusionStrategy > = listOf() ): SpotifyRestAction <LinkedResult <SimpleAlbum >> {
4747 return toAction(Supplier {
4848 get(" https://api.spotify.com/v1/artists/${artistId.encode()} /albums?limit=$limit &offset=$offset " +
4949 if (market != null ) " &market=${market.code} " else " " +
@@ -56,13 +56,29 @@ class ArtistsAPI(api: SpotifyAPI) : SpotifyEndpoint(api) {
5656 ALBUM (" album" ), SINGLE (" single" ), APPEARS_ON (" appears_on" ), COMPILATION (" compilation" )
5757 }
5858
59+ /* *
60+ * Get Spotify catalog information about an artist’s top tracks **by country**.
61+ * @param artistId The Spotify ID for the artist.
62+ * @param market The country ([Market]) to search. Unlike endpoints with optional Track Relinking, the Market is **not** optional.
63+ *
64+ * @throws BadRequestException if tracks are not available in the specified [Market] or the [artistId] is not found
65+ */
5966 fun getArtistTopTracks (artistId : String , market : Market ): SpotifyRestAction <List <Track >> {
6067 return toAction(Supplier {
6168 get(" https://api.spotify.com/v1/artists/${artistId.encode()} /top-tracks?country=${market.code} " ).toObject<TrackList >(api).tracks.map { it!! }
6269 })
6370
6471 }
6572
73+ /* *
74+ * Get Spotify catalog information about artists similar to a given artist.
75+ * Similarity is based on analysis of the Spotify community’s listening history.
76+ *
77+ * @param artistId The Spotify ID for the artist.
78+ *
79+ * @return List of *never-null*, but possibly empty Artist objects representing similar artists
80+ * @throws BadRequestException if the [artistId] is not found
81+ */
6682 fun getRelatedArtists (artistId : String ): SpotifyRestAction <List <Artist >> {
6783 return toAction(Supplier {
6884 get(" https://api.spotify.com/v1/artists/${artistId.encode()} /related-artists" ).toObject<ArtistList >(api).artists.map { it!! }
0 commit comments