1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\StreetViewPublish\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\StreetViewPublish\Photo as PhotoModel;
|
---|
21 | use Google\Service\StreetViewPublish\StreetviewpublishEmpty;
|
---|
22 | use Google\Service\StreetViewPublish\UploadRef;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "photo" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $streetviewpublishService = new Google\Service\StreetViewPublish(...);
|
---|
29 | * $photo = $streetviewpublishService->photo;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class Photo extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * After the client finishes uploading the photo with the returned UploadRef,
|
---|
36 | * CreatePhoto publishes the uploaded Photo to Street View on Google Maps.
|
---|
37 | * Currently, the only way to set heading, pitch, and roll in CreatePhoto is
|
---|
38 | * through the [Photo Sphere XMP
|
---|
39 | * metadata](https://developers.google.com/streetview/spherical-metadata) in the
|
---|
40 | * photo bytes. CreatePhoto ignores the `pose.heading`, `pose.pitch`,
|
---|
41 | * `pose.roll`, `pose.altitude`, and `pose.level` fields in Pose. This method
|
---|
42 | * returns the following error codes: * google.rpc.Code.INVALID_ARGUMENT if the
|
---|
43 | * request is malformed or if the uploaded photo is not a 360 photo. *
|
---|
44 | * google.rpc.Code.NOT_FOUND if the upload reference does not exist. *
|
---|
45 | * google.rpc.Code.RESOURCE_EXHAUSTED if the account has reached the storage
|
---|
46 | * limit. (photo.create)
|
---|
47 | *
|
---|
48 | * @param PhotoModel $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return PhotoModel
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create(PhotoModel $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], PhotoModel::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Deletes a Photo and its metadata. This method returns the following error
|
---|
61 | * codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did not
|
---|
62 | * create the requested photo. * google.rpc.Code.NOT_FOUND if the photo ID does
|
---|
63 | * not exist. (photo.delete)
|
---|
64 | *
|
---|
65 | * @param string $photoId Required. ID of the Photo.
|
---|
66 | * @param array $optParams Optional parameters.
|
---|
67 | * @return StreetviewpublishEmpty
|
---|
68 | * @throws \Google\Service\Exception
|
---|
69 | */
|
---|
70 | public function delete($photoId, $optParams = [])
|
---|
71 | {
|
---|
72 | $params = ['photoId' => $photoId];
|
---|
73 | $params = array_merge($params, $optParams);
|
---|
74 | return $this->call('delete', [$params], StreetviewpublishEmpty::class);
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * Gets the metadata of the specified Photo. This method returns the following
|
---|
78 | * error codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did
|
---|
79 | * not create the requested Photo. * google.rpc.Code.NOT_FOUND if the requested
|
---|
80 | * Photo does not exist. * google.rpc.Code.UNAVAILABLE if the requested Photo is
|
---|
81 | * still being indexed. (photo.get)
|
---|
82 | *
|
---|
83 | * @param string $photoId Required. ID of the Photo.
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | *
|
---|
86 | * @opt_param string languageCode The BCP-47 language code, such as "en-US" or
|
---|
87 | * "sr-Latn". For more information, see
|
---|
88 | * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. If
|
---|
89 | * language_code is unspecified, the user's language preference for Google
|
---|
90 | * services is used.
|
---|
91 | * @opt_param string view Required. Specifies if a download URL for the photo
|
---|
92 | * bytes should be returned in the Photo response.
|
---|
93 | * @return PhotoModel
|
---|
94 | * @throws \Google\Service\Exception
|
---|
95 | */
|
---|
96 | public function get($photoId, $optParams = [])
|
---|
97 | {
|
---|
98 | $params = ['photoId' => $photoId];
|
---|
99 | $params = array_merge($params, $optParams);
|
---|
100 | return $this->call('get', [$params], PhotoModel::class);
|
---|
101 | }
|
---|
102 | /**
|
---|
103 | * Creates an upload session to start uploading photo bytes. The method uses the
|
---|
104 | * upload URL of the returned UploadRef to upload the bytes for the Photo. In
|
---|
105 | * addition to the photo requirements shown in
|
---|
106 | * https://support.google.com/maps/answer/7012050?ref_topic=6275604, the photo
|
---|
107 | * must meet the following requirements: * Photo Sphere XMP metadata must be
|
---|
108 | * included in the photo metadata. See
|
---|
109 | * https://developers.google.com/streetview/spherical-metadata for the required
|
---|
110 | * fields. * The pixel size of the photo must meet the size requirements listed
|
---|
111 | * in https://support.google.com/maps/answer/7012050?ref_topic=6275604, and the
|
---|
112 | * photo must be a full 360 horizontally. After the upload completes, the method
|
---|
113 | * uses UploadRef with CreatePhoto to create the Photo object entry.
|
---|
114 | * (photo.startUpload)
|
---|
115 | *
|
---|
116 | * @param StreetviewpublishEmpty $postBody
|
---|
117 | * @param array $optParams Optional parameters.
|
---|
118 | * @return UploadRef
|
---|
119 | * @throws \Google\Service\Exception
|
---|
120 | */
|
---|
121 | public function startUpload(StreetviewpublishEmpty $postBody, $optParams = [])
|
---|
122 | {
|
---|
123 | $params = ['postBody' => $postBody];
|
---|
124 | $params = array_merge($params, $optParams);
|
---|
125 | return $this->call('startUpload', [$params], UploadRef::class);
|
---|
126 | }
|
---|
127 | /**
|
---|
128 | * Updates the metadata of a Photo, such as pose, place association,
|
---|
129 | * connections, etc. Changing the pixels of a photo is not supported. Only the
|
---|
130 | * fields specified in the updateMask field are used. If `updateMask` is not
|
---|
131 | * present, the update applies to all fields. This method returns the following
|
---|
132 | * error codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did
|
---|
133 | * not create the requested photo. * google.rpc.Code.INVALID_ARGUMENT if the
|
---|
134 | * request is malformed. * google.rpc.Code.NOT_FOUND if the requested photo does
|
---|
135 | * not exist. * google.rpc.Code.UNAVAILABLE if the requested Photo is still
|
---|
136 | * being indexed. (photo.update)
|
---|
137 | *
|
---|
138 | * @param string $id A unique identifier for a photo.
|
---|
139 | * @param PhotoModel $postBody
|
---|
140 | * @param array $optParams Optional parameters.
|
---|
141 | *
|
---|
142 | * @opt_param string updateMask Required. Mask that identifies fields on the
|
---|
143 | * photo metadata to update. If not present, the old Photo metadata is entirely
|
---|
144 | * replaced with the new Photo metadata in this request. The update fails if
|
---|
145 | * invalid fields are specified. Multiple fields can be specified in a comma-
|
---|
146 | * delimited list. The following fields are valid: * `pose.heading` *
|
---|
147 | * `pose.lat_lng_pair` * `pose.pitch` * `pose.roll` * `pose.level` *
|
---|
148 | * `pose.altitude` * `connections` * `places` > Note: When updateMask contains
|
---|
149 | * repeated fields, the entire set of repeated values get replaced with the new
|
---|
150 | * contents. For example, if updateMask contains `connections` and
|
---|
151 | * `UpdatePhotoRequest.photo.connections` is empty, all connections are removed.
|
---|
152 | * @return PhotoModel
|
---|
153 | * @throws \Google\Service\Exception
|
---|
154 | */
|
---|
155 | public function update($id, PhotoModel $postBody, $optParams = [])
|
---|
156 | {
|
---|
157 | $params = ['id' => $id, 'postBody' => $postBody];
|
---|
158 | $params = array_merge($params, $optParams);
|
---|
159 | return $this->call('update', [$params], PhotoModel::class);
|
---|
160 | }
|
---|
161 | }
|
---|
162 |
|
---|
163 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
164 | class_alias(Photo::class, 'Google_Service_StreetViewPublish_Resource_Photo');
|
---|