@@ -19,9 +19,9 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
1919 *
2020 * @throws BadRequestException if [userId] is a non-existing id
2121 */
22- fun isFollowingUser (userId : String ): SpotifyRestAction <Boolean > {
22+ fun isFollowingUser (user : String ): SpotifyRestAction <Boolean > {
2323 return toAction(Supplier {
24- isFollowingUsers(userId ).complete()[0 ]
24+ isFollowingUsers(user ).complete()[0 ]
2525 })
2626 }
2727
@@ -46,10 +46,10 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
4646 *
4747 * @throws BadRequestException if [userIds] contains a non-existing id
4848 */
49- fun isFollowingUsers (vararg userIds : String ): SpotifyRestAction <List <Boolean >> {
49+ fun isFollowingUsers (vararg users : String ): SpotifyRestAction <List <Boolean >> {
5050 return toAction(Supplier {
5151 get(EndpointBuilder (" /me/following/contains" ).with (" type" , " user" )
52- .with (" ids" , userIds .joinToString(" ," ) { it .encode() }).toString()).toObject(api, mutableListOf<Boolean >().javaClass).toList()
52+ .with (" ids" , users .joinToString(" ," ) { UserURI (it).id .encode() }).toString()).toObject(api, mutableListOf<Boolean >().javaClass).toList()
5353 })
5454 }
5555
@@ -60,9 +60,9 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
6060 *
6161 * @throws BadRequestException if [artistId] is a non-existing id
6262 */
63- fun isFollowingArtist (artistId : String ): SpotifyRestAction <Boolean > {
63+ fun isFollowingArtist (artist : String ): SpotifyRestAction <Boolean > {
6464 return toAction(Supplier {
65- isFollowingArtists(artistId ).complete()[0 ]
65+ isFollowingArtists(artist ).complete()[0 ]
6666 })
6767 }
6868
@@ -73,10 +73,10 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
7373 *
7474 * @throws BadRequestException if [artistIds] contains a non-existing id
7575 */
76- fun isFollowingArtists (vararg artistIds : String ): SpotifyRestAction <List <Boolean >> {
76+ fun isFollowingArtists (vararg artists : String ): SpotifyRestAction <List <Boolean >> {
7777 return toAction(Supplier {
7878 get(EndpointBuilder (" /me/following/contains" ).with (" type" , " artist" )
79- .with (" ids" , artistIds .joinToString(" ," ) { it .encode() }).toString()).toObject(api, mutableListOf<Boolean >().javaClass).toList()
79+ .with (" ids" , artists .joinToString(" ," ) { ArtistURI (it).id .encode() }).toString()).toObject(api, mutableListOf<Boolean >().javaClass).toList()
8080 })
8181 }
8282
@@ -100,9 +100,9 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
100100 *
101101 * @throws BadRequestException if an invalid id is provided
102102 */
103- fun followUser (userId : String ): SpotifyRestAction <Unit > {
103+ fun followUser (user : String ): SpotifyRestAction <Unit > {
104104 return toAction(Supplier {
105- followUsers(userId ).complete()
105+ followUsers(user ).complete()
106106 })
107107 }
108108
@@ -111,10 +111,10 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
111111 *
112112 * @throws BadRequestException if an invalid id is provided
113113 */
114- fun followUsers (vararg userIds : String ): SpotifyRestAction <Unit > {
114+ fun followUsers (vararg users : String ): SpotifyRestAction <Unit > {
115115 return toAction(Supplier {
116116 put(EndpointBuilder (" /me/following" ).with (" type" , " user" )
117- .with (" ids" , userIds .joinToString(" ," ) { it .encode() }).toString())
117+ .with (" ids" , users .joinToString(" ," ) { UserURI (it).id .encode() }).toString())
118118 Unit
119119 })
120120 }
@@ -135,28 +135,27 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
135135 *
136136 * @throws BadRequestException if an invalid id is provided
137137 */
138- fun followArtists (vararg artistIds : String ): SpotifyRestAction <Unit > {
138+ fun followArtists (vararg artists : String ): SpotifyRestAction <Unit > {
139139 return toAction(Supplier {
140140 put(EndpointBuilder (" /me/following" ).with (" type" , " artist" )
141- .with (" ids" , artistIds .joinToString(" ," ) { it .encode() }).toString())
141+ .with (" ids" , artists .joinToString(" ," ) { ArtistURI (it).id .encode() }).toString())
142142 Unit
143143 })
144144 }
145145
146146 /* *
147147 * Add the current user as a follower of a playlist.
148148 *
149- * @param ownerId The Spotify user ID of the person who owns the playlist.
150- * @param playlistId The Spotify ID of the playlist. Any playlist can be followed, regardless of its
149+ * @param playlist The Spotify ID of the playlist. Any playlist can be followed, regardless of its
151150 * public/private status, as long as you know its playlist ID.
152151 * @param followPublicly Defaults to true. If true the playlist will be included in user’s public playlists,
153152 * if false it will remain private. To be able to follow playlists privately, the user must have granted the playlist-modify-private scope.
154153 *
155154 * @throws BadRequestException if the playlist is not found
156155 */
157- fun followPlaylist (playlistId : String , followPublicly : Boolean = true): SpotifyRestAction <Unit > {
156+ fun followPlaylist (playlist : String , followPublicly : Boolean = true): SpotifyRestAction <Unit > {
158157 return toAction(Supplier {
159- put(EndpointBuilder (" /playlists/$playlistId /followers" ).toString(), " {\" public\" : $followPublicly }" )
158+ put(EndpointBuilder (" /playlists/${ PlaylistURI (playlist).id} /followers" ).toString(), " {\" public\" : $followPublicly }" )
160159 Unit
161160 })
162161
@@ -169,9 +168,9 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
169168 *
170169 * @throws BadRequestException if [userId] is not found
171170 */
172- fun unfollowUser (userId : String ): SpotifyRestAction <Unit > {
171+ fun unfollowUser (user : String ): SpotifyRestAction <Unit > {
173172 return toAction(Supplier {
174- unfollowUsers(userId ).complete()
173+ unfollowUsers(user ).complete()
175174 })
176175 }
177176
@@ -182,10 +181,10 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
182181 *
183182 * @throws BadRequestException if an invalid id is provided
184183 */
185- fun unfollowUsers (vararg userIds : String ): SpotifyRestAction <Unit > {
184+ fun unfollowUsers (vararg users : String ): SpotifyRestAction <Unit > {
186185 return toAction(Supplier {
187186 delete(EndpointBuilder (" /me/following" ).with (" type" , " user" )
188- .with (" ids" , userIds .joinToString(" ," ) { it .encode() }).toString())
187+ .with (" ids" , users .joinToString(" ," ) { UserURI (it).id .encode() }).toString())
189188 Unit
190189 })
191190 }
@@ -197,9 +196,9 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
197196 *
198197 * @throws BadRequestException if an invalid id is provided
199198 */
200- fun unfollowArtist (artistId : String ): SpotifyRestAction <Unit > {
199+ fun unfollowArtist (artist : String ): SpotifyRestAction <Unit > {
201200 return toAction(Supplier {
202- unfollowArtists(artistId ).complete()
201+ unfollowArtists(artist ).complete()
203202 })
204203 }
205204
@@ -210,26 +209,25 @@ class ClientFollowingAPI(api: SpotifyAPI) : FollowingAPI(api) {
210209 *
211210 * @throws BadRequestException if an invalid id is provided
212211 */
213- fun unfollowArtists (vararg artistIds : String ): SpotifyRestAction <Unit > {
212+ fun unfollowArtists (vararg artists : String ): SpotifyRestAction <Unit > {
214213 return toAction(Supplier {
215214 delete(EndpointBuilder (" /me/following" ).with (" type" , " artist" )
216- .with (" ids" , artistIds .joinToString(" ," ) { it .encode() }).toString())
215+ .with (" ids" , artists .joinToString(" ," ) { ArtistURI (it).id .encode() }).toString())
217216 Unit
218217 })
219218 }
220219
221220 /* *
222221 * Remove the current user as a follower of a playlist.
223222 *
224- * @param ownerId The Spotify user ID of the person who owns the playlist.
225223 * @param playlistId The Spotify ID of the playlist that is to be no longer followed.
226224 *
227225 * @throws BadRequestException if the playlist is not found
228226 */
229- fun unfollowPlaylist (playlistId : String ): SpotifyRestAction <Unit > {
227+ fun unfollowPlaylist (playlist : String ): SpotifyRestAction <Unit > {
230228 return toAction(Supplier {
231- delete(EndpointBuilder (" /playlists/$playlistId /followers" ).toString())
229+ delete(EndpointBuilder (" /playlists/${ PlaylistURI (playlist).id} /followers" ).toString())
232230 Unit
233231 })
234232 }
235- }
233+ }
0 commit comments