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\AddProductToProductSetRequest; 21use Google\Service\Vision\ImportProductSetsRequest; 22use Google\Service\Vision\ListProductSetsResponse; 23use Google\Service\Vision\Operation; 24use Google\Service\Vision\ProductSet; 25use Google\Service\Vision\RemoveProductFromProductSetRequest; 26use Google\Service\Vision\VisionEmpty; 27 28/** 29 * The "productSets" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $visionService = new Google\Service\Vision(...); 33 * $productSets = $visionService->productSets; 34 * </code> 35 */ 36class ProjectsLocationsProductSets extends \Google\Service\Resource 37{ 38 /** 39 * Adds a Product to the specified ProductSet. If the Product is already 40 * present, no change is made. One Product can be added to at most 100 41 * ProductSets. Possible errors: * Returns NOT_FOUND if the Product or the 42 * ProductSet doesn't exist. (productSets.addProduct) 43 * 44 * @param string $name Required. The resource name for the ProductSet to modify. 45 * Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` 46 * @param AddProductToProductSetRequest $postBody 47 * @param array $optParams Optional parameters. 48 * @return VisionEmpty 49 */ 50 public function addProduct($name, AddProductToProductSetRequest $postBody, $optParams = []) 51 { 52 $params = ['name' => $name, 'postBody' => $postBody]; 53 $params = array_merge($params, $optParams); 54 return $this->call('addProduct', [$params], VisionEmpty::class); 55 } 56 /** 57 * Creates and returns a new ProductSet resource. Possible errors: * Returns 58 * INVALID_ARGUMENT if display_name is missing, or is longer than 4096 59 * characters. (productSets.create) 60 * 61 * @param string $parent Required. The project in which the ProductSet should be 62 * created. Format is `projects/PROJECT_ID/locations/LOC_ID`. 63 * @param ProductSet $postBody 64 * @param array $optParams Optional parameters. 65 * 66 * @opt_param string productSetId A user-supplied resource id for this 67 * ProductSet. If set, the server will attempt to use this value as the resource 68 * id. If it is already in use, an error is returned with code ALREADY_EXISTS. 69 * Must be at most 128 characters long. It cannot contain the character `/`. 70 * @return ProductSet 71 */ 72 public function create($parent, ProductSet $postBody, $optParams = []) 73 { 74 $params = ['parent' => $parent, 'postBody' => $postBody]; 75 $params = array_merge($params, $optParams); 76 return $this->call('create', [$params], ProductSet::class); 77 } 78 /** 79 * Permanently deletes a ProductSet. Products and ReferenceImages in the 80 * ProductSet are not deleted. The actual image files are not deleted from 81 * Google Cloud Storage. (productSets.delete) 82 * 83 * @param string $name Required. Resource name of the ProductSet to delete. 84 * Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` 85 * @param array $optParams Optional parameters. 86 * @return VisionEmpty 87 */ 88 public function delete($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('delete', [$params], VisionEmpty::class); 93 } 94 /** 95 * Gets information associated with a ProductSet. Possible errors: * Returns 96 * NOT_FOUND if the ProductSet does not exist. (productSets.get) 97 * 98 * @param string $name Required. Resource name of the ProductSet to get. Format 99 * is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` 100 * @param array $optParams Optional parameters. 101 * @return ProductSet 102 */ 103 public function get($name, $optParams = []) 104 { 105 $params = ['name' => $name]; 106 $params = array_merge($params, $optParams); 107 return $this->call('get', [$params], ProductSet::class); 108 } 109 /** 110 * Asynchronous API that imports a list of reference images to specified product 111 * sets based on a list of image information. The google.longrunning.Operation 112 * API can be used to keep track of the progress and results of the request. 113 * `Operation.metadata` contains `BatchOperationMetadata`. (progress) 114 * `Operation.response` contains `ImportProductSetsResponse`. (results) The 115 * input source of this method is a csv file on Google Cloud Storage. For the 116 * format of the csv file please see ImportProductSetsGcsSource.csv_file_uri. 117 * (productSets.import) 118 * 119 * @param string $parent Required. The project in which the ProductSets should 120 * be imported. Format is `projects/PROJECT_ID/locations/LOC_ID`. 121 * @param ImportProductSetsRequest $postBody 122 * @param array $optParams Optional parameters. 123 * @return Operation 124 */ 125 public function import($parent, ImportProductSetsRequest $postBody, $optParams = []) 126 { 127 $params = ['parent' => $parent, 'postBody' => $postBody]; 128 $params = array_merge($params, $optParams); 129 return $this->call('import', [$params], Operation::class); 130 } 131 /** 132 * Lists ProductSets in an unspecified order. Possible errors: * Returns 133 * INVALID_ARGUMENT if page_size is greater than 100, or less than 1. 134 * (productSets.listProjectsLocationsProductSets) 135 * 136 * @param string $parent Required. The project from which ProductSets should be 137 * listed. Format is `projects/PROJECT_ID/locations/LOC_ID`. 138 * @param array $optParams Optional parameters. 139 * 140 * @opt_param int pageSize The maximum number of items to return. Default 10, 141 * maximum 100. 142 * @opt_param string pageToken The next_page_token returned from a previous List 143 * request, if any. 144 * @return ListProductSetsResponse 145 */ 146 public function listProjectsLocationsProductSets($parent, $optParams = []) 147 { 148 $params = ['parent' => $parent]; 149 $params = array_merge($params, $optParams); 150 return $this->call('list', [$params], ListProductSetsResponse::class); 151 } 152 /** 153 * Makes changes to a ProductSet resource. Only display_name can be updated 154 * currently. Possible errors: * Returns NOT_FOUND if the ProductSet does not 155 * exist. * Returns INVALID_ARGUMENT if display_name is present in update_mask 156 * but missing from the request or longer than 4096 characters. 157 * (productSets.patch) 158 * 159 * @param string $name The resource name of the ProductSet. Format is: 160 * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. This field 161 * is ignored when creating a ProductSet. 162 * @param ProductSet $postBody 163 * @param array $optParams Optional parameters. 164 * 165 * @opt_param string updateMask The FieldMask that specifies which fields to 166 * update. If update_mask isn't specified, all mutable fields are to be updated. 167 * Valid mask path is `display_name`. 168 * @return ProductSet 169 */ 170 public function patch($name, ProductSet $postBody, $optParams = []) 171 { 172 $params = ['name' => $name, 'postBody' => $postBody]; 173 $params = array_merge($params, $optParams); 174 return $this->call('patch', [$params], ProductSet::class); 175 } 176 /** 177 * Removes a Product from the specified ProductSet. (productSets.removeProduct) 178 * 179 * @param string $name Required. The resource name for the ProductSet to modify. 180 * Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` 181 * @param RemoveProductFromProductSetRequest $postBody 182 * @param array $optParams Optional parameters. 183 * @return VisionEmpty 184 */ 185 public function removeProduct($name, RemoveProductFromProductSetRequest $postBody, $optParams = []) 186 { 187 $params = ['name' => $name, 'postBody' => $postBody]; 188 $params = array_merge($params, $optParams); 189 return $this->call('removeProduct', [$params], VisionEmpty::class); 190 } 191} 192 193// Adding a class alias for backwards compatibility with the previous class name. 194class_alias(ProjectsLocationsProductSets::class, 'Google_Service_Vision_Resource_ProjectsLocationsProductSets'); 195