API: Add Swagger annotations #2132

This commit is contained in:
graciousgrey
2024-09-03 16:47:29 +02:00
parent d6482815ae
commit 7792abf9a8
7 changed files with 486 additions and 27 deletions

View File

@@ -12,11 +12,14 @@ import (
// GetFile returns file details as JSON.
//
// The request parameters are:
//
// - hash (string) SHA-1 hash of the file
//
// GET /api/v1/files/:hash
// @Summary returns file details as JSON
// @Id GetFile
// @Tags Files
// @Produce json
// @Success 200 {object} entity.File
// @Failure 401,403,404,429 {object} i18n.Response
// @Param hash path string true "hash (string) SHA-1 hash of the file"
// @Router /api/v1/files/{hash} [get]
func GetFile(router *gin.RouterGroup) {
router.GET("/files/:hash", func(c *gin.Context) {
s := Auth(c, acl.ResourceFiles, acl.ActionView)