Documentation ¶
Overview ¶
Package api provides REST-API authentication and request handlers.
Copyright (c) 2018 - 2024 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
- Variables
- func Abort(c *gin.Context, code int, id i18n.Message, params ...interface{})
- func AbortAlbumNotFound(c *gin.Context)
- func AbortBadRequest(c *gin.Context)
- func AbortBusy(c *gin.Context)
- func AbortDeleteFailed(c *gin.Context)
- func AbortEntityNotFound(c *gin.Context)
- func AbortFeatureDisabled(c *gin.Context)
- func AbortForbidden(c *gin.Context)
- func AbortSaveFailed(c *gin.Context)
- func AbortUnauthorized(c *gin.Context)
- func AbortUnexpectedError(c *gin.Context)
- func AddAuthTokenHeader(c *gin.Context, authToken string)
- func AddCacheHeader(c *gin.Context, maxAge ttl.Duration, public bool)
- func AddContentTypeHeader(c *gin.Context, contentType string)
- func AddCountHeader(c *gin.Context, count int)
- func AddCoverCacheHeader(c *gin.Context)
- func AddDownloadHeader(c *gin.Context, fileName string)
- func AddFileCountHeaders(c *gin.Context, filesCount, foldersCount int)
- func AddImmutableCacheHeader(c *gin.Context)
- func AddLimitHeader(c *gin.Context, limit int)
- func AddOffsetHeader(c *gin.Context, offset int)
- func AddPhotoLabel(router *gin.RouterGroup)
- func AddPhotosToAlbum(router *gin.RouterGroup)
- func AddService(router *gin.RouterGroup)
- func AddTokenHeaders(c *gin.Context, s *entity.Session)
- func AddVideoCacheHeader(c *gin.Context, cdn bool)
- func AlbumCover(router *gin.RouterGroup)
- func ApprovePhoto(router *gin.RouterGroup)
- func Auth(c *gin.Context, resource acl.Resource, grant acl.Permission) *entity.Session
- func AuthAny(c *gin.Context, resource acl.Resource, grants acl.Permissions) (s *entity.Session)
- func AuthToken(c *gin.Context) string
- func BatchAlbumsDelete(router *gin.RouterGroup)
- func BatchLabelsDelete(router *gin.RouterGroup)
- func BatchPhotosApprove(router *gin.RouterGroup)
- func BatchPhotosArchive(router *gin.RouterGroup)
- func BatchPhotosDelete(router *gin.RouterGroup)
- func BatchPhotosPrivate(router *gin.RouterGroup)
- func BatchPhotosRestore(router *gin.RouterGroup)
- func CacheKey(ns, uid, name string) string
- func CancelImport(router *gin.RouterGroup)
- func CancelIndexing(router *gin.RouterGroup)
- func ChangeFileOrientation(router *gin.RouterGroup)
- func ClearMarkerSubject(router *gin.RouterGroup)
- func ClientIP(c *gin.Context) (ip string)
- func CloneAlbums(router *gin.RouterGroup)
- func Connect(router *gin.RouterGroup)
- func CreateAlbum(router *gin.RouterGroup)
- func CreateAlbumLink(router *gin.RouterGroup)
- func CreateLink(c *gin.Context)
- func CreateMarker(router *gin.RouterGroup)
- func CreateOAuthToken(router *gin.RouterGroup)
- func CreateSession(router *gin.RouterGroup)
- func CreateSessionResponse(authToken string, sess *entity.Session, conf config.ClientConfig) gin.H
- func DeleteAlbum(router *gin.RouterGroup)
- func DeleteAlbumLink(router *gin.RouterGroup)
- func DeleteErrors(router *gin.RouterGroup)
- func DeleteFile(router *gin.RouterGroup)
- func DeleteLink(c *gin.Context)
- func DeleteService(router *gin.RouterGroup)
- func DeleteSession(router *gin.RouterGroup)
- func DeleteSessionResponse(id string) gin.H
- func DislikeAlbum(router *gin.RouterGroup)
- func DislikeLabel(router *gin.RouterGroup)
- func DislikePhoto(router *gin.RouterGroup)
- func DislikeSubject(router *gin.RouterGroup)
- func DownloadAlbum(router *gin.RouterGroup)
- func DownloadName(c *gin.Context) customize.DownloadName
- func Echo(router *gin.RouterGroup)
- func Error(c *gin.Context, code int, err error, id i18n.Message, params ...interface{})
- func FlushCoverCache()
- func FolderCover(router *gin.RouterGroup)
- func GetAlbum(router *gin.RouterGroup)
- func GetAlbumLinks(router *gin.RouterGroup)
- func GetClientConfig(router *gin.RouterGroup)
- func GetConfigOptions(router *gin.RouterGroup)
- func GetDownload(router *gin.RouterGroup)
- func GetErrors(router *gin.RouterGroup)
- func GetFace(router *gin.RouterGroup)
- func GetFile(router *gin.RouterGroup)
- func GetMetrics(router *gin.RouterGroup)
- func GetMomentsTime(router *gin.RouterGroup)
- func GetPhoto(router *gin.RouterGroup)
- func GetPhotoDownload(router *gin.RouterGroup)
- func GetPhotoYaml(router *gin.RouterGroup)
- func GetService(router *gin.RouterGroup)
- func GetServiceFolders(router *gin.RouterGroup)
- func GetSession(router *gin.RouterGroup)
- func GetSessionResponse(authToken string, sess *entity.Session, conf config.ClientConfig) gin.H
- func GetSettings(router *gin.RouterGroup)
- func GetStatus(router *gin.RouterGroup)
- func GetSubject(router *gin.RouterGroup)
- func GetSvg(router *gin.RouterGroup)
- func GetThumb(router *gin.RouterGroup)
- func GetVideo(router *gin.RouterGroup)
- func InvalidDownloadToken(c *gin.Context) bool
- func InvalidPreviewToken(c *gin.Context) bool
- func LabelCover(router *gin.RouterGroup)
- func LikeAlbum(router *gin.RouterGroup)
- func LikeLabel(router *gin.RouterGroup)
- func LikePhoto(router *gin.RouterGroup)
- func LikeSubject(router *gin.RouterGroup)
- func PhotoPrimary(router *gin.RouterGroup)
- func PhotoUnstack(router *gin.RouterGroup)
- func ProcessUserUpload(router *gin.RouterGroup)
- func PublishAlbumEvent(ev Event, uid string, c *gin.Context)
- func PublishLabelEvent(ev Event, uid string, c *gin.Context)
- func PublishPhotoEvent(ev Event, uid string, c *gin.Context)
- func PublishSubjectEvent(ev Event, uid string, c *gin.Context)
- func RemoveFromAlbumCoverCache(uid string)
- func RemoveFromFolderCache(rootName string)
- func RemovePhotoLabel(router *gin.RouterGroup)
- func RemovePhotosFromAlbum(router *gin.RouterGroup)
- func RevokeOAuthToken(router *gin.RouterGroup)
- func SaveAlbumAsYaml(a entity.Album)
- func SaveConfigOptions(router *gin.RouterGroup)
- func SavePhotoAsYaml(p entity.Photo)
- func SaveSettings(router *gin.RouterGroup)
- func SearchAlbums(router *gin.RouterGroup)
- func SearchFaces(router *gin.RouterGroup)
- func SearchFolders(router *gin.RouterGroup, urlPath, rootName, rootPath string)
- func SearchFoldersImport(router *gin.RouterGroup)
- func SearchFoldersOriginals(router *gin.RouterGroup)
- func SearchGeo(router *gin.RouterGroup)
- func SearchLabels(router *gin.RouterGroup)
- func SearchPhotos(router *gin.RouterGroup)
- func SearchServices(router *gin.RouterGroup)
- func SearchSubjects(router *gin.RouterGroup)
- func SendFeedback(router *gin.RouterGroup)
- func Session(clientIp, authToken string) *entity.Session
- func SharePreview(router *gin.RouterGroup)
- func Shares(router *gin.RouterGroup)
- func StartImport(router *gin.RouterGroup)
- func StartIndexing(router *gin.RouterGroup)
- func StopServer(router *gin.RouterGroup)
- func UpdateAlbum(router *gin.RouterGroup)
- func UpdateAlbumLink(router *gin.RouterGroup)
- func UpdateClientConfig()
- func UpdateFace(router *gin.RouterGroup)
- func UpdateLabel(router *gin.RouterGroup)
- func UpdateLink(c *gin.Context)
- func UpdateMarker(router *gin.RouterGroup)
- func UpdatePhoto(router *gin.RouterGroup)
- func UpdatePhotoLabel(router *gin.RouterGroup)
- func UpdateService(router *gin.RouterGroup)
- func UpdateSubject(router *gin.RouterGroup)
- func UpdateUser(router *gin.RouterGroup)
- func UpdateUserPassword(router *gin.RouterGroup)
- func UploadToService(router *gin.RouterGroup)
- func UploadUserAvatar(router *gin.RouterGroup)
- func UploadUserFiles(router *gin.RouterGroup)
- func UserAgent(c *gin.Context) string
- func WebSocket(router *gin.RouterGroup)
- func ZipCreate(router *gin.RouterGroup)
- func ZipDownload(router *gin.RouterGroup)
- type ByteCache
- type Event
- type FoldersResponse
- type Response
- type ThumbCache
Constants ¶
const (
UploadPath = "/upload"
)
Variables ¶
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 AbortAlbumNotFound ¶
AbortAlbumNotFound aborts with status code 404.
func AbortBadRequest ¶
func AbortDeleteFailed ¶
func AbortEntityNotFound ¶
AbortEntityNotFound aborts with status code 404.
func AbortFeatureDisabled ¶
func AbortForbidden ¶
AbortForbidden aborts with status code 403.
func AbortSaveFailed ¶
func AbortUnauthorized ¶
AbortUnauthorized aborts with status code 401.
func AbortUnexpectedError ¶
func AddAuthTokenHeader ¶
AddAuthTokenHeader adds an X-Auth-Token header to the response.
func AddCacheHeader ¶
AddCacheHeader adds a cache control header to the response.
func AddContentTypeHeader ¶
AddContentTypeHeader adds a content type header to the response.
func AddCountHeader ¶
AddCountHeader adds the actual result count to the response.
func AddCoverCacheHeader ¶
AddCoverCacheHeader adds cover image cache control headers to the response.
func AddDownloadHeader ¶
AddDownloadHeader adds a header indicating the response is expected to be downloaded.
func AddFileCountHeaders ¶
AddFileCountHeaders adds file and folder counts to the response.
func AddImmutableCacheHeader ¶
AddImmutableCacheHeader adds cache control headers to the response for immutable content like thumbnails.
func AddLimitHeader ¶
AddLimitHeader adds the max result count to the response.
func AddOffsetHeader ¶
AddOffsetHeader adds the result offset to the response.
func AddPhotoLabel ¶
func AddPhotoLabel(router *gin.RouterGroup)
AddPhotoLabel adds a label to a photo.
The request parameters are:
- uid: string PhotoUID as returned by the API
POST /api/v1/photos/:uid/label
func AddPhotosToAlbum ¶
func AddPhotosToAlbum(router *gin.RouterGroup)
AddPhotosToAlbum adds photos to an album.
POST /api/v1/albums/:uid/photos
func AddService ¶
func AddService(router *gin.RouterGroup)
AddService creates a new remote account configuration.
POST /api/v1/services
func AddTokenHeaders ¶
AddTokenHeaders adds preview token headers to the response.
func AddVideoCacheHeader ¶
AddVideoCacheHeader adds video cache control headers to the response.
func AlbumCover ¶
func AlbumCover(router *gin.RouterGroup)
AlbumCover returns an album cover image.
The request parameters are:
- uid: string album uid
- token: string security token (see config)
- size: string thumb type, see photoprism.ThumbnailTypes
GET /api/v1/albums/:uid/t/:token/:size
func ApprovePhoto ¶
func ApprovePhoto(router *gin.RouterGroup)
ApprovePhoto marks a photo in review as approved.
The request parameters are:
- uid: string PhotoUID as returned by the API
POST /api/v1/photos/:uid/approve
func Auth ¶
Auth checks if the user is authorized to access a resource with the given permission and returns the session or nil otherwise.
func AuthAny ¶
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 ¶
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.
POST /api/v1/batch/albums/delete
func BatchLabelsDelete ¶
func BatchLabelsDelete(router *gin.RouterGroup)
BatchLabelsDelete deletes multiple labels.
POST /api/v1/batch/labels/delete
func BatchPhotosApprove ¶
func BatchPhotosApprove(router *gin.RouterGroup)
BatchPhotosApprove approves multiple photos that are currently under review.
POST /api/v1/batch/photos/approve
func BatchPhotosArchive ¶
func BatchPhotosArchive(router *gin.RouterGroup)
BatchPhotosArchive moves multiple photos to the archive.
POST /api/v1/batch/photos/archive
func BatchPhotosDelete ¶
func BatchPhotosDelete(router *gin.RouterGroup)
BatchPhotosDelete permanently removes multiple photos from the archive.
POST /api/v1/batch/photos/delete
func BatchPhotosPrivate ¶
func BatchPhotosPrivate(router *gin.RouterGroup)
BatchPhotosPrivate flags multiple photos as private.
POST /api/v1/batch/photos/private
func BatchPhotosRestore ¶
func BatchPhotosRestore(router *gin.RouterGroup)
BatchPhotosRestore restores multiple photos from the archive.
POST /api/v1/batch/photos/restore
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.
The request parameters are:
- uid: string Photo UID as returned by the API
- file_uid: string File UID as returned by the API
PUT /api/v1/photos/:uid/files/:file_uid/orientation
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 ¶
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.
POST /api/v1/albums/:uid/clone
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 adds a new album.
POST /api/v1/albums
func CreateAlbumLink ¶
func CreateAlbumLink(router *gin.RouterGroup)
CreateAlbumLink adds a new album share link and return it as JSON.
POST /api/v1/albums/:uid/links
func CreateLink ¶
CreateLink adds a new share link and return it as JSON.
POST /api/v1/:entity/:uid/links
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.
POST /api/v1/markers
func CreateOAuthToken ¶
func CreateOAuthToken(router *gin.RouterGroup)
CreateOAuthToken creates a new access token for clients that authenticate with valid OAuth2 client credentials.
POST /api/v1/oauth/token
func CreateSession ¶
func CreateSession(router *gin.RouterGroup)
CreateSession creates a new client session and returns it as JSON if authentication was successful.
POST /api/v1/session POST /api/v1/sessions
func CreateSessionResponse ¶
CreateSessionResponse returns the authentication response data for POST requests based on the session and configuration.
func DeleteAlbum ¶
func DeleteAlbum(router *gin.RouterGroup)
DeleteAlbum deletes an existing album.
DELETE /api/v1/albums/:uid
func DeleteAlbumLink ¶
func DeleteAlbumLink(router *gin.RouterGroup)
DeleteAlbumLink deletes an album share link.
DELETE /api/v1/albums/:uid/links/:link
func DeleteErrors ¶
func DeleteErrors(router *gin.RouterGroup)
DeleteErrors removes all entries from the error logs.
DELETE /api/v1/errors
func DeleteFile ¶
func DeleteFile(router *gin.RouterGroup)
DeleteFile removes a file from storage.
The request parameters are:
- uid: string Photo UID as returned by the API
- file_uid: string File UID as returned by the API
DELETE /api/v1/photos/:uid/files/:file_uid
func DeleteService ¶
func DeleteService(router *gin.RouterGroup)
DeleteService removes a remote account configuration.
DELETE /api/v1/services/:id
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 ¶
DeleteSessionResponse returns a confirmation response for DELETE requests.
func DislikeAlbum ¶
func DislikeAlbum(router *gin.RouterGroup)
DislikeAlbum removes the favorite flag from an album.
The request parameters are:
- uid: string Album UID
DELETE /api/v1/albums/:uid/like
func DislikeLabel ¶
func DislikeLabel(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
func DislikePhoto ¶
func DislikePhoto(router *gin.RouterGroup)
DislikePhoto removes the favorite flags from a photo.
DELETE /api/v1/photos/:uid/like
func DislikeSubject ¶
func DislikeSubject(router *gin.RouterGroup)
DislikeSubject removes the favorite flag from a subject.
The request parameters are:
- uid: string Subject UID
DELETE /api/v1/subjects/:uid/like
func DownloadAlbum ¶
func DownloadAlbum(router *gin.RouterGroup)
DownloadAlbum streams the album contents as zip archive.
GET /api/v1/albums/:uid/dl
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 FolderCover ¶
func FolderCover(router *gin.RouterGroup)
FolderCover returns a folder cover image.
The request parameters are:
- uid: string folder uid
- token: string url security token, see config
- size: string thumb type, see thumb.Sizes
GET /api/v1/folders/t/:hash/:token/:size
func GetAlbum ¶
func GetAlbum(router *gin.RouterGroup)
GetAlbum returns album details as JSON.
GET /api/v1/albums/:uid
func GetAlbumLinks ¶
func GetAlbumLinks(router *gin.RouterGroup)
GetAlbumLinks returns all share links for the given UID as JSON.
GET /api/v1/albums/:uid/links
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.
GET /api/v1/config/options
func GetDownload ¶
func GetDownload(router *gin.RouterGroup)
GetDownload returns the raw file data.
The request parameters are:
- hash: string The file hash as returned by the files/photos endpoint
GET /api/v1/dl/:hash
func GetErrors ¶
func GetErrors(router *gin.RouterGroup)
GetErrors searches the error logs and returns the results as JSON.
GET /api/v1/errors
func GetFace ¶
func GetFace(router *gin.RouterGroup)
GetFace returns a face as JSON.
GET /api/v1/faces/:id
func GetFile ¶
func GetFile(router *gin.RouterGroup)
GetFile returns file details as JSON.
The request parameters are:
- hash (string) SHA-1 hash of the file
GET /api/v1/files/:hash
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.
GET /api/v1/moments/time
func GetPhoto ¶
func GetPhoto(router *gin.RouterGroup)
GetPhoto returns photo details as JSON.
The request parameters are:
- uid (string) PhotoUID as returned by the API
GET /api/v1/photos/:uid
func GetPhotoDownload ¶
func GetPhotoDownload(router *gin.RouterGroup)
GetPhotoDownload returns the primary file matching that belongs to the photo.
Route :GET /api/v1/photos/:uid/dl
The request parameters are:
- uid (string) PhotoUID as returned by the API
func GetPhotoYaml ¶
func GetPhotoYaml(router *gin.RouterGroup)
GetPhotoYaml returns photo details as YAML.
The request parameters are:
- uid: string PhotoUID as returned by the API
GET /api/v1/photos/:uid/yaml
func GetService ¶
func GetService(router *gin.RouterGroup)
GetService returns an account as JSON.
GET /api/v1/services/:id
func GetServiceFolders ¶
func GetServiceFolders(router *gin.RouterGroup)
GetServiceFolders returns folders that belong to an account as JSON.
GET /api/v1/services/:id/folders
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 ¶
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.
GET /api/v1/settings
func GetStatus ¶
func GetStatus(router *gin.RouterGroup)
GetStatus reports if the server is operational.
GET /api/v1/status
func GetSubject ¶
func GetSubject(router *gin.RouterGroup)
GetSubject returns a subject as JSON.
GET /api/v1/subjects/:uid
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.
The request parameters are:
- thumb: string sha1 file hash plus optional crop area
- token: string url security token, see config
- size: string thumb type, see thumb.Sizes
GET /api/v1/t/:thumb/:token/:size
func GetVideo ¶
func GetVideo(router *gin.RouterGroup)
GetVideo streams video content.
The request parameters are:
- hash: string The photo or video file hash as returned by the search API
- type: string Video format
GET /api/v1/videos/:hash/:token/:type
func InvalidDownloadToken ¶
InvalidDownloadToken checks if the token found in the request is valid for file downloads.
func InvalidPreviewToken ¶
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.
The request parameters are:
- uid: string label uid
- token: string security token (see config)
- size: string thumb type, see photoprism.ThumbnailTypes
GET /api/v1/labels/:uid/t/:token/:size
func LikeAlbum ¶
func LikeAlbum(router *gin.RouterGroup)
LikeAlbum sets the favorite flag for an album.
The request parameters are:
- uid: string Album UID
POST /api/v1/albums/:uid/like
func LikeLabel ¶
func LikeLabel(router *gin.RouterGroup)
LikeLabel flags a label as favorite.
The request parameters are:
- uid: string Label UID
POST /api/v1/labels/:uid/like
func LikePhoto ¶
func LikePhoto(router *gin.RouterGroup)
LikePhoto flags a photo as favorite.
POST /api/v1/photos/:uid/like
func LikeSubject ¶
func LikeSubject(router *gin.RouterGroup)
LikeSubject flags a subject as favorite.
The request parameters are:
- uid: string Subject UID
POST /api/v1/subjects/:uid/like
func PhotoPrimary ¶
func PhotoPrimary(router *gin.RouterGroup)
PhotoPrimary sets the primary file for a photo.
The request parameters are:
- uid: string PhotoUID as returned by the API
- file_uid: string File UID as returned by the API
POST /photos/:uid/files/:file_uid/primary
func PhotoUnstack ¶
func PhotoUnstack(router *gin.RouterGroup)
PhotoUnstack removes a file from an existing photo stack.
The request parameters are:
- uid: string Photo UID as returned by the API
- file_uid: string File UID as returned by the API
POST /api/v1/photos/:uid/files/:file_uid/unstack
func ProcessUserUpload ¶
func ProcessUserUpload(router *gin.RouterGroup)
ProcessUserUpload triggers processing once all files have been uploaded.
PUT /users/:uid/upload/:token
func PublishAlbumEvent ¶
PublishAlbumEvent publishes updated album data after changes have been made.
func PublishLabelEvent ¶
PublishLabelEvent publishes updated label data after changes have been made.
func PublishPhotoEvent ¶
PublishPhotoEvent publishes updated photo data after changes have been made.
func PublishSubjectEvent ¶
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.
The request parameters are:
- uid: string PhotoUID as returned by the API
- id: int LabelId as returned by the API
DELETE /api/v1/photos/:uid/label/:id
func RemovePhotosFromAlbum ¶
func RemovePhotosFromAlbum(router *gin.RouterGroup)
RemovePhotosFromAlbum removes photos from an album.
DELETE /api/v1/albums/:uid/photos
func RevokeOAuthToken ¶
func RevokeOAuthToken(router *gin.RouterGroup)
RevokeOAuthToken takes an access token and deletes it. A client may only delete its own tokens.
POST /api/v1/oauth/revoke
func SaveAlbumAsYaml ¶
SaveAlbumAsYaml saves album data as YAML file.
func SaveConfigOptions ¶
func SaveConfigOptions(router *gin.RouterGroup)
SaveConfigOptions updates backend config options.
POST /api/v1/config/options
func SavePhotoAsYaml ¶
SavePhotoAsYaml saves photo data as YAML file.
func SaveSettings ¶
func SaveSettings(router *gin.RouterGroup)
SaveSettings saved the user app settings.
POST /api/v1/settings
func SearchAlbums ¶
func SearchAlbums(router *gin.RouterGroup)
SearchAlbums finds albums and returns them as JSON.
GET /api/v1/albums
func SearchFaces ¶
func SearchFaces(router *gin.RouterGroup)
SearchFaces finds and returns faces as JSON.
GET /api/v1/faces
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.
GET /api/v1/geo
func SearchLabels ¶
func SearchLabels(router *gin.RouterGroup)
SearchLabels finds and returns labels as JSON.
GET /api/v1/labels
func SearchPhotos ¶
func SearchPhotos(router *gin.RouterGroup)
SearchPhotos searches the pictures index and returns the result as JSON. See form.SearchPhotos for supported search params and data types.
GET /api/v1/photos
func SearchServices ¶
func SearchServices(router *gin.RouterGroup)
SearchServices finds account settings and returns them as JSON.
GET /api/v1/services
func SearchSubjects ¶
func SearchSubjects(router *gin.RouterGroup)
SearchSubjects finds and returns subjects as JSON.
GET /api/v1/subjects
func SendFeedback ¶
func SendFeedback(router *gin.RouterGroup)
SendFeedback sends a feedback message.
POST /api/v1/feedback
func 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 StartImport ¶
func StartImport(router *gin.RouterGroup)
StartImport imports media files from a directory and converts/indexes them as needed.
POST /api/v1/import*
func StartIndexing ¶
func StartIndexing(router *gin.RouterGroup)
StartIndexing indexes media files in the "originals" folder.
POST /api/v1/index
func StopServer ¶
func StopServer(router *gin.RouterGroup)
StopServer shuts down the server.
POST /api/v1/server/stop
func UpdateAlbum ¶
func UpdateAlbum(router *gin.RouterGroup)
UpdateAlbum updates album metadata like title and description.
PUT /api/v1/albums/:uid
func UpdateAlbumLink ¶
func UpdateAlbumLink(router *gin.RouterGroup)
UpdateAlbumLink updates an album share link and return it as JSON.
PUT /api/v1/albums/:uid/links/:link
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.
PUT /api/v1/faces/:id
func UpdateLabel ¶
func UpdateLabel(router *gin.RouterGroup)
UpdateLabel updates label properties.
PUT /api/v1/labels/:uid
func UpdateLink ¶
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 photo details and returns them as JSON.
PUT /api/v1/photos/:uid
func UpdatePhotoLabel ¶
func UpdatePhotoLabel(router *gin.RouterGroup)
UpdatePhotoLabel changes a photo labels.
The request parameters are:
- uid: string PhotoUID as returned by the API
- id: int LabelId as returned by the API
PUT /api/v1/photos/:uid/label/:id
func UpdateService ¶
func UpdateService(router *gin.RouterGroup)
UpdateService updates a remote account configuration.
PUT /api/v1/services/:id
func UpdateSubject ¶
func UpdateSubject(router *gin.RouterGroup)
UpdateSubject updates subject properties.
PUT /api/v1/subjects/:uid
func UpdateUser ¶
func UpdateUser(router *gin.RouterGroup)
UpdateUser updates the profile information of the currently authenticated user.
PUT /api/v1/users/:uid
func UpdateUserPassword ¶
func UpdateUserPassword(router *gin.RouterGroup)
UpdateUserPassword changes the password of the currently authenticated user.
PUT /api/v1/users/:uid/password
func UploadToService ¶
func UploadToService(router *gin.RouterGroup)
UploadToService uploads files to the selected account.
GET /api/v1/services/:id/upload
func UploadUserAvatar ¶
func UploadUserAvatar(router *gin.RouterGroup)
UploadUserAvatar updates the avatar image of the currently authenticated user.
POST /api/v1/users/:uid/avatar
func UploadUserFiles ¶
func UploadUserFiles(router *gin.RouterGroup)
UploadUserFiles adds files to the user upload folder, from where they can be moved and indexed.
POST /users/:uid/upload/:token
func UserAgent ¶
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.
POST /api/v1/zip
func ZipDownload ¶
func ZipDownload(router *gin.RouterGroup)
ZipDownload downloads a zip file archive.
GET /api/v1/zip/:filename
Types ¶
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.
type ThumbCache ¶
type ThumbCache struct { FileName string }
Source Files ¶
- abort.go
- albums.go
- albums_search.go
- api.go
- api_auth.go
- api_client_config.go
- api_event.go
- api_log.go
- api_request.go
- api_response.go
- api_response_headers.go
- auth_tokens.go
- batch.go
- cache.go
- config_options.go
- config_settings.go
- connect.go
- covers.go
- download_album.go
- download_file.go
- echo.go
- errors.go
- faces.go
- faces_search.go
- feedback.go
- file_delete.go
- file_orientation.go
- files.go
- folders_cover.go
- folders_search.go
- import.go
- index.go
- labels.go
- labels_search.go
- links.go
- markers.go
- metrics.go
- moments_time.go
- photo_label.go
- photo_unstack.go
- photos.go
- photos_search.go
- photos_search_geo.go
- reactions.go
- server.go
- services.go
- services_search.go
- services_upload.go
- session.go
- session_create.go
- session_delete.go
- session_get.go
- session_oauth.go
- session_response.go
- share.go
- share_preview.go
- status.go
- subjects.go
- subjects_search.go
- svg.go
- thumbnails.go
- users_avatar.go
- users_password.go
- users_update.go
- users_upload.go
- video.go
- websocket.go
- websocket_create.go
- websocket_reader.go
- websocket_writer.go
- zip.go