Documentation
¶
Index ¶
- type BatchCreateOptions
- type ContentCategory
- type ContentFilter
- type ContributorInfo
- type DateFilter
- type DateFilterDateItem
- type DateFilterRangeItem
- type Feature
- type FeatureFilter
- type Field
- type HttpMediaItemsService
- func (s HttpMediaItemsService) BatchCreateItems(options BatchCreateOptions, ctx context.Context) ([]NewMediaItemResult, error)
- func (s HttpMediaItemsService) BatchCreateItemsFromFiles(albumId string, paths []string, position albums.AlbumPosition, ...) ([]NewMediaItemResult, error)
- func (s HttpMediaItemsService) BatchGetItems(ids []string, ctx context.Context) (mediaItems []MediaItemWithStatus, err error)
- func (s HttpMediaItemsService) BatchGetItemsAll(ids []string, ctx context.Context) ([]MediaItemWithStatus, error)
- func (s HttpMediaItemsService) BatchGetItemsAllAsync(ids []string, ctx context.Context) (<-chan MediaItemWithStatus, <-chan error)
- func (s HttpMediaItemsService) Get(itemId string, ctx context.Context) (mediaItem *MediaItem, err error)
- func (s HttpMediaItemsService) List(options *ListOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
- func (s HttpMediaItemsService) ListAll(options *ListOptions, ctx context.Context) ([]MediaItem, error)
- func (s HttpMediaItemsService) ListAllAsync(options *ListOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
- func (s HttpMediaItemsService) Patch(mediaItem MediaItem, updateMask []Field, ctx context.Context) (*MediaItem, error)
- func (s HttpMediaItemsService) Search(options *SearchOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
- func (s HttpMediaItemsService) SearchAll(options *SearchOptions, ctx context.Context) ([]MediaItem, error)
- func (s HttpMediaItemsService) SearchAllAsync(options *SearchOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
- type ListOptions
- type MediaItem
- type MediaItemWithStatus
- type MediaItemsService
- type MediaMetadata
- type MediaType
- type MediaTypeFilter
- type NewMediaItem
- type NewMediaItemResult
- type PhotoMetadata
- type SearchFilters
- type SearchOptions
- type SimpleMediaItem
- type VideoMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchCreateOptions ¶
type BatchCreateOptions struct {
AlbumId string `json:"albumId"`
AlbumPosition albums.AlbumPosition `json:"albumPosition"`
NewMediaItems []NewMediaItem `json:"newMediaItems"`
}
type ContentCategory ¶
type ContentCategory string
Content category used in search filter
const ( ContentCategoryAnimals ContentCategory = "ANIMALS" ContentCategoryArts ContentCategory = "ARTS" ContentCategoryBirthdays ContentCategory = "BIRTHDAYS" ContentCategoryCityscapes ContentCategory = "CITYSCAPES" ContentCategoryCrafts ContentCategory = "CRAFTS" ContentCategoryDocuments ContentCategory = "DOCUMENTS" ContentCategoryFashion ContentCategory = "FASHION" ContentCategoryFlowers ContentCategory = "FLOWERS" ContentCategoryFood ContentCategory = "FOOD" ContentCategoryGardens ContentCategory = "GARDENS" ContentCategoryHolidays ContentCategory = "HOLIDAYS" ContentCategoryHouses ContentCategory = "HOUSES" ContentCategoryLandmarks ContentCategory = "LANDMARKS" ContentCategoryLandscapes ContentCategory = "LANDSCAPES" ContentCategoryNight ContentCategory = "NIGHT" ContentCategoryPeople ContentCategory = "PEOPLE" ContentCategoryPerformances ContentCategory = "PERFORMANCES" ContentCategoryPets ContentCategory = "PETS" ContentCategoryReceipts ContentCategory = "RECEIPTS" ContentCategoryScreenshots ContentCategory = "SCREENSHOTS" ContentCategorySelfies ContentCategory = "SELFIES" ContentCategorySport ContentCategory = "SPORT" ContentCategoryTravel ContentCategory = "TRAVEL" ContentCategoryUtility ContentCategory = "UTILITY" ContentCategoryWeddings ContentCategory = "WEDDINGS" ContentCategoryWhiteboards ContentCategory = "WHITEBOARDS" )
type ContentFilter ¶
type ContentFilter struct {
IncludedContentCategories []ContentCategory `json:"includedContentCategories"`
ExcludedContentCategories []ContentCategory `json:"excludedContentCategories"`
}
type ContributorInfo ¶
type DateFilter ¶
type DateFilter struct {
Dates []DateFilterDateItem `json:"dates"`
Ranges []DateFilterRangeItem `json:"ranges"`
}
type DateFilterDateItem ¶
type DateFilterRangeItem ¶
type DateFilterRangeItem struct {
StartDate DateFilterDateItem `json:"startDate"`
EndDate DateFilterDateItem `json:"endDate"`
}
type FeatureFilter ¶
type FeatureFilter struct {
IncludedFeatures []Feature `json:"includedFeatures,omitEmpty"`
}
type Field ¶ added in v0.2.0
type Field string
Used for updateMask attribute in patch method
const (
MediaItemFieldDescription Field = "description"
)
type HttpMediaItemsService ¶
type HttpMediaItemsService struct {
// contains filtered or unexported fields
}
func NewHttpMediaItemsService ¶
func NewHttpMediaItemsService(httpClient *http.Client, uploader uploader.MediaUploader) HttpMediaItemsService
func (HttpMediaItemsService) BatchCreateItems ¶
func (s HttpMediaItemsService) BatchCreateItems(options BatchCreateOptions, ctx context.Context) ([]NewMediaItemResult, error)
Create one or multiple media items
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate
func (HttpMediaItemsService) BatchCreateItemsFromFiles ¶
func (s HttpMediaItemsService) BatchCreateItemsFromFiles(albumId string, paths []string, position albums.AlbumPosition, ctx context.Context) ([]NewMediaItemResult, error)
Extension of BatchCreateItems for easier uploading (at this moment it's limited by
func (HttpMediaItemsService) BatchGetItems ¶
func (s HttpMediaItemsService) BatchGetItems(ids []string, ctx context.Context) (mediaItems []MediaItemWithStatus, err error)
Fetches multiple media items (max 50)
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchGet
func (HttpMediaItemsService) BatchGetItemsAll ¶
func (s HttpMediaItemsService) BatchGetItemsAll(ids []string, ctx context.Context) ([]MediaItemWithStatus, error)
Synchronous wrapper for BatchGetItemsAllAsync
func (HttpMediaItemsService) BatchGetItemsAllAsync ¶
func (s HttpMediaItemsService) BatchGetItemsAllAsync(ids []string, ctx context.Context) (<-chan MediaItemWithStatus, <-chan error)
Asynchronous wrapper for BatchGetItems Fetches any number of media items in 50 items chunks.
func (HttpMediaItemsService) Get ¶
func (s HttpMediaItemsService) Get(itemId string, ctx context.Context) (mediaItem *MediaItem, err error)
Fetches media item specified by ID
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/get
func (HttpMediaItemsService) List ¶
func (s HttpMediaItemsService) List(options *ListOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
Fetches all media items. Default page size is 50
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/list
func (HttpMediaItemsService) ListAll ¶
func (s HttpMediaItemsService) ListAll(options *ListOptions, ctx context.Context) ([]MediaItem, error)
Synchronous wrapper for ListAllAsync
func (HttpMediaItemsService) ListAllAsync ¶
func (s HttpMediaItemsService) ListAllAsync(options *ListOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
Asynchronous wrapper for List that takes care of pagination. Returned channel has buffer size of 50
func (HttpMediaItemsService) Patch ¶ added in v0.2.0
func (s HttpMediaItemsService) Patch(mediaItem MediaItem, updateMask []Field, ctx context.Context) (*MediaItem, error)
Patches MediaItem. updateMask argument can be used to update only selected fields. Currently only id and description fields are read
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/patch
func (HttpMediaItemsService) Search ¶
func (s HttpMediaItemsService) Search(options *SearchOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
Fetches all media items based on search criteria. Default page size is 50
Doc: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search
func (HttpMediaItemsService) SearchAll ¶
func (s HttpMediaItemsService) SearchAll(options *SearchOptions, ctx context.Context) ([]MediaItem, error)
Synchronous wrapper for SearchAllAsync
func (HttpMediaItemsService) SearchAllAsync ¶
func (s HttpMediaItemsService) SearchAllAsync(options *SearchOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
Asynchronous wrapper for Search that takes care of pagination. Returned channel has buffer size of 50
type ListOptions ¶
type ListOptions struct {
PageSize int `url:"pageSize"`
}
type MediaItem ¶
type MediaItem struct {
ID string `json:"id"`
Description string `json:"description"`
ProductURL string `json:"productUrl"`
BaseURL string `json:"baseUrl"`
MimeType string `json:"mimeType"`
MediaMetadata MediaMetadata `json:"mediaMetaData"`
ContributorInfo ContributorInfo `json:"contributorInfo"`
Filename string `json:"filename"`
}
type MediaItemWithStatus ¶
type MediaItemsService ¶
type MediaItemsService interface {
BatchCreateItems(options BatchCreateOptions, ctx context.Context) ([]NewMediaItemResult, error)
BatchCreateItemsFromFiles(albumId string, paths []string, position albums.AlbumPosition, ctx context.Context) ([]NewMediaItemResult, error)
BatchGetItems(ids []string, ctx context.Context) (mediaItems []MediaItemWithStatus, err error)
BatchGetItemsAll(ids []string, ctx context.Context) ([]MediaItemWithStatus, error)
BatchGetItemsAllAsync(ids []string, ctx context.Context) (<-chan MediaItemWithStatus, <-chan error)
Get(itemId string, ctx context.Context) (mediaItem *MediaItem, err error)
List(options *ListOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
ListAll(options *ListOptions, ctx context.Context) ([]MediaItem, error)
ListAllAsync(options *ListOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
Patch(mediaItem MediaItem, updateMask []Field, ctx context.Context) (*MediaItem, error)
Search(options *SearchOptions, pageToken string, ctx context.Context) (mediaItems []MediaItem, nextPageToken string, err error)
SearchAll(options *SearchOptions, ctx context.Context) ([]MediaItem, error)
SearchAllAsync(options *SearchOptions, ctx context.Context) (<-chan MediaItem, <-chan error)
}
Interface for https://developers.google.com/photos/library/reference/rest/v1/mediaItems resource
type MediaMetadata ¶
type MediaMetadata struct {
CreationTime string `json:"creationTime"`
Width string `json:"width"`
Height string `json:"height"`
PhotoMetadata *PhotoMetadata `json:"photo,omitempty"`
VideoMetadata *VideoMetadata `json:"video,omitempty"`
}
type MediaTypeFilter ¶
type MediaTypeFilter struct {
MediaTypes []MediaType `json:"mediaTypes"`
}
type NewMediaItem ¶
type NewMediaItem struct {
Description string `json:"description"`
SimpleMediaItem SimpleMediaItem `json:"simpleMediaItem"`
}
type NewMediaItemResult ¶
type PhotoMetadata ¶
type SearchFilters ¶
type SearchFilters struct {
FeatureFilter *FeatureFilter `json:"featureFilter,omitEmpty"`
DateFilter *DateFilter `json:"dateFilter, omitEmpty"`
ContentFilter *ContentFilter `json:"contentFilter, omitEmpty"`
MediaTypeFilter *MediaTypeFilter `json:"mediaTypeFilter, omitEmpty"`
IncludeArchivedMedia bool `json:"includeArchivedMedia"`
ExcludeNonAppCreatedData bool `json:"excludeNonAppCreatedData"`
}
type SearchOptions ¶
type SearchOptions struct {
PageSize int `json:"pageSize"`
AlbumId string `json:"albumId,omitEmpty"`
Filters *SearchFilters `json:"filters,omitEmpty"`
}