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
144144``` kotlin
145145val token = spotifyAppApi(spotifyClientId, spotifyClientSecret).build().token
146146val 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+
154154println (api.browse.getNewReleases()) // use it
155155```
156156
@@ -228,11 +228,11 @@ val api = spotifyClientPkceApi(
228228 " clientId" , // optional. include for token refresh
229229 " your-redirect-uri" , // optional. include for token refresh
230230 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+
236236println (api.library.getSavedTracks().take(10 ).filterNotNull().map { it.track.name })
237237```
238238
@@ -277,13 +277,12 @@ val api = spotifyClientApi(
277277 " clientId" ,
278278 " clientSecret" ,
279279 " 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()
287286println (api.personalization.getTopTracks(limit = 5 ).items.map { it.name })
288287```
289288
You can’t perform that action at this time.
0 commit comments