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\Vision\Resource; 19 20use Google\Service\Vision\ListReferenceImagesResponse; 21use Google\Service\Vision\ReferenceImage; 22use Google\Service\Vision\VisionEmpty; 23 24/** 25 * The "referenceImages" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $visionService = new Google\Service\Vision(...); 29 * $referenceImages = $visionService->referenceImages; 30 * </code> 31 */ 32class ProjectsLocationsProductsReferenceImages extends \Google\Service\Resource 33{ 34 /** 35 * Creates and returns a new ReferenceImage resource. The `bounding_poly` field 36 * is optional. If `bounding_poly` is not specified, the system will try to 37 * detect regions of interest in the image that are compatible with the 38 * product_category on the parent product. If it is specified, detection is 39 * ALWAYS skipped. The system converts polygons into non-rotated rectangles. 40 * Note that the pipeline will resize the image if the image resolution is too 41 * large to process (above 50MP). Possible errors: * Returns INVALID_ARGUMENT if 42 * the image_uri is missing or longer than 4096 characters. * Returns 43 * INVALID_ARGUMENT if the product does not exist. * Returns INVALID_ARGUMENT if 44 * bounding_poly is not provided, and nothing compatible with the parent 45 * product's product_category is detected. * Returns INVALID_ARGUMENT if 46 * bounding_poly contains more than 10 polygons. (referenceImages.create) 47 * 48 * @param string $parent Required. Resource name of the product in which to 49 * create the reference image. Format is 50 * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. 51 * @param ReferenceImage $postBody 52 * @param array $optParams Optional parameters. 53 * 54 * @opt_param string referenceImageId A user-supplied resource id for the 55 * ReferenceImage to be added. If set, the server will attempt to use this value 56 * as the resource id. If it is already in use, an error is returned with code 57 * ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the 58 * character `/`. 59 * @return ReferenceImage 60 */ 61 public function create($parent, ReferenceImage $postBody, $optParams = []) 62 { 63 $params = ['parent' => $parent, 'postBody' => $postBody]; 64 $params = array_merge($params, $optParams); 65 return $this->call('create', [$params], ReferenceImage::class); 66 } 67 /** 68 * Permanently deletes a reference image. The image metadata will be deleted 69 * right away, but search queries against ProductSets containing the image may 70 * still work until all related caches are refreshed. The actual image files are 71 * not deleted from Google Cloud Storage. (referenceImages.delete) 72 * 73 * @param string $name Required. The resource name of the reference image to 74 * delete. Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/ 75 * referenceImages/IMAGE_ID` 76 * @param array $optParams Optional parameters. 77 * @return VisionEmpty 78 */ 79 public function delete($name, $optParams = []) 80 { 81 $params = ['name' => $name]; 82 $params = array_merge($params, $optParams); 83 return $this->call('delete', [$params], VisionEmpty::class); 84 } 85 /** 86 * Gets information associated with a ReferenceImage. Possible errors: * Returns 87 * NOT_FOUND if the specified image does not exist. (referenceImages.get) 88 * 89 * @param string $name Required. The resource name of the ReferenceImage to get. 90 * Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenc 91 * eImages/IMAGE_ID`. 92 * @param array $optParams Optional parameters. 93 * @return ReferenceImage 94 */ 95 public function get($name, $optParams = []) 96 { 97 $params = ['name' => $name]; 98 $params = array_merge($params, $optParams); 99 return $this->call('get', [$params], ReferenceImage::class); 100 } 101 /** 102 * Lists reference images. Possible errors: * Returns NOT_FOUND if the parent 103 * product does not exist. * Returns INVALID_ARGUMENT if the page_size is 104 * greater than 100, or less than 1. 105 * (referenceImages.listProjectsLocationsProductsReferenceImages) 106 * 107 * @param string $parent Required. Resource name of the product containing the 108 * reference images. Format is 109 * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. 110 * @param array $optParams Optional parameters. 111 * 112 * @opt_param int pageSize The maximum number of items to return. Default 10, 113 * maximum 100. 114 * @opt_param string pageToken A token identifying a page of results to be 115 * returned. This is the value of `nextPageToken` returned in a previous 116 * reference image list request. Defaults to the first page if not specified. 117 * @return ListReferenceImagesResponse 118 */ 119 public function listProjectsLocationsProductsReferenceImages($parent, $optParams = []) 120 { 121 $params = ['parent' => $parent]; 122 $params = array_merge($params, $optParams); 123 return $this->call('list', [$params], ListReferenceImagesResponse::class); 124 } 125} 126 127// Adding a class alias for backwards compatibility with the previous class name. 128class_alias(ProjectsLocationsProductsReferenceImages::class, 'Google_Service_Vision_Resource_ProjectsLocationsProductsReferenceImages'); 129