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\RecommendationsAI\Resource; 19 20use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1PredictRequest; 21use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1PredictResponse; 22 23/** 24 * The "placements" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $recommendationengineService = new Google\Service\RecommendationsAI(...); 28 * $placements = $recommendationengineService->placements; 29 * </code> 30 */ 31class ProjectsLocationsCatalogsEventStoresPlacements extends \Google\Service\Resource 32{ 33 /** 34 * Makes a recommendation prediction. If using API Key based authentication, the 35 * API Key must be registered using the PredictionApiKeyRegistry service. [Learn 36 * more](https://cloud.google.com/recommendations-ai/docs/setting-up#register- 37 * key). (placements.predict) 38 * 39 * @param string $name Required. Full resource name of the format: `{name=projec 40 * ts/locations/global/catalogs/default_catalog/eventStores/default_event_store/ 41 * placements}` The id of the recommendation engine placement. This id is used 42 * to identify the set of models that will be used to make the prediction. We 43 * currently support three placements with the following IDs by default: * 44 * `shopping_cart`: Predicts items frequently bought together with one or more 45 * catalog items in the same shopping session. Commonly displayed after `add-to- 46 * cart` events, on product detail pages, or on the shopping cart page. * 47 * `home_page`: Predicts the next product that a user will most likely engage 48 * with or purchase based on the shopping or viewing history of the specified 49 * `userId` or `visitorId`. For example - Recommendations for you. * 50 * `product_detail`: Predicts the next product that a user will most likely 51 * engage with or purchase. The prediction is based on the shopping or viewing 52 * history of the specified `userId` or `visitorId` and its relevance to a 53 * specified `CatalogItem`. Typically used on product detail pages. For example 54 * - More items like this. * `recently_viewed_default`: Returns up to 75 items 55 * recently viewed by the specified `userId` or `visitorId`, most recent ones 56 * first. Returns nothing if neither of them has viewed any items yet. For 57 * example - Recently viewed. The full list of available placements can be seen 58 * at https://console.cloud.google.com/recommendation/datafeeds/default_catalog/ 59 * dashboard 60 * @param GoogleCloudRecommendationengineV1beta1PredictRequest $postBody 61 * @param array $optParams Optional parameters. 62 * @return GoogleCloudRecommendationengineV1beta1PredictResponse 63 */ 64 public function predict($name, GoogleCloudRecommendationengineV1beta1PredictRequest $postBody, $optParams = []) 65 { 66 $params = ['name' => $name, 'postBody' => $postBody]; 67 $params = array_merge($params, $optParams); 68 return $this->call('predict', [$params], GoogleCloudRecommendationengineV1beta1PredictResponse::class); 69 } 70} 71 72// Adding a class alias for backwards compatibility with the previous class name. 73class_alias(ProjectsLocationsCatalogsEventStoresPlacements::class, 'Google_Service_RecommendationsAI_Resource_ProjectsLocationsCatalogsEventStoresPlacements'); 74