mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
api: Allow querying the packages endpoint
The ".../packages" endpoints for mirror, local repos and snapshots all share the same syntax for querying. However the "/api/packages" endpoint doesn't match this. Adjust that to allow for a bit more consistency and allow querying the full package database. The current endpoint functionality "/packages/:name" is kept intact and can be used the same as now Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
This commit is contained in:
committed by
Benj Fassbind
parent
42cfee2c09
commit
393d1a6888
@@ -15,3 +15,10 @@ func apiPackagesShow(c *gin.Context) {
|
||||
|
||||
c.JSON(200, p)
|
||||
}
|
||||
|
||||
// GET /api/packages
|
||||
func apiPackages(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PackageCollection()
|
||||
showPackages(c, collection.AllPackageRefs(), collectionFactory)
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
|
||||
{
|
||||
root.GET("/packages/:key", apiPackagesShow)
|
||||
root.GET("/packages", apiPackages)
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user