Created
January 21, 2022 10:16
-
-
Save ivarref/41d4914b1ec3936ad83e0ed9a9c8517d 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 iterate-gql-connection [{:keys [api-url token]} query variables] | |
(->> (iteration | |
(fn [after] | |
(some->> (client/post api-url {:content-type :json | |
:accept :json | |
:as :json | |
:headers {"authorization" (str "Bearer " token)} | |
:form-params {:query query | |
:variables (merge variables {:after after})}}) | |
:body | |
:data | |
(vals) | |
(first) | |
:edges)) | |
:some? not-empty | |
:vf (partial map :node) | |
:kf (comp :cursor last) | |
:initk nil) | |
(mapcat identity))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment