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\GoogleCloudRetailV2AddControlRequest;
|
---|
21 | use Google\Service\CloudRetail\GoogleCloudRetailV2ListServingConfigsResponse;
|
---|
22 | use Google\Service\CloudRetail\GoogleCloudRetailV2PredictRequest;
|
---|
23 | use Google\Service\CloudRetail\GoogleCloudRetailV2PredictResponse;
|
---|
24 | use Google\Service\CloudRetail\GoogleCloudRetailV2RemoveControlRequest;
|
---|
25 | use Google\Service\CloudRetail\GoogleCloudRetailV2SearchRequest;
|
---|
26 | use Google\Service\CloudRetail\GoogleCloudRetailV2SearchResponse;
|
---|
27 | use Google\Service\CloudRetail\GoogleCloudRetailV2ServingConfig;
|
---|
28 | use Google\Service\CloudRetail\GoogleProtobufEmpty;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "servingConfigs" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $retailService = new Google\Service\CloudRetail(...);
|
---|
35 | * $servingConfigs = $retailService->projects_locations_catalogs_servingConfigs;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class ProjectsLocationsCatalogsServingConfigs extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Enables a Control on the specified ServingConfig. The control is added in the
|
---|
42 | * last position of the list of controls it belongs to (e.g. if it's a facet
|
---|
43 | * spec control it will be applied in the last position of
|
---|
44 | * servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has
|
---|
45 | * already been applied. Returns a FAILED_PRECONDITION error if the addition
|
---|
46 | * could exceed maximum number of control allowed for that type of control.
|
---|
47 | * (servingConfigs.addControl)
|
---|
48 | *
|
---|
49 | * @param string $servingConfig Required. The source ServingConfig resource name
|
---|
50 | * . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalo
|
---|
51 | * g_id}/servingConfigs/{serving_config_id}`
|
---|
52 | * @param GoogleCloudRetailV2AddControlRequest $postBody
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | * @return GoogleCloudRetailV2ServingConfig
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function addControl($servingConfig, GoogleCloudRetailV2AddControlRequest $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['servingConfig' => $servingConfig, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('addControl', [$params], GoogleCloudRetailV2ServingConfig::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Creates a ServingConfig. A maximum of 100 ServingConfigs are allowed in a
|
---|
65 | * Catalog, otherwise a FAILED_PRECONDITION error is returned.
|
---|
66 | * (servingConfigs.create)
|
---|
67 | *
|
---|
68 | * @param string $parent Required. Full resource name of parent. Format:
|
---|
69 | * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
|
---|
70 | * @param GoogleCloudRetailV2ServingConfig $postBody
|
---|
71 | * @param array $optParams Optional parameters.
|
---|
72 | *
|
---|
73 | * @opt_param string servingConfigId Required. The ID to use for the
|
---|
74 | * ServingConfig, which will become the final component of the ServingConfig's
|
---|
75 | * resource name. This value should be 4-63 characters, and valid characters are
|
---|
76 | * /a-z-_/.
|
---|
77 | * @return GoogleCloudRetailV2ServingConfig
|
---|
78 | * @throws \Google\Service\Exception
|
---|
79 | */
|
---|
80 | public function create($parent, GoogleCloudRetailV2ServingConfig $postBody, $optParams = [])
|
---|
81 | {
|
---|
82 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
83 | $params = array_merge($params, $optParams);
|
---|
84 | return $this->call('create', [$params], GoogleCloudRetailV2ServingConfig::class);
|
---|
85 | }
|
---|
86 | /**
|
---|
87 | * Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does
|
---|
88 | * not exist. (servingConfigs.delete)
|
---|
89 | *
|
---|
90 | * @param string $name Required. The resource name of the ServingConfig to
|
---|
91 | * delete. Format: `projects/{project_number}/locations/{location_id}/catalogs/{
|
---|
92 | * catalog_id}/servingConfigs/{serving_config_id}`
|
---|
93 | * @param array $optParams Optional parameters.
|
---|
94 | * @return GoogleProtobufEmpty
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function delete($name, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['name' => $name];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
102 | }
|
---|
103 | /**
|
---|
104 | * Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not
|
---|
105 | * exist. (servingConfigs.get)
|
---|
106 | *
|
---|
107 | * @param string $name Required. The resource name of the ServingConfig to get.
|
---|
108 | * Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_
|
---|
109 | * id}/servingConfigs/{serving_config_id}`
|
---|
110 | * @param array $optParams Optional parameters.
|
---|
111 | * @return GoogleCloudRetailV2ServingConfig
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function get($name, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['name' => $name];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('get', [$params], GoogleCloudRetailV2ServingConfig::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Lists all ServingConfigs linked to this catalog.
|
---|
122 | * (servingConfigs.listProjectsLocationsCatalogsServingConfigs)
|
---|
123 | *
|
---|
124 | * @param string $parent Required. The catalog resource name. Format:
|
---|
125 | * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | *
|
---|
128 | * @opt_param int pageSize Optional. Maximum number of results to return. If
|
---|
129 | * unspecified, defaults to 100. If a value greater than 100 is provided, at
|
---|
130 | * most 100 results are returned.
|
---|
131 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
132 | * `ListServingConfigs` call. Provide this to retrieve the subsequent page.
|
---|
133 | * @return GoogleCloudRetailV2ListServingConfigsResponse
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function listProjectsLocationsCatalogsServingConfigs($parent, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['parent' => $parent];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('list', [$params], GoogleCloudRetailV2ListServingConfigsResponse::class);
|
---|
141 | }
|
---|
142 | /**
|
---|
143 | * Updates a ServingConfig. (servingConfigs.patch)
|
---|
144 | *
|
---|
145 | * @param string $name Immutable. Fully qualified name
|
---|
146 | * `projects/locations/global/catalogs/servingConfig`
|
---|
147 | * @param GoogleCloudRetailV2ServingConfig $postBody
|
---|
148 | * @param array $optParams Optional parameters.
|
---|
149 | *
|
---|
150 | * @opt_param string updateMask Indicates which fields in the provided
|
---|
151 | * ServingConfig to update. The following are NOT supported: *
|
---|
152 | * ServingConfig.name If not set, all supported fields are updated.
|
---|
153 | * @return GoogleCloudRetailV2ServingConfig
|
---|
154 | * @throws \Google\Service\Exception
|
---|
155 | */
|
---|
156 | public function patch($name, GoogleCloudRetailV2ServingConfig $postBody, $optParams = [])
|
---|
157 | {
|
---|
158 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
159 | $params = array_merge($params, $optParams);
|
---|
160 | return $this->call('patch', [$params], GoogleCloudRetailV2ServingConfig::class);
|
---|
161 | }
|
---|
162 | /**
|
---|
163 | * Makes a recommendation prediction. (servingConfigs.predict)
|
---|
164 | *
|
---|
165 | * @param string $placement Required. Full resource name of the format: `{placem
|
---|
166 | * ent=projects/locations/global/catalogs/default_catalog/servingConfigs}` or
|
---|
167 | * `{placement=projects/locations/global/catalogs/default_catalog/placements}`.
|
---|
168 | * We recommend using the `servingConfigs` resource. `placements` is a legacy
|
---|
169 | * resource. The ID of the Recommendations AI serving config or placement.
|
---|
170 | * Before you can request predictions from your model, you must create at least
|
---|
171 | * one serving config or placement for it. For more information, see [Manage
|
---|
172 | * serving configs] (https://cloud.google.com/retail/docs/manage-configs). The
|
---|
173 | * full list of available serving configs can be seen at
|
---|
174 | * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs
|
---|
175 | * @param GoogleCloudRetailV2PredictRequest $postBody
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | * @return GoogleCloudRetailV2PredictResponse
|
---|
178 | * @throws \Google\Service\Exception
|
---|
179 | */
|
---|
180 | public function predict($placement, GoogleCloudRetailV2PredictRequest $postBody, $optParams = [])
|
---|
181 | {
|
---|
182 | $params = ['placement' => $placement, 'postBody' => $postBody];
|
---|
183 | $params = array_merge($params, $optParams);
|
---|
184 | return $this->call('predict', [$params], GoogleCloudRetailV2PredictResponse::class);
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * Disables a Control on the specified ServingConfig. The control is removed
|
---|
188 | * from the ServingConfig. Returns a NOT_FOUND error if the Control is not
|
---|
189 | * enabled for the ServingConfig. (servingConfigs.removeControl)
|
---|
190 | *
|
---|
191 | * @param string $servingConfig Required. The source ServingConfig resource name
|
---|
192 | * . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalo
|
---|
193 | * g_id}/servingConfigs/{serving_config_id}`
|
---|
194 | * @param GoogleCloudRetailV2RemoveControlRequest $postBody
|
---|
195 | * @param array $optParams Optional parameters.
|
---|
196 | * @return GoogleCloudRetailV2ServingConfig
|
---|
197 | * @throws \Google\Service\Exception
|
---|
198 | */
|
---|
199 | public function removeControl($servingConfig, GoogleCloudRetailV2RemoveControlRequest $postBody, $optParams = [])
|
---|
200 | {
|
---|
201 | $params = ['servingConfig' => $servingConfig, 'postBody' => $postBody];
|
---|
202 | $params = array_merge($params, $optParams);
|
---|
203 | return $this->call('removeControl', [$params], GoogleCloudRetailV2ServingConfig::class);
|
---|
204 | }
|
---|
205 | /**
|
---|
206 | * Performs a search. This feature is only available for users who have Retail
|
---|
207 | * Search enabled. Enable Retail Search on Cloud Console before using this
|
---|
208 | * feature. (servingConfigs.search)
|
---|
209 | *
|
---|
210 | * @param string $placement Required. The resource name of the Retail Search
|
---|
211 | * serving config, such as `projects/locations/global/catalogs/default_catalog/s
|
---|
212 | * ervingConfigs/default_serving_config` or the name of the legacy placement
|
---|
213 | * resource, such as `projects/locations/global/catalogs/default_catalog/placeme
|
---|
214 | * nts/default_search`. This field is used to identify the serving config name
|
---|
215 | * and the set of models that are used to make the search.
|
---|
216 | * @param GoogleCloudRetailV2SearchRequest $postBody
|
---|
217 | * @param array $optParams Optional parameters.
|
---|
218 | * @return GoogleCloudRetailV2SearchResponse
|
---|
219 | * @throws \Google\Service\Exception
|
---|
220 | */
|
---|
221 | public function search($placement, GoogleCloudRetailV2SearchRequest $postBody, $optParams = [])
|
---|
222 | {
|
---|
223 | $params = ['placement' => $placement, 'postBody' => $postBody];
|
---|
224 | $params = array_merge($params, $optParams);
|
---|
225 | return $this->call('search', [$params], GoogleCloudRetailV2SearchResponse::class);
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
230 | class_alias(ProjectsLocationsCatalogsServingConfigs::class, 'Google_Service_CloudRetail_Resource_ProjectsLocationsCatalogsServingConfigs');
|
---|