api

package
v0.0.0-...-1dc401f Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package api provides types used by the Google Photos API.

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"`
	MediaItemsCount       string `json:"mediaItemsCount,omitempty"`
	CoverPhotoBaseURL     string `json:"coverPhotoBaseUrl,omitempty"`
	CoverPhotoMediaItemID string `json:"coverPhotoMediaItemId,omitempty"`
	IsWriteable           bool   `json:"isWriteable,omitempty"`
}

Album of photos

type BatchCreateRequest

type BatchCreateRequest struct {
	AlbumID       string         `json:"albumId,omitempty"`
	NewMediaItems []NewMediaItem `json:"newMediaItems"`
}

BatchCreateRequest creates media items from upload tokens

type BatchCreateResponse

type BatchCreateResponse struct {
	NewMediaItemResults []struct {
		UploadToken string `json:"uploadToken"`
		Status      struct {
			Message string `json:"message"`
			Code    int    `json:"code"`
		} `json:"status"`
		MediaItem MediaItem `json:"mediaItem"`
	} `json:"newMediaItemResults"`
}

BatchCreateResponse is returned from BatchCreateRequest

type BatchRemoveItems

type BatchRemoveItems struct {
	MediaItemIDs []string `json:"mediaItemIds"`
}

BatchRemoveItems is for removing items from an album

type ContentFilter

type ContentFilter struct {
	IncludedContentCategories []string `json:"includedContentCategories,omitempty"`
	ExcludedContentCategories []string `json:"excludedContentCategories,omitempty"`
}

ContentFilter is uses to add content categories to media item queries

type CreateAlbum

type CreateAlbum struct {
	Album *Album `json:"album"`
}

CreateAlbum creates an Album

type Date

type Date struct {
	Year  int `json:"year,omitempty"`
	Month int `json:"month,omitempty"`
	Day   int `json:"day,omitempty"`
}

Date is used as part of SearchFilter

type DateFilter

type DateFilter struct {
	Dates  []Date `json:"dates,omitempty"`
	Ranges []struct {
		StartDate Date `json:"startDate,omitempty"`
		EndDate   Date `json:"endDate,omitempty"`
	} `json:"ranges,omitempty"`
}

DateFilter is uses to add date ranges to media item queries

type Error

type Error struct {
	Details ErrorDetails `json:"error"`
}

Error is returned on errors

func (*Error) Error

func (e *Error) Error() string

Error satisfies error interface

type ErrorDetails

type ErrorDetails struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Status  string `json:"status"`
}

ErrorDetails in the internals of the Error type

type FeatureFilter

type FeatureFilter struct {
	IncludedFeatures []string `json:"includedFeatures,omitempty"`
}

FeatureFilter is uses to add features to media item queries

type Filters

type Filters struct {
	DateFilter               *DateFilter      `json:"dateFilter,omitempty"`
	ContentFilter            *ContentFilter   `json:"contentFilter,omitempty"`
	MediaTypeFilter          *MediaTypeFilter `json:"mediaTypeFilter,omitempty"`
	FeatureFilter            *FeatureFilter   `json:"featureFilter,omitempty"`
	IncludeArchivedMedia     *bool            `json:"includeArchivedMedia,omitempty"`
	ExcludeNonAppCreatedData *bool            `json:"excludeNonAppCreatedData,omitempty"`
}

Filters combines all the filter types for media item queries

type ListAlbums

type ListAlbums struct {
	Albums        []Album `json:"albums"`
	SharedAlbums  []Album `json:"sharedAlbums"`
	NextPageToken string  `json:"nextPageToken"`
}

ListAlbums is returned from albums.list and sharedAlbums.list

type MediaItem

type MediaItem struct {
	ID            string `json:"id"`
	ProductURL    string `json:"productUrl"`
	BaseURL       string `json:"baseUrl"`
	MimeType      string `json:"mimeType"`
	MediaMetadata struct {
		CreationTime time.Time `json:"creationTime"`
		Width        string    `json:"width"`
		Height       string    `json:"height"`
		Photo        struct{}  `json:"photo"`
	} `json:"mediaMetadata"`
	Filename string `json:"filename"`
}

MediaItem is a photo or video

type MediaItems

type MediaItems struct {
	MediaItems    []MediaItem `json:"mediaItems"`
	NextPageToken string      `json:"nextPageToken"`
}

MediaItems is returned from mediaitems.list, mediaitems.search

type MediaTypeFilter

type MediaTypeFilter struct {
	MediaTypes []string `json:"mediaTypes,omitempty"`
}

MediaTypeFilter is uses to add media types to media item queries

type NewMediaItem

type NewMediaItem struct {
	Description     string          `json:"description"`
	SimpleMediaItem SimpleMediaItem `json:"simpleMediaItem"`
}

NewMediaItem is a single media item for upload

type SearchFilter

type SearchFilter struct {
	AlbumID   string   `json:"albumId,omitempty"`
	PageSize  int      `json:"pageSize"`
	PageToken string   `json:"pageToken,omitempty"`
	Filters   *Filters `json:"filters,omitempty"`
}

SearchFilter is uses with mediaItems.search

type SimpleMediaItem

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

SimpleMediaItem is part of NewMediaItem

Jump to

Keyboard shortcuts

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