backends

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album added in v0.5.0

type Album struct {
	AlbumKey    string `json:"AlbumKey"`
	Name        string `json:"Name"`
	Description string `json:"Description,omitempty"`
	URLPath     string `json:"UrlPath"`
	URI         string `json:"Uri"`
	WebURI      string `json:"WebUri"`
	NodeID      string `json:"NodeId"`
	ImageCount  int    `json:"ImageCount"`
}

Album represents a SmugMug album

type AlbumImage added in v0.5.0

type AlbumImage struct {
	ImageKey string `json:"ImageKey"`
	URI      string `json:"Uri"`
	WebURI   string `json:"WebUri"`
	Title    string `json:"Title,omitempty"`
	Caption  string `json:"Caption,omitempty"`
	Image    struct {
		WebURI string `json:"WebUri"`
	} `json:"Uris,omitempty"`
}

AlbumImage represents an image within an album context

type AlbumImageDetail added in v0.7.0

type AlbumImageDetail struct {
	URI              string `json:"Uri"`
	WebURI           string `json:"WebUri"`
	FileName         string `json:"FileName"`
	ImageKey         string `json:"ImageKey"`
	UploadKey        string `json:"UploadKey,omitempty"`
	ArchivedMD5      string `json:"ArchivedMd5,omitempty"`
	Title            string `json:"Title,omitempty"`
	Caption          string `json:"Caption,omitempty"`
	Keywords         string `json:"Keywords,omitempty"`
	DateTimeOriginal string `json:"DateTimeOriginal,omitempty"`
	DateTimeUploaded string `json:"DateTimeUploaded,omitempty"`
	Format           string `json:"Format,omitempty"`
	OriginalSize     int64  `json:"OriginalSize,omitempty"`
}

AlbumImageDetail represents detailed image information including MD5

type AlbumImagesResponse added in v0.7.0

type AlbumImagesResponse struct {
	Response struct {
		AlbumImage []AlbumImageDetail `json:"AlbumImage"`
		Pages      struct {
			Total          int    `json:"Total"`
			Start          int    `json:"Start"`
			Count          int    `json:"Count"`
			RequestedCount int    `json:"RequestedCount"`
			NextPage       string `json:"NextPage,omitempty"`
		} `json:"Pages"`
	} `json:"Response"`
}

AlbumImagesResponse represents the response from the album images endpoint

type AlbumsResponse added in v0.5.0

type AlbumsResponse struct {
	Response struct {
		Album      []Album `json:"Album"`
		AlbumCount int     `json:"AlbumCount"`
		Pages      struct {
			Total          int    `json:"Total"`
			Start          int    `json:"Start"`
			Count          int    `json:"Count"`
			RequestedCount int    `json:"RequestedCount"`
			NextPage       string `json:"NextPage,omitempty"`
		} `json:"Pages"`
	} `json:"Response"`
}

AlbumsResponse represents the response from the albums endpoint

type FlickrAPI

type FlickrAPI struct {
	*FlickrUploader
}

FlickrAPI handles Flickr API calls

func NewFlickrAPI

func NewFlickrAPI(cfg *config.FlickrConfig) *FlickrAPI

NewFlickrAPI creates a new Flickr API client

func (*FlickrAPI) BuildImageURL added in v0.7.0

func (api *FlickrAPI) BuildImageURL(photo PhotoSearchResult, size string) string

BuildImageURL constructs the direct image URL from search result Size can be: s (square 75), q (square 150), t (thumbnail), m (small), n (small 320), z (medium), c (medium 800), b (large), h (large 1600), k (large 2048), o (original)

func (*FlickrAPI) BuildPhotoURL added in v0.7.0

func (api *FlickrAPI) BuildPhotoURL(photo PhotoSearchResult) string

BuildPhotoURL constructs the Flickr photo page URL from search result

func (*FlickrAPI) GetPhotoInfo

func (api *FlickrAPI) GetPhotoInfo(ctx context.Context, photoID string) (*PhotoInfo, error)

GetPhotoInfo gets information about a photo

func (*FlickrAPI) GetPhotoSizes

func (api *FlickrAPI) GetPhotoSizes(ctx context.Context, photoID string) ([]PhotoSize, error)

GetPhotoSizes gets available sizes for a photo

func (*FlickrAPI) GetUserID added in v0.7.0

func (api *FlickrAPI) GetUserID(ctx context.Context) (string, error)

GetUserID gets the authenticated user's NSID using flickr.test.login

func (*FlickrAPI) PhotosSearch added in v0.7.0

func (api *FlickrAPI) PhotosSearch(ctx context.Context, params PhotoSearchParams) (*PhotoSearchResponse, error)

PhotosSearch searches for photos using various criteria

type FlickrAuth

type FlickrAuth struct {
	ConsumerKey    string
	ConsumerSecret string
}

FlickrAuth handles Flickr OAuth authentication

func NewFlickrAuth

func NewFlickrAuth(consumerKey, consumerSecret string) *FlickrAuth

NewFlickrAuth creates a new Flickr authenticator

func (*FlickrAuth) Authenticate

func (a *FlickrAuth) Authenticate(ctx context.Context) (*oauth1.Token, error)

Authenticate performs the OAuth flow and returns the access token

type FlickrPullClient added in v0.10.0

type FlickrPullClient struct {
	// contains filtered or unexported fields
}

FlickrPullClient handles pulling images from Flickr

func NewFlickrPullClient added in v0.10.0

func NewFlickrPullClient(cfg *config.FlickrConfig) *FlickrPullClient

NewFlickrPullClient creates a new Flickr pull client

func (*FlickrPullClient) PullImages added in v0.10.0

func (c *FlickrPullClient) PullImages(ctx context.Context, albumName string, count int, tags string) ([]types.PullImage, error)

PullImages fetches recent images from Flickr

type FlickrUploader

type FlickrUploader struct {
	ConsumerKey    string
	ConsumerSecret string
	AccessToken    string
	AccessSecret   string
}

FlickrUploader handles image uploads to Flickr

func NewFlickrUploader

func NewFlickrUploader(consumerKey, consumerSecret, accessToken, accessSecret string) *FlickrUploader

NewFlickrUploader creates a new Flickr uploader

func (*FlickrUploader) Upload

func (u *FlickrUploader) Upload(ctx context.Context, imagePath string, title, description string, tags []string, isPrivate bool) (*UploadResult, error)

Upload uploads an image to Flickr using upload-then-set pattern

type Image added in v0.5.0

type Image struct {
	ImageKey string `json:"ImageKey"`
	URI      string `json:"Uri"`
	WebURI   string `json:"WebUri"`
	Title    string `json:"Title,omitempty"`
	Caption  string `json:"Caption,omitempty"`
}

Image represents a SmugMug image

type PhotoInfo

type PhotoInfo struct {
	ID        string
	Owner     string
	OwnerNSID string
	URL       string
	Sizes     []PhotoSize
}

PhotoInfo contains basic photo information

type PhotoSearchParams added in v0.7.0

type PhotoSearchParams struct {
	UserID       string   // User NSID (optional, but recommended for performance)
	Tags         []string // Regular tags
	MachineTags  []string // Machine tags (e.g., "imgupv2:checksum=abc123")
	Text         string   // Free text search
	MinTakenDate string   // Minimum taken date (MySQL datetime)
	MaxTakenDate string   // Maximum taken date (MySQL datetime)
	Page         int      // Page number (default 1)
	PerPage      int      // Results per page (default 100, max 500)
}

PhotoSearchParams contains parameters for photo search

type PhotoSearchResponse added in v0.7.0

type PhotoSearchResponse struct {
	Photos []PhotoSearchResult
	Page   int
	Pages  int
	Total  int
}

PhotoSearchResponse contains the search response

type PhotoSearchResult added in v0.7.0

type PhotoSearchResult struct {
	ID       string `json:"id"`
	Owner    string `json:"owner"`
	Secret   string `json:"secret"`
	Server   string `json:"server"`
	Farm     int    `json:"farm"`
	Title    string `json:"title"`
	IsPublic int    `json:"ispublic"`
	IsFriend int    `json:"isfriend"`
	IsFamily int    `json:"isfamily"`
}

PhotoSearchResult represents a photo in search results

type PhotoSize

type PhotoSize struct {
	Label  string
	Width  int
	Height int
	Source string
}

PhotoSize represents a photo size variant

type SmugMugAPI added in v0.5.0

type SmugMugAPI struct {
	*SmugMugUploader
}

SmugMugAPI handles SmugMug API calls

func NewSmugMugAPI added in v0.5.0

func NewSmugMugAPI(cfg *config.SmugMugConfig) *SmugMugAPI

NewSmugMugAPI creates a new SmugMug API client

func (*SmugMugAPI) GetAlbum added in v0.5.0

func (api *SmugMugAPI) GetAlbum(ctx context.Context, albumKey string) (*Album, error)

GetAlbum gets details for a specific album

func (*SmugMugAPI) GetAlbumImage added in v0.5.0

func (api *SmugMugAPI) GetAlbumImage(ctx context.Context, albumImageURI string) (map[string]interface{}, error)

GetAlbumImage gets details for an image in album context

func (*SmugMugAPI) GetAlbumImages added in v0.7.0

func (api *SmugMugAPI) GetAlbumImages(ctx context.Context, albumKey string) ([]AlbumImageDetail, error)

GetAlbumImages retrieves all images from an album with MD5 hashes

func (*SmugMugAPI) GetAuthenticatedUser added in v0.5.0

func (api *SmugMugAPI) GetAuthenticatedUser(ctx context.Context) (*UserResponse, error)

GetAuthenticatedUser gets information about the authenticated user

func (*SmugMugAPI) GetImage added in v0.5.0

func (api *SmugMugAPI) GetImage(ctx context.Context, imageURI string) (*Image, error)

GetImage gets details for a specific image

func (*SmugMugAPI) GetImageSizes added in v0.5.0

func (api *SmugMugAPI) GetImageSizes(ctx context.Context, imageURI string) (map[string]interface{}, error)

GetImageSizes gets the available sizes for an uploaded image

func (*SmugMugAPI) ListAlbums added in v0.5.0

func (api *SmugMugAPI) ListAlbums(ctx context.Context) ([]Album, error)

ListAlbums gets all albums for the authenticated user with pagination

func (*SmugMugAPI) SearchAlbumImages added in v0.7.0

func (api *SmugMugAPI) SearchAlbumImages(ctx context.Context, albumKey string, query string) ([]AlbumImageDetail, error)

SearchAlbumImages searches for images in an album by filename or other criteria

type SmugMugAuth added in v0.5.0

type SmugMugAuth struct {
	ConsumerKey    string
	ConsumerSecret string
}

SmugMugAuth handles SmugMug OAuth authentication

func NewSmugMugAuth added in v0.5.0

func NewSmugMugAuth(consumerKey, consumerSecret string) *SmugMugAuth

NewSmugMugAuth creates a new SmugMug authenticator

func (*SmugMugAuth) Authenticate added in v0.5.0

func (a *SmugMugAuth) Authenticate(ctx context.Context) (*oauth1.Token, string, error)

Authenticate performs the OAuth flow and returns the access token

type SmugMugPullClient added in v0.10.0

type SmugMugPullClient struct {
	// contains filtered or unexported fields
}

SmugMugPullClient handles pulling images from SmugMug

func NewSmugMugPullClient added in v0.10.0

func NewSmugMugPullClient(cfg *config.SmugMugConfig) *SmugMugPullClient

NewSmugMugPullClient creates a new SmugMug pull client

func (*SmugMugPullClient) PullImages added in v0.10.0

func (c *SmugMugPullClient) PullImages(ctx context.Context, albumName string, count int, tags string) ([]types.PullImage, error)

PullImages fetches recent images from SmugMug

type SmugMugUploadResult added in v0.5.0

type SmugMugUploadResult struct {
	ImageURI string
	ImageKey string
	URL      string // Web URL
	ImageURL string // Direct image URL for embedding
}

SmugMugUploadResult contains the result of an upload

type SmugMugUploader added in v0.5.0

type SmugMugUploader struct {
	ConsumerKey    string
	ConsumerSecret string
	AccessToken    string
	AccessSecret   string
	AlbumID        string
}

SmugMugUploader handles image uploads to SmugMug

func NewSmugMugUploader added in v0.5.0

func NewSmugMugUploader(consumerKey, consumerSecret, accessToken, accessSecret, albumID string) *SmugMugUploader

NewSmugMugUploader creates a new SmugMug uploader

func (*SmugMugUploader) Upload added in v0.5.0

func (u *SmugMugUploader) Upload(ctx context.Context, imagePath string, title, description string, tags []string, isPrivate bool) (*SmugMugUploadResult, error)

Upload uploads an image to SmugMug

type UploadResult

type UploadResult struct {
	PhotoID  string
	URL      string   // Photo page URL
	ImageURL string   // Direct image URL for embedding
	Warnings []string // Non-fatal warnings (e.g., failed to set tags)
}

UploadResult contains the result of an upload

type UserResponse added in v0.5.0

type UserResponse struct {
	Response struct {
		User struct {
			NickName string `json:"NickName"`
			Name     string `json:"Name"`
			URI      string `json:"Uri"`
			WebURI   string `json:"WebUri"`
			Uris     struct {
				UserAlbums struct {
					URI string `json:"Uri"`
				} `json:"UserAlbums"`
			} `json:"Uris"`
		} `json:"User"`
	} `json:"Response"`
}

UserResponse represents the response from the authuser endpoint

Jump to

Keyboard shortcuts

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