Created
April 4, 2022 20:20
-
-
Save kennyjwilli/2be42fbf7172907cf5f1d479627d1578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn json-api-iteration | |
"Returns a reducible to iterate through a JSON API pagination compliant API. | |
`request!` is a function of a URI string, expected to return a JSON API response. | |
`uri` is the statring URI for the paginated endpoint." | |
[request! uri] | |
(pages/iteration request! | |
:initk uri | |
:vf #(get-in % [:body "data"]) | |
:kf #(get-in % [:body "links" "next"]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment