From 9dd02e1f9112c1bae3f86da0fa23a94da5b91c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 24 Jan 2026 21:39:53 +0100 Subject: [PATCH] teams: Correctly handle more than 50 teams. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page size limit for GET requests on /api/v1/orgs/guix/teams is 50. Thus, ‘organization-teams’ was previously reporting at most 50 teams, even though there are now 52 of them. This patch fixes that. * etc/teams.scm (organization-teams): Rename to… (organization-teams/paginated): … this. Add ‘page’ parameter and honor it. Remove “limit” URL parameter. (organization-teams): New procedure. Fixes: guix/guix#5833 Reported-by: Maxim Cournoyer Change-Id: Ia25685e001e8522ca4268557ade7d29b5106ae00 Signed-off-by: Ludovic Courtès Merges: #5883 --- etc/teams.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/etc/teams.scm b/etc/teams.scm index 1650286c42..5e5d5643ed 100755 --- a/etc/teams.scm +++ b/etc/teams.scm @@ -285,14 +285,25 @@ PARAMETERS." ;; API documentation at . -(define-forgejo-request (organization-teams organization) - "Return the list of teams of ORGANIZATION." +(define-forgejo-request (organization-teams/paginated organization page) + "Return the list of teams of ORGANIZATION, for the given PAGE (1-indexed)." (GET "orgs" organization "teams" - & '(("limit" . "100"))) ;get up to 100 teams + & `(("page" . ,(number->string page)))) => 200 (lambda (port) (map json->forgejo-team (vector->list (json->scm port))))) +(define (organization-teams token organization) + "Return the list of teams of ORGANIZATION." + (let loop ((index 1) + (pages '())) + (match (organization-teams/paginated token organization index) + (() + (concatenate (reverse pages))) + (lst + (loop (+ 1 index) + (cons lst pages)))))) + (define-forgejo-request (create-team organization team) "Create TEAM, a Forgejo team, under ORGANIZATION." (POST "orgs" organization "teams")