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.
 
 
 

3315 lines
121 KiB

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