Add Swag annotations to all handler endpoints for OpenAPI documentation
This commit is contained in:
@@ -14,18 +14,41 @@ func NewDownloadHandler() *DownloadHandler {
|
||||
return &DownloadHandler{}
|
||||
}
|
||||
|
||||
// CheckLatest godoc
|
||||
// @Summary Check for latest version
|
||||
// @Description Checks for the latest version of the application
|
||||
// @Tags download
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {string} string
|
||||
// @Router /download [get]
|
||||
func (d *DownloadHandler) checkLatest(ctx echo.Context) error {
|
||||
log.Println("Checking latest version")
|
||||
latest := backend.CheckLatest()
|
||||
return ctx.JSON(http.StatusOK, latest)
|
||||
}
|
||||
|
||||
// ListAssetsOfLatest godoc
|
||||
// @Summary List assets of latest version
|
||||
// @Description Lists all assets available for the latest version
|
||||
// @Tags download
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} string
|
||||
// @Router /download/list [get]
|
||||
func (d *DownloadHandler) listAssetsOfLatest(ctx echo.Context) error {
|
||||
log.Println("Listing assets")
|
||||
assets := backend.ListAssetsOfLatest()
|
||||
return ctx.JSON(http.StatusOK, assets)
|
||||
}
|
||||
|
||||
// DownloadLatestWindows godoc
|
||||
// @Summary Download latest Windows version
|
||||
// @Description Redirects to download the latest Windows version
|
||||
// @Tags download
|
||||
// @Produce octet-stream
|
||||
// @Success 302 {string} string
|
||||
// @Router /download/windows [get]
|
||||
func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
|
||||
log.Println("Downloading latest windows")
|
||||
asset := backend.DownloadLatestWindows()
|
||||
@@ -33,6 +56,13 @@ func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
|
||||
return ctx.Redirect(http.StatusFound, asset)
|
||||
}
|
||||
|
||||
// DownloadLatestLinux godoc
|
||||
// @Summary Download latest Linux version
|
||||
// @Description Redirects to download the latest Linux version
|
||||
// @Tags download
|
||||
// @Produce octet-stream
|
||||
// @Success 302 {string} string
|
||||
// @Router /download/linux [get]
|
||||
func (d *DownloadHandler) downloadLatestLinux(ctx echo.Context) error {
|
||||
log.Println("Downloading latest linux")
|
||||
asset := backend.DownloadLatestLinux()
|
||||
|
||||
Reference in New Issue
Block a user