API: Add "@Accept json" Swagger doc annotations where applicable

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-01-19 15:26:18 +01:00
parent 8c8e5c9f52
commit beef2e0c63
20 changed files with 216 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ func GetAlbum(router *gin.RouterGroup) {
// @Summary creates a new album
// @Id CreateAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} entity.Album
// @Failure 400,401,403,429,500 {object} i18n.Response
@@ -143,6 +144,7 @@ func CreateAlbum(router *gin.RouterGroup) {
// @Summary updates album metadata like title and description
// @Id UpdateAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} entity.Album
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -216,6 +218,7 @@ func UpdateAlbum(router *gin.RouterGroup) {
// @Summary deletes an existing album
// @Id DeleteAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Failure 401,403,404,429,500 {object} i18n.Response
// @Param uid path string true "Album UID"
@@ -290,6 +293,7 @@ func DeleteAlbum(router *gin.RouterGroup) {
// @Summary sets the favorite flag for an album
// @Id LikeAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Failure 401,403,404,429,500 {object} i18n.Response
// @Param uid path string true "Album UID"
@@ -340,6 +344,7 @@ func LikeAlbum(router *gin.RouterGroup) {
// @Summary removes the favorite flag from an album
// @Id DislikeAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Failure 401,403,404,429,500 {object} i18n.Response
// @Param uid path string true "Album UID"
@@ -390,6 +395,7 @@ func DislikeAlbum(router *gin.RouterGroup) {
// @Summary creates a new album containing pictures from other albums
// @Id CloneAlbums
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 400,401,403,404,429 {object} i18n.Response
@@ -467,6 +473,7 @@ func CloneAlbums(router *gin.RouterGroup) {
// @Summary adds photos to an album
// @Id AddPhotosToAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 400,401,403,404,429 {object} i18n.Response
@@ -577,6 +584,7 @@ func AddPhotosToAlbum(router *gin.RouterGroup) {
// @Summary removes photos from an album
// @Id RemovePhotosFromAlbum
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 400,401,403,404,429 {object} i18n.Response

View File

@@ -26,6 +26,7 @@ import (
// @Summary moves multiple photos to the archive
// @Id BatchPhotosArchive
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -97,6 +98,7 @@ func BatchPhotosArchive(router *gin.RouterGroup) {
// @Summary restores multiple photos from the archive
// @Id BatchPhotosRestore
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -166,6 +168,7 @@ func BatchPhotosRestore(router *gin.RouterGroup) {
// @Summary approves multiple photos that are currently under review
// @Id BatchPhotosApprove
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,404,429 {object} i18n.Response
@@ -225,6 +228,7 @@ func BatchPhotosApprove(router *gin.RouterGroup) {
// @Summary permanently removes multiple albums
// @Id BatchAlbumsDelete
// @Tags Albums
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,404,429 {object} i18n.Response
@@ -298,6 +302,7 @@ func BatchAlbumsDelete(router *gin.RouterGroup) {
// @Summary toggles private state of multiple photos
// @Id BatchPhotosPrivate
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -357,6 +362,7 @@ func BatchPhotosPrivate(router *gin.RouterGroup) {
// @Summary deletes multiple labels
// @Id BatchLabelsDelete
// @Tags Labels
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,429,500 {object} i18n.Response
@@ -409,6 +415,7 @@ func BatchLabelsDelete(router *gin.RouterGroup) {
// @Summary permanently removes multiple or all photos from the archive
// @Id BatchPhotosDelete
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,429 {object} i18n.Response

View File

@@ -45,6 +45,7 @@ func GetConfigOptions(router *gin.RouterGroup) {
// @Summary updates backend config options
// @Id SaveConfigOptions
// @Tags Config, Settings
// @Accept json
// @Produce json
// @Success 200 {object} config.Options
// @Failure 400,401,403,429,500 {object} i18n.Response

View File

@@ -46,6 +46,7 @@ func GetSettings(router *gin.RouterGroup) {
// @Summary saves the user app settings
// @Id SaveSettings
// @Tags Settings
// @Accept json
// @Produce json
// @Success 200 {object} customize.Settings
// @Failure 400,401,403,404,500 {object} i18n.Response

View File

@@ -55,6 +55,7 @@ func GetErrors(router *gin.RouterGroup) {
// @Summary removes all entries from the error logs
// @Id DeleteErrors
// @Tags Errors
// @Accept json
// @Produce json
// @Failure 401,403,429,500 {object} i18n.Response
// @Router /api/v1/errors [delete]

View File

@@ -50,6 +50,7 @@ func GetFace(router *gin.RouterGroup) {
// @Summary updates face properties
// @Id UpdateFace
// @Tags Faces
// @Accept json
// @Produce json
// @Success 200 {object} entity.Face
// @Failure 400,401,403,404,429,500 {object} i18n.Response

View File

@@ -20,6 +20,7 @@ import (
// @Summary removes a file from storage
// @Id DeleteFile
// @Tags Files
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 401,403,404,429,500 {object} i18n.Response

View File

@@ -19,6 +19,7 @@ import (
// @Summary changes the orientation of a file
// @Id ChangeFileOrientation
// @Tags Files
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response

View File

@@ -33,6 +33,7 @@ const (
// @Summary start import
// @Id StartImport
// @Tags Library
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403 {object} i18n.Response

View File

@@ -24,6 +24,7 @@ import (
// @Summary start indexing
// @Id StartIndexing
// @Tags Library
// @Accept json
// @Produce json
// @Success 200 {object} i18n.Response
// @Failure 400,401,403,429,500 {object} i18n.Response

View File

@@ -21,6 +21,7 @@ import (
// @Summary updates label name
// @Id UpdateLabel
// @Tags Labels
// @Accept json
// @Produce json
// @Success 200 {object} entity.Label
// @Failure 401,403,404,429 {object} i18n.Response
@@ -78,6 +79,7 @@ func UpdateLabel(router *gin.RouterGroup) {
// @Summary sets favorite flag for a label
// @Id LikeLabel
// @Tags Labels
// @Accept json
// @Produce json
// @Failure 401,403,404,429 {object} i18n.Response
// @Param uid path string true "Label UID"
@@ -120,6 +122,7 @@ func LikeLabel(router *gin.RouterGroup) {
// @Summary removes favorite flag from a label
// @Id DislikeLabel
// @Tags Labels
// @Accept json
// @Produce json
// @Failure 401,403,404,429 {object} i18n.Response
// @Param uid path string true "Label UID"

View File

@@ -144,6 +144,7 @@ func CreateLink(c *gin.Context) {
// @Summary adds a new album share link and return it as JSON
// @Id CreateAlbumLink
// @Tags Links, Albums
// @Accept json
// @Produce json
// @Success 200 {object} entity.Link
// @Failure 400,401,403,404,409,429 {object} i18n.Response
@@ -172,6 +173,7 @@ func CreateAlbumLink(router *gin.RouterGroup) {
// @Summary updates an album share link and return it as JSON
// @Id UpdateAlbumLink
// @Tags Links, Albums
// @Accept json
// @Produce json
// @Success 200 {object} entity.Link
// @Failure 400,401,403,429,409,500 {object} i18n.Response
@@ -196,6 +198,7 @@ func UpdateAlbumLink(router *gin.RouterGroup) {
// @Summary deletes an album share link
// @Id DeleteAlbumLink
// @Tags Links, Albums
// @Accept json
// @Produce json
// @Success 200 {object} entity.Link
// @Failure 401,403,429,409 {object} i18n.Response

View File

@@ -21,6 +21,7 @@ import (
// @Summary adds a label to a photo
// @Id AddPhotoLabel
// @Tags Labels, Photos
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -103,6 +104,7 @@ func AddPhotoLabel(router *gin.RouterGroup) {
// @Summary removes a label from a photo
// @Id RemovePhotoLabel
// @Tags Labels, Photos
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -176,6 +178,7 @@ func RemovePhotoLabel(router *gin.RouterGroup) {
// @Summary changes a photo label
// @Id UpdatePhotoLabel
// @Tags Labels, Photos
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response

View File

@@ -22,6 +22,7 @@ import (
// @Summary removes a file from an existing photo stack
// @Id PhotoUnstack
// @Tags Photos, Stacks
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response

View File

@@ -69,6 +69,7 @@ func GetPhoto(router *gin.RouterGroup) {
// @Summary updates picture details and returns them as JSON
// @Id UpdatePhoto
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -217,6 +218,7 @@ func GetPhotoYaml(router *gin.RouterGroup) {
// @Summary marks a photo in review as approved
// @Id ApprovePhoto
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 401,403,404,429,500 {object} i18n.Response
@@ -257,6 +259,7 @@ func ApprovePhoto(router *gin.RouterGroup) {
// @Summary sets the primary file for a photo
// @Id PhotoPrimary
// @Tags Photos, Stacks
// @Accept json
// @Produce json
// @Success 200 {object} entity.Photo
// @Failure 401,403,404,429,500 {object} i18n.Response

View File

@@ -17,6 +17,7 @@ import (
// @Summary flags a photo as favorite
// @Id LikePhoto
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 401,403,404,500 {object} i18n.Response
@@ -64,6 +65,7 @@ func LikePhoto(router *gin.RouterGroup) {
// @Summary removes the favorite flags from a photo
// @Id DislikePhoto
// @Tags Photos
// @Accept json
// @Produce json
// @Success 200 {object} gin.H
// @Failure 401,403,404,500 {object} i18n.Response

View File

@@ -121,6 +121,7 @@ func GetServiceFolders(router *gin.RouterGroup) {
// @Summary creates a new remote service account configuration
// @Id AddService
// @Tags Services
// @Accept json
// @Produce json
// @Success 200 {object} entity.Service
// @Failure 401,403,404,429 {object} i18n.Response
@@ -171,6 +172,7 @@ func AddService(router *gin.RouterGroup) {
// @Summary updates a remote account configuration
// @Id UpdateService
// @Tags Services
// @Accept json
// @Produce json
// @Success 200 {object} entity.Service
// @Failure 401,403,404,429 {object} i18n.Response
@@ -242,6 +244,7 @@ func UpdateService(router *gin.RouterGroup) {
// @Summary removes a remote service account configuration
// @Id DeleteService
// @Tags Services
// @Accept json
// @Produce json
// @Success 200 {object} entity.Service
// @Failure 401,403,404,429 {object} i18n.Response

View File

@@ -22,6 +22,7 @@ import (
// @Summary uploads files to the selected service account
// @Id UploadToService
// @Tags Services
// @Accept json
// @Produce json
// @Param id path string true "service id"
// @Success 200 {object} entity.Files

View File

@@ -47,6 +47,7 @@ func GetSubject(router *gin.RouterGroup) {
// @Summary updates subject properties
// @Id UpdateSubject
// @Tags Subjects
// @Accept json
// @Produce json
// @Success 200 {object} entity.Subject
// @Failure 400,401,403,404,429,500 {object} i18n.Response
@@ -113,6 +114,7 @@ func UpdateSubject(router *gin.RouterGroup) {
// @Summary flags a subject as favorite
// @Id LikeSubject
// @Tags Subjects
// @Accept json
// @Produce json
// @Failure 401,403,404,429,500 {object} i18n.Response
// @Param uid path string true "subject uid"
@@ -149,6 +151,7 @@ func LikeSubject(router *gin.RouterGroup) {
// @Summary removes the favorite flag from a subject
// @Id DislikeSubject
// @Tags Subjects
// @Accept json
// @Produce json
// @Failure 401,403,404,429,500 {object} i18n.Response
// @Param uid path string true "subject uid"

View File

@@ -81,6 +81,9 @@
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -193,6 +196,9 @@
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -265,6 +271,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -318,6 +327,9 @@
},
"/api/v1/albums/{uid}/clone": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -434,6 +446,9 @@
},
"/api/v1/albums/{uid}/like": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -485,6 +500,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -590,6 +608,9 @@
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -665,6 +686,9 @@
},
"/api/v1/albums/{uid}/links/{linkuid}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -745,6 +769,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -806,6 +833,9 @@
},
"/api/v1/albums/{uid}/photos": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -872,6 +902,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1009,6 +1042,9 @@
},
"/api/v1/batch/albums/delete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1070,6 +1106,9 @@
},
"/api/v1/batch/labels/delete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1131,6 +1170,9 @@
},
"/api/v1/batch/photos/approve": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1192,6 +1234,9 @@
},
"/api/v1/batch/photos/archive": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1259,6 +1304,9 @@
},
"/api/v1/batch/photos/delete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1314,6 +1362,9 @@
},
"/api/v1/batch/photos/private": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1381,6 +1432,9 @@
},
"/api/v1/batch/photos/restore": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1485,6 +1539,9 @@
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1656,6 +1713,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -1848,6 +1908,9 @@
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2157,6 +2220,9 @@
},
"/api/v1/import/": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2206,6 +2272,9 @@
},
"/api/v1/index": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2342,6 +2411,9 @@
},
"/api/v1/labels/{uid}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2404,6 +2476,9 @@
},
"/api/v1/labels/{uid}/like": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2449,6 +2524,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2817,6 +2895,9 @@
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2891,6 +2972,9 @@
},
"/api/v1/photos/{uid}/approve": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -2992,6 +3076,9 @@
},
"/api/v1/photos/{uid}/files/{fileuid}": {
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3058,6 +3145,9 @@
},
"/api/v1/photos/{uid}/files/{fileuid}/orientation": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3139,6 +3229,9 @@
},
"/api/v1/photos/{uid}/files/{fileuid}/primary": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3206,6 +3299,9 @@
},
"/api/v1/photos/{uid}/files/{fileuid}/unstack": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3279,6 +3375,9 @@
},
"/api/v1/photos/{uid}/label": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3354,6 +3453,9 @@
},
"/api/v1/photos/{uid}/label/{id}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3434,6 +3536,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3507,6 +3612,9 @@
},
"/api/v1/photos/{uid}/like": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3558,6 +3666,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3715,6 +3826,9 @@
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3801,6 +3915,9 @@
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3843,6 +3960,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -3925,6 +4045,9 @@
},
"/api/v1/services/{id}/upload": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -4033,6 +4156,9 @@
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -4265,6 +4391,9 @@
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -4339,6 +4468,9 @@
},
"/api/v1/subjects/{uid}/like": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -4390,6 +4522,9 @@
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@@ -7050,6 +7185,24 @@
"time.Duration": {
"type": "integer",
"enum": [
-9223372036854775808,
9223372036854775807,
1,
1000,
1000000,
1000000000,
60000000000,
3600000000000,
-9223372036854775808,
9223372036854775807,
1,
1000,
1000000,
1000000000,
60000000000,
3600000000000,
-9223372036854775808,
9223372036854775807,
1,
1000,
1000000,
@@ -7058,6 +7211,24 @@
3600000000000
],
"x-enum-varnames": [
"minDuration",
"maxDuration",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour",
"minDuration",
"maxDuration",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour",
"minDuration",
"maxDuration",
"Nanosecond",
"Microsecond",
"Millisecond",