From ed9d7d84314d4bea1ff610420cf09f79d9d82719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 20 Feb 2024 14:38:23 +0100 Subject: [PATCH] =?UTF-8?q?swh:=20=E2=80=98origin-visits=E2=80=99=20takes?= =?UTF-8?q?=20an=20optional=20=E2=80=98max=E2=80=99=20parameter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/swh.scm (origin-visits): Add optional ‘max’ parameter and honor it. Change-Id: I642d7d4b0672b68fb5c7ce2b49161307e13d3c95 --- guix/swh.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guix/swh.scm b/guix/swh.scm index 83f67423c8be604199e03234dd6dfb04a529b451..14c65f6806905e0c0c2a91709be38bcd2e740e76 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -474,10 +474,11 @@ and use of ALGORITHM." hash) external-id-target)) -(define (origin-visits origin) - "Return the list of visits of ORIGIN, a record as returned by -'lookup-origin'." - (call (swh-url (origin-visits-url origin)) +(define* (origin-visits origin #:optional (max 10)) + "Return the list of the up to MAX latest visits of ORIGIN, a record as +returned by 'lookup-origin'." + (call (string-append (swh-url (origin-visits-url origin)) + "?per_page=" (number->string max)) (lambda (port) (map json->visit (vector->list (json->scm port))))))