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.
 
 
 

2704 lines
93 KiB

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