mirror of
git://git.savannah.gnu.org/guix/data-service.git
synced 2023-12-14 03:23:03 +01:00
Add a JSON representation for repositories
This commit is contained in:
parent
02681d7e7a
commit
f7933807ac
1 changed files with 17 additions and 3 deletions
|
@ -44,9 +44,23 @@
|
|||
(match method-and-path-components
|
||||
(('GET "repositories")
|
||||
(let ((git-repositories (all-git-repositories conn)))
|
||||
(render-html
|
||||
#:sxml
|
||||
(view-git-repositories git-repositories))))
|
||||
(case (most-appropriate-mime-type
|
||||
'(application/json text/html)
|
||||
mime-types)
|
||||
((application/json)
|
||||
(render-json
|
||||
`((repositories
|
||||
. ,(list->vector
|
||||
(map (match-lambda
|
||||
((id label url cgit-base-url)
|
||||
`((id . ,id)
|
||||
(label . ,label)
|
||||
(url . ,url))))
|
||||
git-repositories))))))
|
||||
(else
|
||||
(render-html
|
||||
#:sxml
|
||||
(view-git-repositories git-repositories))))))
|
||||
(('GET "repository" id)
|
||||
(match (select-git-repository conn id)
|
||||
((label url cgit-url-base)
|
||||
|
|
Loading…
Reference in a new issue