@@ -28,7 +28,7 @@ repositories {
28
28
jcenter()
29
29
}
30
30
31
- compile group: 'com.adamratzman', name: 'spotify-api-kotlin', version: '2.3.08 '
31
+ compile group: 'com.adamratzman', name: 'spotify-api-kotlin', version: '3.0.0 '
32
32
```
33
33
34
34
To use the latest snapshot instead, you must add the Jitpack repository as well
@@ -50,7 +50,7 @@ dependencies {
50
50
<dependency>
51
51
<groupId>com.adamratzman</groupId>
52
52
<artifactId>spotify-api-kotlin</artifactId>
53
- <version>2.3.08 </version>
53
+ <version>3.0.0 </version>
54
54
</dependency>
55
55
56
56
<repository>
@@ -79,12 +79,12 @@ To build a new `SpotifyAPI`, you must pass the application id and secret.
79
79
import com.adamratzman.spotify.SpotifyScope
80
80
import com.adamratzman.spotify.spotifyApi
81
81
82
- spotifyApi {
82
+ val spotifyApi: SpotifyAPI = spotifyAppApi {
83
83
credentials {
84
84
clientId = " YOUR_CLIENT_ID"
85
85
clientSecret = " YOUR_CLIENT_SECRET"
86
86
}
87
- }.buildCredentialed ()
87
+ }.build ()
88
88
```
89
89
* Note:* You are ** unable** to use any client endpoint without authenticating with the methods below.
90
90
@@ -97,7 +97,7 @@ an authorization code or a `Token` object. Otherwise, it will expire `Token.expi
97
97
You have two options when building the Client API.
98
98
1 . You can use [ Implicit Grant access tokens] ( https://developer.spotify.com/web-api/authorization-guide/#implicit_grant_flow ) by
99
99
setting the value of ` tokenString ` in the builder ` authentication ` block. However, this is a one-time token that cannot be refreshed.
100
- 2 . You can use the [ Authorization code flow] ( https://developer.spotify.com/web-api/authorization-guide/#authorization_code_flow ) by
100
+ 2 . You can use the [ Authorization code flow] ( https://developer.spotify.com/web-api/authorization-guide/#authorization_code_flow ) by
101
101
setting the value of ` authorizationCode ` in a builder. You may generate an authentication flow url allowing you to request specific
102
102
Spotify scopes using the ` getAuthorizationUrl ` method in any builder. This library does not provide a method to retrieve the code from your
103
103
callback URL; you must implement that with a web server.
@@ -156,18 +156,18 @@ the synchronous format is also shown.
156
156
import com.adamratzman.spotify.SpotifyScope
157
157
import com.adamratzman.spotify.spotifyApi
158
158
159
- val api = spotifyApi {
159
+ val api: SpotifyAPI = spotifyAppApi {
160
160
credentials {
161
161
clientId = " YOUR_CLIENT_ID"
162
162
clientSecret = " YOUR_CLIENT_SECRET"
163
163
}
164
- }.buildCredentialed ()
164
+ }.build ()
165
165
166
166
// block and print out the names of the twenty most similar songs to the search
167
- println (api.search.searchTrack(" Début de la Suite" ).complete().map { it.name }.joinToString() )
167
+ println (api.search.searchTrack(" Début de la Suite" ).complete().joinToString { it.name })
168
168
169
169
// now, let's do it asynchronously
170
- api.search.searchTrack(" Début de la Suite" ).queue { println (it.map { it .name }.joinToString() ) }
170
+ api.search.searchTrack(" Début de la Suite" ).queue { tracks -> println (tracks.joinToString { track -> track .name }) }
171
171
172
172
// simple, right? what about if we want to print out the featured playlists message from the "Overview" tab?
173
173
println (api.browse.getFeaturedPlaylists().complete().message)
@@ -176,6 +176,7 @@ println(api.browse.getFeaturedPlaylists().complete().message)
176
176
// let's find out Bénabar's Spotify ID, find his top tracks, and print them out
177
177
178
178
val benabarId = api.search.searchArtist(" Bénabar" ).complete()[0 ].id
179
+ // this works, but a better way would be: api.artists.getArtist("spotify:artist:6xoAWsIOZxJVPpo7Qvqaqv").complete().id
179
180
180
181
println (api.artists.getArtistTopTracks(benabarId).complete().joinToString { it.name })
181
182
```
@@ -189,7 +190,7 @@ In both Track and SimpleTrack objects in an endpoint response, there is a nullab
189
190
If the track is unable to be played in the specified market and there is an alternative that * is* playable, this
190
191
will be populated with the href, uri, and, most importantly, the id of the track.
191
192
192
- You can then use this track in ` SpotifyClientAPI ` actions such as playing or saving the track, knowing that it will be playable
193
+ You can then use this track in ` SpotifyClientAPI ` endpoints such as playing or saving the track, knowing that it will be playable
193
194
in your market!
194
195
195
196
### Contributing
0 commit comments