albums

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID                    string         `json:"id,omitempty"`
	Title                 string         `json:"title"`
	ProductURL            string         `json:"productUrl,omitempty"`
	IsWriteable           bool           `json:"isWriteable,omitempty"`
	ShareInfo             AlbumShareInfo `json:"shareInfo,omitempty"`
	MediaItemsCount       string         `json:"mediaItemsCount,omitempty"`
	CoverPhotoBaseURL     string         `json:"coverPhotoBaseUrl,omitempty"`
	CoverPhotoMediaItemID string         `json:"coverPhotoMediaItemId,omitempty"`
}

type AlbumPosition

type AlbumPosition struct {
	Position                 AlbumPositionType `json:"position"`
	RelativeMediaItemId      string            `json:"relativeMediaItemId,omitempty"`
	RelativeEnrichmentItemId string            `json:"relativeEnrichmentItemId,omitempty"`
}

type AlbumPositionType

type AlbumPositionType string
const (
	AlbumPositionTypeUnspecified         AlbumPositionType = "POSITION_TYPE_UNSPECIFIED"
	AlbumPositionTypeFirstInAlbum        AlbumPositionType = "FIRST_IN_ALBUM"
	AlbumPositionTypeLastInAlbum         AlbumPositionType = "LAST_IN_ALBUM"
	AlbumPositionTypeAfterMediaItem      AlbumPositionType = "AFTER_MEDIA_ITEM"
	AlbumPositionTypeAfterEnrichmentItem AlbumPositionType = "AFTER_ENRICHMENT_ITEM"
)

type AlbumShareInfo

type AlbumShareInfo struct {
	SharedAlbumOptions SharedAlbumOptions `json:"sharedAlbumOptions"`
	ShareableURL       string             `json:"shareableUrl"`
	ShareToken         string             `json:"shareToken"`
	IsJoined           bool               `json:"isJoined"`
	IsOwned            bool               `json:"isOwned"`
}

type AlbumsListOptions

type AlbumsListOptions struct {
	PageSize                 int  `url:"pageSize"`
	ExcludeNonAppCreatedData bool `url:"excludeNonAppCreatedData"`
}

type AlbumsService

type AlbumsService interface {
	AddEnrichment(albumId string, enrichment NewEnrichmentItem, ctx context.Context) (*EnrichmentItem, error)
	BatchAddMediaItems(albumId string, mediaItemIds []string, ctx context.Context) error
	BatchAddMediaItemsAll(albumId string, mediaItemIds []string, ctx context.Context) error
	BatchRemoveMediaItems(albumId string, mediaItemIds []string, ctx context.Context) error
	BatchRemoveMediaItemsAll(albumId string, mediaItemIds []string, ctx context.Context) error
	Create(title string, ctx context.Context) (*Album, error)
	Get(id string, ctx context.Context) (*Album, error)
	List(options *AlbumsListOptions, pageToken string, ctx context.Context) (result []Album, nextPageToken string, err error)
	ListAll(options *AlbumsListOptions, ctx context.Context) ([]Album, error)
	ListAllAsync(options *AlbumsListOptions, ctx context.Context) (<-chan Album, <-chan error)
	Patch(album Album, fieldMask []Field, ctx context.Context) (*Album, error)
	Share(id string, options SharedAlbumOptions, ctx context.Context) (*AlbumShareInfo, error)
	Unshare(id string, ctx context.Context) error
}

Interface for https://developers.google.com/photos/library/reference/rest/v1/albums resource

type EnrichmentItem

type EnrichmentItem struct {
	Id string `json:"id"`
}

type Field added in v0.2.0

type Field string

Used for updateMask attribute in patch method

const (
	AlbumFieldTitle                 Field = "title"
	AlbumFieldCoverPhotoMediaItemId Field = "coverPhotoMediaItemId"
)

type HttpAlbumsService

type HttpAlbumsService struct {
	// contains filtered or unexported fields
}

func NewHttpAlbumsService

func NewHttpAlbumsService(authenticatedClient *http.Client) HttpAlbumsService

func (HttpAlbumsService) AddEnrichment

func (s HttpAlbumsService) AddEnrichment(albumId string, enrichment NewEnrichmentItem, ctx context.Context) (*EnrichmentItem, error)

Adds enrichment item to album specified by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/addEnrichment

func (HttpAlbumsService) BatchAddMediaItems

func (s HttpAlbumsService) BatchAddMediaItems(albumId string, mediaItemIds []string, ctx context.Context) error

Adds multiple media items (max 50) to album specified by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/batchAddMediaItems

func (HttpAlbumsService) BatchAddMediaItemsAll

func (s HttpAlbumsService) BatchAddMediaItemsAll(albumId string, mediaItemIds []string, ctx context.Context) error

Adds multiple media items (no limit) using multiple BatchAddMediaItems requests

func (HttpAlbumsService) BatchRemoveMediaItems

func (s HttpAlbumsService) BatchRemoveMediaItems(albumId string, mediaItemIds []string, ctx context.Context) error

Removes multiple media items (max 50) from album specified by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/batchRemoveMediaItems

func (HttpAlbumsService) BatchRemoveMediaItemsAll

func (s HttpAlbumsService) BatchRemoveMediaItemsAll(albumId string, mediaItemIds []string, ctx context.Context) error

Removes multiple media items (no limit) using multiple BatchRemoveMediaItems requests

func (HttpAlbumsService) Create

func (s HttpAlbumsService) Create(title string, ctx context.Context) (*Album, error)

Create new album

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/create

func (HttpAlbumsService) Get

func (s HttpAlbumsService) Get(id string, ctx context.Context) (*Album, error)

Fetch album by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/get

func (HttpAlbumsService) List

func (s HttpAlbumsService) List(options *AlbumsListOptions, pageToken string, ctx context.Context) (result []Album, nextPageToken string, err error)

Lists all albums

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/list

func (HttpAlbumsService) ListAll

func (s HttpAlbumsService) ListAll(options *AlbumsListOptions, ctx context.Context) ([]Album, error)

Synchronous wrapper for ListAllAsync

func (HttpAlbumsService) ListAllAsync

func (s HttpAlbumsService) ListAllAsync(options *AlbumsListOptions, ctx context.Context) (<-chan Album, <-chan error)

Asynchronous wrapper for List that takes care of pagination. Returned channel has buffer size of 50

func (HttpAlbumsService) Patch added in v0.2.0

func (s HttpAlbumsService) Patch(album Album, updateMask []Field, ctx context.Context) (*Album, error)

Patches album. updateMask argument can be used to update only selected fields. Currently only id, title and coverPhotoMediaItemId are read

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/patch

func (HttpAlbumsService) Share

Shares album specified by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/share

func (HttpAlbumsService) Unshare

func (s HttpAlbumsService) Unshare(id string, ctx context.Context) error

Unshares album specified by id

Doc: https://developers.google.com/photos/library/reference/rest/v1/albums/unshare

type LatLng

type LatLng struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

type Location

type Location struct {
	LocationName string `json:"locationName"`
	LatLng       LatLng `json:"latLng"`
}

type LocationEnrichment

type LocationEnrichment struct {
	Location Location `json:"location"`
}

type MapEnrichment

type MapEnrichment struct {
	Origin      Location `json:"origin"`
	Destination Location `json:"destination"`
}

type NewEnrichmentItem

type NewEnrichmentItem struct {
	TextEnrichment     TextEnrichment     `json:"textEnrichment,omitempty"`
	LocationEnrichment LocationEnrichment `json:"locationEnrichment, omitempty"`
	MapEnrichment      MapEnrichment      `json:"mapEnrichment,omitempty"`
}

type SharedAlbumOptions

type SharedAlbumOptions struct {
	IsCollaborative bool `json:"isCollaborative"`
	IsCommentable   bool `json:"isCommentable"`
}

type SharedAlbumRequestOptions

type SharedAlbumRequestOptions struct {
	IsCollaborative bool `json:"isCollaborative"`
	IsCommentable   bool `json:"isCommentable"`
}

type TextEnrichment

type TextEnrichment struct {
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

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