You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3310 lines
121 KiB

  1. // Package photoslibrary provides access to the Photos Library API.
  2. //
  3. // See https://developers.google.com/photos/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/photoslibrary/v1"
  8. // ...
  9. // photoslibraryService, err := photoslibrary.New(oauthHttpClient)
  10. package photoslibrary // import "google.golang.org/api/photoslibrary/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "photoslibrary:v1"
  41. const apiName = "photoslibrary"
  42. const apiVersion = "v1"
  43. const basePath = "https://photoslibrary.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View the photos, videos and albums in your Google Photos
  47. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  48. // View and manage your Google Photos library
  49. PhotoslibraryScope = "https://www.googleapis.com/auth/photoslibrary"
  50. // Add to your Google Photos library
  51. PhotoslibraryAppendonlyScope = "https://www.googleapis.com/auth/photoslibrary.appendonly"
  52. // View your Google Photos library
  53. PhotoslibraryReadonlyScope = "https://www.googleapis.com/auth/photoslibrary.readonly"
  54. // Manage photos added by this app
  55. PhotoslibraryReadonlyAppcreateddataScope = "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  56. // Manage and add to shared albums on your behalf
  57. PhotoslibrarySharingScope = "https://www.googleapis.com/auth/photoslibrary.sharing"
  58. )
  59. func New(client *http.Client) (*Service, error) {
  60. if client == nil {
  61. return nil, errors.New("client is nil")
  62. }
  63. s := &Service{client: client, BasePath: basePath}
  64. s.Albums = NewAlbumsService(s)
  65. s.MediaItems = NewMediaItemsService(s)
  66. s.SharedAlbums = NewSharedAlbumsService(s)
  67. return s, nil
  68. }
  69. type Service struct {
  70. client *http.Client
  71. BasePath string // API endpoint base URL
  72. UserAgent string // optional additional User-Agent fragment
  73. Albums *AlbumsService
  74. MediaItems *MediaItemsService
  75. SharedAlbums *SharedAlbumsService
  76. }
  77. func (s *Service) userAgent() string {
  78. if s.UserAgent == "" {
  79. return googleapi.UserAgent
  80. }
  81. return googleapi.UserAgent + " " + s.UserAgent
  82. }
  83. func NewAlbumsService(s *Service) *AlbumsService {
  84. rs := &AlbumsService{s: s}
  85. return rs
  86. }
  87. type AlbumsService struct {
  88. s *Service
  89. }
  90. func NewMediaItemsService(s *Service) *MediaItemsService {
  91. rs := &MediaItemsService{s: s}
  92. return rs
  93. }
  94. type MediaItemsService struct {
  95. s *Service
  96. }
  97. func NewSharedAlbumsService(s *Service) *SharedAlbumsService {
  98. rs := &SharedAlbumsService{s: s}
  99. return rs
  100. }
  101. type SharedAlbumsService struct {
  102. s *Service
  103. }
  104. // AddEnrichmentToAlbumRequest: Request to add an enrichment to a
  105. // specific album at a specific position.
  106. type AddEnrichmentToAlbumRequest struct {
  107. // AlbumPosition: The position where the enrichment will be inserted.
  108. AlbumPosition *AlbumPosition `json:"albumPosition,omitempty"`
  109. // NewEnrichmentItem: The enrichment to be added.
  110. NewEnrichmentItem *NewEnrichmentItem `json:"newEnrichmentItem,omitempty"`
  111. // ForceSendFields is a list of field names (e.g. "AlbumPosition") to
  112. // unconditionally include in API requests. By default, fields with
  113. // empty values are omitted from API requests. However, any non-pointer,
  114. // non-interface field appearing in ForceSendFields will be sent to the
  115. // server regardless of whether the field is empty or not. This may be
  116. // used to include empty fields in Patch requests.
  117. ForceSendFields []string `json:"-"`
  118. // NullFields is a list of field names (e.g. "AlbumPosition") to include
  119. // in API requests with the JSON null value. By default, fields with
  120. // empty values are omitted from API requests. However, any field with
  121. // an empty value appearing in NullFields will be sent to the server as
  122. // null. It is an error if a field in this list has a non-empty value.
  123. // This may be used to include null fields in Patch requests.
  124. NullFields []string `json:"-"`
  125. }
  126. func (s *AddEnrichmentToAlbumRequest) MarshalJSON() ([]byte, error) {
  127. type NoMethod AddEnrichmentToAlbumRequest
  128. raw := NoMethod(*s)
  129. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  130. }
  131. type AddEnrichmentToAlbumResponse struct {
  132. // EnrichmentItem: [Output only] Enrichment which was added.
  133. EnrichmentItem *EnrichmentItem `json:"enrichmentItem,omitempty"`
  134. // ServerResponse contains the HTTP response code and headers from the
  135. // server.
  136. googleapi.ServerResponse `json:"-"`
  137. // ForceSendFields is a list of field names (e.g. "EnrichmentItem") to
  138. // unconditionally include in API requests. By default, fields with
  139. // empty values are omitted from API requests. However, any non-pointer,
  140. // non-interface field appearing in ForceSendFields will be sent to the
  141. // server regardless of whether the field is empty or not. This may be
  142. // used to include empty fields in Patch requests.
  143. ForceSendFields []string `json:"-"`
  144. // NullFields is a list of field names (e.g. "EnrichmentItem") to
  145. // include in API requests with the JSON null value. By default, fields
  146. // with empty values are omitted from API requests. However, any field
  147. // with an empty value appearing in NullFields will be sent to the
  148. // server as null. It is an error if a field in this list has a
  149. // non-empty value. This may be used to include null fields in Patch
  150. // requests.
  151. NullFields []string `json:"-"`
  152. }
  153. func (s *AddEnrichmentToAlbumResponse) MarshalJSON() ([]byte, error) {
  154. type NoMethod AddEnrichmentToAlbumResponse
  155. raw := NoMethod(*s)
  156. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  157. }
  158. // Album: Representation of an album in Google Photos.
  159. // Albums are a container for media items. They contain an
  160. // additional
  161. // shareInfo property if they have been shared by the application.
  162. type Album struct {
  163. // CoverPhotoBaseUrl: [Output only] A URL to the cover photo's bytes.
  164. // This should not be used as
  165. // is. Parameters should be appended to this URL before use. For
  166. // example,
  167. // '=w2048-h1024' will set the dimensions of the cover photo to have a
  168. // width
  169. // of 2048 px and height of 1024 px.
  170. CoverPhotoBaseUrl string `json:"coverPhotoBaseUrl,omitempty"`
  171. // Id: [Ouput only] Identifier for the album. This is a persistent
  172. // identifier that
  173. // can be used between sessions to identify this album.
  174. Id string `json:"id,omitempty"`
  175. // IsWriteable: [Output only] True if media items can be created in the
  176. // album.
  177. // This field is based on the scopes granted and permissions of the
  178. // album. If
  179. // the scopes are changed or permissions of the album are changed, this
  180. // field
  181. // will be updated.
  182. IsWriteable bool `json:"isWriteable,omitempty"`
  183. // ProductUrl: [Output only] Google Photos URL for the album. The user
  184. // needs to be signed
  185. // in to their Google Photos account to access this link.
  186. ProductUrl string `json:"productUrl,omitempty"`
  187. // ShareInfo: [Output only] Information related to shared albums.
  188. // This field is only populated if the album is a shared album,
  189. // the
  190. // developer created the album and the user has granted
  191. // photoslibrary.sharing
  192. // scope.
  193. ShareInfo *ShareInfo `json:"shareInfo,omitempty"`
  194. // Title: Name of the album displayed to the user in their Google Photos
  195. // account.
  196. // This string should not be more than 500 characters.
  197. Title string `json:"title,omitempty"`
  198. // TotalMediaItems: [Output only] The number of media items in the album
  199. TotalMediaItems int64 `json:"totalMediaItems,omitempty,string"`
  200. // ServerResponse contains the HTTP response code and headers from the
  201. // server.
  202. googleapi.ServerResponse `json:"-"`
  203. // ForceSendFields is a list of field names (e.g. "CoverPhotoBaseUrl")
  204. // to unconditionally include in API requests. By default, fields with
  205. // empty values are omitted from API requests. However, any non-pointer,
  206. // non-interface field appearing in ForceSendFields will be sent to the
  207. // server regardless of whether the field is empty or not. This may be
  208. // used to include empty fields in Patch requests.
  209. ForceSendFields []string `json:"-"`
  210. // NullFields is a list of field names (e.g. "CoverPhotoBaseUrl") to
  211. // include in API requests with the JSON null value. By default, fields
  212. // with empty values are omitted from API requests. However, any field
  213. // with an empty value appearing in NullFields will be sent to the
  214. // server as null. It is an error if a field in this list has a
  215. // non-empty value. This may be used to include null fields in Patch
  216. // requests.
  217. NullFields []string `json:"-"`
  218. }
  219. func (s *Album) MarshalJSON() ([]byte, error) {
  220. type NoMethod Album
  221. raw := NoMethod(*s)
  222. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  223. }
  224. // AlbumPosition: Specifies a position in an album.
  225. type AlbumPosition struct {
  226. // Position: Type of position, for a media or enrichment item.
  227. //
  228. // Possible values:
  229. // "POSITION_TYPE_UNSPECIFIED" - Default value if this enum is not
  230. // set.
  231. // "FIRST_IN_ALBUM" - At the beginning of the album.
  232. // "LAST_IN_ALBUM" - At the end of the album.
  233. // "AFTER_MEDIA_ITEM" - After a media item.
  234. // "AFTER_ENRICHMENT_ITEM" - After an enrichment item.
  235. Position string `json:"position,omitempty"`
  236. // RelativeEnrichmentItemId: The enrichment item to which the position
  237. // is relative to.
  238. // Only used when position type is AFTER_ENRICHMENT_ITEM.
  239. RelativeEnrichmentItemId string `json:"relativeEnrichmentItemId,omitempty"`
  240. // RelativeMediaItemId: The media item to which the position is relative
  241. // to.
  242. // Only used when position type is AFTER_MEDIA_ITEM.
  243. RelativeMediaItemId string `json:"relativeMediaItemId,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "Position") to
  245. // unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "Position") to include in
  252. // API requests with the JSON null value. By default, fields with empty
  253. // values are omitted from API requests. However, any field with an
  254. // empty value appearing in NullFields will be sent to the server as
  255. // null. It is an error if a field in this list has a non-empty value.
  256. // This may be used to include null fields in Patch requests.
  257. NullFields []string `json:"-"`
  258. }
  259. func (s *AlbumPosition) MarshalJSON() ([]byte, error) {
  260. type NoMethod AlbumPosition
  261. raw := NoMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  263. }
  264. // BatchCreateMediaItemsRequest: Request to create one or more media
  265. // items in a user's Google Photos library.
  266. // If an <code>albumid</code> is specified, the media items are also
  267. // added to
  268. // that album. <code>albumPosition</code> is optional and can only be
  269. // specified
  270. // if an <code>albumId</code> is set.
  271. type BatchCreateMediaItemsRequest struct {
  272. // AlbumId: Identifier of the album where the media item(s) will be
  273. // added. They will
  274. // also be added to the user's library. This is an optional field.
  275. AlbumId string `json:"albumId,omitempty"`
  276. // AlbumPosition: Position in the album where the media item(s) will be
  277. // added. If not
  278. // specified, the media item(s) will be added to the end of the album
  279. // (as per
  280. // the default value which is LAST_IN_ALBUM).
  281. // The request will fail if this field is present but no album_id
  282. // is
  283. // specified.
  284. AlbumPosition *AlbumPosition `json:"albumPosition,omitempty"`
  285. // NewMediaItems: List of media items to be created.
  286. NewMediaItems []*NewMediaItem `json:"newMediaItems,omitempty"`
  287. // ForceSendFields is a list of field names (e.g. "AlbumId") to
  288. // unconditionally include in API requests. By default, fields with
  289. // empty values are omitted from API requests. However, any non-pointer,
  290. // non-interface field appearing in ForceSendFields will be sent to the
  291. // server regardless of whether the field is empty or not. This may be
  292. // used to include empty fields in Patch requests.
  293. ForceSendFields []string `json:"-"`
  294. // NullFields is a list of field names (e.g. "AlbumId") to include in
  295. // API requests with the JSON null value. By default, fields with empty
  296. // values are omitted from API requests. However, any field with an
  297. // empty value appearing in NullFields will be sent to the server as
  298. // null. It is an error if a field in this list has a non-empty value.
  299. // This may be used to include null fields in Patch requests.
  300. NullFields []string `json:"-"`
  301. }
  302. func (s *BatchCreateMediaItemsRequest) MarshalJSON() ([]byte, error) {
  303. type NoMethod BatchCreateMediaItemsRequest
  304. raw := NoMethod(*s)
  305. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  306. }
  307. type BatchCreateMediaItemsResponse struct {
  308. // NewMediaItemResults: [Output only] List of media items which were
  309. // created.
  310. NewMediaItemResults []*NewMediaItemResult `json:"newMediaItemResults,omitempty"`
  311. // ServerResponse contains the HTTP response code and headers from the
  312. // server.
  313. googleapi.ServerResponse `json:"-"`
  314. // ForceSendFields is a list of field names (e.g. "NewMediaItemResults")
  315. // to unconditionally include in API requests. By default, fields with
  316. // empty values are omitted from API requests. However, any non-pointer,
  317. // non-interface field appearing in ForceSendFields will be sent to the
  318. // server regardless of whether the field is empty or not. This may be
  319. // used to include empty fields in Patch requests.
  320. ForceSendFields []string `json:"-"`
  321. // NullFields is a list of field names (e.g. "NewMediaItemResults") to
  322. // include in API requests with the JSON null value. By default, fields
  323. // with empty values are omitted from API requests. However, any field
  324. // with an empty value appearing in NullFields will be sent to the
  325. // server as null. It is an error if a field in this list has a
  326. // non-empty value. This may be used to include null fields in Patch
  327. // requests.
  328. NullFields []string `json:"-"`
  329. }
  330. func (s *BatchCreateMediaItemsResponse) MarshalJSON() ([]byte, error) {
  331. type NoMethod BatchCreateMediaItemsResponse
  332. raw := NoMethod(*s)
  333. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  334. }
  335. // ContentFilter: This filter is used to define which results to return
  336. // based on the contents
  337. // of the media item.
  338. //
  339. // It is possible to specify a list of categories to include, and/or a
  340. // list of
  341. // categories to exclude. Within each list, the categories are combined
  342. // with an
  343. // OR. For example, if the content filter looks like:
  344. //
  345. // included_content_categories: [c1, c2, c3]
  346. //
  347. // It would get media items that contain (c1 OR c2 OR c3).
  348. //
  349. // And if the content filter looks like:
  350. //
  351. // excluded_content_categories: [c1, c2, c3]
  352. //
  353. // It would get media items that contain NOT (c1 OR c2 OR c3).
  354. // You can also include some categories while excluding others, as in
  355. // this
  356. // proto:
  357. //
  358. // included_content_categories: [c1, c2],
  359. // excluded_content_category: [c3, c4]
  360. //
  361. // It would get media items that contain (c1 OR c2) AND NOT (c3 OR
  362. // c4).
  363. //
  364. // A category that appears in <code>includedContentategories</code> must
  365. // not
  366. // appear in <code>excludedContentCategories</code>.
  367. type ContentFilter struct {
  368. // ExcludedContentCategories: The set of categories that must NOT be
  369. // present in the media items in the
  370. // result. The items in the set are ORed. There is a maximum of
  371. // 10
  372. // excludedContentCategories per request.
  373. //
  374. // Possible values:
  375. // "NONE" - Default content category. This category is ignored if any
  376. // other category is
  377. // also listed.
  378. // "LANDSCAPES" - Media items containing landscapes.
  379. // "RECEIPTS" - Media items containing receipts.
  380. // "CITYSCAPES" - Media items containing cityscapes.
  381. // "LANDMARKS" - Media items containing landmarks.
  382. // "SELFIES" - Media items that are selfies.
  383. // "PEOPLE" - Media items containing people.
  384. // "PETS" - Media items containing pets.
  385. // "WEDDINGS" - Media items from weddings.
  386. // "BIRTHDAYS" - Media items from birthdays.
  387. // "DOCUMENTS" - Media items containing documents.
  388. // "TRAVEL" - Media items taken during travel.
  389. // "ANIMALS" - Media items containing animals.
  390. // "FOOD" - Media items containing food.
  391. // "SPORT" - Media items from sporting events.
  392. // "NIGHT" - Media items taken at night.
  393. // "PERFORMANCES" - Media items from performances.
  394. // "WHITEBOARDS" - Media items containing whiteboards.
  395. // "SCREENSHOTS" - Media items that are screenshots.
  396. // "UTILITY" - Media items that are considered to be 'utility.
  397. // Including, but not limited
  398. // to documents, screenshots, whiteboards etc.
  399. ExcludedContentCategories []string `json:"excludedContentCategories,omitempty"`
  400. // IncludedContentCategories: The set of categories that must be present
  401. // in the media items in the
  402. // result. The items in the set are ORed. There is a maximum of
  403. // 10
  404. // includedContentCategories per request.
  405. //
  406. // Possible values:
  407. // "NONE" - Default content category. This category is ignored if any
  408. // other category is
  409. // also listed.
  410. // "LANDSCAPES" - Media items containing landscapes.
  411. // "RECEIPTS" - Media items containing receipts.
  412. // "CITYSCAPES" - Media items containing cityscapes.
  413. // "LANDMARKS" - Media items containing landmarks.
  414. // "SELFIES" - Media items that are selfies.
  415. // "PEOPLE" - Media items containing people.
  416. // "PETS" - Media items containing pets.
  417. // "WEDDINGS" - Media items from weddings.
  418. // "BIRTHDAYS" - Media items from birthdays.
  419. // "DOCUMENTS" - Media items containing documents.
  420. // "TRAVEL" - Media items taken during travel.
  421. // "ANIMALS" - Media items containing animals.
  422. // "FOOD" - Media items containing food.
  423. // "SPORT" - Media items from sporting events.
  424. // "NIGHT" - Media items taken at night.
  425. // "PERFORMANCES" - Media items from performances.
  426. // "WHITEBOARDS" - Media items containing whiteboards.
  427. // "SCREENSHOTS" - Media items that are screenshots.
  428. // "UTILITY" - Media items that are considered to be 'utility.
  429. // Including, but not limited
  430. // to documents, screenshots, whiteboards etc.
  431. IncludedContentCategories []string `json:"includedContentCategories,omitempty"`
  432. // ForceSendFields is a list of field names (e.g.
  433. // "ExcludedContentCategories") to unconditionally include in API
  434. // requests. By default, fields with empty values are omitted from API
  435. // requests. However, any non-pointer, non-interface field appearing in
  436. // ForceSendFields will be sent to the server regardless of whether the
  437. // field is empty or not. This may be used to include empty fields in
  438. // Patch requests.
  439. ForceSendFields []string `json:"-"`
  440. // NullFields is a list of field names (e.g.
  441. // "ExcludedContentCategories") to include in API requests with the JSON
  442. // null value. By default, fields with empty values are omitted from API
  443. // requests. However, any field with an empty value appearing in
  444. // NullFields will be sent to the server as null. It is an error if a
  445. // field in this list has a non-empty value. This may be used to include
  446. // null fields in Patch requests.
  447. NullFields []string `json:"-"`
  448. }
  449. func (s *ContentFilter) MarshalJSON() ([]byte, error) {
  450. type NoMethod ContentFilter
  451. raw := NoMethod(*s)
  452. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  453. }
  454. // ContributorInfo: Information about a user who contributed the media
  455. // item. Note that this
  456. // information is only included if the album containing the media item
  457. // is
  458. // shared, was created by you and you have the sharing scope.
  459. type ContributorInfo struct {
  460. // DisplayName: Display name of the contributor.
  461. DisplayName string `json:"displayName,omitempty"`
  462. // ProfilePictureBaseUrl: URL to the profile picture of the contributor.
  463. ProfilePictureBaseUrl string `json:"profilePictureBaseUrl,omitempty"`
  464. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  465. // unconditionally include in API requests. By default, fields with
  466. // empty values are omitted from API requests. However, any non-pointer,
  467. // non-interface field appearing in ForceSendFields will be sent to the
  468. // server regardless of whether the field is empty or not. This may be
  469. // used to include empty fields in Patch requests.
  470. ForceSendFields []string `json:"-"`
  471. // NullFields is a list of field names (e.g. "DisplayName") to include
  472. // in API requests with the JSON null value. By default, fields with
  473. // empty values are omitted from API requests. However, any field with
  474. // an empty value appearing in NullFields will be sent to the server as
  475. // null. It is an error if a field in this list has a non-empty value.
  476. // This may be used to include null fields in Patch requests.
  477. NullFields []string `json:"-"`
  478. }
  479. func (s *ContributorInfo) MarshalJSON() ([]byte, error) {
  480. type NoMethod ContributorInfo
  481. raw := NoMethod(*s)
  482. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  483. }
  484. // CreateAlbumRequest: Request to create an album in Google Photos.
  485. type CreateAlbumRequest struct {
  486. // Album: The album to be created.
  487. Album *Album `json:"album,omitempty"`
  488. // ForceSendFields is a list of field names (e.g. "Album") to
  489. // unconditionally include in API requests. By default, fields with
  490. // empty values are omitted from API requests. However, any non-pointer,
  491. // non-interface field appearing in ForceSendFields will be sent to the
  492. // server regardless of whether the field is empty or not. This may be
  493. // used to include empty fields in Patch requests.
  494. ForceSendFields []string `json:"-"`
  495. // NullFields is a list of field names (e.g. "Album") to include in API
  496. // requests with the JSON null value. By default, fields with empty
  497. // values are omitted from API requests. However, any field with an
  498. // empty value appearing in NullFields will be sent to the server as
  499. // null. It is an error if a field in this list has a non-empty value.
  500. // This may be used to include null fields in Patch requests.
  501. NullFields []string `json:"-"`
  502. }
  503. func (s *CreateAlbumRequest) MarshalJSON() ([]byte, error) {
  504. type NoMethod CreateAlbumRequest
  505. raw := NoMethod(*s)
  506. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  507. }
  508. // Date: Represents a whole calendar date. The day may be 0 to represent
  509. // a year and month where the day is not significant, e.g. a whole
  510. // calendar month. The month may be 0 to represent a a day and a year
  511. // where the month is not signficant, e.g. when you want to specify the
  512. // same day in every month of a year or a specific year. The year may be
  513. // 0 to represent a month and day independent of year, e.g. anniversary
  514. // date.
  515. type Date struct {
  516. // Day: Day of month. Must be from 1 to 31 and valid for the year and
  517. // month, or 0
  518. // if specifying a year/month where the day is not significant.
  519. Day int64 `json:"day,omitempty"`
  520. // Month: Month of year. Must be from 1 to 12, or 0 if specifying a date
  521. // without a
  522. // month.
  523. Month int64 `json:"month,omitempty"`
  524. // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date
  525. // without
  526. // a year.
  527. Year int64 `json:"year,omitempty"`
  528. // ForceSendFields is a list of field names (e.g. "Day") to
  529. // unconditionally include in API requests. By default, fields with
  530. // empty values are omitted from API requests. However, any non-pointer,
  531. // non-interface field appearing in ForceSendFields will be sent to the
  532. // server regardless of whether the field is empty or not. This may be
  533. // used to include empty fields in Patch requests.
  534. ForceSendFields []string `json:"-"`
  535. // NullFields is a list of field names (e.g. "Day") to include in API
  536. // requests with the JSON null value. By default, fields with empty
  537. // values are omitted from API requests. However, any field with an
  538. // empty value appearing in NullFields will be sent to the server as
  539. // null. It is an error if a field in this list has a non-empty value.
  540. // This may be used to include null fields in Patch requests.
  541. NullFields []string `json:"-"`
  542. }
  543. func (s *Date) MarshalJSON() ([]byte, error) {
  544. type NoMethod Date
  545. raw := NoMethod(*s)
  546. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  547. }
  548. // DateFilter: This filter defines the allowed dates or date ranges for
  549. // the media returned.
  550. // It is possible to pick a set of specific dates and a set of date
  551. // ranges.
  552. type DateFilter struct {
  553. // Dates: List of dates that the media items must have been created on.
  554. // There is a
  555. // maximum of 5 dates that can be included per request.
  556. Dates []*Date `json:"dates,omitempty"`
  557. // Ranges: List of dates ranges that the media items must have been
  558. // created in. There
  559. // is a maximum of 5 dates ranges that can be included per request.
  560. Ranges []*DateRange `json:"ranges,omitempty"`
  561. // ForceSendFields is a list of field names (e.g. "Dates") to
  562. // unconditionally include in API requests. By default, fields with
  563. // empty values are omitted from API requests. However, any non-pointer,
  564. // non-interface field appearing in ForceSendFields will be sent to the
  565. // server regardless of whether the field is empty or not. This may be
  566. // used to include empty fields in Patch requests.
  567. ForceSendFields []string `json:"-"`
  568. // NullFields is a list of field names (e.g. "Dates") to include in API
  569. // requests with the JSON null value. By default, fields with empty
  570. // values are omitted from API requests. However, any field with an
  571. // empty value appearing in NullFields will be sent to the server as
  572. // null. It is an error if a field in this list has a non-empty value.
  573. // This may be used to include null fields in Patch requests.
  574. NullFields []string `json:"-"`
  575. }
  576. func (s *DateFilter) MarshalJSON() ([]byte, error) {
  577. type NoMethod DateFilter
  578. raw := NoMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  580. }
  581. // DateRange: Defines a range of dates. Both dates must be of the same
  582. // format (see Date
  583. // definition for more).
  584. type DateRange struct {
  585. // EndDate: The end date (included as part of the range) in the same
  586. // format as the
  587. // start date.
  588. EndDate *Date `json:"endDate,omitempty"`
  589. // StartDate: The start date (included as part of the range) in one of
  590. // the formats
  591. // described.
  592. StartDate *Date `json:"startDate,omitempty"`
  593. // ForceSendFields is a list of field names (e.g. "EndDate") to
  594. // unconditionally include in API requests. By default, fields with
  595. // empty values are omitted from API requests. However, any non-pointer,
  596. // non-interface field appearing in ForceSendFields will be sent to the
  597. // server regardless of whether the field is empty or not. This may be
  598. // used to include empty fields in Patch requests.
  599. ForceSendFields []string `json:"-"`
  600. // NullFields is a list of field names (e.g. "EndDate") to include in
  601. // API requests with the JSON null value. By default, fields with empty
  602. // values are omitted from API requests. However, any field with an
  603. // empty value appearing in NullFields will be sent to the server as
  604. // null. It is an error if a field in this list has a non-empty value.
  605. // This may be used to include null fields in Patch requests.
  606. NullFields []string `json:"-"`
  607. }
  608. func (s *DateRange) MarshalJSON() ([]byte, error) {
  609. type NoMethod DateRange
  610. raw := NoMethod(*s)
  611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  612. }
  613. // EnrichmentItem: An enrichment item.
  614. type EnrichmentItem struct {
  615. // Id: Identifier of the enrichment item.
  616. Id string `json:"id,omitempty"`
  617. // ForceSendFields is a list of field names (e.g. "Id") to
  618. // unconditionally include in API requests. By default, fields with
  619. // empty values are omitted from API requests. However, any non-pointer,
  620. // non-interface field appearing in ForceSendFields will be sent to the
  621. // server regardless of whether the field is empty or not. This may be
  622. // used to include empty fields in Patch requests.
  623. ForceSendFields []string `json:"-"`
  624. // NullFields is a list of field names (e.g. "Id") to include in API
  625. // requests with the JSON null value. By default, fields with empty
  626. // values are omitted from API requests. However, any field with an
  627. // empty value appearing in NullFields will be sent to the server as
  628. // null. It is an error if a field in this list has a non-empty value.
  629. // This may be used to include null fields in Patch requests.
  630. NullFields []string `json:"-"`
  631. }
  632. func (s *EnrichmentItem) MarshalJSON() ([]byte, error) {
  633. type NoMethod EnrichmentItem
  634. raw := NoMethod(*s)
  635. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  636. }
  637. // Filters: Filters that can be applied to a media item search.
  638. // If multiple filter options are specified, they are treated as AND
  639. // with each
  640. // other.
  641. type Filters struct {
  642. // ContentFilter: Filters the media items based on their content.
  643. ContentFilter *ContentFilter `json:"contentFilter,omitempty"`
  644. // DateFilter: Filters the media items based on their creation date.
  645. DateFilter *DateFilter `json:"dateFilter,omitempty"`
  646. // IncludeArchivedMedia: If set, the results will include media items
  647. // that the user has archived.
  648. // Defaults to false (archived media items are not included).
  649. IncludeArchivedMedia bool `json:"includeArchivedMedia,omitempty"`
  650. // MediaTypeFilter: Filters the media items based on the type of media.
  651. MediaTypeFilter *MediaTypeFilter `json:"mediaTypeFilter,omitempty"`
  652. // ForceSendFields is a list of field names (e.g. "ContentFilter") to
  653. // unconditionally include in API requests. By default, fields with
  654. // empty values are omitted from API requests. However, any non-pointer,
  655. // non-interface field appearing in ForceSendFields will be sent to the
  656. // server regardless of whether the field is empty or not. This may be
  657. // used to include empty fields in Patch requests.
  658. ForceSendFields []string `json:"-"`
  659. // NullFields is a list of field names (e.g. "ContentFilter") to include
  660. // in API requests with the JSON null value. By default, fields with
  661. // empty values are omitted from API requests. However, any field with
  662. // an empty value appearing in NullFields will be sent to the server as
  663. // null. It is an error if a field in this list has a non-empty value.
  664. // This may be used to include null fields in Patch requests.
  665. NullFields []string `json:"-"`
  666. }
  667. func (s *Filters) MarshalJSON() ([]byte, error) {
  668. type NoMethod Filters
  669. raw := NoMethod(*s)
  670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  671. }
  672. // JoinSharedAlbumRequest: Request to join a shared album on behalf of
  673. // the user. This uses a shareToken
  674. // which can be acquired via the shareAlbum or listSharedAlbums calls.
  675. type JoinSharedAlbumRequest struct {
  676. // ShareToken: Token indicating the shared album to join on behalf of
  677. // the user.
  678. ShareToken string `json:"shareToken,omitempty"`
  679. // ForceSendFields is a list of field names (e.g. "ShareToken") to
  680. // unconditionally include in API requests. By default, fields with
  681. // empty values are omitted from API requests. However, any non-pointer,
  682. // non-interface field appearing in ForceSendFields will be sent to the
  683. // server regardless of whether the field is empty or not. This may be
  684. // used to include empty fields in Patch requests.
  685. ForceSendFields []string `json:"-"`
  686. // NullFields is a list of field names (e.g. "ShareToken") to include in
  687. // API requests with the JSON null value. By default, fields with empty
  688. // values are omitted from API requests. However, any field with an
  689. // empty value appearing in NullFields will be sent to the server as
  690. // null. It is an error if a field in this list has a non-empty value.
  691. // This may be used to include null fields in Patch requests.
  692. NullFields []string `json:"-"`
  693. }
  694. func (s *JoinSharedAlbumRequest) MarshalJSON() ([]byte, error) {
  695. type NoMethod JoinSharedAlbumRequest
  696. raw := NoMethod(*s)
  697. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  698. }
  699. // JoinSharedAlbumResponse: Response to successfully joining the shared
  700. // album on behalf of the user.
  701. type JoinSharedAlbumResponse struct {
  702. // ServerResponse contains the HTTP response code and headers from the
  703. // server.
  704. googleapi.ServerResponse `json:"-"`
  705. }
  706. // LatLng: An object representing a latitude/longitude pair. This is
  707. // expressed as a pair
  708. // of doubles representing degrees latitude and degrees longitude.
  709. // Unless
  710. // specified otherwise, this must conform to the
  711. // <a
  712. // href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
  713. // st
  714. // andard</a>. Values must be within normalized ranges.
  715. type LatLng struct {
  716. // Latitude: The latitude in degrees. It must be in the range [-90.0,
  717. // +90.0].
  718. Latitude float64 `json:"latitude,omitempty"`
  719. // Longitude: The longitude in degrees. It must be in the range [-180.0,
  720. // +180.0].
  721. Longitude float64 `json:"longitude,omitempty"`
  722. // ForceSendFields is a list of field names (e.g. "Latitude") to
  723. // unconditionally include in API requests. By default, fields with
  724. // empty values are omitted from API requests. However, any non-pointer,
  725. // non-interface field appearing in ForceSendFields will be sent to the
  726. // server regardless of whether the field is empty or not. This may be
  727. // used to include empty fields in Patch requests.
  728. ForceSendFields []string `json:"-"`
  729. // NullFields is a list of field names (e.g. "Latitude") to include in
  730. // API requests with the JSON null value. By default, fields with empty
  731. // values are omitted from API requests. However, any field with an
  732. // empty value appearing in NullFields will be sent to the server as
  733. // null. It is an error if a field in this list has a non-empty value.
  734. // This may be used to include null fields in Patch requests.
  735. NullFields []string `json:"-"`
  736. }
  737. func (s *LatLng) MarshalJSON() ([]byte, error) {
  738. type NoMethod LatLng
  739. raw := NoMethod(*s)
  740. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  741. }
  742. func (s *LatLng) UnmarshalJSON(data []byte) error {
  743. type NoMethod LatLng
  744. var s1 struct {
  745. Latitude gensupport.JSONFloat64 `json:"latitude"`
  746. Longitude gensupport.JSONFloat64 `json:"longitude"`
  747. *NoMethod
  748. }
  749. s1.NoMethod = (*NoMethod)(s)
  750. if err := json.Unmarshal(data, &s1); err != nil {
  751. return err
  752. }
  753. s.Latitude = float64(s1.Latitude)
  754. s.Longitude = float64(s1.Longitude)
  755. return nil
  756. }
  757. type ListAlbumsResponse struct {
  758. // Albums: [Output only] List of albums that were created by the user.
  759. Albums []*Album `json:"albums,omitempty"`
  760. // NextPageToken: [Output only] Token to use to get the next set of
  761. // albums. Populated if
  762. // there are more albums to retrieve for this request.
  763. NextPageToken string `json:"nextPageToken,omitempty"`
  764. // ServerResponse contains the HTTP response code and headers from the
  765. // server.
  766. googleapi.ServerResponse `json:"-"`
  767. // ForceSendFields is a list of field names (e.g. "Albums") to
  768. // unconditionally include in API requests. By default, fields with
  769. // empty values are omitted from API requests. However, any non-pointer,
  770. // non-interface field appearing in ForceSendFields will be sent to the
  771. // server regardless of whether the field is empty or not. This may be
  772. // used to include empty fields in Patch requests.
  773. ForceSendFields []string `json:"-"`
  774. // NullFields is a list of field names (e.g. "Albums") to include in API
  775. // requests with the JSON null value. By default, fields with empty
  776. // values are omitted from API requests. However, any field with an
  777. // empty value appearing in NullFields will be sent to the server as
  778. // null. It is an error if a field in this list has a non-empty value.
  779. // This may be used to include null fields in Patch requests.
  780. NullFields []string `json:"-"`
  781. }
  782. func (s *ListAlbumsResponse) MarshalJSON() ([]byte, error) {
  783. type NoMethod ListAlbumsResponse
  784. raw := NoMethod(*s)
  785. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  786. }
  787. type ListSharedAlbumsResponse struct {
  788. // NextPageToken: [Output only] Token to use to get the next set of
  789. // shared albums. Populated
  790. // if there are more shared albums to retrieve for this request.
  791. NextPageToken string `json:"nextPageToken,omitempty"`
  792. // SharedAlbums: [Output only] List of shared albums that were
  793. // requested.
  794. SharedAlbums []*Album `json:"sharedAlbums,omitempty"`
  795. // ServerResponse contains the HTTP response code and headers from the
  796. // server.
  797. googleapi.ServerResponse `json:"-"`
  798. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  799. // unconditionally include in API requests. By default, fields with
  800. // empty values are omitted from API requests. However, any non-pointer,
  801. // non-interface field appearing in ForceSendFields will be sent to the
  802. // server regardless of whether the field is empty or not. This may be
  803. // used to include empty fields in Patch requests.
  804. ForceSendFields []string `json:"-"`
  805. // NullFields is a list of field names (e.g. "NextPageToken") to include
  806. // in API requests with the JSON null value. By default, fields with
  807. // empty values are omitted from API requests. However, any field with
  808. // an empty value appearing in NullFields will be sent to the server as
  809. // null. It is an error if a field in this list has a non-empty value.
  810. // This may be used to include null fields in Patch requests.
  811. NullFields []string `json:"-"`
  812. }
  813. func (s *ListSharedAlbumsResponse) MarshalJSON() ([]byte, error) {
  814. type NoMethod ListSharedAlbumsResponse
  815. raw := NoMethod(*s)
  816. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  817. }
  818. // Location: Represents a physical location.
  819. type Location struct {
  820. // Latlng: Position of the location on the map.
  821. Latlng *LatLng `json:"latlng,omitempty"`
  822. // LocationName: Name of the location to be displayed.
  823. LocationName string `json:"locationName,omitempty"`
  824. // ForceSendFields is a list of field names (e.g. "Latlng") to
  825. // unconditionally include in API requests. By default, fields with
  826. // empty values are omitted from API requests. However, any non-pointer,
  827. // non-interface field appearing in ForceSendFields will be sent to the
  828. // server regardless of whether the field is empty or not. This may be
  829. // used to include empty fields in Patch requests.
  830. ForceSendFields []string `json:"-"`
  831. // NullFields is a list of field names (e.g. "Latlng") to include in API
  832. // requests with the JSON null value. By default, fields with empty
  833. // values are omitted from API requests. However, any field with an
  834. // empty value appearing in NullFields will be sent to the server as
  835. // null. It is an error if a field in this list has a non-empty value.
  836. // This may be used to include null fields in Patch requests.
  837. NullFields []string `json:"-"`
  838. }
  839. func (s *Location) MarshalJSON() ([]byte, error) {
  840. type NoMethod Location
  841. raw := NoMethod(*s)
  842. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  843. }
  844. // LocationEnrichment: An enrichment containing a single location.
  845. type LocationEnrichment struct {
  846. // Location: Location for this enrichment item.
  847. Location *Location `json:"location,omitempty"`
  848. // ForceSendFields is a list of field names (e.g. "Location") to
  849. // unconditionally include in API requests. By default, fields with
  850. // empty values are omitted from API requests. However, any non-pointer,
  851. // non-interface field appearing in ForceSendFields will be sent to the
  852. // server regardless of whether the field is empty or not. This may be
  853. // used to include empty fields in Patch requests.
  854. ForceSendFields []string `json:"-"`
  855. // NullFields is a list of field names (e.g. "Location") to include in
  856. // API requests with the JSON null value. By default, fields with empty
  857. // values are omitted from API requests. However, any field with an
  858. // empty value appearing in NullFields will be sent to the server as
  859. // null. It is an error if a field in this list has a non-empty value.
  860. // This may be used to include null fields in Patch requests.
  861. NullFields []string `json:"-"`
  862. }
  863. func (s *LocationEnrichment) MarshalJSON() ([]byte, error) {
  864. type NoMethod LocationEnrichment
  865. raw := NoMethod(*s)
  866. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  867. }
  868. // MapEnrichment: An enrichment containing a map, showing origin and
  869. // destination locations.
  870. type MapEnrichment struct {
  871. // Destination: Destination location for this enrichemt item.
  872. Destination *Location `json:"destination,omitempty"`
  873. // Origin: Origin location for this enrichment item.
  874. Origin *Location `json:"origin,omitempty"`
  875. // ForceSendFields is a list of field names (e.g. "Destination") to
  876. // unconditionally include in API requests. By default, fields with
  877. // empty values are omitted from API requests. However, any non-pointer,
  878. // non-interface field appearing in ForceSendFields will be sent to the
  879. // server regardless of whether the field is empty or not. This may be
  880. // used to include empty fields in Patch requests.
  881. ForceSendFields []string `json:"-"`
  882. // NullFields is a list of field names (e.g. "Destination") to include
  883. // in API requests with the JSON null value. By default, fields with
  884. // empty values are omitted from API requests. However, any field with
  885. // an empty value appearing in NullFields will be sent to the server as
  886. // null. It is an error if a field in this list has a non-empty value.
  887. // This may be used to include null fields in Patch requests.
  888. NullFields []string `json:"-"`
  889. }
  890. func (s *MapEnrichment) MarshalJSON() ([]byte, error) {
  891. type NoMethod MapEnrichment
  892. raw := NoMethod(*s)
  893. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  894. }
  895. // MediaItem: Representation of a media item (e.g. photo, video etc.) in
  896. // Google Photos.
  897. type MediaItem struct {
  898. // BaseUrl: A URL to the media item's bytes. This should not be used as
  899. // is.
  900. // For example, '=w2048-h1024' will set the dimensions of a media item
  901. // of type
  902. // photo to have a width of 2048 px and height of 1024 px.
  903. BaseUrl string `json:"baseUrl,omitempty"`
  904. // ContributorInfo: Information about the user who created this media
  905. // item.
  906. ContributorInfo *ContributorInfo `json:"contributorInfo,omitempty"`
  907. // Description: Description of the media item. This is shown to the user
  908. // in the item's
  909. // info section in the Google Photos app.
  910. Description string `json:"description,omitempty"`
  911. // Id: Identifier for the media item. This is a persistent identifier
  912. // that can be
  913. // used between sessions to identify this media item.
  914. Id string `json:"id,omitempty"`
  915. // MediaMetadata: Metadata related to the media item, for example the
  916. // height, width or
  917. // creation time.
  918. MediaMetadata *MediaMetadata `json:"mediaMetadata,omitempty"`
  919. // MimeType: MIME type of the media item.
  920. MimeType string `json:"mimeType,omitempty"`
  921. // ProductUrl: Google Photos URL for the media item. This link will only
  922. // be available to
  923. // the user if they're signed in.
  924. ProductUrl string `json:"productUrl,omitempty"`
  925. // ServerResponse contains the HTTP response code and headers from the
  926. // server.
  927. googleapi.ServerResponse `json:"-"`
  928. // ForceSendFields is a list of field names (e.g. "BaseUrl") to
  929. // unconditionally include in API requests. By default, fields with
  930. // empty values are omitted from API requests. However, any non-pointer,
  931. // non-interface field appearing in ForceSendFields will be sent to the
  932. // server regardless of whether the field is empty or not. This may be
  933. // used to include empty fields in Patch requests.
  934. ForceSendFields []string `json:"-"`
  935. // NullFields is a list of field names (e.g. "BaseUrl") to include in
  936. // API requests with the JSON null value. By default, fields with empty
  937. // values are omitted from API requests. However, any field with an
  938. // empty value appearing in NullFields will be sent to the server as
  939. // null. It is an error if a field in this list has a non-empty value.
  940. // This may be used to include null fields in Patch requests.
  941. NullFields []string `json:"-"`
  942. }
  943. func (s *MediaItem) MarshalJSON() ([]byte, error) {
  944. type NoMethod MediaItem
  945. raw := NoMethod(*s)
  946. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  947. }
  948. // MediaMetadata: Metadata for a media item.
  949. type MediaMetadata struct {
  950. // CreationTime: Time when the media item was first created (not when it
  951. // was uploaded to
  952. // Google Photos).
  953. CreationTime string `json:"creationTime,omitempty"`
  954. // Height: Original height (in pixels) of the media item.
  955. Height int64 `json:"height,omitempty,string"`
  956. // Photo: Metadata for a photo media type.
  957. Photo *Photo `json:"photo,omitempty"`
  958. // Video: Metadata for a video media type.
  959. Video *Video `json:"video,omitempty"`
  960. // Width: Original width (in pixels) of the media item.
  961. Width int64 `json:"width,omitempty,string"`
  962. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  963. // unconditionally include in API requests. By default, fields with
  964. // empty values are omitted from API requests. However, any non-pointer,
  965. // non-interface field appearing in ForceSendFields will be sent to the
  966. // server regardless of whether the field is empty or not. This may be
  967. // used to include empty fields in Patch requests.
  968. ForceSendFields []string `json:"-"`
  969. // NullFields is a list of field names (e.g. "CreationTime") to include
  970. // in API requests with the JSON null value. By default, fields with
  971. // empty values are omitted from API requests. However, any field with
  972. // an empty value appearing in NullFields will be sent to the server as
  973. // null. It is an error if a field in this list has a non-empty value.
  974. // This may be used to include null fields in Patch requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *MediaMetadata) MarshalJSON() ([]byte, error) {
  978. type NoMethod MediaMetadata
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // MediaTypeFilter: This filter defines the type of media items to be
  983. // returned, for example
  984. // videos or photos. All the specified media types are treated as an OR
  985. // with
  986. // each other.
  987. type MediaTypeFilter struct {
  988. // MediaTypes: The types of media items to be included. This field
  989. // should only be
  990. // populated with one media type, multiple media types will result in an
  991. // error
  992. // response.
  993. //
  994. // Possible values:
  995. // "ALL_MEDIA" - Treated as if no filters are applied. All media types
  996. // are included.
  997. // "VIDEO" - All media items that are considered videos.
  998. // This also includes movies the user has created using the Google
  999. // Photos app.
  1000. // "PHOTO" - All media items that are considered photos. This includes
  1001. // .bmp, .gif, .ico,
  1002. // .jpg (and other spellings), .tiff, .webp as well as special photo
  1003. // types
  1004. // such as iOS live photos, Android motion photos, panoramas,
  1005. // photospheres.
  1006. MediaTypes []string `json:"mediaTypes,omitempty"`
  1007. // ForceSendFields is a list of field names (e.g. "MediaTypes") to
  1008. // unconditionally include in API requests. By default, fields with
  1009. // empty values are omitted from API requests. However, any non-pointer,
  1010. // non-interface field appearing in ForceSendFields will be sent to the
  1011. // server regardless of whether the field is empty or not. This may be
  1012. // used to include empty fields in Patch requests.
  1013. ForceSendFields []string `json:"-"`
  1014. // NullFields is a list of field names (e.g. "MediaTypes") to include in
  1015. // API requests with the JSON null value. By default, fields with empty
  1016. // values are omitted from API requests. However, any field with an
  1017. // empty value appearing in NullFields will be sent to the server as
  1018. // null. It is an error if a field in this list has a non-empty value.
  1019. // This may be used to include null fields in Patch requests.
  1020. NullFields []string `json:"-"`
  1021. }
  1022. func (s *MediaTypeFilter) MarshalJSON() ([]byte, error) {
  1023. type NoMethod MediaTypeFilter
  1024. raw := NoMethod(*s)
  1025. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1026. }
  1027. // NewEnrichmentItem: A new enrichment item to be added to an album,
  1028. // used by the
  1029. // AddEnrichmentToAlbum call.
  1030. type NewEnrichmentItem struct {
  1031. // LocationEnrichment: Location to be added to the album.
  1032. LocationEnrichment *LocationEnrichment `json:"locationEnrichment,omitempty"`
  1033. // MapEnrichment: Map to be added to the album.
  1034. MapEnrichment *MapEnrichment `json:"mapEnrichment,omitempty"`
  1035. // TextEnrichment: Text to be added to the album.
  1036. TextEnrichment *TextEnrichment `json:"textEnrichment,omitempty"`
  1037. // ForceSendFields is a list of field names (e.g. "LocationEnrichment")
  1038. // to unconditionally include in API requests. By default, fields with
  1039. // empty values are omitted from API requests. However, any non-pointer,
  1040. // non-interface field appearing in ForceSendFields will be sent to the
  1041. // server regardless of whether the field is empty or not. This may be
  1042. // used to include empty fields in Patch requests.
  1043. ForceSendFields []string `json:"-"`
  1044. // NullFields is a list of field names (e.g. "LocationEnrichment") to
  1045. // include in API requests with the JSON null value. By default, fields
  1046. // with empty values are omitted from API requests. However, any field
  1047. // with an empty value appearing in NullFields will be sent to the
  1048. // server as null. It is an error if a field in this list has a
  1049. // non-empty value. This may be used to include null fields in Patch
  1050. // requests.
  1051. NullFields []string `json:"-"`
  1052. }
  1053. func (s *NewEnrichmentItem) MarshalJSON() ([]byte, error) {
  1054. type NoMethod NewEnrichmentItem
  1055. raw := NoMethod(*s)
  1056. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1057. }
  1058. // NewMediaItem: New media item that will be created in a user's Google
  1059. // Photos account.
  1060. type NewMediaItem struct {
  1061. // Description: Description of the media item. This will be shown to the
  1062. // user in the item's
  1063. // info section in the Google Photos app.
  1064. // This string should not be more than 1000 characters.
  1065. Description string `json:"description,omitempty"`
  1066. // SimpleMediaItem: A new media item that has been uploaded via the
  1067. // included uploadToken.
  1068. SimpleMediaItem *SimpleMediaItem `json:"simpleMediaItem,omitempty"`
  1069. // ForceSendFields is a list of field names (e.g. "Description") to
  1070. // unconditionally include in API requests. By default, fields with
  1071. // empty values are omitted from API requests. However, any non-pointer,
  1072. // non-interface field appearing in ForceSendFields will be sent to the
  1073. // server regardless of whether the field is empty or not. This may be
  1074. // used to include empty fields in Patch requests.
  1075. ForceSendFields []string `json:"-"`
  1076. // NullFields is a list of field names (e.g. "Description") to include
  1077. // in API requests with the JSON null value. By default, fields with
  1078. // empty values are omitted from API requests. However, any field with
  1079. // an empty value appearing in NullFields will be sent to the server as
  1080. // null. It is an error if a field in this list has a non-empty value.
  1081. // This may be used to include null fields in Patch requests.
  1082. NullFields []string `json:"-"`
  1083. }
  1084. func (s *NewMediaItem) MarshalJSON() ([]byte, error) {
  1085. type NoMethod NewMediaItem
  1086. raw := NoMethod(*s)
  1087. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1088. }
  1089. // NewMediaItemResult: Result of creating a new media item.
  1090. type NewMediaItemResult struct {
  1091. // MediaItem: Media item created with the upload token. It is populated
  1092. // if no errors
  1093. // occurred and the media item was created successfully.
  1094. MediaItem *MediaItem `json:"mediaItem,omitempty"`
  1095. // Status: If an error occurred during the creation of this media item,
  1096. // this field
  1097. // will be populated with information related to the error. Details of
  1098. // this
  1099. // status can be found down below.
  1100. Status *Status `json:"status,omitempty"`
  1101. // UploadToken: The upload token used to create this new media item.
  1102. UploadToken string `json:"uploadToken,omitempty"`
  1103. // ForceSendFields is a list of field names (e.g. "MediaItem") to
  1104. // unconditionally include in API requests. By default, fields with
  1105. // empty values are omitted from API requests. However, any non-pointer,
  1106. // non-interface field appearing in ForceSendFields will be sent to the
  1107. // server regardless of whether the field is empty or not. This may be
  1108. // used to include empty fields in Patch requests.
  1109. ForceSendFields []string `json:"-"`
  1110. // NullFields is a list of field names (e.g. "MediaItem") to include in
  1111. // API requests with the JSON null value. By default, fields with empty
  1112. // values are omitted from API requests. However, any field with an
  1113. // empty value appearing in NullFields will be sent to the server as
  1114. // null. It is an error if a field in this list has a non-empty value.
  1115. // This may be used to include null fields in Patch requests.
  1116. NullFields []string `json:"-"`
  1117. }
  1118. func (s *NewMediaItemResult) MarshalJSON() ([]byte, error) {
  1119. type NoMethod NewMediaItemResult
  1120. raw := NoMethod(*s)
  1121. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1122. }
  1123. // Photo: Metadata that is specific to a photo, for example, ISO, focal
  1124. // length and
  1125. // exposure time. Some of these fields may be null or not included.
  1126. type Photo struct {
  1127. // ApertureFNumber: Apeture f number of the photo.
  1128. ApertureFNumber float64 `json:"apertureFNumber,omitempty"`
  1129. // CameraMake: Brand of the camera which took the photo.
  1130. CameraMake string `json:"cameraMake,omitempty"`
  1131. // CameraModel: Model of the camera which took the photo.
  1132. CameraModel string `json:"cameraModel,omitempty"`
  1133. // ExposureTime: Exposure time of the photo.
  1134. ExposureTime string `json:"exposureTime,omitempty"`
  1135. // FocalLength: Focal length of the photo.
  1136. FocalLength float64 `json:"focalLength,omitempty"`
  1137. // IsoEquivalent: ISO of the photo.
  1138. IsoEquivalent int64 `json:"isoEquivalent,omitempty"`
  1139. // ForceSendFields is a list of field names (e.g. "ApertureFNumber") to
  1140. // unconditionally include in API requests. By default, fields with
  1141. // empty values are omitted from API requests. However, any non-pointer,
  1142. // non-interface field appearing in ForceSendFields will be sent to the
  1143. // server regardless of whether the field is empty or not. This may be
  1144. // used to include empty fields in Patch requests.
  1145. ForceSendFields []string `json:"-"`
  1146. // NullFields is a list of field names (e.g. "ApertureFNumber") to
  1147. // include in API requests with the JSON null value. By default, fields
  1148. // with empty values are omitted from API requests. However, any field
  1149. // with an empty value appearing in NullFields will be sent to the
  1150. // server as null. It is an error if a field in this list has a
  1151. // non-empty value. This may be used to include null fields in Patch
  1152. // requests.
  1153. NullFields []string `json:"-"`
  1154. }
  1155. func (s *Photo) MarshalJSON() ([]byte, error) {
  1156. type NoMethod Photo
  1157. raw := NoMethod(*s)
  1158. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1159. }
  1160. func (s *Photo) UnmarshalJSON(data []byte) error {
  1161. type NoMethod Photo
  1162. var s1 struct {
  1163. ApertureFNumber gensupport.JSONFloat64 `json:"apertureFNumber"`
  1164. FocalLength gensupport.JSONFloat64 `json:"focalLength"`
  1165. *NoMethod
  1166. }
  1167. s1.NoMethod = (*NoMethod)(s)
  1168. if err := json.Unmarshal(data, &s1); err != nil {
  1169. return err
  1170. }
  1171. s.ApertureFNumber = float64(s1.ApertureFNumber)
  1172. s.FocalLength = float64(s1.FocalLength)
  1173. return nil
  1174. }
  1175. // SearchMediaItemsRequest: Request to search for media items in a
  1176. // user's library.
  1177. //
  1178. // If the album id is specified, this call will return the list of media
  1179. // items
  1180. // in the album. If neither filters nor album id are
  1181. // specified, this call will return all media items in a user's Google
  1182. // Photos
  1183. // library.
  1184. //
  1185. // If filters are specified, this call will return all media items
  1186. // in
  1187. // the user's library which fulfills the criteria based upon the
  1188. // filters.
  1189. //
  1190. // Filters and album id must not both be set, as this will result in
  1191. // an
  1192. // invalid request.
  1193. type SearchMediaItemsRequest struct {
  1194. // AlbumId: Identifier of an album. If populated will list all media
  1195. // items in
  1196. // specified album. Cannot be set in conjunction with any filters.
  1197. AlbumId string `json:"albumId,omitempty"`
  1198. // Filters: Filters to apply to the request. Cannot be set in conjuction
  1199. // with an
  1200. // albumId.
  1201. Filters *Filters `json:"filters,omitempty"`
  1202. // PageSize: Maximum number of media items to return in the response.
  1203. // The default number
  1204. // of media items to return at a time is 100. The maximum page size is
  1205. // 500.
  1206. PageSize int64 `json:"pageSize,omitempty"`
  1207. // PageToken: A continuation token to get the next page of the results.
  1208. // Adding this to
  1209. // the request will return the rows after the pageToken. The pageToken
  1210. // should
  1211. // be the value returned in the nextPageToken parameter in the response
  1212. // to the
  1213. // searchMediaItems request.
  1214. PageToken string `json:"pageToken,omitempty"`
  1215. // ForceSendFields is a list of field names (e.g. "AlbumId") to
  1216. // unconditionally include in API requests. By default, fields with
  1217. // empty values are omitted from API requests. However, any non-pointer,
  1218. // non-interface field appearing in ForceSendFields will be sent to the
  1219. // server regardless of whether the field is empty or not. This may be
  1220. // used to include empty fields in Patch requests.
  1221. ForceSendFields []string `json:"-"`
  1222. // NullFields is a list of field names (e.g. "AlbumId") to include in
  1223. // API requests with the JSON null value. By default, fields with empty
  1224. // values are omitted from API requests. However, any field with an
  1225. // empty value appearing in NullFields will be sent to the server as
  1226. // null. It is an error if a field in this list has a non-empty value.
  1227. // This may be used to include null fields in Patch requests.
  1228. NullFields []string `json:"-"`
  1229. }
  1230. func (s *SearchMediaItemsRequest) MarshalJSON() ([]byte, error) {
  1231. type NoMethod SearchMediaItemsRequest
  1232. raw := NoMethod(*s)
  1233. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1234. }
  1235. type SearchMediaItemsResponse struct {
  1236. // MediaItems: [Output only] List of media items that match the search
  1237. // parameters.
  1238. MediaItems []*MediaItem `json:"mediaItems,omitempty"`
  1239. // NextPageToken: [Output only] Token to use to get the next set of
  1240. // media items. Its presence
  1241. // is the only reliable indicator of more media items being available in
  1242. // the
  1243. // next request.
  1244. NextPageToken string `json:"nextPageToken,omitempty"`
  1245. // ServerResponse contains the HTTP response code and headers from the
  1246. // server.
  1247. googleapi.ServerResponse `json:"-"`
  1248. // ForceSendFields is a list of field names (e.g. "MediaItems") to
  1249. // unconditionally include in API requests. By default, fields with
  1250. // empty values are omitted from API requests. However, any non-pointer,
  1251. // non-interface field appearing in ForceSendFields will be sent to the
  1252. // server regardless of whether the field is empty or not. This may be
  1253. // used to include empty fields in Patch requests.
  1254. ForceSendFields []string `json:"-"`
  1255. // NullFields is a list of field names (e.g. "MediaItems") to include in
  1256. // API requests with the JSON null value. By default, fields with empty
  1257. // values are omitted from API requests. However, any field with an
  1258. // empty value appearing in NullFields will be sent to the server as
  1259. // null. It is an error if a field in this list has a non-empty value.
  1260. // This may be used to include null fields in Patch requests.
  1261. NullFields []string `json:"-"`
  1262. }
  1263. func (s *SearchMediaItemsResponse) MarshalJSON() ([]byte, error) {
  1264. type NoMethod SearchMediaItemsResponse
  1265. raw := NoMethod(*s)
  1266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1267. }
  1268. // ShareAlbumRequest: Request to make an album shared in Google Photos.
  1269. type ShareAlbumRequest struct {
  1270. // SharedAlbumOptions: Options to be set when converting the album to a
  1271. // shared album.
  1272. SharedAlbumOptions *SharedAlbumOptions `json:"sharedAlbumOptions,omitempty"`
  1273. // ForceSendFields is a list of field names (e.g. "SharedAlbumOptions")
  1274. // to unconditionally include in API requests. By default, fields with
  1275. // empty values are omitted from API requests. However, any non-pointer,
  1276. // non-interface field appearing in ForceSendFields will be sent to the
  1277. // server regardless of whether the field is empty or not. This may be
  1278. // used to include empty fields in Patch requests.
  1279. ForceSendFields []string `json:"-"`
  1280. // NullFields is a list of field names (e.g. "SharedAlbumOptions") to
  1281. // include in API requests with the JSON null value. By default, fields
  1282. // with empty values are omitted from API requests. However, any field
  1283. // with an empty value appearing in NullFields will be sent to the
  1284. // server as null. It is an error if a field in this list has a
  1285. // non-empty value. This may be used to include null fields in Patch
  1286. // requests.
  1287. NullFields []string `json:"-"`
  1288. }
  1289. func (s *ShareAlbumRequest) MarshalJSON() ([]byte, error) {
  1290. type NoMethod ShareAlbumRequest
  1291. raw := NoMethod(*s)
  1292. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1293. }
  1294. type ShareAlbumResponse struct {
  1295. // ShareInfo: [Output only] Information about the shared album.
  1296. ShareInfo *ShareInfo `json:"shareInfo,omitempty"`
  1297. // ServerResponse contains the HTTP response code and headers from the
  1298. // server.
  1299. googleapi.ServerResponse `json:"-"`
  1300. // ForceSendFields is a list of field names (e.g. "ShareInfo") to
  1301. // unconditionally include in API requests. By default, fields with
  1302. // empty values are omitted from API requests. However, any non-pointer,
  1303. // non-interface field appearing in ForceSendFields will be sent to the
  1304. // server regardless of whether the field is empty or not. This may be
  1305. // used to include empty fields in Patch requests.
  1306. ForceSendFields []string `json:"-"`
  1307. // NullFields is a list of field names (e.g. "ShareInfo") to include in
  1308. // API requests with the JSON null value. By default, fields with empty
  1309. // values are omitted from API requests. However, any field with an
  1310. // empty value appearing in NullFields will be sent to the server as
  1311. // null. It is an error if a field in this list has a non-empty value.
  1312. // This may be used to include null fields in Patch requests.
  1313. NullFields []string `json:"-"`
  1314. }
  1315. func (s *ShareAlbumResponse) MarshalJSON() ([]byte, error) {
  1316. type NoMethod ShareAlbumResponse
  1317. raw := NoMethod(*s)
  1318. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1319. }
  1320. // ShareInfo: Information about albums that are shared. Note that
  1321. // this
  1322. // information is only included if the album was created by you and you
  1323. // have the
  1324. // sharing scope.
  1325. type ShareInfo struct {
  1326. // ShareToken: A token which can be used to join this shared album on
  1327. // behalf of other
  1328. // users via the API.
  1329. ShareToken string `json:"shareToken,omitempty"`
  1330. // ShareableUrl: A link to the album that's now shared on the Google
  1331. // Photos website and app.
  1332. // Anyone with the link can access this shared album and see all of the
  1333. // items
  1334. // present in the album.
  1335. ShareableUrl string `json:"shareableUrl,omitempty"`
  1336. // SharedAlbumOptions: Options set for the shared album.
  1337. SharedAlbumOptions *SharedAlbumOptions `json:"sharedAlbumOptions,omitempty"`
  1338. // ForceSendFields is a list of field names (e.g. "ShareToken") to
  1339. // unconditionally include in API requests. By default, fields with
  1340. // empty values are omitted from API requests. However, any non-pointer,
  1341. // non-interface field appearing in ForceSendFields will be sent to the
  1342. // server regardless of whether the field is empty or not. This may be
  1343. // used to include empty fields in Patch requests.
  1344. ForceSendFields []string `json:"-"`
  1345. // NullFields is a list of field names (e.g. "ShareToken") to include in
  1346. // API requests with the JSON null value. By default, fields with empty
  1347. // values are omitted from API requests. However, any field with an
  1348. // empty value appearing in NullFields will be sent to the server as
  1349. // null. It is an error if a field in this list has a non-empty value.
  1350. // This may be used to include null fields in Patch requests.
  1351. NullFields []string `json:"-"`
  1352. }
  1353. func (s *ShareInfo) MarshalJSON() ([]byte, error) {
  1354. type NoMethod ShareInfo
  1355. raw := NoMethod(*s)
  1356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1357. }
  1358. // SharedAlbumOptions: Options that control the sharing of an album.
  1359. type SharedAlbumOptions struct {
  1360. // IsCollaborative: True if the shared album allows collaborators (users
  1361. // who have joined
  1362. // the album) to add media items to it. Defaults to false.
  1363. IsCollaborative bool `json:"isCollaborative,omitempty"`
  1364. // IsCommentable: True if the shared album allows the owner and the
  1365. // collaborators (users
  1366. // who have joined the album) to add comments to the album. Defaults to
  1367. // false.
  1368. IsCommentable bool `json:"isCommentable,omitempty"`
  1369. // ForceSendFields is a list of field names (e.g. "IsCollaborative") to
  1370. // unconditionally include in API requests. By default, fields with
  1371. // empty values are omitted from API requests. However, any non-pointer,
  1372. // non-interface field appearing in ForceSendFields will be sent to the
  1373. // server regardless of whether the field is empty or not. This may be
  1374. // used to include empty fields in Patch requests.
  1375. ForceSendFields []string `json:"-"`
  1376. // NullFields is a list of field names (e.g. "IsCollaborative") to
  1377. // include in API requests with the JSON null value. By default, fields
  1378. // with empty values are omitted from API requests. However, any field
  1379. // with an empty value appearing in NullFields will be sent to the
  1380. // server as null. It is an error if a field in this list has a
  1381. // non-empty value. This may be used to include null fields in Patch
  1382. // requests.
  1383. NullFields []string `json:"-"`
  1384. }
  1385. func (s *SharedAlbumOptions) MarshalJSON() ([]byte, error) {
  1386. type NoMethod SharedAlbumOptions
  1387. raw := NoMethod(*s)
  1388. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1389. }
  1390. // SimpleMediaItem: A simple media item to be created in Google Photos
  1391. // via an upload token.
  1392. type SimpleMediaItem struct {
  1393. // UploadToken: Token identifying the media bytes which have been
  1394. // uploaded to Google.
  1395. UploadToken string `json:"uploadToken,omitempty"`
  1396. // ForceSendFields is a list of field names (e.g. "UploadToken") to
  1397. // unconditionally include in API requests. By default, fields with
  1398. // empty values are omitted from API requests. However, any non-pointer,
  1399. // non-interface field appearing in ForceSendFields will be sent to the
  1400. // server regardless of whether the field is empty or not. This may be
  1401. // used to include empty fields in Patch requests.
  1402. ForceSendFields []string `json:"-"`
  1403. // NullFields is a list of field names (e.g. "UploadToken") to include
  1404. // in API requests with the JSON null value. By default, fields with
  1405. // empty values are omitted from API requests. However, any field with
  1406. // an empty value appearing in NullFields will be sent to the server as
  1407. // null. It is an error if a field in this list has a non-empty value.
  1408. // This may be used to include null fields in Patch requests.
  1409. NullFields []string `json:"-"`
  1410. }
  1411. func (s *SimpleMediaItem) MarshalJSON() ([]byte, error) {
  1412. type NoMethod SimpleMediaItem
  1413. raw := NoMethod(*s)
  1414. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1415. }
  1416. // Status: The `Status` type defines a logical error model that is
  1417. // suitable for different
  1418. // programming environments, including REST APIs and RPC APIs. It is
  1419. // used by
  1420. // [gRPC](https://github.com/grpc). The error model is designed to
  1421. // be:
  1422. //
  1423. // - Simple to use and understand for most users
  1424. // - Flexible enough to meet unexpected needs
  1425. //
  1426. // # Overview
  1427. //
  1428. // The `Status` message contains three pieces of data: error code, error
  1429. // message,
  1430. // and error details. The error code should be an enum value
  1431. // of
  1432. // google.rpc.Code, but it may accept additional error codes if needed.
  1433. // The
  1434. // error message should be a developer-facing English message that
  1435. // helps
  1436. // developers *understand* and *resolve* the error. If a localized
  1437. // user-facing
  1438. // error message is needed, put the localized message in the error
  1439. // details or
  1440. // localize it in the client. The optional error details may contain
  1441. // arbitrary
  1442. // information about the error. There is a predefined set of error
  1443. // detail types
  1444. // in the package `google.rpc` that can be used for common error
  1445. // conditions.
  1446. //
  1447. // # Language mapping
  1448. //
  1449. // The `Status` message is the logical representation of the error
  1450. // model, but it
  1451. // is not necessarily the actual wire format. When the `Status` message
  1452. // is
  1453. // exposed in different client libraries and different wire protocols,
  1454. // it can be
  1455. // mapped differently. For example, it will likely be mapped to some
  1456. // exceptions
  1457. // in Java, but more likely mapped to some error codes in C.
  1458. //
  1459. // # Other uses
  1460. //
  1461. // The error model and the `Status` message can be used in a variety
  1462. // of
  1463. // environments, either with or without APIs, to provide a
  1464. // consistent developer experience across different
  1465. // environments.
  1466. //
  1467. // Example uses of this error model include:
  1468. //
  1469. // - Partial errors. If a service needs to return partial errors to the
  1470. // client,
  1471. // it may embed the `Status` in the normal response to indicate the
  1472. // partial
  1473. // errors.
  1474. //
  1475. // - Workflow errors. A typical workflow has multiple steps. Each step
  1476. // may
  1477. // have a `Status` message for error reporting.
  1478. //
  1479. // - Batch operations. If a client uses batch request and batch
  1480. // response, the
  1481. // `Status` message should be used directly inside batch response,
  1482. // one for
  1483. // each error sub-response.
  1484. //
  1485. // - Asynchronous operations. If an API call embeds asynchronous
  1486. // operation
  1487. // results in its response, the status of those operations should
  1488. // be
  1489. // represented directly using the `Status` message.
  1490. //
  1491. // - Logging. If some API errors are stored in logs, the message
  1492. // `Status` could
  1493. // be used directly after any stripping needed for security/privacy
  1494. // reasons.
  1495. type Status struct {
  1496. // Code: The status code, which should be an enum value of
  1497. // google.rpc.Code.
  1498. Code int64 `json:"code,omitempty"`
  1499. // Details: A list of messages that carry the error details. There is a
  1500. // common set of
  1501. // message types for APIs to use.
  1502. Details []googleapi.RawMessage `json:"details,omitempty"`
  1503. // Message: A developer-facing error message, which should be in
  1504. // English. Any
  1505. // user-facing error message should be localized and sent in
  1506. // the
  1507. // google.rpc.Status.details field, or localized by the client.
  1508. Message string `json:"message,omitempty"`
  1509. // ForceSendFields is a list of field names (e.g. "Code") to
  1510. // unconditionally include in API requests. By default, fields with
  1511. // empty values are omitted from API requests. However, any non-pointer,
  1512. // non-interface field appearing in ForceSendFields will be sent to the
  1513. // server regardless of whether the field is empty or not. This may be
  1514. // used to include empty fields in Patch requests.
  1515. ForceSendFields []string `json:"-"`
  1516. // NullFields is a list of field names (e.g. "Code") to include in API
  1517. // requests with the JSON null value. By default, fields with empty
  1518. // values are omitted from API requests. However, any field with an
  1519. // empty value appearing in NullFields will be sent to the server as
  1520. // null. It is an error if a field in this list has a non-empty value.
  1521. // This may be used to include null fields in Patch requests.
  1522. NullFields []string `json:"-"`
  1523. }
  1524. func (s *Status) MarshalJSON() ([]byte, error) {
  1525. type NoMethod Status
  1526. raw := NoMethod(*s)
  1527. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1528. }
  1529. // TextEnrichment: An enrichment containing text.
  1530. type TextEnrichment struct {
  1531. // Text: Text for this text enrichment item.
  1532. Text string `json:"text,omitempty"`
  1533. // ForceSendFields is a list of field names (e.g. "Text") to
  1534. // unconditionally include in API requests. By default, fields with
  1535. // empty values are omitted from API requests. However, any non-pointer,
  1536. // non-interface field appearing in ForceSendFields will be sent to the
  1537. // server regardless of whether the field is empty or not. This may be
  1538. // used to include empty fields in Patch requests.
  1539. ForceSendFields []string `json:"-"`
  1540. // NullFields is a list of field names (e.g. "Text") to include in API
  1541. // requests with the JSON null value. By default, fields with empty
  1542. // values are omitted from API requests. However, any field with an
  1543. // empty value appearing in NullFields will be sent to the server as
  1544. // null. It is an error if a field in this list has a non-empty value.
  1545. // This may be used to include null fields in Patch requests.
  1546. NullFields []string `json:"-"`
  1547. }
  1548. func (s *TextEnrichment) MarshalJSON() ([]byte, error) {
  1549. type NoMethod TextEnrichment
  1550. raw := NoMethod(*s)
  1551. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1552. }
  1553. // Video: Metadata that is specific to a video, for example, fps and
  1554. // processing status.
  1555. // Some of these fields may be null or not included.
  1556. type Video struct {
  1557. // CameraMake: Brand of the camera which took the video.
  1558. CameraMake string `json:"cameraMake,omitempty"`
  1559. // CameraModel: Model of the camera which took the video.
  1560. CameraModel string `json:"cameraModel,omitempty"`
  1561. // Fps: Frame rate of the video.
  1562. Fps float64 `json:"fps,omitempty"`
  1563. // Status: Processing status of the video.
  1564. //
  1565. // Possible values:
  1566. // "UNSPECIFIED" - Video processing status is unknown.
  1567. // "PROCESSING" - Video is currently being processed. The user will
  1568. // see an icon for this
  1569. // video in the Google Photos app, however, it will not be playable yet.
  1570. // "READY" - Video is now ready for viewing.
  1571. // "FAILED" - Something has gone wrong and the video has failed to
  1572. // process.
  1573. Status string `json:"status,omitempty"`
  1574. // ForceSendFields is a list of field names (e.g. "CameraMake") to
  1575. // unconditionally include in API requests. By default, fields with
  1576. // empty values are omitted from API requests. However, any non-pointer,
  1577. // non-interface field appearing in ForceSendFields will be sent to the
  1578. // server regardless of whether the field is empty or not. This may be
  1579. // used to include empty fields in Patch requests.
  1580. ForceSendFields []string `json:"-"`
  1581. // NullFields is a list of field names (e.g. "CameraMake") to include in
  1582. // API requests with the JSON null value. By default, fields with empty
  1583. // values are omitted from API requests. However, any field with an
  1584. // empty value appearing in NullFields will be sent to the server as
  1585. // null. It is an error if a field in this list has a non-empty value.
  1586. // This may be used to include null fields in Patch requests.
  1587. NullFields []string `json:"-"`
  1588. }
  1589. func (s *Video) MarshalJSON() ([]byte, error) {
  1590. type NoMethod Video
  1591. raw := NoMethod(*s)
  1592. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1593. }
  1594. func (s *Video) UnmarshalJSON(data []byte) error {
  1595. type NoMethod Video
  1596. var s1 struct {
  1597. Fps gensupport.JSONFloat64 `json:"fps"`
  1598. *NoMethod
  1599. }
  1600. s1.NoMethod = (*NoMethod)(s)
  1601. if err := json.Unmarshal(data, &s1); err != nil {
  1602. return err
  1603. }
  1604. s.Fps = float64(s1.Fps)
  1605. return nil
  1606. }
  1607. // method id "photoslibrary.albums.addEnrichment":
  1608. type AlbumsAddEnrichmentCall struct {
  1609. s *Service
  1610. albumId string
  1611. addenrichmenttoalbumrequest *AddEnrichmentToAlbumRequest
  1612. urlParams_ gensupport.URLParams
  1613. ctx_ context.Context
  1614. header_ http.Header
  1615. }
  1616. // AddEnrichment: Adds an enrichment to a specified position in a
  1617. // defined album.
  1618. func (r *AlbumsService) AddEnrichment(albumId string, addenrichmenttoalbumrequest *AddEnrichmentToAlbumRequest) *AlbumsAddEnrichmentCall {
  1619. c := &AlbumsAddEnrichmentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1620. c.albumId = albumId
  1621. c.addenrichmenttoalbumrequest = addenrichmenttoalbumrequest
  1622. return c
  1623. }
  1624. // Fields allows partial responses to be retrieved. See
  1625. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1626. // for more information.
  1627. func (c *AlbumsAddEnrichmentCall) Fields(s ...googleapi.Field) *AlbumsAddEnrichmentCall {
  1628. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1629. return c
  1630. }
  1631. // Context sets the context to be used in this call's Do method. Any
  1632. // pending HTTP request will be aborted if the provided context is
  1633. // canceled.
  1634. func (c *AlbumsAddEnrichmentCall) Context(ctx context.Context) *AlbumsAddEnrichmentCall {
  1635. c.ctx_ = ctx
  1636. return c
  1637. }
  1638. // Header returns an http.Header that can be modified by the caller to
  1639. // add HTTP headers to the request.
  1640. func (c *AlbumsAddEnrichmentCall) Header() http.Header {
  1641. if c.header_ == nil {
  1642. c.header_ = make(http.Header)
  1643. }
  1644. return c.header_
  1645. }
  1646. func (c *AlbumsAddEnrichmentCall) doRequest(alt string) (*http.Response, error) {
  1647. reqHeaders := make(http.Header)
  1648. for k, v := range c.header_ {
  1649. reqHeaders[k] = v
  1650. }
  1651. reqHeaders.Set("User-Agent", c.s.userAgent())
  1652. var body io.Reader = nil
  1653. body, err := googleapi.WithoutDataWrapper.JSONReader(c.addenrichmenttoalbumrequest)
  1654. if err != nil {
  1655. return nil, err
  1656. }
  1657. reqHeaders.Set("Content-Type", "application/json")
  1658. c.urlParams_.Set("alt", alt)
  1659. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/albums/{+albumId}:addEnrichment")
  1660. urls += "?" + c.urlParams_.Encode()
  1661. req, _ := http.NewRequest("POST", urls, body)
  1662. req.Header = reqHeaders
  1663. googleapi.Expand(req.URL, map[string]string{
  1664. "albumId": c.albumId,
  1665. })
  1666. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1667. }
  1668. // Do executes the "photoslibrary.albums.addEnrichment" call.
  1669. // Exactly one of *AddEnrichmentToAlbumResponse or error will be
  1670. // non-nil. Any non-2xx status code is an error. Response headers are in
  1671. // either *AddEnrichmentToAlbumResponse.ServerResponse.Header or (if a
  1672. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1673. // googleapi.IsNotModified to check whether the returned error was
  1674. // because http.StatusNotModified was returned.
  1675. func (c *AlbumsAddEnrichmentCall) Do(opts ...googleapi.CallOption) (*AddEnrichmentToAlbumResponse, error) {
  1676. gensupport.SetOptions(c.urlParams_, opts...)
  1677. res, err := c.doRequest("json")
  1678. if res != nil && res.StatusCode == http.StatusNotModified {
  1679. if res.Body != nil {
  1680. res.Body.Close()
  1681. }
  1682. return nil, &googleapi.Error{
  1683. Code: res.StatusCode,
  1684. Header: res.Header,
  1685. }
  1686. }
  1687. if err != nil {
  1688. return nil, err
  1689. }
  1690. defer googleapi.CloseBody(res)
  1691. if err := googleapi.CheckResponse(res); err != nil {
  1692. return nil, err
  1693. }
  1694. ret := &AddEnrichmentToAlbumResponse{
  1695. ServerResponse: googleapi.ServerResponse{
  1696. Header: res.Header,
  1697. HTTPStatusCode: res.StatusCode,
  1698. },
  1699. }
  1700. target := &ret
  1701. if err := gensupport.DecodeResponse(target, res); err != nil {
  1702. return nil, err
  1703. }
  1704. return ret, nil
  1705. // {
  1706. // "description": "Adds an enrichment to a specified position in a defined album.",
  1707. // "flatPath": "v1/albums/{albumsId}:addEnrichment",
  1708. // "httpMethod": "POST",
  1709. // "id": "photoslibrary.albums.addEnrichment",
  1710. // "parameterOrder": [
  1711. // "albumId"
  1712. // ],
  1713. // "parameters": {
  1714. // "albumId": {
  1715. // "description": "Identifier of the album where the enrichment will be added.",
  1716. // "location": "path",
  1717. // "pattern": "^[^/]+$",
  1718. // "required": true,
  1719. // "type": "string"
  1720. // }
  1721. // },
  1722. // "path": "v1/albums/{+albumId}:addEnrichment",
  1723. // "request": {
  1724. // "$ref": "AddEnrichmentToAlbumRequest"
  1725. // },
  1726. // "response": {
  1727. // "$ref": "AddEnrichmentToAlbumResponse"
  1728. // },
  1729. // "scopes": [
  1730. // "https://www.googleapis.com/auth/photoslibrary",
  1731. // "https://www.googleapis.com/auth/photoslibrary.appendonly",
  1732. // "https://www.googleapis.com/auth/photoslibrary.sharing"
  1733. // ]
  1734. // }
  1735. }
  1736. // method id "photoslibrary.albums.create":
  1737. type AlbumsCreateCall struct {
  1738. s *Service
  1739. createalbumrequest *CreateAlbumRequest
  1740. urlParams_ gensupport.URLParams
  1741. ctx_ context.Context
  1742. header_ http.Header
  1743. }
  1744. // Create: Creates an album in a user's Google Photos library.
  1745. func (r *AlbumsService) Create(createalbumrequest *CreateAlbumRequest) *AlbumsCreateCall {
  1746. c := &AlbumsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1747. c.createalbumrequest = createalbumrequest
  1748. return c
  1749. }
  1750. // Fields allows partial responses to be retrieved. See
  1751. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1752. // for more information.
  1753. func (c *AlbumsCreateCall) Fields(s ...googleapi.Field) *AlbumsCreateCall {
  1754. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1755. return c
  1756. }
  1757. // Context sets the context to be used in this call's Do method. Any
  1758. // pending HTTP request will be aborted if the provided context is
  1759. // canceled.
  1760. func (c *AlbumsCreateCall) Context(ctx context.Context) *AlbumsCreateCall {
  1761. c.ctx_ = ctx
  1762. return c
  1763. }
  1764. // Header returns an http.Header that can be modified by the caller to
  1765. // add HTTP headers to the request.
  1766. func (c *AlbumsCreateCall) Header() http.Header {
  1767. if c.header_ == nil {
  1768. c.header_ = make(http.Header)
  1769. }
  1770. return c.header_
  1771. }
  1772. func (c *AlbumsCreateCall) doRequest(alt string) (*http.Response, error) {
  1773. reqHeaders := make(http.Header)
  1774. for k, v := range c.header_ {
  1775. reqHeaders[k] = v
  1776. }
  1777. reqHeaders.Set("User-Agent", c.s.userAgent())
  1778. var body io.Reader = nil
  1779. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createalbumrequest)
  1780. if err != nil {
  1781. return nil, err
  1782. }
  1783. reqHeaders.Set("Content-Type", "application/json")
  1784. c.urlParams_.Set("alt", alt)
  1785. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/albums")
  1786. urls += "?" + c.urlParams_.Encode()
  1787. req, _ := http.NewRequest("POST", urls, body)
  1788. req.Header = reqHeaders
  1789. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1790. }
  1791. // Do executes the "photoslibrary.albums.create" call.
  1792. // Exactly one of *Album or error will be non-nil. Any non-2xx status
  1793. // code is an error. Response headers are in either
  1794. // *Album.ServerResponse.Header or (if a response was returned at all)
  1795. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1796. // check whether the returned error was because http.StatusNotModified
  1797. // was returned.
  1798. func (c *AlbumsCreateCall) Do(opts ...googleapi.CallOption) (*Album, error) {
  1799. gensupport.SetOptions(c.urlParams_, opts...)
  1800. res, err := c.doRequest("json")
  1801. if res != nil && res.StatusCode == http.StatusNotModified {
  1802. if res.Body != nil {
  1803. res.Body.Close()
  1804. }
  1805. return nil, &googleapi.Error{
  1806. Code: res.StatusCode,
  1807. Header: res.Header,
  1808. }
  1809. }
  1810. if err != nil {
  1811. return nil, err
  1812. }
  1813. defer googleapi.CloseBody(res)
  1814. if err := googleapi.CheckResponse(res); err != nil {
  1815. return nil, err
  1816. }
  1817. ret := &Album{
  1818. ServerResponse: googleapi.ServerResponse{
  1819. Header: res.Header,
  1820. HTTPStatusCode: res.StatusCode,
  1821. },
  1822. }
  1823. target := &ret
  1824. if err := gensupport.DecodeResponse(target, res); err != nil {
  1825. return nil, err
  1826. }
  1827. return ret, nil
  1828. // {
  1829. // "description": "Creates an album in a user's Google Photos library.",
  1830. // "flatPath": "v1/albums",
  1831. // "httpMethod": "POST",
  1832. // "id": "photoslibrary.albums.create",
  1833. // "parameterOrder": [],
  1834. // "parameters": {},
  1835. // "path": "v1/albums",
  1836. // "request": {
  1837. // "$ref": "CreateAlbumRequest"
  1838. // },
  1839. // "response": {
  1840. // "$ref": "Album"
  1841. // },
  1842. // "scopes": [
  1843. // "https://www.googleapis.com/auth/photoslibrary",
  1844. // "https://www.googleapis.com/auth/photoslibrary.appendonly",
  1845. // "https://www.googleapis.com/auth/photoslibrary.sharing"
  1846. // ]
  1847. // }
  1848. }
  1849. // method id "photoslibrary.albums.get":
  1850. type AlbumsGetCall struct {
  1851. s *Service
  1852. albumId string
  1853. urlParams_ gensupport.URLParams
  1854. ifNoneMatch_ string
  1855. ctx_ context.Context
  1856. header_ http.Header
  1857. }
  1858. // Get: Returns the album specified by the given album id.
  1859. func (r *AlbumsService) Get(albumId string) *AlbumsGetCall {
  1860. c := &AlbumsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1861. c.albumId = albumId
  1862. return c
  1863. }
  1864. // Fields allows partial responses to be retrieved. See
  1865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1866. // for more information.
  1867. func (c *AlbumsGetCall) Fields(s ...googleapi.Field) *AlbumsGetCall {
  1868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1869. return c
  1870. }
  1871. // IfNoneMatch sets the optional parameter which makes the operation
  1872. // fail if the object's ETag matches the given value. This is useful for
  1873. // getting updates only after the object has changed since the last
  1874. // request. Use googleapi.IsNotModified to check whether the response
  1875. // error from Do is the result of In-None-Match.
  1876. func (c *AlbumsGetCall) IfNoneMatch(entityTag string) *AlbumsGetCall {
  1877. c.ifNoneMatch_ = entityTag
  1878. return c
  1879. }
  1880. // Context sets the context to be used in this call's Do method. Any
  1881. // pending HTTP request will be aborted if the provided context is
  1882. // canceled.
  1883. func (c *AlbumsGetCall) Context(ctx context.Context) *AlbumsGetCall {
  1884. c.ctx_ = ctx
  1885. return c
  1886. }
  1887. // Header returns an http.Header that can be modified by the caller to
  1888. // add HTTP headers to the request.
  1889. func (c *AlbumsGetCall) Header() http.Header {
  1890. if c.header_ == nil {
  1891. c.header_ = make(http.Header)
  1892. }
  1893. return c.header_
  1894. }
  1895. func (c *AlbumsGetCall) doRequest(alt string) (*http.Response, error) {
  1896. reqHeaders := make(http.Header)
  1897. for k, v := range c.header_ {
  1898. reqHeaders[k] = v
  1899. }
  1900. reqHeaders.Set("User-Agent", c.s.userAgent())
  1901. if c.ifNoneMatch_ != "" {
  1902. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1903. }
  1904. var body io.Reader = nil
  1905. c.urlParams_.Set("alt", alt)
  1906. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/albums/{+albumId}")
  1907. urls += "?" + c.urlParams_.Encode()
  1908. req, _ := http.NewRequest("GET", urls, body)
  1909. req.Header = reqHeaders
  1910. googleapi.Expand(req.URL, map[string]string{
  1911. "albumId": c.albumId,
  1912. })
  1913. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1914. }
  1915. // Do executes the "photoslibrary.albums.get" call.
  1916. // Exactly one of *Album or error will be non-nil. Any non-2xx status
  1917. // code is an error. Response headers are in either
  1918. // *Album.ServerResponse.Header or (if a response was returned at all)
  1919. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1920. // check whether the returned error was because http.StatusNotModified
  1921. // was returned.
  1922. func (c *AlbumsGetCall) Do(opts ...googleapi.CallOption) (*Album, error) {
  1923. gensupport.SetOptions(c.urlParams_, opts...)
  1924. res, err := c.doRequest("json")
  1925. if res != nil && res.StatusCode == http.StatusNotModified {
  1926. if res.Body != nil {
  1927. res.Body.Close()
  1928. }
  1929. return nil, &googleapi.Error{
  1930. Code: res.StatusCode,
  1931. Header: res.Header,
  1932. }
  1933. }
  1934. if err != nil {
  1935. return nil, err
  1936. }
  1937. defer googleapi.CloseBody(res)
  1938. if err := googleapi.CheckResponse(res); err != nil {
  1939. return nil, err
  1940. }
  1941. ret := &Album{
  1942. ServerResponse: googleapi.ServerResponse{
  1943. Header: res.Header,
  1944. HTTPStatusCode: res.StatusCode,
  1945. },
  1946. }
  1947. target := &ret
  1948. if err := gensupport.DecodeResponse(target, res); err != nil {
  1949. return nil, err
  1950. }
  1951. return ret, nil
  1952. // {
  1953. // "description": "Returns the album specified by the given album id.",
  1954. // "flatPath": "v1/albums/{albumsId}",
  1955. // "httpMethod": "GET",
  1956. // "id": "photoslibrary.albums.get",
  1957. // "parameterOrder": [
  1958. // "albumId"
  1959. // ],
  1960. // "parameters": {
  1961. // "albumId": {
  1962. // "description": "Identifier of the album to be requested.",
  1963. // "location": "path",
  1964. // "pattern": "^[^/]+$",
  1965. // "required": true,
  1966. // "type": "string"
  1967. // }
  1968. // },
  1969. // "path": "v1/albums/{+albumId}",
  1970. // "response": {
  1971. // "$ref": "Album"
  1972. // },
  1973. // "scopes": [
  1974. // "https://www.googleapis.com/auth/drive.photos.readonly",
  1975. // "https://www.googleapis.com/auth/photoslibrary",
  1976. // "https://www.googleapis.com/auth/photoslibrary.readonly",
  1977. // "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  1978. // ]
  1979. // }
  1980. }
  1981. // method id "photoslibrary.albums.list":
  1982. type AlbumsListCall struct {
  1983. s *Service
  1984. urlParams_ gensupport.URLParams
  1985. ifNoneMatch_ string
  1986. ctx_ context.Context
  1987. header_ http.Header
  1988. }
  1989. // List: Lists all albums shown to a user in the 'Albums' tab of the
  1990. // Google
  1991. // Photos app.
  1992. func (r *AlbumsService) List() *AlbumsListCall {
  1993. c := &AlbumsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1994. return c
  1995. }
  1996. // PageSize sets the optional parameter "pageSize": Maximum number of
  1997. // albums to return in the response. The default number of
  1998. // albums to return at a time is 20. The maximum page size is 50.
  1999. func (c *AlbumsListCall) PageSize(pageSize int64) *AlbumsListCall {
  2000. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2001. return c
  2002. }
  2003. // PageToken sets the optional parameter "pageToken": A continuation
  2004. // token to get the next page of the results. Adding this to
  2005. // the request will return the rows after the pageToken. The pageToken
  2006. // should
  2007. // be the value returned in the nextPageToken parameter in the response
  2008. // to the
  2009. // listAlbums request.
  2010. func (c *AlbumsListCall) PageToken(pageToken string) *AlbumsListCall {
  2011. c.urlParams_.Set("pageToken", pageToken)
  2012. return c
  2013. }
  2014. // Fields allows partial responses to be retrieved. See
  2015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2016. // for more information.
  2017. func (c *AlbumsListCall) Fields(s ...googleapi.Field) *AlbumsListCall {
  2018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2019. return c
  2020. }
  2021. // IfNoneMatch sets the optional parameter which makes the operation
  2022. // fail if the object's ETag matches the given value. This is useful for
  2023. // getting updates only after the object has changed since the last
  2024. // request. Use googleapi.IsNotModified to check whether the response
  2025. // error from Do is the result of In-None-Match.
  2026. func (c *AlbumsListCall) IfNoneMatch(entityTag string) *AlbumsListCall {
  2027. c.ifNoneMatch_ = entityTag
  2028. return c
  2029. }
  2030. // Context sets the context to be used in this call's Do method. Any
  2031. // pending HTTP request will be aborted if the provided context is
  2032. // canceled.
  2033. func (c *AlbumsListCall) Context(ctx context.Context) *AlbumsListCall {
  2034. c.ctx_ = ctx
  2035. return c
  2036. }
  2037. // Header returns an http.Header that can be modified by the caller to
  2038. // add HTTP headers to the request.
  2039. func (c *AlbumsListCall) Header() http.Header {
  2040. if c.header_ == nil {
  2041. c.header_ = make(http.Header)
  2042. }
  2043. return c.header_
  2044. }
  2045. func (c *AlbumsListCall) doRequest(alt string) (*http.Response, error) {
  2046. reqHeaders := make(http.Header)
  2047. for k, v := range c.header_ {
  2048. reqHeaders[k] = v
  2049. }
  2050. reqHeaders.Set("User-Agent", c.s.userAgent())
  2051. if c.ifNoneMatch_ != "" {
  2052. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2053. }
  2054. var body io.Reader = nil
  2055. c.urlParams_.Set("alt", alt)
  2056. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/albums")
  2057. urls += "?" + c.urlParams_.Encode()
  2058. req, _ := http.NewRequest("GET", urls, body)
  2059. req.Header = reqHeaders
  2060. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2061. }
  2062. // Do executes the "photoslibrary.albums.list" call.
  2063. // Exactly one of *ListAlbumsResponse or error will be non-nil. Any
  2064. // non-2xx status code is an error. Response headers are in either
  2065. // *ListAlbumsResponse.ServerResponse.Header or (if a response was
  2066. // returned at all) in error.(*googleapi.Error).Header. Use
  2067. // googleapi.IsNotModified to check whether the returned error was
  2068. // because http.StatusNotModified was returned.
  2069. func (c *AlbumsListCall) Do(opts ...googleapi.CallOption) (*ListAlbumsResponse, error) {
  2070. gensupport.SetOptions(c.urlParams_, opts...)
  2071. res, err := c.doRequest("json")
  2072. if res != nil && res.StatusCode == http.StatusNotModified {
  2073. if res.Body != nil {
  2074. res.Body.Close()
  2075. }
  2076. return nil, &googleapi.Error{
  2077. Code: res.StatusCode,
  2078. Header: res.Header,
  2079. }
  2080. }
  2081. if err != nil {
  2082. return nil, err
  2083. }
  2084. defer googleapi.CloseBody(res)
  2085. if err := googleapi.CheckResponse(res); err != nil {
  2086. return nil, err
  2087. }
  2088. ret := &ListAlbumsResponse{
  2089. ServerResponse: googleapi.ServerResponse{
  2090. Header: res.Header,
  2091. HTTPStatusCode: res.StatusCode,
  2092. },
  2093. }
  2094. target := &ret
  2095. if err := gensupport.DecodeResponse(target, res); err != nil {
  2096. return nil, err
  2097. }
  2098. return ret, nil
  2099. // {
  2100. // "description": "Lists all albums shown to a user in the 'Albums' tab of the Google\nPhotos app.",
  2101. // "flatPath": "v1/albums",
  2102. // "httpMethod": "GET",
  2103. // "id": "photoslibrary.albums.list",
  2104. // "parameterOrder": [],
  2105. // "parameters": {
  2106. // "pageSize": {
  2107. // "description": "Maximum number of albums to return in the response. The default number of\nalbums to return at a time is 20. The maximum page size is 50.",
  2108. // "format": "int32",
  2109. // "location": "query",
  2110. // "type": "integer"
  2111. // },
  2112. // "pageToken": {
  2113. // "description": "A continuation token to get the next page of the results. Adding this to\nthe request will return the rows after the pageToken. The pageToken should\nbe the value returned in the nextPageToken parameter in the response to the\nlistAlbums request.",
  2114. // "location": "query",
  2115. // "type": "string"
  2116. // }
  2117. // },
  2118. // "path": "v1/albums",
  2119. // "response": {
  2120. // "$ref": "ListAlbumsResponse"
  2121. // },
  2122. // "scopes": [
  2123. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2124. // "https://www.googleapis.com/auth/photoslibrary",
  2125. // "https://www.googleapis.com/auth/photoslibrary.readonly",
  2126. // "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  2127. // ]
  2128. // }
  2129. }
  2130. // Pages invokes f for each page of results.
  2131. // A non-nil error returned from f will halt the iteration.
  2132. // The provided context supersedes any context provided to the Context method.
  2133. func (c *AlbumsListCall) Pages(ctx context.Context, f func(*ListAlbumsResponse) error) error {
  2134. c.ctx_ = ctx
  2135. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2136. for {
  2137. x, err := c.Do()
  2138. if err != nil {
  2139. return err
  2140. }
  2141. if err := f(x); err != nil {
  2142. return err
  2143. }
  2144. if x.NextPageToken == "" {
  2145. return nil
  2146. }
  2147. c.PageToken(x.NextPageToken)
  2148. }
  2149. }
  2150. // method id "photoslibrary.albums.share":
  2151. type AlbumsShareCall struct {
  2152. s *Service
  2153. albumId string
  2154. sharealbumrequest *ShareAlbumRequest
  2155. urlParams_ gensupport.URLParams
  2156. ctx_ context.Context
  2157. header_ http.Header
  2158. }
  2159. // Share: Marks an album as 'shared' and accessible to other users. This
  2160. // action can
  2161. // only be performed on albums which were created by the developer via
  2162. // the
  2163. // API.
  2164. func (r *AlbumsService) Share(albumId string, sharealbumrequest *ShareAlbumRequest) *AlbumsShareCall {
  2165. c := &AlbumsShareCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2166. c.albumId = albumId
  2167. c.sharealbumrequest = sharealbumrequest
  2168. return c
  2169. }
  2170. // Fields allows partial responses to be retrieved. See
  2171. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2172. // for more information.
  2173. func (c *AlbumsShareCall) Fields(s ...googleapi.Field) *AlbumsShareCall {
  2174. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2175. return c
  2176. }
  2177. // Context sets the context to be used in this call's Do method. Any
  2178. // pending HTTP request will be aborted if the provided context is
  2179. // canceled.
  2180. func (c *AlbumsShareCall) Context(ctx context.Context) *AlbumsShareCall {
  2181. c.ctx_ = ctx
  2182. return c
  2183. }
  2184. // Header returns an http.Header that can be modified by the caller to
  2185. // add HTTP headers to the request.
  2186. func (c *AlbumsShareCall) Header() http.Header {
  2187. if c.header_ == nil {
  2188. c.header_ = make(http.Header)
  2189. }
  2190. return c.header_
  2191. }
  2192. func (c *AlbumsShareCall) doRequest(alt string) (*http.Response, error) {
  2193. reqHeaders := make(http.Header)
  2194. for k, v := range c.header_ {
  2195. reqHeaders[k] = v
  2196. }
  2197. reqHeaders.Set("User-Agent", c.s.userAgent())
  2198. var body io.Reader = nil
  2199. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sharealbumrequest)
  2200. if err != nil {
  2201. return nil, err
  2202. }
  2203. reqHeaders.Set("Content-Type", "application/json")
  2204. c.urlParams_.Set("alt", alt)
  2205. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/albums/{+albumId}:share")
  2206. urls += "?" + c.urlParams_.Encode()
  2207. req, _ := http.NewRequest("POST", urls, body)
  2208. req.Header = reqHeaders
  2209. googleapi.Expand(req.URL, map[string]string{
  2210. "albumId": c.albumId,
  2211. })
  2212. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2213. }
  2214. // Do executes the "photoslibrary.albums.share" call.
  2215. // Exactly one of *ShareAlbumResponse or error will be non-nil. Any
  2216. // non-2xx status code is an error. Response headers are in either
  2217. // *ShareAlbumResponse.ServerResponse.Header or (if a response was
  2218. // returned at all) in error.(*googleapi.Error).Header. Use
  2219. // googleapi.IsNotModified to check whether the returned error was
  2220. // because http.StatusNotModified was returned.
  2221. func (c *AlbumsShareCall) Do(opts ...googleapi.CallOption) (*ShareAlbumResponse, error) {
  2222. gensupport.SetOptions(c.urlParams_, opts...)
  2223. res, err := c.doRequest("json")
  2224. if res != nil && res.StatusCode == http.StatusNotModified {
  2225. if res.Body != nil {
  2226. res.Body.Close()
  2227. }
  2228. return nil, &googleapi.Error{
  2229. Code: res.StatusCode,
  2230. Header: res.Header,
  2231. }
  2232. }
  2233. if err != nil {
  2234. return nil, err
  2235. }
  2236. defer googleapi.CloseBody(res)
  2237. if err := googleapi.CheckResponse(res); err != nil {
  2238. return nil, err
  2239. }
  2240. ret := &ShareAlbumResponse{
  2241. ServerResponse: googleapi.ServerResponse{
  2242. Header: res.Header,
  2243. HTTPStatusCode: res.StatusCode,
  2244. },
  2245. }
  2246. target := &ret
  2247. if err := gensupport.DecodeResponse(target, res); err != nil {
  2248. return nil, err
  2249. }
  2250. return ret, nil
  2251. // {
  2252. // "description": "Marks an album as 'shared' and accessible to other users. This action can\nonly be performed on albums which were created by the developer via the\nAPI.",
  2253. // "flatPath": "v1/albums/{albumsId}:share",
  2254. // "httpMethod": "POST",
  2255. // "id": "photoslibrary.albums.share",
  2256. // "parameterOrder": [
  2257. // "albumId"
  2258. // ],
  2259. // "parameters": {
  2260. // "albumId": {
  2261. // "description": "Identifier of the album to be shared. This album id must belong to an album\ncreated by the developer.\n.",
  2262. // "location": "path",
  2263. // "pattern": "^[^/]+$",
  2264. // "required": true,
  2265. // "type": "string"
  2266. // }
  2267. // },
  2268. // "path": "v1/albums/{+albumId}:share",
  2269. // "request": {
  2270. // "$ref": "ShareAlbumRequest"
  2271. // },
  2272. // "response": {
  2273. // "$ref": "ShareAlbumResponse"
  2274. // },
  2275. // "scopes": [
  2276. // "https://www.googleapis.com/auth/photoslibrary.sharing"
  2277. // ]
  2278. // }
  2279. }
  2280. // method id "photoslibrary.mediaItems.batchCreate":
  2281. type MediaItemsBatchCreateCall struct {
  2282. s *Service
  2283. batchcreatemediaitemsrequest *BatchCreateMediaItemsRequest
  2284. urlParams_ gensupport.URLParams
  2285. ctx_ context.Context
  2286. header_ http.Header
  2287. }
  2288. // BatchCreate: Creates one or more media items in a user's Google
  2289. // Photos library.
  2290. // If an album id is specified, the media item(s) are also added to the
  2291. // album.
  2292. // By default the media item(s) will be added to the end of the library
  2293. // or
  2294. // album.
  2295. //
  2296. // If an album id and position are both defined, then the media items
  2297. // will
  2298. // be added to the album at the specified position.
  2299. //
  2300. // If multiple media items are given, they will be inserted at the
  2301. // specified
  2302. // position.
  2303. func (r *MediaItemsService) BatchCreate(batchcreatemediaitemsrequest *BatchCreateMediaItemsRequest) *MediaItemsBatchCreateCall {
  2304. c := &MediaItemsBatchCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2305. c.batchcreatemediaitemsrequest = batchcreatemediaitemsrequest
  2306. return c
  2307. }
  2308. // Fields allows partial responses to be retrieved. See
  2309. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2310. // for more information.
  2311. func (c *MediaItemsBatchCreateCall) Fields(s ...googleapi.Field) *MediaItemsBatchCreateCall {
  2312. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2313. return c
  2314. }
  2315. // Context sets the context to be used in this call's Do method. Any
  2316. // pending HTTP request will be aborted if the provided context is
  2317. // canceled.
  2318. func (c *MediaItemsBatchCreateCall) Context(ctx context.Context) *MediaItemsBatchCreateCall {
  2319. c.ctx_ = ctx
  2320. return c
  2321. }
  2322. // Header returns an http.Header that can be modified by the caller to
  2323. // add HTTP headers to the request.
  2324. func (c *MediaItemsBatchCreateCall) Header() http.Header {
  2325. if c.header_ == nil {
  2326. c.header_ = make(http.Header)
  2327. }
  2328. return c.header_
  2329. }
  2330. func (c *MediaItemsBatchCreateCall) doRequest(alt string) (*http.Response, error) {
  2331. reqHeaders := make(http.Header)
  2332. for k, v := range c.header_ {
  2333. reqHeaders[k] = v
  2334. }
  2335. reqHeaders.Set("User-Agent", c.s.userAgent())
  2336. var body io.Reader = nil
  2337. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchcreatemediaitemsrequest)
  2338. if err != nil {
  2339. return nil, err
  2340. }
  2341. reqHeaders.Set("Content-Type", "application/json")
  2342. c.urlParams_.Set("alt", alt)
  2343. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/mediaItems:batchCreate")
  2344. urls += "?" + c.urlParams_.Encode()
  2345. req, _ := http.NewRequest("POST", urls, body)
  2346. req.Header = reqHeaders
  2347. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2348. }
  2349. // Do executes the "photoslibrary.mediaItems.batchCreate" call.
  2350. // Exactly one of *BatchCreateMediaItemsResponse or error will be
  2351. // non-nil. Any non-2xx status code is an error. Response headers are in
  2352. // either *BatchCreateMediaItemsResponse.ServerResponse.Header or (if a
  2353. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2354. // googleapi.IsNotModified to check whether the returned error was
  2355. // because http.StatusNotModified was returned.
  2356. func (c *MediaItemsBatchCreateCall) Do(opts ...googleapi.CallOption) (*BatchCreateMediaItemsResponse, error) {
  2357. gensupport.SetOptions(c.urlParams_, opts...)
  2358. res, err := c.doRequest("json")
  2359. if res != nil && res.StatusCode == http.StatusNotModified {
  2360. if res.Body != nil {
  2361. res.Body.Close()
  2362. }
  2363. return nil, &googleapi.Error{
  2364. Code: res.StatusCode,
  2365. Header: res.Header,
  2366. }
  2367. }
  2368. if err != nil {
  2369. return nil, err
  2370. }
  2371. defer googleapi.CloseBody(res)
  2372. if err := googleapi.CheckResponse(res); err != nil {
  2373. return nil, err
  2374. }
  2375. ret := &BatchCreateMediaItemsResponse{
  2376. ServerResponse: googleapi.ServerResponse{
  2377. Header: res.Header,
  2378. HTTPStatusCode: res.StatusCode,
  2379. },
  2380. }
  2381. target := &ret
  2382. if err := gensupport.DecodeResponse(target, res); err != nil {
  2383. return nil, err
  2384. }
  2385. return ret, nil
  2386. // {
  2387. // "description": "Creates one or more media items in a user's Google Photos library.\nIf an album id is specified, the media item(s) are also added to the album.\nBy default the media item(s) will be added to the end of the library or\nalbum.\n\nIf an album id and position are both defined, then the media items will\nbe added to the album at the specified position.\n\nIf multiple media items are given, they will be inserted at the specified\nposition.",
  2388. // "flatPath": "v1/mediaItems:batchCreate",
  2389. // "httpMethod": "POST",
  2390. // "id": "photoslibrary.mediaItems.batchCreate",
  2391. // "parameterOrder": [],
  2392. // "parameters": {},
  2393. // "path": "v1/mediaItems:batchCreate",
  2394. // "request": {
  2395. // "$ref": "BatchCreateMediaItemsRequest"
  2396. // },
  2397. // "response": {
  2398. // "$ref": "BatchCreateMediaItemsResponse"
  2399. // },
  2400. // "scopes": [
  2401. // "https://www.googleapis.com/auth/photoslibrary",
  2402. // "https://www.googleapis.com/auth/photoslibrary.appendonly",
  2403. // "https://www.googleapis.com/auth/photoslibrary.sharing"
  2404. // ]
  2405. // }
  2406. }
  2407. // method id "photoslibrary.mediaItems.get":
  2408. type MediaItemsGetCall struct {
  2409. s *Service
  2410. mediaItemId string
  2411. urlParams_ gensupport.URLParams
  2412. ifNoneMatch_ string
  2413. ctx_ context.Context
  2414. header_ http.Header
  2415. }
  2416. // Get: Returns the media item specified based on a given media item id.
  2417. func (r *MediaItemsService) Get(mediaItemId string) *MediaItemsGetCall {
  2418. c := &MediaItemsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2419. c.mediaItemId = mediaItemId
  2420. return c
  2421. }
  2422. // Fields allows partial responses to be retrieved. See
  2423. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2424. // for more information.
  2425. func (c *MediaItemsGetCall) Fields(s ...googleapi.Field) *MediaItemsGetCall {
  2426. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2427. return c
  2428. }
  2429. // IfNoneMatch sets the optional parameter which makes the operation
  2430. // fail if the object's ETag matches the given value. This is useful for
  2431. // getting updates only after the object has changed since the last
  2432. // request. Use googleapi.IsNotModified to check whether the response
  2433. // error from Do is the result of In-None-Match.
  2434. func (c *MediaItemsGetCall) IfNoneMatch(entityTag string) *MediaItemsGetCall {
  2435. c.ifNoneMatch_ = entityTag
  2436. return c
  2437. }
  2438. // Context sets the context to be used in this call's Do method. Any
  2439. // pending HTTP request will be aborted if the provided context is
  2440. // canceled.
  2441. func (c *MediaItemsGetCall) Context(ctx context.Context) *MediaItemsGetCall {
  2442. c.ctx_ = ctx
  2443. return c
  2444. }
  2445. // Header returns an http.Header that can be modified by the caller to
  2446. // add HTTP headers to the request.
  2447. func (c *MediaItemsGetCall) Header() http.Header {
  2448. if c.header_ == nil {
  2449. c.header_ = make(http.Header)
  2450. }
  2451. return c.header_
  2452. }
  2453. func (c *MediaItemsGetCall) doRequest(alt string) (*http.Response, error) {
  2454. reqHeaders := make(http.Header)
  2455. for k, v := range c.header_ {
  2456. reqHeaders[k] = v
  2457. }
  2458. reqHeaders.Set("User-Agent", c.s.userAgent())
  2459. if c.ifNoneMatch_ != "" {
  2460. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2461. }
  2462. var body io.Reader = nil
  2463. c.urlParams_.Set("alt", alt)
  2464. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/mediaItems/{+mediaItemId}")
  2465. urls += "?" + c.urlParams_.Encode()
  2466. req, _ := http.NewRequest("GET", urls, body)
  2467. req.Header = reqHeaders
  2468. googleapi.Expand(req.URL, map[string]string{
  2469. "mediaItemId": c.mediaItemId,
  2470. })
  2471. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2472. }
  2473. // Do executes the "photoslibrary.mediaItems.get" call.
  2474. // Exactly one of *MediaItem or error will be non-nil. Any non-2xx
  2475. // status code is an error. Response headers are in either
  2476. // *MediaItem.ServerResponse.Header or (if a response was returned at
  2477. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2478. // to check whether the returned error was because
  2479. // http.StatusNotModified was returned.
  2480. func (c *MediaItemsGetCall) Do(opts ...googleapi.CallOption) (*MediaItem, error) {
  2481. gensupport.SetOptions(c.urlParams_, opts...)
  2482. res, err := c.doRequest("json")
  2483. if res != nil && res.StatusCode == http.StatusNotModified {
  2484. if res.Body != nil {
  2485. res.Body.Close()
  2486. }
  2487. return nil, &googleapi.Error{
  2488. Code: res.StatusCode,
  2489. Header: res.Header,
  2490. }
  2491. }
  2492. if err != nil {
  2493. return nil, err
  2494. }
  2495. defer googleapi.CloseBody(res)
  2496. if err := googleapi.CheckResponse(res); err != nil {
  2497. return nil, err
  2498. }
  2499. ret := &MediaItem{
  2500. ServerResponse: googleapi.ServerResponse{
  2501. Header: res.Header,
  2502. HTTPStatusCode: res.StatusCode,
  2503. },
  2504. }
  2505. target := &ret
  2506. if err := gensupport.DecodeResponse(target, res); err != nil {
  2507. return nil, err
  2508. }
  2509. return ret, nil
  2510. // {
  2511. // "description": "Returns the media item specified based on a given media item id.",
  2512. // "flatPath": "v1/mediaItems/{mediaItemsId}",
  2513. // "httpMethod": "GET",
  2514. // "id": "photoslibrary.mediaItems.get",
  2515. // "parameterOrder": [
  2516. // "mediaItemId"
  2517. // ],
  2518. // "parameters": {
  2519. // "mediaItemId": {
  2520. // "description": "Identifier of media item to be requested.",
  2521. // "location": "path",
  2522. // "pattern": "^[^/]+$",
  2523. // "required": true,
  2524. // "type": "string"
  2525. // }
  2526. // },
  2527. // "path": "v1/mediaItems/{+mediaItemId}",
  2528. // "response": {
  2529. // "$ref": "MediaItem"
  2530. // },
  2531. // "scopes": [
  2532. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2533. // "https://www.googleapis.com/auth/photoslibrary",
  2534. // "https://www.googleapis.com/auth/photoslibrary.readonly",
  2535. // "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  2536. // ]
  2537. // }
  2538. }
  2539. // method id "photoslibrary.mediaItems.search":
  2540. type MediaItemsSearchCall struct {
  2541. s *Service
  2542. searchmediaitemsrequest *SearchMediaItemsRequest
  2543. urlParams_ gensupport.URLParams
  2544. ctx_ context.Context
  2545. header_ http.Header
  2546. }
  2547. // Search: Searches for media items in a user's Google Photos
  2548. // library.
  2549. // If no filters are set, then all media items in the user's library
  2550. // will be
  2551. // returned.
  2552. //
  2553. // If an album is set, all media items in the specified album will
  2554. // be
  2555. // returned.
  2556. //
  2557. // If filters are specified, anything that matches the filters from the
  2558. // user's
  2559. // library will be listed.
  2560. //
  2561. // If an album and filters are set, then this will result in an error.
  2562. func (r *MediaItemsService) Search(searchmediaitemsrequest *SearchMediaItemsRequest) *MediaItemsSearchCall {
  2563. c := &MediaItemsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2564. c.searchmediaitemsrequest = searchmediaitemsrequest
  2565. return c
  2566. }
  2567. // Fields allows partial responses to be retrieved. See
  2568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2569. // for more information.
  2570. func (c *MediaItemsSearchCall) Fields(s ...googleapi.Field) *MediaItemsSearchCall {
  2571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2572. return c
  2573. }
  2574. // Context sets the context to be used in this call's Do method. Any
  2575. // pending HTTP request will be aborted if the provided context is
  2576. // canceled.
  2577. func (c *MediaItemsSearchCall) Context(ctx context.Context) *MediaItemsSearchCall {
  2578. c.ctx_ = ctx
  2579. return c
  2580. }
  2581. // Header returns an http.Header that can be modified by the caller to
  2582. // add HTTP headers to the request.
  2583. func (c *MediaItemsSearchCall) Header() http.Header {
  2584. if c.header_ == nil {
  2585. c.header_ = make(http.Header)
  2586. }
  2587. return c.header_
  2588. }
  2589. func (c *MediaItemsSearchCall) doRequest(alt string) (*http.Response, error) {
  2590. reqHeaders := make(http.Header)
  2591. for k, v := range c.header_ {
  2592. reqHeaders[k] = v
  2593. }
  2594. reqHeaders.Set("User-Agent", c.s.userAgent())
  2595. var body io.Reader = nil
  2596. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchmediaitemsrequest)
  2597. if err != nil {
  2598. return nil, err
  2599. }
  2600. reqHeaders.Set("Content-Type", "application/json")
  2601. c.urlParams_.Set("alt", alt)
  2602. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/mediaItems:search")
  2603. urls += "?" + c.urlParams_.Encode()
  2604. req, _ := http.NewRequest("POST", urls, body)
  2605. req.Header = reqHeaders
  2606. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2607. }
  2608. // Do executes the "photoslibrary.mediaItems.search" call.
  2609. // Exactly one of *SearchMediaItemsResponse or error will be non-nil.
  2610. // Any non-2xx status code is an error. Response headers are in either
  2611. // *SearchMediaItemsResponse.ServerResponse.Header or (if a response was
  2612. // returned at all) in error.(*googleapi.Error).Header. Use
  2613. // googleapi.IsNotModified to check whether the returned error was
  2614. // because http.StatusNotModified was returned.
  2615. func (c *MediaItemsSearchCall) Do(opts ...googleapi.CallOption) (*SearchMediaItemsResponse, error) {
  2616. gensupport.SetOptions(c.urlParams_, opts...)
  2617. res, err := c.doRequest("json")
  2618. if res != nil && res.StatusCode == http.StatusNotModified {
  2619. if res.Body != nil {
  2620. res.Body.Close()
  2621. }
  2622. return nil, &googleapi.Error{
  2623. Code: res.StatusCode,
  2624. Header: res.Header,
  2625. }
  2626. }
  2627. if err != nil {
  2628. return nil, err
  2629. }
  2630. defer googleapi.CloseBody(res)
  2631. if err := googleapi.CheckResponse(res); err != nil {
  2632. return nil, err
  2633. }
  2634. ret := &SearchMediaItemsResponse{
  2635. ServerResponse: googleapi.ServerResponse{
  2636. Header: res.Header,
  2637. HTTPStatusCode: res.StatusCode,
  2638. },
  2639. }
  2640. target := &ret
  2641. if err := gensupport.DecodeResponse(target, res); err != nil {
  2642. return nil, err
  2643. }
  2644. return ret, nil
  2645. // {
  2646. // "description": "Searches for media items in a user's Google Photos library.\nIf no filters are set, then all media items in the user's library will be\nreturned.\n\nIf an album is set, all media items in the specified album will be\nreturned.\n\nIf filters are specified, anything that matches the filters from the user's\nlibrary will be listed.\n\nIf an album and filters are set, then this will result in an error.",
  2647. // "flatPath": "v1/mediaItems:search",
  2648. // "httpMethod": "POST",
  2649. // "id": "photoslibrary.mediaItems.search",
  2650. // "parameterOrder": [],
  2651. // "parameters": {},
  2652. // "path": "v1/mediaItems:search",
  2653. // "request": {
  2654. // "$ref": "SearchMediaItemsRequest"
  2655. // },
  2656. // "response": {
  2657. // "$ref": "SearchMediaItemsResponse"
  2658. // },
  2659. // "scopes": [
  2660. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2661. // "https://www.googleapis.com/auth/photoslibrary",
  2662. // "https://www.googleapis.com/auth/photoslibrary.readonly",
  2663. // "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  2664. // ]
  2665. // }
  2666. }
  2667. // Pages invokes f for each page of results.
  2668. // A non-nil error returned from f will halt the iteration.
  2669. // The provided context supersedes any context provided to the Context method.
  2670. func (c *MediaItemsSearchCall) Pages(ctx context.Context, f func(*SearchMediaItemsResponse) error) error {
  2671. c.ctx_ = ctx
  2672. defer func(pt string) { c.searchmediaitemsrequest.PageToken = pt }(c.searchmediaitemsrequest.PageToken) // reset paging to original point
  2673. for {
  2674. x, err := c.Do()
  2675. if err != nil {
  2676. return err
  2677. }
  2678. if err := f(x); err != nil {
  2679. return err
  2680. }
  2681. if x.NextPageToken == "" {
  2682. return nil
  2683. }
  2684. c.searchmediaitemsrequest.PageToken = x.NextPageToken
  2685. }
  2686. }
  2687. // method id "photoslibrary.sharedAlbums.join":
  2688. type SharedAlbumsJoinCall struct {
  2689. s *Service
  2690. joinsharedalbumrequest *JoinSharedAlbumRequest
  2691. urlParams_ gensupport.URLParams
  2692. ctx_ context.Context
  2693. header_ http.Header
  2694. }
  2695. // Join: Joins a shared album on behalf of the Google Photos user.
  2696. func (r *SharedAlbumsService) Join(joinsharedalbumrequest *JoinSharedAlbumRequest) *SharedAlbumsJoinCall {
  2697. c := &SharedAlbumsJoinCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2698. c.joinsharedalbumrequest = joinsharedalbumrequest
  2699. return c
  2700. }
  2701. // Fields allows partial responses to be retrieved. See
  2702. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2703. // for more information.
  2704. func (c *SharedAlbumsJoinCall) Fields(s ...googleapi.Field) *SharedAlbumsJoinCall {
  2705. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2706. return c
  2707. }
  2708. // Context sets the context to be used in this call's Do method. Any
  2709. // pending HTTP request will be aborted if the provided context is
  2710. // canceled.
  2711. func (c *SharedAlbumsJoinCall) Context(ctx context.Context) *SharedAlbumsJoinCall {
  2712. c.ctx_ = ctx
  2713. return c
  2714. }
  2715. // Header returns an http.Header that can be modified by the caller to
  2716. // add HTTP headers to the request.
  2717. func (c *SharedAlbumsJoinCall) Header() http.Header {
  2718. if c.header_ == nil {
  2719. c.header_ = make(http.Header)
  2720. }
  2721. return c.header_
  2722. }
  2723. func (c *SharedAlbumsJoinCall) doRequest(alt string) (*http.Response, error) {
  2724. reqHeaders := make(http.Header)
  2725. for k, v := range c.header_ {
  2726. reqHeaders[k] = v
  2727. }
  2728. reqHeaders.Set("User-Agent", c.s.userAgent())
  2729. var body io.Reader = nil
  2730. body, err := googleapi.WithoutDataWrapper.JSONReader(c.joinsharedalbumrequest)
  2731. if err != nil {
  2732. return nil, err
  2733. }
  2734. reqHeaders.Set("Content-Type", "application/json")
  2735. c.urlParams_.Set("alt", alt)
  2736. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/sharedAlbums:join")
  2737. urls += "?" + c.urlParams_.Encode()
  2738. req, _ := http.NewRequest("POST", urls, body)
  2739. req.Header = reqHeaders
  2740. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2741. }
  2742. // Do executes the "photoslibrary.sharedAlbums.join" call.
  2743. // Exactly one of *JoinSharedAlbumResponse or error will be non-nil. Any
  2744. // non-2xx status code is an error. Response headers are in either
  2745. // *JoinSharedAlbumResponse.ServerResponse.Header or (if a response was
  2746. // returned at all) in error.(*googleapi.Error).Header. Use
  2747. // googleapi.IsNotModified to check whether the returned error was
  2748. // because http.StatusNotModified was returned.
  2749. func (c *SharedAlbumsJoinCall) Do(opts ...googleapi.CallOption) (*JoinSharedAlbumResponse, error) {
  2750. gensupport.SetOptions(c.urlParams_, opts...)
  2751. res, err := c.doRequest("json")
  2752. if res != nil && res.StatusCode == http.StatusNotModified {
  2753. if res.Body != nil {
  2754. res.Body.Close()
  2755. }
  2756. return nil, &googleapi.Error{
  2757. Code: res.StatusCode,
  2758. Header: res.Header,
  2759. }
  2760. }
  2761. if err != nil {
  2762. return nil, err
  2763. }
  2764. defer googleapi.CloseBody(res)
  2765. if err := googleapi.CheckResponse(res); err != nil {
  2766. return nil, err
  2767. }
  2768. ret := &JoinSharedAlbumResponse{
  2769. ServerResponse: googleapi.ServerResponse{
  2770. Header: res.Header,
  2771. HTTPStatusCode: res.StatusCode,
  2772. },
  2773. }
  2774. target := &ret
  2775. if err := gensupport.DecodeResponse(target, res); err != nil {
  2776. return nil, err
  2777. }
  2778. return ret, nil
  2779. // {
  2780. // "description": "Joins a shared album on behalf of the Google Photos user.",
  2781. // "flatPath": "v1/sharedAlbums:join",
  2782. // "httpMethod": "POST",
  2783. // "id": "photoslibrary.sharedAlbums.join",
  2784. // "parameterOrder": [],
  2785. // "parameters": {},
  2786. // "path": "v1/sharedAlbums:join",
  2787. // "request": {
  2788. // "$ref": "JoinSharedAlbumRequest"
  2789. // },
  2790. // "response": {
  2791. // "$ref": "JoinSharedAlbumResponse"
  2792. // },
  2793. // "scopes": [
  2794. // "https://www.googleapis.com/auth/photoslibrary.sharing"
  2795. // ]
  2796. // }
  2797. }
  2798. // method id "photoslibrary.sharedAlbums.list":
  2799. type SharedAlbumsListCall struct {
  2800. s *Service
  2801. urlParams_ gensupport.URLParams
  2802. ifNoneMatch_ string
  2803. ctx_ context.Context
  2804. header_ http.Header
  2805. }
  2806. // List: Lists all shared albums shown to a user in the 'Sharing' tab of
  2807. // the
  2808. // Google Photos app.
  2809. func (r *SharedAlbumsService) List() *SharedAlbumsListCall {
  2810. c := &SharedAlbumsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2811. return c
  2812. }
  2813. // PageSize sets the optional parameter "pageSize": Maximum number of
  2814. // albums to return in the response. The default number of
  2815. // albums to return at a time is 20. The maximum page size is 50.
  2816. func (c *SharedAlbumsListCall) PageSize(pageSize int64) *SharedAlbumsListCall {
  2817. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2818. return c
  2819. }
  2820. // PageToken sets the optional parameter "pageToken": A continuation
  2821. // token to get the next page of the results. Adding this to
  2822. // the request will return the rows after the pageToken. The pageToken
  2823. // should
  2824. // be the value returned in the nextPageToken parameter in the response
  2825. // to the
  2826. // listSharedAlbums request.
  2827. func (c *SharedAlbumsListCall) PageToken(pageToken string) *SharedAlbumsListCall {
  2828. c.urlParams_.Set("pageToken", pageToken)
  2829. return c
  2830. }
  2831. // Fields allows partial responses to be retrieved. See
  2832. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2833. // for more information.
  2834. func (c *SharedAlbumsListCall) Fields(s ...googleapi.Field) *SharedAlbumsListCall {
  2835. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2836. return c
  2837. }
  2838. // IfNoneMatch sets the optional parameter which makes the operation
  2839. // fail if the object's ETag matches the given value. This is useful for
  2840. // getting updates only after the object has changed since the last
  2841. // request. Use googleapi.IsNotModified to check whether the response
  2842. // error from Do is the result of In-None-Match.
  2843. func (c *SharedAlbumsListCall) IfNoneMatch(entityTag string) *SharedAlbumsListCall {
  2844. c.ifNoneMatch_ = entityTag
  2845. return c
  2846. }
  2847. // Context sets the context to be used in this call's Do method. Any
  2848. // pending HTTP request will be aborted if the provided context is
  2849. // canceled.
  2850. func (c *SharedAlbumsListCall) Context(ctx context.Context) *SharedAlbumsListCall {
  2851. c.ctx_ = ctx
  2852. return c
  2853. }
  2854. // Header returns an http.Header that can be modified by the caller to
  2855. // add HTTP headers to the request.
  2856. func (c *SharedAlbumsListCall) Header() http.Header {
  2857. if c.header_ == nil {
  2858. c.header_ = make(http.Header)
  2859. }
  2860. return c.header_
  2861. }
  2862. func (c *SharedAlbumsListCall) doRequest(alt string) (*http.Response, error) {
  2863. reqHeaders := make(http.Header)
  2864. for k, v := range c.header_ {
  2865. reqHeaders[k] = v
  2866. }
  2867. reqHeaders.Set("User-Agent", c.s.userAgent())
  2868. if c.ifNoneMatch_ != "" {
  2869. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2870. }
  2871. var body io.Reader = nil
  2872. c.urlParams_.Set("alt", alt)
  2873. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/sharedAlbums")
  2874. urls += "?" + c.urlParams_.Encode()
  2875. req, _ := http.NewRequest("GET", urls, body)
  2876. req.Header = reqHeaders
  2877. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2878. }
  2879. // Do executes the "photoslibrary.sharedAlbums.list" call.
  2880. // Exactly one of *ListSharedAlbumsResponse or error will be non-nil.
  2881. // Any non-2xx status code is an error. Response headers are in either
  2882. // *ListSharedAlbumsResponse.ServerResponse.Header or (if a response was
  2883. // returned at all) in error.(*googleapi.Error).Header. Use
  2884. // googleapi.IsNotModified to check whether the returned error was
  2885. // because http.StatusNotModified was returned.
  2886. func (c *SharedAlbumsListCall) Do(opts ...googleapi.CallOption) (*ListSharedAlbumsResponse, error) {
  2887. gensupport.SetOptions(c.urlParams_, opts...)
  2888. res, err := c.doRequest("json")
  2889. if res != nil && res.StatusCode == http.StatusNotModified {
  2890. if res.Body != nil {
  2891. res.Body.Close()
  2892. }
  2893. return nil, &googleapi.Error{
  2894. Code: res.StatusCode,
  2895. Header: res.Header,
  2896. }
  2897. }
  2898. if err != nil {
  2899. return nil, err
  2900. }
  2901. defer googleapi.CloseBody(res)
  2902. if err := googleapi.CheckResponse(res); err != nil {
  2903. return nil, err
  2904. }
  2905. ret := &ListSharedAlbumsResponse{
  2906. ServerResponse: googleapi.ServerResponse{
  2907. Header: res.Header,
  2908. HTTPStatusCode: res.StatusCode,
  2909. },
  2910. }
  2911. target := &ret
  2912. if err := gensupport.DecodeResponse(target, res); err != nil {
  2913. return nil, err
  2914. }
  2915. return ret, nil
  2916. // {
  2917. // "description": "Lists all shared albums shown to a user in the 'Sharing' tab of the\nGoogle Photos app.",
  2918. // "flatPath": "v1/sharedAlbums",
  2919. // "httpMethod": "GET",
  2920. // "id": "photoslibrary.sharedAlbums.list",
  2921. // "parameterOrder": [],
  2922. // "parameters": {
  2923. // "pageSize": {
  2924. // "description": "Maximum number of albums to return in the response. The default number of\nalbums to return at a time is 20. The maximum page size is 50.",
  2925. // "format": "int32",
  2926. // "location": "query",
  2927. // "type": "integer"
  2928. // },
  2929. // "pageToken": {
  2930. // "description": "A continuation token to get the next page of the results. Adding this to\nthe request will return the rows after the pageToken. The pageToken should\nbe the value returned in the nextPageToken parameter in the response to the\nlistSharedAlbums request.",
  2931. // "location": "query",
  2932. // "type": "string"
  2933. // }
  2934. // },
  2935. // "path": "v1/sharedAlbums",
  2936. // "response": {
  2937. // "$ref": "ListSharedAlbumsResponse"
  2938. // },
  2939. // "scopes": [
  2940. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2941. // "https://www.googleapis.com/auth/photoslibrary",
  2942. // "https://www.googleapis.com/auth/photoslibrary.readonly",
  2943. // "https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata"
  2944. // ]
  2945. // }
  2946. }
  2947. // Pages invokes f for each page of results.
  2948. // A non-nil error returned from f will halt the iteration.
  2949. // The provided context supersedes any context provided to the Context method.
  2950. func (c *SharedAlbumsListCall) Pages(ctx context.Context, f func(*ListSharedAlbumsResponse) error) error {
  2951. c.ctx_ = ctx
  2952. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2953. for {
  2954. x, err := c.Do()
  2955. if err != nil {
  2956. return err
  2957. }
  2958. if err := f(x); err != nil {
  2959. return err
  2960. }
  2961. if x.NextPageToken == "" {
  2962. return nil
  2963. }
  2964. c.PageToken(x.NextPageToken)
  2965. }
  2966. }