File tree Expand file tree Collapse file tree 1 file changed +18
-19
lines changed Expand file tree Collapse file tree 1 file changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -144,13 +144,13 @@ Example creation, using an existing Token and setting automatic token refresh to
144
144
``` kotlin
145
145
val token = spotifyAppApi(spotifyClientId, spotifyClientSecret).build().token
146
146
val api = spotifyAppApi(
147
- " clientId" ,
148
- " clientSecret" ,
149
- token,
150
- SpotifyApiOptionsBuilder (
151
- automaticRefresh = false
152
- )
153
- )
147
+ " clientId" ,
148
+ " clientSecret" ,
149
+ token
150
+ ) {
151
+ automaticRefresh = false
152
+ }.build( )
153
+
154
154
println (api.browse.getNewReleases()) // use it
155
155
```
156
156
@@ -228,11 +228,11 @@ val api = spotifyClientPkceApi(
228
228
" clientId" , // optional. include for token refresh
229
229
" your-redirect-uri" , // optional. include for token refresh
230
230
code,
231
- codeVerifier, // the same code verifier you used to generate the code challenge
232
- SpotifyApiOptionsBuilder (
233
- retryWhenRateLimited = false
234
- )
235
- ).build()
231
+ codeVerifier // the same code verifier you used to generate the code challenge
232
+ ) {
233
+ retryWhenRateLimited = false
234
+ }.build( )
235
+
236
236
println (api.library.getSavedTracks().take(10 ).filterNotNull().map { it.track.name })
237
237
```
238
238
@@ -277,13 +277,12 @@ val api = spotifyClientApi(
277
277
" clientId" ,
278
278
" clientSecret" ,
279
279
" your-redirect-uri" ,
280
- token,
281
- SpotifyApiOptionsBuilder (
282
- onTokenRefresh = {
283
- println (" Token refreshed at ${System .currentTimeMillis()} " )
284
- }
285
- )
286
- ).build()
280
+ token
281
+ ) {
282
+ onTokenRefresh = {
283
+ println (" Token refreshed at ${System .currentTimeMillis()} " )
284
+ }
285
+ }.build()
287
286
println (api.personalization.getTopTracks(limit = 5 ).items.map { it.name })
288
287
```
289
288
You can’t perform that action at this time.
0 commit comments