Fixup guix packaging

This commit is contained in:
2024-06-09 14:16:37 -04:00
parent 742b271a69
commit 8bc873ba41
7 changed files with 30 additions and 27 deletions

20
src/metalapi/project.scm Normal file
View File

@@ -0,0 +1,20 @@
(define-module (metalapi project)
#:use-module (metalapi requests)
#:export (list-all-projects
build-project
project->id
project->organization))
(define (list-all-projects)
(handle-pagination "/projects?exclude=devices,memberships,members" "projects" build-project))
(define (build-project project-alist)
(extract-attrs project-alist "id" "name"))
(define (project->id project)
(assoc-ref project "id"))
(define (project->organization project)
(let ((project (GET (format #f "/projects/~a" (project->id project)) (headers))))
(let ((org (GET (assoc-ref (assoc-ref project "organization") "href") (headers))))
(list (assoc "id" org) (assoc "name" org)))))