photoprism-client-go/api/v1/types.go

245 lines
9.4 KiB
Go

package api
import (
"time"
)
type Photos []Photo
// Photo represents a photo, all its properties, and link to all its images and sidecar files.
type Photo struct {
PhotoID int `json:"ID,omitempty"`
TakenAt time.Time `json:"TakenAt"`
TakenAtLocal time.Time `json:"TakenAtLocal"`
TakenSrc string `json:"TakenSrc"`
PhotoUID string `json:"UID"`
PhotoType string `json:"Type"`
TypeSrc string `json:"TypeSrc"`
PhotoTitle string `json:"Title"`
TitleSrc string `json:"TitleSrc"`
PhotoDescription string `json:"Description"`
DescriptionSrc string `json:"DescriptionSrc"`
PhotoPath string `json:"Path"`
PhotoName string `json:"Name"`
OriginalName string `json:"OriginalName"`
PhotoStack int8 `json:"Stack"`
PhotoFavorite bool `json:"Favorite"`
PhotoPrivate bool `json:"Private"`
PhotoScan bool `json:"Scan"`
PhotoPanorama bool `json:"Panorama"`
TimeZone string `json:"TimeZone"`
PlaceID string `json:"PlaceID"`
PlaceSrc string `json:"PlaceSrc"`
CellID string `json:"CellID"`
CellAccuracy int `json:"CellAccuracy"`
PhotoAltitude int `json:"Altitude"`
PhotoLat float32 `json:"Lat"`
PhotoLng float32 `json:"Lng"`
PhotoCountry string `json:"Country"`
PhotoYear int `json:"Year"`
PhotoMonth int `json:"Month"`
PhotoDay int `json:"Day"`
PhotoIso int `json:"Iso"`
PhotoExposure string `json:"Exposure"`
PhotoFNumber float32 `json:"FNumber"`
PhotoFocalLength int `json:"FocalLength"`
PhotoQuality int `json:"Quality"`
PhotoResolution int `json:"Resolution"`
PhotoColor uint8 `json:"Color"`
CameraID uint `json:"CameraID"`
CameraSerial string `json:"CameraSerial"`
CameraSrc string `json:"CameraSrc"`
LensID uint `json:"LensID"`
Details *Details `json:"Details"`
Camera *Camera `json:"Camera"`
Lens *Lens `json:"Lens"`
Cell *Cell `json:"Cell"`
Place *Place `json:"Place"`
Files []File `json:"Files"`
Labels []PhotoLabel `json:"Labels"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
EditedAt *time.Time `json:"EditedAt"`
CheckedAt *time.Time `json:"CheckedAt"`
DeletedAt *time.Time `json:"DeletedAt"`
}
// Details stores additional metadata fields for each photo to improve search performance.
type Details struct {
PhotoID uint `json:"PhotoID"`
Keywords string `json:"Keywords"`
KeywordsSrc string `json:"KeywordsSrc"`
Notes string `json:"Notes"`
NotesSrc string `json:"NotesSrc"`
Subject string `json:"Subject"`
SubjectSrc string `json:"SubjectSrc"`
Artist string `json:"Artist"`
ArtistSrc string `json:"ArtistSrc"`
Copyright string `json:"Copyright"`
CopyrightSrc string `json:"CopyrightSrc"`
License string `json:"License"`
LicenseSrc string `json:"LicenseSrc"`
Software string `json:"Software"`
SoftwareSrc string `json:"SoftwareSrc"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
}
// Camera model and make (as extracted from UpdateExif metadata)
type Camera struct {
ID uint `json:"ID"`
CameraSlug string `json:"Slug"`
CameraName string `json:"Name"`
CameraMake string `json:"Make"`
CameraModel string `json:"Model"`
CameraType string `json:"Type,omitempty"`
CameraDescription string `json:"Description,omitempty"`
CameraNotes string `json:"Notes,omitempty"`
}
// Lens represents camera lens (as extracted from UpdateExif metadata)
type Lens struct {
ID uint `json:"ID"`
LensSlug string `json:"Slug"`
LensName string `json:"Name"`
LensMake string `json:"Make"`
LensModel string `json:"Model"`
LensType string `json:"Type"`
LensDescription string `json:"Description,omitempty"`
LensNotes string `json:"Notes,omitempty"`
}
// Cell represents a S2 cell with location data.
type Cell struct {
ID string `json:"ID"`
CellName string `json:"Name"`
CellStreet string `json:"Street"`
CellPostcode string `json:"Postcode"`
CellCategory string `json:"Category"`
Place *Place `json:"Place"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
}
// Place used to associate photos to places
type Place struct {
ID string `json:"PlaceID"`
PlaceLabel string `json:"Label"`
PlaceCity string `json:"City"`
PlaceState string `json:"State"`
PlaceCountry string `json:"Country"`
PlaceKeywords string `json:"Keywords"`
PlaceFavorite bool `json:"Favorite"`
PhotoCount int `json:"PhotoCount"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
}
// Album represents a photo album
type Album struct {
ID uint `json:"ID"`
AlbumUID string `json:"UID"`
AlbumSlug string `json:"Slug"`
AlbumType string `json:"Type"`
AlbumTitle string `json:"Title"`
AlbumLocation string `json:"Location"`
AlbumCategory string `json:"Category"`
AlbumCaption string `json:"Caption"`
AlbumDescription string `json:"Description"`
AlbumNotes string `json:"Notes"`
AlbumFilter string `json:"Filter"`
AlbumOrder string `json:"Order"`
AlbumTemplate string `json:"Template"`
AlbumCountry string `json:"Country"`
AlbumYear int `json:"Year"`
AlbumMonth int `json:"Month"`
AlbumDay int `json:"Day"`
AlbumFavorite bool `json:"Favorite"`
AlbumPrivate bool `json:"Private"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
DeletedAt *time.Time `json:"DeletedAt"`
}
type PhotoAlbums []PhotoAlbum
// PhotoAlbum represents the many_to_many relation between Photo and Album
type PhotoAlbum struct {
PhotoUID string `json:"PhotoUID"`
AlbumUID string `json:"AlbumUID"`
Order int `json:"Order"`
Hidden bool `json:"Hidden"`
Missing bool `json:"Missing"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
Photo *Photo
Album *Album
}
type Files []File
// File represents an image or sidecar file that belongs to a photo.
type File struct {
PhotoUID string `json:"PhotoUID"`
FileUID string `json:"UID"`
FileName string `json:"Name"`
FileRoot string `json:"Root"`
OriginalName string `json:"OriginalName"`
FileHash string `json:"Hash"`
FileSize int64 `json:"Size"`
FileCodec string `json:"Codec"`
FileType string `json:"Type"`
FileMime string `json:"Mime"`
FilePrimary bool `json:"Primary"`
FileSidecar bool `json:"Sidecar"`
FileMissing bool `json:"Missing"`
FilePortrait bool `json:"Portrait"`
FileVideo bool `json:"Video"`
FileDuration time.Duration `json:"Duration"`
FileWidth int `json:"Width"`
FileHeight int `json:"Height"`
FileOrientation int `json:"Orientation"`
FileProjection string `json:"Projection,omitempty"`
FileAspectRatio float32 `json:"AspectRatio"`
FileMainColor string `json:"MainColor"`
FileColors string `json:"Colors"`
FileLuminance string `json:"Luminance"`
FileDiff uint32 `json:"Diff"`
FileChroma uint8 `json:"Chroma"`
FileError string `json:"Error"`
ModTime int64 `json:"ModTime"`
CreatedAt time.Time `json:"CreatedAt"`
CreatedIn int64 `json:"CreatedIn"`
UpdatedAt time.Time `json:"UpdatedAt"`
UpdatedIn int64 `json:"UpdatedIn"`
DeletedAt *time.Time `json:"DeletedAt,omitempty"`
}
// PhotoLabel represents the many-to-many relation between Photo and label.
// Labels are weighted by uncertainty (100 - confidence)
type PhotoLabel struct {
PhotoID uint `json:"PhotoID"`
LabelID uint `json:"LabelID"`
LabelSrc string `json:"LabelSrc""`
Uncertainty int `json:"Uncertainty"`
Photo *Photo `json:"Photo"`
Label *Label `json:"Label"`
}
// Label is used for photo, album and location categorization
type Label struct {
ID uint `json:"ID"`
LabelUID string `json:"UID"`
LabelSlug string `json:"Slug"`
CustomSlug string `json:"CustomSlug"`
LabelName string `json:"Name"`
LabelPriority int `json:"Priority"`
LabelFavorite bool `json:"Favorite"`
LabelDescription string `json:"Description"`
LabelNotes string `json:"Notes"`
PhotoCount int `json:"PhotoCount"`
LabelThumb string `json:"Thumb"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
}