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\GoogleCloudRetailV2AttributesConfig;
|
---|
21 | use Google\Service\CloudRetail\GoogleCloudRetailV2Catalog;
|
---|
22 | use Google\Service\CloudRetail\GoogleCloudRetailV2CompleteQueryResponse;
|
---|
23 | use Google\Service\CloudRetail\GoogleCloudRetailV2CompletionConfig;
|
---|
24 | use Google\Service\CloudRetail\GoogleCloudRetailV2ExportAnalyticsMetricsRequest;
|
---|
25 | use Google\Service\CloudRetail\GoogleCloudRetailV2GenerativeQuestionConfig;
|
---|
26 | use Google\Service\CloudRetail\GoogleCloudRetailV2GenerativeQuestionsFeatureConfig;
|
---|
27 | use Google\Service\CloudRetail\GoogleCloudRetailV2GetDefaultBranchResponse;
|
---|
28 | use Google\Service\CloudRetail\GoogleCloudRetailV2ListCatalogsResponse;
|
---|
29 | use Google\Service\CloudRetail\GoogleCloudRetailV2SetDefaultBranchRequest;
|
---|
30 | use Google\Service\CloudRetail\GoogleLongrunningOperation;
|
---|
31 | use Google\Service\CloudRetail\GoogleProtobufEmpty;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * The "catalogs" collection of methods.
|
---|
35 | * Typical usage is:
|
---|
36 | * <code>
|
---|
37 | * $retailService = new Google\Service\CloudRetail(...);
|
---|
38 | * $catalogs = $retailService->projects_locations_catalogs;
|
---|
39 | * </code>
|
---|
40 | */
|
---|
41 | class ProjectsLocationsCatalogs extends \Google\Service\Resource
|
---|
42 | {
|
---|
43 | /**
|
---|
44 | * Completes the specified prefix with keyword suggestions. This feature is only
|
---|
45 | * available for users who have Retail Search enabled. Enable Retail Search on
|
---|
46 | * Cloud Console before using this feature. (catalogs.completeQuery)
|
---|
47 | *
|
---|
48 | * @param string $catalog Required. Catalog for which the completion is
|
---|
49 | * performed. Full resource name of catalog, such as
|
---|
50 | * `projects/locations/global/catalogs/default_catalog`.
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | *
|
---|
53 | * @opt_param string dataset Determines which dataset to use for fetching
|
---|
54 | * completion. "user-data" will use the imported dataset through
|
---|
55 | * CompletionService.ImportCompletionData. "cloud-retail" will use the dataset
|
---|
56 | * generated by cloud retail based on user events. If leave empty, it will use
|
---|
57 | * the "user-data". Current supported values: * user-data * cloud-retail: This
|
---|
58 | * option requires enabling auto-learning function first. See
|
---|
59 | * [guidelines](https://cloud.google.com/retail/docs/completion-
|
---|
60 | * overview#generated-completion-dataset).
|
---|
61 | * @opt_param string deviceType The device type context for completion
|
---|
62 | * suggestions. We recommend that you leave this field empty. It can apply
|
---|
63 | * different suggestions on different device types, e.g. `DESKTOP`, `MOBILE`. If
|
---|
64 | * it is empty, the suggestions are across all device types. Supported formats:
|
---|
65 | * * `UNKNOWN_DEVICE_TYPE` * `DESKTOP` * `MOBILE` * A customized string starts
|
---|
66 | * with `OTHER_`, e.g. `OTHER_IPHONE`.
|
---|
67 | * @opt_param bool enableAttributeSuggestions If true, attribute suggestions are
|
---|
68 | * enabled and provided in the response. This field is only available for the
|
---|
69 | * "cloud-retail" dataset.
|
---|
70 | * @opt_param string entity The entity for customers who run multiple entities,
|
---|
71 | * domains, sites, or regions, for example, `Google US`, `Google Ads`, `Waymo`,
|
---|
72 | * `google.com`, `youtube.com`, etc. If this is set, it must be an exact match
|
---|
73 | * with UserEvent.entity to get per-entity autocomplete results.
|
---|
74 | * @opt_param string languageCodes Note that this field applies for `user-data`
|
---|
75 | * dataset only. For requests with `cloud-retail` dataset, setting this field
|
---|
76 | * has no effect. The language filters applied to the output suggestions. If
|
---|
77 | * set, it should contain the language of the query. If not set, suggestions are
|
---|
78 | * returned without considering language restrictions. This is the BCP-47
|
---|
79 | * language code, such as "en-US" or "sr-Latn". For more information, see [Tags
|
---|
80 | * for Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
|
---|
81 | * number of language codes is 3.
|
---|
82 | * @opt_param int maxSuggestions Completion max suggestions. If left unset or
|
---|
83 | * set to 0, then will fallback to the configured value
|
---|
84 | * CompletionConfig.max_suggestions. The maximum allowed max suggestions is 20.
|
---|
85 | * If it is set higher, it will be capped by 20.
|
---|
86 | * @opt_param string query Required. The query used to generate suggestions. The
|
---|
87 | * maximum number of allowed characters is 255.
|
---|
88 | * @opt_param string visitorId Required field. A unique identifier for tracking
|
---|
89 | * visitors. For example, this could be implemented with an HTTP cookie, which
|
---|
90 | * should be able to uniquely identify a visitor on a single device. This unique
|
---|
91 | * identifier should not change if the visitor logs in or out of the website.
|
---|
92 | * The field must be a UTF-8 encoded string with a length limit of 128
|
---|
93 | * characters. Otherwise, an INVALID_ARGUMENT error is returned.
|
---|
94 | * @return GoogleCloudRetailV2CompleteQueryResponse
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function completeQuery($catalog, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['catalog' => $catalog];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('completeQuery', [$params], GoogleCloudRetailV2CompleteQueryResponse::class);
|
---|
102 | }
|
---|
103 | /**
|
---|
104 | * Exports analytics metrics. `Operation.response` is of type
|
---|
105 | * `ExportAnalyticsMetricsResponse`. `Operation.metadata` is of type
|
---|
106 | * `ExportMetadata`. (catalogs.exportAnalyticsMetrics)
|
---|
107 | *
|
---|
108 | * @param string $catalog Required. Full resource name of the parent catalog.
|
---|
109 | * Expected format: `projects/locations/catalogs`
|
---|
110 | * @param GoogleCloudRetailV2ExportAnalyticsMetricsRequest $postBody
|
---|
111 | * @param array $optParams Optional parameters.
|
---|
112 | * @return GoogleLongrunningOperation
|
---|
113 | * @throws \Google\Service\Exception
|
---|
114 | */
|
---|
115 | public function exportAnalyticsMetrics($catalog, GoogleCloudRetailV2ExportAnalyticsMetricsRequest $postBody, $optParams = [])
|
---|
116 | {
|
---|
117 | $params = ['catalog' => $catalog, 'postBody' => $postBody];
|
---|
118 | $params = array_merge($params, $optParams);
|
---|
119 | return $this->call('exportAnalyticsMetrics', [$params], GoogleLongrunningOperation::class);
|
---|
120 | }
|
---|
121 | /**
|
---|
122 | * Gets an AttributesConfig. (catalogs.getAttributesConfig)
|
---|
123 | *
|
---|
124 | * @param string $name Required. Full AttributesConfig resource name. Format: `p
|
---|
125 | * rojects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attrib
|
---|
126 | * utesConfig`
|
---|
127 | * @param array $optParams Optional parameters.
|
---|
128 | * @return GoogleCloudRetailV2AttributesConfig
|
---|
129 | * @throws \Google\Service\Exception
|
---|
130 | */
|
---|
131 | public function getAttributesConfig($name, $optParams = [])
|
---|
132 | {
|
---|
133 | $params = ['name' => $name];
|
---|
134 | $params = array_merge($params, $optParams);
|
---|
135 | return $this->call('getAttributesConfig', [$params], GoogleCloudRetailV2AttributesConfig::class);
|
---|
136 | }
|
---|
137 | /**
|
---|
138 | * Gets a CompletionConfig. (catalogs.getCompletionConfig)
|
---|
139 | *
|
---|
140 | * @param string $name Required. Full CompletionConfig resource name. Format: `p
|
---|
141 | * rojects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/comple
|
---|
142 | * tionConfig`
|
---|
143 | * @param array $optParams Optional parameters.
|
---|
144 | * @return GoogleCloudRetailV2CompletionConfig
|
---|
145 | * @throws \Google\Service\Exception
|
---|
146 | */
|
---|
147 | public function getCompletionConfig($name, $optParams = [])
|
---|
148 | {
|
---|
149 | $params = ['name' => $name];
|
---|
150 | $params = array_merge($params, $optParams);
|
---|
151 | return $this->call('getCompletionConfig', [$params], GoogleCloudRetailV2CompletionConfig::class);
|
---|
152 | }
|
---|
153 | /**
|
---|
154 | * Get which branch is currently default branch set by
|
---|
155 | * CatalogService.SetDefaultBranch method under a specified parent catalog.
|
---|
156 | * (catalogs.getDefaultBranch)
|
---|
157 | *
|
---|
158 | * @param string $catalog The parent catalog resource name, such as
|
---|
159 | * `projects/locations/global/catalogs/default_catalog`.
|
---|
160 | * @param array $optParams Optional parameters.
|
---|
161 | * @return GoogleCloudRetailV2GetDefaultBranchResponse
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function getDefaultBranch($catalog, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['catalog' => $catalog];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('getDefaultBranch', [$params], GoogleCloudRetailV2GetDefaultBranchResponse::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Manages overal generative question feature state -- enables toggling feature
|
---|
172 | * on and off. (catalogs.getGenerativeQuestionFeature)
|
---|
173 | *
|
---|
174 | * @param string $catalog Required. Resource name of the parent catalog. Format:
|
---|
175 | * projects/{project}/locations/{location}/catalogs/{catalog}
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | * @return GoogleCloudRetailV2GenerativeQuestionsFeatureConfig
|
---|
178 | * @throws \Google\Service\Exception
|
---|
179 | */
|
---|
180 | public function getGenerativeQuestionFeature($catalog, $optParams = [])
|
---|
181 | {
|
---|
182 | $params = ['catalog' => $catalog];
|
---|
183 | $params = array_merge($params, $optParams);
|
---|
184 | return $this->call('getGenerativeQuestionFeature', [$params], GoogleCloudRetailV2GenerativeQuestionsFeatureConfig::class);
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * Lists all the Catalogs associated with the project.
|
---|
188 | * (catalogs.listProjectsLocationsCatalogs)
|
---|
189 | *
|
---|
190 | * @param string $parent Required. The account resource name with an associated
|
---|
191 | * location. If the caller does not have permission to list Catalogs under this
|
---|
192 | * location, regardless of whether or not this location exists, a
|
---|
193 | * PERMISSION_DENIED error is returned.
|
---|
194 | * @param array $optParams Optional parameters.
|
---|
195 | *
|
---|
196 | * @opt_param int pageSize Maximum number of Catalogs to return. If unspecified,
|
---|
197 | * defaults to 50. The maximum allowed value is 1000. Values above 1000 will be
|
---|
198 | * coerced to 1000. If this field is negative, an INVALID_ARGUMENT is returned.
|
---|
199 | * @opt_param string pageToken A page token
|
---|
200 | * ListCatalogsResponse.next_page_token, received from a previous
|
---|
201 | * CatalogService.ListCatalogs call. Provide this to retrieve the subsequent
|
---|
202 | * page. When paginating, all other parameters provided to
|
---|
203 | * CatalogService.ListCatalogs must match the call that provided the page token.
|
---|
204 | * Otherwise, an INVALID_ARGUMENT error is returned.
|
---|
205 | * @return GoogleCloudRetailV2ListCatalogsResponse
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function listProjectsLocationsCatalogs($parent, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['parent' => $parent];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('list', [$params], GoogleCloudRetailV2ListCatalogsResponse::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Updates the Catalogs. (catalogs.patch)
|
---|
216 | *
|
---|
217 | * @param string $name Required. Immutable. The fully qualified resource name of
|
---|
218 | * the catalog.
|
---|
219 | * @param GoogleCloudRetailV2Catalog $postBody
|
---|
220 | * @param array $optParams Optional parameters.
|
---|
221 | *
|
---|
222 | * @opt_param string updateMask Indicates which fields in the provided Catalog
|
---|
223 | * to update. If an unsupported or unknown field is provided, an
|
---|
224 | * INVALID_ARGUMENT error is returned.
|
---|
225 | * @return GoogleCloudRetailV2Catalog
|
---|
226 | * @throws \Google\Service\Exception
|
---|
227 | */
|
---|
228 | public function patch($name, GoogleCloudRetailV2Catalog $postBody, $optParams = [])
|
---|
229 | {
|
---|
230 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
231 | $params = array_merge($params, $optParams);
|
---|
232 | return $this->call('patch', [$params], GoogleCloudRetailV2Catalog::class);
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * Set a specified branch id as default branch. API methods such as
|
---|
236 | * SearchService.Search, ProductService.GetProduct, ProductService.ListProducts
|
---|
237 | * will treat requests using "default_branch" to the actual branch id set as
|
---|
238 | * default. For example, if `projects/locations/catalogs/branches/1` is set as
|
---|
239 | * default, setting SearchRequest.branch to
|
---|
240 | * `projects/locations/catalogs/branches/default_branch` is equivalent to
|
---|
241 | * setting SearchRequest.branch to `projects/locations/catalogs/branches/1`.
|
---|
242 | * Using multiple branches can be useful when developers would like to have a
|
---|
243 | * staging branch to test and verify for future usage. When it becomes ready,
|
---|
244 | * developers switch on the staging branch using this API while keeping using
|
---|
245 | * `projects/locations/catalogs/branches/default_branch` as SearchRequest.branch
|
---|
246 | * to route the traffic to this staging branch. CAUTION: If you have live
|
---|
247 | * predict/search traffic, switching the default branch could potentially cause
|
---|
248 | * outages if the ID space of the new branch is very different from the old one.
|
---|
249 | * More specifically: * PredictionService will only return product IDs from
|
---|
250 | * branch {newBranch}. * SearchService will only return product IDs from branch
|
---|
251 | * {newBranch} (if branch is not explicitly set). * UserEventService will only
|
---|
252 | * join events with products from branch {newBranch}.
|
---|
253 | * (catalogs.setDefaultBranch)
|
---|
254 | *
|
---|
255 | * @param string $catalog Full resource name of the catalog, such as
|
---|
256 | * `projects/locations/global/catalogs/default_catalog`.
|
---|
257 | * @param GoogleCloudRetailV2SetDefaultBranchRequest $postBody
|
---|
258 | * @param array $optParams Optional parameters.
|
---|
259 | * @return GoogleProtobufEmpty
|
---|
260 | * @throws \Google\Service\Exception
|
---|
261 | */
|
---|
262 | public function setDefaultBranch($catalog, GoogleCloudRetailV2SetDefaultBranchRequest $postBody, $optParams = [])
|
---|
263 | {
|
---|
264 | $params = ['catalog' => $catalog, 'postBody' => $postBody];
|
---|
265 | $params = array_merge($params, $optParams);
|
---|
266 | return $this->call('setDefaultBranch', [$params], GoogleProtobufEmpty::class);
|
---|
267 | }
|
---|
268 | /**
|
---|
269 | * Updates the AttributesConfig. The catalog attributes in the request will be
|
---|
270 | * updated in the catalog, or inserted if they do not exist. Existing catalog
|
---|
271 | * attributes not included in the request will remain unchanged. Attributes that
|
---|
272 | * are assigned to products, but do not exist at the catalog level, are always
|
---|
273 | * included in the response. The product attribute is assigned default values
|
---|
274 | * for missing catalog attribute fields, e.g., searchable and dynamic facetable
|
---|
275 | * options. (catalogs.updateAttributesConfig)
|
---|
276 | *
|
---|
277 | * @param string $name Required. Immutable. The fully qualified resource name of
|
---|
278 | * the attribute config. Format: `projects/locations/catalogs/attributesConfig`
|
---|
279 | * @param GoogleCloudRetailV2AttributesConfig $postBody
|
---|
280 | * @param array $optParams Optional parameters.
|
---|
281 | *
|
---|
282 | * @opt_param string updateMask Indicates which fields in the provided
|
---|
283 | * AttributesConfig to update. The following is the only supported field: *
|
---|
284 | * AttributesConfig.catalog_attributes If not set, all supported fields are
|
---|
285 | * updated.
|
---|
286 | * @return GoogleCloudRetailV2AttributesConfig
|
---|
287 | * @throws \Google\Service\Exception
|
---|
288 | */
|
---|
289 | public function updateAttributesConfig($name, GoogleCloudRetailV2AttributesConfig $postBody, $optParams = [])
|
---|
290 | {
|
---|
291 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
292 | $params = array_merge($params, $optParams);
|
---|
293 | return $this->call('updateAttributesConfig', [$params], GoogleCloudRetailV2AttributesConfig::class);
|
---|
294 | }
|
---|
295 | /**
|
---|
296 | * Updates the CompletionConfigs. (catalogs.updateCompletionConfig)
|
---|
297 | *
|
---|
298 | * @param string $name Required. Immutable. Fully qualified name
|
---|
299 | * `projects/locations/catalogs/completionConfig`
|
---|
300 | * @param GoogleCloudRetailV2CompletionConfig $postBody
|
---|
301 | * @param array $optParams Optional parameters.
|
---|
302 | *
|
---|
303 | * @opt_param string updateMask Indicates which fields in the provided
|
---|
304 | * CompletionConfig to update. The following are the only supported fields: *
|
---|
305 | * CompletionConfig.matching_order * CompletionConfig.max_suggestions *
|
---|
306 | * CompletionConfig.min_prefix_length * CompletionConfig.auto_learning If not
|
---|
307 | * set, all supported fields are updated.
|
---|
308 | * @return GoogleCloudRetailV2CompletionConfig
|
---|
309 | * @throws \Google\Service\Exception
|
---|
310 | */
|
---|
311 | public function updateCompletionConfig($name, GoogleCloudRetailV2CompletionConfig $postBody, $optParams = [])
|
---|
312 | {
|
---|
313 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
314 | $params = array_merge($params, $optParams);
|
---|
315 | return $this->call('updateCompletionConfig', [$params], GoogleCloudRetailV2CompletionConfig::class);
|
---|
316 | }
|
---|
317 | /**
|
---|
318 | * Allows management of individual questions.
|
---|
319 | * (catalogs.updateGenerativeQuestion)
|
---|
320 | *
|
---|
321 | * @param string $catalog Required. Resource name of the catalog. Format:
|
---|
322 | * projects/{project}/locations/{location}/catalogs/{catalog}
|
---|
323 | * @param GoogleCloudRetailV2GenerativeQuestionConfig $postBody
|
---|
324 | * @param array $optParams Optional parameters.
|
---|
325 | *
|
---|
326 | * @opt_param string updateMask Optional. Indicates which fields in the provided
|
---|
327 | * GenerativeQuestionConfig to update. The following are NOT supported: *
|
---|
328 | * GenerativeQuestionConfig.frequency If not set or empty, all supported fields
|
---|
329 | * are updated.
|
---|
330 | * @return GoogleCloudRetailV2GenerativeQuestionConfig
|
---|
331 | * @throws \Google\Service\Exception
|
---|
332 | */
|
---|
333 | public function updateGenerativeQuestion($catalog, GoogleCloudRetailV2GenerativeQuestionConfig $postBody, $optParams = [])
|
---|
334 | {
|
---|
335 | $params = ['catalog' => $catalog, 'postBody' => $postBody];
|
---|
336 | $params = array_merge($params, $optParams);
|
---|
337 | return $this->call('updateGenerativeQuestion', [$params], GoogleCloudRetailV2GenerativeQuestionConfig::class);
|
---|
338 | }
|
---|
339 | /**
|
---|
340 | * Manages overal generative question feature state -- enables toggling feature
|
---|
341 | * on and off. (catalogs.updateGenerativeQuestionFeature)
|
---|
342 | *
|
---|
343 | * @param string $catalog Required. Resource name of the affected catalog.
|
---|
344 | * Format: projects/{project}/locations/{location}/catalogs/{catalog}
|
---|
345 | * @param GoogleCloudRetailV2GenerativeQuestionsFeatureConfig $postBody
|
---|
346 | * @param array $optParams Optional parameters.
|
---|
347 | *
|
---|
348 | * @opt_param string updateMask Optional. Indicates which fields in the provided
|
---|
349 | * GenerativeQuestionsFeatureConfig to update. If not set or empty, all
|
---|
350 | * supported fields are updated.
|
---|
351 | * @return GoogleCloudRetailV2GenerativeQuestionsFeatureConfig
|
---|
352 | * @throws \Google\Service\Exception
|
---|
353 | */
|
---|
354 | public function updateGenerativeQuestionFeature($catalog, GoogleCloudRetailV2GenerativeQuestionsFeatureConfig $postBody, $optParams = [])
|
---|
355 | {
|
---|
356 | $params = ['catalog' => $catalog, 'postBody' => $postBody];
|
---|
357 | $params = array_merge($params, $optParams);
|
---|
358 | return $this->call('updateGenerativeQuestionFeature', [$params], GoogleCloudRetailV2GenerativeQuestionsFeatureConfig::class);
|
---|
359 | }
|
---|
360 | }
|
---|
361 |
|
---|
362 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
363 | class_alias(ProjectsLocationsCatalogs::class, 'Google_Service_CloudRetail_Resource_ProjectsLocationsCatalogs');
|
---|