diff --git a/docs/docs.go b/docs/docs.go index 88707d2f..bf6a0a52 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -322,6 +322,7 @@ const docTemplate = `{ "application/json" ], "tags": [ + "v16.12.0", "v16.12.0" ], "summary": "List all registered filesystems", @@ -389,7 +390,7 @@ const docTemplate = `{ } } }, - "/api/v3/fs/{name}": { + "/api/v3/fs/{storage}": { "get": { "security": [ { @@ -401,6 +402,7 @@ const docTemplate = `{ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "List all files on a filesystem", @@ -409,7 +411,7 @@ const docTemplate = `{ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, @@ -445,7 +447,7 @@ const docTemplate = `{ } } }, - "/api/v3/fs/{name}/{path}": { + "/api/v3/fs/{storage}/{filepath}": { "get": { "security": [ { @@ -458,6 +460,7 @@ const docTemplate = `{ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Fetch a file from a filesystem", @@ -466,14 +469,14 @@ const docTemplate = `{ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true } @@ -514,6 +517,7 @@ const docTemplate = `{ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Add a file to a filesystem", @@ -522,14 +526,14 @@ const docTemplate = `{ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true }, @@ -578,6 +582,7 @@ const docTemplate = `{ "text/plain" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Remove a file from a filesystem", @@ -586,14 +591,14 @@ const docTemplate = `{ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true } diff --git a/docs/swagger.json b/docs/swagger.json index 004a63f2..451abadb 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -315,6 +315,7 @@ "application/json" ], "tags": [ + "v16.12.0", "v16.12.0" ], "summary": "List all registered filesystems", @@ -382,7 +383,7 @@ } } }, - "/api/v3/fs/{name}": { + "/api/v3/fs/{storage}": { "get": { "security": [ { @@ -394,6 +395,7 @@ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "List all files on a filesystem", @@ -402,7 +404,7 @@ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, @@ -438,7 +440,7 @@ } } }, - "/api/v3/fs/{name}/{path}": { + "/api/v3/fs/{storage}/{filepath}": { "get": { "security": [ { @@ -451,6 +453,7 @@ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Fetch a file from a filesystem", @@ -459,14 +462,14 @@ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true } @@ -507,6 +510,7 @@ "application/json" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Add a file to a filesystem", @@ -515,14 +519,14 @@ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true }, @@ -571,6 +575,7 @@ "text/plain" ], "tags": [ + "v16.7.2", "v16.7.2" ], "summary": "Remove a file from a filesystem", @@ -579,14 +584,14 @@ { "type": "string", "description": "Name of the filesystem", - "name": "name", + "name": "storage", "in": "path", "required": true }, { "type": "string", "description": "Path to file", - "name": "path", + "name": "filepath", "in": "path", "required": true } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 3cfb54d9..3156530c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2172,6 +2172,7 @@ paths: summary: List all registered filesystems tags: - v16.12.0 + - v16.12.0 put: consumes: - application/json @@ -2204,7 +2205,7 @@ paths: summary: File operations between filesystems tags: - v16.?.? - /api/v3/fs/{name}: + /api/v3/fs/{storage}: get: description: List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order. @@ -2212,7 +2213,7 @@ paths: parameters: - description: Name of the filesystem in: path - name: name + name: storage required: true type: string - description: glob pattern for file names @@ -2241,19 +2242,20 @@ paths: summary: List all files on a filesystem tags: - v16.7.2 - /api/v3/fs/{name}/{path}: + - v16.7.2 + /api/v3/fs/{storage}/{filepath}: delete: description: Remove a file from a filesystem operationId: filesystem-3-delete-file parameters: - description: Name of the filesystem in: path - name: name + name: storage required: true type: string - description: Path to file in: path - name: path + name: filepath required: true type: string produces: @@ -2272,18 +2274,19 @@ paths: summary: Remove a file from a filesystem tags: - v16.7.2 + - v16.7.2 get: description: Fetch a file from a filesystem operationId: filesystem-3-get-file parameters: - description: Name of the filesystem in: path - name: name + name: storage required: true type: string - description: Path to file in: path - name: path + name: filepath required: true type: string produces: @@ -2307,6 +2310,7 @@ paths: summary: Fetch a file from a filesystem tags: - v16.7.2 + - v16.7.2 put: consumes: - application/data @@ -2315,12 +2319,12 @@ paths: parameters: - description: Name of the filesystem in: path - name: name + name: storage required: true type: string - description: Path to file in: path - name: path + name: filepath required: true type: string - description: File data @@ -2352,6 +2356,7 @@ paths: summary: Add a file to a filesystem tags: - v16.7.2 + - v16.7.2 /api/v3/log: get: description: Get the last log lines of the Restreamer application diff --git a/http/handler/api/filesystems.go b/http/handler/api/filesystems.go index b13920de..1bcab1a5 100644 --- a/http/handler/api/filesystems.go +++ b/http/handler/api/filesystems.go @@ -32,17 +32,18 @@ func NewFS(filesystems map[string]FSConfig) *FSHandler { // GetFileAPI returns the file at the given path // @Summary Fetch a file from a filesystem // @Description Fetch a file from a filesystem +// @Tags v16.7.2 // @ID filesystem-3-get-file // @Tags v16.7.2 // @Produce application/data // @Produce json -// @Param name path string true "Name of the filesystem" -// @Param path path string true "Path to file" +// @Param storage path string true "Name of the filesystem" +// @Param filepath path string true "Path to file" // @Success 200 {file} byte // @Success 301 {string} string // @Failure 404 {object} api.Error // @Security ApiKeyAuth -// @Router /api/v3/fs/{name}/{path} [get] +// @Router /api/v3/fs/{storage}/{filepath} [get] func (h *FSHandler) GetFile(c echo.Context) error { name := util.PathParam(c, "name") @@ -57,19 +58,20 @@ func (h *FSHandler) GetFile(c echo.Context) error { // PutFileAPI adds or overwrites a file at the given path // @Summary Add a file to a filesystem // @Description Writes or overwrites a file on a filesystem +// @Tags v16.7.2 // @ID filesystem-3-put-file // @Tags v16.7.2 // @Accept application/data // @Produce text/plain // @Produce json -// @Param name path string true "Name of the filesystem" -// @Param path path string true "Path to file" +// @Param storage path string true "Name of the filesystem" +// @Param filepath path string true "Path to file" // @Param data body []byte true "File data" // @Success 201 {string} string // @Success 204 {string} string // @Failure 507 {object} api.Error // @Security ApiKeyAuth -// @Router /api/v3/fs/{name}/{path} [put] +// @Router /api/v3/fs/{storage}/{filepath} [put] func (h *FSHandler) PutFile(c echo.Context) error { name := util.PathParam(c, "name") @@ -84,15 +86,16 @@ func (h *FSHandler) PutFile(c echo.Context) error { // DeleteFileAPI removes a file from a filesystem // @Summary Remove a file from a filesystem // @Description Remove a file from a filesystem +// @Tags v16.7.2 // @ID filesystem-3-delete-file // @Tags v16.7.2 // @Produce text/plain -// @Param name path string true "Name of the filesystem" -// @Param path path string true "Path to file" +// @Param storage path string true "Name of the filesystem" +// @Param filepath path string true "Path to file" // @Success 200 {string} string // @Failure 404 {object} api.Error // @Security ApiKeyAuth -// @Router /api/v3/fs/{name}/{path} [delete] +// @Router /api/v3/fs/{storage}/{filepath} [delete] func (h *FSHandler) DeleteFile(c echo.Context) error { name := util.PathParam(c, "name") @@ -107,16 +110,17 @@ func (h *FSHandler) DeleteFile(c echo.Context) error { // ListFiles lists all files on a filesystem // @Summary List all files on a filesystem // @Description List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order. +// @Tags v16.7.2 // @ID filesystem-3-list-files // @Tags v16.7.2 // @Produce json -// @Param name path string true "Name of the filesystem" +// @Param storage path string true "Name of the filesystem" // @Param glob query string false "glob pattern for file names" // @Param sort query string false "none, name, size, lastmod" // @Param order query string false "asc, desc" // @Success 200 {array} api.FileInfo // @Security ApiKeyAuth -// @Router /api/v3/fs/{name} [get] +// @Router /api/v3/fs/{storage} [get] func (h *FSHandler) ListFiles(c echo.Context) error { name := util.PathParam(c, "name") @@ -131,6 +135,7 @@ func (h *FSHandler) ListFiles(c echo.Context) error { // List lists all registered filesystems // @Summary List all registered filesystems // @Description Listall registered filesystems +// @Tags v16.12.0 // @ID filesystem-3-list // @Tags v16.12.0 // @Produce json