21 lines
696 B
Scheme
21 lines
696 B
Scheme
(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)))))
|