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 18namespace Google\Service\StreetViewPublish\Resource; 19 20use Google\Service\StreetViewPublish\Photo as PhotoModel; 21use Google\Service\StreetViewPublish\StreetviewpublishEmpty; 22use 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 */ 32class 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 */ 52 public function create(PhotoModel $postBody, $optParams = []) 53 { 54 $params = ['postBody' => $postBody]; 55 $params = array_merge($params, $optParams); 56 return $this->call('create', [$params], PhotoModel::class); 57 } 58 /** 59 * Deletes a Photo and its metadata. This method returns the following error 60 * codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did not 61 * create the requested photo. * google.rpc.Code.NOT_FOUND if the photo ID does 62 * not exist. (photo.delete) 63 * 64 * @param string $photoId Required. ID of the Photo. 65 * @param array $optParams Optional parameters. 66 * @return StreetviewpublishEmpty 67 */ 68 public function delete($photoId, $optParams = []) 69 { 70 $params = ['photoId' => $photoId]; 71 $params = array_merge($params, $optParams); 72 return $this->call('delete', [$params], StreetviewpublishEmpty::class); 73 } 74 /** 75 * Gets the metadata of the specified Photo. This method returns the following 76 * error codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did 77 * not create the requested Photo. * google.rpc.Code.NOT_FOUND if the requested 78 * Photo does not exist. * google.rpc.Code.UNAVAILABLE if the requested Photo is 79 * still being indexed. (photo.get) 80 * 81 * @param string $photoId Required. ID of the Photo. 82 * @param array $optParams Optional parameters. 83 * 84 * @opt_param string languageCode The BCP-47 language code, such as "en-US" or 85 * "sr-Latn". For more information, see 86 * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. If 87 * language_code is unspecified, the user's language preference for Google 88 * services is used. 89 * @opt_param string view Required. Specifies if a download URL for the photo 90 * bytes should be returned in the Photo response. 91 * @return PhotoModel 92 */ 93 public function get($photoId, $optParams = []) 94 { 95 $params = ['photoId' => $photoId]; 96 $params = array_merge($params, $optParams); 97 return $this->call('get', [$params], PhotoModel::class); 98 } 99 /** 100 * Creates an upload session to start uploading photo bytes. The method uses the 101 * upload URL of the returned UploadRef to upload the bytes for the Photo. In 102 * addition to the photo requirements shown in 103 * https://support.google.com/maps/answer/7012050?ref_topic=6275604, the photo 104 * must meet the following requirements: * Photo Sphere XMP metadata must be 105 * included in the photo metadata. See https://developers.google.com/streetview 106 * /spherical-metadata for the required fields. * The pixel size of the photo 107 * must meet the size requirements listed in 108 * https://support.google.com/maps/answer/7012050?ref_topic=6275604, and the 109 * photo must be a full 360 horizontally. After the upload completes, the method 110 * uses UploadRef with CreatePhoto to create the Photo object entry. 111 * (photo.startUpload) 112 * 113 * @param StreetviewpublishEmpty $postBody 114 * @param array $optParams Optional parameters. 115 * @return UploadRef 116 */ 117 public function startUpload(StreetviewpublishEmpty $postBody, $optParams = []) 118 { 119 $params = ['postBody' => $postBody]; 120 $params = array_merge($params, $optParams); 121 return $this->call('startUpload', [$params], UploadRef::class); 122 } 123 /** 124 * Updates the metadata of a Photo, such as pose, place association, 125 * connections, etc. Changing the pixels of a photo is not supported. Only the 126 * fields specified in the updateMask field are used. If `updateMask` is not 127 * present, the update applies to all fields. This method returns the following 128 * error codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did 129 * not create the requested photo. * google.rpc.Code.INVALID_ARGUMENT if the 130 * request is malformed. * google.rpc.Code.NOT_FOUND if the requested photo does 131 * not exist. * google.rpc.Code.UNAVAILABLE if the requested Photo is still 132 * being indexed. (photo.update) 133 * 134 * @param string $id A unique identifier for a photo. 135 * @param PhotoModel $postBody 136 * @param array $optParams Optional parameters. 137 * 138 * @opt_param string updateMask Required. Mask that identifies fields on the 139 * photo metadata to update. If not present, the old Photo metadata is entirely 140 * replaced with the new Photo metadata in this request. The update fails if 141 * invalid fields are specified. Multiple fields can be specified in a comma- 142 * delimited list. The following fields are valid: * `pose.heading` * 143 * `pose.latLngPair` * `pose.pitch` * `pose.roll` * `pose.level` * 144 * `pose.altitude` * `connections` * `places` > Note: When updateMask contains 145 * repeated fields, the entire set of repeated values get replaced with the new 146 * contents. For example, if updateMask contains `connections` and 147 * `UpdatePhotoRequest.photo.connections` is empty, all connections are removed. 148 * @return PhotoModel 149 */ 150 public function update($id, PhotoModel $postBody, $optParams = []) 151 { 152 $params = ['id' => $id, 'postBody' => $postBody]; 153 $params = array_merge($params, $optParams); 154 return $this->call('update', [$params], PhotoModel::class); 155 } 156} 157 158// Adding a class alias for backwards compatibility with the previous class name. 159class_alias(Photo::class, 'Google_Service_StreetViewPublish_Resource_Photo'); 160