Documentation ¶
Index ¶
- type Config
- type MediaItem
- type MediaMetadata
- type PaginatedListOptions
- type PhotosLibraryClient
- type Service
- func (s *Service) Create(ctx context.Context, mediaItem SimpleMediaItem) (*MediaItem, error)
- func (s *Service) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]*MediaItem, error)
- func (s *Service) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []SimpleMediaItem) ([]*MediaItem, error)
- func (s *Service) CreateToAlbum(ctx context.Context, albumId string, mediaItem SimpleMediaItem) (*MediaItem, error)
- func (s *Service) Get(ctx context.Context, mediaItemId string) (*MediaItem, error)
- func (s *Service) ListByAlbum(ctx context.Context, albumId string) ([]*MediaItem, error)
- func (s *Service) PaginatedList(ctx context.Context, options *PaginatedListOptions) (mediaItems []MediaItem, nextPageToken string, err error)
- type SimpleMediaItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 MediaItem ¶
type MediaItem struct { // BaseURL: [Output only] A URL to the media item's bytes. // This should not be used as is. // For example, '=w2048-h1024' will set the dimensions of a media item // of a type photo to have a width of 2048 px and height of 1024 px. BaseURL string // Description: [Output only] Description of the media item. // This is shown to the user in the item's info section in the Google // Photos app. Description string // Filename: [Output only] Filename of the media item. // This is shown to the user in the item's info section in the Google Photos app. Filename string // ID: [Output only] Identifier for the media item. This is a persistent // identifier that can be used to identify this media item. ID string // MediaMetadata: [Output only] Metadata related to the media item, for example, // the height, width or creation time. MediaMetadata MediaMetadata // MimeType: [Output only] MIME type of the media item. MimeType string // ProductURL: [Output only] Google Photos URL for the media item. This link // will only be available to the user if they're signed in. ProductURL string }
A MediaItem represents a media item (e.g. photo, video etc.) in Google Photos.
See: https://developers.google.com/photos/library/reference/rest/v1/mediaItems.
type MediaMetadata ¶
type MediaMetadata struct { // CreationTime: [Output only] Time when the media item was first // created (not when it was uploaded to Google Photos). CreationTime string // Height: [Output only] Original height (in pixels) of the media item. Height int64 // Width: [Output only] Original width (in pixels) of the media item. Width int64 }
A MediaMetadata represents the metadata for a media item.
See: https://developers.google.com/photos/library/reference/rest/v1/mediaItems.
type PaginatedListOptions ¶ added in v3.0.1
type PhotosLibraryClient ¶
type PhotosLibraryClient interface { BatchCreate(batchCreateMediaItemsRequest *photoslibrary.BatchCreateMediaItemsRequest) *photoslibrary.MediaItemsBatchCreateCall Get(mediaItemId string) *photoslibrary.MediaItemsGetCall Search(searchMediaItemsRequest *photoslibrary.SearchMediaItemsRequest) *photoslibrary.MediaItemsSearchCall }
PhotosLibraryClient represents a Google Photos client using `gphotosuploader/googlemirror/api/photoslibrary`.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements a media items Google Photos client.
func (*Service) Create ¶
Create creates one media items in a user's Google Photos library. By default, the media item will be added to the end of the library.
func (*Service) CreateMany ¶
func (s *Service) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]*MediaItem, error)
CreateMany creates many media items in a user's Google Photos library. By default, the media items will be added to the end of the library.
func (*Service) CreateManyToAlbum ¶
func (s *Service) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []SimpleMediaItem) ([]*MediaItem, error)
CreateManyToAlbum creates one or more media item(s) in the repository. If an album id is specified, the media item(s) is also added to the album. By default, the media item(s) will be added to the end of the library or album.
func (*Service) CreateToAlbum ¶
func (s *Service) CreateToAlbum(ctx context.Context, albumId string, mediaItem SimpleMediaItem) (*MediaItem, error)
CreateToAlbum creates one media items in a user's Google Photos library. If an album id is specified, the media item is also added to the album. By default, the media item will be added to the end of the library or album.
func (*Service) ListByAlbum ¶
ListByAlbum list all media items in the specified album.
func (*Service) PaginatedList ¶ added in v3.0.1
func (s *Service) PaginatedList(ctx context.Context, options *PaginatedListOptions) (mediaItems []MediaItem, nextPageToken string, err error)
PaginatedList retrieves a specific page of media items, allowing for efficient retrieval of media item in pages. Each page contains a predetermined number of media items.
type SimpleMediaItem ¶
type SimpleMediaItem struct { // UploadToken: Token identifying the media bytes which have been // uploaded to Google. UploadToken string Filename string }
A SimpleMediaItem represents a simple media item to be created in Google Photos via an upload token.
See: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate.