immich

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package immich provides functions to interact with the Immich API.

It includes functionality for retrieving random images, fetching images associated with specific people or albums, and getting image statistics. The package also implements caching mechanisms to optimize API calls.

Index

Constants

View Source
const (
	PortraitOrientation  ImageOrientation = "PORTRAIT"
	LandscapeOrientation ImageOrientation = "LANDSCAPE"
	SquareOrientation    ImageOrientation = "SQUARE"

	ImageType ImmichAssetType = "IMAGE"
	VideoType ImmichAssetType = "VIDEO"
	AudioType ImmichAssetType = "AUDIO"
	OtherType ImmichAssetType = "OTHER"

	AlbumKeywordAll        string = "all"
	AlbumKeywordShared     string = "shared"
	AlbumKeywordFavourites string = "favourites"
	AlbumKeywordFavorites  string = "favorites"
)

Variables

This section is empty.

Functions

func ApiCacheCount added in v0.11.0

func ApiCacheCount() int

func FluchApiCache added in v0.11.0

func FluchApiCache()

Types

type ExifInfo added in v0.7.0

type ExifInfo struct {
	Make             string    `json:"-"` // `json:"make"`
	Model            string    `json:"-"` // `json:"model"`
	ExifImageWidth   int       `json:"exifImageWidth"`
	ExifImageHeight  int       `json:"exifImageHeight"`
	FileSizeInByte   int       `json:"-"` // `json:"fileSizeInByte"`
	Orientation      string    `json:"orientation"`
	DateTimeOriginal time.Time `json:"dateTimeOriginal"`
	ModifyDate       time.Time `json:"-"` // `json:"modifyDate"`
	TimeZone         string    `json:"-"` // `json:"timeZone"`
	LensModel        string    `json:"-"` // `json:"lensModel"`
	FNumber          float64   `json:"fNumber"`
	FocalLength      float64   `json:"focalLength"`
	Iso              int       `json:"iso"`
	ExposureTime     string    `json:"-"` // `json:"exposureTime"`
	Latitude         float64   `json:"-"` // `json:"latitude"`
	Longitude        float64   `json:"-"` // `json:"longitude"`
	City             string    `json:"city"`
	State            string    `json:"state"`
	Country          string    `json:"country"`
	Description      string    `json:"-"` // `json:"description"`
	ProjectionType   any       `json:"-"` // `json:"projectionType"`
	ImageOrientation ImageOrientation
}

type Faces added in v0.7.0

type Faces []struct {
	ID            string `json:"-"` // `json:"id"`
	ImageHeight   int    `json:"-"` // `json:"imageHeight"`
	ImageWidth    int    `json:"-"` // `json:"imageWidth"`
	BoundingBoxX1 int    `json:"-"` // `json:"boundingBoxX1"`
	BoundingBoxX2 int    `json:"-"` // `json:"boundingBoxX2"`
	BoundingBoxY1 int    `json:"-"` // `json:"boundingBoxY1"`
	BoundingBoxY2 int    `json:"-"` // `json:"boundingBoxY2"`
}

type ImageOrientation added in v0.11.0

type ImageOrientation string

type ImmichAlbum

type ImmichAlbum struct {
	ID         string        `json:"id"`
	Assets     []ImmichAsset `json:"assets"`
	AssetCount int           `json:"assetCount"`
}

type ImmichAlbums added in v0.11.0

type ImmichAlbums []ImmichAlbum

type ImmichApiCall added in v0.5.0

type ImmichApiCall func(string, string, io.Reader) ([]byte, error)

type ImmichApiResponse added in v0.11.0

type ImmichAsset

type ImmichAsset struct {
	ID               string          `json:"id"`
	DeviceAssetID    string          `json:"-"` // `json:"deviceAssetId"`
	OwnerID          string          `json:"-"` // `json:"ownerId"`
	DeviceID         string          `json:"-"` // `json:"deviceId"`
	LibraryID        string          `json:"-"` // `json:"libraryId"`
	Type             ImmichAssetType `json:"type"`
	OriginalPath     string          `json:"-"`                // `json:"originalPath"`
	OriginalFileName string          `json:"-"`                // `json:"originalFileName"`
	OriginalMimeType string          `json:"originalMimeType"` // `json:"originalMimeType"`
	Resized          bool            `json:"-"`                // `json:"resized"`
	Thumbhash        string          `json:"-"`                // `json:"thumbhash"`
	FileCreatedAt    time.Time       `json:"-"`                // `json:"fileCreatedAt"`
	FileModifiedAt   time.Time       `json:"-"`                // `json:"fileModifiedAt"`
	LocalDateTime    time.Time       `json:"localDateTime"`    // `json:"localDateTime"`
	UpdatedAt        time.Time       `json:"-"`                // `json:"updatedAt"`
	IsFavorite       bool            `json:"isFavorite"`
	IsArchived       bool            `json:"isArchived"`
	IsTrashed        bool            `json:"isTrashed"`
	Duration         string          `json:"-"` // `json:"duration"`
	ExifInfo         ExifInfo        `json:"exifInfo"`
	LivePhotoVideoID any             `json:"-"`        // `json:"livePhotoVideoId"`
	People           People          `json:"people"`   // `json:"people"`
	Checksum         string          `json:"checksum"` // `json:"checksum"`
	StackCount       any             `json:"-"`        // `json:"stackCount"`
	IsOffline        bool            `json:"-"`        // `json:"isOffline"`
	HasMetadata      bool            `json:"-"`        // `json:"hasMetadata"`
	DuplicateID      any             `json:"-"`        // `json:"duplicateId"`
	RatioWanted      ImageOrientation
	IsPortrait       bool
	IsLandscape      bool
}

func NewImage

func NewImage(base config.Config) ImmichAsset

NewImage returns a new image instance

func (*ImmichAsset) AlbumImageCount added in v0.10.0

func (i *ImmichAsset) AlbumImageCount(albumID string, requestID string) (int, error)

AlbumImageCount retrieves the number of images in a specific album from Immich.

func (*ImmichAsset) ImagePreview added in v0.10.0

func (i *ImmichAsset) ImagePreview() ([]byte, error)

ImagePreview fetches the raw image data from Immich

func (*ImmichAsset) OLDRandomImageOfPerson added in v0.11.0

func (i *ImmichAsset) OLDRandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error

DEPRECIATED RandomImageOfPerson retrieve random image of person from Immich

func (*ImmichAsset) PersonImageCount added in v0.10.0

func (i *ImmichAsset) PersonImageCount(personID, requestID string) (int, error)

PersonImageCount returns the number of images associated with a specific person in Immich.

func (*ImmichAsset) RandomAlbumFromAllAlbums added in v0.11.0

func (i *ImmichAsset) RandomAlbumFromAllAlbums(requestID string) (string, error)

func (*ImmichAsset) RandomAlbumFromSharedAlbums added in v0.11.0

func (i *ImmichAsset) RandomAlbumFromSharedAlbums(requestID string) (string, error)

func (*ImmichAsset) RandomImage added in v0.10.0

func (i *ImmichAsset) RandomImage(requestID, kioskDeviceID string, isPrefetch bool) error

GetRandomImage retrieve a random image from Immich

func (*ImmichAsset) RandomImageFromAlbum added in v0.10.0

func (i *ImmichAsset) RandomImageFromAlbum(albumID, requestID, kioskDeviceID string, isPrefetch bool) error

RandomImageFromAlbum retrieve random image within a specified album from Immich

func (*ImmichAsset) RandomImageFromFavourites added in v0.11.0

func (i *ImmichAsset) RandomImageFromFavourites(requestID, kioskDeviceID string, isPrefetch bool) error

RandomImageFromFavourites retrieves a random favorite image from the Immich server.

func (*ImmichAsset) RandomImageOfPerson added in v0.10.0

func (i *ImmichAsset) RandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error

RandomImageOfPerson retrieve random image of person from Immich

type ImmichAssetType added in v0.11.0

type ImmichAssetType string

type ImmichBuckets added in v0.9.0

type ImmichBuckets []struct {
	Count      int       `json:"count"`
	TimeBucket time.Time `json:"timeBucket"`
}

type ImmichError

type ImmichError struct {
	Message    []string `json:"message"`
	Error      string   `json:"error"`
	StatusCode int      `json:"statusCode"`
}

type ImmichPersonStatistics added in v0.10.0

type ImmichPersonStatistics struct {
	Assets int `json:"assets"`
}

type ImmichSearchMetadataResponse added in v0.11.0

type ImmichSearchMetadataResponse struct {
	Assets struct {
		Total    int    `json:"total"`
		NextPage string `json:"nextPage"`
	} `json:"assets"`
}

type ImmichSearchRandomBody added in v0.11.0

type ImmichSearchRandomBody struct {
	City          string   `url:"city,omitempty" json:"city,omitempty"`
	Country       string   `url:"country,omitempty" json:"country,omitempty"`
	CreatedAfter  string   `url:"createdAfter,omitempty" json:"createdAfter,omitempty"`
	CreatedBefore string   `url:"createdBefore,omitempty" json:"createdBefore,omitempty"`
	DeviceID      string   `url:"deviceId,omitempty" json:"deviceId,omitempty"`
	IsArchived    bool     `url:"isArchived,omitempty" json:"isArchived,omitempty"`
	IsEncoded     bool     `url:"isEncoded,omitempty" json:"isEncoded,omitempty"`
	IsFavorite    bool     `url:"isFavorite,omitempty" json:"isFavorite,omitempty"`
	IsMotion      bool     `url:"isMotion,omitempty" json:"isMotion,omitempty"`
	IsNotInAlbum  bool     `url:"isNotInAlbum,omitempty" json:"isNotInAlbum,omitempty"`
	IsOffline     bool     `url:"isOffline,omitempty" json:"isOffline,omitempty"`
	IsVisible     bool     `url:"isVisible,omitempty" json:"isVisible,omitempty"`
	LensModel     string   `url:"lensModel,omitempty" json:"lensModel,omitempty"`
	LibraryID     string   `url:"libraryId,omitempty" json:"libraryId,omitempty"`
	Make          string   `url:"make,omitempty" json:"make,omitempty"`
	Model         string   `url:"model,omitempty" json:"model,omitempty"`
	PersonIds     []string `url:"personIds,omitempty" json:"personIds,omitempty"`
	Size          int      `url:"size,omitempty" json:"size,omitempty"`
	State         string   `url:"state,omitempty" json:"state,omitempty"`
	TakenAfter    string   `url:"takenAfter,omitempty" json:"takenAfter,omitempty"`
	TakenBefore   string   `url:"takenBefore,omitempty" json:"takenBefore,omitempty"`
	TrashedAfter  string   `url:"trashedAfter,omitempty" json:"trashedAfter,omitempty"`
	TrashedBefore string   `url:"trashedBefore,omitempty" json:"trashedBefore,omitempty"`
	Type          string   `url:"type,omitempty" json:"type,omitempty"`
	UpdatedAfter  string   `url:"updatedAfter,omitempty" json:"updatedAfter,omitempty"`
	UpdatedBefore string   `url:"updatedBefore,omitempty" json:"updatedBefore,omitempty"`
	WithArchived  bool     `url:"withArchived,omitempty" json:"withArchived,omitempty"`
	WithDeleted   bool     `url:"withDeleted,omitempty" json:"withDeleted,omitempty"`
	WithExif      bool     `url:"withExif,omitempty" json:"withExif,omitempty"`
	WithPeople    bool     `url:"withPeople,omitempty" json:"withPeople,omitempty"`
	WithStacked   bool     `url:"withStacked,omitempty" json:"withStacked,omitempty"`
	Page          int      `url:"page,omitempty" json:"page,omitempty"`
}

type People added in v0.7.0

type People []struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	BirthDate     any       `json:"-"` // `json:"birthDate"`
	ThumbnailPath string    `json:"-"` // `json:"thumbnailPath"`
	IsHidden      bool      `json:"-"` // `json:"isHidden"`
	UpdatedAt     time.Time `json:"-"` // `json:"updatedAt"`
	Faces         Faces     `json:"-"` // `json:"faces"`
}

Jump to

Keyboard shortcuts

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