Documentation ¶
Index ¶
- Variables
- type Album
- type Config
- type PaginatedListOptions
- type PhotosLibraryClient
- type Service
- func (s *Service) AddMediaItems(ctx context.Context, albumID string, mediaItemIDs []string) error
- func (s *Service) Create(ctx context.Context, title string) (*Album, error)
- func (s *Service) GetById(ctx context.Context, albumID string) (*Album, error)
- func (s *Service) GetByTitle(ctx context.Context, title string) (*Album, error)
- func (s *Service) List(ctx context.Context) ([]Album, error)
- func (s *Service) PaginatedList(ctx context.Context, options *PaginatedListOptions) (albums []Album, nextPageToken string, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAlbumNotFound is the error returned when an album is not found. ErrAlbumNotFound = errors.New("album not found") )
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { // CoverPhotoBaseURL: [Output only] A BaseURL to the cover photo's bytes. // This should not be used as is. // Parameters should be appended to this BaseURL before use. For example, // '=w2048-h1024' will set the dimensions of the cover photo to have a // width of 2048 px and height of 1024 px. CoverPhotoBaseURL string // Id: [Output only] Identifier for the album. This is a persistent // identifier that can be used to identify this album. ID string // IsWriteable: [Output only] True if media items can be created in the // album. // This field is based on the scopes granted and permissions of the // album. If the scopes are changed or permissions of the album are changed, this // field will be updated. IsWriteable bool // ProductURL: [Output only] Google Photos BaseURL for the album. The user // needs to be signed in to their Google Photos account to access this link. ProductURL string // Title: Name of the album displayed to the user in their Google Photos // account. // This string should not be more than 500 characters. Title string // TotalMediaItems: [Output only] The number of media items in the album. TotalMediaItems int64 }
An Album represents a Google Photos album. Albums are a container for media items.
See: https://developers.google.com/photos/library/reference/rest/v1/albums.
type Config ¶
type Config struct { // HTTP client used to communicate with the API. Client *http.Client // [Optional] Base URL for API requests. // BaseURL should always be specified with a trailing slash. BaseURL string // [Optional] User agent used when communicating with the Google Photos API. UserAgent string }
Config holds the configuration parameters for the service.
type PaginatedListOptions ¶
PaginatedListOptions set the options for the PaginatedList call.
type PhotosLibraryClient ¶
type PhotosLibraryClient interface { BatchAddMediaItems(albumId string, albumBatchAddMediaItemsRequest *photoslibrary.AlbumBatchAddMediaItemsRequest) *photoslibrary.AlbumBatchAddMediaItemsCall Create(createAlbumRequest *photoslibrary.CreateAlbumRequest) *photoslibrary.AlbumsCreateCall Get(albumId string) *photoslibrary.AlbumsGetCall List() *photoslibrary.AlbumsListCall }
PhotosLibraryClient represents a Google Photos client using `gphotosuploader/googlemirror/api/photoslibrary`.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements an albums Google Photos client.
func (*Service) AddMediaItems ¶
AddMediaItems add one or more existing media items to an existing Album.
func (*Service) GetByTitle ¶
GetByTitle searches for an album with the specified title in the list of all albums. It paginates through all albums until finding one with the matching title.
Returns ErrAlbumNotFound if the album does not exist.
func (*Service) PaginatedList ¶
func (s *Service) PaginatedList(ctx context.Context, options *PaginatedListOptions) (albums []Album, nextPageToken string, err error)
PaginatedList retrieves a specific page of albums, allowing for efficient retrieval of albums in pages. Each page contains the predetermined number of albums.