photoprism: github.com/photoprism/photoprism/internal/api Index | Files

package api

import "github.com/photoprism/photoprism/internal/api"

Package api contains PhotoPrism REST API handlers.

Copyright (c) 2018 - 2020 Michael Mayer <hello@photoprism.org>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

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.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

PhotoPrism™ is a registered trademark of Michael Mayer.  You may use it as required
to describe our software, run your own server, for educational purposes, but not for
offering commercial goods, products, or services without prior written permission.
In other words, please ask.

Feel free to send an e-mail to hello@photoprism.org 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.org/developer-guide/

Package api contains REST request handlers used by the server package.

Additional information concerning the API can be found in our Developer Guide:

https://github.com/photoprism/photoprism/wiki/REST-API

Index

Package Files

account.go album.go api.go batch.go config.go doc.go download.go errors.go event.go file.go folder.go geo.go import.go index.go label.go link.go moments_time.go parse.go photo.go photo_label.go photo_search.go photo_unstack.go session.go settings.go share.go share_preview.go status.go svg.go thumbs.go upload.go user.go video.go websocket.go zip.go

func Abort Uses

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

func AbortAlreadyExists Uses

func AbortAlreadyExists(c *gin.Context, s string)

func AbortBadRequest Uses

func AbortBadRequest(c *gin.Context)

func AbortEntityNotFound Uses

func AbortEntityNotFound(c *gin.Context)

func AbortFeatureDisabled Uses

func AbortFeatureDisabled(c *gin.Context)

func AbortSaveFailed Uses

func AbortSaveFailed(c *gin.Context)

func AbortUnauthorized Uses

func AbortUnauthorized(c *gin.Context)

func AbortUnexpected Uses

func AbortUnexpected(c *gin.Context)

func AddPhotoLabel Uses

func AddPhotoLabel(router *gin.RouterGroup)

POST /api/v1/photos/:uid/label

Parameters:

uid: string PhotoUID as returned by the API

func AddPhotosToAlbum Uses

func AddPhotosToAlbum(router *gin.RouterGroup)

POST /api/v1/albums/:uid/photos

func AlbumThumb Uses

func AlbumThumb(router *gin.RouterGroup)

GET /api/v1/albums/:uid/t/:token/:type

Parameters:

uid: string album uid
token: string security token (see config)
type: string thumb type, see photoprism.ThumbnailTypes

func ApprovePhoto Uses

func ApprovePhoto(router *gin.RouterGroup)

POST /api/v1/photos/:uid/approve

Parameters:

uid: string PhotoUID as returned by the API

func Auth Uses

func Auth(id string, resource acl.Resource, action acl.Action) session.Data

Auth returns the session if user is authorized for the current action.

func BatchAlbumsDelete Uses

func BatchAlbumsDelete(router *gin.RouterGroup)

POST /api/v1/batch/albums/delete

func BatchLabelsDelete Uses

func BatchLabelsDelete(router *gin.RouterGroup)

POST /api/v1/batch/labels/delete

func BatchPhotosArchive Uses

func BatchPhotosArchive(router *gin.RouterGroup)

POST /api/v1/batch/photos/archive

func BatchPhotosPrivate Uses

func BatchPhotosPrivate(router *gin.RouterGroup)

POST /api/v1/batch/photos/private

func BatchPhotosRestore Uses

func BatchPhotosRestore(router *gin.RouterGroup)

POST /api/v1/batch/photos/restore

func CancelImport Uses

func CancelImport(router *gin.RouterGroup)

DELETE /api/v1/import

func CancelIndexing Uses

func CancelIndexing(router *gin.RouterGroup)

DELETE /api/v1/index

func ChangePassword Uses

func ChangePassword(router *gin.RouterGroup)

PUT /api/v1/users/:uid/password

func CloneAlbums Uses

func CloneAlbums(router *gin.RouterGroup)

POST /api/v1/albums/:uid/clone

func CreateAccount Uses

func CreateAccount(router *gin.RouterGroup)

POST /api/v1/accounts

func CreateAlbum Uses

func CreateAlbum(router *gin.RouterGroup)

POST /api/v1/albums

func CreateAlbumLink(router *gin.RouterGroup)

POST /api/v1/albums/:uid/links

func CreateLabelLink(router *gin.RouterGroup)

POST /api/v1/labels/:uid/links

func CreateLink(c *gin.Context)

CreateLink returns a new link entity initialized with request data

func CreatePhotoLink(router *gin.RouterGroup)

POST /api/v1/photos/:uid/links

func CreateSession Uses

func CreateSession(router *gin.RouterGroup)

POST /api/v1/session

func CreateZip Uses

func CreateZip(router *gin.RouterGroup)

POST /api/v1/zip

func DeleteAccount Uses

func DeleteAccount(router *gin.RouterGroup)

DELETE /api/v1/accounts/:id

Parameters:

id: string Account ID as returned by the API

func DeleteAlbum Uses

func DeleteAlbum(router *gin.RouterGroup)

DELETE /api/v1/albums/:uid

func DeleteAlbumLink(router *gin.RouterGroup)

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

func DeleteLabelLink(router *gin.RouterGroup)

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

func DeleteLink(c *gin.Context)

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

func DeletePhotoLink(router *gin.RouterGroup)

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

func DeleteSession Uses

func DeleteSession(router *gin.RouterGroup)

DELETE /api/v1/session/:id

func DislikeAlbum Uses

func DislikeAlbum(router *gin.RouterGroup)

DELETE /api/v1/albums/:uid/like

Parameters:

uid: string Album UID

func DislikeLabel Uses

func DislikeLabel(router *gin.RouterGroup)

DELETE /api/v1/labels/:uid/like

Parameters:

uid: string Label UID

func DislikePhoto Uses

func DislikePhoto(router *gin.RouterGroup)

DELETE /api/v1/photos/:uid/like

Parameters:

uid: string PhotoUID as returned by the API

func DownloadAlbum Uses

func DownloadAlbum(router *gin.RouterGroup)

GET /api/v1/albums/:uid/dl

func DownloadZip Uses

func DownloadZip(router *gin.RouterGroup)

GET /api/v1/zip/:filename

func Error Uses

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

func GetAccount Uses

func GetAccount(router *gin.RouterGroup)

GET /api/v1/accounts/:id

Parameters:

id: string Account ID as returned by the API

func GetAccountFolders Uses

func GetAccountFolders(router *gin.RouterGroup)

GET /api/v1/accounts/:id/folders

Parameters:

id: string Account ID as returned by the API

func GetAccounts Uses

func GetAccounts(router *gin.RouterGroup)

GET /api/v1/accounts

func GetAlbum Uses

func GetAlbum(router *gin.RouterGroup)

GET /api/v1/albums/:uid

func GetAlbumLinks(router *gin.RouterGroup)

GET /api/v1/albums/:uid/links

func GetAlbums Uses

func GetAlbums(router *gin.RouterGroup)

GET /api/v1/albums

func GetConfig Uses

func GetConfig(router *gin.RouterGroup)

GET /api/v1/config

func GetDownload Uses

func GetDownload(router *gin.RouterGroup)

GET /api/v1/dl/:hash

Parameters:

hash: string The file hash as returned by the search API

func GetErrors Uses

func GetErrors(router *gin.RouterGroup)

func GetFile Uses

func GetFile(router *gin.RouterGroup)

GET /api/v1/files/:hash

Parameters:

hash: string SHA-1 hash of the file

func GetFolders Uses

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

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

func GetFoldersImport Uses

func GetFoldersImport(router *gin.RouterGroup)

GET /api/v1/folders/import

func GetFoldersOriginals Uses

func GetFoldersOriginals(router *gin.RouterGroup)

GET /api/v1/folders/originals

func GetGeo Uses

func GetGeo(router *gin.RouterGroup)

GET /api/v1/geo

func GetLabelLinks(router *gin.RouterGroup)

GET /api/v1/labels/:uid/links

func GetLabels Uses

func GetLabels(router *gin.RouterGroup)

GET /api/v1/labels

func GetMomentsTime Uses

func GetMomentsTime(router *gin.RouterGroup)

GET /api/v1/moments/time

func GetPhoto Uses

func GetPhoto(router *gin.RouterGroup)

GET /api/v1/photos/:uid

Parameters:

uid: string PhotoUID as returned by the API

func GetPhotoDownload Uses

func GetPhotoDownload(router *gin.RouterGroup)

GET /api/v1/photos/:uid/dl

Parameters:

uid: string PhotoUID as returned by the API
func GetPhotoLinks(router *gin.RouterGroup)

GET /api/v1/photos/:uid/links

func GetPhotoYaml Uses

func GetPhotoYaml(router *gin.RouterGroup)

GET /api/v1/photos/:uid/yaml

Parameters:

uid: string PhotoUID as returned by the API

func GetPhotos Uses

func GetPhotos(router *gin.RouterGroup)

GET /api/v1/photos

Query:

q:         string Query string
label:     string Label
cat:       string Category
country:   string Country code
camera:    int    UpdateCamera ID
order:     string Sort order
count:     int    Max result count (required)
offset:    int    Result offset
before:    date   Find photos taken before (format: "2006-01-02")
after:     date   Find photos taken after (format: "2006-01-02")
favorite:  bool   Find favorites only

func GetSettings Uses

func GetSettings(router *gin.RouterGroup)

GET /api/v1/settings

func GetStatus Uses

func GetStatus(router *gin.RouterGroup)

GET /api/v1/status

func GetSvg Uses

func GetSvg(router *gin.RouterGroup)

GET /api/v1/svg/*

func GetThumb Uses

func GetThumb(router *gin.RouterGroup)

GET /api/v1/t/:hash/:token/:type

Parameters:

hash: string file hash as returned by the search API
token: string security token (see config)
type: string thumb type, see photoprism.ThumbnailTypes

func GetVideo Uses

func GetVideo(router *gin.RouterGroup)

GET /api/v1/videos/:hash/:token/:type

Parameters:

hash: string The photo or video file hash as returned by the search API
type: string Video type

func InvalidDownloadToken Uses

func InvalidDownloadToken(c *gin.Context) bool

InvalidDownloadToken returns true if the token is invalid.

func InvalidPreviewToken Uses

func InvalidPreviewToken(c *gin.Context) bool

InvalidPreviewToken returns true if the token is invalid.

func LabelThumb Uses

func LabelThumb(router *gin.RouterGroup)

GET /api/v1/labels/:uid/t/:token/:type

Parameters:

uid: string label uid
token: string security token (see config)
type: string thumb type, see photoprism.ThumbnailTypes

func LikeAlbum Uses

func LikeAlbum(router *gin.RouterGroup)

POST /api/v1/albums/:uid/like

Parameters:

uid: string Album UID

func LikeLabel Uses

func LikeLabel(router *gin.RouterGroup)

POST /api/v1/labels/:uid/like

Parameters:

uid: string Label UID

func LikePhoto Uses

func LikePhoto(router *gin.RouterGroup)

POST /api/v1/photos/:uid/like

Parameters:

uid: string PhotoUID as returned by the API

func ParseUint Uses

func ParseUint(s string) uint

func PhotoPrimary Uses

func PhotoPrimary(router *gin.RouterGroup)

POST /api/v1/photos/:uid/files/:file_uid/primary

Parameters:

uid: string PhotoUID as returned by the API
file_uid: string File UID as returned by the API

func PhotoUnstack Uses

func PhotoUnstack(router *gin.RouterGroup)

POST /api/v1/photos/:uid/files/:file_uid/unstack

Parameters:

uid: string Photo UID as returned by the API
file_uid: string File UID as returned by the API

func PublishAlbumEvent Uses

func PublishAlbumEvent(e EntityEvent, uid string, c *gin.Context)

func PublishLabelEvent Uses

func PublishLabelEvent(e EntityEvent, uid string, c *gin.Context)

func PublishPhotoEvent Uses

func PublishPhotoEvent(e EntityEvent, uid string, c *gin.Context)

func RemovePhotoLabel Uses

func RemovePhotoLabel(router *gin.RouterGroup)

DELETE /api/v1/photos/:uid/label/:id

Parameters:

uid: string PhotoUID as returned by the API
id: int LabelId as returned by the API

func RemovePhotosFromAlbum Uses

func RemovePhotosFromAlbum(router *gin.RouterGroup)

DELETE /api/v1/albums/:uid/photos

func SavePhotoAsYaml Uses

func SavePhotoAsYaml(p entity.Photo)

SavePhotoAsYaml saves photo data as YAML file.

func SaveSettings Uses

func SaveSettings(router *gin.RouterGroup)

POST /api/v1/settings

func Session Uses

func Session(id string) session.Data

Session returns the current session data.

func SessionID Uses

func SessionID(c *gin.Context) string

Gets session id from HTTP header.

func SharePreview Uses

func SharePreview(router *gin.RouterGroup)

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

func ShareWithAccount Uses

func ShareWithAccount(router *gin.RouterGroup)

GET /api/v1/accounts/:id/share

Parameters:

id: string Account ID as returned by the API

func Shares Uses

func Shares(router *gin.RouterGroup)

GET /s/:token/...

func StartImport Uses

func StartImport(router *gin.RouterGroup)

POST /api/v1/import*

func StartIndexing Uses

func StartIndexing(router *gin.RouterGroup)

POST /api/v1/index

func UpdateAccount Uses

func UpdateAccount(router *gin.RouterGroup)

PUT /api/v1/accounts/:id

Parameters:

id: string Account ID as returned by the API

func UpdateAlbum Uses

func UpdateAlbum(router *gin.RouterGroup)

PUT /api/v1/albums/:uid

func UpdateAlbumLink(router *gin.RouterGroup)

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

func UpdateClientConfig Uses

func UpdateClientConfig()

func UpdateLabel Uses

func UpdateLabel(router *gin.RouterGroup)

PUT /api/v1/labels/:uid

func UpdateLabelLink(router *gin.RouterGroup)

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

func UpdateLink(c *gin.Context)

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

func UpdatePhoto Uses

func UpdatePhoto(router *gin.RouterGroup)

PUT /api/v1/photos/:uid

func UpdatePhotoLabel Uses

func UpdatePhotoLabel(router *gin.RouterGroup)

PUT /api/v1/photos/:uid/label/:id

Parameters:

uid: string PhotoUID as returned by the API
id: int LabelId as returned by the API
func UpdatePhotoLink(router *gin.RouterGroup)

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

func Upload Uses

func Upload(router *gin.RouterGroup)

POST /api/v1/upload/:path

func Websocket Uses

func Websocket(router *gin.RouterGroup)

GET /api/v1/ws

type ByteCache Uses

type ByteCache struct {
    Data []byte
}

type EntityEvent Uses

type EntityEvent string
const (
    EntityUpdated EntityEvent = "updated"
    EntityCreated EntityEvent = "created"
    EntityDeleted EntityEvent = "deleted"
)

type FoldersResponse Uses

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"`
}

type ThumbCache Uses

type ThumbCache struct {
    FileName  string
    ShareName string
}

Package api imports 37 packages (graph) and is imported by 1 packages. Updated 2020-07-20. Refresh now. Tools for package owners.