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\CloudRetail\Resource; 19 20use Google\Service\CloudRetail\GoogleCloudRetailV2PredictRequest; 21use Google\Service\CloudRetail\GoogleCloudRetailV2PredictResponse; 22use Google\Service\CloudRetail\GoogleCloudRetailV2SearchRequest; 23use Google\Service\CloudRetail\GoogleCloudRetailV2SearchResponse; 24 25/** 26 * The "servingConfigs" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $retailService = new Google\Service\CloudRetail(...); 30 * $servingConfigs = $retailService->servingConfigs; 31 * </code> 32 */ 33class ProjectsLocationsCatalogsServingConfigs extends \Google\Service\Resource 34{ 35 /** 36 * Makes a recommendation prediction. (servingConfigs.predict) 37 * 38 * @param string $placement Required. Full resource name of the format: 39 * {name=projects/locations/global/catalogs/default_catalog/servingConfigs} or 40 * {name=projects/locations/global/catalogs/default_catalog/placements}. We 41 * recommend using the `servingConfigs` resource. `placements` is a legacy 42 * resource. The ID of the Recommendations AI serving config or placement. 43 * Before you can request predictions from your model, you must create at least 44 * one serving config or placement for it. For more information, see [Managing 45 * serving configurations] (https://cloud.google.com/retail/docs/manage- 46 * configs). The full list of available serving configs can be seen at 47 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 48 * @param GoogleCloudRetailV2PredictRequest $postBody 49 * @param array $optParams Optional parameters. 50 * @return GoogleCloudRetailV2PredictResponse 51 */ 52 public function predict($placement, GoogleCloudRetailV2PredictRequest $postBody, $optParams = []) 53 { 54 $params = ['placement' => $placement, 'postBody' => $postBody]; 55 $params = array_merge($params, $optParams); 56 return $this->call('predict', [$params], GoogleCloudRetailV2PredictResponse::class); 57 } 58 /** 59 * Performs a search. This feature is only available for users who have Retail 60 * Search enabled. Please enable Retail Search on Cloud Console before using 61 * this feature. (servingConfigs.search) 62 * 63 * @param string $placement Required. The resource name of the Retail Search 64 * serving config, such as `projects/locations/global/catalogs/default_catalog/s 65 * ervingConfigs/default_serving_config` or the name of the legacy placement 66 * resource, such as `projects/locations/global/catalogs/default_catalog/placeme 67 * nts/default_search`. This field is used to identify the serving configuration 68 * name and the set of models that will be used to make the search. 69 * @param GoogleCloudRetailV2SearchRequest $postBody 70 * @param array $optParams Optional parameters. 71 * @return GoogleCloudRetailV2SearchResponse 72 */ 73 public function search($placement, GoogleCloudRetailV2SearchRequest $postBody, $optParams = []) 74 { 75 $params = ['placement' => $placement, 'postBody' => $postBody]; 76 $params = array_merge($params, $optParams); 77 return $this->call('search', [$params], GoogleCloudRetailV2SearchResponse::class); 78 } 79} 80 81// Adding a class alias for backwards compatibility with the previous class name. 82class_alias(ProjectsLocationsCatalogsServingConfigs::class, 'Google_Service_CloudRetail_Resource_ProjectsLocationsCatalogsServingConfigs'); 83