media_items

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 ContributorInfo struct {
	ProfilePictureBaseURL string `json:"profilePictureBaseUrl"`
	DisplayName           string `json:"displayName"`
}

type DateFilter

type DateFilter struct {
	Dates  []DateFilterDateItem  `json:"dates"`
	Ranges []DateFilterRangeItem `json:"ranges"`
}

type DateFilterDateItem

type DateFilterDateItem struct {
	Year  int `json:"year"`
	Month int `json:"month"`
	Day   int `json:"day"`
}

type DateFilterRangeItem

type DateFilterRangeItem struct {
	StartDate DateFilterDateItem `json:"startDate"`
	EndDate   DateFilterDateItem `json:"endDate"`
}

type Feature

type Feature string

Feature used in search filter

const (
	FeatureNone      Feature = "NONE"
	FeatureFavorites Feature = "FAVORITES"
)

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 MediaItemWithStatus struct {
	MediaItem MediaItem          `json:"mediaItem"`
	Status    internal.APIStatus `json:"status"`
}

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 MediaType

type MediaType string

Media type used in search filter

const (
	MediaTypeFilterPhoto    MediaType = "PHOTO"
	MediaTypeFilterVideo    MediaType = "VIDEO"
	MediaTypeFilterAllMedia MediaType = "ALL_MEDIA"
)

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 NewMediaItemResult struct {
	UploadToken string             `json:"uploadToken"`
	Status      internal.APIStatus `json:"status"`
	MediaItem   MediaItem          `json:"mediaItem"`
}

type PhotoMetadata

type PhotoMetadata struct {
	CameraMake      string  `json:"cameraMake"`
	CameraModel     string  `json:"cameraModel"`
	FocalLength     float32 `json:"focalLength"`
	ApertureFNumber float32 `json:"apertureFNumber"`
	IsoEquivalent   int     `json:"isoEquivalent"`
	ExposureTime    string  `json:"exposureTime"`
}

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"`
}

type SimpleMediaItem

type SimpleMediaItem struct {
	UploadToken string `json:"uploadToken"`
	FileName    string `json:"fileName"`
}

type VideoMetadata

type VideoMetadata struct {
	CameraMake  string  `json:"cameraMake"`
	CameraModel string  `json:"cameraModel"`
	Fps         float32 `json:"fps"`
	Status      string  `json:"status"`
}

Jump to

Keyboard shortcuts

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