@@ -85,30 +85,40 @@ PagingObjects are a container for the requested objects (`items`), but also incl
8585important information useful in future calls. It contains the request's ` limit ` and ` offset ` , along with
8686(sometimes) a link to the next and last page of items and the total number of items returned.
8787
88+ If a link to the next or previous page is provided, we can use the ` getNext ` and ` getPrevious ` methods to retrieve
89+ the respective PagingObjects
90+
8891#### Cursor-Based Paging Objects
8992A cursor-based paging object is a PagingObject with a cursor added on that can be used as a key to find the next
90- page of items
93+ page of items. The value in the cursor, ` after ` , describes after what object to begin the query.
94+
95+ Just like with PagingObjects, you can get the next page of items with ` getNext ` . * However* , there is no
96+ provided implementation of ` after ` in this library. You will need to do it yourself, if necessary.
9197
9298#### LinkedResults
9399Some endpoints, like ` PlaylistsAPI.getPlaylistTracks ` , return a LinkedResult, which is a simple wrapper around the
94100list of objects. With this, we have access to its Spotify API url (with ` href ` ), and we provide simple methods to parse
95101that url.
96102
97103### Generic Request
104+ For obvious reasons, in most cases, asynchronous requests via ` queue ` or ` queueAfter ` are preferred. However,
105+ the synchronous format is also shown.
106+
98107``` kotlin
99108 val api = SpotifyAPI .Builder (" appId" , " appSecret" ).build()
100109 val trackSearch = api.search.searchTrack(" Si t'étais là" , market = Market .FR )
101110 // with optional parameter of market
102111
103112 fun blocking () {
104113 val trackPaging = trackSearch.complete()
114+ println (trackPaging.items.map { it.name })
105115 // iterate through, see total found, etc. with the paging object..
106116 }
107117
108118 fun async () {
109119 trackSearch.queueAfter(2 , TimeUnit .SECONDS , { result ->
110- // do whatever with the result
111- // this will be executed 2000 += ~2 ms after invocation
120+ // do whatever with the result.
121+ // this will be executed 2000 +- approximately 5 ms after invocation
112122 })
113123 }
114124```
0 commit comments