mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
add api documentation stubs
This commit is contained in:
40
api/api.go
40
api/api.go
@@ -23,12 +23,38 @@ import (
|
||||
// 3. SnapshotCollection
|
||||
// 4. PublishedRepoCollection
|
||||
|
||||
// GET /api/version
|
||||
type aptlyVersion struct {
|
||||
// Aptly Version
|
||||
Version string `json:"Version"`
|
||||
}
|
||||
|
||||
// @Summary Aptly version
|
||||
// @Description **Get aptly version**
|
||||
// @Description Returns the aptly version
|
||||
// @Tags Status
|
||||
// @Produce json
|
||||
// @Success 200 {object} aptlyVersion
|
||||
// @Router /api/version [get]
|
||||
func apiVersion(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"Version": aptly.Version})
|
||||
}
|
||||
|
||||
// GET /api/ready
|
||||
type aptlyStatus struct {
|
||||
// Aptly Status
|
||||
Status string `json:"Status" example:"'Aptly is ready', 'Aptly is unavailable', 'Aptly is healthy'"`
|
||||
}
|
||||
|
||||
// @Summary Ready State
|
||||
// @Description **Get aptly ready state**
|
||||
// @Description
|
||||
// @Description Return aptly ready state:
|
||||
// @Description - `Aptly is ready` (HTTP 200)
|
||||
// @Description - `Aptly is unavailable` (HTTP 503)
|
||||
// @Tags Status
|
||||
// @Produce json
|
||||
// @Success 200 {object} aptlyStatus "Aptly is ready"
|
||||
// @Failure 503 {object} aptlyStatus "Aptly is unavailable"
|
||||
// @Router /api/ready [get]
|
||||
func apiReady(isReady *atomic.Value) func(*gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
if isReady == nil || !isReady.Load().(bool) {
|
||||
@@ -40,7 +66,15 @@ func apiReady(isReady *atomic.Value) func(*gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/healthy
|
||||
// @Summary Health State
|
||||
// @Description **Get aptly health state**
|
||||
// @Description
|
||||
// @Description Return aptly health state:
|
||||
// @Description - `Aptly is healthy` (HTTP 200)
|
||||
// @Tags Status
|
||||
// @Produce json
|
||||
// @Success 200 {object} aptlyStatus
|
||||
// @Router /api/healthy [get]
|
||||
func apiHealthy(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"Status": "Aptly is healthy"})
|
||||
}
|
||||
|
||||
@@ -11,7 +11,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// POST /api/db/cleanup
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Database
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/db/cleanup [post]
|
||||
func apiDbCleanup(c *gin.Context) {
|
||||
|
||||
resources := []string{string(task.AllResourcesKey)}
|
||||
|
||||
42
api/files.go
42
api/files.go
@@ -34,10 +34,10 @@ func verifyDir(c *gin.Context) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// @Summary Get files
|
||||
// @Description Get list of uploaded files.
|
||||
// @Summary List Files
|
||||
// @Description **Get list of uploaded files**
|
||||
// @Tags Files
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Success 200 {array} string "List of files"
|
||||
// @Router /api/files [get]
|
||||
func apiFilesListDirs(c *gin.Context) {
|
||||
@@ -67,7 +67,14 @@ func apiFilesListDirs(c *gin.Context) {
|
||||
c.JSON(200, list)
|
||||
}
|
||||
|
||||
// POST /files/:dir/
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Files
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/files/{dir} [post]
|
||||
func apiFilesUpload(c *gin.Context) {
|
||||
if !verifyDir(c) {
|
||||
return
|
||||
@@ -121,7 +128,14 @@ func apiFilesUpload(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
// GET /files/:dir
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Files
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/files/{dir} [get]
|
||||
func apiFilesListFiles(c *gin.Context) {
|
||||
if !verifyDir(c) {
|
||||
return
|
||||
@@ -159,7 +173,14 @@ func apiFilesListFiles(c *gin.Context) {
|
||||
c.JSON(200, list)
|
||||
}
|
||||
|
||||
// DELETE /files/:dir
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Files
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/files/{dir} [delete]
|
||||
func apiFilesDeleteDir(c *gin.Context) {
|
||||
if !verifyDir(c) {
|
||||
return
|
||||
@@ -174,7 +195,14 @@ func apiFilesDeleteDir(c *gin.Context) {
|
||||
c.JSON(200, gin.H{})
|
||||
}
|
||||
|
||||
// DELETE /files/:dir/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Files
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/files/{dir}/{name} [delete]
|
||||
func apiFilesDeleteFile(c *gin.Context) {
|
||||
if !verifyDir(c) {
|
||||
return
|
||||
|
||||
@@ -12,7 +12,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// POST /api/gpg
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags GPG
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/gpg [post]
|
||||
func apiGPGAddKey(c *gin.Context) {
|
||||
var b struct {
|
||||
Keyserver string
|
||||
|
||||
@@ -12,6 +12,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Graph
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/graph [get]
|
||||
// GET /api/graph.:ext?layout=[vertical|horizontal(default)]
|
||||
func apiGraph(c *gin.Context) {
|
||||
var (
|
||||
|
||||
@@ -4,7 +4,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GET /api/packages/:key
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Packages
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/packages/{key} [get]
|
||||
func apiPackagesShow(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
p, err := collectionFactory.PackageCollection().ByKey([]byte(c.Params.ByName("key")))
|
||||
|
||||
@@ -102,6 +102,7 @@ func apiPublishList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, repos)
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// @Summary Show Published Repository
|
||||
// @Description **Get published repository information**
|
||||
// @Description
|
||||
@@ -117,6 +118,17 @@ func apiPublishList(c *gin.Context) {
|
||||
// @Failure 500 {object} Error "Internal Error"
|
||||
// @Router /api/publish/{prefix}/{distribution} [get]
|
||||
func apiPublishShow(c *gin.Context) {
|
||||
=======
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Publish
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/publish/{prefix} [post]
|
||||
func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
>>>>>>> d237283f (add api documentation stubs)
|
||||
param := slashEscape(c.Params.ByName("prefix"))
|
||||
storage, prefix := deb.ParsePrefix(param)
|
||||
distribution := slashEscape(c.Params.ByName("distribution"))
|
||||
|
||||
104
api/repos.go
104
api/repos.go
@@ -18,7 +18,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GET /repos
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos [get]
|
||||
func reposListInAPIMode(localRepos map[string]utils.FileSystemPublishRoot) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
c.Writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
@@ -35,7 +42,16 @@ func reposListInAPIMode(localRepos map[string]utils.FileSystemPublishRoot) gin.H
|
||||
}
|
||||
}
|
||||
|
||||
// GET /repos/:storage/*pkgPath
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Param storage path string true "Storage"
|
||||
// @Param pkgPath path string true "Package Path" allowReserved=true
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/{storage}/{pkgPath} [get]
|
||||
func reposServeInAPIMode(c *gin.Context) {
|
||||
pkgpath := c.Param("pkgPath")
|
||||
|
||||
@@ -51,7 +67,8 @@ func reposServeInAPIMode(c *gin.Context) {
|
||||
}
|
||||
|
||||
// @Summary Get repos
|
||||
// @Description Get list of available repos. Each repo is returned as in “show” API.
|
||||
// @Description **Get list of available repos**
|
||||
// @Description Each repo is returned as in “show” API.
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {array} deb.LocalRepo
|
||||
@@ -142,7 +159,14 @@ func apiReposCreate(c *gin.Context) {
|
||||
c.JSON(http.StatusCreated, repo)
|
||||
}
|
||||
|
||||
// PUT /api/repos/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name} [put]
|
||||
func apiReposEdit(c *gin.Context) {
|
||||
var b struct {
|
||||
Name *string
|
||||
@@ -214,7 +238,14 @@ func apiReposShow(c *gin.Context) {
|
||||
c.JSON(200, repo)
|
||||
}
|
||||
|
||||
// DELETE /api/repos/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name} [delete]
|
||||
func apiReposDrop(c *gin.Context) {
|
||||
force := c.Request.URL.Query().Get("force") == "1"
|
||||
name := c.Params.ByName("name")
|
||||
@@ -249,7 +280,14 @@ func apiReposDrop(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// GET /api/repos/:name/packages
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/packages [get]
|
||||
func apiReposPackagesShow(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
@@ -330,7 +368,14 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
|
||||
})
|
||||
}
|
||||
|
||||
// POST /repos/:name/packages
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/packages [post]
|
||||
func apiReposPackagesAdd(c *gin.Context) {
|
||||
apiReposPackagesAddDelete(c, "Add packages to repo ", func(list *deb.PackageList, p *deb.Package, out aptly.Progress) error {
|
||||
out.Printf("Adding package %s\n", p.Name)
|
||||
@@ -338,7 +383,14 @@ func apiReposPackagesAdd(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// DELETE /repos/:name/packages
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/packages [delete]
|
||||
func apiReposPackagesDelete(c *gin.Context) {
|
||||
apiReposPackagesAddDelete(c, "Delete packages from repo ", func(list *deb.PackageList, p *deb.Package, out aptly.Progress) error {
|
||||
out.Printf("Removing package %s\n", p.Name)
|
||||
@@ -347,7 +399,14 @@ func apiReposPackagesDelete(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /repos/:name/file/:dir/:file
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/file/{dir}/{file} [post]
|
||||
func apiReposPackageFromFile(c *gin.Context) {
|
||||
// redirect all work to dir method
|
||||
apiReposPackageFromDir(c)
|
||||
@@ -487,7 +546,14 @@ func apiReposPackageFromDir(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /repos/:name/copy/:src/:file
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/copy/{src}/{file} [post]
|
||||
func apiReposCopyPackage(c *gin.Context) {
|
||||
dstRepoName := c.Params.ByName("name")
|
||||
srcRepoName := c.Params.ByName("src")
|
||||
@@ -626,13 +692,27 @@ func apiReposCopyPackage(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /repos/:name/include/:dir/:file
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/include/{dir}/{file} [post]
|
||||
func apiReposIncludePackageFromFile(c *gin.Context) {
|
||||
// redirect all work to dir method
|
||||
apiReposIncludePackageFromDir(c)
|
||||
}
|
||||
|
||||
// POST /repos/:name/include/:dir
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Repos
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/include/{dir} [post]
|
||||
func apiReposIncludePackageFromDir(c *gin.Context) {
|
||||
forceReplace := c.Request.URL.Query().Get("forceReplace") == "1"
|
||||
noRemoveFiles := c.Request.URL.Query().Get("noRemoveFiles") == "1"
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary Get S3 buckets
|
||||
// @Description Get list of S3 buckets.
|
||||
// @Summary S3 buckets
|
||||
// @Description **Get list of S3 buckets**
|
||||
// @Tags S3
|
||||
// @Produce json
|
||||
// @Success 200 {array} string "List of S3 buckets"
|
||||
|
||||
@@ -39,7 +39,14 @@ func apiSnapshotsList(c *gin.Context) {
|
||||
c.JSON(200, result)
|
||||
}
|
||||
|
||||
// POST /api/mirrors/:name/snapshots/
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/mirrors/{name}/snapshots [post]
|
||||
func apiSnapshotsCreateFromMirror(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
@@ -98,7 +105,14 @@ func apiSnapshotsCreateFromMirror(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /api/snapshots
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots [post]
|
||||
func apiSnapshotsCreate(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
@@ -173,7 +187,14 @@ func apiSnapshotsCreate(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /api/repos/:name/snapshots
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/repos/{name}/snapshots [post]
|
||||
func apiSnapshotsCreateFromRepository(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
@@ -227,7 +248,14 @@ func apiSnapshotsCreateFromRepository(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// PUT /api/snapshots/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots/{name} [put]
|
||||
func apiSnapshotsUpdate(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
@@ -277,7 +305,14 @@ func apiSnapshotsUpdate(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// GET /api/snapshots/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots/{name} [get]
|
||||
func apiSnapshotsShow(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.SnapshotCollection()
|
||||
@@ -297,7 +332,14 @@ func apiSnapshotsShow(c *gin.Context) {
|
||||
c.JSON(200, snapshot)
|
||||
}
|
||||
|
||||
// DELETE /api/snapshots/:name
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots/{name} [delete]
|
||||
func apiSnapshotsDrop(c *gin.Context) {
|
||||
name := c.Params.ByName("name")
|
||||
force := c.Request.URL.Query().Get("force") == "1"
|
||||
@@ -336,7 +378,14 @@ func apiSnapshotsDrop(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// GET /api/snapshots/:name/diff/:withSnapshot
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots/{name}/diff/{withSnapshot} [get]
|
||||
func apiSnapshotsDiff(c *gin.Context) {
|
||||
onlyMatching := c.Request.URL.Query().Get("onlyMatching") == "1"
|
||||
|
||||
@@ -387,7 +436,14 @@ func apiSnapshotsDiff(c *gin.Context) {
|
||||
c.JSON(200, result)
|
||||
}
|
||||
|
||||
// GET /api/snapshots/:name/packages
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Snapshots
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/snapshots/{name}/packages [get]
|
||||
func apiSnapshotsSearchPackages(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.SnapshotCollection()
|
||||
|
||||
82
api/task.go
82
api/task.go
@@ -20,21 +20,41 @@ func apiTasksList(c *gin.Context) {
|
||||
c.JSON(200, list.GetTasks())
|
||||
}
|
||||
|
||||
// POST /tasks-clear
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Router /api/tasks-clear [post]
|
||||
func apiTasksClear(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
list.Clear()
|
||||
c.JSON(200, gin.H{})
|
||||
}
|
||||
|
||||
// GET /tasks-wait
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks-wait [get]
|
||||
func apiTasksWait(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
list.Wait()
|
||||
c.JSON(200, gin.H{})
|
||||
}
|
||||
|
||||
// GET /tasks/:id/wait
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id}/wait [get]
|
||||
func apiTasksWaitForTaskByID(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -52,7 +72,14 @@ func apiTasksWaitForTaskByID(c *gin.Context) {
|
||||
c.JSON(200, task)
|
||||
}
|
||||
|
||||
// GET /tasks/:id
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id} [get]
|
||||
func apiTasksShow(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -71,7 +98,14 @@ func apiTasksShow(c *gin.Context) {
|
||||
c.JSON(200, task)
|
||||
}
|
||||
|
||||
// GET /tasks/:id/output
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id}/output [get]
|
||||
func apiTasksOutputShow(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -90,7 +124,14 @@ func apiTasksOutputShow(c *gin.Context) {
|
||||
c.JSON(200, output)
|
||||
}
|
||||
|
||||
// GET /tasks/:id/detail
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id}/detail [get]
|
||||
func apiTasksDetailShow(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -109,7 +150,14 @@ func apiTasksDetailShow(c *gin.Context) {
|
||||
c.JSON(200, detail)
|
||||
}
|
||||
|
||||
// GET /tasks/:id/return_value
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id}/return_value [get]
|
||||
func apiTasksReturnValueShow(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -127,7 +175,14 @@ func apiTasksReturnValueShow(c *gin.Context) {
|
||||
c.JSON(200, output)
|
||||
}
|
||||
|
||||
// DELETE /tasks/:id
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks/{id} [delete]
|
||||
func apiTasksDelete(c *gin.Context) {
|
||||
list := context.TaskList()
|
||||
id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
|
||||
@@ -146,7 +201,16 @@ func apiTasksDelete(c *gin.Context) {
|
||||
c.JSON(200, delTask)
|
||||
}
|
||||
|
||||
// POST /tasks-dummy
|
||||
// FIXME: used for testing only, remove:
|
||||
|
||||
// @Summary TODO
|
||||
// @Description **ToDo**
|
||||
// @Description To Do
|
||||
// @Tags Tasks
|
||||
// @Produce json
|
||||
// @Success 200 {object} string "msg"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Router /api/tasks-dummy [post]
|
||||
func apiTasksDummy(c *gin.Context) {
|
||||
resources := []string{"dummy"}
|
||||
taskName := "Dummy task"
|
||||
|
||||
Reference in New Issue
Block a user