me
/
guix
Archived
1
0
Fork 0

swh: ‘origin-visits’ takes an optional ‘max’ parameter.

* guix/swh.scm (origin-visits): Add optional ‘max’ parameter and honor
it.

Change-Id: I642d7d4b0672b68fb5c7ce2b49161307e13d3c95
master
Ludovic Courtès 2024-02-20 14:38:23 +01:00
parent a813d6890b
commit ed9d7d8431
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 5 additions and 4 deletions

View File

@ -474,10 +474,11 @@ and use of ALGORITHM."
hash) hash)
external-id-target)) external-id-target))
(define (origin-visits origin) (define* (origin-visits origin #:optional (max 10))
"Return the list of visits of ORIGIN, a record as returned by "Return the list of the up to MAX latest visits of ORIGIN, a record as
'lookup-origin'." returned by 'lookup-origin'."
(call (swh-url (origin-visits-url origin)) (call (string-append (swh-url (origin-visits-url origin))
"?per_page=" (number->string max))
(lambda (port) (lambda (port)
(map json->visit (vector->list (json->scm port)))))) (map json->visit (vector->list (json->scm port))))))