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.
 
 
 

2505 lines
86 KiB

  1. // Package streetviewpublish provides access to the Street View Publish API.
  2. //
  3. // See https://developers.google.com/streetview/publish/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/streetviewpublish/v1"
  8. // ...
  9. // streetviewpublishService, err := streetviewpublish.New(oauthHttpClient)
  10. package streetviewpublish // import "google.golang.org/api/streetviewpublish/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "streetviewpublish:v1"
  41. const apiName = "streetviewpublish"
  42. const apiVersion = "v1"
  43. const basePath = "https://streetviewpublish.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Publish and manage your 360 photos on Google Street View
  47. StreetviewpublishScope = "https://www.googleapis.com/auth/streetviewpublish"
  48. )
  49. func New(client *http.Client) (*Service, error) {
  50. if client == nil {
  51. return nil, errors.New("client is nil")
  52. }
  53. s := &Service{client: client, BasePath: basePath}
  54. s.Photo = NewPhotoService(s)
  55. s.Photos = NewPhotosService(s)
  56. return s, nil
  57. }
  58. type Service struct {
  59. client *http.Client
  60. BasePath string // API endpoint base URL
  61. UserAgent string // optional additional User-Agent fragment
  62. Photo *PhotoService
  63. Photos *PhotosService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewPhotoService(s *Service) *PhotoService {
  72. rs := &PhotoService{s: s}
  73. return rs
  74. }
  75. type PhotoService struct {
  76. s *Service
  77. }
  78. func NewPhotosService(s *Service) *PhotosService {
  79. rs := &PhotosService{s: s}
  80. return rs
  81. }
  82. type PhotosService struct {
  83. s *Service
  84. }
  85. // BatchDeletePhotosRequest: Request to delete multiple Photos.
  86. type BatchDeletePhotosRequest struct {
  87. // PhotoIds: Required. IDs of the Photos. For HTTP
  88. // GET requests, the URL query parameter should
  89. // be
  90. // `photoIds=<id1>&photoIds=<id2>&...`.
  91. PhotoIds []string `json:"photoIds,omitempty"`
  92. // ForceSendFields is a list of field names (e.g. "PhotoIds") to
  93. // unconditionally include in API requests. By default, fields with
  94. // empty values are omitted from API requests. However, any non-pointer,
  95. // non-interface field appearing in ForceSendFields will be sent to the
  96. // server regardless of whether the field is empty or not. This may be
  97. // used to include empty fields in Patch requests.
  98. ForceSendFields []string `json:"-"`
  99. // NullFields is a list of field names (e.g. "PhotoIds") to include in
  100. // API requests with the JSON null value. By default, fields with empty
  101. // values are omitted from API requests. However, any field with an
  102. // empty value appearing in NullFields will be sent to the server as
  103. // null. It is an error if a field in this list has a non-empty value.
  104. // This may be used to include null fields in Patch requests.
  105. NullFields []string `json:"-"`
  106. }
  107. func (s *BatchDeletePhotosRequest) MarshalJSON() ([]byte, error) {
  108. type NoMethod BatchDeletePhotosRequest
  109. raw := NoMethod(*s)
  110. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  111. }
  112. // BatchDeletePhotosResponse: Response to batch delete of one or
  113. // more
  114. // Photos.
  115. type BatchDeletePhotosResponse struct {
  116. // Status: The status for the operation to delete a single
  117. // Photo in the batch request.
  118. Status []*Status `json:"status,omitempty"`
  119. // ServerResponse contains the HTTP response code and headers from the
  120. // server.
  121. googleapi.ServerResponse `json:"-"`
  122. // ForceSendFields is a list of field names (e.g. "Status") to
  123. // unconditionally include in API requests. By default, fields with
  124. // empty values are omitted from API requests. However, any non-pointer,
  125. // non-interface field appearing in ForceSendFields will be sent to the
  126. // server regardless of whether the field is empty or not. This may be
  127. // used to include empty fields in Patch requests.
  128. ForceSendFields []string `json:"-"`
  129. // NullFields is a list of field names (e.g. "Status") to include in API
  130. // requests with the JSON null value. By default, fields with empty
  131. // values are omitted from API requests. However, any field with an
  132. // empty value appearing in NullFields will be sent to the server as
  133. // null. It is an error if a field in this list has a non-empty value.
  134. // This may be used to include null fields in Patch requests.
  135. NullFields []string `json:"-"`
  136. }
  137. func (s *BatchDeletePhotosResponse) MarshalJSON() ([]byte, error) {
  138. type NoMethod BatchDeletePhotosResponse
  139. raw := NoMethod(*s)
  140. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  141. }
  142. // BatchGetPhotosResponse: Response to batch get of Photos.
  143. type BatchGetPhotosResponse struct {
  144. // Results: List of results for each individual
  145. // Photo requested, in the same order as
  146. // the requests in
  147. // BatchGetPhotos.
  148. Results []*PhotoResponse `json:"results,omitempty"`
  149. // ServerResponse contains the HTTP response code and headers from the
  150. // server.
  151. googleapi.ServerResponse `json:"-"`
  152. // ForceSendFields is a list of field names (e.g. "Results") to
  153. // unconditionally include in API requests. By default, fields with
  154. // empty values are omitted from API requests. However, any non-pointer,
  155. // non-interface field appearing in ForceSendFields will be sent to the
  156. // server regardless of whether the field is empty or not. This may be
  157. // used to include empty fields in Patch requests.
  158. ForceSendFields []string `json:"-"`
  159. // NullFields is a list of field names (e.g. "Results") to include in
  160. // API requests with the JSON null value. By default, fields with empty
  161. // values are omitted from API requests. However, any field with an
  162. // empty value appearing in NullFields will be sent to the server as
  163. // null. It is an error if a field in this list has a non-empty value.
  164. // This may be used to include null fields in Patch requests.
  165. NullFields []string `json:"-"`
  166. }
  167. func (s *BatchGetPhotosResponse) MarshalJSON() ([]byte, error) {
  168. type NoMethod BatchGetPhotosResponse
  169. raw := NoMethod(*s)
  170. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  171. }
  172. // BatchUpdatePhotosRequest: Request to update the metadata of
  173. // photos.
  174. // Updating the pixels of photos is not supported.
  175. type BatchUpdatePhotosRequest struct {
  176. // UpdatePhotoRequests: Required. List of
  177. // UpdatePhotoRequests.
  178. UpdatePhotoRequests []*UpdatePhotoRequest `json:"updatePhotoRequests,omitempty"`
  179. // ForceSendFields is a list of field names (e.g. "UpdatePhotoRequests")
  180. // to unconditionally include in API requests. By default, fields with
  181. // empty values are omitted from API requests. However, any non-pointer,
  182. // non-interface field appearing in ForceSendFields will be sent to the
  183. // server regardless of whether the field is empty or not. This may be
  184. // used to include empty fields in Patch requests.
  185. ForceSendFields []string `json:"-"`
  186. // NullFields is a list of field names (e.g. "UpdatePhotoRequests") to
  187. // include in API requests with the JSON null value. By default, fields
  188. // with empty values are omitted from API requests. However, any field
  189. // with an empty value appearing in NullFields will be sent to the
  190. // server as null. It is an error if a field in this list has a
  191. // non-empty value. This may be used to include null fields in Patch
  192. // requests.
  193. NullFields []string `json:"-"`
  194. }
  195. func (s *BatchUpdatePhotosRequest) MarshalJSON() ([]byte, error) {
  196. type NoMethod BatchUpdatePhotosRequest
  197. raw := NoMethod(*s)
  198. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  199. }
  200. // BatchUpdatePhotosResponse: Response to batch update of metadata of
  201. // one or more
  202. // Photos.
  203. type BatchUpdatePhotosResponse struct {
  204. // Results: List of results for each individual
  205. // Photo updated, in the same order as
  206. // the request.
  207. Results []*PhotoResponse `json:"results,omitempty"`
  208. // ServerResponse contains the HTTP response code and headers from the
  209. // server.
  210. googleapi.ServerResponse `json:"-"`
  211. // ForceSendFields is a list of field names (e.g. "Results") to
  212. // unconditionally include in API requests. By default, fields with
  213. // empty values are omitted from API requests. However, any non-pointer,
  214. // non-interface field appearing in ForceSendFields will be sent to the
  215. // server regardless of whether the field is empty or not. This may be
  216. // used to include empty fields in Patch requests.
  217. ForceSendFields []string `json:"-"`
  218. // NullFields is a list of field names (e.g. "Results") to include in
  219. // API requests with the JSON null value. By default, fields with empty
  220. // values are omitted from API requests. However, any field with an
  221. // empty value appearing in NullFields will be sent to the server as
  222. // null. It is an error if a field in this list has a non-empty value.
  223. // This may be used to include null fields in Patch requests.
  224. NullFields []string `json:"-"`
  225. }
  226. func (s *BatchUpdatePhotosResponse) MarshalJSON() ([]byte, error) {
  227. type NoMethod BatchUpdatePhotosResponse
  228. raw := NoMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  230. }
  231. // Connection: A connection is the link from a source photo to a
  232. // destination photo.
  233. type Connection struct {
  234. // Target: Required. The destination of the connection from the
  235. // containing photo to
  236. // another photo.
  237. Target *PhotoId `json:"target,omitempty"`
  238. // ForceSendFields is a list of field names (e.g. "Target") to
  239. // unconditionally include in API requests. By default, fields with
  240. // empty values are omitted from API requests. However, any non-pointer,
  241. // non-interface field appearing in ForceSendFields will be sent to the
  242. // server regardless of whether the field is empty or not. This may be
  243. // used to include empty fields in Patch requests.
  244. ForceSendFields []string `json:"-"`
  245. // NullFields is a list of field names (e.g. "Target") to include in API
  246. // requests with the JSON null value. By default, fields with empty
  247. // values are omitted from API requests. However, any field with an
  248. // empty value appearing in NullFields will be sent to the server as
  249. // null. It is an error if a field in this list has a non-empty value.
  250. // This may be used to include null fields in Patch requests.
  251. NullFields []string `json:"-"`
  252. }
  253. func (s *Connection) MarshalJSON() ([]byte, error) {
  254. type NoMethod Connection
  255. raw := NoMethod(*s)
  256. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  257. }
  258. // Empty: A generic empty message that you can re-use to avoid defining
  259. // duplicated
  260. // empty messages in your APIs. A typical example is to use it as the
  261. // request
  262. // or the response type of an API method. For instance:
  263. //
  264. // service Foo {
  265. // rpc Bar(google.protobuf.Empty) returns
  266. // (google.protobuf.Empty);
  267. // }
  268. //
  269. // The JSON representation for `Empty` is empty JSON object `{}`.
  270. type Empty struct {
  271. // ServerResponse contains the HTTP response code and headers from the
  272. // server.
  273. googleapi.ServerResponse `json:"-"`
  274. }
  275. // LatLng: An object representing a latitude/longitude pair. This is
  276. // expressed as a pair
  277. // of doubles representing degrees latitude and degrees longitude.
  278. // Unless
  279. // specified otherwise, this must conform to the
  280. // <a
  281. // href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
  282. // st
  283. // andard</a>. Values must be within normalized ranges.
  284. type LatLng struct {
  285. // Latitude: The latitude in degrees. It must be in the range [-90.0,
  286. // +90.0].
  287. Latitude float64 `json:"latitude,omitempty"`
  288. // Longitude: The longitude in degrees. It must be in the range [-180.0,
  289. // +180.0].
  290. Longitude float64 `json:"longitude,omitempty"`
  291. // ForceSendFields is a list of field names (e.g. "Latitude") to
  292. // unconditionally include in API requests. By default, fields with
  293. // empty values are omitted from API requests. However, any non-pointer,
  294. // non-interface field appearing in ForceSendFields will be sent to the
  295. // server regardless of whether the field is empty or not. This may be
  296. // used to include empty fields in Patch requests.
  297. ForceSendFields []string `json:"-"`
  298. // NullFields is a list of field names (e.g. "Latitude") to include in
  299. // API requests with the JSON null value. By default, fields with empty
  300. // values are omitted from API requests. However, any field with an
  301. // empty value appearing in NullFields will be sent to the server as
  302. // null. It is an error if a field in this list has a non-empty value.
  303. // This may be used to include null fields in Patch requests.
  304. NullFields []string `json:"-"`
  305. }
  306. func (s *LatLng) MarshalJSON() ([]byte, error) {
  307. type NoMethod LatLng
  308. raw := NoMethod(*s)
  309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  310. }
  311. func (s *LatLng) UnmarshalJSON(data []byte) error {
  312. type NoMethod LatLng
  313. var s1 struct {
  314. Latitude gensupport.JSONFloat64 `json:"latitude"`
  315. Longitude gensupport.JSONFloat64 `json:"longitude"`
  316. *NoMethod
  317. }
  318. s1.NoMethod = (*NoMethod)(s)
  319. if err := json.Unmarshal(data, &s1); err != nil {
  320. return err
  321. }
  322. s.Latitude = float64(s1.Latitude)
  323. s.Longitude = float64(s1.Longitude)
  324. return nil
  325. }
  326. // Level: Level information containing level number and its
  327. // corresponding name.
  328. type Level struct {
  329. // Name: Required. A name assigned to this Level, restricted to 3
  330. // characters.
  331. // Consider how the elevator buttons would be labeled for this level if
  332. // there
  333. // was an elevator.
  334. Name string `json:"name,omitempty"`
  335. // Number: Floor number, used for ordering. 0 indicates the ground
  336. // level, 1 indicates
  337. // the first level above ground level, -1 indicates the first level
  338. // under
  339. // ground level. Non-integer values are OK.
  340. Number float64 `json:"number,omitempty"`
  341. // ForceSendFields is a list of field names (e.g. "Name") to
  342. // unconditionally include in API requests. By default, fields with
  343. // empty values are omitted from API requests. However, any non-pointer,
  344. // non-interface field appearing in ForceSendFields will be sent to the
  345. // server regardless of whether the field is empty or not. This may be
  346. // used to include empty fields in Patch requests.
  347. ForceSendFields []string `json:"-"`
  348. // NullFields is a list of field names (e.g. "Name") to include in API
  349. // requests with the JSON null value. By default, fields with empty
  350. // values are omitted from API requests. However, any field with an
  351. // empty value appearing in NullFields will be sent to the server as
  352. // null. It is an error if a field in this list has a non-empty value.
  353. // This may be used to include null fields in Patch requests.
  354. NullFields []string `json:"-"`
  355. }
  356. func (s *Level) MarshalJSON() ([]byte, error) {
  357. type NoMethod Level
  358. raw := NoMethod(*s)
  359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  360. }
  361. func (s *Level) UnmarshalJSON(data []byte) error {
  362. type NoMethod Level
  363. var s1 struct {
  364. Number gensupport.JSONFloat64 `json:"number"`
  365. *NoMethod
  366. }
  367. s1.NoMethod = (*NoMethod)(s)
  368. if err := json.Unmarshal(data, &s1); err != nil {
  369. return err
  370. }
  371. s.Number = float64(s1.Number)
  372. return nil
  373. }
  374. // ListPhotosResponse: Response to list all photos that belong to a
  375. // user.
  376. type ListPhotosResponse struct {
  377. // NextPageToken: Token to retrieve the next page of results, or empty
  378. // if there are no more
  379. // results in the list.
  380. NextPageToken string `json:"nextPageToken,omitempty"`
  381. // Photos: List of photos. The maximum number of items returned is based
  382. // on the
  383. // pageSize field
  384. // in the request.
  385. Photos []*Photo `json:"photos,omitempty"`
  386. // ServerResponse contains the HTTP response code and headers from the
  387. // server.
  388. googleapi.ServerResponse `json:"-"`
  389. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  390. // unconditionally include in API requests. By default, fields with
  391. // empty values are omitted from API requests. However, any non-pointer,
  392. // non-interface field appearing in ForceSendFields will be sent to the
  393. // server regardless of whether the field is empty or not. This may be
  394. // used to include empty fields in Patch requests.
  395. ForceSendFields []string `json:"-"`
  396. // NullFields is a list of field names (e.g. "NextPageToken") to include
  397. // in API requests with the JSON null value. By default, fields with
  398. // empty values are omitted from API requests. However, any field with
  399. // an empty value appearing in NullFields will be sent to the server as
  400. // null. It is an error if a field in this list has a non-empty value.
  401. // This may be used to include null fields in Patch requests.
  402. NullFields []string `json:"-"`
  403. }
  404. func (s *ListPhotosResponse) MarshalJSON() ([]byte, error) {
  405. type NoMethod ListPhotosResponse
  406. raw := NoMethod(*s)
  407. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  408. }
  409. // Operation: This resource represents a long-running operation that is
  410. // the result of a
  411. // network API call.
  412. type Operation struct {
  413. // Done: If the value is `false`, it means the operation is still in
  414. // progress.
  415. // If `true`, the operation is completed, and either `error` or
  416. // `response` is
  417. // available.
  418. Done bool `json:"done,omitempty"`
  419. // Error: The error result of the operation in case of failure or
  420. // cancellation.
  421. Error *Status `json:"error,omitempty"`
  422. // Metadata: Service-specific metadata associated with the operation.
  423. // It typically
  424. // contains progress information and common metadata such as create
  425. // time.
  426. // Some services might not provide such metadata. Any method that
  427. // returns a
  428. // long-running operation should document the metadata type, if any.
  429. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  430. // Name: The server-assigned name, which is only unique within the same
  431. // service that
  432. // originally returns it. If you use the default HTTP mapping,
  433. // the
  434. // `name` should have the format of `operations/some/unique/name`.
  435. Name string `json:"name,omitempty"`
  436. // Response: The normal response of the operation in case of success.
  437. // If the original
  438. // method returns no data on success, such as `Delete`, the response
  439. // is
  440. // `google.protobuf.Empty`. If the original method is
  441. // standard
  442. // `Get`/`Create`/`Update`, the response should be the resource. For
  443. // other
  444. // methods, the response should have the type `XxxResponse`, where
  445. // `Xxx`
  446. // is the original method name. For example, if the original method
  447. // name
  448. // is `TakeSnapshot()`, the inferred response type
  449. // is
  450. // `TakeSnapshotResponse`.
  451. Response googleapi.RawMessage `json:"response,omitempty"`
  452. // ForceSendFields is a list of field names (e.g. "Done") to
  453. // unconditionally include in API requests. By default, fields with
  454. // empty values are omitted from API requests. However, any non-pointer,
  455. // non-interface field appearing in ForceSendFields will be sent to the
  456. // server regardless of whether the field is empty or not. This may be
  457. // used to include empty fields in Patch requests.
  458. ForceSendFields []string `json:"-"`
  459. // NullFields is a list of field names (e.g. "Done") to include in API
  460. // requests with the JSON null value. By default, fields with empty
  461. // values are omitted from API requests. However, any field with an
  462. // empty value appearing in NullFields will be sent to the server as
  463. // null. It is an error if a field in this list has a non-empty value.
  464. // This may be used to include null fields in Patch requests.
  465. NullFields []string `json:"-"`
  466. }
  467. func (s *Operation) MarshalJSON() ([]byte, error) {
  468. type NoMethod Operation
  469. raw := NoMethod(*s)
  470. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  471. }
  472. // Photo: Photo is used to store 360 photos along with photo metadata.
  473. type Photo struct {
  474. // CaptureTime: Absolute time when the photo was captured.
  475. // When the photo has no exif timestamp, this is used to set a timestamp
  476. // in
  477. // the photo metadata.
  478. CaptureTime string `json:"captureTime,omitempty"`
  479. // Connections: Connections to other photos. A connection represents the
  480. // link from this
  481. // photo to another photo.
  482. Connections []*Connection `json:"connections,omitempty"`
  483. // DownloadUrl: Output only. The download URL for the photo bytes. This
  484. // field is set only
  485. // when
  486. // GetPhotoRequest.view
  487. // is set to
  488. // PhotoView.INCLUDE_DOWNLOAD_URL.
  489. DownloadUrl string `json:"downloadUrl,omitempty"`
  490. // PhotoId: Required when updating a photo. Output only when creating a
  491. // photo.
  492. // Identifier for the photo, which is unique among all photos in
  493. // Google.
  494. PhotoId *PhotoId `json:"photoId,omitempty"`
  495. // Places: Places where this photo belongs.
  496. Places []*Place `json:"places,omitempty"`
  497. // Pose: Pose of the photo.
  498. Pose *Pose `json:"pose,omitempty"`
  499. // ShareLink: Output only. The share link for the photo.
  500. ShareLink string `json:"shareLink,omitempty"`
  501. // ThumbnailUrl: Output only. The thumbnail URL for showing a preview of
  502. // the given photo.
  503. ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
  504. // UploadReference: Required when creating a photo. Input only. The
  505. // resource URL where the
  506. // photo bytes are uploaded to.
  507. UploadReference *UploadRef `json:"uploadReference,omitempty"`
  508. // ViewCount: Output only. View count of the photo.
  509. ViewCount int64 `json:"viewCount,omitempty,string"`
  510. // ServerResponse contains the HTTP response code and headers from the
  511. // server.
  512. googleapi.ServerResponse `json:"-"`
  513. // ForceSendFields is a list of field names (e.g. "CaptureTime") to
  514. // unconditionally include in API requests. By default, fields with
  515. // empty values are omitted from API requests. However, any non-pointer,
  516. // non-interface field appearing in ForceSendFields will be sent to the
  517. // server regardless of whether the field is empty or not. This may be
  518. // used to include empty fields in Patch requests.
  519. ForceSendFields []string `json:"-"`
  520. // NullFields is a list of field names (e.g. "CaptureTime") to include
  521. // in API requests with the JSON null value. By default, fields with
  522. // empty values are omitted from API requests. However, any field with
  523. // an empty value appearing in NullFields will be sent to the server as
  524. // null. It is an error if a field in this list has a non-empty value.
  525. // This may be used to include null fields in Patch requests.
  526. NullFields []string `json:"-"`
  527. }
  528. func (s *Photo) MarshalJSON() ([]byte, error) {
  529. type NoMethod Photo
  530. raw := NoMethod(*s)
  531. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  532. }
  533. // PhotoId: Identifier for a Photo.
  534. type PhotoId struct {
  535. // Id: Required. A unique identifier for a photo.
  536. Id string `json:"id,omitempty"`
  537. // ForceSendFields is a list of field names (e.g. "Id") to
  538. // unconditionally include in API requests. By default, fields with
  539. // empty values are omitted from API requests. However, any non-pointer,
  540. // non-interface field appearing in ForceSendFields will be sent to the
  541. // server regardless of whether the field is empty or not. This may be
  542. // used to include empty fields in Patch requests.
  543. ForceSendFields []string `json:"-"`
  544. // NullFields is a list of field names (e.g. "Id") to include in API
  545. // requests with the JSON null value. By default, fields with empty
  546. // values are omitted from API requests. However, any field with an
  547. // empty value appearing in NullFields will be sent to the server as
  548. // null. It is an error if a field in this list has a non-empty value.
  549. // This may be used to include null fields in Patch requests.
  550. NullFields []string `json:"-"`
  551. }
  552. func (s *PhotoId) MarshalJSON() ([]byte, error) {
  553. type NoMethod PhotoId
  554. raw := NoMethod(*s)
  555. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  556. }
  557. // PhotoResponse: Response payload for a single
  558. // Photo
  559. // in batch operations including
  560. // BatchGetPhotos
  561. // and
  562. // BatchUpdatePhotos.
  563. type PhotoResponse struct {
  564. // Photo: The Photo resource, if the request
  565. // was successful.
  566. Photo *Photo `json:"photo,omitempty"`
  567. // Status: The status for the operation to get or update a single photo
  568. // in the batch
  569. // request.
  570. Status *Status `json:"status,omitempty"`
  571. // ForceSendFields is a list of field names (e.g. "Photo") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "Photo") to include in API
  579. // requests with the JSON null value. By default, fields with empty
  580. // values are omitted from API requests. However, any field with an
  581. // empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *PhotoResponse) MarshalJSON() ([]byte, error) {
  587. type NoMethod PhotoResponse
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // Place: Place metadata for an entity.
  592. type Place struct {
  593. // PlaceId: Place identifier, as described
  594. // in
  595. // https://developers.google.com/places/place-id.
  596. PlaceId string `json:"placeId,omitempty"`
  597. // ForceSendFields is a list of field names (e.g. "PlaceId") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. // NullFields is a list of field names (e.g. "PlaceId") to include in
  605. // API requests with the JSON null value. By default, fields with empty
  606. // values are omitted from API requests. However, any field with an
  607. // empty value appearing in NullFields will be sent to the server as
  608. // null. It is an error if a field in this list has a non-empty value.
  609. // This may be used to include null fields in Patch requests.
  610. NullFields []string `json:"-"`
  611. }
  612. func (s *Place) MarshalJSON() ([]byte, error) {
  613. type NoMethod Place
  614. raw := NoMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  616. }
  617. // Pose: Raw pose measurement for an entity.
  618. type Pose struct {
  619. // Altitude: Altitude of the pose in meters above WGS84 ellipsoid.
  620. // NaN indicates an unmeasured quantity.
  621. Altitude float64 `json:"altitude,omitempty"`
  622. // Heading: Compass heading, measured at the center of the photo in
  623. // degrees clockwise
  624. // from North. Value must be >=0 and <360.
  625. // NaN indicates an unmeasured quantity.
  626. Heading float64 `json:"heading,omitempty"`
  627. // LatLngPair: Latitude and longitude pair of the pose, as explained
  628. // here:
  629. // https://cloud.google.com/datastore/docs/reference/rest/Shared.Ty
  630. // pes/LatLng
  631. // When creating a Photo, if the
  632. // latitude and longitude pair are not provided here, the geolocation
  633. // from the
  634. // exif header will be used. If the latitude and longitude pair is
  635. // not
  636. // provided and cannot be found in the exif header, the create photo
  637. // process
  638. // will fail.
  639. LatLngPair *LatLng `json:"latLngPair,omitempty"`
  640. // Level: Level (the floor in a building) used to configure vertical
  641. // navigation.
  642. Level *Level `json:"level,omitempty"`
  643. // Pitch: Pitch, measured at the center of the photo in degrees. Value
  644. // must be >=-90
  645. // and <= 90. A value of -90 means looking directly down, and a value of
  646. // 90
  647. // means looking directly up.
  648. // NaN indicates an unmeasured quantity.
  649. Pitch float64 `json:"pitch,omitempty"`
  650. // Roll: Roll, measured in degrees. Value must be >= 0 and <360. A value
  651. // of 0
  652. // means level with the horizon.
  653. // NaN indicates an unmeasured quantity.
  654. Roll float64 `json:"roll,omitempty"`
  655. // ForceSendFields is a list of field names (e.g. "Altitude") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. // NullFields is a list of field names (e.g. "Altitude") to include in
  663. // API requests with the JSON null value. By default, fields with empty
  664. // values are omitted from API requests. However, any field with an
  665. // empty value appearing in NullFields will be sent to the server as
  666. // null. It is an error if a field in this list has a non-empty value.
  667. // This may be used to include null fields in Patch requests.
  668. NullFields []string `json:"-"`
  669. }
  670. func (s *Pose) MarshalJSON() ([]byte, error) {
  671. type NoMethod Pose
  672. raw := NoMethod(*s)
  673. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  674. }
  675. func (s *Pose) UnmarshalJSON(data []byte) error {
  676. type NoMethod Pose
  677. var s1 struct {
  678. Altitude gensupport.JSONFloat64 `json:"altitude"`
  679. Heading gensupport.JSONFloat64 `json:"heading"`
  680. Pitch gensupport.JSONFloat64 `json:"pitch"`
  681. Roll gensupport.JSONFloat64 `json:"roll"`
  682. *NoMethod
  683. }
  684. s1.NoMethod = (*NoMethod)(s)
  685. if err := json.Unmarshal(data, &s1); err != nil {
  686. return err
  687. }
  688. s.Altitude = float64(s1.Altitude)
  689. s.Heading = float64(s1.Heading)
  690. s.Pitch = float64(s1.Pitch)
  691. s.Roll = float64(s1.Roll)
  692. return nil
  693. }
  694. // Status: The `Status` type defines a logical error model that is
  695. // suitable for different
  696. // programming environments, including REST APIs and RPC APIs. It is
  697. // used by
  698. // [gRPC](https://github.com/grpc). The error model is designed to
  699. // be:
  700. //
  701. // - Simple to use and understand for most users
  702. // - Flexible enough to meet unexpected needs
  703. //
  704. // # Overview
  705. //
  706. // The `Status` message contains three pieces of data: error code, error
  707. // message,
  708. // and error details. The error code should be an enum value
  709. // of
  710. // google.rpc.Code, but it may accept additional error codes if needed.
  711. // The
  712. // error message should be a developer-facing English message that
  713. // helps
  714. // developers *understand* and *resolve* the error. If a localized
  715. // user-facing
  716. // error message is needed, put the localized message in the error
  717. // details or
  718. // localize it in the client. The optional error details may contain
  719. // arbitrary
  720. // information about the error. There is a predefined set of error
  721. // detail types
  722. // in the package `google.rpc` that can be used for common error
  723. // conditions.
  724. //
  725. // # Language mapping
  726. //
  727. // The `Status` message is the logical representation of the error
  728. // model, but it
  729. // is not necessarily the actual wire format. When the `Status` message
  730. // is
  731. // exposed in different client libraries and different wire protocols,
  732. // it can be
  733. // mapped differently. For example, it will likely be mapped to some
  734. // exceptions
  735. // in Java, but more likely mapped to some error codes in C.
  736. //
  737. // # Other uses
  738. //
  739. // The error model and the `Status` message can be used in a variety
  740. // of
  741. // environments, either with or without APIs, to provide a
  742. // consistent developer experience across different
  743. // environments.
  744. //
  745. // Example uses of this error model include:
  746. //
  747. // - Partial errors. If a service needs to return partial errors to the
  748. // client,
  749. // it may embed the `Status` in the normal response to indicate the
  750. // partial
  751. // errors.
  752. //
  753. // - Workflow errors. A typical workflow has multiple steps. Each step
  754. // may
  755. // have a `Status` message for error reporting.
  756. //
  757. // - Batch operations. If a client uses batch request and batch
  758. // response, the
  759. // `Status` message should be used directly inside batch response,
  760. // one for
  761. // each error sub-response.
  762. //
  763. // - Asynchronous operations. If an API call embeds asynchronous
  764. // operation
  765. // results in its response, the status of those operations should
  766. // be
  767. // represented directly using the `Status` message.
  768. //
  769. // - Logging. If some API errors are stored in logs, the message
  770. // `Status` could
  771. // be used directly after any stripping needed for security/privacy
  772. // reasons.
  773. type Status struct {
  774. // Code: The status code, which should be an enum value of
  775. // google.rpc.Code.
  776. Code int64 `json:"code,omitempty"`
  777. // Details: A list of messages that carry the error details. There is a
  778. // common set of
  779. // message types for APIs to use.
  780. Details []googleapi.RawMessage `json:"details,omitempty"`
  781. // Message: A developer-facing error message, which should be in
  782. // English. Any
  783. // user-facing error message should be localized and sent in
  784. // the
  785. // google.rpc.Status.details field, or localized by the client.
  786. Message string `json:"message,omitempty"`
  787. // ForceSendFields is a list of field names (e.g. "Code") to
  788. // unconditionally include in API requests. By default, fields with
  789. // empty values are omitted from API requests. However, any non-pointer,
  790. // non-interface field appearing in ForceSendFields will be sent to the
  791. // server regardless of whether the field is empty or not. This may be
  792. // used to include empty fields in Patch requests.
  793. ForceSendFields []string `json:"-"`
  794. // NullFields is a list of field names (e.g. "Code") to include in API
  795. // requests with the JSON null value. By default, fields with empty
  796. // values are omitted from API requests. However, any field with an
  797. // empty value appearing in NullFields will be sent to the server as
  798. // null. It is an error if a field in this list has a non-empty value.
  799. // This may be used to include null fields in Patch requests.
  800. NullFields []string `json:"-"`
  801. }
  802. func (s *Status) MarshalJSON() ([]byte, error) {
  803. type NoMethod Status
  804. raw := NoMethod(*s)
  805. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  806. }
  807. // UpdatePhotoRequest: Request to update the metadata of a
  808. // Photo. Updating the pixels of a photo
  809. // is not supported.
  810. type UpdatePhotoRequest struct {
  811. // Photo: Required. Photo object containing the
  812. // new metadata.
  813. Photo *Photo `json:"photo,omitempty"`
  814. // UpdateMask: Mask that identifies fields on the photo metadata to
  815. // update.
  816. // If not present, the old Photo
  817. // metadata will be entirely replaced with the
  818. // new Photo metadata in this request.
  819. // The update fails if invalid fields are specified. Multiple fields can
  820. // be
  821. // specified in a comma-delimited list.
  822. //
  823. // The following fields are valid:
  824. //
  825. // * `pose.heading`
  826. // * `pose.latLngPair`
  827. // * `pose.pitch`
  828. // * `pose.roll`
  829. // * `pose.level`
  830. // * `pose.altitude`
  831. // * `connections`
  832. // * `places`
  833. //
  834. //
  835. // <aside class="note"><b>Note:</b> Repeated fields in
  836. // updateMask
  837. // mean the entire set of repeated values will be replaced with the
  838. // new
  839. // contents. For example, if
  840. // updateMask
  841. // contains `connections` and `UpdatePhotoRequest.photo.connections` is
  842. // empty,
  843. // all connections will be removed.</aside>
  844. UpdateMask string `json:"updateMask,omitempty"`
  845. // ForceSendFields is a list of field names (e.g. "Photo") to
  846. // unconditionally include in API requests. By default, fields with
  847. // empty values are omitted from API requests. However, any non-pointer,
  848. // non-interface field appearing in ForceSendFields will be sent to the
  849. // server regardless of whether the field is empty or not. This may be
  850. // used to include empty fields in Patch requests.
  851. ForceSendFields []string `json:"-"`
  852. // NullFields is a list of field names (e.g. "Photo") to include in API
  853. // requests with the JSON null value. By default, fields with empty
  854. // values are omitted from API requests. However, any field with an
  855. // empty value appearing in NullFields will be sent to the server as
  856. // null. It is an error if a field in this list has a non-empty value.
  857. // This may be used to include null fields in Patch requests.
  858. NullFields []string `json:"-"`
  859. }
  860. func (s *UpdatePhotoRequest) MarshalJSON() ([]byte, error) {
  861. type NoMethod UpdatePhotoRequest
  862. raw := NoMethod(*s)
  863. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  864. }
  865. // UploadRef: Upload reference for media files.
  866. type UploadRef struct {
  867. // UploadUrl: Required. An upload reference should be unique for each
  868. // user. It follows
  869. // the
  870. // form:
  871. // "https://streetviewpublish.googleapis.com/media/user/{account_id
  872. // }/photo/{upload_reference}"
  873. UploadUrl string `json:"uploadUrl,omitempty"`
  874. // ServerResponse contains the HTTP response code and headers from the
  875. // server.
  876. googleapi.ServerResponse `json:"-"`
  877. // ForceSendFields is a list of field names (e.g. "UploadUrl") 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. "UploadUrl") to include in
  885. // API requests with the JSON null value. By default, fields with empty
  886. // values are omitted from API requests. However, any field with an
  887. // 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 *UploadRef) MarshalJSON() ([]byte, error) {
  893. type NoMethod UploadRef
  894. raw := NoMethod(*s)
  895. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  896. }
  897. // method id "streetviewpublish.photo.create":
  898. type PhotoCreateCall struct {
  899. s *Service
  900. photo *Photo
  901. urlParams_ gensupport.URLParams
  902. ctx_ context.Context
  903. header_ http.Header
  904. }
  905. // Create: After the client finishes uploading the photo with the
  906. // returned
  907. // UploadRef,
  908. // CreatePhoto
  909. // publishes the uploaded Photo to
  910. // Street View on Google Maps.
  911. //
  912. // Currently, the only way to set heading, pitch, and roll in
  913. // CreatePhoto is
  914. // through the [Photo Sphere
  915. // XMP
  916. // metadata](https://developers.google.com/streetview/spherical-metad
  917. // ata) in
  918. // the photo bytes. The `pose.heading`, `pose.pitch`,
  919. // `pose.roll`,
  920. // `pose.altitude`, and `pose.level` fields in Pose are ignored
  921. // for
  922. // CreatePhoto.
  923. //
  924. // This method returns the following error codes:
  925. //
  926. // * google.rpc.Code.INVALID_ARGUMENT if the request is malformed or
  927. // if
  928. // the uploaded photo is not a 360 photo.
  929. // * google.rpc.Code.NOT_FOUND if the upload reference does not exist.
  930. // * google.rpc.Code.RESOURCE_EXHAUSTED if the account has reached
  931. // the
  932. // storage limit.
  933. func (r *PhotoService) Create(photo *Photo) *PhotoCreateCall {
  934. c := &PhotoCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  935. c.photo = photo
  936. return c
  937. }
  938. // Fields allows partial responses to be retrieved. See
  939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  940. // for more information.
  941. func (c *PhotoCreateCall) Fields(s ...googleapi.Field) *PhotoCreateCall {
  942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  943. return c
  944. }
  945. // Context sets the context to be used in this call's Do method. Any
  946. // pending HTTP request will be aborted if the provided context is
  947. // canceled.
  948. func (c *PhotoCreateCall) Context(ctx context.Context) *PhotoCreateCall {
  949. c.ctx_ = ctx
  950. return c
  951. }
  952. // Header returns an http.Header that can be modified by the caller to
  953. // add HTTP headers to the request.
  954. func (c *PhotoCreateCall) Header() http.Header {
  955. if c.header_ == nil {
  956. c.header_ = make(http.Header)
  957. }
  958. return c.header_
  959. }
  960. func (c *PhotoCreateCall) doRequest(alt string) (*http.Response, error) {
  961. reqHeaders := make(http.Header)
  962. for k, v := range c.header_ {
  963. reqHeaders[k] = v
  964. }
  965. reqHeaders.Set("User-Agent", c.s.userAgent())
  966. var body io.Reader = nil
  967. body, err := googleapi.WithoutDataWrapper.JSONReader(c.photo)
  968. if err != nil {
  969. return nil, err
  970. }
  971. reqHeaders.Set("Content-Type", "application/json")
  972. c.urlParams_.Set("alt", alt)
  973. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photo")
  974. urls += "?" + c.urlParams_.Encode()
  975. req, _ := http.NewRequest("POST", urls, body)
  976. req.Header = reqHeaders
  977. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  978. }
  979. // Do executes the "streetviewpublish.photo.create" call.
  980. // Exactly one of *Photo or error will be non-nil. Any non-2xx status
  981. // code is an error. Response headers are in either
  982. // *Photo.ServerResponse.Header or (if a response was returned at all)
  983. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  984. // check whether the returned error was because http.StatusNotModified
  985. // was returned.
  986. func (c *PhotoCreateCall) Do(opts ...googleapi.CallOption) (*Photo, error) {
  987. gensupport.SetOptions(c.urlParams_, opts...)
  988. res, err := c.doRequest("json")
  989. if res != nil && res.StatusCode == http.StatusNotModified {
  990. if res.Body != nil {
  991. res.Body.Close()
  992. }
  993. return nil, &googleapi.Error{
  994. Code: res.StatusCode,
  995. Header: res.Header,
  996. }
  997. }
  998. if err != nil {
  999. return nil, err
  1000. }
  1001. defer googleapi.CloseBody(res)
  1002. if err := googleapi.CheckResponse(res); err != nil {
  1003. return nil, err
  1004. }
  1005. ret := &Photo{
  1006. ServerResponse: googleapi.ServerResponse{
  1007. Header: res.Header,
  1008. HTTPStatusCode: res.StatusCode,
  1009. },
  1010. }
  1011. target := &ret
  1012. if err := gensupport.DecodeResponse(target, res); err != nil {
  1013. return nil, err
  1014. }
  1015. return ret, nil
  1016. // {
  1017. // "description": "After the client finishes uploading the photo with the returned\nUploadRef,\nCreatePhoto\npublishes the uploaded Photo to\nStreet View on Google Maps.\n\nCurrently, the only way to set heading, pitch, and roll in CreatePhoto is\nthrough the [Photo Sphere XMP\nmetadata](https://developers.google.com/streetview/spherical-metadata) in\nthe photo bytes. The `pose.heading`, `pose.pitch`, `pose.roll`,\n`pose.altitude`, and `pose.level` fields in Pose are ignored for\nCreatePhoto.\n\nThis method returns the following error codes:\n\n* google.rpc.Code.INVALID_ARGUMENT if the request is malformed or if\nthe uploaded photo is not a 360 photo.\n* google.rpc.Code.NOT_FOUND if the upload reference does not exist.\n* google.rpc.Code.RESOURCE_EXHAUSTED if the account has reached the\nstorage limit.",
  1018. // "flatPath": "v1/photo",
  1019. // "httpMethod": "POST",
  1020. // "id": "streetviewpublish.photo.create",
  1021. // "parameterOrder": [],
  1022. // "parameters": {},
  1023. // "path": "v1/photo",
  1024. // "request": {
  1025. // "$ref": "Photo"
  1026. // },
  1027. // "response": {
  1028. // "$ref": "Photo"
  1029. // },
  1030. // "scopes": [
  1031. // "https://www.googleapis.com/auth/streetviewpublish"
  1032. // ]
  1033. // }
  1034. }
  1035. // method id "streetviewpublish.photo.delete":
  1036. type PhotoDeleteCall struct {
  1037. s *Service
  1038. photoId string
  1039. urlParams_ gensupport.URLParams
  1040. ctx_ context.Context
  1041. header_ http.Header
  1042. }
  1043. // Delete: Deletes a Photo and its metadata.
  1044. //
  1045. // This method returns the following error codes:
  1046. //
  1047. // * google.rpc.Code.PERMISSION_DENIED if the requesting user did
  1048. // not
  1049. // create the requested photo.
  1050. // * google.rpc.Code.NOT_FOUND if the photo ID does not exist.
  1051. func (r *PhotoService) Delete(photoId string) *PhotoDeleteCall {
  1052. c := &PhotoDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1053. c.photoId = photoId
  1054. return c
  1055. }
  1056. // Fields allows partial responses to be retrieved. See
  1057. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1058. // for more information.
  1059. func (c *PhotoDeleteCall) Fields(s ...googleapi.Field) *PhotoDeleteCall {
  1060. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1061. return c
  1062. }
  1063. // Context sets the context to be used in this call's Do method. Any
  1064. // pending HTTP request will be aborted if the provided context is
  1065. // canceled.
  1066. func (c *PhotoDeleteCall) Context(ctx context.Context) *PhotoDeleteCall {
  1067. c.ctx_ = ctx
  1068. return c
  1069. }
  1070. // Header returns an http.Header that can be modified by the caller to
  1071. // add HTTP headers to the request.
  1072. func (c *PhotoDeleteCall) Header() http.Header {
  1073. if c.header_ == nil {
  1074. c.header_ = make(http.Header)
  1075. }
  1076. return c.header_
  1077. }
  1078. func (c *PhotoDeleteCall) doRequest(alt string) (*http.Response, error) {
  1079. reqHeaders := make(http.Header)
  1080. for k, v := range c.header_ {
  1081. reqHeaders[k] = v
  1082. }
  1083. reqHeaders.Set("User-Agent", c.s.userAgent())
  1084. var body io.Reader = nil
  1085. c.urlParams_.Set("alt", alt)
  1086. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photo/{photoId}")
  1087. urls += "?" + c.urlParams_.Encode()
  1088. req, _ := http.NewRequest("DELETE", urls, body)
  1089. req.Header = reqHeaders
  1090. googleapi.Expand(req.URL, map[string]string{
  1091. "photoId": c.photoId,
  1092. })
  1093. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1094. }
  1095. // Do executes the "streetviewpublish.photo.delete" call.
  1096. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1097. // code is an error. Response headers are in either
  1098. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1099. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1100. // check whether the returned error was because http.StatusNotModified
  1101. // was returned.
  1102. func (c *PhotoDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1103. gensupport.SetOptions(c.urlParams_, opts...)
  1104. res, err := c.doRequest("json")
  1105. if res != nil && res.StatusCode == http.StatusNotModified {
  1106. if res.Body != nil {
  1107. res.Body.Close()
  1108. }
  1109. return nil, &googleapi.Error{
  1110. Code: res.StatusCode,
  1111. Header: res.Header,
  1112. }
  1113. }
  1114. if err != nil {
  1115. return nil, err
  1116. }
  1117. defer googleapi.CloseBody(res)
  1118. if err := googleapi.CheckResponse(res); err != nil {
  1119. return nil, err
  1120. }
  1121. ret := &Empty{
  1122. ServerResponse: googleapi.ServerResponse{
  1123. Header: res.Header,
  1124. HTTPStatusCode: res.StatusCode,
  1125. },
  1126. }
  1127. target := &ret
  1128. if err := gensupport.DecodeResponse(target, res); err != nil {
  1129. return nil, err
  1130. }
  1131. return ret, nil
  1132. // {
  1133. // "description": "Deletes a Photo and its metadata.\n\nThis method returns the following error codes:\n\n* google.rpc.Code.PERMISSION_DENIED if the requesting user did not\ncreate the requested photo.\n* google.rpc.Code.NOT_FOUND if the photo ID does not exist.",
  1134. // "flatPath": "v1/photo/{photoId}",
  1135. // "httpMethod": "DELETE",
  1136. // "id": "streetviewpublish.photo.delete",
  1137. // "parameterOrder": [
  1138. // "photoId"
  1139. // ],
  1140. // "parameters": {
  1141. // "photoId": {
  1142. // "description": "Required. ID of the Photo.",
  1143. // "location": "path",
  1144. // "required": true,
  1145. // "type": "string"
  1146. // }
  1147. // },
  1148. // "path": "v1/photo/{photoId}",
  1149. // "response": {
  1150. // "$ref": "Empty"
  1151. // },
  1152. // "scopes": [
  1153. // "https://www.googleapis.com/auth/streetviewpublish"
  1154. // ]
  1155. // }
  1156. }
  1157. // method id "streetviewpublish.photo.get":
  1158. type PhotoGetCall struct {
  1159. s *Service
  1160. photoId string
  1161. urlParams_ gensupport.URLParams
  1162. ifNoneMatch_ string
  1163. ctx_ context.Context
  1164. header_ http.Header
  1165. }
  1166. // Get: Gets the metadata of the specified
  1167. // Photo.
  1168. //
  1169. // This method returns the following error codes:
  1170. //
  1171. // * google.rpc.Code.PERMISSION_DENIED if the requesting user did
  1172. // not
  1173. // create the requested Photo.
  1174. // * google.rpc.Code.NOT_FOUND if the requested
  1175. // Photo does not exist.
  1176. // * google.rpc.Code.UNAVAILABLE if the requested
  1177. // Photo is still being indexed.
  1178. func (r *PhotoService) Get(photoId string) *PhotoGetCall {
  1179. c := &PhotoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1180. c.photoId = photoId
  1181. return c
  1182. }
  1183. // View sets the optional parameter "view": Specifies if a download URL
  1184. // for the photo bytes should be returned in the
  1185. // Photo response.
  1186. //
  1187. // Possible values:
  1188. // "BASIC"
  1189. // "INCLUDE_DOWNLOAD_URL"
  1190. func (c *PhotoGetCall) View(view string) *PhotoGetCall {
  1191. c.urlParams_.Set("view", view)
  1192. return c
  1193. }
  1194. // Fields allows partial responses to be retrieved. See
  1195. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1196. // for more information.
  1197. func (c *PhotoGetCall) Fields(s ...googleapi.Field) *PhotoGetCall {
  1198. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1199. return c
  1200. }
  1201. // IfNoneMatch sets the optional parameter which makes the operation
  1202. // fail if the object's ETag matches the given value. This is useful for
  1203. // getting updates only after the object has changed since the last
  1204. // request. Use googleapi.IsNotModified to check whether the response
  1205. // error from Do is the result of In-None-Match.
  1206. func (c *PhotoGetCall) IfNoneMatch(entityTag string) *PhotoGetCall {
  1207. c.ifNoneMatch_ = entityTag
  1208. return c
  1209. }
  1210. // Context sets the context to be used in this call's Do method. Any
  1211. // pending HTTP request will be aborted if the provided context is
  1212. // canceled.
  1213. func (c *PhotoGetCall) Context(ctx context.Context) *PhotoGetCall {
  1214. c.ctx_ = ctx
  1215. return c
  1216. }
  1217. // Header returns an http.Header that can be modified by the caller to
  1218. // add HTTP headers to the request.
  1219. func (c *PhotoGetCall) Header() http.Header {
  1220. if c.header_ == nil {
  1221. c.header_ = make(http.Header)
  1222. }
  1223. return c.header_
  1224. }
  1225. func (c *PhotoGetCall) doRequest(alt string) (*http.Response, error) {
  1226. reqHeaders := make(http.Header)
  1227. for k, v := range c.header_ {
  1228. reqHeaders[k] = v
  1229. }
  1230. reqHeaders.Set("User-Agent", c.s.userAgent())
  1231. if c.ifNoneMatch_ != "" {
  1232. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1233. }
  1234. var body io.Reader = nil
  1235. c.urlParams_.Set("alt", alt)
  1236. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photo/{photoId}")
  1237. urls += "?" + c.urlParams_.Encode()
  1238. req, _ := http.NewRequest("GET", urls, body)
  1239. req.Header = reqHeaders
  1240. googleapi.Expand(req.URL, map[string]string{
  1241. "photoId": c.photoId,
  1242. })
  1243. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1244. }
  1245. // Do executes the "streetviewpublish.photo.get" call.
  1246. // Exactly one of *Photo or error will be non-nil. Any non-2xx status
  1247. // code is an error. Response headers are in either
  1248. // *Photo.ServerResponse.Header or (if a response was returned at all)
  1249. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1250. // check whether the returned error was because http.StatusNotModified
  1251. // was returned.
  1252. func (c *PhotoGetCall) Do(opts ...googleapi.CallOption) (*Photo, error) {
  1253. gensupport.SetOptions(c.urlParams_, opts...)
  1254. res, err := c.doRequest("json")
  1255. if res != nil && res.StatusCode == http.StatusNotModified {
  1256. if res.Body != nil {
  1257. res.Body.Close()
  1258. }
  1259. return nil, &googleapi.Error{
  1260. Code: res.StatusCode,
  1261. Header: res.Header,
  1262. }
  1263. }
  1264. if err != nil {
  1265. return nil, err
  1266. }
  1267. defer googleapi.CloseBody(res)
  1268. if err := googleapi.CheckResponse(res); err != nil {
  1269. return nil, err
  1270. }
  1271. ret := &Photo{
  1272. ServerResponse: googleapi.ServerResponse{
  1273. Header: res.Header,
  1274. HTTPStatusCode: res.StatusCode,
  1275. },
  1276. }
  1277. target := &ret
  1278. if err := gensupport.DecodeResponse(target, res); err != nil {
  1279. return nil, err
  1280. }
  1281. return ret, nil
  1282. // {
  1283. // "description": "Gets the metadata of the specified\nPhoto.\n\nThis method returns the following error codes:\n\n* google.rpc.Code.PERMISSION_DENIED if the requesting user did not\ncreate the requested Photo.\n* google.rpc.Code.NOT_FOUND if the requested\nPhoto does not exist.\n* google.rpc.Code.UNAVAILABLE if the requested\nPhoto is still being indexed.",
  1284. // "flatPath": "v1/photo/{photoId}",
  1285. // "httpMethod": "GET",
  1286. // "id": "streetviewpublish.photo.get",
  1287. // "parameterOrder": [
  1288. // "photoId"
  1289. // ],
  1290. // "parameters": {
  1291. // "photoId": {
  1292. // "description": "Required. ID of the Photo.",
  1293. // "location": "path",
  1294. // "required": true,
  1295. // "type": "string"
  1296. // },
  1297. // "view": {
  1298. // "description": "Specifies if a download URL for the photo bytes should be returned in the\nPhoto response.",
  1299. // "enum": [
  1300. // "BASIC",
  1301. // "INCLUDE_DOWNLOAD_URL"
  1302. // ],
  1303. // "location": "query",
  1304. // "type": "string"
  1305. // }
  1306. // },
  1307. // "path": "v1/photo/{photoId}",
  1308. // "response": {
  1309. // "$ref": "Photo"
  1310. // },
  1311. // "scopes": [
  1312. // "https://www.googleapis.com/auth/streetviewpublish"
  1313. // ]
  1314. // }
  1315. }
  1316. // method id "streetviewpublish.photo.startUpload":
  1317. type PhotoStartUploadCall struct {
  1318. s *Service
  1319. empty *Empty
  1320. urlParams_ gensupport.URLParams
  1321. ctx_ context.Context
  1322. header_ http.Header
  1323. }
  1324. // StartUpload: Creates an upload session to start uploading photo
  1325. // bytes. The upload URL of
  1326. // the returned UploadRef is used to
  1327. // upload the bytes for the Photo.
  1328. //
  1329. // In addition to the photo requirements shown
  1330. // in
  1331. // https://support.google.com/maps/answer/7012050?hl=en&ref_topic=6275
  1332. // 604,
  1333. // the photo must also meet the following requirements:
  1334. //
  1335. // * Photo Sphere XMP metadata must be included in the photo medadata.
  1336. // See
  1337. // https://developers.google.com/streetview/spherical-metadata for
  1338. // the
  1339. // required fields.
  1340. // * The pixel size of the photo must meet the size requirements listed
  1341. // in
  1342. // https://support.google.com/maps/answer/7012050?hl=en&ref_topic=6275
  1343. // 604, and
  1344. // the photo must be a full 360 horizontally.
  1345. //
  1346. // After the upload is complete, the
  1347. // UploadRef is used with
  1348. // CreatePhoto
  1349. // to create the Photo object entry.
  1350. func (r *PhotoService) StartUpload(empty *Empty) *PhotoStartUploadCall {
  1351. c := &PhotoStartUploadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1352. c.empty = empty
  1353. return c
  1354. }
  1355. // Fields allows partial responses to be retrieved. See
  1356. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1357. // for more information.
  1358. func (c *PhotoStartUploadCall) Fields(s ...googleapi.Field) *PhotoStartUploadCall {
  1359. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1360. return c
  1361. }
  1362. // Context sets the context to be used in this call's Do method. Any
  1363. // pending HTTP request will be aborted if the provided context is
  1364. // canceled.
  1365. func (c *PhotoStartUploadCall) Context(ctx context.Context) *PhotoStartUploadCall {
  1366. c.ctx_ = ctx
  1367. return c
  1368. }
  1369. // Header returns an http.Header that can be modified by the caller to
  1370. // add HTTP headers to the request.
  1371. func (c *PhotoStartUploadCall) Header() http.Header {
  1372. if c.header_ == nil {
  1373. c.header_ = make(http.Header)
  1374. }
  1375. return c.header_
  1376. }
  1377. func (c *PhotoStartUploadCall) doRequest(alt string) (*http.Response, error) {
  1378. reqHeaders := make(http.Header)
  1379. for k, v := range c.header_ {
  1380. reqHeaders[k] = v
  1381. }
  1382. reqHeaders.Set("User-Agent", c.s.userAgent())
  1383. var body io.Reader = nil
  1384. body, err := googleapi.WithoutDataWrapper.JSONReader(c.empty)
  1385. if err != nil {
  1386. return nil, err
  1387. }
  1388. reqHeaders.Set("Content-Type", "application/json")
  1389. c.urlParams_.Set("alt", alt)
  1390. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photo:startUpload")
  1391. urls += "?" + c.urlParams_.Encode()
  1392. req, _ := http.NewRequest("POST", urls, body)
  1393. req.Header = reqHeaders
  1394. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1395. }
  1396. // Do executes the "streetviewpublish.photo.startUpload" call.
  1397. // Exactly one of *UploadRef or error will be non-nil. Any non-2xx
  1398. // status code is an error. Response headers are in either
  1399. // *UploadRef.ServerResponse.Header or (if a response was returned at
  1400. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1401. // to check whether the returned error was because
  1402. // http.StatusNotModified was returned.
  1403. func (c *PhotoStartUploadCall) Do(opts ...googleapi.CallOption) (*UploadRef, error) {
  1404. gensupport.SetOptions(c.urlParams_, opts...)
  1405. res, err := c.doRequest("json")
  1406. if res != nil && res.StatusCode == http.StatusNotModified {
  1407. if res.Body != nil {
  1408. res.Body.Close()
  1409. }
  1410. return nil, &googleapi.Error{
  1411. Code: res.StatusCode,
  1412. Header: res.Header,
  1413. }
  1414. }
  1415. if err != nil {
  1416. return nil, err
  1417. }
  1418. defer googleapi.CloseBody(res)
  1419. if err := googleapi.CheckResponse(res); err != nil {
  1420. return nil, err
  1421. }
  1422. ret := &UploadRef{
  1423. ServerResponse: googleapi.ServerResponse{
  1424. Header: res.Header,
  1425. HTTPStatusCode: res.StatusCode,
  1426. },
  1427. }
  1428. target := &ret
  1429. if err := gensupport.DecodeResponse(target, res); err != nil {
  1430. return nil, err
  1431. }
  1432. return ret, nil
  1433. // {
  1434. // "description": "Creates an upload session to start uploading photo bytes. The upload URL of\nthe returned UploadRef is used to\nupload the bytes for the Photo.\n\nIn addition to the photo requirements shown in\nhttps://support.google.com/maps/answer/7012050?hl=en\u0026ref_topic=6275604,\nthe photo must also meet the following requirements:\n\n* Photo Sphere XMP metadata must be included in the photo medadata. See\nhttps://developers.google.com/streetview/spherical-metadata for the\nrequired fields.\n* The pixel size of the photo must meet the size requirements listed in\nhttps://support.google.com/maps/answer/7012050?hl=en\u0026ref_topic=6275604, and\nthe photo must be a full 360 horizontally.\n\nAfter the upload is complete, the\nUploadRef is used with\nCreatePhoto\nto create the Photo object entry.",
  1435. // "flatPath": "v1/photo:startUpload",
  1436. // "httpMethod": "POST",
  1437. // "id": "streetviewpublish.photo.startUpload",
  1438. // "parameterOrder": [],
  1439. // "parameters": {},
  1440. // "path": "v1/photo:startUpload",
  1441. // "request": {
  1442. // "$ref": "Empty"
  1443. // },
  1444. // "response": {
  1445. // "$ref": "UploadRef"
  1446. // },
  1447. // "scopes": [
  1448. // "https://www.googleapis.com/auth/streetviewpublish"
  1449. // ]
  1450. // }
  1451. }
  1452. // method id "streetviewpublish.photo.update":
  1453. type PhotoUpdateCall struct {
  1454. s *Service
  1455. id string
  1456. photo *Photo
  1457. urlParams_ gensupport.URLParams
  1458. ctx_ context.Context
  1459. header_ http.Header
  1460. }
  1461. // Update: Updates the metadata of a Photo, such
  1462. // as pose, place association, connections, etc. Changing the pixels of
  1463. // a
  1464. // photo is not supported.
  1465. //
  1466. // Only the fields specified in the
  1467. // updateMask
  1468. // field are used. If `updateMask` is not present, the update applies to
  1469. // all
  1470. // fields.
  1471. //
  1472. // <aside class="note"><b>Note:</b> To
  1473. // update
  1474. // Pose.altitude,
  1475. // Pose.latLngPair has to be
  1476. // filled as well. Otherwise, the request will fail.</aside>
  1477. //
  1478. // This method returns the following error codes:
  1479. //
  1480. // * google.rpc.Code.PERMISSION_DENIED if the requesting user did
  1481. // not
  1482. // create the requested photo.
  1483. // * google.rpc.Code.INVALID_ARGUMENT if the request is malformed.
  1484. // * google.rpc.Code.NOT_FOUND if the requested photo does not exist.
  1485. // * google.rpc.Code.UNAVAILABLE if the requested
  1486. // Photo is still being indexed.
  1487. func (r *PhotoService) Update(id string, photo *Photo) *PhotoUpdateCall {
  1488. c := &PhotoUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1489. c.id = id
  1490. c.photo = photo
  1491. return c
  1492. }
  1493. // UpdateMask sets the optional parameter "updateMask": Mask that
  1494. // identifies fields on the photo metadata to update.
  1495. // If not present, the old Photo
  1496. // metadata will be entirely replaced with the
  1497. // new Photo metadata in this request.
  1498. // The update fails if invalid fields are specified. Multiple fields can
  1499. // be
  1500. // specified in a comma-delimited list.
  1501. //
  1502. // The following fields are valid:
  1503. //
  1504. // * `pose.heading`
  1505. // * `pose.latLngPair`
  1506. // * `pose.pitch`
  1507. // * `pose.roll`
  1508. // * `pose.level`
  1509. // * `pose.altitude`
  1510. // * `connections`
  1511. // * `places`
  1512. //
  1513. //
  1514. // <aside class="note"><b>Note:</b> Repeated fields in
  1515. // updateMask
  1516. // mean the entire set of repeated values will be replaced with the
  1517. // new
  1518. // contents. For example, if
  1519. // updateMask
  1520. // contains `connections` and `UpdatePhotoRequest.photo.connections` is
  1521. // empty,
  1522. // all connections will be removed.</aside>
  1523. func (c *PhotoUpdateCall) UpdateMask(updateMask string) *PhotoUpdateCall {
  1524. c.urlParams_.Set("updateMask", updateMask)
  1525. return c
  1526. }
  1527. // Fields allows partial responses to be retrieved. See
  1528. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1529. // for more information.
  1530. func (c *PhotoUpdateCall) Fields(s ...googleapi.Field) *PhotoUpdateCall {
  1531. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1532. return c
  1533. }
  1534. // Context sets the context to be used in this call's Do method. Any
  1535. // pending HTTP request will be aborted if the provided context is
  1536. // canceled.
  1537. func (c *PhotoUpdateCall) Context(ctx context.Context) *PhotoUpdateCall {
  1538. c.ctx_ = ctx
  1539. return c
  1540. }
  1541. // Header returns an http.Header that can be modified by the caller to
  1542. // add HTTP headers to the request.
  1543. func (c *PhotoUpdateCall) Header() http.Header {
  1544. if c.header_ == nil {
  1545. c.header_ = make(http.Header)
  1546. }
  1547. return c.header_
  1548. }
  1549. func (c *PhotoUpdateCall) doRequest(alt string) (*http.Response, error) {
  1550. reqHeaders := make(http.Header)
  1551. for k, v := range c.header_ {
  1552. reqHeaders[k] = v
  1553. }
  1554. reqHeaders.Set("User-Agent", c.s.userAgent())
  1555. var body io.Reader = nil
  1556. body, err := googleapi.WithoutDataWrapper.JSONReader(c.photo)
  1557. if err != nil {
  1558. return nil, err
  1559. }
  1560. reqHeaders.Set("Content-Type", "application/json")
  1561. c.urlParams_.Set("alt", alt)
  1562. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photo/{id}")
  1563. urls += "?" + c.urlParams_.Encode()
  1564. req, _ := http.NewRequest("PUT", urls, body)
  1565. req.Header = reqHeaders
  1566. googleapi.Expand(req.URL, map[string]string{
  1567. "id": c.id,
  1568. })
  1569. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1570. }
  1571. // Do executes the "streetviewpublish.photo.update" call.
  1572. // Exactly one of *Photo or error will be non-nil. Any non-2xx status
  1573. // code is an error. Response headers are in either
  1574. // *Photo.ServerResponse.Header or (if a response was returned at all)
  1575. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1576. // check whether the returned error was because http.StatusNotModified
  1577. // was returned.
  1578. func (c *PhotoUpdateCall) Do(opts ...googleapi.CallOption) (*Photo, error) {
  1579. gensupport.SetOptions(c.urlParams_, opts...)
  1580. res, err := c.doRequest("json")
  1581. if res != nil && res.StatusCode == http.StatusNotModified {
  1582. if res.Body != nil {
  1583. res.Body.Close()
  1584. }
  1585. return nil, &googleapi.Error{
  1586. Code: res.StatusCode,
  1587. Header: res.Header,
  1588. }
  1589. }
  1590. if err != nil {
  1591. return nil, err
  1592. }
  1593. defer googleapi.CloseBody(res)
  1594. if err := googleapi.CheckResponse(res); err != nil {
  1595. return nil, err
  1596. }
  1597. ret := &Photo{
  1598. ServerResponse: googleapi.ServerResponse{
  1599. Header: res.Header,
  1600. HTTPStatusCode: res.StatusCode,
  1601. },
  1602. }
  1603. target := &ret
  1604. if err := gensupport.DecodeResponse(target, res); err != nil {
  1605. return nil, err
  1606. }
  1607. return ret, nil
  1608. // {
  1609. // "description": "Updates the metadata of a Photo, such\nas pose, place association, connections, etc. Changing the pixels of a\nphoto is not supported.\n\nOnly the fields specified in the\nupdateMask\nfield are used. If `updateMask` is not present, the update applies to all\nfields.\n\n\u003caside class=\"note\"\u003e\u003cb\u003eNote:\u003c/b\u003e To update\nPose.altitude,\nPose.latLngPair has to be\nfilled as well. Otherwise, the request will fail.\u003c/aside\u003e\n\nThis method returns the following error codes:\n\n* google.rpc.Code.PERMISSION_DENIED if the requesting user did not\ncreate the requested photo.\n* google.rpc.Code.INVALID_ARGUMENT if the request is malformed.\n* google.rpc.Code.NOT_FOUND if the requested photo does not exist.\n* google.rpc.Code.UNAVAILABLE if the requested\nPhoto is still being indexed.",
  1610. // "flatPath": "v1/photo/{id}",
  1611. // "httpMethod": "PUT",
  1612. // "id": "streetviewpublish.photo.update",
  1613. // "parameterOrder": [
  1614. // "id"
  1615. // ],
  1616. // "parameters": {
  1617. // "id": {
  1618. // "description": "Required. A unique identifier for a photo.",
  1619. // "location": "path",
  1620. // "required": true,
  1621. // "type": "string"
  1622. // },
  1623. // "updateMask": {
  1624. // "description": "Mask that identifies fields on the photo metadata to update.\nIf not present, the old Photo\nmetadata will be entirely replaced with the\nnew Photo metadata in this request.\nThe update fails if invalid fields are specified. Multiple fields can be\nspecified in a comma-delimited list.\n\nThe following fields are valid:\n\n* `pose.heading`\n* `pose.latLngPair`\n* `pose.pitch`\n* `pose.roll`\n* `pose.level`\n* `pose.altitude`\n* `connections`\n* `places`\n\n\n\u003caside class=\"note\"\u003e\u003cb\u003eNote:\u003c/b\u003e Repeated fields in\nupdateMask\nmean the entire set of repeated values will be replaced with the new\ncontents. For example, if\nupdateMask\ncontains `connections` and `UpdatePhotoRequest.photo.connections` is empty,\nall connections will be removed.\u003c/aside\u003e",
  1625. // "format": "google-fieldmask",
  1626. // "location": "query",
  1627. // "type": "string"
  1628. // }
  1629. // },
  1630. // "path": "v1/photo/{id}",
  1631. // "request": {
  1632. // "$ref": "Photo"
  1633. // },
  1634. // "response": {
  1635. // "$ref": "Photo"
  1636. // },
  1637. // "scopes": [
  1638. // "https://www.googleapis.com/auth/streetviewpublish"
  1639. // ]
  1640. // }
  1641. }
  1642. // method id "streetviewpublish.photos.batchDelete":
  1643. type PhotosBatchDeleteCall struct {
  1644. s *Service
  1645. batchdeletephotosrequest *BatchDeletePhotosRequest
  1646. urlParams_ gensupport.URLParams
  1647. ctx_ context.Context
  1648. header_ http.Header
  1649. }
  1650. // BatchDelete: Deletes a list of Photos and their
  1651. // metadata.
  1652. //
  1653. // Note that if
  1654. // BatchDeletePhotos
  1655. // fails, either critical fields are missing or there was an
  1656. // authentication
  1657. // error. Even if
  1658. // BatchDeletePhotos
  1659. // succeeds, there may have been failures for single photos in the
  1660. // batch.
  1661. // These failures will be specified in
  1662. // each
  1663. // PhotoResponse.status
  1664. // in
  1665. // BatchDeletePhotosResponse.results.
  1666. // See
  1667. // De
  1668. // letePhoto
  1669. // for specific failures that can occur per photo.
  1670. func (r *PhotosService) BatchDelete(batchdeletephotosrequest *BatchDeletePhotosRequest) *PhotosBatchDeleteCall {
  1671. c := &PhotosBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1672. c.batchdeletephotosrequest = batchdeletephotosrequest
  1673. return c
  1674. }
  1675. // Fields allows partial responses to be retrieved. See
  1676. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1677. // for more information.
  1678. func (c *PhotosBatchDeleteCall) Fields(s ...googleapi.Field) *PhotosBatchDeleteCall {
  1679. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1680. return c
  1681. }
  1682. // Context sets the context to be used in this call's Do method. Any
  1683. // pending HTTP request will be aborted if the provided context is
  1684. // canceled.
  1685. func (c *PhotosBatchDeleteCall) Context(ctx context.Context) *PhotosBatchDeleteCall {
  1686. c.ctx_ = ctx
  1687. return c
  1688. }
  1689. // Header returns an http.Header that can be modified by the caller to
  1690. // add HTTP headers to the request.
  1691. func (c *PhotosBatchDeleteCall) Header() http.Header {
  1692. if c.header_ == nil {
  1693. c.header_ = make(http.Header)
  1694. }
  1695. return c.header_
  1696. }
  1697. func (c *PhotosBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
  1698. reqHeaders := make(http.Header)
  1699. for k, v := range c.header_ {
  1700. reqHeaders[k] = v
  1701. }
  1702. reqHeaders.Set("User-Agent", c.s.userAgent())
  1703. var body io.Reader = nil
  1704. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletephotosrequest)
  1705. if err != nil {
  1706. return nil, err
  1707. }
  1708. reqHeaders.Set("Content-Type", "application/json")
  1709. c.urlParams_.Set("alt", alt)
  1710. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photos:batchDelete")
  1711. urls += "?" + c.urlParams_.Encode()
  1712. req, _ := http.NewRequest("POST", urls, body)
  1713. req.Header = reqHeaders
  1714. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1715. }
  1716. // Do executes the "streetviewpublish.photos.batchDelete" call.
  1717. // Exactly one of *BatchDeletePhotosResponse or error will be non-nil.
  1718. // Any non-2xx status code is an error. Response headers are in either
  1719. // *BatchDeletePhotosResponse.ServerResponse.Header or (if a response
  1720. // was returned at all) in error.(*googleapi.Error).Header. Use
  1721. // googleapi.IsNotModified to check whether the returned error was
  1722. // because http.StatusNotModified was returned.
  1723. func (c *PhotosBatchDeleteCall) Do(opts ...googleapi.CallOption) (*BatchDeletePhotosResponse, error) {
  1724. gensupport.SetOptions(c.urlParams_, opts...)
  1725. res, err := c.doRequest("json")
  1726. if res != nil && res.StatusCode == http.StatusNotModified {
  1727. if res.Body != nil {
  1728. res.Body.Close()
  1729. }
  1730. return nil, &googleapi.Error{
  1731. Code: res.StatusCode,
  1732. Header: res.Header,
  1733. }
  1734. }
  1735. if err != nil {
  1736. return nil, err
  1737. }
  1738. defer googleapi.CloseBody(res)
  1739. if err := googleapi.CheckResponse(res); err != nil {
  1740. return nil, err
  1741. }
  1742. ret := &BatchDeletePhotosResponse{
  1743. ServerResponse: googleapi.ServerResponse{
  1744. Header: res.Header,
  1745. HTTPStatusCode: res.StatusCode,
  1746. },
  1747. }
  1748. target := &ret
  1749. if err := gensupport.DecodeResponse(target, res); err != nil {
  1750. return nil, err
  1751. }
  1752. return ret, nil
  1753. // {
  1754. // "description": "Deletes a list of Photos and their\nmetadata.\n\nNote that if\nBatchDeletePhotos\nfails, either critical fields are missing or there was an authentication\nerror. Even if\nBatchDeletePhotos\nsucceeds, there may have been failures for single photos in the batch.\nThese failures will be specified in each\nPhotoResponse.status\nin\nBatchDeletePhotosResponse.results.\nSee\nDeletePhoto\nfor specific failures that can occur per photo.",
  1755. // "flatPath": "v1/photos:batchDelete",
  1756. // "httpMethod": "POST",
  1757. // "id": "streetviewpublish.photos.batchDelete",
  1758. // "parameterOrder": [],
  1759. // "parameters": {},
  1760. // "path": "v1/photos:batchDelete",
  1761. // "request": {
  1762. // "$ref": "BatchDeletePhotosRequest"
  1763. // },
  1764. // "response": {
  1765. // "$ref": "BatchDeletePhotosResponse"
  1766. // },
  1767. // "scopes": [
  1768. // "https://www.googleapis.com/auth/streetviewpublish"
  1769. // ]
  1770. // }
  1771. }
  1772. // method id "streetviewpublish.photos.batchGet":
  1773. type PhotosBatchGetCall struct {
  1774. s *Service
  1775. urlParams_ gensupport.URLParams
  1776. ifNoneMatch_ string
  1777. ctx_ context.Context
  1778. header_ http.Header
  1779. }
  1780. // BatchGet: Gets the metadata of the specified
  1781. // Photo batch.
  1782. //
  1783. // Note that if
  1784. // BatchGetPhotos
  1785. // fails, either critical fields are missing or there was an
  1786. // authentication
  1787. // error. Even if
  1788. // BatchGetPhotos
  1789. // succeeds, there may have been failures for single photos in the
  1790. // batch.
  1791. // These failures will be specified in
  1792. // each
  1793. // PhotoResponse.status
  1794. // in
  1795. // BatchGetPhotosResponse.results.
  1796. // See
  1797. // GetPh
  1798. // oto
  1799. // for specific failures that can occur per photo.
  1800. func (r *PhotosService) BatchGet() *PhotosBatchGetCall {
  1801. c := &PhotosBatchGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1802. return c
  1803. }
  1804. // PhotoIds sets the optional parameter "photoIds": Required. IDs of the
  1805. // Photos. For HTTP
  1806. // GET requests, the URL query parameter should
  1807. // be
  1808. // `photoIds=<id1>&photoIds=<id2>&...`.
  1809. func (c *PhotosBatchGetCall) PhotoIds(photoIds ...string) *PhotosBatchGetCall {
  1810. c.urlParams_.SetMulti("photoIds", append([]string{}, photoIds...))
  1811. return c
  1812. }
  1813. // View sets the optional parameter "view": Specifies if a download URL
  1814. // for the photo bytes should be returned in the
  1815. // Photo response.
  1816. //
  1817. // Possible values:
  1818. // "BASIC"
  1819. // "INCLUDE_DOWNLOAD_URL"
  1820. func (c *PhotosBatchGetCall) View(view string) *PhotosBatchGetCall {
  1821. c.urlParams_.Set("view", view)
  1822. return c
  1823. }
  1824. // Fields allows partial responses to be retrieved. See
  1825. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1826. // for more information.
  1827. func (c *PhotosBatchGetCall) Fields(s ...googleapi.Field) *PhotosBatchGetCall {
  1828. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1829. return c
  1830. }
  1831. // IfNoneMatch sets the optional parameter which makes the operation
  1832. // fail if the object's ETag matches the given value. This is useful for
  1833. // getting updates only after the object has changed since the last
  1834. // request. Use googleapi.IsNotModified to check whether the response
  1835. // error from Do is the result of In-None-Match.
  1836. func (c *PhotosBatchGetCall) IfNoneMatch(entityTag string) *PhotosBatchGetCall {
  1837. c.ifNoneMatch_ = entityTag
  1838. return c
  1839. }
  1840. // Context sets the context to be used in this call's Do method. Any
  1841. // pending HTTP request will be aborted if the provided context is
  1842. // canceled.
  1843. func (c *PhotosBatchGetCall) Context(ctx context.Context) *PhotosBatchGetCall {
  1844. c.ctx_ = ctx
  1845. return c
  1846. }
  1847. // Header returns an http.Header that can be modified by the caller to
  1848. // add HTTP headers to the request.
  1849. func (c *PhotosBatchGetCall) Header() http.Header {
  1850. if c.header_ == nil {
  1851. c.header_ = make(http.Header)
  1852. }
  1853. return c.header_
  1854. }
  1855. func (c *PhotosBatchGetCall) doRequest(alt string) (*http.Response, error) {
  1856. reqHeaders := make(http.Header)
  1857. for k, v := range c.header_ {
  1858. reqHeaders[k] = v
  1859. }
  1860. reqHeaders.Set("User-Agent", c.s.userAgent())
  1861. if c.ifNoneMatch_ != "" {
  1862. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1863. }
  1864. var body io.Reader = nil
  1865. c.urlParams_.Set("alt", alt)
  1866. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photos:batchGet")
  1867. urls += "?" + c.urlParams_.Encode()
  1868. req, _ := http.NewRequest("GET", urls, body)
  1869. req.Header = reqHeaders
  1870. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1871. }
  1872. // Do executes the "streetviewpublish.photos.batchGet" call.
  1873. // Exactly one of *BatchGetPhotosResponse or error will be non-nil. Any
  1874. // non-2xx status code is an error. Response headers are in either
  1875. // *BatchGetPhotosResponse.ServerResponse.Header or (if a response was
  1876. // returned at all) in error.(*googleapi.Error).Header. Use
  1877. // googleapi.IsNotModified to check whether the returned error was
  1878. // because http.StatusNotModified was returned.
  1879. func (c *PhotosBatchGetCall) Do(opts ...googleapi.CallOption) (*BatchGetPhotosResponse, error) {
  1880. gensupport.SetOptions(c.urlParams_, opts...)
  1881. res, err := c.doRequest("json")
  1882. if res != nil && res.StatusCode == http.StatusNotModified {
  1883. if res.Body != nil {
  1884. res.Body.Close()
  1885. }
  1886. return nil, &googleapi.Error{
  1887. Code: res.StatusCode,
  1888. Header: res.Header,
  1889. }
  1890. }
  1891. if err != nil {
  1892. return nil, err
  1893. }
  1894. defer googleapi.CloseBody(res)
  1895. if err := googleapi.CheckResponse(res); err != nil {
  1896. return nil, err
  1897. }
  1898. ret := &BatchGetPhotosResponse{
  1899. ServerResponse: googleapi.ServerResponse{
  1900. Header: res.Header,
  1901. HTTPStatusCode: res.StatusCode,
  1902. },
  1903. }
  1904. target := &ret
  1905. if err := gensupport.DecodeResponse(target, res); err != nil {
  1906. return nil, err
  1907. }
  1908. return ret, nil
  1909. // {
  1910. // "description": "Gets the metadata of the specified\nPhoto batch.\n\nNote that if\nBatchGetPhotos\nfails, either critical fields are missing or there was an authentication\nerror. Even if\nBatchGetPhotos\nsucceeds, there may have been failures for single photos in the batch.\nThese failures will be specified in each\nPhotoResponse.status\nin\nBatchGetPhotosResponse.results.\nSee\nGetPhoto\nfor specific failures that can occur per photo.",
  1911. // "flatPath": "v1/photos:batchGet",
  1912. // "httpMethod": "GET",
  1913. // "id": "streetviewpublish.photos.batchGet",
  1914. // "parameterOrder": [],
  1915. // "parameters": {
  1916. // "photoIds": {
  1917. // "description": "Required. IDs of the Photos. For HTTP\nGET requests, the URL query parameter should be\n`photoIds=\u003cid1\u003e\u0026photoIds=\u003cid2\u003e\u0026...`.",
  1918. // "location": "query",
  1919. // "repeated": true,
  1920. // "type": "string"
  1921. // },
  1922. // "view": {
  1923. // "description": "Specifies if a download URL for the photo bytes should be returned in the\nPhoto response.",
  1924. // "enum": [
  1925. // "BASIC",
  1926. // "INCLUDE_DOWNLOAD_URL"
  1927. // ],
  1928. // "location": "query",
  1929. // "type": "string"
  1930. // }
  1931. // },
  1932. // "path": "v1/photos:batchGet",
  1933. // "response": {
  1934. // "$ref": "BatchGetPhotosResponse"
  1935. // },
  1936. // "scopes": [
  1937. // "https://www.googleapis.com/auth/streetviewpublish"
  1938. // ]
  1939. // }
  1940. }
  1941. // method id "streetviewpublish.photos.batchUpdate":
  1942. type PhotosBatchUpdateCall struct {
  1943. s *Service
  1944. batchupdatephotosrequest *BatchUpdatePhotosRequest
  1945. urlParams_ gensupport.URLParams
  1946. ctx_ context.Context
  1947. header_ http.Header
  1948. }
  1949. // BatchUpdate: Updates the metadata of Photos, such
  1950. // as pose, place association, connections, etc. Changing the pixels of
  1951. // photos
  1952. // is not supported.
  1953. //
  1954. // Note that if
  1955. // BatchUpdatePhotos
  1956. // fails, either critical fields are missing or there was an
  1957. // authentication
  1958. // error. Even if
  1959. // BatchUpdatePhotos
  1960. // succeeds, there may have been failures for single photos in the
  1961. // batch.
  1962. // These failures will be specified in
  1963. // each
  1964. // PhotoResponse.status
  1965. // in
  1966. // BatchUpdatePhotosResponse.results.
  1967. // See
  1968. // Up
  1969. // datePhoto
  1970. // for specific failures that can occur per photo.
  1971. //
  1972. // Only the fields specified in
  1973. // updateMask
  1974. // field are used. If `updateMask` is not present, the update applies to
  1975. // all
  1976. // fields.
  1977. //
  1978. // <aside class="note"><b>Note:</b> To
  1979. // update
  1980. // Pose.altitude,
  1981. // Pose.latLngPair has to be
  1982. // filled as well. Otherwise, the request will fail.</aside>
  1983. func (r *PhotosService) BatchUpdate(batchupdatephotosrequest *BatchUpdatePhotosRequest) *PhotosBatchUpdateCall {
  1984. c := &PhotosBatchUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1985. c.batchupdatephotosrequest = batchupdatephotosrequest
  1986. return c
  1987. }
  1988. // Fields allows partial responses to be retrieved. See
  1989. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1990. // for more information.
  1991. func (c *PhotosBatchUpdateCall) Fields(s ...googleapi.Field) *PhotosBatchUpdateCall {
  1992. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1993. return c
  1994. }
  1995. // Context sets the context to be used in this call's Do method. Any
  1996. // pending HTTP request will be aborted if the provided context is
  1997. // canceled.
  1998. func (c *PhotosBatchUpdateCall) Context(ctx context.Context) *PhotosBatchUpdateCall {
  1999. c.ctx_ = ctx
  2000. return c
  2001. }
  2002. // Header returns an http.Header that can be modified by the caller to
  2003. // add HTTP headers to the request.
  2004. func (c *PhotosBatchUpdateCall) Header() http.Header {
  2005. if c.header_ == nil {
  2006. c.header_ = make(http.Header)
  2007. }
  2008. return c.header_
  2009. }
  2010. func (c *PhotosBatchUpdateCall) doRequest(alt string) (*http.Response, error) {
  2011. reqHeaders := make(http.Header)
  2012. for k, v := range c.header_ {
  2013. reqHeaders[k] = v
  2014. }
  2015. reqHeaders.Set("User-Agent", c.s.userAgent())
  2016. var body io.Reader = nil
  2017. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchupdatephotosrequest)
  2018. if err != nil {
  2019. return nil, err
  2020. }
  2021. reqHeaders.Set("Content-Type", "application/json")
  2022. c.urlParams_.Set("alt", alt)
  2023. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photos:batchUpdate")
  2024. urls += "?" + c.urlParams_.Encode()
  2025. req, _ := http.NewRequest("POST", urls, body)
  2026. req.Header = reqHeaders
  2027. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2028. }
  2029. // Do executes the "streetviewpublish.photos.batchUpdate" call.
  2030. // Exactly one of *BatchUpdatePhotosResponse or error will be non-nil.
  2031. // Any non-2xx status code is an error. Response headers are in either
  2032. // *BatchUpdatePhotosResponse.ServerResponse.Header or (if a response
  2033. // was returned at all) in error.(*googleapi.Error).Header. Use
  2034. // googleapi.IsNotModified to check whether the returned error was
  2035. // because http.StatusNotModified was returned.
  2036. func (c *PhotosBatchUpdateCall) Do(opts ...googleapi.CallOption) (*BatchUpdatePhotosResponse, error) {
  2037. gensupport.SetOptions(c.urlParams_, opts...)
  2038. res, err := c.doRequest("json")
  2039. if res != nil && res.StatusCode == http.StatusNotModified {
  2040. if res.Body != nil {
  2041. res.Body.Close()
  2042. }
  2043. return nil, &googleapi.Error{
  2044. Code: res.StatusCode,
  2045. Header: res.Header,
  2046. }
  2047. }
  2048. if err != nil {
  2049. return nil, err
  2050. }
  2051. defer googleapi.CloseBody(res)
  2052. if err := googleapi.CheckResponse(res); err != nil {
  2053. return nil, err
  2054. }
  2055. ret := &BatchUpdatePhotosResponse{
  2056. ServerResponse: googleapi.ServerResponse{
  2057. Header: res.Header,
  2058. HTTPStatusCode: res.StatusCode,
  2059. },
  2060. }
  2061. target := &ret
  2062. if err := gensupport.DecodeResponse(target, res); err != nil {
  2063. return nil, err
  2064. }
  2065. return ret, nil
  2066. // {
  2067. // "description": "Updates the metadata of Photos, such\nas pose, place association, connections, etc. Changing the pixels of photos\nis not supported.\n\nNote that if\nBatchUpdatePhotos\nfails, either critical fields are missing or there was an authentication\nerror. Even if\nBatchUpdatePhotos\nsucceeds, there may have been failures for single photos in the batch.\nThese failures will be specified in each\nPhotoResponse.status\nin\nBatchUpdatePhotosResponse.results.\nSee\nUpdatePhoto\nfor specific failures that can occur per photo.\n\nOnly the fields specified in\nupdateMask\nfield are used. If `updateMask` is not present, the update applies to all\nfields.\n\n\u003caside class=\"note\"\u003e\u003cb\u003eNote:\u003c/b\u003e To update\nPose.altitude,\nPose.latLngPair has to be\nfilled as well. Otherwise, the request will fail.\u003c/aside\u003e",
  2068. // "flatPath": "v1/photos:batchUpdate",
  2069. // "httpMethod": "POST",
  2070. // "id": "streetviewpublish.photos.batchUpdate",
  2071. // "parameterOrder": [],
  2072. // "parameters": {},
  2073. // "path": "v1/photos:batchUpdate",
  2074. // "request": {
  2075. // "$ref": "BatchUpdatePhotosRequest"
  2076. // },
  2077. // "response": {
  2078. // "$ref": "BatchUpdatePhotosResponse"
  2079. // },
  2080. // "scopes": [
  2081. // "https://www.googleapis.com/auth/streetviewpublish"
  2082. // ]
  2083. // }
  2084. }
  2085. // method id "streetviewpublish.photos.list":
  2086. type PhotosListCall struct {
  2087. s *Service
  2088. urlParams_ gensupport.URLParams
  2089. ifNoneMatch_ string
  2090. ctx_ context.Context
  2091. header_ http.Header
  2092. }
  2093. // List: Lists all the Photos that belong to
  2094. // the user.
  2095. //
  2096. // <aside class="note"><b>Note:</b> Recently created photos that are
  2097. // still
  2098. // being indexed are not returned in the response.</aside>
  2099. func (r *PhotosService) List() *PhotosListCall {
  2100. c := &PhotosListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2101. return c
  2102. }
  2103. // Filter sets the optional parameter "filter": The filter expression.
  2104. // For example: `placeId=ChIJj61dQgK6j4AR4GeTYWZsKWw`.
  2105. //
  2106. // The only filter supported at the moment is `placeId`.
  2107. func (c *PhotosListCall) Filter(filter string) *PhotosListCall {
  2108. c.urlParams_.Set("filter", filter)
  2109. return c
  2110. }
  2111. // PageSize sets the optional parameter "pageSize": The maximum number
  2112. // of photos to return.
  2113. // `pageSize` must be non-negative. If `pageSize` is zero or is not
  2114. // provided,
  2115. // the default page size of 100 will be used.
  2116. // The number of photos returned in the response may be less than
  2117. // `pageSize`
  2118. // if the number of photos that belong to the user is less than
  2119. // `pageSize`.
  2120. func (c *PhotosListCall) PageSize(pageSize int64) *PhotosListCall {
  2121. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2122. return c
  2123. }
  2124. // PageToken sets the optional parameter "pageToken":
  2125. // The
  2126. // nextPageToken
  2127. // value returned from a previous
  2128. // ListPhotos
  2129. // request, if any.
  2130. func (c *PhotosListCall) PageToken(pageToken string) *PhotosListCall {
  2131. c.urlParams_.Set("pageToken", pageToken)
  2132. return c
  2133. }
  2134. // View sets the optional parameter "view": Specifies if a download URL
  2135. // for the photos bytes should be returned in the
  2136. // Photos response.
  2137. //
  2138. // Possible values:
  2139. // "BASIC"
  2140. // "INCLUDE_DOWNLOAD_URL"
  2141. func (c *PhotosListCall) View(view string) *PhotosListCall {
  2142. c.urlParams_.Set("view", view)
  2143. return c
  2144. }
  2145. // Fields allows partial responses to be retrieved. See
  2146. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2147. // for more information.
  2148. func (c *PhotosListCall) Fields(s ...googleapi.Field) *PhotosListCall {
  2149. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2150. return c
  2151. }
  2152. // IfNoneMatch sets the optional parameter which makes the operation
  2153. // fail if the object's ETag matches the given value. This is useful for
  2154. // getting updates only after the object has changed since the last
  2155. // request. Use googleapi.IsNotModified to check whether the response
  2156. // error from Do is the result of In-None-Match.
  2157. func (c *PhotosListCall) IfNoneMatch(entityTag string) *PhotosListCall {
  2158. c.ifNoneMatch_ = entityTag
  2159. return c
  2160. }
  2161. // Context sets the context to be used in this call's Do method. Any
  2162. // pending HTTP request will be aborted if the provided context is
  2163. // canceled.
  2164. func (c *PhotosListCall) Context(ctx context.Context) *PhotosListCall {
  2165. c.ctx_ = ctx
  2166. return c
  2167. }
  2168. // Header returns an http.Header that can be modified by the caller to
  2169. // add HTTP headers to the request.
  2170. func (c *PhotosListCall) Header() http.Header {
  2171. if c.header_ == nil {
  2172. c.header_ = make(http.Header)
  2173. }
  2174. return c.header_
  2175. }
  2176. func (c *PhotosListCall) doRequest(alt string) (*http.Response, error) {
  2177. reqHeaders := make(http.Header)
  2178. for k, v := range c.header_ {
  2179. reqHeaders[k] = v
  2180. }
  2181. reqHeaders.Set("User-Agent", c.s.userAgent())
  2182. if c.ifNoneMatch_ != "" {
  2183. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2184. }
  2185. var body io.Reader = nil
  2186. c.urlParams_.Set("alt", alt)
  2187. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/photos")
  2188. urls += "?" + c.urlParams_.Encode()
  2189. req, _ := http.NewRequest("GET", urls, body)
  2190. req.Header = reqHeaders
  2191. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2192. }
  2193. // Do executes the "streetviewpublish.photos.list" call.
  2194. // Exactly one of *ListPhotosResponse or error will be non-nil. Any
  2195. // non-2xx status code is an error. Response headers are in either
  2196. // *ListPhotosResponse.ServerResponse.Header or (if a response was
  2197. // returned at all) in error.(*googleapi.Error).Header. Use
  2198. // googleapi.IsNotModified to check whether the returned error was
  2199. // because http.StatusNotModified was returned.
  2200. func (c *PhotosListCall) Do(opts ...googleapi.CallOption) (*ListPhotosResponse, error) {
  2201. gensupport.SetOptions(c.urlParams_, opts...)
  2202. res, err := c.doRequest("json")
  2203. if res != nil && res.StatusCode == http.StatusNotModified {
  2204. if res.Body != nil {
  2205. res.Body.Close()
  2206. }
  2207. return nil, &googleapi.Error{
  2208. Code: res.StatusCode,
  2209. Header: res.Header,
  2210. }
  2211. }
  2212. if err != nil {
  2213. return nil, err
  2214. }
  2215. defer googleapi.CloseBody(res)
  2216. if err := googleapi.CheckResponse(res); err != nil {
  2217. return nil, err
  2218. }
  2219. ret := &ListPhotosResponse{
  2220. ServerResponse: googleapi.ServerResponse{
  2221. Header: res.Header,
  2222. HTTPStatusCode: res.StatusCode,
  2223. },
  2224. }
  2225. target := &ret
  2226. if err := gensupport.DecodeResponse(target, res); err != nil {
  2227. return nil, err
  2228. }
  2229. return ret, nil
  2230. // {
  2231. // "description": "Lists all the Photos that belong to\nthe user.\n\n\u003caside class=\"note\"\u003e\u003cb\u003eNote:\u003c/b\u003e Recently created photos that are still\nbeing indexed are not returned in the response.\u003c/aside\u003e",
  2232. // "flatPath": "v1/photos",
  2233. // "httpMethod": "GET",
  2234. // "id": "streetviewpublish.photos.list",
  2235. // "parameterOrder": [],
  2236. // "parameters": {
  2237. // "filter": {
  2238. // "description": "The filter expression. For example: `placeId=ChIJj61dQgK6j4AR4GeTYWZsKWw`.\n\nThe only filter supported at the moment is `placeId`.",
  2239. // "location": "query",
  2240. // "type": "string"
  2241. // },
  2242. // "pageSize": {
  2243. // "description": "The maximum number of photos to return.\n`pageSize` must be non-negative. If `pageSize` is zero or is not provided,\nthe default page size of 100 will be used.\nThe number of photos returned in the response may be less than `pageSize`\nif the number of photos that belong to the user is less than `pageSize`.",
  2244. // "format": "int32",
  2245. // "location": "query",
  2246. // "type": "integer"
  2247. // },
  2248. // "pageToken": {
  2249. // "description": "The\nnextPageToken\nvalue returned from a previous\nListPhotos\nrequest, if any.",
  2250. // "location": "query",
  2251. // "type": "string"
  2252. // },
  2253. // "view": {
  2254. // "description": "Specifies if a download URL for the photos bytes should be returned in the\nPhotos response.",
  2255. // "enum": [
  2256. // "BASIC",
  2257. // "INCLUDE_DOWNLOAD_URL"
  2258. // ],
  2259. // "location": "query",
  2260. // "type": "string"
  2261. // }
  2262. // },
  2263. // "path": "v1/photos",
  2264. // "response": {
  2265. // "$ref": "ListPhotosResponse"
  2266. // },
  2267. // "scopes": [
  2268. // "https://www.googleapis.com/auth/streetviewpublish"
  2269. // ]
  2270. // }
  2271. }
  2272. // Pages invokes f for each page of results.
  2273. // A non-nil error returned from f will halt the iteration.
  2274. // The provided context supersedes any context provided to the Context method.
  2275. func (c *PhotosListCall) Pages(ctx context.Context, f func(*ListPhotosResponse) error) error {
  2276. c.ctx_ = ctx
  2277. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2278. for {
  2279. x, err := c.Do()
  2280. if err != nil {
  2281. return err
  2282. }
  2283. if err := f(x); err != nil {
  2284. return err
  2285. }
  2286. if x.NextPageToken == "" {
  2287. return nil
  2288. }
  2289. c.PageToken(x.NextPageToken)
  2290. }
  2291. }