Added REST route as a first step to document API, see #12
This commit is contained in:
parent
b202bb6cc7
commit
5868d4e664
@ -11,7 +11,8 @@ import (
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
)
|
||||
|
||||
// GetPhotos searches the databse for photos based on a form.
|
||||
// GET /api/v1/photos
|
||||
// Parameters see https://github.com/photoprism/photoprism/blob/develop/internal/forms/photo-search.go
|
||||
func GetPhotos(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
router.GET("/photos", func(c *gin.Context) {
|
||||
var form forms.PhotoSearchForm
|
||||
@ -33,6 +34,7 @@ func GetPhotos(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
})
|
||||
}
|
||||
|
||||
// POST /api/v1/photos/:photoId/like
|
||||
func LikePhoto(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
router.POST("/photos/:photoId/like", func(c *gin.Context) {
|
||||
search := photoprism.NewSearch(conf.OriginalsPath, conf.GetDb())
|
||||
@ -51,6 +53,7 @@ func LikePhoto(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
})
|
||||
}
|
||||
|
||||
// DELETE /api/v1/photos/:photoId/like
|
||||
func DislikePhoto(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
router.DELETE("/photos/:photoId/like", func(c *gin.Context) {
|
||||
search := photoprism.NewSearch(conf.OriginalsPath, conf.GetDb())
|
||||
|
@ -15,7 +15,10 @@ var photoIconSvg = []byte(`
|
||||
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
|
||||
</svg>`)
|
||||
|
||||
// GetThumbnail searches the database for a thumbnail based on hash, size, and type.
|
||||
// GET /api/v1/thumbnails/:type/:size/:hash
|
||||
// :type string Format, either "fit" or "square"
|
||||
// :size int Size in pixels
|
||||
// :hash string The file hash as returned by the search API
|
||||
func GetThumbnail(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||
router.GET("/thumbnails/:type/:size/:hash", func(c *gin.Context) {
|
||||
fileHash := c.Param("hash")
|
||||
|
Loading…
x
Reference in New Issue
Block a user