api

package
v0.0.0-...-2499b13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2025 License: AGPL-3.0 Imports: 69 Imported by: 0

Documentation

Overview

Package api provides REST-API authentication and request handlers.

Copyright (c) 2018 - 2025 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const (
	UploadPath = "/upload"
)

Variables

View Source
var AbortNotFound = func(c *gin.Context) {
	conf := get.Config()

	switch c.NegotiateFormat(gin.MIMEHTML, gin.MIMEJSON) {
	case gin.MIMEJSON:
		c.JSON(http.StatusNotFound, gin.H{"error": i18n.Msg(i18n.ErrNotFound)})
	default:
		var redirect string

		if root, path := conf.BaseUri("/"), c.Request.URL.Path; path != "" && path != root {
			redirect = root
		}

		values := gin.H{
			"signUp":   config.SignUp,
			"config":   conf.ClientPublic(),
			"error":    i18n.Msg(i18n.ErrNotFound),
			"code":     http.StatusNotFound,
			"redirect": redirect,
		}

		c.HTML(http.StatusNotFound, "404.gohtml", values)
	}

	c.Abort()
}

AbortNotFound renders a "404 Not Found" error page or JSON response.

Functions

func Abort

func Abort(c *gin.Context, code int, id i18n.Message, params ...interface{})

func AbortAlbumNotFound

func AbortAlbumNotFound(c *gin.Context)

AbortAlbumNotFound aborts with status code 404.

func AbortBadRequest

func AbortBadRequest(c *gin.Context)

func AbortBusy

func AbortBusy(c *gin.Context)

func AbortDeleteFailed

func AbortDeleteFailed(c *gin.Context)

func AbortEntityNotFound

func AbortEntityNotFound(c *gin.Context)

AbortEntityNotFound aborts with status code 404.

func AbortFeatureDisabled

func AbortFeatureDisabled(c *gin.Context)

func AbortForbidden

func AbortForbidden(c *gin.Context)

AbortForbidden aborts with status code 403.

func AbortInvalidCredentials

func AbortInvalidCredentials(c *gin.Context)

func AbortInvalidName

func AbortInvalidName(c *gin.Context)

func AbortNotImplemented

func AbortNotImplemented(c *gin.Context)

func AbortQuotaExceeded

func AbortQuotaExceeded(c *gin.Context)

func AbortSaveFailed

func AbortSaveFailed(c *gin.Context)

func AbortUnauthorized

func AbortUnauthorized(c *gin.Context)

AbortUnauthorized aborts with status code 401.

func AbortUnexpectedError

func AbortUnexpectedError(c *gin.Context)

func AbortVideo

func AbortVideo(c *gin.Context)

func AbortVideoWithStatus

func AbortVideoWithStatus(c *gin.Context, code int)

func ActivateUserPasscode

func ActivateUserPasscode(router *gin.RouterGroup)

ActivateUserPasscode activates two-factor authentication if a passcode has been created and verified.

@Tags	Users
@Router	/api/v1/users/{uid}/passcode/activate [post]

func AddCacheHeader

func AddCacheHeader(c *gin.Context, duration ttl.Duration, public bool)

AddCacheHeader adds a cache control header to the response.

func AddContentTypeHeader

func AddContentTypeHeader(c *gin.Context, contentType string)

AddContentTypeHeader adds a "Content-Type" header to the response.

func AddCountHeader

func AddCountHeader(c *gin.Context, count int)

AddCountHeader adds the actual result count to the response.

func AddCoverCacheHeader

func AddCoverCacheHeader(c *gin.Context)

AddCoverCacheHeader adds cover image cache control headers to the response.

func AddDownloadHeader

func AddDownloadHeader(c *gin.Context, fileName string)

AddDownloadHeader adds a header indicating the response is expected to be downloaded.

func AddFileCountHeaders

func AddFileCountHeaders(c *gin.Context, filesCount, foldersCount int)

AddFileCountHeaders adds file and folder counts to the response.

func AddImmutableCacheHeader

func AddImmutableCacheHeader(c *gin.Context)

AddImmutableCacheHeader adds cache control headers to the response for immutable content like thumbnails.

func AddLimitHeader

func AddLimitHeader(c *gin.Context, limit int)

AddLimitHeader adds the max result count to the response.

func AddOffsetHeader

func AddOffsetHeader(c *gin.Context, offset int)

AddOffsetHeader adds the result offset to the response.

func AddPhotoLabel

func AddPhotoLabel(router *gin.RouterGroup)

AddPhotoLabel adds a label to a photo.

@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
@Param		label					body		form.Label	true	"label properties"
@Param		uid						path		string		true	"photo uid"
@Router		/api/v1/photos/{uid}/label [post]

func AddPhotosToAlbum

func AddPhotosToAlbum(router *gin.RouterGroup)

AddPhotosToAlbum adds photos to an album.

@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
@Param		photos				body		form.Selection	true	"Photo Selection"
@Param		uid					path		string			true	"Album UID"
@Router		/api/v1/albums/{uid}/photos [post]

func AddService

func AddService(router *gin.RouterGroup)

AddService creates a new remote account configuration.

@Summary	creates a new remote service account configuration
@Id			AddService
@Tags		Services
@Accept		json
@Produce	json
@Success	200				{object}	entity.Service
@Failure	400,401,403,429	{object}	i18n.Response
@Param		service			body		form.Service	true	"properties of the service to be created"
@Router		/api/v1/services [post]

func AddTokenHeaders

func AddTokenHeaders(c *gin.Context, s *entity.Session)

AddTokenHeaders adds preview token headers to the response.

func AddVideoCacheHeader

func AddVideoCacheHeader(c *gin.Context, cdn bool)

AddVideoCacheHeader adds video cache control headers to the response.

func AlbumCover

func AlbumCover(router *gin.RouterGroup)

AlbumCover returns an album cover image.

@Summary	returns an album cover image
@Id			AlbumCover
@Produce	image/jpeg
@Produce	image/svg+xml
@Tags		Images, Albums
@Failure	403		{file}	image/svg+xml
@Failure	200		{file}	image/svg+xml
@Success	200		{file}	image/jpg
@Param		uid		path	string	true	"Album UID"
@Param		token	path	string	true	"user-specific security token provided with session or 'public' when running PhotoPrism in public mode"
@Param		size	path	string	true	"thumbnail size"	Enums(tile_50, tile_100, left_224, right_224, tile_224, tile_500, fit_720, tile_1080, fit_1280, fit_1600, fit_1920, fit_2048, fit_2560, fit_3840, fit_4096, fit_7680)
@Router		/api/v1/albums/{uid}/t/{token}/{size} [get]

func AlbumDownloadName

func AlbumDownloadName(c *gin.Context) customize.DownloadName

AlbumDownloadName returns the album download file name type.

func ApprovePhoto

func ApprovePhoto(router *gin.RouterGroup)

ApprovePhoto marks a photo in review as approved.

@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
@Param		uid					path		string	true	"photo uid"
@Router		/api/v1/photos/{uid}/approve [post]

func Auth

func Auth(c *gin.Context, resource acl.Resource, perm acl.Permission) *entity.Session

Auth checks if the user is authorized to access a resource with the given permission and returns the session or nil otherwise.

func AuthAny

func AuthAny(c *gin.Context, resource acl.Resource, perms acl.Permissions) (s *entity.Session)

AuthAny checks if the user is authorized to access a resource with any of the specified permissions and returns the session or nil otherwise.

func AuthToken

func AuthToken(c *gin.Context) string

AuthToken returns the client authentication token from the request context if one was found, or an empty string if no supported request header value was provided.

func BatchAlbumsDelete

func BatchAlbumsDelete(router *gin.RouterGroup)

BatchAlbumsDelete permanently removes multiple albums.

@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
@Param		albums				body		form.Selection	true	"Album Selection"
@Router		/api/v1/batch/albums/delete [post]

func BatchLabelsDelete

func BatchLabelsDelete(router *gin.RouterGroup)

BatchLabelsDelete deletes multiple labels.

@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
@Param		labels				body		form.Selection	true	"Label Selection"
@Router		/api/v1/batch/labels/delete [post]

func BatchPhotosApprove

func BatchPhotosApprove(router *gin.RouterGroup)

BatchPhotosApprove approves multiple photos that are currently under review.

@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
@Param		photos				body		form.Selection	true	"Photo Selection"
@Router		/api/v1/batch/photos/approve [post]

func BatchPhotosArchive

func BatchPhotosArchive(router *gin.RouterGroup)

BatchPhotosArchive moves multiple photos to the archive.

@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
@Param		photos					body		form.Selection	true	"Photo Selection"
@Router		/api/v1/batch/photos/archive [post]

func BatchPhotosDelete

func BatchPhotosDelete(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
@Accept		json
@Produce	json
@Success	200				{object}	i18n.Response
@Failure	400,401,403,429	{object}	i18n.Response
@Param		photos			body		form.Selection	true	"All or Photo Selection"
@Router		/api/v1/batch/photos/delete [post]

func BatchPhotosEdit

func BatchPhotosEdit(router *gin.RouterGroup)

BatchPhotosEdit returns and updates the metadata of multiple photos.

@Summary	returns and updates the metadata of multiple photos
@Id			BatchPhotosEdit
@Tags		Photos
@Accept		json
@Produce	json
@Success	200						{object}	batch.PhotosForm
@Failure	400,401,403,404,429,500	{object}	i18n.Response
@Param		photos					body		batch.PhotosRequest	true	"photos selection and values"
@Router		/api/v1/batch/photos/edit [post]

func BatchPhotosPrivate

func BatchPhotosPrivate(router *gin.RouterGroup)

BatchPhotosPrivate toggles private state of multiple photos.

@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
@Param		photos					body		form.Selection	true	"Photo Selection"
@Router		/api/v1/batch/photos/private [post]

func BatchPhotosRestore

func BatchPhotosRestore(router *gin.RouterGroup)

BatchPhotosRestore restores multiple photos from the archive.

@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
@Param		photos					body		form.Selection	true	"Photo Selection"
@Router		/api/v1/batch/photos/restore [post]

func CacheKey

func CacheKey(ns, uid, name string) string

CacheKey returns a cache key string based on namespace, uid and name.

func CancelImport

func CancelImport(router *gin.RouterGroup)

CancelImport stops the current import operation.

DELETE /api/v1/import

func CancelIndexing

func CancelIndexing(router *gin.RouterGroup)

CancelIndexing stops indexing media files in the "originals" folder.

DELETE /api/v1/index

func ChangeFileOrientation

func ChangeFileOrientation(router *gin.RouterGroup)

ChangeFileOrientation changes the orientation of a file.

@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
@Param		uid						path		string		true	"photo uid"
@Param		fileuid					path		string		true	"file uid"
@Param		file					body		form.File	true	"file orientation"
@Router		/api/v1/photos/{uid}/files/{fileuid}/orientation [put]

func ClearMarkerSubject

func ClearMarkerSubject(router *gin.RouterGroup)

ClearMarkerSubject removes an existing marker subject association.

The request parameters are:

  • uid: string Photo UID as returned by the API
  • file_uid: string File UID as returned by the API
  • id: int Marker ID as returned by the API

DELETE /api/v1/markers/:marker_uid/subject

func ClientIP

func ClientIP(c *gin.Context) (ip string)

ClientIP returns the client IP address from the request context or a placeholder if it is unknown.

func CloneAlbums

func CloneAlbums(router *gin.RouterGroup)

CloneAlbums creates a new album containing pictures from other albums.

@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
@Param		albums				body		form.Selection	true	"Album Selection"
@Param		uid					path		string			true	"UID of the album to which the pictures are to be added"
@Router		/api/v1/albums/{uid}/clone [post]

func ConfirmUserPasscode

func ConfirmUserPasscode(router *gin.RouterGroup)

ConfirmUserPasscode checks a new passcode and flags it as verified so that it can be activated.

@Tags	Users
@Router	/api/v1/users/{uid}/passcode/confirm [post]

func Connect

func Connect(router *gin.RouterGroup)

Connect confirms external service accounts using a token.

PUT /api/v1/connect/:name

func CreateAlbum

func CreateAlbum(router *gin.RouterGroup)

CreateAlbum creates a new album.

@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
@Param		album				body		form.Album	true	"properties of the album to be created (currently supports Title and Favorite)"
@Router		/api/v1/albums [post]
func CreateAlbumLink(router *gin.RouterGroup)

CreateAlbumLink adds a new album share link and return it as JSON.

@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
@Param		uid						path		string		true	"album uid"
@Param		link					body		form.Link	true	"link properties (currently supported: slug, expires)"
@Router		/api/v1/albums/{uid}/links [post]
func CreateLink(c *gin.Context)

CreateLink adds a new share link and return it as JSON.

@Tags	Links
@Router	/api/v1/{entity}/{uid}/links [post]

func CreateMarker

func CreateMarker(router *gin.RouterGroup)

CreateMarker adds a new file area marker to assign faces or other subjects.

See internal/form/marker.go for the values required to create a new marker.

@Tags Files
@Router	/api/v1/markers [post]

func CreateSession

func CreateSession(router *gin.RouterGroup)

CreateSession creates a new client session and returns it as JSON if authentication was successful.

@Tags	Authentication
@Router	/api/v1/session [post]
@Router	/api/v1/sessions [post]

func CreateSessionError

func CreateSessionError(code int, err error) gin.H

CreateSessionError returns an authentication error response.

func CreateSessionResponse

func CreateSessionResponse(authToken string, sess *entity.Session, conf *config.ClientConfig) gin.H

CreateSessionResponse returns the authentication response data for POST requests based on the session and configuration.

func CreateUserPasscode

func CreateUserPasscode(router *gin.RouterGroup)

CreateUserPasscode sets up a new two-factor authentication passcode.

@Tags	Users
@Router	/api/v1/users/{uid}/passcode [post]

func DeactivateUserPasscode

func DeactivateUserPasscode(router *gin.RouterGroup)

DeactivateUserPasscode disables removes a passcode key to disable two-factor authentication.

@Tags	Users
@Router	/api/v1/users/{uid}/passcode/deactivate [post]

func DeleteAlbum

func DeleteAlbum(router *gin.RouterGroup)

DeleteAlbum deletes an existing album.

@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"
@Router		/api/v1/albums/{uid} [delete]
func DeleteAlbumLink(router *gin.RouterGroup)

DeleteAlbumLink deletes an album share link.

@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
@Param		uid				path		string	true	"album"
@Param		linkuid			path		string	true	"link uid"
@Router		/api/v1/albums/{uid}/links/{linkuid} [delete]

func DeleteErrors

func DeleteErrors(router *gin.RouterGroup)

DeleteErrors removes all entries from the error logs.

@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]

func DeleteFile

func DeleteFile(router *gin.RouterGroup)

DeleteFile removes a file from storage.

@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
@Param		uid					path		string	true	"photo uid"
@Param		fileuid				path		string	true	"file uid"
@Router		/api/v1/photos/{uid}/files/{fileuid} [delete]
func DeleteLink(c *gin.Context)

DeleteLink deletes a share link.

DELETE /api/v1/:entity/:uid/links/:link

func DeleteService

func DeleteService(router *gin.RouterGroup)

DeleteService removes a remote account configuration.

@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
@Param		id				path		string	true	"service id"
@Router		/api/v1/services/{id} [delete]

func DeleteSession

func DeleteSession(router *gin.RouterGroup)

DeleteSession deletes an existing client session (logout).

DELETE /api/v1/session DELETE /api/v1/session/:id DELETE /api/v1/sessions/:id

func DeleteSessionResponse

func DeleteSessionResponse(id string) gin.H

DeleteSessionResponse returns a confirmation response for DELETE requests.

func DislikeAlbum

func DislikeAlbum(router *gin.RouterGroup)

DislikeAlbum removes the favorite flag from an album.

@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"
@Router		/api/v1/albums/{uid}/like [delete]

func DislikeLabel

func DislikeLabel(router *gin.RouterGroup)

DislikeLabel removes the favorite flag from a label.

@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"
@Router		/api/v1/labels/{uid}/like [delete]

func DislikePhoto

func DislikePhoto(router *gin.RouterGroup)

DislikePhoto removes the favorite flags from a photo.

@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
@Param		uid				path		string	true	"photo uid"
@Router		/api/v1/photos/{uid}/like [delete]

func DislikeSubject

func DislikeSubject(router *gin.RouterGroup)

DislikeSubject removes the favorite flag from a subject.

@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"
@Router		/api/v1/subjects/{uid}/like [delete]

func DownloadAlbum

func DownloadAlbum(router *gin.RouterGroup)

DownloadAlbum streams the album contents as zip archive.

@Summary	streams the album contents as zip archive
@Id			DownloadAlbum
@Tags		Images, Albums
@Produce	application/zip
@Failure	403,404,500	{object}	i18n.Response
@Success	200			{file}		application/zip
@Param		uid			path		string	true	"Album UID"
@Router		/api/v1/albums/{uid}/dl [get]

func DownloadName

func DownloadName(c *gin.Context) customize.DownloadName

DownloadName returns the download file name type.

func Echo

func Echo(router *gin.RouterGroup)

Echo returns the request and response headers as JSON if debug mode is enabled.

The supported request methods are:

  • GET
  • POST
  • PUT
  • PATCH
  • HEAD
  • OPTIONS
  • DELETE
  • CONNECT
  • TRACE

ANY /api/v1/echo

func Error

func Error(c *gin.Context, code int, err error, id i18n.Message, params ...interface{})

func FindUserSessions

func FindUserSessions(router *gin.RouterGroup)

FindUserSessions finds user sessions and returns them as JSON.

@Tags	Users, Authentication
@Router /api/v1/users/{uid}/sessions [get]

func FlushCoverCache

func FlushCoverCache()

FlushCoverCache clears the complete cover cache.

func FolderCover

func FolderCover(router *gin.RouterGroup)

FolderCover returns a folder cover image.

@Summary	returns a folder cover image
@Id			FolderCover
@Produce	image/jpeg
@Produce	image/svg+xml
@Tags		Images, Folders
@Failure	403		{file}	image/svg+xml
@Failure	200		{file}	image/svg+xml
@Success	200		{file}	image/jpg
@Param		uid		path	string	true	"folder uid"
@Param		token	path	string	true	"user-specific security token provided with session or 'public' when running PhotoPrism in public mode"
@Param		size	path	string	true	"thumbnail size"	Enums(tile_50, tile_100, left_224, right_224, tile_224, tile_500, fit_720, tile_1080, fit_1280, fit_1600, fit_1920, fit_2048, fit_2560, fit_3840, fit_4096, fit_7680)
@Router		/api/v1/folders/t/{uid}/{token}/{size} [get]

func GetAlbum

func GetAlbum(router *gin.RouterGroup)

GetAlbum returns album details as JSON.

@Summary	returns album details as JSON
@Id			GetAlbum
@Tags		Albums
@Produce	json
@Success	200				{object}	entity.Album
@Failure	401,403,404,429	{object}	i18n.Response
@Param		uid				path		string	true	"Album UID"
@Router		/api/v1/albums/{uid} [get]
func GetAlbumLinks(router *gin.RouterGroup)

GetAlbumLinks returns all share links for the given UID as JSON.

@Summary	returns all share links for the given UID as JSON
@Id			GetAlbumLinks
@Tags		Links, Albums
@Produce	json
@Success	200				{object}	entity.Link
@Failure	401,403,404,429	{object}	i18n.Response
@Param		uid				path		string	true	"album uid"
@Router		/api/v1/albums/{uid}/links [get]

func GetClientConfig

func GetClientConfig(router *gin.RouterGroup)

GetClientConfig returns the client configuration values as JSON.

GET /api/v1/config

func GetConfigOptions

func GetConfigOptions(router *gin.RouterGroup)

GetConfigOptions returns backend config options.

@Summary	returns backend config options
@Id			GetConfigOptions
@Tags		Config, Settings
@Produce	json
@Success	200			{object}	config.Options
@Failure	401,403,429	{object}	i18n.Response
@Router		/api/v1/config/options [get]

func GetDownload

func GetDownload(router *gin.RouterGroup)

GetDownload returns the raw file data.

@Summary	returns the raw file data
@Id			GetDownload
@Tags		Images, Files
@Produce	application/octet-stream
@Failure	403,404	{file}	image/svg+xml
@Success	200		{file}	application/octet-stream
@Param		file	path	string	true	"file hash or unique download id"
@Router		/api/v1/dl/{file} [get]

func GetErrors

func GetErrors(router *gin.RouterGroup)

GetErrors searches the error logs and returns the results as JSON.

@Summary	searches the error logs and returns the results as JSON
@Id			GetErrors
@Tags		Errors
@Produce	json
@Success	200				{object}	entity.Error
@Failure	401,403,429,400	{object}	i18n.Response
@Param		count			query		int		true	"maximum number of results"	minimum(1)	maximum(100000)
@Param		offset			query		int		false	"search result offset"		minimum(0)	maximum(100000)
@Param		q				query		string	false	"search query"
@Router		/api/v1/errors [get]

func GetFace

func GetFace(router *gin.RouterGroup)

GetFace returns a face as JSON.

@Summary	returns a face as JSON
@Id			GetFace
@Tags		Faces
@Produce	json
@Success	200				{object}	entity.Face
@Failure	401,403,404,429	{object}	i18n.Response
@Param		id				path		string	true	"face id"
@Router		/api/v1/faces/{id} [get]

func GetFile

func GetFile(router *gin.RouterGroup)

GetFile returns file details as JSON.

@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 GetMetrics

func GetMetrics(router *gin.RouterGroup)

GetMetrics provides a prometheus-compatible metrics endpoint for monitoring.

GET /api/v1/metrics

func GetMomentsTime

func GetMomentsTime(router *gin.RouterGroup)

GetMomentsTime returns monthly albums as JSON.

@Summary	returns monthly albums as JSON
@Id			GetMomentsTime
@Tags		Albums
@Produce	json
@Success	200				{object}	entity.Album
@Failure	401,403,429,500	{object}	i18n.Response
@Router		/api/v1/moments/time [get]

func GetPhoto

func GetPhoto(router *gin.RouterGroup)

GetPhoto returns picture details as JSON.

@Summary	returns picture details as JSON
@Id			GetPhoto
@Tags		Photos
@Produce	json
@Success	200				{object}	entity.Photo
@Failure	401,403,404,429	{object}	i18n.Response
@Param		uid				path		string	true	"Photo UID"
@Router		/api/v1/photos/{uid} [get]

func GetPhotoDownload

func GetPhotoDownload(router *gin.RouterGroup)

GetPhotoDownload returns the primary file matching that belongs to the photo.

@Summary	returns the primary file matching that belongs to the photo
@Id			GetPhotoDownload
@Tags		Images, Files
@Produce	application/octet-stream
@Failure	403,404	{file}	image/svg+xml
@Success	200		{file}	application/octet-stream
@Param		uid		path	string	true	"photo uid"
@Router		/api/v1/photos/{uid}/dl [get]

func GetPhotoYaml

func GetPhotoYaml(router *gin.RouterGroup)

GetPhotoYaml returns picture details as YAML.

@Summary	returns picture details as YAML
@Id			GetPhotoYaml
@Tags		Photos
@Produce	text/x-yaml
@Failure	401,403,404,429,500	{object}	i18n.Response
@Success	200					{file}		text/x-yaml
@Param		uid					path		string	true	"photo uid"
@Router		/api/v1/photos/{uid}/yaml [get]

func GetService

func GetService(router *gin.RouterGroup)

GetService returns an account as JSON.

@Summary	returns the specified remote service account configuration as JSON
@Id			GetService
@Tags		Services
@Produce	json
@Success	200				{object}	entity.Service
@Failure	401,403,404,429	{object}	i18n.Response
@Param		id				path		string	true	"service id"
@Router		/api/v1/services/{id} [get]

func GetServiceFolders

func GetServiceFolders(router *gin.RouterGroup)

GetServiceFolders returns folders that belong to an account.

@Summary	returns folders that belong to a remote service account
@Id			GetServiceFolders
@Tags		Services
@Produce	json
@Success	200					{object}	[]object
@Failure	400,401,403,404,429	{object}	i18n.Response
@Param		id					path		string	true	"service id"
@Router		/api/v1/services/{id}/folders [get]

func GetSession

func GetSession(router *gin.RouterGroup)

GetSession returns the session data as JSON if authentication was successful.

GET /api/v1/session GET /api/v1/session/:id GET /api/v1/sessions/:id

func GetSessionResponse

func GetSessionResponse(authToken string, sess *entity.Session, conf *config.ClientConfig) gin.H

GetSessionResponse returns the authentication response data for GET requests based on the session and configuration.

func GetSettings

func GetSettings(router *gin.RouterGroup)

GetSettings returns the user app settings as JSON.

@Summary	returns the user app settings as JSON
@Id			GetSettings
@Tags		Settings
@Produce	json
@Success	200			{object}	customize.Settings
@Failure	401,403,404	{object}	i18n.Response
@Router		/api/v1/settings [get]

func GetStatus

func GetStatus(router *gin.RouterGroup)

GetStatus reports if the server is operational.

@Summary	reports if the server is operational
@Id			GetStatus
@Tags		Server
@Produce	json
@Success	200	{object}	gin.H
@Router		/api/v1/status [get]

func GetSubject

func GetSubject(router *gin.RouterGroup)

GetSubject returns a subject as JSON.

@Summary	returns a subject as JSON
@Id			GetSubject
@Tags		Subjects
@Produce	json
@Success	200				{object}	entity.Subject
@Failure	401,403,404,429	{object}	i18n.Response
@Param		uid				path		string	true	"subject uid"
@Router		/api/v1/subjects/{uid} [get]

func GetSvg

func GetSvg(router *gin.RouterGroup)

GetSvg returns SVG placeholder symbols.

GET /api/v1/svg/*

func GetThumb

func GetThumb(router *gin.RouterGroup)

GetThumb returns a thumbnail image matching the file hash, crop area, and type.

@Summary		returns a thumbnail image with the requested size
@Description	Fore more information see:
@Description	- https://docs.photoprism.app/developer-guide/api/thumbnails/#image-endpoint-uri
@Id				GetThumb
@Produce		image/jpeg
@Tags			Images, Files
@Failure		403		{file}	image/svg+xml
@Failure		200		{file}	image/svg+xml
@Success		200		{file}	image/jpg
@Param			thumb	path	string	true	"SHA1 file hash, optionally with a crop area suffixed, e.g. '-016014058037'"
@Param			token	path	string	true	"user-specific security token provided with session or 'public' when running PhotoPrism in public mode"
@Param			size	path	string	true	"thumbnail size"	Enums(tile_50, tile_100, left_224, right_224, tile_224, tile_500, fit_720, tile_1080, fit_1280, fit_1600, fit_1920, fit_2048, fit_2560, fit_3840, fit_4096, fit_7680)
@Router			/api/v1/t/{thumb}/{token}/{size} [get]

func GetVideo

func GetVideo(router *gin.RouterGroup)

GetVideo returns a video, optionally limited to a byte range for streaming.

@Summary		returns a video, optionally limited to a byte range for streaming
@Description	Fore more information see:
@Description	- https://docs.photoprism.app/developer-guide/api/thumbnails/#video-endpoint-uri
@Id				GetVideo
@Produce		video/mp4
@Tags			Files, Videos
@Failure		403		{object}	i18n.Response
@Param			thumb	path		string	true	"SHA1 video file hash"
@Param			token	path		string	true	"user-specific security token provided with session"
@Param			format	path		string	true	"video format, e.g. mp4"
@Router			/api/v1/videos/{hash}/{token}/{format} [get]

func InvalidDownloadToken

func InvalidDownloadToken(c *gin.Context) bool

InvalidDownloadToken checks if the token found in the request is valid for file downloads.

func InvalidPreviewToken

func InvalidPreviewToken(c *gin.Context) bool

InvalidPreviewToken checks if the token found in the request is valid for image thumbnails and video streams.

func LabelCover

func LabelCover(router *gin.RouterGroup)

LabelCover returns a label cover image.

@Summary	returns a label cover image
@Id			LabelCover
@Produce	image/jpeg
@Produce	image/svg+xml
@Tags		Images, Labels
@Failure	403		{file}	image/svg+xml
@Failure	200		{file}	image/svg+xml
@Success	200		{file}	image/jpg
@Param		uid		path	string	true	"Label UID"
@Param		token	path	string	true	"user-specific security token provided with session or 'public' when running PhotoPrism in public mode"
@Param		size	path	string	true	"thumbnail size"	Enums(tile_50, tile_100, left_224, right_224, tile_224, tile_500, fit_720, tile_1080, fit_1280, fit_1600, fit_1920, fit_2048, fit_2560, fit_3840, fit_4096, fit_7680)
@Router		/api/v1/labels/{uid}/t/{token}/{size} [get]

func LikeAlbum

func LikeAlbum(router *gin.RouterGroup)

LikeAlbum sets the favorite flag for an album.

@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"
@Router		/api/v1/albums/{uid}/like [post]

func LikeLabel

func LikeLabel(router *gin.RouterGroup)

LikeLabel flags a label as favorite.

@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"
@Router		/api/v1/labels/{uid}/like [post]

func LikePhoto

func LikePhoto(router *gin.RouterGroup)

LikePhoto flags a photo as favorite.

@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
@Param		uid				path		string	true	"photo uid"
@Router		/api/v1/photos/{uid}/like [post]

func LikeSubject

func LikeSubject(router *gin.RouterGroup)

LikeSubject flags a subject as favorite.

@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"
@Router		/api/v1/subjects/{uid}/like [post]

func OAuthAuthorize

func OAuthAuthorize(router *gin.RouterGroup)

OAuthAuthorize should gather consent and authorization from resource owners when using the Authorization Code Grant flow, see https://github.com/photoprism/photoprism/issues/4368.

GET /api/v1/oauth/authorize

func OAuthRevoke

func OAuthRevoke(router *gin.RouterGroup)

OAuthRevoke takes an access token and deletes it. A client may only delete its own tokens.

@Tags	Authentication
@Router	/api/v1/oauth/revoke [post]

func OAuthToken

func OAuthToken(router *gin.RouterGroup)

OAuthToken creates a new access token for clients that authenticate with valid OAuth2 client credentials.

@Tags	Authentication
@Router	/api/v1/oauth/token [post]

func OAuthUserinfo

func OAuthUserinfo(router *gin.RouterGroup)

OAuthUserinfo should return information about the authenticated user, see https://github.com/photoprism/photoprism/issues/4369.

GET /api/v1/oauth/userinfo

func OIDCLogin

func OIDCLogin(router *gin.RouterGroup)

OIDCLogin redirects a browser to the login page of the configured OpenID Connect provider, if any.

GET /api/v1/oidc/login

func OIDCRedirect

func OIDCRedirect(router *gin.RouterGroup)

OIDCRedirect creates a new API access token when a user has been successfully authenticated via OIDC, and then redirects the browser back to the app.

GET /api/v1/oidc/redirect

func PhotoPrimary

func PhotoPrimary(router *gin.RouterGroup)

PhotoPrimary sets the primary file for a photo.

@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
@Param		uid					path		string	true	"photo uid"
@Param		fileuid				path		string	true	"file uid"
@Router		/api/v1/photos/{uid}/files/{fileuid}/primary [post]

func PhotoUnstack

func PhotoUnstack(router *gin.RouterGroup)

PhotoUnstack removes a file from an existing photo stack.

@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
@Param		uid						path		string	true	"photo uid"
@Param		fileuid					path		string	true	"file uid"
@Router		/api/v1/photos/{uid}/files/{fileuid}/unstack [post]

func PostVisionCaption

func PostVisionCaption(router *gin.RouterGroup)

PostVisionCaption returns a suitable caption for an image.

@Summary	returns a suitable caption for an image
@Id			PostVisionCaption
@Tags		Vision
@Produce	json
@Success	200					{object}	vision.ApiResponse
@Failure	401,403,404,429,501	{object}	i18n.Response
@Param		images				body		vision.ApiRequest	true	"list of image file urls"
@Router		/api/v1/vision/caption [post]

func PostVisionFace

func PostVisionFace(router *gin.RouterGroup)

PostVisionFace returns the embeddings of a face.

@Summary	returns the embeddings of a face image
@Id			PostVisionFace
@Tags		Vision
@Produce	json
@Success	200				{object}	vision.ApiResponse
@Failure	401,403,429,501	{object}	i18n.Response
@Param		images			body		vision.ApiRequest	true	"list of image file urls"
@Router		/api/v1/vision/face [post]

func PostVisionLabels

func PostVisionLabels(router *gin.RouterGroup)

PostVisionLabels returns suitable labels for an image.

@Summary	returns suitable labels for an image
@Id			PostVisionLabels
@Tags		Vision
@Accept		json
@Produce	json
@Success	200			{object}	vision.ApiResponse
@Failure	401,403,429	{object}	i18n.Response
@Param		images		body		vision.ApiRequest	true	"list of image file urls"
@Router		/api/v1/vision/labels [post]

func PostVisionNsfw

func PostVisionNsfw(router *gin.RouterGroup)

PostVisionNsfw checks the specified images for inappropriate content.

@Summary	checks the specified images for inappropriate content
@Id			PostVisionNsfw
@Tags		Vision
@Accept		json
@Produce	json
@Success	200			{object}	vision.ApiResponse
@Failure	401,403,429	{object}	i18n.Response
@Param		images		body		vision.ApiRequest	true	"list of image file urls"
@Router		/api/v1/vision/nsfw [post]

func ProcessUserUpload

func ProcessUserUpload(router *gin.RouterGroup)

ProcessUserUpload triggers processing once all files have been uploaded.

PUT /users/:uid/upload/:token

func PublishAlbumEvent

func PublishAlbumEvent(ev Event, uid string, c *gin.Context)

PublishAlbumEvent publishes updated album data after changes have been made.

func PublishLabelEvent

func PublishLabelEvent(ev Event, uid string, c *gin.Context)

PublishLabelEvent publishes updated label data after changes have been made.

func PublishPhotoEvent

func PublishPhotoEvent(ev Event, uid string, c *gin.Context)

PublishPhotoEvent publishes updated photo data after changes have been made.

func PublishSubjectEvent

func PublishSubjectEvent(ev Event, uid string, c *gin.Context)

PublishSubjectEvent publishes updated subject data after changes have been made.

func RemoveFromAlbumCoverCache

func RemoveFromAlbumCoverCache(uid string)

RemoveFromAlbumCoverCache removes covers by album UID e.g. after adding or removing photos.

func RemoveFromFolderCache

func RemoveFromFolderCache(rootName string)

RemoveFromFolderCache removes an item from the folder cache e.g. after indexing.

func RemovePhotoLabel

func RemovePhotoLabel(router *gin.RouterGroup)

RemovePhotoLabel removes a label from a photo.

@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
@Param		uid						path		string	true	"photo uid"
@Param		id						path		string	true	"label id"
@Router		/api/v1/photos/{uid}/label/{id} [delete]

func RemovePhotosFromAlbum

func RemovePhotosFromAlbum(router *gin.RouterGroup)

RemovePhotosFromAlbum removes photos from an album.

@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
@Param		photos				body		form.Selection	true	"Photo Selection"
@Param		uid					path		string			true	"Album UID"
@Router		/api/v1/albums/{uid}/photos [delete]

func SaveAlbumYaml

func SaveAlbumYaml(album entity.Album)

SaveAlbumYaml saves the album metadata to a YAML backup file.

func SaveConfigOptions

func SaveConfigOptions(router *gin.RouterGroup)

SaveConfigOptions updates backend config options.

@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
@Param		options				body		config.Options	true	"properties to be updated (only submit values that should be changed)"
@Router		/api/v1/config/options [post]

func SaveSettings

func SaveSettings(router *gin.RouterGroup)

SaveSettings saves the user app settings.

@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
@Param		settings			body		customize.Settings	true "user settings"
@Router		/api/v1/settings [post]

func SaveSidecarYaml

func SaveSidecarYaml(photo *entity.Photo)

SaveSidecarYaml saves the photo metadata to a YAML sidecar file.

func SearchAlbums

func SearchAlbums(router *gin.RouterGroup)

SearchAlbums finds albums and returns them as JSON.

@Summary	finds albums and returns them as JSON
@Id			SearchAlbums
@Tags		Albums
@Produce	json
@Success	200		{object}	search.AlbumResults
@Failure	400,404	{object}	i18n.Response
@Param		count	query		int		true	"maximum number of results"	minimum(1)	maximum(100000)
@Param		offset	query		int		false	"search result offset"		minimum(0)	maximum(100000)
@Param		order	query		string	false	"sort order"				Enums(favorites, name, title, added, edited)
@Param		q		query		string	false	"search query"
@Router		/api/v1/albums [get]

func SearchFaces

func SearchFaces(router *gin.RouterGroup)

SearchFaces finds and returns faces as JSON.

@Summary	finds and returns faces as JSON
@Id			SearchFaces
@Tags		Faces
@Produce	json
@Success	200					{object}	search.FaceResults
@Failure	400,401,403,429,404	{object}	i18n.Response
@Param		count				query		int		true	"maximum number of results"	minimum(1)	maximum(100000)
@Param		offset				query		int		false	"search result offset"		minimum(0)	maximum(100000)
@Param		order				query		string	false	"sort order"				Enums(subject, added, samples)
@Param		hidden				query		string	false	"show hidden"				Enums(yes, no)
@Param		unknown				query		string	false	"show unknown"				Enums(yes, no)
@Router		/api/v1/faces [get]

func SearchFolders

func SearchFolders(router *gin.RouterGroup, urlPath, rootName, rootPath string)

SearchFolders is a reusable request handler for directory listings (GET /api/v1/folders/*).

func SearchFoldersImport

func SearchFoldersImport(router *gin.RouterGroup)

SearchFoldersImport returns import folders as JSON.

GET /api/v1/folders/import

func SearchFoldersOriginals

func SearchFoldersOriginals(router *gin.RouterGroup)

SearchFoldersOriginals returns folders in originals as JSON.

GET /api/v1/folders/originals

func SearchGeo

func SearchGeo(router *gin.RouterGroup)

SearchGeo finds photos and returns results as JSON, so they can be displayed on a map or in a viewer. See form.SearchPhotosGeo for supported search params and data types.

@Summary	finds photos and returns results as JSON, so they can be displayed on a map or in a viewer
@Id			SearchGeo
@Tags		Photos
@Produce	json
@Success	200				{object}	search.GeoResults
@Failure	400,401,403,404	{object}	i18n.Response
@Param		count			query		int		true	"maximum number of files"	minimum(1)	maximum(100000)
@Param		offset			query		int		false	"file offset"				minimum(0)	maximum(100000)
@Param		public			query		bool	false	"excludes private pictures"
@Param		quality			query		int		true	"minimum quality score (1-7)"	Enums(0, 1, 2, 3, 4, 5, 6, 7)
@Param		q				query		string	false	"search query"
@Param		s				query		string	false	"album uid"
@Param		path			query		string	false	"photo path"
@Param		video			query		bool	false	"is type video"
@Router		/api/v1/geo [get]

func SearchLabels

func SearchLabels(router *gin.RouterGroup)

SearchLabels finds and returns labels as JSON.

@Summary	finds and returns labels as JSON
@Id			SearchLabels
@Tags		Labels
@Produce	json
@Success	200				{object}	search.Label
@Failure	401,429,403,400	{object}	i18n.Response
@Param		count			query		int		true	"maximum number of results"	minimum(1)	maximum(100000)
@Param		offset			query		int		false	"search result offset"		minimum(0)	maximum(100000)
@Param		all				query		bool	false	"show all"
@Param		q				query		string	false	"search query"
@Router		/api/v1/labels [get]

func SearchPhotos

func SearchPhotos(router *gin.RouterGroup)

SearchPhotos finds pictures and returns them as JSON.

@Summary		finds pictures and returns them as JSON
@Description	Fore more information see:
@Description	- https://docs.photoprism.app/developer-guide/api/search/#get-apiv1photos
@Id				SearchPhotos
@Tags			Photos
@Produce		json
@Success		200				{object}	search.PhotoResults
@Failure		400,401,403,404	{object}	i18n.Response
@Param			count			query		int		true	"maximum number of files"	minimum(1)	maximum(100000)
@Param			offset			query		int		false	"file offset"				minimum(0)	maximum(100000)
@Param			order			query		string	false	"sort order"				Enums(favorites, name, title, added, edited)
@Param			merged			query		bool	false	"groups consecutive files that belong to the same photo"
@Param			public			query		bool	false	"excludes private pictures"
@Param			quality			query		int		true	"minimum quality score (1-7)"	Enums(0, 1, 2, 3, 4, 5, 6, 7)
@Param			q				query		string	false	"search query"
@Param			s				query		string	false	"album uid"
@Param			path			query		string	false	"photo path"
@Param			video			query		bool	false	"is type video"
@Router			/api/v1/photos [get]

func SearchServices

func SearchServices(router *gin.RouterGroup)

SearchServices finds account settings and returns them as JSON.

@Summary	finds services and returns them as JSON
@Id			SearchServices
@Tags		Services
@Produce	json
@Success	200				{object}	entity.Services
@Failure	401,403,404,429	{object}	i18n.Response
@Param		count			query		int	true	"maximum number of results"	minimum(1)	maximum(100000)
@Router		/api/v1/services [get]

func SearchSubjects

func SearchSubjects(router *gin.RouterGroup)

SearchSubjects finds and returns subjects as JSON.

@Summary	finds and returns subjects as JSON
@Id			SearchSubjects
@Tags		Subjects
@Produce	json
@Success	200				{object}	search.SubjectResults
@Failure	401,429,403,400	{object}	i18n.Response
@Param		count			query		int		true	"maximum number of results"	minimum(1)	maximum(100000)
@Param		offset			query		int		false	"search result offset"		minimum(0)	maximum(100000)
@Param		order			query		string	false	"sort order"				Enums(name, count, added, relevance)
@Param		hidden			query		string	false	"show hidden"				Enums(yes, no)
@Param		files			query		int		false	"minimum number of files"
@Param		q				query		string	false	"search query"
@Router		/api/v1/subjects [get]

func SendFeedback

func SendFeedback(router *gin.RouterGroup)

SendFeedback sends a feedback message.

POST /api/v1/feedback

func Session

func Session(clientIp, authToken string) (sess *entity.Session)

Session finds the client session for the specified auth token, or returns nil if not found.

func SharePreview

func SharePreview(router *gin.RouterGroup)

SharePreview returns a preview image for the given share uid if the token is valid.

GET /s/:token/:shared/preview TODO: Proof of concept, needs refactoring.

func Shares

func Shares(router *gin.RouterGroup)

Shares handles link share

GET /s/:token/...

func StartImport

func StartImport(router *gin.RouterGroup)

StartImport imports media files from a directory and converts/indexes them as needed.

@Summary	start import
@Id			StartImport
@Tags		Library
@Accept		json
@Produce	json
@Success	200			{object}	i18n.Response
@Failure	400,401,403	{object}	i18n.Response
@Param		options		body		form.ImportOptions	true	"import options"
@Router		/api/v1/import/ [post]

func StartIndexing

func StartIndexing(router *gin.RouterGroup)

StartIndexing indexes media files in the "originals" folder.

@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
@Param		options				body		form.IndexOptions	true	"index options"
@Router		/api/v1/index [post]

func StopServer

func StopServer(router *gin.RouterGroup)

StopServer initiates a server restart if the user is authorized.

POST /api/v1/server/stop

func UpdateAlbum

func UpdateAlbum(router *gin.RouterGroup)

UpdateAlbum updates album metadata like title and description.

@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
@Param		uid						path		string		true	"Album UID"
@Param		album					body		form.Album	true	"properties to be updated"
@Router		/api/v1/albums/{uid} [put]
func UpdateAlbumLink(router *gin.RouterGroup)

UpdateAlbumLink updates an album share link and return it as JSON.

@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
@Param		uid						path		string		true	"album uid"
@Param		linkuid					path		string		true	"link uid"
@Param		link					body		form.Link	true	"properties to be updated (currently supported: slug, expires, token)"
@Router		/api/v1/albums/{uid}/links/{linkuid} [put]

func UpdateClientConfig

func UpdateClientConfig()

UpdateClientConfig publishes updated client configuration values over the websocket connections.

func UpdateFace

func UpdateFace(router *gin.RouterGroup)

UpdateFace updates face properties.

@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
@Param		id						path		string		true	"face id"
@Param		face					body		form.Face	true	"properties to be updated"
@Router		/api/v1/faces/{id} [put]

func UpdateLabel

func UpdateLabel(router *gin.RouterGroup)

UpdateLabel updates label properties.

PUT /api/v1/labels/:uid

@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
@Param		uid				path		string		true	"Label UID"
@Param		label			body		form.Label	true	"Label Name"
@Router		/api/v1/labels/{uid} [put]
func UpdateLink(c *gin.Context)

UpdateLink updates a share link and return it as JSON.

PUT /api/v1/:entity/:uid/links/:link

func UpdateMarker

func UpdateMarker(router *gin.RouterGroup)

UpdateMarker updates an existing file area marker to assign faces or other subjects.

The request parameters are:

  • marker_uid: string Marker UID as returned by the API

PUT /api/v1/markers/:marker_uid

func UpdatePhoto

func UpdatePhoto(router *gin.RouterGroup)

UpdatePhoto updates picture details and returns them as JSON.

@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
@Param		uid						path		string		true	"Photo UID"
@Param		photo					body		form.Photo	true	"properties to be updated (only submit values that should be changed)"
@Router		/api/v1/photos/{uid} [put]

func UpdatePhotoLabel

func UpdatePhotoLabel(router *gin.RouterGroup)

UpdatePhotoLabel changes a photo label.

@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
@Param		uid						path		string		true	"photo uid"
@Param		id						path		string		true	"label id"
@Param		label					body		form.Label	true	"properties to be updated (currently supports: uncertainty)"
@Router		/api/v1/photos/{uid}/label/{id} [put]

func UpdateService

func UpdateService(router *gin.RouterGroup)

UpdateService updates a remote account configuration.

@Summary	updates a remote account configuration
@Id			UpdateService
@Tags		Services
@Accept		json
@Produce	json
@Success	200						{object}	entity.Service
@Failure	400,401,403,404,429,500	{object}	i18n.Response
@Param		id						path		string			true	"service id"
@Param		service					body		form.Service	true	"properties to be updated (only submit values that should be changed)"
@Router		/api/v1/services/{id} [put]

func UpdateSubject

func UpdateSubject(router *gin.RouterGroup)

UpdateSubject updates subject properties.

@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
@Param		uid						path		string			true	"subject uid"
@Param		subject					body		form.Subject	true	"properties to be updated (only submit values that should be changed)"
@Router		/api/v1/subjects/{uid} [put]

func UpdateUser

func UpdateUser(router *gin.RouterGroup)

UpdateUser updates the profile information of the currently authenticated user.

@Tags	Users
@Router /api/v1/users/{uid} [put]

func UpdateUserPassword

func UpdateUserPassword(router *gin.RouterGroup)

UpdateUserPassword changes the password of the currently authenticated user.

@Tags	Users, Authentication
@Router /api/v1/users/{uid}/password [put]

func UploadCheckFile

func UploadCheckFile(destName string, rejectRaw bool, totalSizeLimit int64) (remainingSizeLimit int64, err error)

UploadCheckFile checks if the file is supported and has the correct extension.

func UploadToService

func UploadToService(router *gin.RouterGroup)

UploadToService uploads files to the selected service account.

@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
@Failure	401,403,404,429	{object}	i18n.Response
@Router		/api/v1/services/{id}/upload [post]

func UploadUserAvatar

func UploadUserAvatar(router *gin.RouterGroup)

UploadUserAvatar updates the avatar image of the currently authenticated user.

@Tags	Users
@Router	/api/v1/users/{uid}/avatar [post]

func UploadUserFiles

func UploadUserFiles(router *gin.RouterGroup)

UploadUserFiles adds files to the user upload folder, from where they can be moved and indexed.

@Tags	Users, Files
@Router /users/{uid}/upload/{token} [post]

func UserAgent

func UserAgent(c *gin.Context) string

UserAgent returns the user agent from the request context or an empty string if it is unknown.

func WebSocket

func WebSocket(router *gin.RouterGroup)

WebSocket registers the /ws endpoint for establishing websocket connections.

func ZipCreate

func ZipCreate(router *gin.RouterGroup)

ZipCreate creates a zip file archive for download.

@Tags	Download
@Router	/api/v1/zip [post]

func ZipDownload

func ZipDownload(router *gin.RouterGroup)

ZipDownload downloads a zip file archive.

GET /api/v1/zip/:filename

Types

type ByteCache

type ByteCache struct {
	Data []byte
}

type Event

type Event string

Event represents an api event type.

const (
	StatusCreated Event = "created"
	StatusUpdated Event = "updated"
	StatusDeleted Event = "deleted"
	StatusSuccess Event = "success"
	StatusFailed  Event = "failed"
)

func (Event) String

func (ev Event) String() string

String returns the event type as string.

type FoldersResponse

type FoldersResponse struct {
	Root      string          `json:"root,omitempty"`
	Folders   []entity.Folder `json:"folders"`
	Files     []entity.File   `json:"files,omitempty"`
	Recursive bool            `json:"recursive,omitempty"`
	Cached    bool            `json:"cached,omitempty"`
}

FoldersResponse represents the folders API response.

type Response

type Response struct {
	Code    int    `json:"code"`
	Err     string `json:"error,omitempty"`
	Msg     string `json:"message,omitempty"`
	Details string `json:"details,omitempty"`
}

Response represents a server status response.

func NewResponse

func NewResponse(code int, err error, details string) Response

NewResponse creates a new server status response.

type ThumbCache

type ThumbCache struct {
	FileName  string
	ShareName string
}

Directories

Path Synopsis
Package download allows to register files so that they can be temporarily made available for download.
Package download allows to register files so that they can be temporarily made available for download.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL