Use assoc-set! to set alist value

This commit is contained in:
Ray Miller 2025-06-26 16:13:51 +00:00
parent dfa8c98779
commit 3816a547fe

View file

@ -110,7 +110,10 @@ values strings or #f, in which case the parameter is skipped."
(define* (get-paged client endpoint #:key (query '()) (post-proc identity)) (define* (get-paged client endpoint #:key (query '()) (post-proc identity))
(let ((query-params (ensure-per-page query "100"))) (let ((query-params (ensure-per-page query "100")))
(define (get-pages accum next-page) (define (get-pages accum next-page)
(let* ((body headers (api-call client http-get endpoint #:query (alist-cons 'page next-page query-params) #:post-proc post-proc #:return-headers? #t)) (let* ((body headers (api-call client http-get endpoint
#:query (assoc-set! query-params 'page next-page)
#:post-proc post-proc
#:return-headers? #t))
(accum (append accum body)) (accum (append accum body))
(next-page (assoc-ref headers 'x-next-page))) (next-page (assoc-ref headers 'x-next-page)))
(if (and (string? next-page) (> (string-length next-page) 0)) (if (and (string? next-page) (> (string-length next-page) 0))