diff --git a/api/files.go b/api/files.go index 745d41c80..bd9296cc1 100644 --- a/api/files.go +++ b/api/files.go @@ -33,7 +33,12 @@ func verifyDir(c *gin.Context) bool { return true } -// GET /files +// @Summary Get files +// @Description Get list of uploaded files. +// @Tags Files +// @Produce json +// @Success 200 {array} string "List of files" +// @Router /api/files [get] func apiFilesListDirs(c *gin.Context) { list := []string{} listLock := &sync.Mutex{} diff --git a/api/packages.go b/api/packages.go index 7286915f0..09ae785a5 100644 --- a/api/packages.go +++ b/api/packages.go @@ -16,7 +16,15 @@ func apiPackagesShow(c *gin.Context) { c.JSON(200, p) } -// GET /api/packages +// @Summary Get packages +// @Description Get list of packages. +// @Tags Packages +// @Consume json +// @Produce json +// @Param q query string false "search query" +// @Param format query string false "format: `details` for more detailed information" +// @Success 200 {array} string "List of packages" +// @Router /api/packages [get] func apiPackages(c *gin.Context) { collectionFactory := context.NewCollectionFactory() collection := collectionFactory.PackageCollection() diff --git a/api/publish.go b/api/publish.go index adce3c84e..3ea1c6b4c 100644 --- a/api/publish.go +++ b/api/publish.go @@ -53,7 +53,12 @@ func parseEscapedPath(path string) string { return result } -// GET /publish +// @Summary Get publish points +// @Description Get list of available publish points. Each publish point is returned as in “show” API. +// @Tags Publish +// @Produce json +// @Success 200 {array} deb.PublishedRepo +// @Router /api/publish [get] func apiPublishList(c *gin.Context) { collectionFactory := context.NewCollectionFactory() collection := collectionFactory.PublishedRepoCollection() diff --git a/api/repos.go b/api/repos.go index ca72f8c94..fcb7d9b94 100644 --- a/api/repos.go +++ b/api/repos.go @@ -50,7 +50,12 @@ func reposServeInAPIMode(c *gin.Context) { c.FileFromFS(pkgpath, http.Dir(publicPath)) } -// GET /api/repos +// @Summary Get repos +// @Description Get list of available repos. Each repo is returned as in “show” API. +// @Tags Repos +// @Produce json +// @Success 200 {array} deb.LocalRepo +// @Router /api/repos [get] func apiReposList(c *gin.Context) { result := []*deb.LocalRepo{} diff --git a/api/s3.go b/api/s3.go index 4273d6fc7..33ed0c83e 100644 --- a/api/s3.go +++ b/api/s3.go @@ -4,7 +4,12 @@ import ( "github.com/gin-gonic/gin" ) -// GET /api/s3 +// @Summary Get S3 buckets +// @Description Get list of S3 buckets. +// @Tags S3 +// @Produce json +// @Success 200 {array} string "List of S3 buckets" +// @Router /api/s3 [get] func apiS3List(c *gin.Context) { keys := []string{} for k := range context.Config().S3PublishRoots { diff --git a/api/snapshot.go b/api/snapshot.go index dfad75c34..fbfd52c56 100644 --- a/api/snapshot.go +++ b/api/snapshot.go @@ -12,7 +12,12 @@ import ( "github.com/gin-gonic/gin" ) -// GET /api/snapshots +// @Summary Get snapshots +// @Description Get list of available snapshots. Each snapshot is returned as in “show” API. +// @Tags Snapshots +// @Produce json +// @Success 200 {array} deb.Snapshot +// @Router /api/snapshots [get] func apiSnapshotsList(c *gin.Context) { SortMethodString := c.Request.URL.Query().Get("sort") diff --git a/api/task.go b/api/task.go index 27cbbbd62..189d79319 100644 --- a/api/task.go +++ b/api/task.go @@ -9,7 +9,12 @@ import ( "github.com/gin-gonic/gin" ) -// GET /tasks +// @Summary Get tasks +// @Description Get list of available tasks. Each task is returned as in “show” API. +// @Tags Tasks +// @Produce json +// @Success 200 {array} task.Task +// @Router /api/tasks [get] func apiTasksList(c *gin.Context) { list := context.TaskList() c.JSON(200, list.GetTasks())