API: Update swagger annotations #2132

This commit is contained in:
graciousgrey
2024-07-23 18:26:21 +02:00
parent 88156866f6
commit c95df6e072
3 changed files with 233 additions and 20 deletions

View File

@@ -324,7 +324,13 @@ func BatchPhotosPrivate(router *gin.RouterGroup) {
// BatchLabelsDelete deletes multiple labels.
//
// @Summary deletes multiple labels
// @Id BatchLabelsDelete
// @Tags Labels
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400 {object} i18n.Response
// @Param labels body form.Selection true "Label Selection"
// @Router /api/v1/batch/labels/delete [post]
func BatchLabelsDelete(router *gin.RouterGroup) {
router.POST("/batch/labels/delete", func(c *gin.Context) {
@@ -370,8 +376,11 @@ func BatchLabelsDelete(router *gin.RouterGroup) {
// BatchPhotosDelete permanently removes multiple photos from the archive.
//
// @Summary permanently removes multiple or all photos from the archive
// @Id BatchPhotosDelete
// @Tags Photos
// @Router /api/v1/batch/photos/delete [post]
//
// @Router /api/v1/batch/photos/delete [post]
func BatchPhotosDelete(router *gin.RouterGroup) {
router.POST("/batch/photos/delete", func(c *gin.Context) {
s := Auth(c, acl.ResourcePhotos, acl.ActionDelete)

View File

@@ -18,6 +18,16 @@ import (
// UpdateLabel updates label properties.
//
// PUT /api/v1/labels/:uid
//
// @Summary updates label name
// @Id UpdateLabel
// @Tags Labels
// @Produce json
// @Success 200 {object} entity.Label
// @Failure 404 {object} i18n.Response
// @Param uid path string true "Label UID"
// @Param label body form.Label true "Label Name"
// @Router /api/v1/labels/{uid} [put]
func UpdateLabel(router *gin.RouterGroup) {
router.PUT("/labels/:uid", func(c *gin.Context) {
s := Auth(c, acl.ResourceLabels, acl.ActionUpdate)
@@ -55,12 +65,13 @@ func UpdateLabel(router *gin.RouterGroup) {
// LikeLabel flags a label as favorite.
//
// The request parameters are:
//
// - uid: string Label UID
//
// @Tags Links
// @Router /api/v1/labels/{uid}/like [post]
// @Summary sets favorite flag for a label
// @Id LikeLabel
// @Tags Labels
// @Produce json
// @Failure 404 {object} i18n.Response
// @Param uid path string true "Label UID"
// @Router /api/v1/labels/{uid}/like [post]
func LikeLabel(router *gin.RouterGroup) {
router.POST("/labels/:uid/like", func(c *gin.Context) {
s := Auth(c, acl.ResourceLabels, acl.ActionUpdate)
@@ -96,11 +107,13 @@ func LikeLabel(router *gin.RouterGroup) {
// DislikeLabel removes the favorite flag from a label.
//
// The request parameters are:
//
// - uid: string Label UID
//
// DELETE /api/v1/labels/:uid/like
// @Summary removes favorite flag from a label
// @Id DislikeLabel
// @Tags Labels
// @Produce json
// @Failure 404 {object} i18n.Response
// @Param uid path string true "Label UID"
// @Router /api/v1/labels/{uid}/like [delete]
func DislikeLabel(router *gin.RouterGroup) {
router.DELETE("/labels/:uid/like", func(c *gin.Context) {
s := Auth(c, acl.ResourceLabels, acl.ActionUpdate)

View File

@@ -183,10 +183,39 @@
},
"/api/v1/batch/labels/delete": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"responses": {}
"summary": "deletes multiple labels",
"operationId": "BatchLabelsDelete",
"parameters": [
{
"description": "Label Selection",
"name": "labels",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/form.Selection"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/i18n.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/i18n.Response"
}
}
}
}
},
"/api/v1/batch/photos/approve": {
@@ -210,6 +239,8 @@
"tags": [
"Photos"
],
"summary": "permanently removes multiple or all photos from the archive",
"operationId": "BatchPhotosDelete",
"responses": {}
}
},
@@ -253,12 +284,104 @@
"responses": {}
}
},
"/api/v1/labels/{uid}": {
"put": {
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "updates label name",
"operationId": "UpdateLabel",
"parameters": [
{
"type": "string",
"description": "Label UID",
"name": "uid",
"in": "path",
"required": true
},
{
"description": "Label Name",
"name": "label",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/form.Label"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/entity.Label"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/i18n.Response"
}
}
}
}
},
"/api/v1/labels/{uid}/like": {
"post": {
"tags": [
"Links"
"produces": [
"application/json"
],
"responses": {}
"tags": [
"Labels"
],
"summary": "sets favorite flag for a label",
"operationId": "LikeLabel",
"parameters": [
{
"type": "string",
"description": "Label UID",
"name": "uid",
"in": "path",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/i18n.Response"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "removes favorite flag from a label",
"operationId": "DislikeLabel",
"parameters": [
{
"type": "string",
"description": "Label UID",
"name": "uid",
"in": "path",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/i18n.Response"
}
}
}
}
},
"/api/v1/markers": {
@@ -1324,6 +1447,64 @@
}
}
},
"form.Label": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Priority": {
"type": "integer"
},
"Uncertainty": {
"type": "integer"
}
}
},
"form.Selection": {
"type": "object",
"properties": {
"albums": {
"type": "array",
"items": {
"type": "string"
}
},
"all": {
"type": "boolean"
},
"files": {
"type": "array",
"items": {
"type": "string"
}
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"photos": {
"type": "array",
"items": {
"type": "string"
}
},
"places": {
"type": "array",
"items": {
"type": "string"
}
},
"subjects": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"i18n.Response": {
"type": "object",
"properties": {
@@ -1658,10 +1839,16 @@
1000000000,
60000000000,
3600000000000,
-9223372036854775808,
9223372036854775807,
1,
1000,
1000000,
1000000000,
60000000000,
3600000000000,
-9223372036854775808,
9223372036854775807,
1,
1000,
1000000,
@@ -1672,8 +1859,7 @@
1000,
1000000,
1000000000,
60000000000,
3600000000000
60000000000
],
"x-enum-varnames": [
"minDuration",
@@ -1692,10 +1878,16 @@
"Second",
"Minute",
"Hour",
"minDuration",
"maxDuration",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour",
"minDuration",
"maxDuration",
"Nanosecond",
"Microsecond",
"Millisecond",
@@ -1706,8 +1898,7 @@
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour"
"Minute"
]
}
},