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 |
|
---|
18 | namespace Google\Service\CloudRetail\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudRetail\GoogleCloudRetailV2PredictRequest;
|
---|
21 | use Google\Service\CloudRetail\GoogleCloudRetailV2PredictResponse;
|
---|
22 | use Google\Service\CloudRetail\GoogleCloudRetailV2SearchRequest;
|
---|
23 | use Google\Service\CloudRetail\GoogleCloudRetailV2SearchResponse;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "placements" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $retailService = new Google\Service\CloudRetail(...);
|
---|
30 | * $placements = $retailService->projects_locations_catalogs_placements;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsCatalogsPlacements extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Makes a recommendation prediction. (placements.predict)
|
---|
37 | *
|
---|
38 | * @param string $placement Required. Full resource name of the format: `{placem
|
---|
39 | * ent=projects/locations/global/catalogs/default_catalog/servingConfigs}` or
|
---|
40 | * `{placement=projects/locations/global/catalogs/default_catalog/placements}`.
|
---|
41 | * We 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 [Manage
|
---|
45 | * serving configs] (https://cloud.google.com/retail/docs/manage-configs). The
|
---|
46 | * 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 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function predict($placement, GoogleCloudRetailV2PredictRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['placement' => $placement, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('predict', [$params], GoogleCloudRetailV2PredictResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Performs a search. This feature is only available for users who have Retail
|
---|
61 | * Search enabled. Enable Retail Search on Cloud Console before using this
|
---|
62 | * feature. (placements.search)
|
---|
63 | *
|
---|
64 | * @param string $placement Required. The resource name of the Retail Search
|
---|
65 | * serving config, such as `projects/locations/global/catalogs/default_catalog/s
|
---|
66 | * ervingConfigs/default_serving_config` or the name of the legacy placement
|
---|
67 | * resource, such as `projects/locations/global/catalogs/default_catalog/placeme
|
---|
68 | * nts/default_search`. This field is used to identify the serving config name
|
---|
69 | * and the set of models that are used to make the search.
|
---|
70 | * @param GoogleCloudRetailV2SearchRequest $postBody
|
---|
71 | * @param array $optParams Optional parameters.
|
---|
72 | * @return GoogleCloudRetailV2SearchResponse
|
---|
73 | * @throws \Google\Service\Exception
|
---|
74 | */
|
---|
75 | public function search($placement, GoogleCloudRetailV2SearchRequest $postBody, $optParams = [])
|
---|
76 | {
|
---|
77 | $params = ['placement' => $placement, 'postBody' => $postBody];
|
---|
78 | $params = array_merge($params, $optParams);
|
---|
79 | return $this->call('search', [$params], GoogleCloudRetailV2SearchResponse::class);
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
84 | class_alias(ProjectsLocationsCatalogsPlacements::class, 'Google_Service_CloudRetail_Resource_ProjectsLocationsCatalogsPlacements');
|
---|