Documentation ¶
Index ¶
- Variables
- type HttpMediaItemsService
- func (ms HttpMediaItemsService) Create(ctx context.Context, mediaItem SimpleMediaItem) (MediaItem, error)
- func (ms HttpMediaItemsService) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]MediaItem, error)
- func (ms HttpMediaItemsService) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []SimpleMediaItem) ([]MediaItem, error)
- func (ms HttpMediaItemsService) CreateToAlbum(ctx context.Context, albumId string, mediaItem SimpleMediaItem) (MediaItem, error)
- func (ms HttpMediaItemsService) Get(ctx context.Context, mediaItemId string) (*MediaItem, error)
- func (ms HttpMediaItemsService) ListByAlbum(ctx context.Context, albumId string) ([]MediaItem, error)
- type MediaItem
- type MediaMetadata
- type PhotosLibraryClient
- type PhotosLibraryMediaItemsRepository
- func (r PhotosLibraryMediaItemsRepository) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]MediaItem, error)
- func (r PhotosLibraryMediaItemsRepository) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []SimpleMediaItem) ([]MediaItem, error)
- func (r PhotosLibraryMediaItemsRepository) Get(ctx context.Context, mediaItemId string) (*MediaItem, error)
- func (r PhotosLibraryMediaItemsRepository) ListByAlbum(ctx context.Context, albumId string) ([]MediaItem, error)
- func (r PhotosLibraryMediaItemsRepository) URL() string
- type Repository
- type SimpleMediaItem
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type HttpMediaItemsService ¶
type HttpMediaItemsService struct {
// contains filtered or unexported fields
}
HttpMediaItemsService implements a media items Google Photos client.
func NewHttpMediaItemsService ¶
func NewHttpMediaItemsService(authenticatedClient *http.Client) (*HttpMediaItemsService, error)
NewHttpMediaItemsService returns a media items Google Photos client. The authenticatedClient should have all oAuth credentials in place.
func (HttpMediaItemsService) Create ¶
func (ms HttpMediaItemsService) Create(ctx context.Context, mediaItem SimpleMediaItem) (MediaItem, error)
Create creates a media item in the repository. By default, the media item will be added to the end of the library.
func (HttpMediaItemsService) CreateMany ¶
func (ms HttpMediaItemsService) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]MediaItem, error)
CreateMany creates one or more media items in the repository. By default, the media item(s) will be added to the end of the library.
func (HttpMediaItemsService) CreateManyToAlbum ¶
func (ms HttpMediaItemsService) 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) are also added to the album. By default, the media item(s) will be added to the end of the library or album.
func (HttpMediaItemsService) CreateToAlbum ¶
func (ms HttpMediaItemsService) CreateToAlbum(ctx context.Context, albumId string, mediaItem SimpleMediaItem) (MediaItem, error)
CreateToAlbum creates a media item in the repository. 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 (HttpMediaItemsService) Get ¶
Get returns the media item specified based on a given media item id. It will return ErrNotFound if the media item id does not exist.
func (HttpMediaItemsService) ListByAlbum ¶
func (ms HttpMediaItemsService) ListByAlbum(ctx context.Context, albumId string) ([]MediaItem, error)
ListByAlbum list all media items in the specified album.
type MediaItem ¶
type MediaItem struct { ID string Description string ProductURL string BaseURL string MimeType string MediaMetadata MediaMetadata Filename string }
MediaItem represents of a media item (such as a photo or video) in Google Photos. See: https://developers.google.com/photos/library/reference/rest/v1/mediaItems
type MediaMetadata ¶
MediaMetadata represents metadata for a media item. See: https://developers.google.com/photos/library/reference/rest/v1/mediaItems
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 media items service using `gphotosuploader/googlemirror/api/photoslibrary`.
type PhotosLibraryMediaItemsRepository ¶ added in v2.1.0
type PhotosLibraryMediaItemsRepository struct {
// contains filtered or unexported fields
}
PhotosLibraryMediaItemsRepository represents a media items Google Photos repository.
func NewPhotosLibraryClient ¶
func NewPhotosLibraryClient(authenticatedClient *http.Client) (*PhotosLibraryMediaItemsRepository, error)
NewPhotosLibraryClient returns a Repository using PhotosLibrary service.
func NewPhotosLibraryClientWithURL ¶ added in v2.1.0
func NewPhotosLibraryClientWithURL(authenticatedClient *http.Client, url string) (*PhotosLibraryMediaItemsRepository, error)
NewPhotosLibraryClientWithURL returns a Repository using PhotosLibrary service with a custom URL.
func (PhotosLibraryMediaItemsRepository) CreateMany ¶ added in v2.1.0
func (r PhotosLibraryMediaItemsRepository) CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]MediaItem, error)
CreateMany creates one or more media items in the repository. By default, the media item(s) will be added to the end of the library.
func (PhotosLibraryMediaItemsRepository) CreateManyToAlbum ¶ added in v2.1.0
func (r PhotosLibraryMediaItemsRepository) 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) are also added to the album. By default, the media item(s) will be added to the end of the library or album.
func (PhotosLibraryMediaItemsRepository) Get ¶ added in v2.1.0
func (r PhotosLibraryMediaItemsRepository) Get(ctx context.Context, mediaItemId string) (*MediaItem, error)
Get returns the media item specified based on a given media item id.
func (PhotosLibraryMediaItemsRepository) ListByAlbum ¶ added in v2.1.0
func (r PhotosLibraryMediaItemsRepository) ListByAlbum(ctx context.Context, albumId string) ([]MediaItem, error)
ListByAlbum list all media items in the specified album.
func (PhotosLibraryMediaItemsRepository) URL ¶ added in v2.1.0
func (r PhotosLibraryMediaItemsRepository) URL() string
URL returns the repository url.
type Repository ¶
type Repository interface { CreateMany(ctx context.Context, mediaItems []SimpleMediaItem) ([]MediaItem, error) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []SimpleMediaItem) ([]MediaItem, error) Get(ctx context.Context, itemId string) (*MediaItem, error) ListByAlbum(ctx context.Context, albumId string) ([]MediaItem, error) }
Repository represents a media items' repository.
type SimpleMediaItem ¶
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