google_cloud_retail_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate google_cloud_type;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Configures what level the product should be uploaded with regards to
41/// how users will be send events and how predictions will be made.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct ProductLevelConfig {
45 /// The type of [Product][google.cloud.retail.v2.Product]s allowed to be
46 /// ingested into the catalog. Acceptable values are:
47 ///
48 /// * `primary` (default): You can ingest
49 /// [Product][google.cloud.retail.v2.Product]s of all types. When
50 /// ingesting a [Product][google.cloud.retail.v2.Product], its type will
51 /// default to
52 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if
53 /// unset.
54 /// * `variant` (incompatible with Retail Search): You can only
55 /// ingest
56 /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
57 /// [Product][google.cloud.retail.v2.Product]s. This means
58 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
59 /// cannot be empty.
60 ///
61 /// If this field is set to an invalid value other than these, an
62 /// INVALID_ARGUMENT error is returned.
63 ///
64 /// If this field is `variant` and
65 /// [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
66 /// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
67 ///
68 /// See [Product
69 /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
70 /// for more details.
71 ///
72 /// [google.cloud.retail.v2.Product]: crate::model::Product
73 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
74 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
75 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
76 /// [google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]: crate::model::ProductLevelConfig::merchant_center_product_id_field
77 pub ingestion_product_type: std::string::String,
78
79 /// Which field of [Merchant Center
80 /// Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
81 /// imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
82 /// values are:
83 ///
84 /// * `offerId` (default): Import `offerId` as the product ID.
85 /// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
86 /// API will choose one item from the ones with the same `itemGroupId`, and
87 /// use it to represent the item group.
88 ///
89 /// If this field is set to an invalid value other than these, an
90 /// INVALID_ARGUMENT error is returned.
91 ///
92 /// If this field is `itemGroupId` and
93 /// [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
94 /// is `variant`, an INVALID_ARGUMENT error is returned.
95 ///
96 /// See [Product
97 /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
98 /// for more details.
99 ///
100 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
101 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
102 pub merchant_center_product_id_field: std::string::String,
103
104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
105}
106
107impl ProductLevelConfig {
108 pub fn new() -> Self {
109 std::default::Default::default()
110 }
111
112 /// Sets the value of [ingestion_product_type][crate::model::ProductLevelConfig::ingestion_product_type].
113 ///
114 /// # Example
115 /// ```ignore,no_run
116 /// # use google_cloud_retail_v2::model::ProductLevelConfig;
117 /// let x = ProductLevelConfig::new().set_ingestion_product_type("example");
118 /// ```
119 pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
120 mut self,
121 v: T,
122 ) -> Self {
123 self.ingestion_product_type = v.into();
124 self
125 }
126
127 /// Sets the value of [merchant_center_product_id_field][crate::model::ProductLevelConfig::merchant_center_product_id_field].
128 ///
129 /// # Example
130 /// ```ignore,no_run
131 /// # use google_cloud_retail_v2::model::ProductLevelConfig;
132 /// let x = ProductLevelConfig::new().set_merchant_center_product_id_field("example");
133 /// ```
134 pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
135 mut self,
136 v: T,
137 ) -> Self {
138 self.merchant_center_product_id_field = v.into();
139 self
140 }
141}
142
143impl wkt::message::Message for ProductLevelConfig {
144 fn typename() -> &'static str {
145 "type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
146 }
147}
148
149/// Catalog level attribute config for an attribute. For example, if customers
150/// want to enable/disable facet for a specific attribute.
151#[derive(Clone, Default, PartialEq)]
152#[non_exhaustive]
153pub struct CatalogAttribute {
154 /// Required. Attribute name.
155 /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
156 /// `attributes.xyz`.
157 /// To be indexable, the attribute name can contain only alpha-numeric
158 /// characters and underscores. For example, an attribute named
159 /// `attributes.abc_xyz` can be indexed, but an attribute named
160 /// `attributes.abc-xyz` cannot be indexed.
161 ///
162 /// If the attribute key starts with `attributes.`, then the attribute is a
163 /// custom attribute. Attributes such as `brands`, `patterns`, and `title` are
164 /// built-in and called system attributes.
165 pub key: std::string::String,
166
167 /// Output only. Indicates whether this attribute has been used by any
168 /// products. `True` if at least one [Product][google.cloud.retail.v2.Product]
169 /// is using this attribute in
170 /// [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
171 /// this field is `False`.
172 ///
173 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
174 /// pre-loaded by using
175 /// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
176 /// or
177 /// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
178 /// APIs. This field is `False` for pre-loaded
179 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
180 ///
181 /// Only pre-loaded [catalog
182 /// attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in
183 /// use by products nor predefined can be deleted. [Catalog
184 /// attributes][google.cloud.retail.v2.CatalogAttribute] that are
185 /// either in use by products or are predefined attributes cannot be deleted;
186 /// however, their configuration properties will reset to default values upon
187 /// removal request.
188 ///
189 /// After catalog changes, it takes about 10 minutes for this field to update.
190 ///
191 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
192 /// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
193 /// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
194 /// [google.cloud.retail.v2.Product]: crate::model::Product
195 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
196 pub in_use: bool,
197
198 /// Output only. The type of this attribute. This is derived from the attribute
199 /// in [Product.attributes][google.cloud.retail.v2.Product.attributes].
200 ///
201 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
202 pub r#type: crate::model::catalog_attribute::AttributeType,
203
204 /// When
205 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
206 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
207 /// are indexed so that it can be filtered, faceted, or boosted in
208 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
209 ///
210 /// Must be specified when
211 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
212 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
213 ///
214 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
215 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
216 pub indexable_option: crate::model::catalog_attribute::IndexableOption,
217
218 /// If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
219 /// facet. Could only be DYNAMIC_FACETABLE_DISABLED if
220 /// [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
221 /// is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
222 ///
223 /// Must be specified, otherwise throws INVALID_FORMAT error.
224 ///
225 /// [google.cloud.retail.v2.CatalogAttribute.indexable_option]: crate::model::CatalogAttribute::indexable_option
226 pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
227
228 /// When
229 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
230 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
231 /// are searchable by text queries in
232 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
233 ///
234 /// If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
235 /// will not be searchable by text queries in
236 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
237 /// there are no text values associated to numerical attributes.
238 ///
239 /// Must be specified, when
240 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
241 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
242 ///
243 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
244 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
245 pub searchable_option: crate::model::catalog_attribute::SearchableOption,
246
247 /// If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable.
248 /// This property only applies to textual custom attributes and requires
249 /// indexable set to enabled to enable exact-searchable. If unset, the server
250 /// behavior defaults to
251 /// [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED].
252 ///
253 /// [google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]: crate::model::catalog_attribute::ExactSearchableOption::ExactSearchableDisabled
254 pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
255
256 /// If RETRIEVABLE_ENABLED, attribute values are retrievable in the search
257 /// results. If unset, the server behavior defaults to
258 /// [RETRIEVABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED].
259 ///
260 /// [google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]: crate::model::catalog_attribute::RetrievableOption::RetrievableDisabled
261 pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
262
263 /// Contains facet options.
264 pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
265
266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
267}
268
269impl CatalogAttribute {
270 pub fn new() -> Self {
271 std::default::Default::default()
272 }
273
274 /// Sets the value of [key][crate::model::CatalogAttribute::key].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_retail_v2::model::CatalogAttribute;
279 /// let x = CatalogAttribute::new().set_key("example");
280 /// ```
281 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
282 self.key = v.into();
283 self
284 }
285
286 /// Sets the value of [in_use][crate::model::CatalogAttribute::in_use].
287 ///
288 /// # Example
289 /// ```ignore,no_run
290 /// # use google_cloud_retail_v2::model::CatalogAttribute;
291 /// let x = CatalogAttribute::new().set_in_use(true);
292 /// ```
293 pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
294 self.in_use = v.into();
295 self
296 }
297
298 /// Sets the value of [r#type][crate::model::CatalogAttribute::type].
299 ///
300 /// # Example
301 /// ```ignore,no_run
302 /// # use google_cloud_retail_v2::model::CatalogAttribute;
303 /// use google_cloud_retail_v2::model::catalog_attribute::AttributeType;
304 /// let x0 = CatalogAttribute::new().set_type(AttributeType::Textual);
305 /// let x1 = CatalogAttribute::new().set_type(AttributeType::Numerical);
306 /// ```
307 pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
308 mut self,
309 v: T,
310 ) -> Self {
311 self.r#type = v.into();
312 self
313 }
314
315 /// Sets the value of [indexable_option][crate::model::CatalogAttribute::indexable_option].
316 ///
317 /// # Example
318 /// ```ignore,no_run
319 /// # use google_cloud_retail_v2::model::CatalogAttribute;
320 /// use google_cloud_retail_v2::model::catalog_attribute::IndexableOption;
321 /// let x0 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableEnabled);
322 /// let x1 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableDisabled);
323 /// ```
324 pub fn set_indexable_option<
325 T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
326 >(
327 mut self,
328 v: T,
329 ) -> Self {
330 self.indexable_option = v.into();
331 self
332 }
333
334 /// Sets the value of [dynamic_facetable_option][crate::model::CatalogAttribute::dynamic_facetable_option].
335 ///
336 /// # Example
337 /// ```ignore,no_run
338 /// # use google_cloud_retail_v2::model::CatalogAttribute;
339 /// use google_cloud_retail_v2::model::catalog_attribute::DynamicFacetableOption;
340 /// let x0 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableEnabled);
341 /// let x1 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableDisabled);
342 /// ```
343 pub fn set_dynamic_facetable_option<
344 T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
345 >(
346 mut self,
347 v: T,
348 ) -> Self {
349 self.dynamic_facetable_option = v.into();
350 self
351 }
352
353 /// Sets the value of [searchable_option][crate::model::CatalogAttribute::searchable_option].
354 ///
355 /// # Example
356 /// ```ignore,no_run
357 /// # use google_cloud_retail_v2::model::CatalogAttribute;
358 /// use google_cloud_retail_v2::model::catalog_attribute::SearchableOption;
359 /// let x0 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableEnabled);
360 /// let x1 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableDisabled);
361 /// ```
362 pub fn set_searchable_option<
363 T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
364 >(
365 mut self,
366 v: T,
367 ) -> Self {
368 self.searchable_option = v.into();
369 self
370 }
371
372 /// Sets the value of [exact_searchable_option][crate::model::CatalogAttribute::exact_searchable_option].
373 ///
374 /// # Example
375 /// ```ignore,no_run
376 /// # use google_cloud_retail_v2::model::CatalogAttribute;
377 /// use google_cloud_retail_v2::model::catalog_attribute::ExactSearchableOption;
378 /// let x0 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableEnabled);
379 /// let x1 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableDisabled);
380 /// ```
381 pub fn set_exact_searchable_option<
382 T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
383 >(
384 mut self,
385 v: T,
386 ) -> Self {
387 self.exact_searchable_option = v.into();
388 self
389 }
390
391 /// Sets the value of [retrievable_option][crate::model::CatalogAttribute::retrievable_option].
392 ///
393 /// # Example
394 /// ```ignore,no_run
395 /// # use google_cloud_retail_v2::model::CatalogAttribute;
396 /// use google_cloud_retail_v2::model::catalog_attribute::RetrievableOption;
397 /// let x0 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableEnabled);
398 /// let x1 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableDisabled);
399 /// ```
400 pub fn set_retrievable_option<
401 T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
402 >(
403 mut self,
404 v: T,
405 ) -> Self {
406 self.retrievable_option = v.into();
407 self
408 }
409
410 /// Sets the value of [facet_config][crate::model::CatalogAttribute::facet_config].
411 ///
412 /// # Example
413 /// ```ignore,no_run
414 /// # use google_cloud_retail_v2::model::CatalogAttribute;
415 /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
416 /// let x = CatalogAttribute::new().set_facet_config(FacetConfig::default()/* use setters */);
417 /// ```
418 pub fn set_facet_config<T>(mut self, v: T) -> Self
419 where
420 T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
421 {
422 self.facet_config = std::option::Option::Some(v.into());
423 self
424 }
425
426 /// Sets or clears the value of [facet_config][crate::model::CatalogAttribute::facet_config].
427 ///
428 /// # Example
429 /// ```ignore,no_run
430 /// # use google_cloud_retail_v2::model::CatalogAttribute;
431 /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
432 /// let x = CatalogAttribute::new().set_or_clear_facet_config(Some(FacetConfig::default()/* use setters */));
433 /// let x = CatalogAttribute::new().set_or_clear_facet_config(None::<FacetConfig>);
434 /// ```
435 pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
436 where
437 T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
438 {
439 self.facet_config = v.map(|x| x.into());
440 self
441 }
442}
443
444impl wkt::message::Message for CatalogAttribute {
445 fn typename() -> &'static str {
446 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
447 }
448}
449
450/// Defines additional types related to [CatalogAttribute].
451pub mod catalog_attribute {
452 #[allow(unused_imports)]
453 use super::*;
454
455 /// Possible options for the facet that corresponds to the current attribute
456 /// config.
457 #[derive(Clone, Default, PartialEq)]
458 #[non_exhaustive]
459 pub struct FacetConfig {
460 /// If you don't set the facet
461 /// [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
462 /// in the request to a numerical attribute, then we use the computed
463 /// intervals with rounded bounds obtained from all its product numerical
464 /// attribute values. The computed intervals might not be ideal for some
465 /// attributes. Therefore, we give you the option to overwrite them with the
466 /// facet_intervals field. The maximum of facet intervals per
467 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
468 /// interval must have a lower bound or an upper bound. If both bounds are
469 /// provided, then the lower bound must be smaller or equal than the upper
470 /// bound.
471 ///
472 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
473 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
474 pub facet_intervals: std::vec::Vec<crate::model::Interval>,
475
476 /// Each instance represents a list of attribute values to ignore as facet
477 /// values for a specific time range. The maximum number of instances per
478 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
479 ///
480 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
481 pub ignored_facet_values:
482 std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
483
484 /// Each instance replaces a list of facet values by a merged facet
485 /// value. If a facet value is not in any list, then it will stay the same.
486 /// To avoid conflicts, only paths of length 1 are accepted. In other words,
487 /// if "dark_blue" merged into "BLUE", then the latter can't merge into
488 /// "blues" because this would create a path of length 2. The maximum number
489 /// of instances of MergedFacetValue per
490 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
491 /// feature is available only for textual custom attributes.
492 ///
493 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
494 pub merged_facet_values:
495 std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
496
497 /// Use this field only if you want to merge a facet key into another facet
498 /// key.
499 pub merged_facet:
500 std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
501
502 /// Set this field only if you want to rerank based on facet values engaged
503 /// by the user for the current key. This option is only possible for custom
504 /// facetable textual keys.
505 pub rerank_config:
506 std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
507
508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
509 }
510
511 impl FacetConfig {
512 pub fn new() -> Self {
513 std::default::Default::default()
514 }
515
516 /// Sets the value of [facet_intervals][crate::model::catalog_attribute::FacetConfig::facet_intervals].
517 ///
518 /// # Example
519 /// ```ignore,no_run
520 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
521 /// use google_cloud_retail_v2::model::Interval;
522 /// let x = FacetConfig::new()
523 /// .set_facet_intervals([
524 /// Interval::default()/* use setters */,
525 /// Interval::default()/* use (different) setters */,
526 /// ]);
527 /// ```
528 pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
529 where
530 T: std::iter::IntoIterator<Item = V>,
531 V: std::convert::Into<crate::model::Interval>,
532 {
533 use std::iter::Iterator;
534 self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
535 self
536 }
537
538 /// Sets the value of [ignored_facet_values][crate::model::catalog_attribute::FacetConfig::ignored_facet_values].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
543 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
544 /// let x = FacetConfig::new()
545 /// .set_ignored_facet_values([
546 /// IgnoredFacetValues::default()/* use setters */,
547 /// IgnoredFacetValues::default()/* use (different) setters */,
548 /// ]);
549 /// ```
550 pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
551 where
552 T: std::iter::IntoIterator<Item = V>,
553 V: std::convert::Into<
554 crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
555 >,
556 {
557 use std::iter::Iterator;
558 self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
559 self
560 }
561
562 /// Sets the value of [merged_facet_values][crate::model::catalog_attribute::FacetConfig::merged_facet_values].
563 ///
564 /// # Example
565 /// ```ignore,no_run
566 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
567 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
568 /// let x = FacetConfig::new()
569 /// .set_merged_facet_values([
570 /// MergedFacetValue::default()/* use setters */,
571 /// MergedFacetValue::default()/* use (different) setters */,
572 /// ]);
573 /// ```
574 pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
575 where
576 T: std::iter::IntoIterator<Item = V>,
577 V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
578 {
579 use std::iter::Iterator;
580 self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
581 self
582 }
583
584 /// Sets the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
585 ///
586 /// # Example
587 /// ```ignore,no_run
588 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
589 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
590 /// let x = FacetConfig::new().set_merged_facet(MergedFacet::default()/* use setters */);
591 /// ```
592 pub fn set_merged_facet<T>(mut self, v: T) -> Self
593 where
594 T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
595 {
596 self.merged_facet = std::option::Option::Some(v.into());
597 self
598 }
599
600 /// Sets or clears the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
605 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
606 /// let x = FacetConfig::new().set_or_clear_merged_facet(Some(MergedFacet::default()/* use setters */));
607 /// let x = FacetConfig::new().set_or_clear_merged_facet(None::<MergedFacet>);
608 /// ```
609 pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
610 where
611 T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
612 {
613 self.merged_facet = v.map(|x| x.into());
614 self
615 }
616
617 /// Sets the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
618 ///
619 /// # Example
620 /// ```ignore,no_run
621 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
622 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
623 /// let x = FacetConfig::new().set_rerank_config(RerankConfig::default()/* use setters */);
624 /// ```
625 pub fn set_rerank_config<T>(mut self, v: T) -> Self
626 where
627 T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
628 {
629 self.rerank_config = std::option::Option::Some(v.into());
630 self
631 }
632
633 /// Sets or clears the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
634 ///
635 /// # Example
636 /// ```ignore,no_run
637 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
638 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
639 /// let x = FacetConfig::new().set_or_clear_rerank_config(Some(RerankConfig::default()/* use setters */));
640 /// let x = FacetConfig::new().set_or_clear_rerank_config(None::<RerankConfig>);
641 /// ```
642 pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
643 where
644 T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
645 {
646 self.rerank_config = v.map(|x| x.into());
647 self
648 }
649 }
650
651 impl wkt::message::Message for FacetConfig {
652 fn typename() -> &'static str {
653 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
654 }
655 }
656
657 /// Defines additional types related to [FacetConfig].
658 pub mod facet_config {
659 #[allow(unused_imports)]
660 use super::*;
661
662 /// [Facet values][google.cloud.retail.v2.SearchResponse.Facet.values] to
663 /// ignore on [facets][google.cloud.retail.v2.SearchResponse.Facet] during
664 /// the specified time range for the given
665 /// [SearchResponse.Facet.key][google.cloud.retail.v2.SearchResponse.Facet.key]
666 /// attribute.
667 ///
668 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
669 /// [google.cloud.retail.v2.SearchResponse.Facet.key]: crate::model::search_response::Facet::key
670 /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
671 #[derive(Clone, Default, PartialEq)]
672 #[non_exhaustive]
673 pub struct IgnoredFacetValues {
674 /// List of facet values to ignore for the following time range. The facet
675 /// values are the same as the attribute values. There is a limit of 10
676 /// values per instance of IgnoredFacetValues. Each value can have at most
677 /// 128 characters.
678 pub values: std::vec::Vec<std::string::String>,
679
680 /// Time range for the current list of facet values to ignore.
681 /// If multiple time ranges are specified for an facet value for the
682 /// current attribute, consider all of them. If both are empty, ignore
683 /// always. If start time and end time are set, then start time
684 /// must be before end time.
685 /// If start time is not empty and end time is empty, then will ignore
686 /// these facet values after the start time.
687 pub start_time: std::option::Option<wkt::Timestamp>,
688
689 /// If start time is empty and end time is not empty, then ignore these
690 /// facet values before end time.
691 pub end_time: std::option::Option<wkt::Timestamp>,
692
693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
694 }
695
696 impl IgnoredFacetValues {
697 pub fn new() -> Self {
698 std::default::Default::default()
699 }
700
701 /// Sets the value of [values][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::values].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
706 /// let x = IgnoredFacetValues::new().set_values(["a", "b", "c"]);
707 /// ```
708 pub fn set_values<T, V>(mut self, v: T) -> Self
709 where
710 T: std::iter::IntoIterator<Item = V>,
711 V: std::convert::Into<std::string::String>,
712 {
713 use std::iter::Iterator;
714 self.values = v.into_iter().map(|i| i.into()).collect();
715 self
716 }
717
718 /// Sets the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
719 ///
720 /// # Example
721 /// ```ignore,no_run
722 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
723 /// use wkt::Timestamp;
724 /// let x = IgnoredFacetValues::new().set_start_time(Timestamp::default()/* use setters */);
725 /// ```
726 pub fn set_start_time<T>(mut self, v: T) -> Self
727 where
728 T: std::convert::Into<wkt::Timestamp>,
729 {
730 self.start_time = std::option::Option::Some(v.into());
731 self
732 }
733
734 /// Sets or clears the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
735 ///
736 /// # Example
737 /// ```ignore,no_run
738 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
739 /// use wkt::Timestamp;
740 /// let x = IgnoredFacetValues::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
741 /// let x = IgnoredFacetValues::new().set_or_clear_start_time(None::<Timestamp>);
742 /// ```
743 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
744 where
745 T: std::convert::Into<wkt::Timestamp>,
746 {
747 self.start_time = v.map(|x| x.into());
748 self
749 }
750
751 /// Sets the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
752 ///
753 /// # Example
754 /// ```ignore,no_run
755 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
756 /// use wkt::Timestamp;
757 /// let x = IgnoredFacetValues::new().set_end_time(Timestamp::default()/* use setters */);
758 /// ```
759 pub fn set_end_time<T>(mut self, v: T) -> Self
760 where
761 T: std::convert::Into<wkt::Timestamp>,
762 {
763 self.end_time = std::option::Option::Some(v.into());
764 self
765 }
766
767 /// Sets or clears the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
768 ///
769 /// # Example
770 /// ```ignore,no_run
771 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
772 /// use wkt::Timestamp;
773 /// let x = IgnoredFacetValues::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
774 /// let x = IgnoredFacetValues::new().set_or_clear_end_time(None::<Timestamp>);
775 /// ```
776 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
777 where
778 T: std::convert::Into<wkt::Timestamp>,
779 {
780 self.end_time = v.map(|x| x.into());
781 self
782 }
783 }
784
785 impl wkt::message::Message for IgnoredFacetValues {
786 fn typename() -> &'static str {
787 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
788 }
789 }
790
791 /// Replaces a set of textual facet values by the same (possibly different)
792 /// merged facet value. Each facet value should appear at most once as a
793 /// value per [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
794 /// This feature is available only for textual custom attributes.
795 ///
796 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
797 #[derive(Clone, Default, PartialEq)]
798 #[non_exhaustive]
799 pub struct MergedFacetValue {
800 /// All the facet values that are replaces by the same
801 /// [merged_value][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]
802 /// that follows. The maximum number of values per MergedFacetValue is 25.
803 /// Each value can have up to 128 characters.
804 ///
805 /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]: crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value
806 pub values: std::vec::Vec<std::string::String>,
807
808 /// All the previous values are replaced by this merged facet value.
809 /// This merged_value must be non-empty and can have up to 128 characters.
810 pub merged_value: std::string::String,
811
812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
813 }
814
815 impl MergedFacetValue {
816 pub fn new() -> Self {
817 std::default::Default::default()
818 }
819
820 /// Sets the value of [values][crate::model::catalog_attribute::facet_config::MergedFacetValue::values].
821 ///
822 /// # Example
823 /// ```ignore,no_run
824 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
825 /// let x = MergedFacetValue::new().set_values(["a", "b", "c"]);
826 /// ```
827 pub fn set_values<T, V>(mut self, v: T) -> Self
828 where
829 T: std::iter::IntoIterator<Item = V>,
830 V: std::convert::Into<std::string::String>,
831 {
832 use std::iter::Iterator;
833 self.values = v.into_iter().map(|i| i.into()).collect();
834 self
835 }
836
837 /// Sets the value of [merged_value][crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value].
838 ///
839 /// # Example
840 /// ```ignore,no_run
841 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
842 /// let x = MergedFacetValue::new().set_merged_value("example");
843 /// ```
844 pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
845 mut self,
846 v: T,
847 ) -> Self {
848 self.merged_value = v.into();
849 self
850 }
851 }
852
853 impl wkt::message::Message for MergedFacetValue {
854 fn typename() -> &'static str {
855 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
856 }
857 }
858
859 /// The current facet key (i.e. attribute config) maps into the
860 /// [merged_facet_key][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key].
861 /// A facet key can have at most one child. The current facet key and the
862 /// merged facet key need both to be textual custom attributes or both
863 /// numerical custom attributes (same type).
864 ///
865 /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]: crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key
866 #[derive(Clone, Default, PartialEq)]
867 #[non_exhaustive]
868 pub struct MergedFacet {
869 /// The merged facet key should be a valid facet key that is different than
870 /// the facet key of the current catalog attribute. We refer this is
871 /// merged facet key as the child of the current catalog attribute. This
872 /// merged facet key can't be a parent of another facet key (i.e. no
873 /// directed path of length 2). This merged facet key needs to be either a
874 /// textual custom attribute or a numerical custom attribute.
875 pub merged_facet_key: std::string::String,
876
877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
878 }
879
880 impl MergedFacet {
881 pub fn new() -> Self {
882 std::default::Default::default()
883 }
884
885 /// Sets the value of [merged_facet_key][crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key].
886 ///
887 /// # Example
888 /// ```ignore,no_run
889 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
890 /// let x = MergedFacet::new().set_merged_facet_key("example");
891 /// ```
892 pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
893 mut self,
894 v: T,
895 ) -> Self {
896 self.merged_facet_key = v.into();
897 self
898 }
899 }
900
901 impl wkt::message::Message for MergedFacet {
902 fn typename() -> &'static str {
903 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
904 }
905 }
906
907 /// Options to rerank based on facet values engaged by the user for the
908 /// current key. That key needs to be a custom textual key and facetable.
909 /// To use this control, you also need to pass all the facet keys engaged by
910 /// the user in the request using the field [SearchRequest.FacetSpec]. In
911 /// particular, if you don't pass the facet keys engaged that you want to
912 /// rerank on, this control won't be effective. Moreover, to obtain better
913 /// results, the facet values that you want to rerank on should be close to
914 /// English (ideally made of words, underscores, and spaces).
915 #[derive(Clone, Default, PartialEq)]
916 #[non_exhaustive]
917 pub struct RerankConfig {
918 /// If set to true, then we also rerank the dynamic facets based on the
919 /// facet values engaged by the user for the current attribute key during
920 /// serving.
921 pub rerank_facet: bool,
922
923 /// If empty, rerank on all facet values for the current key. Otherwise,
924 /// will rerank on the facet values from this list only.
925 pub facet_values: std::vec::Vec<std::string::String>,
926
927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
928 }
929
930 impl RerankConfig {
931 pub fn new() -> Self {
932 std::default::Default::default()
933 }
934
935 /// Sets the value of [rerank_facet][crate::model::catalog_attribute::facet_config::RerankConfig::rerank_facet].
936 ///
937 /// # Example
938 /// ```ignore,no_run
939 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
940 /// let x = RerankConfig::new().set_rerank_facet(true);
941 /// ```
942 pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
943 self.rerank_facet = v.into();
944 self
945 }
946
947 /// Sets the value of [facet_values][crate::model::catalog_attribute::facet_config::RerankConfig::facet_values].
948 ///
949 /// # Example
950 /// ```ignore,no_run
951 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
952 /// let x = RerankConfig::new().set_facet_values(["a", "b", "c"]);
953 /// ```
954 pub fn set_facet_values<T, V>(mut self, v: T) -> Self
955 where
956 T: std::iter::IntoIterator<Item = V>,
957 V: std::convert::Into<std::string::String>,
958 {
959 use std::iter::Iterator;
960 self.facet_values = v.into_iter().map(|i| i.into()).collect();
961 self
962 }
963 }
964
965 impl wkt::message::Message for RerankConfig {
966 fn typename() -> &'static str {
967 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
968 }
969 }
970 }
971
972 /// The type of an attribute.
973 ///
974 /// # Working with unknown values
975 ///
976 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
977 /// additional enum variants at any time. Adding new variants is not considered
978 /// a breaking change. Applications should write their code in anticipation of:
979 ///
980 /// - New values appearing in future releases of the client library, **and**
981 /// - New values received dynamically, without application changes.
982 ///
983 /// Please consult the [Working with enums] section in the user guide for some
984 /// guidelines.
985 ///
986 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
987 #[derive(Clone, Debug, PartialEq)]
988 #[non_exhaustive]
989 pub enum AttributeType {
990 /// The type of the attribute is unknown.
991 ///
992 /// Used when type cannot be derived from attribute that is not
993 /// [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
994 ///
995 /// [google.cloud.retail.v2.CatalogAttribute.in_use]: crate::model::CatalogAttribute::in_use
996 Unknown,
997 /// Textual attribute.
998 Textual,
999 /// Numerical attribute.
1000 Numerical,
1001 /// If set, the enum was initialized with an unknown value.
1002 ///
1003 /// Applications can examine the value using [AttributeType::value] or
1004 /// [AttributeType::name].
1005 UnknownValue(attribute_type::UnknownValue),
1006 }
1007
1008 #[doc(hidden)]
1009 pub mod attribute_type {
1010 #[allow(unused_imports)]
1011 use super::*;
1012 #[derive(Clone, Debug, PartialEq)]
1013 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1014 }
1015
1016 impl AttributeType {
1017 /// Gets the enum value.
1018 ///
1019 /// Returns `None` if the enum contains an unknown value deserialized from
1020 /// the string representation of enums.
1021 pub fn value(&self) -> std::option::Option<i32> {
1022 match self {
1023 Self::Unknown => std::option::Option::Some(0),
1024 Self::Textual => std::option::Option::Some(1),
1025 Self::Numerical => std::option::Option::Some(2),
1026 Self::UnknownValue(u) => u.0.value(),
1027 }
1028 }
1029
1030 /// Gets the enum value as a string.
1031 ///
1032 /// Returns `None` if the enum contains an unknown value deserialized from
1033 /// the integer representation of enums.
1034 pub fn name(&self) -> std::option::Option<&str> {
1035 match self {
1036 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1037 Self::Textual => std::option::Option::Some("TEXTUAL"),
1038 Self::Numerical => std::option::Option::Some("NUMERICAL"),
1039 Self::UnknownValue(u) => u.0.name(),
1040 }
1041 }
1042 }
1043
1044 impl std::default::Default for AttributeType {
1045 fn default() -> Self {
1046 use std::convert::From;
1047 Self::from(0)
1048 }
1049 }
1050
1051 impl std::fmt::Display for AttributeType {
1052 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1053 wkt::internal::display_enum(f, self.name(), self.value())
1054 }
1055 }
1056
1057 impl std::convert::From<i32> for AttributeType {
1058 fn from(value: i32) -> Self {
1059 match value {
1060 0 => Self::Unknown,
1061 1 => Self::Textual,
1062 2 => Self::Numerical,
1063 _ => Self::UnknownValue(attribute_type::UnknownValue(
1064 wkt::internal::UnknownEnumValue::Integer(value),
1065 )),
1066 }
1067 }
1068 }
1069
1070 impl std::convert::From<&str> for AttributeType {
1071 fn from(value: &str) -> Self {
1072 use std::string::ToString;
1073 match value {
1074 "UNKNOWN" => Self::Unknown,
1075 "TEXTUAL" => Self::Textual,
1076 "NUMERICAL" => Self::Numerical,
1077 _ => Self::UnknownValue(attribute_type::UnknownValue(
1078 wkt::internal::UnknownEnumValue::String(value.to_string()),
1079 )),
1080 }
1081 }
1082 }
1083
1084 impl serde::ser::Serialize for AttributeType {
1085 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1086 where
1087 S: serde::Serializer,
1088 {
1089 match self {
1090 Self::Unknown => serializer.serialize_i32(0),
1091 Self::Textual => serializer.serialize_i32(1),
1092 Self::Numerical => serializer.serialize_i32(2),
1093 Self::UnknownValue(u) => u.0.serialize(serializer),
1094 }
1095 }
1096 }
1097
1098 impl<'de> serde::de::Deserialize<'de> for AttributeType {
1099 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1100 where
1101 D: serde::Deserializer<'de>,
1102 {
1103 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
1104 ".google.cloud.retail.v2.CatalogAttribute.AttributeType",
1105 ))
1106 }
1107 }
1108
1109 /// The status of the indexable option of a catalog attribute.
1110 ///
1111 /// # Working with unknown values
1112 ///
1113 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1114 /// additional enum variants at any time. Adding new variants is not considered
1115 /// a breaking change. Applications should write their code in anticipation of:
1116 ///
1117 /// - New values appearing in future releases of the client library, **and**
1118 /// - New values received dynamically, without application changes.
1119 ///
1120 /// Please consult the [Working with enums] section in the user guide for some
1121 /// guidelines.
1122 ///
1123 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1124 #[derive(Clone, Debug, PartialEq)]
1125 #[non_exhaustive]
1126 pub enum IndexableOption {
1127 /// Value used when unset.
1128 Unspecified,
1129 /// Indexable option enabled for an attribute.
1130 IndexableEnabled,
1131 /// Indexable option disabled for an attribute.
1132 IndexableDisabled,
1133 /// If set, the enum was initialized with an unknown value.
1134 ///
1135 /// Applications can examine the value using [IndexableOption::value] or
1136 /// [IndexableOption::name].
1137 UnknownValue(indexable_option::UnknownValue),
1138 }
1139
1140 #[doc(hidden)]
1141 pub mod indexable_option {
1142 #[allow(unused_imports)]
1143 use super::*;
1144 #[derive(Clone, Debug, PartialEq)]
1145 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1146 }
1147
1148 impl IndexableOption {
1149 /// Gets the enum value.
1150 ///
1151 /// Returns `None` if the enum contains an unknown value deserialized from
1152 /// the string representation of enums.
1153 pub fn value(&self) -> std::option::Option<i32> {
1154 match self {
1155 Self::Unspecified => std::option::Option::Some(0),
1156 Self::IndexableEnabled => std::option::Option::Some(1),
1157 Self::IndexableDisabled => std::option::Option::Some(2),
1158 Self::UnknownValue(u) => u.0.value(),
1159 }
1160 }
1161
1162 /// Gets the enum value as a string.
1163 ///
1164 /// Returns `None` if the enum contains an unknown value deserialized from
1165 /// the integer representation of enums.
1166 pub fn name(&self) -> std::option::Option<&str> {
1167 match self {
1168 Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
1169 Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
1170 Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
1171 Self::UnknownValue(u) => u.0.name(),
1172 }
1173 }
1174 }
1175
1176 impl std::default::Default for IndexableOption {
1177 fn default() -> Self {
1178 use std::convert::From;
1179 Self::from(0)
1180 }
1181 }
1182
1183 impl std::fmt::Display for IndexableOption {
1184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1185 wkt::internal::display_enum(f, self.name(), self.value())
1186 }
1187 }
1188
1189 impl std::convert::From<i32> for IndexableOption {
1190 fn from(value: i32) -> Self {
1191 match value {
1192 0 => Self::Unspecified,
1193 1 => Self::IndexableEnabled,
1194 2 => Self::IndexableDisabled,
1195 _ => Self::UnknownValue(indexable_option::UnknownValue(
1196 wkt::internal::UnknownEnumValue::Integer(value),
1197 )),
1198 }
1199 }
1200 }
1201
1202 impl std::convert::From<&str> for IndexableOption {
1203 fn from(value: &str) -> Self {
1204 use std::string::ToString;
1205 match value {
1206 "INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1207 "INDEXABLE_ENABLED" => Self::IndexableEnabled,
1208 "INDEXABLE_DISABLED" => Self::IndexableDisabled,
1209 _ => Self::UnknownValue(indexable_option::UnknownValue(
1210 wkt::internal::UnknownEnumValue::String(value.to_string()),
1211 )),
1212 }
1213 }
1214 }
1215
1216 impl serde::ser::Serialize for IndexableOption {
1217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1218 where
1219 S: serde::Serializer,
1220 {
1221 match self {
1222 Self::Unspecified => serializer.serialize_i32(0),
1223 Self::IndexableEnabled => serializer.serialize_i32(1),
1224 Self::IndexableDisabled => serializer.serialize_i32(2),
1225 Self::UnknownValue(u) => u.0.serialize(serializer),
1226 }
1227 }
1228 }
1229
1230 impl<'de> serde::de::Deserialize<'de> for IndexableOption {
1231 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1232 where
1233 D: serde::Deserializer<'de>,
1234 {
1235 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
1236 ".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
1237 ))
1238 }
1239 }
1240
1241 /// The status of the dynamic facetable option of a catalog attribute.
1242 ///
1243 /// # Working with unknown values
1244 ///
1245 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1246 /// additional enum variants at any time. Adding new variants is not considered
1247 /// a breaking change. Applications should write their code in anticipation of:
1248 ///
1249 /// - New values appearing in future releases of the client library, **and**
1250 /// - New values received dynamically, without application changes.
1251 ///
1252 /// Please consult the [Working with enums] section in the user guide for some
1253 /// guidelines.
1254 ///
1255 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1256 #[derive(Clone, Debug, PartialEq)]
1257 #[non_exhaustive]
1258 pub enum DynamicFacetableOption {
1259 /// Value used when unset.
1260 Unspecified,
1261 /// Dynamic facetable option enabled for an attribute.
1262 DynamicFacetableEnabled,
1263 /// Dynamic facetable option disabled for an attribute.
1264 DynamicFacetableDisabled,
1265 /// If set, the enum was initialized with an unknown value.
1266 ///
1267 /// Applications can examine the value using [DynamicFacetableOption::value] or
1268 /// [DynamicFacetableOption::name].
1269 UnknownValue(dynamic_facetable_option::UnknownValue),
1270 }
1271
1272 #[doc(hidden)]
1273 pub mod dynamic_facetable_option {
1274 #[allow(unused_imports)]
1275 use super::*;
1276 #[derive(Clone, Debug, PartialEq)]
1277 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1278 }
1279
1280 impl DynamicFacetableOption {
1281 /// Gets the enum value.
1282 ///
1283 /// Returns `None` if the enum contains an unknown value deserialized from
1284 /// the string representation of enums.
1285 pub fn value(&self) -> std::option::Option<i32> {
1286 match self {
1287 Self::Unspecified => std::option::Option::Some(0),
1288 Self::DynamicFacetableEnabled => std::option::Option::Some(1),
1289 Self::DynamicFacetableDisabled => std::option::Option::Some(2),
1290 Self::UnknownValue(u) => u.0.value(),
1291 }
1292 }
1293
1294 /// Gets the enum value as a string.
1295 ///
1296 /// Returns `None` if the enum contains an unknown value deserialized from
1297 /// the integer representation of enums.
1298 pub fn name(&self) -> std::option::Option<&str> {
1299 match self {
1300 Self::Unspecified => {
1301 std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
1302 }
1303 Self::DynamicFacetableEnabled => {
1304 std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
1305 }
1306 Self::DynamicFacetableDisabled => {
1307 std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
1308 }
1309 Self::UnknownValue(u) => u.0.name(),
1310 }
1311 }
1312 }
1313
1314 impl std::default::Default for DynamicFacetableOption {
1315 fn default() -> Self {
1316 use std::convert::From;
1317 Self::from(0)
1318 }
1319 }
1320
1321 impl std::fmt::Display for DynamicFacetableOption {
1322 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1323 wkt::internal::display_enum(f, self.name(), self.value())
1324 }
1325 }
1326
1327 impl std::convert::From<i32> for DynamicFacetableOption {
1328 fn from(value: i32) -> Self {
1329 match value {
1330 0 => Self::Unspecified,
1331 1 => Self::DynamicFacetableEnabled,
1332 2 => Self::DynamicFacetableDisabled,
1333 _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1334 wkt::internal::UnknownEnumValue::Integer(value),
1335 )),
1336 }
1337 }
1338 }
1339
1340 impl std::convert::From<&str> for DynamicFacetableOption {
1341 fn from(value: &str) -> Self {
1342 use std::string::ToString;
1343 match value {
1344 "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1345 "DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
1346 "DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
1347 _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1348 wkt::internal::UnknownEnumValue::String(value.to_string()),
1349 )),
1350 }
1351 }
1352 }
1353
1354 impl serde::ser::Serialize for DynamicFacetableOption {
1355 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1356 where
1357 S: serde::Serializer,
1358 {
1359 match self {
1360 Self::Unspecified => serializer.serialize_i32(0),
1361 Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
1362 Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
1363 Self::UnknownValue(u) => u.0.serialize(serializer),
1364 }
1365 }
1366 }
1367
1368 impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
1369 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1370 where
1371 D: serde::Deserializer<'de>,
1372 {
1373 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
1374 ".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
1375 ))
1376 }
1377 }
1378
1379 /// The status of the searchable option of a catalog attribute.
1380 ///
1381 /// # Working with unknown values
1382 ///
1383 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1384 /// additional enum variants at any time. Adding new variants is not considered
1385 /// a breaking change. Applications should write their code in anticipation of:
1386 ///
1387 /// - New values appearing in future releases of the client library, **and**
1388 /// - New values received dynamically, without application changes.
1389 ///
1390 /// Please consult the [Working with enums] section in the user guide for some
1391 /// guidelines.
1392 ///
1393 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1394 #[derive(Clone, Debug, PartialEq)]
1395 #[non_exhaustive]
1396 pub enum SearchableOption {
1397 /// Value used when unset.
1398 Unspecified,
1399 /// Searchable option enabled for an attribute.
1400 SearchableEnabled,
1401 /// Searchable option disabled for an attribute.
1402 SearchableDisabled,
1403 /// If set, the enum was initialized with an unknown value.
1404 ///
1405 /// Applications can examine the value using [SearchableOption::value] or
1406 /// [SearchableOption::name].
1407 UnknownValue(searchable_option::UnknownValue),
1408 }
1409
1410 #[doc(hidden)]
1411 pub mod searchable_option {
1412 #[allow(unused_imports)]
1413 use super::*;
1414 #[derive(Clone, Debug, PartialEq)]
1415 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1416 }
1417
1418 impl SearchableOption {
1419 /// Gets the enum value.
1420 ///
1421 /// Returns `None` if the enum contains an unknown value deserialized from
1422 /// the string representation of enums.
1423 pub fn value(&self) -> std::option::Option<i32> {
1424 match self {
1425 Self::Unspecified => std::option::Option::Some(0),
1426 Self::SearchableEnabled => std::option::Option::Some(1),
1427 Self::SearchableDisabled => std::option::Option::Some(2),
1428 Self::UnknownValue(u) => u.0.value(),
1429 }
1430 }
1431
1432 /// Gets the enum value as a string.
1433 ///
1434 /// Returns `None` if the enum contains an unknown value deserialized from
1435 /// the integer representation of enums.
1436 pub fn name(&self) -> std::option::Option<&str> {
1437 match self {
1438 Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
1439 Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
1440 Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
1441 Self::UnknownValue(u) => u.0.name(),
1442 }
1443 }
1444 }
1445
1446 impl std::default::Default for SearchableOption {
1447 fn default() -> Self {
1448 use std::convert::From;
1449 Self::from(0)
1450 }
1451 }
1452
1453 impl std::fmt::Display for SearchableOption {
1454 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1455 wkt::internal::display_enum(f, self.name(), self.value())
1456 }
1457 }
1458
1459 impl std::convert::From<i32> for SearchableOption {
1460 fn from(value: i32) -> Self {
1461 match value {
1462 0 => Self::Unspecified,
1463 1 => Self::SearchableEnabled,
1464 2 => Self::SearchableDisabled,
1465 _ => Self::UnknownValue(searchable_option::UnknownValue(
1466 wkt::internal::UnknownEnumValue::Integer(value),
1467 )),
1468 }
1469 }
1470 }
1471
1472 impl std::convert::From<&str> for SearchableOption {
1473 fn from(value: &str) -> Self {
1474 use std::string::ToString;
1475 match value {
1476 "SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1477 "SEARCHABLE_ENABLED" => Self::SearchableEnabled,
1478 "SEARCHABLE_DISABLED" => Self::SearchableDisabled,
1479 _ => Self::UnknownValue(searchable_option::UnknownValue(
1480 wkt::internal::UnknownEnumValue::String(value.to_string()),
1481 )),
1482 }
1483 }
1484 }
1485
1486 impl serde::ser::Serialize for SearchableOption {
1487 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1488 where
1489 S: serde::Serializer,
1490 {
1491 match self {
1492 Self::Unspecified => serializer.serialize_i32(0),
1493 Self::SearchableEnabled => serializer.serialize_i32(1),
1494 Self::SearchableDisabled => serializer.serialize_i32(2),
1495 Self::UnknownValue(u) => u.0.serialize(serializer),
1496 }
1497 }
1498 }
1499
1500 impl<'de> serde::de::Deserialize<'de> for SearchableOption {
1501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1502 where
1503 D: serde::Deserializer<'de>,
1504 {
1505 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
1506 ".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
1507 ))
1508 }
1509 }
1510
1511 /// The status of the exact-searchable option of a catalog attribute.
1512 ///
1513 /// # Working with unknown values
1514 ///
1515 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1516 /// additional enum variants at any time. Adding new variants is not considered
1517 /// a breaking change. Applications should write their code in anticipation of:
1518 ///
1519 /// - New values appearing in future releases of the client library, **and**
1520 /// - New values received dynamically, without application changes.
1521 ///
1522 /// Please consult the [Working with enums] section in the user guide for some
1523 /// guidelines.
1524 ///
1525 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1526 #[derive(Clone, Debug, PartialEq)]
1527 #[non_exhaustive]
1528 pub enum ExactSearchableOption {
1529 /// Value used when unset.
1530 Unspecified,
1531 /// Exact searchable option enabled for an attribute.
1532 ExactSearchableEnabled,
1533 /// Exact searchable option disabled for an attribute.
1534 ExactSearchableDisabled,
1535 /// If set, the enum was initialized with an unknown value.
1536 ///
1537 /// Applications can examine the value using [ExactSearchableOption::value] or
1538 /// [ExactSearchableOption::name].
1539 UnknownValue(exact_searchable_option::UnknownValue),
1540 }
1541
1542 #[doc(hidden)]
1543 pub mod exact_searchable_option {
1544 #[allow(unused_imports)]
1545 use super::*;
1546 #[derive(Clone, Debug, PartialEq)]
1547 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1548 }
1549
1550 impl ExactSearchableOption {
1551 /// Gets the enum value.
1552 ///
1553 /// Returns `None` if the enum contains an unknown value deserialized from
1554 /// the string representation of enums.
1555 pub fn value(&self) -> std::option::Option<i32> {
1556 match self {
1557 Self::Unspecified => std::option::Option::Some(0),
1558 Self::ExactSearchableEnabled => std::option::Option::Some(1),
1559 Self::ExactSearchableDisabled => std::option::Option::Some(2),
1560 Self::UnknownValue(u) => u.0.value(),
1561 }
1562 }
1563
1564 /// Gets the enum value as a string.
1565 ///
1566 /// Returns `None` if the enum contains an unknown value deserialized from
1567 /// the integer representation of enums.
1568 pub fn name(&self) -> std::option::Option<&str> {
1569 match self {
1570 Self::Unspecified => {
1571 std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
1572 }
1573 Self::ExactSearchableEnabled => {
1574 std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
1575 }
1576 Self::ExactSearchableDisabled => {
1577 std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
1578 }
1579 Self::UnknownValue(u) => u.0.name(),
1580 }
1581 }
1582 }
1583
1584 impl std::default::Default for ExactSearchableOption {
1585 fn default() -> Self {
1586 use std::convert::From;
1587 Self::from(0)
1588 }
1589 }
1590
1591 impl std::fmt::Display for ExactSearchableOption {
1592 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1593 wkt::internal::display_enum(f, self.name(), self.value())
1594 }
1595 }
1596
1597 impl std::convert::From<i32> for ExactSearchableOption {
1598 fn from(value: i32) -> Self {
1599 match value {
1600 0 => Self::Unspecified,
1601 1 => Self::ExactSearchableEnabled,
1602 2 => Self::ExactSearchableDisabled,
1603 _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1604 wkt::internal::UnknownEnumValue::Integer(value),
1605 )),
1606 }
1607 }
1608 }
1609
1610 impl std::convert::From<&str> for ExactSearchableOption {
1611 fn from(value: &str) -> Self {
1612 use std::string::ToString;
1613 match value {
1614 "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1615 "EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
1616 "EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
1617 _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1618 wkt::internal::UnknownEnumValue::String(value.to_string()),
1619 )),
1620 }
1621 }
1622 }
1623
1624 impl serde::ser::Serialize for ExactSearchableOption {
1625 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1626 where
1627 S: serde::Serializer,
1628 {
1629 match self {
1630 Self::Unspecified => serializer.serialize_i32(0),
1631 Self::ExactSearchableEnabled => serializer.serialize_i32(1),
1632 Self::ExactSearchableDisabled => serializer.serialize_i32(2),
1633 Self::UnknownValue(u) => u.0.serialize(serializer),
1634 }
1635 }
1636 }
1637
1638 impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
1639 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1640 where
1641 D: serde::Deserializer<'de>,
1642 {
1643 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
1644 ".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
1645 ))
1646 }
1647 }
1648
1649 /// The status of the retrievable option of a catalog attribute.
1650 ///
1651 /// # Working with unknown values
1652 ///
1653 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1654 /// additional enum variants at any time. Adding new variants is not considered
1655 /// a breaking change. Applications should write their code in anticipation of:
1656 ///
1657 /// - New values appearing in future releases of the client library, **and**
1658 /// - New values received dynamically, without application changes.
1659 ///
1660 /// Please consult the [Working with enums] section in the user guide for some
1661 /// guidelines.
1662 ///
1663 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1664 #[derive(Clone, Debug, PartialEq)]
1665 #[non_exhaustive]
1666 pub enum RetrievableOption {
1667 /// Value used when unset.
1668 Unspecified,
1669 /// Retrievable option enabled for an attribute.
1670 RetrievableEnabled,
1671 /// Retrievable option disabled for an attribute.
1672 RetrievableDisabled,
1673 /// If set, the enum was initialized with an unknown value.
1674 ///
1675 /// Applications can examine the value using [RetrievableOption::value] or
1676 /// [RetrievableOption::name].
1677 UnknownValue(retrievable_option::UnknownValue),
1678 }
1679
1680 #[doc(hidden)]
1681 pub mod retrievable_option {
1682 #[allow(unused_imports)]
1683 use super::*;
1684 #[derive(Clone, Debug, PartialEq)]
1685 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1686 }
1687
1688 impl RetrievableOption {
1689 /// Gets the enum value.
1690 ///
1691 /// Returns `None` if the enum contains an unknown value deserialized from
1692 /// the string representation of enums.
1693 pub fn value(&self) -> std::option::Option<i32> {
1694 match self {
1695 Self::Unspecified => std::option::Option::Some(0),
1696 Self::RetrievableEnabled => std::option::Option::Some(1),
1697 Self::RetrievableDisabled => std::option::Option::Some(2),
1698 Self::UnknownValue(u) => u.0.value(),
1699 }
1700 }
1701
1702 /// Gets the enum value as a string.
1703 ///
1704 /// Returns `None` if the enum contains an unknown value deserialized from
1705 /// the integer representation of enums.
1706 pub fn name(&self) -> std::option::Option<&str> {
1707 match self {
1708 Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
1709 Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
1710 Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
1711 Self::UnknownValue(u) => u.0.name(),
1712 }
1713 }
1714 }
1715
1716 impl std::default::Default for RetrievableOption {
1717 fn default() -> Self {
1718 use std::convert::From;
1719 Self::from(0)
1720 }
1721 }
1722
1723 impl std::fmt::Display for RetrievableOption {
1724 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1725 wkt::internal::display_enum(f, self.name(), self.value())
1726 }
1727 }
1728
1729 impl std::convert::From<i32> for RetrievableOption {
1730 fn from(value: i32) -> Self {
1731 match value {
1732 0 => Self::Unspecified,
1733 1 => Self::RetrievableEnabled,
1734 2 => Self::RetrievableDisabled,
1735 _ => Self::UnknownValue(retrievable_option::UnknownValue(
1736 wkt::internal::UnknownEnumValue::Integer(value),
1737 )),
1738 }
1739 }
1740 }
1741
1742 impl std::convert::From<&str> for RetrievableOption {
1743 fn from(value: &str) -> Self {
1744 use std::string::ToString;
1745 match value {
1746 "RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1747 "RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
1748 "RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
1749 _ => Self::UnknownValue(retrievable_option::UnknownValue(
1750 wkt::internal::UnknownEnumValue::String(value.to_string()),
1751 )),
1752 }
1753 }
1754 }
1755
1756 impl serde::ser::Serialize for RetrievableOption {
1757 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1758 where
1759 S: serde::Serializer,
1760 {
1761 match self {
1762 Self::Unspecified => serializer.serialize_i32(0),
1763 Self::RetrievableEnabled => serializer.serialize_i32(1),
1764 Self::RetrievableDisabled => serializer.serialize_i32(2),
1765 Self::UnknownValue(u) => u.0.serialize(serializer),
1766 }
1767 }
1768 }
1769
1770 impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
1771 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1772 where
1773 D: serde::Deserializer<'de>,
1774 {
1775 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
1776 ".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
1777 ))
1778 }
1779 }
1780}
1781
1782/// Catalog level attribute config.
1783#[derive(Clone, Default, PartialEq)]
1784#[non_exhaustive]
1785pub struct AttributesConfig {
1786 /// Required. Immutable. The fully qualified resource name of the attribute
1787 /// config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
1788 pub name: std::string::String,
1789
1790 /// Enable attribute(s) config at catalog level.
1791 /// For example, indexable, dynamic_facetable, or searchable for each
1792 /// attribute.
1793 ///
1794 /// The key is catalog attribute's name.
1795 /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
1796 /// `attributes.xyz`.
1797 ///
1798 /// The maximum number of catalog attributes allowed in a request is 1000.
1799 pub catalog_attributes:
1800 std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
1801
1802 /// Output only. The
1803 /// [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
1804 /// for this catalog.
1805 ///
1806 /// [google.cloud.retail.v2.AttributeConfigLevel]: crate::model::AttributeConfigLevel
1807 pub attribute_config_level: crate::model::AttributeConfigLevel,
1808
1809 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1810}
1811
1812impl AttributesConfig {
1813 pub fn new() -> Self {
1814 std::default::Default::default()
1815 }
1816
1817 /// Sets the value of [name][crate::model::AttributesConfig::name].
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_retail_v2::model::AttributesConfig;
1822 /// let x = AttributesConfig::new().set_name("example");
1823 /// ```
1824 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1825 self.name = v.into();
1826 self
1827 }
1828
1829 /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1830 ///
1831 /// # Example
1832 /// ```ignore,no_run
1833 /// # use google_cloud_retail_v2::model::AttributesConfig;
1834 /// use google_cloud_retail_v2::model::CatalogAttribute;
1835 /// let x = AttributesConfig::new().set_catalog_attributes([
1836 /// ("key0", CatalogAttribute::default()/* use setters */),
1837 /// ("key1", CatalogAttribute::default()/* use (different) setters */),
1838 /// ]);
1839 /// ```
1840 pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1841 where
1842 T: std::iter::IntoIterator<Item = (K, V)>,
1843 K: std::convert::Into<std::string::String>,
1844 V: std::convert::Into<crate::model::CatalogAttribute>,
1845 {
1846 use std::iter::Iterator;
1847 self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1848 self
1849 }
1850
1851 /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1852 ///
1853 /// # Example
1854 /// ```ignore,no_run
1855 /// # use google_cloud_retail_v2::model::AttributesConfig;
1856 /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1857 /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1858 /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1859 /// ```
1860 pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1861 mut self,
1862 v: T,
1863 ) -> Self {
1864 self.attribute_config_level = v.into();
1865 self
1866 }
1867}
1868
1869impl wkt::message::Message for AttributesConfig {
1870 fn typename() -> &'static str {
1871 "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1872 }
1873}
1874
1875/// Catalog level autocomplete config for customers to customize autocomplete
1876/// feature's settings.
1877#[derive(Clone, Default, PartialEq)]
1878#[non_exhaustive]
1879pub struct CompletionConfig {
1880 /// Required. Immutable. Fully qualified name
1881 /// `projects/*/locations/*/catalogs/*/completionConfig`
1882 pub name: std::string::String,
1883
1884 /// Specifies the matching order for autocomplete suggestions, e.g., a query
1885 /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1886 /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1887 /// suggest "red shoes". Currently supported values:
1888 ///
1889 /// * 'out-of-order'
1890 /// * 'exact-prefix'
1891 ///
1892 /// Default value: 'exact-prefix'.
1893 pub matching_order: std::string::String,
1894
1895 /// The maximum number of autocomplete suggestions returned per term. Default
1896 /// value is 20. If left unset or set to 0, then will fallback to default
1897 /// value.
1898 ///
1899 /// Value range is 1 to 20.
1900 pub max_suggestions: i32,
1901
1902 /// The minimum number of characters needed to be typed in order to get
1903 /// suggestions. Default value is 2. If left unset or set to 0, then will
1904 /// fallback to default value.
1905 ///
1906 /// Value range is 1 to 20.
1907 pub min_prefix_length: i32,
1908
1909 /// If set to true, the auto learning function is enabled. Auto learning uses
1910 /// user data to generate suggestions using ML techniques. Default value is
1911 /// false. Only after enabling auto learning can users use `cloud-retail`
1912 /// data in
1913 /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1914 ///
1915 /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1916 pub auto_learning: bool,
1917
1918 /// Output only. The source data for the latest import of the autocomplete
1919 /// suggestion phrases.
1920 pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1921
1922 /// Output only. Name of the LRO corresponding to the latest suggestion terms
1923 /// list import.
1924 ///
1925 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1926 /// method to retrieve the latest state of the Long Running Operation.
1927 pub last_suggestions_import_operation: std::string::String,
1928
1929 /// Output only. The source data for the latest import of the autocomplete
1930 /// denylist phrases.
1931 pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1932
1933 /// Output only. Name of the LRO corresponding to the latest denylist import.
1934 ///
1935 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1936 /// retrieve the latest state of the Long Running Operation.
1937 pub last_denylist_import_operation: std::string::String,
1938
1939 /// Output only. The source data for the latest import of the autocomplete
1940 /// allowlist phrases.
1941 pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1942
1943 /// Output only. Name of the LRO corresponding to the latest allowlist import.
1944 ///
1945 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1946 /// retrieve the latest state of the Long Running Operation.
1947 pub last_allowlist_import_operation: std::string::String,
1948
1949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1950}
1951
1952impl CompletionConfig {
1953 pub fn new() -> Self {
1954 std::default::Default::default()
1955 }
1956
1957 /// Sets the value of [name][crate::model::CompletionConfig::name].
1958 ///
1959 /// # Example
1960 /// ```ignore,no_run
1961 /// # use google_cloud_retail_v2::model::CompletionConfig;
1962 /// let x = CompletionConfig::new().set_name("example");
1963 /// ```
1964 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1965 self.name = v.into();
1966 self
1967 }
1968
1969 /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1970 ///
1971 /// # Example
1972 /// ```ignore,no_run
1973 /// # use google_cloud_retail_v2::model::CompletionConfig;
1974 /// let x = CompletionConfig::new().set_matching_order("example");
1975 /// ```
1976 pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1977 self.matching_order = v.into();
1978 self
1979 }
1980
1981 /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1982 ///
1983 /// # Example
1984 /// ```ignore,no_run
1985 /// # use google_cloud_retail_v2::model::CompletionConfig;
1986 /// let x = CompletionConfig::new().set_max_suggestions(42);
1987 /// ```
1988 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1989 self.max_suggestions = v.into();
1990 self
1991 }
1992
1993 /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
1994 ///
1995 /// # Example
1996 /// ```ignore,no_run
1997 /// # use google_cloud_retail_v2::model::CompletionConfig;
1998 /// let x = CompletionConfig::new().set_min_prefix_length(42);
1999 /// ```
2000 pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2001 self.min_prefix_length = v.into();
2002 self
2003 }
2004
2005 /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2006 ///
2007 /// # Example
2008 /// ```ignore,no_run
2009 /// # use google_cloud_retail_v2::model::CompletionConfig;
2010 /// let x = CompletionConfig::new().set_auto_learning(true);
2011 /// ```
2012 pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2013 self.auto_learning = v.into();
2014 self
2015 }
2016
2017 /// Sets the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2018 ///
2019 /// # Example
2020 /// ```ignore,no_run
2021 /// # use google_cloud_retail_v2::model::CompletionConfig;
2022 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2023 /// let x = CompletionConfig::new().set_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2024 /// ```
2025 pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2026 where
2027 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2028 {
2029 self.suggestions_input_config = std::option::Option::Some(v.into());
2030 self
2031 }
2032
2033 /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2034 ///
2035 /// # Example
2036 /// ```ignore,no_run
2037 /// # use google_cloud_retail_v2::model::CompletionConfig;
2038 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2039 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2040 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2041 /// ```
2042 pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2043 where
2044 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2045 {
2046 self.suggestions_input_config = v.map(|x| x.into());
2047 self
2048 }
2049
2050 /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2051 ///
2052 /// # Example
2053 /// ```ignore,no_run
2054 /// # use google_cloud_retail_v2::model::CompletionConfig;
2055 /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2056 /// ```
2057 pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2058 mut self,
2059 v: T,
2060 ) -> Self {
2061 self.last_suggestions_import_operation = v.into();
2062 self
2063 }
2064
2065 /// Sets the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2066 ///
2067 /// # Example
2068 /// ```ignore,no_run
2069 /// # use google_cloud_retail_v2::model::CompletionConfig;
2070 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2071 /// let x = CompletionConfig::new().set_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2072 /// ```
2073 pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2074 where
2075 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2076 {
2077 self.denylist_input_config = std::option::Option::Some(v.into());
2078 self
2079 }
2080
2081 /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2082 ///
2083 /// # Example
2084 /// ```ignore,no_run
2085 /// # use google_cloud_retail_v2::model::CompletionConfig;
2086 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2087 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2088 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2089 /// ```
2090 pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2091 where
2092 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2093 {
2094 self.denylist_input_config = v.map(|x| x.into());
2095 self
2096 }
2097
2098 /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2099 ///
2100 /// # Example
2101 /// ```ignore,no_run
2102 /// # use google_cloud_retail_v2::model::CompletionConfig;
2103 /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2104 /// ```
2105 pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2106 mut self,
2107 v: T,
2108 ) -> Self {
2109 self.last_denylist_import_operation = v.into();
2110 self
2111 }
2112
2113 /// Sets the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_retail_v2::model::CompletionConfig;
2118 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2119 /// let x = CompletionConfig::new().set_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2120 /// ```
2121 pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2122 where
2123 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2124 {
2125 self.allowlist_input_config = std::option::Option::Some(v.into());
2126 self
2127 }
2128
2129 /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2130 ///
2131 /// # Example
2132 /// ```ignore,no_run
2133 /// # use google_cloud_retail_v2::model::CompletionConfig;
2134 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2135 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2136 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2137 /// ```
2138 pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2139 where
2140 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2141 {
2142 self.allowlist_input_config = v.map(|x| x.into());
2143 self
2144 }
2145
2146 /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2147 ///
2148 /// # Example
2149 /// ```ignore,no_run
2150 /// # use google_cloud_retail_v2::model::CompletionConfig;
2151 /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2152 /// ```
2153 pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2154 mut self,
2155 v: T,
2156 ) -> Self {
2157 self.last_allowlist_import_operation = v.into();
2158 self
2159 }
2160}
2161
2162impl wkt::message::Message for CompletionConfig {
2163 fn typename() -> &'static str {
2164 "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2165 }
2166}
2167
2168/// The catalog configuration.
2169#[derive(Clone, Default, PartialEq)]
2170#[non_exhaustive]
2171pub struct Catalog {
2172 /// Required. Immutable. The fully qualified resource name of the catalog.
2173 pub name: std::string::String,
2174
2175 /// Required. Immutable. The catalog display name.
2176 ///
2177 /// This field must be a UTF-8 encoded string with a length limit of 128
2178 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2179 pub display_name: std::string::String,
2180
2181 /// Required. The product level configuration.
2182 pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2183
2184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2185}
2186
2187impl Catalog {
2188 pub fn new() -> Self {
2189 std::default::Default::default()
2190 }
2191
2192 /// Sets the value of [name][crate::model::Catalog::name].
2193 ///
2194 /// # Example
2195 /// ```ignore,no_run
2196 /// # use google_cloud_retail_v2::model::Catalog;
2197 /// let x = Catalog::new().set_name("example");
2198 /// ```
2199 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2200 self.name = v.into();
2201 self
2202 }
2203
2204 /// Sets the value of [display_name][crate::model::Catalog::display_name].
2205 ///
2206 /// # Example
2207 /// ```ignore,no_run
2208 /// # use google_cloud_retail_v2::model::Catalog;
2209 /// let x = Catalog::new().set_display_name("example");
2210 /// ```
2211 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2212 self.display_name = v.into();
2213 self
2214 }
2215
2216 /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2217 ///
2218 /// # Example
2219 /// ```ignore,no_run
2220 /// # use google_cloud_retail_v2::model::Catalog;
2221 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2222 /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2223 /// ```
2224 pub fn set_product_level_config<T>(mut self, v: T) -> Self
2225 where
2226 T: std::convert::Into<crate::model::ProductLevelConfig>,
2227 {
2228 self.product_level_config = std::option::Option::Some(v.into());
2229 self
2230 }
2231
2232 /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2233 ///
2234 /// # Example
2235 /// ```ignore,no_run
2236 /// # use google_cloud_retail_v2::model::Catalog;
2237 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2238 /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2239 /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2240 /// ```
2241 pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2242 where
2243 T: std::convert::Into<crate::model::ProductLevelConfig>,
2244 {
2245 self.product_level_config = v.map(|x| x.into());
2246 self
2247 }
2248}
2249
2250impl wkt::message::Message for Catalog {
2251 fn typename() -> &'static str {
2252 "type.googleapis.com/google.cloud.retail.v2.Catalog"
2253 }
2254}
2255
2256/// Request for
2257/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2258/// method.
2259///
2260/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2261#[derive(Clone, Default, PartialEq)]
2262#[non_exhaustive]
2263pub struct ListCatalogsRequest {
2264 /// Required. The account resource name with an associated location.
2265 ///
2266 /// If the caller does not have permission to list
2267 /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2268 /// of whether or not this location exists, a PERMISSION_DENIED error is
2269 /// returned.
2270 ///
2271 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2272 pub parent: std::string::String,
2273
2274 /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2275 /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2276 /// above 1000 will be coerced to 1000.
2277 ///
2278 /// If this field is negative, an INVALID_ARGUMENT is returned.
2279 ///
2280 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2281 pub page_size: i32,
2282
2283 /// A page token
2284 /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2285 /// received from a previous
2286 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2287 /// call. Provide this to retrieve the subsequent page.
2288 ///
2289 /// When paginating, all other parameters provided to
2290 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2291 /// must match the call that provided the page token. Otherwise, an
2292 /// INVALID_ARGUMENT error is returned.
2293 ///
2294 /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2295 /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2296 pub page_token: std::string::String,
2297
2298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2299}
2300
2301impl ListCatalogsRequest {
2302 pub fn new() -> Self {
2303 std::default::Default::default()
2304 }
2305
2306 /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2307 ///
2308 /// # Example
2309 /// ```ignore,no_run
2310 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2311 /// let x = ListCatalogsRequest::new().set_parent("example");
2312 /// ```
2313 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2314 self.parent = v.into();
2315 self
2316 }
2317
2318 /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2319 ///
2320 /// # Example
2321 /// ```ignore,no_run
2322 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2323 /// let x = ListCatalogsRequest::new().set_page_size(42);
2324 /// ```
2325 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2326 self.page_size = v.into();
2327 self
2328 }
2329
2330 /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2335 /// let x = ListCatalogsRequest::new().set_page_token("example");
2336 /// ```
2337 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2338 self.page_token = v.into();
2339 self
2340 }
2341}
2342
2343impl wkt::message::Message for ListCatalogsRequest {
2344 fn typename() -> &'static str {
2345 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2346 }
2347}
2348
2349/// Response for
2350/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2351/// method.
2352///
2353/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2354#[derive(Clone, Default, PartialEq)]
2355#[non_exhaustive]
2356pub struct ListCatalogsResponse {
2357 /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2358 ///
2359 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2360 pub catalogs: std::vec::Vec<crate::model::Catalog>,
2361
2362 /// A token that can be sent as
2363 /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2364 /// to retrieve the next page. If this field is omitted, there are no
2365 /// subsequent pages.
2366 ///
2367 /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2368 pub next_page_token: std::string::String,
2369
2370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2371}
2372
2373impl ListCatalogsResponse {
2374 pub fn new() -> Self {
2375 std::default::Default::default()
2376 }
2377
2378 /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2379 ///
2380 /// # Example
2381 /// ```ignore,no_run
2382 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2383 /// use google_cloud_retail_v2::model::Catalog;
2384 /// let x = ListCatalogsResponse::new()
2385 /// .set_catalogs([
2386 /// Catalog::default()/* use setters */,
2387 /// Catalog::default()/* use (different) setters */,
2388 /// ]);
2389 /// ```
2390 pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2391 where
2392 T: std::iter::IntoIterator<Item = V>,
2393 V: std::convert::Into<crate::model::Catalog>,
2394 {
2395 use std::iter::Iterator;
2396 self.catalogs = v.into_iter().map(|i| i.into()).collect();
2397 self
2398 }
2399
2400 /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2401 ///
2402 /// # Example
2403 /// ```ignore,no_run
2404 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2405 /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2406 /// ```
2407 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2408 self.next_page_token = v.into();
2409 self
2410 }
2411}
2412
2413impl wkt::message::Message for ListCatalogsResponse {
2414 fn typename() -> &'static str {
2415 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2416 }
2417}
2418
2419#[doc(hidden)]
2420impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2421 type PageItem = crate::model::Catalog;
2422
2423 fn items(self) -> std::vec::Vec<Self::PageItem> {
2424 self.catalogs
2425 }
2426
2427 fn next_page_token(&self) -> std::string::String {
2428 use std::clone::Clone;
2429 self.next_page_token.clone()
2430 }
2431}
2432
2433/// Request for
2434/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2435/// method.
2436///
2437/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2438#[derive(Clone, Default, PartialEq)]
2439#[non_exhaustive]
2440pub struct UpdateCatalogRequest {
2441 /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2442 ///
2443 /// If the caller does not have permission to update the
2444 /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2445 /// exists, a PERMISSION_DENIED error is returned.
2446 ///
2447 /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2448 /// a NOT_FOUND error is returned.
2449 ///
2450 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2451 pub catalog: std::option::Option<crate::model::Catalog>,
2452
2453 /// Indicates which fields in the provided
2454 /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2455 ///
2456 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2457 /// is returned.
2458 ///
2459 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2460 pub update_mask: std::option::Option<wkt::FieldMask>,
2461
2462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2463}
2464
2465impl UpdateCatalogRequest {
2466 pub fn new() -> Self {
2467 std::default::Default::default()
2468 }
2469
2470 /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2471 ///
2472 /// # Example
2473 /// ```ignore,no_run
2474 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2475 /// use google_cloud_retail_v2::model::Catalog;
2476 /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2477 /// ```
2478 pub fn set_catalog<T>(mut self, v: T) -> Self
2479 where
2480 T: std::convert::Into<crate::model::Catalog>,
2481 {
2482 self.catalog = std::option::Option::Some(v.into());
2483 self
2484 }
2485
2486 /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2487 ///
2488 /// # Example
2489 /// ```ignore,no_run
2490 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2491 /// use google_cloud_retail_v2::model::Catalog;
2492 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2493 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2494 /// ```
2495 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2496 where
2497 T: std::convert::Into<crate::model::Catalog>,
2498 {
2499 self.catalog = v.map(|x| x.into());
2500 self
2501 }
2502
2503 /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2504 ///
2505 /// # Example
2506 /// ```ignore,no_run
2507 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2508 /// use wkt::FieldMask;
2509 /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2510 /// ```
2511 pub fn set_update_mask<T>(mut self, v: T) -> Self
2512 where
2513 T: std::convert::Into<wkt::FieldMask>,
2514 {
2515 self.update_mask = std::option::Option::Some(v.into());
2516 self
2517 }
2518
2519 /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2520 ///
2521 /// # Example
2522 /// ```ignore,no_run
2523 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2524 /// use wkt::FieldMask;
2525 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2526 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2527 /// ```
2528 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2529 where
2530 T: std::convert::Into<wkt::FieldMask>,
2531 {
2532 self.update_mask = v.map(|x| x.into());
2533 self
2534 }
2535}
2536
2537impl wkt::message::Message for UpdateCatalogRequest {
2538 fn typename() -> &'static str {
2539 "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2540 }
2541}
2542
2543/// Request message to set a specified branch as new default_branch.
2544#[derive(Clone, Default, PartialEq)]
2545#[non_exhaustive]
2546pub struct SetDefaultBranchRequest {
2547 /// Full resource name of the catalog, such as
2548 /// `projects/*/locations/global/catalogs/default_catalog`.
2549 pub catalog: std::string::String,
2550
2551 /// The final component of the resource name of a branch.
2552 ///
2553 /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2554 /// error is returned.
2555 ///
2556 /// If there are no sufficient active products in the targeted branch and
2557 /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2558 /// FAILED_PRECONDITION error is returned.
2559 ///
2560 /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2561 pub branch_id: std::string::String,
2562
2563 /// Some note on this request, this can be retrieved by
2564 /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2565 /// before next valid default branch set occurs.
2566 ///
2567 /// This field must be a UTF-8 encoded string with a length limit of 1,000
2568 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2569 ///
2570 /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2571 pub note: std::string::String,
2572
2573 /// If set to true, it permits switching to a branch with
2574 /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2575 /// if it has no sufficient active products.
2576 ///
2577 /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2578 pub force: bool,
2579
2580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2581}
2582
2583impl SetDefaultBranchRequest {
2584 pub fn new() -> Self {
2585 std::default::Default::default()
2586 }
2587
2588 /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2589 ///
2590 /// # Example
2591 /// ```ignore,no_run
2592 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2593 /// let x = SetDefaultBranchRequest::new().set_catalog("example");
2594 /// ```
2595 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2596 self.catalog = v.into();
2597 self
2598 }
2599
2600 /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2601 ///
2602 /// # Example
2603 /// ```ignore,no_run
2604 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2605 /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2606 /// ```
2607 pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2608 self.branch_id = v.into();
2609 self
2610 }
2611
2612 /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2613 ///
2614 /// # Example
2615 /// ```ignore,no_run
2616 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2617 /// let x = SetDefaultBranchRequest::new().set_note("example");
2618 /// ```
2619 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2620 self.note = v.into();
2621 self
2622 }
2623
2624 /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2625 ///
2626 /// # Example
2627 /// ```ignore,no_run
2628 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2629 /// let x = SetDefaultBranchRequest::new().set_force(true);
2630 /// ```
2631 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2632 self.force = v.into();
2633 self
2634 }
2635}
2636
2637impl wkt::message::Message for SetDefaultBranchRequest {
2638 fn typename() -> &'static str {
2639 "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2640 }
2641}
2642
2643/// Request message to show which branch is currently the default branch.
2644#[derive(Clone, Default, PartialEq)]
2645#[non_exhaustive]
2646pub struct GetDefaultBranchRequest {
2647 /// The parent catalog resource name, such as
2648 /// `projects/*/locations/global/catalogs/default_catalog`.
2649 pub catalog: std::string::String,
2650
2651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2652}
2653
2654impl GetDefaultBranchRequest {
2655 pub fn new() -> Self {
2656 std::default::Default::default()
2657 }
2658
2659 /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2660 ///
2661 /// # Example
2662 /// ```ignore,no_run
2663 /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2664 /// let x = GetDefaultBranchRequest::new().set_catalog("example");
2665 /// ```
2666 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2667 self.catalog = v.into();
2668 self
2669 }
2670}
2671
2672impl wkt::message::Message for GetDefaultBranchRequest {
2673 fn typename() -> &'static str {
2674 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2675 }
2676}
2677
2678/// Response message of
2679/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2680///
2681/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2682#[derive(Clone, Default, PartialEq)]
2683#[non_exhaustive]
2684pub struct GetDefaultBranchResponse {
2685 /// Full resource name of the branch id currently set as default branch.
2686 pub branch: std::string::String,
2687
2688 /// The time when this branch is set to default.
2689 pub set_time: std::option::Option<wkt::Timestamp>,
2690
2691 /// This corresponds to
2692 /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2693 /// field, when this branch was set as default.
2694 ///
2695 /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2696 pub note: std::string::String,
2697
2698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2699}
2700
2701impl GetDefaultBranchResponse {
2702 pub fn new() -> Self {
2703 std::default::Default::default()
2704 }
2705
2706 /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2707 ///
2708 /// # Example
2709 /// ```ignore,no_run
2710 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2711 /// let x = GetDefaultBranchResponse::new().set_branch("example");
2712 /// ```
2713 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2714 self.branch = v.into();
2715 self
2716 }
2717
2718 /// Sets the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2719 ///
2720 /// # Example
2721 /// ```ignore,no_run
2722 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2723 /// use wkt::Timestamp;
2724 /// let x = GetDefaultBranchResponse::new().set_set_time(Timestamp::default()/* use setters */);
2725 /// ```
2726 pub fn set_set_time<T>(mut self, v: T) -> Self
2727 where
2728 T: std::convert::Into<wkt::Timestamp>,
2729 {
2730 self.set_time = std::option::Option::Some(v.into());
2731 self
2732 }
2733
2734 /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2735 ///
2736 /// # Example
2737 /// ```ignore,no_run
2738 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2739 /// use wkt::Timestamp;
2740 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2741 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2742 /// ```
2743 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2744 where
2745 T: std::convert::Into<wkt::Timestamp>,
2746 {
2747 self.set_time = v.map(|x| x.into());
2748 self
2749 }
2750
2751 /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2752 ///
2753 /// # Example
2754 /// ```ignore,no_run
2755 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2756 /// let x = GetDefaultBranchResponse::new().set_note("example");
2757 /// ```
2758 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2759 self.note = v.into();
2760 self
2761 }
2762}
2763
2764impl wkt::message::Message for GetDefaultBranchResponse {
2765 fn typename() -> &'static str {
2766 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2767 }
2768}
2769
2770/// Request for
2771/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2772/// method.
2773///
2774/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2775#[derive(Clone, Default, PartialEq)]
2776#[non_exhaustive]
2777pub struct GetCompletionConfigRequest {
2778 /// Required. Full CompletionConfig resource name. Format:
2779 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2780 pub name: std::string::String,
2781
2782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2783}
2784
2785impl GetCompletionConfigRequest {
2786 pub fn new() -> Self {
2787 std::default::Default::default()
2788 }
2789
2790 /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2791 ///
2792 /// # Example
2793 /// ```ignore,no_run
2794 /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2795 /// let x = GetCompletionConfigRequest::new().set_name("example");
2796 /// ```
2797 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2798 self.name = v.into();
2799 self
2800 }
2801}
2802
2803impl wkt::message::Message for GetCompletionConfigRequest {
2804 fn typename() -> &'static str {
2805 "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2806 }
2807}
2808
2809/// Request for
2810/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2811/// method.
2812///
2813/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2814#[derive(Clone, Default, PartialEq)]
2815#[non_exhaustive]
2816pub struct UpdateCompletionConfigRequest {
2817 /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2818 /// to update.
2819 ///
2820 /// If the caller does not have permission to update the
2821 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2822 /// PERMISSION_DENIED error is returned.
2823 ///
2824 /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2825 /// update does not exist, a NOT_FOUND error is returned.
2826 ///
2827 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2828 pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2829
2830 /// Indicates which fields in the provided
2831 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2832 /// following are the only supported fields:
2833 ///
2834 /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2835 /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2836 /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2837 /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2838 ///
2839 /// If not set, all supported fields are updated.
2840 ///
2841 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2842 /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2843 /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2844 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2845 /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2846 pub update_mask: std::option::Option<wkt::FieldMask>,
2847
2848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2849}
2850
2851impl UpdateCompletionConfigRequest {
2852 pub fn new() -> Self {
2853 std::default::Default::default()
2854 }
2855
2856 /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2857 ///
2858 /// # Example
2859 /// ```ignore,no_run
2860 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2861 /// use google_cloud_retail_v2::model::CompletionConfig;
2862 /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2863 /// ```
2864 pub fn set_completion_config<T>(mut self, v: T) -> Self
2865 where
2866 T: std::convert::Into<crate::model::CompletionConfig>,
2867 {
2868 self.completion_config = std::option::Option::Some(v.into());
2869 self
2870 }
2871
2872 /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2877 /// use google_cloud_retail_v2::model::CompletionConfig;
2878 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2879 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2880 /// ```
2881 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2882 where
2883 T: std::convert::Into<crate::model::CompletionConfig>,
2884 {
2885 self.completion_config = v.map(|x| x.into());
2886 self
2887 }
2888
2889 /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2890 ///
2891 /// # Example
2892 /// ```ignore,no_run
2893 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2894 /// use wkt::FieldMask;
2895 /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2896 /// ```
2897 pub fn set_update_mask<T>(mut self, v: T) -> Self
2898 where
2899 T: std::convert::Into<wkt::FieldMask>,
2900 {
2901 self.update_mask = std::option::Option::Some(v.into());
2902 self
2903 }
2904
2905 /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2906 ///
2907 /// # Example
2908 /// ```ignore,no_run
2909 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2910 /// use wkt::FieldMask;
2911 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2912 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2913 /// ```
2914 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2915 where
2916 T: std::convert::Into<wkt::FieldMask>,
2917 {
2918 self.update_mask = v.map(|x| x.into());
2919 self
2920 }
2921}
2922
2923impl wkt::message::Message for UpdateCompletionConfigRequest {
2924 fn typename() -> &'static str {
2925 "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2926 }
2927}
2928
2929/// Request for
2930/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2931/// method.
2932///
2933/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2934#[derive(Clone, Default, PartialEq)]
2935#[non_exhaustive]
2936pub struct GetAttributesConfigRequest {
2937 /// Required. Full AttributesConfig resource name. Format:
2938 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2939 pub name: std::string::String,
2940
2941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2942}
2943
2944impl GetAttributesConfigRequest {
2945 pub fn new() -> Self {
2946 std::default::Default::default()
2947 }
2948
2949 /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2950 ///
2951 /// # Example
2952 /// ```ignore,no_run
2953 /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2954 /// let x = GetAttributesConfigRequest::new().set_name("example");
2955 /// ```
2956 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2957 self.name = v.into();
2958 self
2959 }
2960}
2961
2962impl wkt::message::Message for GetAttributesConfigRequest {
2963 fn typename() -> &'static str {
2964 "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
2965 }
2966}
2967
2968/// Request for
2969/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
2970/// method.
2971///
2972/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
2973#[derive(Clone, Default, PartialEq)]
2974#[non_exhaustive]
2975pub struct UpdateAttributesConfigRequest {
2976 /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
2977 /// to update.
2978 ///
2979 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2980 pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
2981
2982 /// Indicates which fields in the provided
2983 /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
2984 /// following is the only supported field:
2985 ///
2986 /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
2987 ///
2988 /// If not set, all supported fields are updated.
2989 ///
2990 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2991 /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
2992 pub update_mask: std::option::Option<wkt::FieldMask>,
2993
2994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2995}
2996
2997impl UpdateAttributesConfigRequest {
2998 pub fn new() -> Self {
2999 std::default::Default::default()
3000 }
3001
3002 /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3003 ///
3004 /// # Example
3005 /// ```ignore,no_run
3006 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3007 /// use google_cloud_retail_v2::model::AttributesConfig;
3008 /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3009 /// ```
3010 pub fn set_attributes_config<T>(mut self, v: T) -> Self
3011 where
3012 T: std::convert::Into<crate::model::AttributesConfig>,
3013 {
3014 self.attributes_config = std::option::Option::Some(v.into());
3015 self
3016 }
3017
3018 /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3023 /// use google_cloud_retail_v2::model::AttributesConfig;
3024 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3025 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3026 /// ```
3027 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3028 where
3029 T: std::convert::Into<crate::model::AttributesConfig>,
3030 {
3031 self.attributes_config = v.map(|x| x.into());
3032 self
3033 }
3034
3035 /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3036 ///
3037 /// # Example
3038 /// ```ignore,no_run
3039 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3040 /// use wkt::FieldMask;
3041 /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3042 /// ```
3043 pub fn set_update_mask<T>(mut self, v: T) -> Self
3044 where
3045 T: std::convert::Into<wkt::FieldMask>,
3046 {
3047 self.update_mask = std::option::Option::Some(v.into());
3048 self
3049 }
3050
3051 /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3052 ///
3053 /// # Example
3054 /// ```ignore,no_run
3055 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3056 /// use wkt::FieldMask;
3057 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3058 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3059 /// ```
3060 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3061 where
3062 T: std::convert::Into<wkt::FieldMask>,
3063 {
3064 self.update_mask = v.map(|x| x.into());
3065 self
3066 }
3067}
3068
3069impl wkt::message::Message for UpdateAttributesConfigRequest {
3070 fn typename() -> &'static str {
3071 "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3072 }
3073}
3074
3075/// Request for
3076/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3077/// method.
3078///
3079/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3080#[derive(Clone, Default, PartialEq)]
3081#[non_exhaustive]
3082pub struct AddCatalogAttributeRequest {
3083 /// Required. Full AttributesConfig resource name. Format:
3084 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3085 pub attributes_config: std::string::String,
3086
3087 /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3088 /// to add.
3089 ///
3090 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3091 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3092
3093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3094}
3095
3096impl AddCatalogAttributeRequest {
3097 pub fn new() -> Self {
3098 std::default::Default::default()
3099 }
3100
3101 /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3102 ///
3103 /// # Example
3104 /// ```ignore,no_run
3105 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3106 /// let x = AddCatalogAttributeRequest::new().set_attributes_config("example");
3107 /// ```
3108 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3109 mut self,
3110 v: T,
3111 ) -> Self {
3112 self.attributes_config = v.into();
3113 self
3114 }
3115
3116 /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3117 ///
3118 /// # Example
3119 /// ```ignore,no_run
3120 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3121 /// use google_cloud_retail_v2::model::CatalogAttribute;
3122 /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3123 /// ```
3124 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3125 where
3126 T: std::convert::Into<crate::model::CatalogAttribute>,
3127 {
3128 self.catalog_attribute = std::option::Option::Some(v.into());
3129 self
3130 }
3131
3132 /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3133 ///
3134 /// # Example
3135 /// ```ignore,no_run
3136 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3137 /// use google_cloud_retail_v2::model::CatalogAttribute;
3138 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3139 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3140 /// ```
3141 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3142 where
3143 T: std::convert::Into<crate::model::CatalogAttribute>,
3144 {
3145 self.catalog_attribute = v.map(|x| x.into());
3146 self
3147 }
3148}
3149
3150impl wkt::message::Message for AddCatalogAttributeRequest {
3151 fn typename() -> &'static str {
3152 "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3153 }
3154}
3155
3156/// Request for
3157/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3158/// method.
3159///
3160/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3161#[derive(Clone, Default, PartialEq)]
3162#[non_exhaustive]
3163pub struct RemoveCatalogAttributeRequest {
3164 /// Required. Full AttributesConfig resource name. Format:
3165 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3166 pub attributes_config: std::string::String,
3167
3168 /// Required. The attribute name key of the
3169 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3170 ///
3171 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3172 pub key: std::string::String,
3173
3174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3175}
3176
3177impl RemoveCatalogAttributeRequest {
3178 pub fn new() -> Self {
3179 std::default::Default::default()
3180 }
3181
3182 /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3183 ///
3184 /// # Example
3185 /// ```ignore,no_run
3186 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3187 /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config("example");
3188 /// ```
3189 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3190 mut self,
3191 v: T,
3192 ) -> Self {
3193 self.attributes_config = v.into();
3194 self
3195 }
3196
3197 /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3198 ///
3199 /// # Example
3200 /// ```ignore,no_run
3201 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3202 /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3203 /// ```
3204 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3205 self.key = v.into();
3206 self
3207 }
3208}
3209
3210impl wkt::message::Message for RemoveCatalogAttributeRequest {
3211 fn typename() -> &'static str {
3212 "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3213 }
3214}
3215
3216/// Request for
3217/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3218/// method.
3219///
3220/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3221#[derive(Clone, Default, PartialEq)]
3222#[non_exhaustive]
3223pub struct ReplaceCatalogAttributeRequest {
3224 /// Required. Full AttributesConfig resource name. Format:
3225 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3226 pub attributes_config: std::string::String,
3227
3228 /// Required. The updated
3229 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3230 ///
3231 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3232 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3233
3234 /// Indicates which fields in the provided
3235 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3236 /// following are NOT supported:
3237 ///
3238 /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3239 ///
3240 /// If not set, all supported fields are updated.
3241 ///
3242 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3243 /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3244 pub update_mask: std::option::Option<wkt::FieldMask>,
3245
3246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3247}
3248
3249impl ReplaceCatalogAttributeRequest {
3250 pub fn new() -> Self {
3251 std::default::Default::default()
3252 }
3253
3254 /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3255 ///
3256 /// # Example
3257 /// ```ignore,no_run
3258 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3259 /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config("example");
3260 /// ```
3261 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3262 mut self,
3263 v: T,
3264 ) -> Self {
3265 self.attributes_config = v.into();
3266 self
3267 }
3268
3269 /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3270 ///
3271 /// # Example
3272 /// ```ignore,no_run
3273 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3274 /// use google_cloud_retail_v2::model::CatalogAttribute;
3275 /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3276 /// ```
3277 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3278 where
3279 T: std::convert::Into<crate::model::CatalogAttribute>,
3280 {
3281 self.catalog_attribute = std::option::Option::Some(v.into());
3282 self
3283 }
3284
3285 /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3286 ///
3287 /// # Example
3288 /// ```ignore,no_run
3289 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3290 /// use google_cloud_retail_v2::model::CatalogAttribute;
3291 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3292 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3293 /// ```
3294 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3295 where
3296 T: std::convert::Into<crate::model::CatalogAttribute>,
3297 {
3298 self.catalog_attribute = v.map(|x| x.into());
3299 self
3300 }
3301
3302 /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3303 ///
3304 /// # Example
3305 /// ```ignore,no_run
3306 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3307 /// use wkt::FieldMask;
3308 /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3309 /// ```
3310 pub fn set_update_mask<T>(mut self, v: T) -> Self
3311 where
3312 T: std::convert::Into<wkt::FieldMask>,
3313 {
3314 self.update_mask = std::option::Option::Some(v.into());
3315 self
3316 }
3317
3318 /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3319 ///
3320 /// # Example
3321 /// ```ignore,no_run
3322 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3323 /// use wkt::FieldMask;
3324 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3325 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3326 /// ```
3327 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3328 where
3329 T: std::convert::Into<wkt::FieldMask>,
3330 {
3331 self.update_mask = v.map(|x| x.into());
3332 self
3333 }
3334}
3335
3336impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3337 fn typename() -> &'static str {
3338 "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3339 }
3340}
3341
3342/// Metadata that is used to define a condition that triggers an action.
3343/// A valid condition must specify at least one of 'query_terms' or
3344/// 'products_filter'. If multiple fields are specified, the condition is met if
3345/// all the fields are satisfied e.g. if a set of query terms and product_filter
3346/// are set, then only items matching the product_filter for requests with a
3347/// query matching the query terms wil get boosted.
3348#[derive(Clone, Default, PartialEq)]
3349#[non_exhaustive]
3350pub struct Condition {
3351 /// A list (up to 10 entries) of terms to match the query on. If not
3352 /// specified, match all queries.
3353 /// If many query terms are specified, the condition
3354 /// is matched if any of the terms is a match (i.e. using the OR operator).
3355 pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3356
3357 /// Range of time(s) specifying when Condition is active.
3358 /// Condition true if any time range matches.
3359 pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3360
3361 /// Used to support browse uses cases.
3362 /// A list (up to 10 entries) of categories or departments.
3363 /// The format should be the same as
3364 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3365 ///
3366 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3367 pub page_categories: std::vec::Vec<std::string::String>,
3368
3369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3370}
3371
3372impl Condition {
3373 pub fn new() -> Self {
3374 std::default::Default::default()
3375 }
3376
3377 /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3378 ///
3379 /// # Example
3380 /// ```ignore,no_run
3381 /// # use google_cloud_retail_v2::model::Condition;
3382 /// use google_cloud_retail_v2::model::condition::QueryTerm;
3383 /// let x = Condition::new()
3384 /// .set_query_terms([
3385 /// QueryTerm::default()/* use setters */,
3386 /// QueryTerm::default()/* use (different) setters */,
3387 /// ]);
3388 /// ```
3389 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3390 where
3391 T: std::iter::IntoIterator<Item = V>,
3392 V: std::convert::Into<crate::model::condition::QueryTerm>,
3393 {
3394 use std::iter::Iterator;
3395 self.query_terms = v.into_iter().map(|i| i.into()).collect();
3396 self
3397 }
3398
3399 /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_retail_v2::model::Condition;
3404 /// use google_cloud_retail_v2::model::condition::TimeRange;
3405 /// let x = Condition::new()
3406 /// .set_active_time_range([
3407 /// TimeRange::default()/* use setters */,
3408 /// TimeRange::default()/* use (different) setters */,
3409 /// ]);
3410 /// ```
3411 pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3412 where
3413 T: std::iter::IntoIterator<Item = V>,
3414 V: std::convert::Into<crate::model::condition::TimeRange>,
3415 {
3416 use std::iter::Iterator;
3417 self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3418 self
3419 }
3420
3421 /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_retail_v2::model::Condition;
3426 /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3427 /// ```
3428 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3429 where
3430 T: std::iter::IntoIterator<Item = V>,
3431 V: std::convert::Into<std::string::String>,
3432 {
3433 use std::iter::Iterator;
3434 self.page_categories = v.into_iter().map(|i| i.into()).collect();
3435 self
3436 }
3437}
3438
3439impl wkt::message::Message for Condition {
3440 fn typename() -> &'static str {
3441 "type.googleapis.com/google.cloud.retail.v2.Condition"
3442 }
3443}
3444
3445/// Defines additional types related to [Condition].
3446pub mod condition {
3447 #[allow(unused_imports)]
3448 use super::*;
3449
3450 /// Query terms that we want to match on.
3451 #[derive(Clone, Default, PartialEq)]
3452 #[non_exhaustive]
3453 pub struct QueryTerm {
3454 /// The value of the term to match on.
3455 /// Value cannot be empty.
3456 /// Value can have at most 3 terms if specified as a partial match. Each
3457 /// space separated string is considered as one term.
3458 /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3459 /// and not allowed for a partial match.
3460 pub value: std::string::String,
3461
3462 /// Whether this is supposed to be a full or partial match.
3463 pub full_match: bool,
3464
3465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3466 }
3467
3468 impl QueryTerm {
3469 pub fn new() -> Self {
3470 std::default::Default::default()
3471 }
3472
3473 /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3478 /// let x = QueryTerm::new().set_value("example");
3479 /// ```
3480 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3481 self.value = v.into();
3482 self
3483 }
3484
3485 /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3490 /// let x = QueryTerm::new().set_full_match(true);
3491 /// ```
3492 pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3493 self.full_match = v.into();
3494 self
3495 }
3496 }
3497
3498 impl wkt::message::Message for QueryTerm {
3499 fn typename() -> &'static str {
3500 "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3501 }
3502 }
3503
3504 /// Used for time-dependent conditions.
3505 /// Example: Want to have rule applied for week long sale.
3506 #[derive(Clone, Default, PartialEq)]
3507 #[non_exhaustive]
3508 pub struct TimeRange {
3509 /// Start of time range. Range is inclusive.
3510 pub start_time: std::option::Option<wkt::Timestamp>,
3511
3512 /// End of time range. Range is inclusive.
3513 pub end_time: std::option::Option<wkt::Timestamp>,
3514
3515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3516 }
3517
3518 impl TimeRange {
3519 pub fn new() -> Self {
3520 std::default::Default::default()
3521 }
3522
3523 /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3524 ///
3525 /// # Example
3526 /// ```ignore,no_run
3527 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3528 /// use wkt::Timestamp;
3529 /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3530 /// ```
3531 pub fn set_start_time<T>(mut self, v: T) -> Self
3532 where
3533 T: std::convert::Into<wkt::Timestamp>,
3534 {
3535 self.start_time = std::option::Option::Some(v.into());
3536 self
3537 }
3538
3539 /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3540 ///
3541 /// # Example
3542 /// ```ignore,no_run
3543 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3544 /// use wkt::Timestamp;
3545 /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3546 /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3547 /// ```
3548 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3549 where
3550 T: std::convert::Into<wkt::Timestamp>,
3551 {
3552 self.start_time = v.map(|x| x.into());
3553 self
3554 }
3555
3556 /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3561 /// use wkt::Timestamp;
3562 /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3563 /// ```
3564 pub fn set_end_time<T>(mut self, v: T) -> Self
3565 where
3566 T: std::convert::Into<wkt::Timestamp>,
3567 {
3568 self.end_time = std::option::Option::Some(v.into());
3569 self
3570 }
3571
3572 /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3573 ///
3574 /// # Example
3575 /// ```ignore,no_run
3576 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3577 /// use wkt::Timestamp;
3578 /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3579 /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3580 /// ```
3581 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3582 where
3583 T: std::convert::Into<wkt::Timestamp>,
3584 {
3585 self.end_time = v.map(|x| x.into());
3586 self
3587 }
3588 }
3589
3590 impl wkt::message::Message for TimeRange {
3591 fn typename() -> &'static str {
3592 "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3593 }
3594 }
3595}
3596
3597/// A rule is a condition-action pair
3598///
3599/// * A condition defines when a rule is to be triggered.
3600/// * An action specifies what occurs on that trigger.
3601/// Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3602/// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3603///
3604/// [google.cloud.retail.v2.Control]: crate::model::Control
3605/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3606#[derive(Clone, Default, PartialEq)]
3607#[non_exhaustive]
3608pub struct Rule {
3609 /// Required. The condition that triggers the rule.
3610 /// If the condition is empty, the rule will always apply.
3611 pub condition: std::option::Option<crate::model::Condition>,
3612
3613 /// An action must be provided.
3614 pub action: std::option::Option<crate::model::rule::Action>,
3615
3616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3617}
3618
3619impl Rule {
3620 pub fn new() -> Self {
3621 std::default::Default::default()
3622 }
3623
3624 /// Sets the value of [condition][crate::model::Rule::condition].
3625 ///
3626 /// # Example
3627 /// ```ignore,no_run
3628 /// # use google_cloud_retail_v2::model::Rule;
3629 /// use google_cloud_retail_v2::model::Condition;
3630 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3631 /// ```
3632 pub fn set_condition<T>(mut self, v: T) -> Self
3633 where
3634 T: std::convert::Into<crate::model::Condition>,
3635 {
3636 self.condition = std::option::Option::Some(v.into());
3637 self
3638 }
3639
3640 /// Sets or clears the value of [condition][crate::model::Rule::condition].
3641 ///
3642 /// # Example
3643 /// ```ignore,no_run
3644 /// # use google_cloud_retail_v2::model::Rule;
3645 /// use google_cloud_retail_v2::model::Condition;
3646 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3647 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3648 /// ```
3649 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3650 where
3651 T: std::convert::Into<crate::model::Condition>,
3652 {
3653 self.condition = v.map(|x| x.into());
3654 self
3655 }
3656
3657 /// Sets the value of [action][crate::model::Rule::action].
3658 ///
3659 /// Note that all the setters affecting `action` are mutually
3660 /// exclusive.
3661 ///
3662 /// # Example
3663 /// ```ignore,no_run
3664 /// # use google_cloud_retail_v2::model::Rule;
3665 /// use google_cloud_retail_v2::model::rule::BoostAction;
3666 /// let x = Rule::new().set_action(Some(
3667 /// google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3668 /// ```
3669 pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3670 mut self,
3671 v: T,
3672 ) -> Self {
3673 self.action = v.into();
3674 self
3675 }
3676
3677 /// The value of [action][crate::model::Rule::action]
3678 /// if it holds a `BoostAction`, `None` if the field is not set or
3679 /// holds a different branch.
3680 pub fn boost_action(
3681 &self,
3682 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3683 #[allow(unreachable_patterns)]
3684 self.action.as_ref().and_then(|v| match v {
3685 crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3686 _ => std::option::Option::None,
3687 })
3688 }
3689
3690 /// Sets the value of [action][crate::model::Rule::action]
3691 /// to hold a `BoostAction`.
3692 ///
3693 /// Note that all the setters affecting `action` are
3694 /// mutually exclusive.
3695 ///
3696 /// # Example
3697 /// ```ignore,no_run
3698 /// # use google_cloud_retail_v2::model::Rule;
3699 /// use google_cloud_retail_v2::model::rule::BoostAction;
3700 /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3701 /// assert!(x.boost_action().is_some());
3702 /// assert!(x.redirect_action().is_none());
3703 /// assert!(x.oneway_synonyms_action().is_none());
3704 /// assert!(x.do_not_associate_action().is_none());
3705 /// assert!(x.replacement_action().is_none());
3706 /// assert!(x.ignore_action().is_none());
3707 /// assert!(x.filter_action().is_none());
3708 /// assert!(x.twoway_synonyms_action().is_none());
3709 /// assert!(x.force_return_facet_action().is_none());
3710 /// assert!(x.remove_facet_action().is_none());
3711 /// assert!(x.pin_action().is_none());
3712 /// ```
3713 pub fn set_boost_action<
3714 T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3715 >(
3716 mut self,
3717 v: T,
3718 ) -> Self {
3719 self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3720 self
3721 }
3722
3723 /// The value of [action][crate::model::Rule::action]
3724 /// if it holds a `RedirectAction`, `None` if the field is not set or
3725 /// holds a different branch.
3726 pub fn redirect_action(
3727 &self,
3728 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3729 #[allow(unreachable_patterns)]
3730 self.action.as_ref().and_then(|v| match v {
3731 crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3732 _ => std::option::Option::None,
3733 })
3734 }
3735
3736 /// Sets the value of [action][crate::model::Rule::action]
3737 /// to hold a `RedirectAction`.
3738 ///
3739 /// Note that all the setters affecting `action` are
3740 /// mutually exclusive.
3741 ///
3742 /// # Example
3743 /// ```ignore,no_run
3744 /// # use google_cloud_retail_v2::model::Rule;
3745 /// use google_cloud_retail_v2::model::rule::RedirectAction;
3746 /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3747 /// assert!(x.redirect_action().is_some());
3748 /// assert!(x.boost_action().is_none());
3749 /// assert!(x.oneway_synonyms_action().is_none());
3750 /// assert!(x.do_not_associate_action().is_none());
3751 /// assert!(x.replacement_action().is_none());
3752 /// assert!(x.ignore_action().is_none());
3753 /// assert!(x.filter_action().is_none());
3754 /// assert!(x.twoway_synonyms_action().is_none());
3755 /// assert!(x.force_return_facet_action().is_none());
3756 /// assert!(x.remove_facet_action().is_none());
3757 /// assert!(x.pin_action().is_none());
3758 /// ```
3759 pub fn set_redirect_action<
3760 T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3761 >(
3762 mut self,
3763 v: T,
3764 ) -> Self {
3765 self.action =
3766 std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3767 self
3768 }
3769
3770 /// The value of [action][crate::model::Rule::action]
3771 /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3772 /// holds a different branch.
3773 pub fn oneway_synonyms_action(
3774 &self,
3775 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3776 #[allow(unreachable_patterns)]
3777 self.action.as_ref().and_then(|v| match v {
3778 crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3779 _ => std::option::Option::None,
3780 })
3781 }
3782
3783 /// Sets the value of [action][crate::model::Rule::action]
3784 /// to hold a `OnewaySynonymsAction`.
3785 ///
3786 /// Note that all the setters affecting `action` are
3787 /// mutually exclusive.
3788 ///
3789 /// # Example
3790 /// ```ignore,no_run
3791 /// # use google_cloud_retail_v2::model::Rule;
3792 /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3793 /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3794 /// assert!(x.oneway_synonyms_action().is_some());
3795 /// assert!(x.boost_action().is_none());
3796 /// assert!(x.redirect_action().is_none());
3797 /// assert!(x.do_not_associate_action().is_none());
3798 /// assert!(x.replacement_action().is_none());
3799 /// assert!(x.ignore_action().is_none());
3800 /// assert!(x.filter_action().is_none());
3801 /// assert!(x.twoway_synonyms_action().is_none());
3802 /// assert!(x.force_return_facet_action().is_none());
3803 /// assert!(x.remove_facet_action().is_none());
3804 /// assert!(x.pin_action().is_none());
3805 /// ```
3806 pub fn set_oneway_synonyms_action<
3807 T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3808 >(
3809 mut self,
3810 v: T,
3811 ) -> Self {
3812 self.action =
3813 std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3814 self
3815 }
3816
3817 /// The value of [action][crate::model::Rule::action]
3818 /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3819 /// holds a different branch.
3820 pub fn do_not_associate_action(
3821 &self,
3822 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3823 #[allow(unreachable_patterns)]
3824 self.action.as_ref().and_then(|v| match v {
3825 crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3826 _ => std::option::Option::None,
3827 })
3828 }
3829
3830 /// Sets the value of [action][crate::model::Rule::action]
3831 /// to hold a `DoNotAssociateAction`.
3832 ///
3833 /// Note that all the setters affecting `action` are
3834 /// mutually exclusive.
3835 ///
3836 /// # Example
3837 /// ```ignore,no_run
3838 /// # use google_cloud_retail_v2::model::Rule;
3839 /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3840 /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3841 /// assert!(x.do_not_associate_action().is_some());
3842 /// assert!(x.boost_action().is_none());
3843 /// assert!(x.redirect_action().is_none());
3844 /// assert!(x.oneway_synonyms_action().is_none());
3845 /// assert!(x.replacement_action().is_none());
3846 /// assert!(x.ignore_action().is_none());
3847 /// assert!(x.filter_action().is_none());
3848 /// assert!(x.twoway_synonyms_action().is_none());
3849 /// assert!(x.force_return_facet_action().is_none());
3850 /// assert!(x.remove_facet_action().is_none());
3851 /// assert!(x.pin_action().is_none());
3852 /// ```
3853 pub fn set_do_not_associate_action<
3854 T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3855 >(
3856 mut self,
3857 v: T,
3858 ) -> Self {
3859 self.action =
3860 std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3861 self
3862 }
3863
3864 /// The value of [action][crate::model::Rule::action]
3865 /// if it holds a `ReplacementAction`, `None` if the field is not set or
3866 /// holds a different branch.
3867 pub fn replacement_action(
3868 &self,
3869 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3870 #[allow(unreachable_patterns)]
3871 self.action.as_ref().and_then(|v| match v {
3872 crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3873 _ => std::option::Option::None,
3874 })
3875 }
3876
3877 /// Sets the value of [action][crate::model::Rule::action]
3878 /// to hold a `ReplacementAction`.
3879 ///
3880 /// Note that all the setters affecting `action` are
3881 /// mutually exclusive.
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_retail_v2::model::Rule;
3886 /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3887 /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3888 /// assert!(x.replacement_action().is_some());
3889 /// assert!(x.boost_action().is_none());
3890 /// assert!(x.redirect_action().is_none());
3891 /// assert!(x.oneway_synonyms_action().is_none());
3892 /// assert!(x.do_not_associate_action().is_none());
3893 /// assert!(x.ignore_action().is_none());
3894 /// assert!(x.filter_action().is_none());
3895 /// assert!(x.twoway_synonyms_action().is_none());
3896 /// assert!(x.force_return_facet_action().is_none());
3897 /// assert!(x.remove_facet_action().is_none());
3898 /// assert!(x.pin_action().is_none());
3899 /// ```
3900 pub fn set_replacement_action<
3901 T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3902 >(
3903 mut self,
3904 v: T,
3905 ) -> Self {
3906 self.action =
3907 std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3908 self
3909 }
3910
3911 /// The value of [action][crate::model::Rule::action]
3912 /// if it holds a `IgnoreAction`, `None` if the field is not set or
3913 /// holds a different branch.
3914 pub fn ignore_action(
3915 &self,
3916 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3917 #[allow(unreachable_patterns)]
3918 self.action.as_ref().and_then(|v| match v {
3919 crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3920 _ => std::option::Option::None,
3921 })
3922 }
3923
3924 /// Sets the value of [action][crate::model::Rule::action]
3925 /// to hold a `IgnoreAction`.
3926 ///
3927 /// Note that all the setters affecting `action` are
3928 /// mutually exclusive.
3929 ///
3930 /// # Example
3931 /// ```ignore,no_run
3932 /// # use google_cloud_retail_v2::model::Rule;
3933 /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3934 /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3935 /// assert!(x.ignore_action().is_some());
3936 /// assert!(x.boost_action().is_none());
3937 /// assert!(x.redirect_action().is_none());
3938 /// assert!(x.oneway_synonyms_action().is_none());
3939 /// assert!(x.do_not_associate_action().is_none());
3940 /// assert!(x.replacement_action().is_none());
3941 /// assert!(x.filter_action().is_none());
3942 /// assert!(x.twoway_synonyms_action().is_none());
3943 /// assert!(x.force_return_facet_action().is_none());
3944 /// assert!(x.remove_facet_action().is_none());
3945 /// assert!(x.pin_action().is_none());
3946 /// ```
3947 pub fn set_ignore_action<
3948 T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
3949 >(
3950 mut self,
3951 v: T,
3952 ) -> Self {
3953 self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
3954 self
3955 }
3956
3957 /// The value of [action][crate::model::Rule::action]
3958 /// if it holds a `FilterAction`, `None` if the field is not set or
3959 /// holds a different branch.
3960 pub fn filter_action(
3961 &self,
3962 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
3963 #[allow(unreachable_patterns)]
3964 self.action.as_ref().and_then(|v| match v {
3965 crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
3966 _ => std::option::Option::None,
3967 })
3968 }
3969
3970 /// Sets the value of [action][crate::model::Rule::action]
3971 /// to hold a `FilterAction`.
3972 ///
3973 /// Note that all the setters affecting `action` are
3974 /// mutually exclusive.
3975 ///
3976 /// # Example
3977 /// ```ignore,no_run
3978 /// # use google_cloud_retail_v2::model::Rule;
3979 /// use google_cloud_retail_v2::model::rule::FilterAction;
3980 /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
3981 /// assert!(x.filter_action().is_some());
3982 /// assert!(x.boost_action().is_none());
3983 /// assert!(x.redirect_action().is_none());
3984 /// assert!(x.oneway_synonyms_action().is_none());
3985 /// assert!(x.do_not_associate_action().is_none());
3986 /// assert!(x.replacement_action().is_none());
3987 /// assert!(x.ignore_action().is_none());
3988 /// assert!(x.twoway_synonyms_action().is_none());
3989 /// assert!(x.force_return_facet_action().is_none());
3990 /// assert!(x.remove_facet_action().is_none());
3991 /// assert!(x.pin_action().is_none());
3992 /// ```
3993 pub fn set_filter_action<
3994 T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
3995 >(
3996 mut self,
3997 v: T,
3998 ) -> Self {
3999 self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4000 self
4001 }
4002
4003 /// The value of [action][crate::model::Rule::action]
4004 /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4005 /// holds a different branch.
4006 pub fn twoway_synonyms_action(
4007 &self,
4008 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4009 #[allow(unreachable_patterns)]
4010 self.action.as_ref().and_then(|v| match v {
4011 crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4012 _ => std::option::Option::None,
4013 })
4014 }
4015
4016 /// Sets the value of [action][crate::model::Rule::action]
4017 /// to hold a `TwowaySynonymsAction`.
4018 ///
4019 /// Note that all the setters affecting `action` are
4020 /// mutually exclusive.
4021 ///
4022 /// # Example
4023 /// ```ignore,no_run
4024 /// # use google_cloud_retail_v2::model::Rule;
4025 /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4026 /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4027 /// assert!(x.twoway_synonyms_action().is_some());
4028 /// assert!(x.boost_action().is_none());
4029 /// assert!(x.redirect_action().is_none());
4030 /// assert!(x.oneway_synonyms_action().is_none());
4031 /// assert!(x.do_not_associate_action().is_none());
4032 /// assert!(x.replacement_action().is_none());
4033 /// assert!(x.ignore_action().is_none());
4034 /// assert!(x.filter_action().is_none());
4035 /// assert!(x.force_return_facet_action().is_none());
4036 /// assert!(x.remove_facet_action().is_none());
4037 /// assert!(x.pin_action().is_none());
4038 /// ```
4039 pub fn set_twoway_synonyms_action<
4040 T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4041 >(
4042 mut self,
4043 v: T,
4044 ) -> Self {
4045 self.action =
4046 std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4047 self
4048 }
4049
4050 /// The value of [action][crate::model::Rule::action]
4051 /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4052 /// holds a different branch.
4053 pub fn force_return_facet_action(
4054 &self,
4055 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4056 #[allow(unreachable_patterns)]
4057 self.action.as_ref().and_then(|v| match v {
4058 crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4059 _ => std::option::Option::None,
4060 })
4061 }
4062
4063 /// Sets the value of [action][crate::model::Rule::action]
4064 /// to hold a `ForceReturnFacetAction`.
4065 ///
4066 /// Note that all the setters affecting `action` are
4067 /// mutually exclusive.
4068 ///
4069 /// # Example
4070 /// ```ignore,no_run
4071 /// # use google_cloud_retail_v2::model::Rule;
4072 /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4073 /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4074 /// assert!(x.force_return_facet_action().is_some());
4075 /// assert!(x.boost_action().is_none());
4076 /// assert!(x.redirect_action().is_none());
4077 /// assert!(x.oneway_synonyms_action().is_none());
4078 /// assert!(x.do_not_associate_action().is_none());
4079 /// assert!(x.replacement_action().is_none());
4080 /// assert!(x.ignore_action().is_none());
4081 /// assert!(x.filter_action().is_none());
4082 /// assert!(x.twoway_synonyms_action().is_none());
4083 /// assert!(x.remove_facet_action().is_none());
4084 /// assert!(x.pin_action().is_none());
4085 /// ```
4086 pub fn set_force_return_facet_action<
4087 T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4088 >(
4089 mut self,
4090 v: T,
4091 ) -> Self {
4092 self.action =
4093 std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4094 self
4095 }
4096
4097 /// The value of [action][crate::model::Rule::action]
4098 /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4099 /// holds a different branch.
4100 pub fn remove_facet_action(
4101 &self,
4102 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4103 #[allow(unreachable_patterns)]
4104 self.action.as_ref().and_then(|v| match v {
4105 crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4106 _ => std::option::Option::None,
4107 })
4108 }
4109
4110 /// Sets the value of [action][crate::model::Rule::action]
4111 /// to hold a `RemoveFacetAction`.
4112 ///
4113 /// Note that all the setters affecting `action` are
4114 /// mutually exclusive.
4115 ///
4116 /// # Example
4117 /// ```ignore,no_run
4118 /// # use google_cloud_retail_v2::model::Rule;
4119 /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4120 /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4121 /// assert!(x.remove_facet_action().is_some());
4122 /// assert!(x.boost_action().is_none());
4123 /// assert!(x.redirect_action().is_none());
4124 /// assert!(x.oneway_synonyms_action().is_none());
4125 /// assert!(x.do_not_associate_action().is_none());
4126 /// assert!(x.replacement_action().is_none());
4127 /// assert!(x.ignore_action().is_none());
4128 /// assert!(x.filter_action().is_none());
4129 /// assert!(x.twoway_synonyms_action().is_none());
4130 /// assert!(x.force_return_facet_action().is_none());
4131 /// assert!(x.pin_action().is_none());
4132 /// ```
4133 pub fn set_remove_facet_action<
4134 T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4135 >(
4136 mut self,
4137 v: T,
4138 ) -> Self {
4139 self.action =
4140 std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4141 self
4142 }
4143
4144 /// The value of [action][crate::model::Rule::action]
4145 /// if it holds a `PinAction`, `None` if the field is not set or
4146 /// holds a different branch.
4147 pub fn pin_action(
4148 &self,
4149 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4150 #[allow(unreachable_patterns)]
4151 self.action.as_ref().and_then(|v| match v {
4152 crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4153 _ => std::option::Option::None,
4154 })
4155 }
4156
4157 /// Sets the value of [action][crate::model::Rule::action]
4158 /// to hold a `PinAction`.
4159 ///
4160 /// Note that all the setters affecting `action` are
4161 /// mutually exclusive.
4162 ///
4163 /// # Example
4164 /// ```ignore,no_run
4165 /// # use google_cloud_retail_v2::model::Rule;
4166 /// use google_cloud_retail_v2::model::rule::PinAction;
4167 /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4168 /// assert!(x.pin_action().is_some());
4169 /// assert!(x.boost_action().is_none());
4170 /// assert!(x.redirect_action().is_none());
4171 /// assert!(x.oneway_synonyms_action().is_none());
4172 /// assert!(x.do_not_associate_action().is_none());
4173 /// assert!(x.replacement_action().is_none());
4174 /// assert!(x.ignore_action().is_none());
4175 /// assert!(x.filter_action().is_none());
4176 /// assert!(x.twoway_synonyms_action().is_none());
4177 /// assert!(x.force_return_facet_action().is_none());
4178 /// assert!(x.remove_facet_action().is_none());
4179 /// ```
4180 pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4181 mut self,
4182 v: T,
4183 ) -> Self {
4184 self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4185 self
4186 }
4187}
4188
4189impl wkt::message::Message for Rule {
4190 fn typename() -> &'static str {
4191 "type.googleapis.com/google.cloud.retail.v2.Rule"
4192 }
4193}
4194
4195/// Defines additional types related to [Rule].
4196pub mod rule {
4197 #[allow(unused_imports)]
4198 use super::*;
4199
4200 /// A boost action to apply to results matching condition specified above.
4201 #[derive(Clone, Default, PartialEq)]
4202 #[non_exhaustive]
4203 pub struct BoostAction {
4204 /// Strength of the condition boost, which must be in [-1, 1]. Negative
4205 /// boost means demotion. Default is 0.0.
4206 ///
4207 /// Setting to 1.0 gives the item a big promotion. However, it does not
4208 /// necessarily mean that the boosted item will be the top result at all
4209 /// times, nor that other items will be excluded. Results could still be
4210 /// shown even when none of them matches the condition. And results that
4211 /// are significantly more relevant to the search query can still trump
4212 /// your heavily favored but irrelevant items.
4213 ///
4214 /// Setting to -1.0 gives the item a big demotion. However, results that
4215 /// are deeply relevant might still be shown. The item will have an
4216 /// upstream battle to get a fairly high ranking, but it is not blocked out
4217 /// completely.
4218 ///
4219 /// Setting to 0.0 means no boost applied. The boosting condition is
4220 /// ignored.
4221 pub boost: f32,
4222
4223 /// The filter can have a max size of 5000 characters.
4224 /// An expression which specifies which products to apply an action to.
4225 /// The syntax and supported fields are the same as a filter expression. See
4226 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4227 /// detail syntax and limitations.
4228 ///
4229 /// Examples:
4230 ///
4231 /// * To boost products with product ID "product_1" or "product_2", and
4232 /// color
4233 /// "Red" or "Blue":\<br\>
4234 /// *(id: ANY("product_1", "product_2"))<br>*
4235 /// *AND<br>*
4236 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4237 ///
4238 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4239 pub products_filter: std::string::String,
4240
4241 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4242 }
4243
4244 impl BoostAction {
4245 pub fn new() -> Self {
4246 std::default::Default::default()
4247 }
4248
4249 /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4250 ///
4251 /// # Example
4252 /// ```ignore,no_run
4253 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4254 /// let x = BoostAction::new().set_boost(42.0);
4255 /// ```
4256 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4257 self.boost = v.into();
4258 self
4259 }
4260
4261 /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4262 ///
4263 /// # Example
4264 /// ```ignore,no_run
4265 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4266 /// let x = BoostAction::new().set_products_filter("example");
4267 /// ```
4268 pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4269 mut self,
4270 v: T,
4271 ) -> Self {
4272 self.products_filter = v.into();
4273 self
4274 }
4275 }
4276
4277 impl wkt::message::Message for BoostAction {
4278 fn typename() -> &'static str {
4279 "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4280 }
4281 }
4282
4283 /// * Rule Condition:
4284 ///
4285 /// - No
4286 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4287 /// provided is a global match.
4288 /// - 1 or more
4289 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4290 /// provided are combined with OR operator.
4291 /// * Action Input: The request query and filter that are applied to the
4292 /// retrieved products, in addition to any filters already provided with the
4293 /// SearchRequest. The AND operator is used to combine the query's existing
4294 /// filters with the filter rule(s). NOTE: May result in 0 results when
4295 /// filters conflict.
4296 ///
4297 /// * Action Result: Filters the returned objects to be ONLY those that passed
4298 /// the filter.
4299 ///
4300 ///
4301 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4302 #[derive(Clone, Default, PartialEq)]
4303 #[non_exhaustive]
4304 pub struct FilterAction {
4305 /// A filter to apply on the matching condition results. Supported features:
4306 ///
4307 /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4308 /// * Filter syntax is identical to
4309 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4310 /// more
4311 /// information, see [Filter](/retail/docs/filter-and-order#filter).
4312 /// * To filter products with product ID "product_1" or "product_2", and
4313 /// color
4314 /// "Red" or "Blue":\<br\>
4315 /// *(id: ANY("product_1", "product_2"))<br>*
4316 /// *AND<br>*
4317 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4318 ///
4319 /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4320 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4321 pub filter: std::string::String,
4322
4323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4324 }
4325
4326 impl FilterAction {
4327 pub fn new() -> Self {
4328 std::default::Default::default()
4329 }
4330
4331 /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4332 ///
4333 /// # Example
4334 /// ```ignore,no_run
4335 /// # use google_cloud_retail_v2::model::rule::FilterAction;
4336 /// let x = FilterAction::new().set_filter("example");
4337 /// ```
4338 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4339 self.filter = v.into();
4340 self
4341 }
4342 }
4343
4344 impl wkt::message::Message for FilterAction {
4345 fn typename() -> &'static str {
4346 "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4347 }
4348 }
4349
4350 /// Redirects a shopper to a specific page.
4351 ///
4352 /// * Rule Condition:
4353 /// Must specify
4354 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4355 /// * Action Input: Request Query
4356 /// * Action Result: Redirects shopper to provided uri.
4357 ///
4358 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4359 #[derive(Clone, Default, PartialEq)]
4360 #[non_exhaustive]
4361 pub struct RedirectAction {
4362 /// URL must have length equal or less than 2000 characters.
4363 pub redirect_uri: std::string::String,
4364
4365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4366 }
4367
4368 impl RedirectAction {
4369 pub fn new() -> Self {
4370 std::default::Default::default()
4371 }
4372
4373 /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4374 ///
4375 /// # Example
4376 /// ```ignore,no_run
4377 /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4378 /// let x = RedirectAction::new().set_redirect_uri("example");
4379 /// ```
4380 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4381 mut self,
4382 v: T,
4383 ) -> Self {
4384 self.redirect_uri = v.into();
4385 self
4386 }
4387 }
4388
4389 impl wkt::message::Message for RedirectAction {
4390 fn typename() -> &'static str {
4391 "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4392 }
4393 }
4394
4395 /// Creates a set of terms that will be treated as synonyms of each other.
4396 /// Example: synonyms of "sneakers" and "shoes":
4397 ///
4398 /// * "sneakers" will use a synonym of "shoes".
4399 /// * "shoes" will use a synonym of "sneakers".
4400 #[derive(Clone, Default, PartialEq)]
4401 #[non_exhaustive]
4402 pub struct TwowaySynonymsAction {
4403 /// Defines a set of synonyms.
4404 /// Can specify up to 100 synonyms.
4405 /// Must specify at least 2 synonyms.
4406 pub synonyms: std::vec::Vec<std::string::String>,
4407
4408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4409 }
4410
4411 impl TwowaySynonymsAction {
4412 pub fn new() -> Self {
4413 std::default::Default::default()
4414 }
4415
4416 /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4421 /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4422 /// ```
4423 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4424 where
4425 T: std::iter::IntoIterator<Item = V>,
4426 V: std::convert::Into<std::string::String>,
4427 {
4428 use std::iter::Iterator;
4429 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4430 self
4431 }
4432 }
4433
4434 impl wkt::message::Message for TwowaySynonymsAction {
4435 fn typename() -> &'static str {
4436 "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4437 }
4438 }
4439
4440 /// Maps a set of terms to a set of synonyms.
4441 /// Set of synonyms will be treated as synonyms of each query term only.
4442 /// `query_terms` will not be treated as synonyms of each other.
4443 /// Example: "sneakers" will use a synonym of "shoes".
4444 /// "shoes" will not use a synonym of "sneakers".
4445 #[derive(Clone, Default, PartialEq)]
4446 #[non_exhaustive]
4447 pub struct OnewaySynonymsAction {
4448 /// Terms from the search query.
4449 /// Will treat synonyms as their synonyms.
4450 /// Not themselves synonyms of the synonyms.
4451 /// Can specify up to 100 terms.
4452 pub query_terms: std::vec::Vec<std::string::String>,
4453
4454 /// Defines a set of synonyms.
4455 /// Cannot contain duplicates.
4456 /// Can specify up to 100 synonyms.
4457 pub synonyms: std::vec::Vec<std::string::String>,
4458
4459 /// Will be [deprecated = true] post migration;
4460 pub oneway_terms: std::vec::Vec<std::string::String>,
4461
4462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4463 }
4464
4465 impl OnewaySynonymsAction {
4466 pub fn new() -> Self {
4467 std::default::Default::default()
4468 }
4469
4470 /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4475 /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4476 /// ```
4477 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4478 where
4479 T: std::iter::IntoIterator<Item = V>,
4480 V: std::convert::Into<std::string::String>,
4481 {
4482 use std::iter::Iterator;
4483 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4484 self
4485 }
4486
4487 /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4488 ///
4489 /// # Example
4490 /// ```ignore,no_run
4491 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4492 /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4493 /// ```
4494 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4495 where
4496 T: std::iter::IntoIterator<Item = V>,
4497 V: std::convert::Into<std::string::String>,
4498 {
4499 use std::iter::Iterator;
4500 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4501 self
4502 }
4503
4504 /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4505 ///
4506 /// # Example
4507 /// ```ignore,no_run
4508 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4509 /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4510 /// ```
4511 pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4512 where
4513 T: std::iter::IntoIterator<Item = V>,
4514 V: std::convert::Into<std::string::String>,
4515 {
4516 use std::iter::Iterator;
4517 self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4518 self
4519 }
4520 }
4521
4522 impl wkt::message::Message for OnewaySynonymsAction {
4523 fn typename() -> &'static str {
4524 "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4525 }
4526 }
4527
4528 /// Prevents `query_term` from being associated with specified terms during
4529 /// search.
4530 /// Example: Don't associate "gShoe" and "cheap".
4531 #[derive(Clone, Default, PartialEq)]
4532 #[non_exhaustive]
4533 pub struct DoNotAssociateAction {
4534 /// Terms from the search query.
4535 /// Will not consider do_not_associate_terms for search if in search query.
4536 /// Can specify up to 100 terms.
4537 pub query_terms: std::vec::Vec<std::string::String>,
4538
4539 /// Cannot contain duplicates or the query term.
4540 /// Can specify up to 100 terms.
4541 pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4542
4543 /// Will be [deprecated = true] post migration;
4544 pub terms: std::vec::Vec<std::string::String>,
4545
4546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4547 }
4548
4549 impl DoNotAssociateAction {
4550 pub fn new() -> Self {
4551 std::default::Default::default()
4552 }
4553
4554 /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4555 ///
4556 /// # Example
4557 /// ```ignore,no_run
4558 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4559 /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4560 /// ```
4561 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4562 where
4563 T: std::iter::IntoIterator<Item = V>,
4564 V: std::convert::Into<std::string::String>,
4565 {
4566 use std::iter::Iterator;
4567 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4568 self
4569 }
4570
4571 /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4572 ///
4573 /// # Example
4574 /// ```ignore,no_run
4575 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4576 /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4577 /// ```
4578 pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4579 where
4580 T: std::iter::IntoIterator<Item = V>,
4581 V: std::convert::Into<std::string::String>,
4582 {
4583 use std::iter::Iterator;
4584 self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4585 self
4586 }
4587
4588 /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4589 ///
4590 /// # Example
4591 /// ```ignore,no_run
4592 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4593 /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4594 /// ```
4595 pub fn set_terms<T, V>(mut self, v: T) -> Self
4596 where
4597 T: std::iter::IntoIterator<Item = V>,
4598 V: std::convert::Into<std::string::String>,
4599 {
4600 use std::iter::Iterator;
4601 self.terms = v.into_iter().map(|i| i.into()).collect();
4602 self
4603 }
4604 }
4605
4606 impl wkt::message::Message for DoNotAssociateAction {
4607 fn typename() -> &'static str {
4608 "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4609 }
4610 }
4611
4612 /// Replaces a term in the query. Multiple replacement candidates can be
4613 /// specified. All `query_terms` will be replaced with the replacement term.
4614 /// Example: Replace "gShoe" with "google shoe".
4615 #[derive(Clone, Default, PartialEq)]
4616 #[non_exhaustive]
4617 pub struct ReplacementAction {
4618 /// Terms from the search query.
4619 /// Will be replaced by replacement term.
4620 /// Can specify up to 100 terms.
4621 pub query_terms: std::vec::Vec<std::string::String>,
4622
4623 /// Term that will be used for replacement.
4624 pub replacement_term: std::string::String,
4625
4626 /// Will be [deprecated = true] post migration;
4627 pub term: std::string::String,
4628
4629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4630 }
4631
4632 impl ReplacementAction {
4633 pub fn new() -> Self {
4634 std::default::Default::default()
4635 }
4636
4637 /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4638 ///
4639 /// # Example
4640 /// ```ignore,no_run
4641 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4642 /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4643 /// ```
4644 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4645 where
4646 T: std::iter::IntoIterator<Item = V>,
4647 V: std::convert::Into<std::string::String>,
4648 {
4649 use std::iter::Iterator;
4650 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4651 self
4652 }
4653
4654 /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4655 ///
4656 /// # Example
4657 /// ```ignore,no_run
4658 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4659 /// let x = ReplacementAction::new().set_replacement_term("example");
4660 /// ```
4661 pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4662 mut self,
4663 v: T,
4664 ) -> Self {
4665 self.replacement_term = v.into();
4666 self
4667 }
4668
4669 /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4670 ///
4671 /// # Example
4672 /// ```ignore,no_run
4673 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4674 /// let x = ReplacementAction::new().set_term("example");
4675 /// ```
4676 pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4677 self.term = v.into();
4678 self
4679 }
4680 }
4681
4682 impl wkt::message::Message for ReplacementAction {
4683 fn typename() -> &'static str {
4684 "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4685 }
4686 }
4687
4688 /// Prevents a term in the query from being used in search.
4689 /// Example: Don't search for "shoddy".
4690 #[derive(Clone, Default, PartialEq)]
4691 #[non_exhaustive]
4692 pub struct IgnoreAction {
4693 /// Terms to ignore in the search query.
4694 pub ignore_terms: std::vec::Vec<std::string::String>,
4695
4696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4697 }
4698
4699 impl IgnoreAction {
4700 pub fn new() -> Self {
4701 std::default::Default::default()
4702 }
4703
4704 /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4705 ///
4706 /// # Example
4707 /// ```ignore,no_run
4708 /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4709 /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4710 /// ```
4711 pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4712 where
4713 T: std::iter::IntoIterator<Item = V>,
4714 V: std::convert::Into<std::string::String>,
4715 {
4716 use std::iter::Iterator;
4717 self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4718 self
4719 }
4720 }
4721
4722 impl wkt::message::Message for IgnoreAction {
4723 fn typename() -> &'static str {
4724 "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4725 }
4726 }
4727
4728 /// Force returns an attribute/facet in the request around a certain position
4729 /// or above.
4730 ///
4731 /// * Rule Condition:
4732 /// Must specify non-empty
4733 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4734 /// (for search only) or
4735 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4736 /// (for browse only), but can't specify both.
4737 ///
4738 /// * Action Inputs: attribute name, position
4739 ///
4740 /// * Action Result: Will force return a facet key around a certain position
4741 /// or above if the condition is satisfied.
4742 ///
4743 ///
4744 /// Example: Suppose the query is "shoes", the
4745 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4746 /// "shoes", the
4747 /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4748 /// is "size" and the
4749 /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4750 /// is 8.
4751 ///
4752 /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4753 /// the facet "size" will appear at a position close to 8. b) The facet key
4754 /// "size" in among the top 8 positions in the request, then it will stay at
4755 /// its current rank.
4756 ///
4757 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4758 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4759 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4760 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4761 #[derive(Clone, Default, PartialEq)]
4762 #[non_exhaustive]
4763 pub struct ForceReturnFacetAction {
4764 /// Each instance corresponds to a force return attribute for the given
4765 /// condition. There can't be more 15 instances here.
4766 pub facet_position_adjustments:
4767 std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4768
4769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4770 }
4771
4772 impl ForceReturnFacetAction {
4773 pub fn new() -> Self {
4774 std::default::Default::default()
4775 }
4776
4777 /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4778 ///
4779 /// # Example
4780 /// ```ignore,no_run
4781 /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4782 /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4783 /// let x = ForceReturnFacetAction::new()
4784 /// .set_facet_position_adjustments([
4785 /// FacetPositionAdjustment::default()/* use setters */,
4786 /// FacetPositionAdjustment::default()/* use (different) setters */,
4787 /// ]);
4788 /// ```
4789 pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4790 where
4791 T: std::iter::IntoIterator<Item = V>,
4792 V: std::convert::Into<
4793 crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4794 >,
4795 {
4796 use std::iter::Iterator;
4797 self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4798 self
4799 }
4800 }
4801
4802 impl wkt::message::Message for ForceReturnFacetAction {
4803 fn typename() -> &'static str {
4804 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4805 }
4806 }
4807
4808 /// Defines additional types related to [ForceReturnFacetAction].
4809 pub mod force_return_facet_action {
4810 #[allow(unused_imports)]
4811 use super::*;
4812
4813 /// Each facet position adjustment consists of a single attribute name (i.e.
4814 /// facet key) along with a specified position.
4815 #[derive(Clone, Default, PartialEq)]
4816 #[non_exhaustive]
4817 pub struct FacetPositionAdjustment {
4818 /// The attribute name to force return as a facet. Each attribute name
4819 /// should be a valid attribute name, be non-empty and contain at most 80
4820 /// characters long.
4821 pub attribute_name: std::string::String,
4822
4823 /// This is the position in the request as explained above. It should be
4824 /// strictly positive be at most 100.
4825 pub position: i32,
4826
4827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4828 }
4829
4830 impl FacetPositionAdjustment {
4831 pub fn new() -> Self {
4832 std::default::Default::default()
4833 }
4834
4835 /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4836 ///
4837 /// # Example
4838 /// ```ignore,no_run
4839 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4840 /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4841 /// ```
4842 pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4843 mut self,
4844 v: T,
4845 ) -> Self {
4846 self.attribute_name = v.into();
4847 self
4848 }
4849
4850 /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4851 ///
4852 /// # Example
4853 /// ```ignore,no_run
4854 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4855 /// let x = FacetPositionAdjustment::new().set_position(42);
4856 /// ```
4857 pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4858 self.position = v.into();
4859 self
4860 }
4861 }
4862
4863 impl wkt::message::Message for FacetPositionAdjustment {
4864 fn typename() -> &'static str {
4865 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4866 }
4867 }
4868 }
4869
4870 /// Removes an attribute/facet in the request if is present.
4871 ///
4872 /// * Rule Condition:
4873 /// Must specify non-empty
4874 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4875 /// (for search only) or
4876 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4877 /// (for browse only), but can't specify both.
4878 ///
4879 /// * Action Input: attribute name
4880 ///
4881 /// * Action Result: Will remove the attribute (as a facet) from the request
4882 /// if it is present.
4883 ///
4884 ///
4885 /// Example: Suppose the query is "shoes", the
4886 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4887 /// "shoes" and the attribute name "size", then facet key "size" will be
4888 /// removed from the request (if it is present).
4889 ///
4890 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4891 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4892 #[derive(Clone, Default, PartialEq)]
4893 #[non_exhaustive]
4894 pub struct RemoveFacetAction {
4895 /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4896 /// (if present in the request). There can't be more 3 attribute names.
4897 /// Each attribute name should be a valid attribute name, be non-empty and
4898 /// contain at most 80 characters.
4899 pub attribute_names: std::vec::Vec<std::string::String>,
4900
4901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4902 }
4903
4904 impl RemoveFacetAction {
4905 pub fn new() -> Self {
4906 std::default::Default::default()
4907 }
4908
4909 /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4910 ///
4911 /// # Example
4912 /// ```ignore,no_run
4913 /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4914 /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4915 /// ```
4916 pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4917 where
4918 T: std::iter::IntoIterator<Item = V>,
4919 V: std::convert::Into<std::string::String>,
4920 {
4921 use std::iter::Iterator;
4922 self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4923 self
4924 }
4925 }
4926
4927 impl wkt::message::Message for RemoveFacetAction {
4928 fn typename() -> &'static str {
4929 "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
4930 }
4931 }
4932
4933 /// Pins one or more specified products to a specific position in the
4934 /// results.
4935 ///
4936 /// * Rule Condition:
4937 /// Must specify non-empty
4938 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4939 /// (for search only) or
4940 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4941 /// (for browse only), but can't specify both.
4942 ///
4943 /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
4944 /// uses 1-based indexing).
4945 ///
4946 /// * Action Result: Will pin products with matching ids to the position
4947 /// specified in the final result order.
4948 ///
4949 ///
4950 /// Example: Suppose the query is `shoes`, the
4951 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4952 /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
4953 /// pinned to the top position in the final results.
4954 ///
4955 /// If multiple PinActions are matched to a single request the actions will
4956 /// be processed from most to least recently updated.
4957 ///
4958 /// Pins to positions larger than the max allowed page size of 120 are not
4959 /// allowed.
4960 ///
4961 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4962 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4963 #[derive(Clone, Default, PartialEq)]
4964 #[non_exhaustive]
4965 pub struct PinAction {
4966 /// Required. A map of positions to product_ids.
4967 ///
4968 /// Partial matches per action are allowed, if a certain position in the map
4969 /// is already filled that `[position, product_id]` pair will be ignored
4970 /// but the rest may still be applied. This case will only occur if multiple
4971 /// pin actions are matched to a single request, as the map guarantees that
4972 /// pin positions are unique within the same action.
4973 ///
4974 /// Duplicate product_ids are not permitted within a single pin map.
4975 ///
4976 /// The max size of this map is 120, equivalent to the max [request page
4977 /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
4978 pub pin_map: std::collections::HashMap<i64, std::string::String>,
4979
4980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4981 }
4982
4983 impl PinAction {
4984 pub fn new() -> Self {
4985 std::default::Default::default()
4986 }
4987
4988 /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
4989 ///
4990 /// # Example
4991 /// ```ignore,no_run
4992 /// # use google_cloud_retail_v2::model::rule::PinAction;
4993 /// let x = PinAction::new().set_pin_map([
4994 /// (0, "abc"),
4995 /// (1, "xyz"),
4996 /// ]);
4997 /// ```
4998 pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
4999 where
5000 T: std::iter::IntoIterator<Item = (K, V)>,
5001 K: std::convert::Into<i64>,
5002 V: std::convert::Into<std::string::String>,
5003 {
5004 use std::iter::Iterator;
5005 self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5006 self
5007 }
5008 }
5009
5010 impl wkt::message::Message for PinAction {
5011 fn typename() -> &'static str {
5012 "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5013 }
5014 }
5015
5016 /// An action must be provided.
5017 #[derive(Clone, Debug, PartialEq)]
5018 #[non_exhaustive]
5019 pub enum Action {
5020 /// A boost action.
5021 BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5022 /// Redirects a shopper to a specific page.
5023 RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5024 /// Treats specific term as a synonym with a group of terms.
5025 /// Group of terms will not be treated as synonyms with the specific term.
5026 OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5027 /// Prevents term from being associated with other terms.
5028 DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5029 /// Replaces specific terms in the query.
5030 ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5031 /// Ignores specific terms from query during search.
5032 IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5033 /// Filters results.
5034 FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5035 /// Treats a set of terms as synonyms of one another.
5036 TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5037 /// Force returns an attribute as a facet in the request.
5038 ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5039 /// Remove an attribute as a facet in the request (if present).
5040 RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5041 /// Pins one or more specified products to a specific position in the
5042 /// results.
5043 PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5044 }
5045}
5046
5047/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5048/// whom it's sold.
5049///
5050/// [google.cloud.retail.v2.Product]: crate::model::Product
5051#[derive(Clone, Default, PartialEq)]
5052#[non_exhaustive]
5053pub struct Audience {
5054 /// The genders of the audience. Strongly encouraged to use the standard
5055 /// values: "male", "female", "unisex".
5056 ///
5057 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5058 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5059 /// is returned.
5060 ///
5061 /// Google Merchant Center property
5062 /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5063 /// property
5064 /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5065 pub genders: std::vec::Vec<std::string::String>,
5066
5067 /// The age groups of the audience. Strongly encouraged to use the standard
5068 /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5069 /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5070 /// teens or older).
5071 ///
5072 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5073 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5074 /// is returned.
5075 ///
5076 /// Google Merchant Center property
5077 /// [age_group](https://support.google.com/merchants/answer/6324463).
5078 /// Schema.org property
5079 /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5080 /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5081 pub age_groups: std::vec::Vec<std::string::String>,
5082
5083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5084}
5085
5086impl Audience {
5087 pub fn new() -> Self {
5088 std::default::Default::default()
5089 }
5090
5091 /// Sets the value of [genders][crate::model::Audience::genders].
5092 ///
5093 /// # Example
5094 /// ```ignore,no_run
5095 /// # use google_cloud_retail_v2::model::Audience;
5096 /// let x = Audience::new().set_genders(["a", "b", "c"]);
5097 /// ```
5098 pub fn set_genders<T, V>(mut self, v: T) -> Self
5099 where
5100 T: std::iter::IntoIterator<Item = V>,
5101 V: std::convert::Into<std::string::String>,
5102 {
5103 use std::iter::Iterator;
5104 self.genders = v.into_iter().map(|i| i.into()).collect();
5105 self
5106 }
5107
5108 /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5109 ///
5110 /// # Example
5111 /// ```ignore,no_run
5112 /// # use google_cloud_retail_v2::model::Audience;
5113 /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5114 /// ```
5115 pub fn set_age_groups<T, V>(mut self, v: T) -> Self
5116 where
5117 T: std::iter::IntoIterator<Item = V>,
5118 V: std::convert::Into<std::string::String>,
5119 {
5120 use std::iter::Iterator;
5121 self.age_groups = v.into_iter().map(|i| i.into()).collect();
5122 self
5123 }
5124}
5125
5126impl wkt::message::Message for Audience {
5127 fn typename() -> &'static str {
5128 "type.googleapis.com/google.cloud.retail.v2.Audience"
5129 }
5130}
5131
5132/// The color information of a [Product][google.cloud.retail.v2.Product].
5133///
5134/// [google.cloud.retail.v2.Product]: crate::model::Product
5135#[derive(Clone, Default, PartialEq)]
5136#[non_exhaustive]
5137pub struct ColorInfo {
5138 /// The standard color families. Strongly recommended to use the following
5139 /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5140 /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5141 /// Normally it is expected to have only 1 color family. May consider using
5142 /// single "Mixed" instead of multiple values.
5143 ///
5144 /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5145 /// string with a length limit of 128 characters. Otherwise, an
5146 /// INVALID_ARGUMENT error is returned.
5147 ///
5148 /// Google Merchant Center property
5149 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5150 /// property [Product.color](https://schema.org/color).
5151 ///
5152 /// The colorFamilies field as a system attribute is not a required field but
5153 /// strongly recommended to be specified. Google Search models treat this field
5154 /// as more important than a custom product attribute when specified.
5155 pub color_families: std::vec::Vec<std::string::String>,
5156
5157 /// The color display names, which may be different from standard color family
5158 /// names, such as the color aliases used in the website frontend. Normally
5159 /// it is expected to have only 1 color. May consider using single "Mixed"
5160 /// instead of multiple values.
5161 ///
5162 /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5163 /// string with a length limit of 128 characters. Otherwise, an
5164 /// INVALID_ARGUMENT error is returned.
5165 ///
5166 /// Google Merchant Center property
5167 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5168 /// property [Product.color](https://schema.org/color).
5169 pub colors: std::vec::Vec<std::string::String>,
5170
5171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5172}
5173
5174impl ColorInfo {
5175 pub fn new() -> Self {
5176 std::default::Default::default()
5177 }
5178
5179 /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5180 ///
5181 /// # Example
5182 /// ```ignore,no_run
5183 /// # use google_cloud_retail_v2::model::ColorInfo;
5184 /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5185 /// ```
5186 pub fn set_color_families<T, V>(mut self, v: T) -> Self
5187 where
5188 T: std::iter::IntoIterator<Item = V>,
5189 V: std::convert::Into<std::string::String>,
5190 {
5191 use std::iter::Iterator;
5192 self.color_families = v.into_iter().map(|i| i.into()).collect();
5193 self
5194 }
5195
5196 /// Sets the value of [colors][crate::model::ColorInfo::colors].
5197 ///
5198 /// # Example
5199 /// ```ignore,no_run
5200 /// # use google_cloud_retail_v2::model::ColorInfo;
5201 /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5202 /// ```
5203 pub fn set_colors<T, V>(mut self, v: T) -> Self
5204 where
5205 T: std::iter::IntoIterator<Item = V>,
5206 V: std::convert::Into<std::string::String>,
5207 {
5208 use std::iter::Iterator;
5209 self.colors = v.into_iter().map(|i| i.into()).collect();
5210 self
5211 }
5212}
5213
5214impl wkt::message::Message for ColorInfo {
5215 fn typename() -> &'static str {
5216 "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5217 }
5218}
5219
5220/// A custom attribute that is not explicitly modeled in
5221/// [Product][google.cloud.retail.v2.Product].
5222///
5223/// [google.cloud.retail.v2.Product]: crate::model::Product
5224#[derive(Clone, Default, PartialEq)]
5225#[non_exhaustive]
5226pub struct CustomAttribute {
5227 /// The textual values of this custom attribute. For example, `["yellow",
5228 /// "green"]` when the key is "color".
5229 ///
5230 /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5231 /// returned.
5232 ///
5233 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5234 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5235 /// Otherwise, an INVALID_ARGUMENT error is returned.
5236 ///
5237 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5238 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5239 pub text: std::vec::Vec<std::string::String>,
5240
5241 /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5242 /// when the key is "lengths_cm".
5243 ///
5244 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5245 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5246 /// Otherwise, an INVALID_ARGUMENT error is returned.
5247 ///
5248 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5249 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5250 pub numbers: std::vec::Vec<f64>,
5251
5252 /// This field is normally ignored unless
5253 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5254 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5255 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5256 /// attribute configuration, see [Configuration
5257 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5258 /// If true, custom attribute values are searchable by text queries in
5259 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5260 ///
5261 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5262 ///
5263 /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5264 /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5265 ///
5266 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5267 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5268 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5269 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5270 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5271 #[deprecated]
5272 pub searchable: std::option::Option<bool>,
5273
5274 /// This field is normally ignored unless
5275 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5276 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5277 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5278 /// attribute configuration, see [Configuration
5279 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5280 /// If true, custom attribute values are indexed, so that they can be filtered,
5281 /// faceted or boosted in
5282 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5283 ///
5284 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5285 ///
5286 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5287 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5288 /// and
5289 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5290 /// for more details.
5291 ///
5292 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5293 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5294 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5295 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5296 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5297 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5298 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5299 #[deprecated]
5300 pub indexable: std::option::Option<bool>,
5301
5302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5303}
5304
5305impl CustomAttribute {
5306 pub fn new() -> Self {
5307 std::default::Default::default()
5308 }
5309
5310 /// Sets the value of [text][crate::model::CustomAttribute::text].
5311 ///
5312 /// # Example
5313 /// ```ignore,no_run
5314 /// # use google_cloud_retail_v2::model::CustomAttribute;
5315 /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5316 /// ```
5317 pub fn set_text<T, V>(mut self, v: T) -> Self
5318 where
5319 T: std::iter::IntoIterator<Item = V>,
5320 V: std::convert::Into<std::string::String>,
5321 {
5322 use std::iter::Iterator;
5323 self.text = v.into_iter().map(|i| i.into()).collect();
5324 self
5325 }
5326
5327 /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5328 ///
5329 /// # Example
5330 /// ```ignore,no_run
5331 /// # use google_cloud_retail_v2::model::CustomAttribute;
5332 /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5333 /// ```
5334 pub fn set_numbers<T, V>(mut self, v: T) -> Self
5335 where
5336 T: std::iter::IntoIterator<Item = V>,
5337 V: std::convert::Into<f64>,
5338 {
5339 use std::iter::Iterator;
5340 self.numbers = v.into_iter().map(|i| i.into()).collect();
5341 self
5342 }
5343
5344 /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5345 ///
5346 /// # Example
5347 /// ```ignore,no_run
5348 /// # use google_cloud_retail_v2::model::CustomAttribute;
5349 /// let x = CustomAttribute::new().set_searchable(true);
5350 /// ```
5351 #[deprecated]
5352 pub fn set_searchable<T>(mut self, v: T) -> Self
5353 where
5354 T: std::convert::Into<bool>,
5355 {
5356 self.searchable = std::option::Option::Some(v.into());
5357 self
5358 }
5359
5360 /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5361 ///
5362 /// # Example
5363 /// ```ignore,no_run
5364 /// # use google_cloud_retail_v2::model::CustomAttribute;
5365 /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5366 /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5367 /// ```
5368 #[deprecated]
5369 pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5370 where
5371 T: std::convert::Into<bool>,
5372 {
5373 self.searchable = v.map(|x| x.into());
5374 self
5375 }
5376
5377 /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5378 ///
5379 /// # Example
5380 /// ```ignore,no_run
5381 /// # use google_cloud_retail_v2::model::CustomAttribute;
5382 /// let x = CustomAttribute::new().set_indexable(true);
5383 /// ```
5384 #[deprecated]
5385 pub fn set_indexable<T>(mut self, v: T) -> Self
5386 where
5387 T: std::convert::Into<bool>,
5388 {
5389 self.indexable = std::option::Option::Some(v.into());
5390 self
5391 }
5392
5393 /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5394 ///
5395 /// # Example
5396 /// ```ignore,no_run
5397 /// # use google_cloud_retail_v2::model::CustomAttribute;
5398 /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5399 /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5400 /// ```
5401 #[deprecated]
5402 pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5403 where
5404 T: std::convert::Into<bool>,
5405 {
5406 self.indexable = v.map(|x| x.into());
5407 self
5408 }
5409}
5410
5411impl wkt::message::Message for CustomAttribute {
5412 fn typename() -> &'static str {
5413 "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5414 }
5415}
5416
5417/// Fulfillment information, such as the store IDs for in-store pickup or region
5418/// IDs for different shipping methods.
5419#[derive(Clone, Default, PartialEq)]
5420#[non_exhaustive]
5421pub struct FulfillmentInfo {
5422 /// The fulfillment type, including commonly used types (such as pickup in
5423 /// store and same day delivery), and custom types. Customers have to map
5424 /// custom types to their display names before rendering UI.
5425 ///
5426 /// Supported values:
5427 ///
5428 /// * "pickup-in-store"
5429 /// * "ship-to-store"
5430 /// * "same-day-delivery"
5431 /// * "next-day-delivery"
5432 /// * "custom-type-1"
5433 /// * "custom-type-2"
5434 /// * "custom-type-3"
5435 /// * "custom-type-4"
5436 /// * "custom-type-5"
5437 ///
5438 /// If this field is set to an invalid value other than these, an
5439 /// INVALID_ARGUMENT error is returned.
5440 pub r#type: std::string::String,
5441
5442 /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5443 /// as the store IDs for
5444 /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5445 /// or the region IDs for
5446 /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5447 ///
5448 /// A maximum of 3000 values are allowed. Each value must be a string with a
5449 /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5450 /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5451 /// returned.
5452 ///
5453 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5454 pub place_ids: std::vec::Vec<std::string::String>,
5455
5456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5457}
5458
5459impl FulfillmentInfo {
5460 pub fn new() -> Self {
5461 std::default::Default::default()
5462 }
5463
5464 /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5465 ///
5466 /// # Example
5467 /// ```ignore,no_run
5468 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5469 /// let x = FulfillmentInfo::new().set_type("example");
5470 /// ```
5471 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5472 self.r#type = v.into();
5473 self
5474 }
5475
5476 /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5477 ///
5478 /// # Example
5479 /// ```ignore,no_run
5480 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5481 /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5482 /// ```
5483 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5484 where
5485 T: std::iter::IntoIterator<Item = V>,
5486 V: std::convert::Into<std::string::String>,
5487 {
5488 use std::iter::Iterator;
5489 self.place_ids = v.into_iter().map(|i| i.into()).collect();
5490 self
5491 }
5492}
5493
5494impl wkt::message::Message for FulfillmentInfo {
5495 fn typename() -> &'static str {
5496 "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5497 }
5498}
5499
5500/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5501/// Retail Search use product images to improve prediction and search results.
5502/// Product images can be returned in results, and are shown in prediction or
5503/// search previews in the console. Please try to provide correct product images
5504/// and avoid using images with size too small.
5505///
5506/// [google.cloud.retail.v2.Product]: crate::model::Product
5507#[derive(Clone, Default, PartialEq)]
5508#[non_exhaustive]
5509pub struct Image {
5510 /// Required. URI of the image.
5511 ///
5512 /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5513 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5514 ///
5515 /// Google Merchant Center property
5516 /// [image_link](https://support.google.com/merchants/answer/6324350).
5517 /// Schema.org property [Product.image](https://schema.org/image).
5518 pub uri: std::string::String,
5519
5520 /// Height of the image in number of pixels.
5521 ///
5522 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5523 /// returned.
5524 pub height: i32,
5525
5526 /// Width of the image in number of pixels.
5527 ///
5528 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5529 /// returned.
5530 pub width: i32,
5531
5532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5533}
5534
5535impl Image {
5536 pub fn new() -> Self {
5537 std::default::Default::default()
5538 }
5539
5540 /// Sets the value of [uri][crate::model::Image::uri].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_retail_v2::model::Image;
5545 /// let x = Image::new().set_uri("example");
5546 /// ```
5547 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5548 self.uri = v.into();
5549 self
5550 }
5551
5552 /// Sets the value of [height][crate::model::Image::height].
5553 ///
5554 /// # Example
5555 /// ```ignore,no_run
5556 /// # use google_cloud_retail_v2::model::Image;
5557 /// let x = Image::new().set_height(42);
5558 /// ```
5559 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5560 self.height = v.into();
5561 self
5562 }
5563
5564 /// Sets the value of [width][crate::model::Image::width].
5565 ///
5566 /// # Example
5567 /// ```ignore,no_run
5568 /// # use google_cloud_retail_v2::model::Image;
5569 /// let x = Image::new().set_width(42);
5570 /// ```
5571 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5572 self.width = v.into();
5573 self
5574 }
5575}
5576
5577impl wkt::message::Message for Image {
5578 fn typename() -> &'static str {
5579 "type.googleapis.com/google.cloud.retail.v2.Image"
5580 }
5581}
5582
5583/// A floating point interval.
5584#[derive(Clone, Default, PartialEq)]
5585#[non_exhaustive]
5586pub struct Interval {
5587 /// The lower bound of the interval. If neither of the min fields are set, then
5588 /// the lower bound is negative infinity.
5589 ///
5590 /// This field must not be larger than max.
5591 /// Otherwise, an INVALID_ARGUMENT error is returned.
5592 pub min: std::option::Option<crate::model::interval::Min>,
5593
5594 /// The upper bound of the interval. If neither of the max fields are set, then
5595 /// the upper bound is positive infinity.
5596 ///
5597 /// This field must be not smaller than min.
5598 /// Otherwise, an INVALID_ARGUMENT error is returned.
5599 pub max: std::option::Option<crate::model::interval::Max>,
5600
5601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5602}
5603
5604impl Interval {
5605 pub fn new() -> Self {
5606 std::default::Default::default()
5607 }
5608
5609 /// Sets the value of [min][crate::model::Interval::min].
5610 ///
5611 /// Note that all the setters affecting `min` are mutually
5612 /// exclusive.
5613 ///
5614 /// # Example
5615 /// ```ignore,no_run
5616 /// # use google_cloud_retail_v2::model::Interval;
5617 /// use google_cloud_retail_v2::model::interval::Min;
5618 /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5619 /// ```
5620 pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5621 mut self,
5622 v: T,
5623 ) -> Self {
5624 self.min = v.into();
5625 self
5626 }
5627
5628 /// The value of [min][crate::model::Interval::min]
5629 /// if it holds a `Minimum`, `None` if the field is not set or
5630 /// holds a different branch.
5631 pub fn minimum(&self) -> std::option::Option<&f64> {
5632 #[allow(unreachable_patterns)]
5633 self.min.as_ref().and_then(|v| match v {
5634 crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5635 _ => std::option::Option::None,
5636 })
5637 }
5638
5639 /// Sets the value of [min][crate::model::Interval::min]
5640 /// to hold a `Minimum`.
5641 ///
5642 /// Note that all the setters affecting `min` are
5643 /// mutually exclusive.
5644 ///
5645 /// # Example
5646 /// ```ignore,no_run
5647 /// # use google_cloud_retail_v2::model::Interval;
5648 /// let x = Interval::new().set_minimum(42.0);
5649 /// assert!(x.minimum().is_some());
5650 /// assert!(x.exclusive_minimum().is_none());
5651 /// ```
5652 pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5653 self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5654 self
5655 }
5656
5657 /// The value of [min][crate::model::Interval::min]
5658 /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5659 /// holds a different branch.
5660 pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5661 #[allow(unreachable_patterns)]
5662 self.min.as_ref().and_then(|v| match v {
5663 crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5664 _ => std::option::Option::None,
5665 })
5666 }
5667
5668 /// Sets the value of [min][crate::model::Interval::min]
5669 /// to hold a `ExclusiveMinimum`.
5670 ///
5671 /// Note that all the setters affecting `min` are
5672 /// mutually exclusive.
5673 ///
5674 /// # Example
5675 /// ```ignore,no_run
5676 /// # use google_cloud_retail_v2::model::Interval;
5677 /// let x = Interval::new().set_exclusive_minimum(42.0);
5678 /// assert!(x.exclusive_minimum().is_some());
5679 /// assert!(x.minimum().is_none());
5680 /// ```
5681 pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5682 self.min =
5683 std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5684 self
5685 }
5686
5687 /// Sets the value of [max][crate::model::Interval::max].
5688 ///
5689 /// Note that all the setters affecting `max` are mutually
5690 /// exclusive.
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_retail_v2::model::Interval;
5695 /// use google_cloud_retail_v2::model::interval::Max;
5696 /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5697 /// ```
5698 pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5699 mut self,
5700 v: T,
5701 ) -> Self {
5702 self.max = v.into();
5703 self
5704 }
5705
5706 /// The value of [max][crate::model::Interval::max]
5707 /// if it holds a `Maximum`, `None` if the field is not set or
5708 /// holds a different branch.
5709 pub fn maximum(&self) -> std::option::Option<&f64> {
5710 #[allow(unreachable_patterns)]
5711 self.max.as_ref().and_then(|v| match v {
5712 crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5713 _ => std::option::Option::None,
5714 })
5715 }
5716
5717 /// Sets the value of [max][crate::model::Interval::max]
5718 /// to hold a `Maximum`.
5719 ///
5720 /// Note that all the setters affecting `max` are
5721 /// mutually exclusive.
5722 ///
5723 /// # Example
5724 /// ```ignore,no_run
5725 /// # use google_cloud_retail_v2::model::Interval;
5726 /// let x = Interval::new().set_maximum(42.0);
5727 /// assert!(x.maximum().is_some());
5728 /// assert!(x.exclusive_maximum().is_none());
5729 /// ```
5730 pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5731 self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5732 self
5733 }
5734
5735 /// The value of [max][crate::model::Interval::max]
5736 /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5737 /// holds a different branch.
5738 pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5739 #[allow(unreachable_patterns)]
5740 self.max.as_ref().and_then(|v| match v {
5741 crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5742 _ => std::option::Option::None,
5743 })
5744 }
5745
5746 /// Sets the value of [max][crate::model::Interval::max]
5747 /// to hold a `ExclusiveMaximum`.
5748 ///
5749 /// Note that all the setters affecting `max` are
5750 /// mutually exclusive.
5751 ///
5752 /// # Example
5753 /// ```ignore,no_run
5754 /// # use google_cloud_retail_v2::model::Interval;
5755 /// let x = Interval::new().set_exclusive_maximum(42.0);
5756 /// assert!(x.exclusive_maximum().is_some());
5757 /// assert!(x.maximum().is_none());
5758 /// ```
5759 pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5760 self.max =
5761 std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5762 self
5763 }
5764}
5765
5766impl wkt::message::Message for Interval {
5767 fn typename() -> &'static str {
5768 "type.googleapis.com/google.cloud.retail.v2.Interval"
5769 }
5770}
5771
5772/// Defines additional types related to [Interval].
5773pub mod interval {
5774 #[allow(unused_imports)]
5775 use super::*;
5776
5777 /// The lower bound of the interval. If neither of the min fields are set, then
5778 /// the lower bound is negative infinity.
5779 ///
5780 /// This field must not be larger than max.
5781 /// Otherwise, an INVALID_ARGUMENT error is returned.
5782 #[derive(Clone, Debug, PartialEq)]
5783 #[non_exhaustive]
5784 pub enum Min {
5785 /// Inclusive lower bound.
5786 Minimum(f64),
5787 /// Exclusive lower bound.
5788 ExclusiveMinimum(f64),
5789 }
5790
5791 /// The upper bound of the interval. If neither of the max fields are set, then
5792 /// the upper bound is positive infinity.
5793 ///
5794 /// This field must be not smaller than min.
5795 /// Otherwise, an INVALID_ARGUMENT error is returned.
5796 #[derive(Clone, Debug, PartialEq)]
5797 #[non_exhaustive]
5798 pub enum Max {
5799 /// Inclusive upper bound.
5800 Maximum(f64),
5801 /// Exclusive upper bound.
5802 ExclusiveMaximum(f64),
5803 }
5804}
5805
5806/// The price information of a [Product][google.cloud.retail.v2.Product].
5807///
5808/// [google.cloud.retail.v2.Product]: crate::model::Product
5809#[derive(Clone, Default, PartialEq)]
5810#[non_exhaustive]
5811pub struct PriceInfo {
5812 /// The 3-letter currency code defined in [ISO
5813 /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5814 ///
5815 /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5816 /// error is returned.
5817 ///
5818 /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5819 /// [Product][google.cloud.retail.v2.Product]s with the same
5820 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5821 /// must share the same
5822 /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5823 /// a FAILED_PRECONDITION error is returned.
5824 ///
5825 /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5826 /// [google.cloud.retail.v2.Product]: crate::model::Product
5827 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5828 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5829 pub currency_code: std::string::String,
5830
5831 /// Price of the product.
5832 ///
5833 /// Google Merchant Center property
5834 /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5835 /// property [Offer.price](https://schema.org/price).
5836 pub price: f32,
5837
5838 /// Price of the product without any discount. If zero, by default set to be
5839 /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5840 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5841 /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5842 /// otherwise an INVALID_ARGUMENT error is thrown.
5843 ///
5844 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5845 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5846 pub original_price: f32,
5847
5848 /// The costs associated with the sale of a particular product. Used for gross
5849 /// profit reporting.
5850 ///
5851 /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5852 /// [cost][google.cloud.retail.v2.PriceInfo.cost]
5853 ///
5854 /// Google Merchant Center property
5855 /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5856 ///
5857 /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5858 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5859 pub cost: f32,
5860
5861 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5862 /// starts to be effective. This can be set as a future timestamp, and the
5863 /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5864 /// after
5865 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5866 /// If so, the
5867 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5868 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5869 /// is used before
5870 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5871 ///
5872 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5873 /// effective because it will cause additional latency during search.
5874 ///
5875 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5876 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5877 /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5878 pub price_effective_time: std::option::Option<wkt::Timestamp>,
5879
5880 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5881 /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5882 /// is used for search before
5883 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5884 /// this field is set, the
5885 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5886 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5887 /// is used after
5888 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5889 ///
5890 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5891 /// effective because it will cause additional latency during search.
5892 ///
5893 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5894 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5895 /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5896 pub price_expire_time: std::option::Option<wkt::Timestamp>,
5897
5898 /// Output only. The price range of all the child
5899 /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5900 /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5901 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5902 /// [Product][google.cloud.retail.v2.Product]. Only populated for
5903 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5904 /// [Product][google.cloud.retail.v2.Product]s.
5905 ///
5906 /// Note: This field is OUTPUT_ONLY for
5907 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5908 /// Do not set this field in API requests.
5909 ///
5910 /// [google.cloud.retail.v2.Product]: crate::model::Product
5911 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5912 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5913 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5914 pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5915
5916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5917}
5918
5919impl PriceInfo {
5920 pub fn new() -> Self {
5921 std::default::Default::default()
5922 }
5923
5924 /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
5925 ///
5926 /// # Example
5927 /// ```ignore,no_run
5928 /// # use google_cloud_retail_v2::model::PriceInfo;
5929 /// let x = PriceInfo::new().set_currency_code("example");
5930 /// ```
5931 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5932 self.currency_code = v.into();
5933 self
5934 }
5935
5936 /// Sets the value of [price][crate::model::PriceInfo::price].
5937 ///
5938 /// # Example
5939 /// ```ignore,no_run
5940 /// # use google_cloud_retail_v2::model::PriceInfo;
5941 /// let x = PriceInfo::new().set_price(42.0);
5942 /// ```
5943 pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5944 self.price = v.into();
5945 self
5946 }
5947
5948 /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
5949 ///
5950 /// # Example
5951 /// ```ignore,no_run
5952 /// # use google_cloud_retail_v2::model::PriceInfo;
5953 /// let x = PriceInfo::new().set_original_price(42.0);
5954 /// ```
5955 pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5956 self.original_price = v.into();
5957 self
5958 }
5959
5960 /// Sets the value of [cost][crate::model::PriceInfo::cost].
5961 ///
5962 /// # Example
5963 /// ```ignore,no_run
5964 /// # use google_cloud_retail_v2::model::PriceInfo;
5965 /// let x = PriceInfo::new().set_cost(42.0);
5966 /// ```
5967 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5968 self.cost = v.into();
5969 self
5970 }
5971
5972 /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5973 ///
5974 /// # Example
5975 /// ```ignore,no_run
5976 /// # use google_cloud_retail_v2::model::PriceInfo;
5977 /// use wkt::Timestamp;
5978 /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
5979 /// ```
5980 pub fn set_price_effective_time<T>(mut self, v: T) -> Self
5981 where
5982 T: std::convert::Into<wkt::Timestamp>,
5983 {
5984 self.price_effective_time = std::option::Option::Some(v.into());
5985 self
5986 }
5987
5988 /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5989 ///
5990 /// # Example
5991 /// ```ignore,no_run
5992 /// # use google_cloud_retail_v2::model::PriceInfo;
5993 /// use wkt::Timestamp;
5994 /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
5995 /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
5996 /// ```
5997 pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
5998 where
5999 T: std::convert::Into<wkt::Timestamp>,
6000 {
6001 self.price_effective_time = v.map(|x| x.into());
6002 self
6003 }
6004
6005 /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6006 ///
6007 /// # Example
6008 /// ```ignore,no_run
6009 /// # use google_cloud_retail_v2::model::PriceInfo;
6010 /// use wkt::Timestamp;
6011 /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6012 /// ```
6013 pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6014 where
6015 T: std::convert::Into<wkt::Timestamp>,
6016 {
6017 self.price_expire_time = std::option::Option::Some(v.into());
6018 self
6019 }
6020
6021 /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6022 ///
6023 /// # Example
6024 /// ```ignore,no_run
6025 /// # use google_cloud_retail_v2::model::PriceInfo;
6026 /// use wkt::Timestamp;
6027 /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6028 /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6029 /// ```
6030 pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6031 where
6032 T: std::convert::Into<wkt::Timestamp>,
6033 {
6034 self.price_expire_time = v.map(|x| x.into());
6035 self
6036 }
6037
6038 /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6039 ///
6040 /// # Example
6041 /// ```ignore,no_run
6042 /// # use google_cloud_retail_v2::model::PriceInfo;
6043 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6044 /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6045 /// ```
6046 pub fn set_price_range<T>(mut self, v: T) -> Self
6047 where
6048 T: std::convert::Into<crate::model::price_info::PriceRange>,
6049 {
6050 self.price_range = std::option::Option::Some(v.into());
6051 self
6052 }
6053
6054 /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6055 ///
6056 /// # Example
6057 /// ```ignore,no_run
6058 /// # use google_cloud_retail_v2::model::PriceInfo;
6059 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6060 /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6061 /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6062 /// ```
6063 pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6064 where
6065 T: std::convert::Into<crate::model::price_info::PriceRange>,
6066 {
6067 self.price_range = v.map(|x| x.into());
6068 self
6069 }
6070}
6071
6072impl wkt::message::Message for PriceInfo {
6073 fn typename() -> &'static str {
6074 "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6075 }
6076}
6077
6078/// Defines additional types related to [PriceInfo].
6079pub mod price_info {
6080 #[allow(unused_imports)]
6081 use super::*;
6082
6083 /// The price range of all
6084 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6085 /// [Product][google.cloud.retail.v2.Product] having the same
6086 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6087 ///
6088 /// [google.cloud.retail.v2.Product]: crate::model::Product
6089 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6090 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6091 #[derive(Clone, Default, PartialEq)]
6092 #[non_exhaustive]
6093 pub struct PriceRange {
6094 /// The inclusive
6095 /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6096 /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6097 /// [Product][google.cloud.retail.v2.Product] having the same
6098 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6099 ///
6100 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6101 /// [google.cloud.retail.v2.Product]: crate::model::Product
6102 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6103 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6104 pub price: std::option::Option<crate::model::Interval>,
6105
6106 /// The inclusive
6107 /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6108 /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6109 /// [Product][google.cloud.retail.v2.Product] having the same
6110 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6111 ///
6112 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6113 /// [google.cloud.retail.v2.Product]: crate::model::Product
6114 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6115 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6116 pub original_price: std::option::Option<crate::model::Interval>,
6117
6118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6119 }
6120
6121 impl PriceRange {
6122 pub fn new() -> Self {
6123 std::default::Default::default()
6124 }
6125
6126 /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6127 ///
6128 /// # Example
6129 /// ```ignore,no_run
6130 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6131 /// use google_cloud_retail_v2::model::Interval;
6132 /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6133 /// ```
6134 pub fn set_price<T>(mut self, v: T) -> Self
6135 where
6136 T: std::convert::Into<crate::model::Interval>,
6137 {
6138 self.price = std::option::Option::Some(v.into());
6139 self
6140 }
6141
6142 /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6143 ///
6144 /// # Example
6145 /// ```ignore,no_run
6146 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6147 /// use google_cloud_retail_v2::model::Interval;
6148 /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6149 /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6150 /// ```
6151 pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6152 where
6153 T: std::convert::Into<crate::model::Interval>,
6154 {
6155 self.price = v.map(|x| x.into());
6156 self
6157 }
6158
6159 /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6160 ///
6161 /// # Example
6162 /// ```ignore,no_run
6163 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6164 /// use google_cloud_retail_v2::model::Interval;
6165 /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6166 /// ```
6167 pub fn set_original_price<T>(mut self, v: T) -> Self
6168 where
6169 T: std::convert::Into<crate::model::Interval>,
6170 {
6171 self.original_price = std::option::Option::Some(v.into());
6172 self
6173 }
6174
6175 /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6176 ///
6177 /// # Example
6178 /// ```ignore,no_run
6179 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6180 /// use google_cloud_retail_v2::model::Interval;
6181 /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6182 /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6183 /// ```
6184 pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6185 where
6186 T: std::convert::Into<crate::model::Interval>,
6187 {
6188 self.original_price = v.map(|x| x.into());
6189 self
6190 }
6191 }
6192
6193 impl wkt::message::Message for PriceRange {
6194 fn typename() -> &'static str {
6195 "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6196 }
6197 }
6198}
6199
6200/// The rating of a [Product][google.cloud.retail.v2.Product].
6201///
6202/// [google.cloud.retail.v2.Product]: crate::model::Product
6203#[derive(Clone, Default, PartialEq)]
6204#[non_exhaustive]
6205pub struct Rating {
6206 /// The total number of ratings. This value is independent of the value of
6207 /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6208 ///
6209 /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6210 /// returned.
6211 ///
6212 /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6213 pub rating_count: i32,
6214
6215 /// The average rating of the [Product][google.cloud.retail.v2.Product].
6216 ///
6217 /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6218 /// returned.
6219 ///
6220 /// [google.cloud.retail.v2.Product]: crate::model::Product
6221 pub average_rating: f32,
6222
6223 /// List of rating counts per rating value (index = rating - 1). The list is
6224 /// empty if there is no rating. If the list is non-empty, its size is
6225 /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6226 ///
6227 /// For example, [41, 14, 13, 47, 303]. It means that the
6228 /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6229 /// ratings with 2 star, and so on.
6230 ///
6231 /// [google.cloud.retail.v2.Product]: crate::model::Product
6232 pub rating_histogram: std::vec::Vec<i32>,
6233
6234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6235}
6236
6237impl Rating {
6238 pub fn new() -> Self {
6239 std::default::Default::default()
6240 }
6241
6242 /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6243 ///
6244 /// # Example
6245 /// ```ignore,no_run
6246 /// # use google_cloud_retail_v2::model::Rating;
6247 /// let x = Rating::new().set_rating_count(42);
6248 /// ```
6249 pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6250 self.rating_count = v.into();
6251 self
6252 }
6253
6254 /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6255 ///
6256 /// # Example
6257 /// ```ignore,no_run
6258 /// # use google_cloud_retail_v2::model::Rating;
6259 /// let x = Rating::new().set_average_rating(42.0);
6260 /// ```
6261 pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6262 self.average_rating = v.into();
6263 self
6264 }
6265
6266 /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6267 ///
6268 /// # Example
6269 /// ```ignore,no_run
6270 /// # use google_cloud_retail_v2::model::Rating;
6271 /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6272 /// ```
6273 pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6274 where
6275 T: std::iter::IntoIterator<Item = V>,
6276 V: std::convert::Into<i32>,
6277 {
6278 use std::iter::Iterator;
6279 self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6280 self
6281 }
6282}
6283
6284impl wkt::message::Message for Rating {
6285 fn typename() -> &'static str {
6286 "type.googleapis.com/google.cloud.retail.v2.Rating"
6287 }
6288}
6289
6290/// Information of an end user.
6291#[derive(Clone, Default, PartialEq)]
6292#[non_exhaustive]
6293pub struct UserInfo {
6294 /// Highly recommended for logged-in users. Unique identifier for logged-in
6295 /// user, such as a user name. Don't set for anonymous users.
6296 ///
6297 /// Always use a hashed value for this ID.
6298 ///
6299 /// Don't set the field to the same fixed ID for different users. This mixes
6300 /// the event history of those users together, which results in degraded
6301 /// model quality.
6302 ///
6303 /// The field must be a UTF-8 encoded string with a length limit of 128
6304 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6305 pub user_id: std::string::String,
6306
6307 /// The end user's IP address. This field is used to extract location
6308 /// information for personalization.
6309 ///
6310 /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6311 /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6312 /// INVALID_ARGUMENT error is returned.
6313 ///
6314 /// This should not be set when:
6315 ///
6316 /// * setting
6317 /// [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6318 /// * using the JavaScript tag in
6319 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6320 /// or if
6321 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6322 /// is set.
6323 ///
6324 /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6325 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6326 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6327 pub ip_address: std::string::String,
6328
6329 /// User agent as included in the HTTP header.
6330 /// The field must be a UTF-8 encoded string with a length limit of 1,000
6331 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6332 ///
6333 /// This should not be set when using the client side event reporting with
6334 /// GTM or JavaScript tag in
6335 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6336 /// or if
6337 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6338 /// is set.
6339 ///
6340 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6341 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6342 pub user_agent: std::string::String,
6343
6344 /// True if the request is made directly from the end user, in which case the
6345 /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6346 /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6347 /// from the HTTP request. This flag should be set only if the API request is
6348 /// made directly from the end user such as a mobile app (and not if a gateway
6349 /// or a server is processing and pushing the user events).
6350 ///
6351 /// This should not be set when using the JavaScript tag in
6352 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6353 ///
6354 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6355 /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6356 /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6357 pub direct_user_request: bool,
6358
6359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6360}
6361
6362impl UserInfo {
6363 pub fn new() -> Self {
6364 std::default::Default::default()
6365 }
6366
6367 /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6368 ///
6369 /// # Example
6370 /// ```ignore,no_run
6371 /// # use google_cloud_retail_v2::model::UserInfo;
6372 /// let x = UserInfo::new().set_user_id("example");
6373 /// ```
6374 pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6375 self.user_id = v.into();
6376 self
6377 }
6378
6379 /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6380 ///
6381 /// # Example
6382 /// ```ignore,no_run
6383 /// # use google_cloud_retail_v2::model::UserInfo;
6384 /// let x = UserInfo::new().set_ip_address("example");
6385 /// ```
6386 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6387 self.ip_address = v.into();
6388 self
6389 }
6390
6391 /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6392 ///
6393 /// # Example
6394 /// ```ignore,no_run
6395 /// # use google_cloud_retail_v2::model::UserInfo;
6396 /// let x = UserInfo::new().set_user_agent("example");
6397 /// ```
6398 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6399 self.user_agent = v.into();
6400 self
6401 }
6402
6403 /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6404 ///
6405 /// # Example
6406 /// ```ignore,no_run
6407 /// # use google_cloud_retail_v2::model::UserInfo;
6408 /// let x = UserInfo::new().set_direct_user_request(true);
6409 /// ```
6410 pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6411 self.direct_user_request = v.into();
6412 self
6413 }
6414}
6415
6416impl wkt::message::Message for UserInfo {
6417 fn typename() -> &'static str {
6418 "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6419 }
6420}
6421
6422/// The inventory information at a place (e.g. a store) identified
6423/// by a place ID.
6424#[derive(Clone, Default, PartialEq)]
6425#[non_exhaustive]
6426pub struct LocalInventory {
6427 /// Optional. The place ID for the current set of inventory information.
6428 pub place_id: std::string::String,
6429
6430 /// Optional. Product price and cost information.
6431 ///
6432 /// Google Merchant Center property
6433 /// [price](https://support.google.com/merchants/answer/6324371).
6434 pub price_info: std::option::Option<crate::model::PriceInfo>,
6435
6436 /// Optional. Additional local inventory attributes, for example, store name,
6437 /// promotion tags, etc.
6438 ///
6439 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6440 /// error is returned:
6441 ///
6442 /// * At most 30 attributes are allowed.
6443 /// * The key must be a UTF-8 encoded string with a length limit of 32
6444 /// characters.
6445 /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6446 /// key0LikeThis or KEY_1_LIKE_THIS.
6447 /// * The attribute values must be of the same type (text or number).
6448 /// * Only 1 value is allowed for each attribute.
6449 /// * For text values, the length limit is 256 UTF-8 characters.
6450 /// * The attribute does not support search. The `searchable` field should be
6451 /// unset or set to false.
6452 /// * The max summed total bytes of custom attribute keys and values per
6453 /// product is 5MiB.
6454 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6455
6456 /// Optional. Supported fulfillment types. Valid fulfillment type values
6457 /// include commonly used types (such as pickup in store and same day
6458 /// delivery), and custom types. Customers have to map custom types to their
6459 /// display names before rendering UI.
6460 ///
6461 /// Supported values:
6462 ///
6463 /// * "pickup-in-store"
6464 /// * "ship-to-store"
6465 /// * "same-day-delivery"
6466 /// * "next-day-delivery"
6467 /// * "custom-type-1"
6468 /// * "custom-type-2"
6469 /// * "custom-type-3"
6470 /// * "custom-type-4"
6471 /// * "custom-type-5"
6472 ///
6473 /// If this field is set to an invalid value other than these, an
6474 /// INVALID_ARGUMENT error is returned.
6475 ///
6476 /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6477 /// returned.
6478 pub fulfillment_types: std::vec::Vec<std::string::String>,
6479
6480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6481}
6482
6483impl LocalInventory {
6484 pub fn new() -> Self {
6485 std::default::Default::default()
6486 }
6487
6488 /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6489 ///
6490 /// # Example
6491 /// ```ignore,no_run
6492 /// # use google_cloud_retail_v2::model::LocalInventory;
6493 /// let x = LocalInventory::new().set_place_id("example");
6494 /// ```
6495 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6496 self.place_id = v.into();
6497 self
6498 }
6499
6500 /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6501 ///
6502 /// # Example
6503 /// ```ignore,no_run
6504 /// # use google_cloud_retail_v2::model::LocalInventory;
6505 /// use google_cloud_retail_v2::model::PriceInfo;
6506 /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6507 /// ```
6508 pub fn set_price_info<T>(mut self, v: T) -> Self
6509 where
6510 T: std::convert::Into<crate::model::PriceInfo>,
6511 {
6512 self.price_info = std::option::Option::Some(v.into());
6513 self
6514 }
6515
6516 /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6517 ///
6518 /// # Example
6519 /// ```ignore,no_run
6520 /// # use google_cloud_retail_v2::model::LocalInventory;
6521 /// use google_cloud_retail_v2::model::PriceInfo;
6522 /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6523 /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6524 /// ```
6525 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6526 where
6527 T: std::convert::Into<crate::model::PriceInfo>,
6528 {
6529 self.price_info = v.map(|x| x.into());
6530 self
6531 }
6532
6533 /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6534 ///
6535 /// # Example
6536 /// ```ignore,no_run
6537 /// # use google_cloud_retail_v2::model::LocalInventory;
6538 /// use google_cloud_retail_v2::model::CustomAttribute;
6539 /// let x = LocalInventory::new().set_attributes([
6540 /// ("key0", CustomAttribute::default()/* use setters */),
6541 /// ("key1", CustomAttribute::default()/* use (different) setters */),
6542 /// ]);
6543 /// ```
6544 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6545 where
6546 T: std::iter::IntoIterator<Item = (K, V)>,
6547 K: std::convert::Into<std::string::String>,
6548 V: std::convert::Into<crate::model::CustomAttribute>,
6549 {
6550 use std::iter::Iterator;
6551 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6552 self
6553 }
6554
6555 /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6556 ///
6557 /// # Example
6558 /// ```ignore,no_run
6559 /// # use google_cloud_retail_v2::model::LocalInventory;
6560 /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6561 /// ```
6562 pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6563 where
6564 T: std::iter::IntoIterator<Item = V>,
6565 V: std::convert::Into<std::string::String>,
6566 {
6567 use std::iter::Iterator;
6568 self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6569 self
6570 }
6571}
6572
6573impl wkt::message::Message for LocalInventory {
6574 fn typename() -> &'static str {
6575 "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6576 }
6577}
6578
6579/// Metadata for pinning to be returned in the response.
6580/// This is used for distinguishing between applied vs dropped pins.
6581#[derive(Clone, Default, PartialEq)]
6582#[non_exhaustive]
6583pub struct PinControlMetadata {
6584 /// Map of all matched pins, keyed by pin position.
6585 pub all_matched_pins:
6586 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6587
6588 /// Map of pins that were dropped due to overlap with other matching pins,
6589 /// keyed by pin position.
6590 pub dropped_pins:
6591 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6592
6593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6594}
6595
6596impl PinControlMetadata {
6597 pub fn new() -> Self {
6598 std::default::Default::default()
6599 }
6600
6601 /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6602 ///
6603 /// # Example
6604 /// ```ignore,no_run
6605 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6606 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6607 /// let x = PinControlMetadata::new().set_all_matched_pins([
6608 /// (0, ProductPins::default()/* use setters */),
6609 /// (1, ProductPins::default()/* use (different) setters */),
6610 /// ]);
6611 /// ```
6612 pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6613 where
6614 T: std::iter::IntoIterator<Item = (K, V)>,
6615 K: std::convert::Into<i64>,
6616 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6617 {
6618 use std::iter::Iterator;
6619 self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6620 self
6621 }
6622
6623 /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6624 ///
6625 /// # Example
6626 /// ```ignore,no_run
6627 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6628 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6629 /// let x = PinControlMetadata::new().set_dropped_pins([
6630 /// (0, ProductPins::default()/* use setters */),
6631 /// (1, ProductPins::default()/* use (different) setters */),
6632 /// ]);
6633 /// ```
6634 pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6635 where
6636 T: std::iter::IntoIterator<Item = (K, V)>,
6637 K: std::convert::Into<i64>,
6638 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6639 {
6640 use std::iter::Iterator;
6641 self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6642 self
6643 }
6644}
6645
6646impl wkt::message::Message for PinControlMetadata {
6647 fn typename() -> &'static str {
6648 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6649 }
6650}
6651
6652/// Defines additional types related to [PinControlMetadata].
6653pub mod pin_control_metadata {
6654 #[allow(unused_imports)]
6655 use super::*;
6656
6657 /// List of product ids which have associated pins.
6658 #[derive(Clone, Default, PartialEq)]
6659 #[non_exhaustive]
6660 pub struct ProductPins {
6661 /// List of product ids which have associated pins.
6662 pub product_id: std::vec::Vec<std::string::String>,
6663
6664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6665 }
6666
6667 impl ProductPins {
6668 pub fn new() -> Self {
6669 std::default::Default::default()
6670 }
6671
6672 /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6673 ///
6674 /// # Example
6675 /// ```ignore,no_run
6676 /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6677 /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6678 /// ```
6679 pub fn set_product_id<T, V>(mut self, v: T) -> Self
6680 where
6681 T: std::iter::IntoIterator<Item = V>,
6682 V: std::convert::Into<std::string::String>,
6683 {
6684 use std::iter::Iterator;
6685 self.product_id = v.into_iter().map(|i| i.into()).collect();
6686 self
6687 }
6688 }
6689
6690 impl wkt::message::Message for ProductPins {
6691 fn typename() -> &'static str {
6692 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6693 }
6694 }
6695}
6696
6697/// A list of string values.
6698#[derive(Clone, Default, PartialEq)]
6699#[non_exhaustive]
6700pub struct StringList {
6701 /// String values.
6702 pub values: std::vec::Vec<std::string::String>,
6703
6704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6705}
6706
6707impl StringList {
6708 pub fn new() -> Self {
6709 std::default::Default::default()
6710 }
6711
6712 /// Sets the value of [values][crate::model::StringList::values].
6713 ///
6714 /// # Example
6715 /// ```ignore,no_run
6716 /// # use google_cloud_retail_v2::model::StringList;
6717 /// let x = StringList::new().set_values(["a", "b", "c"]);
6718 /// ```
6719 pub fn set_values<T, V>(mut self, v: T) -> Self
6720 where
6721 T: std::iter::IntoIterator<Item = V>,
6722 V: std::convert::Into<std::string::String>,
6723 {
6724 use std::iter::Iterator;
6725 self.values = v.into_iter().map(|i| i.into()).collect();
6726 self
6727 }
6728}
6729
6730impl wkt::message::Message for StringList {
6731 fn typename() -> &'static str {
6732 "type.googleapis.com/google.cloud.retail.v2.StringList"
6733 }
6734}
6735
6736/// A message with a list of double values.
6737#[derive(Clone, Default, PartialEq)]
6738#[non_exhaustive]
6739pub struct DoubleList {
6740 /// The list of double values.
6741 pub values: std::vec::Vec<f64>,
6742
6743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6744}
6745
6746impl DoubleList {
6747 pub fn new() -> Self {
6748 std::default::Default::default()
6749 }
6750
6751 /// Sets the value of [values][crate::model::DoubleList::values].
6752 ///
6753 /// # Example
6754 /// ```ignore,no_run
6755 /// # use google_cloud_retail_v2::model::DoubleList;
6756 /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6757 /// ```
6758 pub fn set_values<T, V>(mut self, v: T) -> Self
6759 where
6760 T: std::iter::IntoIterator<Item = V>,
6761 V: std::convert::Into<f64>,
6762 {
6763 use std::iter::Iterator;
6764 self.values = v.into_iter().map(|i| i.into()).collect();
6765 self
6766 }
6767}
6768
6769impl wkt::message::Message for DoubleList {
6770 fn typename() -> &'static str {
6771 "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6772 }
6773}
6774
6775/// Autocomplete parameters.
6776#[derive(Clone, Default, PartialEq)]
6777#[non_exhaustive]
6778pub struct CompleteQueryRequest {
6779 /// Required. Catalog for which the completion is performed.
6780 ///
6781 /// Full resource name of catalog, such as
6782 /// `projects/*/locations/global/catalogs/default_catalog`.
6783 pub catalog: std::string::String,
6784
6785 /// Required. The query used to generate suggestions.
6786 ///
6787 /// The maximum number of allowed characters is 255.
6788 pub query: std::string::String,
6789
6790 /// Recommended field. A unique identifier for tracking visitors. For example,
6791 /// this could be implemented with an HTTP cookie, which should be able to
6792 /// uniquely identify a visitor on a single device. This unique identifier
6793 /// should not change if the visitor logs in or out of the website.
6794 ///
6795 /// The field must be a UTF-8 encoded string with a length limit of 128
6796 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6797 pub visitor_id: std::string::String,
6798
6799 /// Note that this field applies for `user-data` dataset only. For requests
6800 /// with `cloud-retail` dataset, setting this field has no effect.
6801 ///
6802 /// The language filters applied to the output suggestions. If set, it should
6803 /// contain the language of the query. If not set, suggestions are returned
6804 /// without considering language restrictions. This is the BCP-47 language
6805 /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6806 /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6807 /// number of language codes is 3.
6808 pub language_codes: std::vec::Vec<std::string::String>,
6809
6810 /// The device type context for completion suggestions. We recommend that you
6811 /// leave this field empty.
6812 ///
6813 /// It can apply different suggestions on different device types, e.g.
6814 /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6815 /// types.
6816 ///
6817 /// Supported formats:
6818 ///
6819 /// * `UNKNOWN_DEVICE_TYPE`
6820 ///
6821 /// * `DESKTOP`
6822 ///
6823 /// * `MOBILE`
6824 ///
6825 /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6826 ///
6827 pub device_type: std::string::String,
6828
6829 /// Determines which dataset to use for fetching completion. "user-data" will
6830 /// use the dataset imported through
6831 /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6832 /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6833 /// events. If left empty, completions will be fetched from the `user-data`
6834 /// dataset.
6835 ///
6836 /// Current supported values:
6837 ///
6838 /// * user-data
6839 ///
6840 /// * cloud-retail:
6841 /// This option requires enabling auto-learning function first. See
6842 /// [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6843 ///
6844 ///
6845 /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6846 pub dataset: std::string::String,
6847
6848 /// Completion max suggestions. If left unset or set to 0, then will fallback
6849 /// to the configured value
6850 /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6851 ///
6852 /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6853 /// capped by 20.
6854 ///
6855 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6856 pub max_suggestions: i32,
6857
6858 /// If true, attribute suggestions are enabled and provided in the response.
6859 ///
6860 /// This field is only available for the `cloud-retail` dataset.
6861 pub enable_attribute_suggestions: bool,
6862
6863 /// The entity for customers who run multiple entities, domains, sites, or
6864 /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6865 /// `google.com`, `youtube.com`, etc.
6866 /// If this is set, it must be an exact match with
6867 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6868 /// per-entity autocomplete results. This field will be applied to
6869 /// `completion_results` only. It has no effect on the `attribute_results`.
6870 /// Also, this entity should be limited to 256 characters, if too long, it will
6871 /// be truncated to 256 characters in both generation and serving time, and may
6872 /// lead to mis-match. To ensure it works, please set the entity with string
6873 /// within 256 characters.
6874 ///
6875 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6876 pub entity: std::string::String,
6877
6878 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6879}
6880
6881impl CompleteQueryRequest {
6882 pub fn new() -> Self {
6883 std::default::Default::default()
6884 }
6885
6886 /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6887 ///
6888 /// # Example
6889 /// ```ignore,no_run
6890 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6891 /// let x = CompleteQueryRequest::new().set_catalog("example");
6892 /// ```
6893 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6894 self.catalog = v.into();
6895 self
6896 }
6897
6898 /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6899 ///
6900 /// # Example
6901 /// ```ignore,no_run
6902 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6903 /// let x = CompleteQueryRequest::new().set_query("example");
6904 /// ```
6905 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6906 self.query = v.into();
6907 self
6908 }
6909
6910 /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
6911 ///
6912 /// # Example
6913 /// ```ignore,no_run
6914 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6915 /// let x = CompleteQueryRequest::new().set_visitor_id("example");
6916 /// ```
6917 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6918 self.visitor_id = v.into();
6919 self
6920 }
6921
6922 /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
6923 ///
6924 /// # Example
6925 /// ```ignore,no_run
6926 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6927 /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
6928 /// ```
6929 pub fn set_language_codes<T, V>(mut self, v: T) -> Self
6930 where
6931 T: std::iter::IntoIterator<Item = V>,
6932 V: std::convert::Into<std::string::String>,
6933 {
6934 use std::iter::Iterator;
6935 self.language_codes = v.into_iter().map(|i| i.into()).collect();
6936 self
6937 }
6938
6939 /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
6940 ///
6941 /// # Example
6942 /// ```ignore,no_run
6943 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6944 /// let x = CompleteQueryRequest::new().set_device_type("example");
6945 /// ```
6946 pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6947 self.device_type = v.into();
6948 self
6949 }
6950
6951 /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
6952 ///
6953 /// # Example
6954 /// ```ignore,no_run
6955 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6956 /// let x = CompleteQueryRequest::new().set_dataset("example");
6957 /// ```
6958 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6959 self.dataset = v.into();
6960 self
6961 }
6962
6963 /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
6964 ///
6965 /// # Example
6966 /// ```ignore,no_run
6967 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6968 /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
6969 /// ```
6970 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6971 self.max_suggestions = v.into();
6972 self
6973 }
6974
6975 /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
6976 ///
6977 /// # Example
6978 /// ```ignore,no_run
6979 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6980 /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
6981 /// ```
6982 pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6983 self.enable_attribute_suggestions = v.into();
6984 self
6985 }
6986
6987 /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
6988 ///
6989 /// # Example
6990 /// ```ignore,no_run
6991 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6992 /// let x = CompleteQueryRequest::new().set_entity("example");
6993 /// ```
6994 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6995 self.entity = v.into();
6996 self
6997 }
6998}
6999
7000impl wkt::message::Message for CompleteQueryRequest {
7001 fn typename() -> &'static str {
7002 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7003 }
7004}
7005
7006/// Response of the autocomplete query.
7007#[derive(Clone, Default, PartialEq)]
7008#[non_exhaustive]
7009pub struct CompleteQueryResponse {
7010 /// Results of the matching suggestions. The result list is ordered and the
7011 /// first result is top suggestion.
7012 pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7013
7014 /// A unique complete token. This should be included in the
7015 /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7016 /// for search events resulting from this completion, which enables accurate
7017 /// attribution of complete model performance.
7018 ///
7019 /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7020 pub attribution_token: std::string::String,
7021
7022 /// Deprecated. Matched recent searches of this user. The maximum number of
7023 /// recent searches is 10. This field is a restricted feature. If you want to
7024 /// enable it, contact Retail Search support.
7025 ///
7026 /// This feature is only available when
7027 /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7028 /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7029 /// The recent searches satisfy the follow rules:
7030 ///
7031 /// * They are ordered from latest to oldest.
7032 ///
7033 /// * They are matched with
7034 /// [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7035 /// case insensitively.
7036 ///
7037 /// * They are transformed to lower case.
7038 ///
7039 /// * They are UTF-8 safe.
7040 ///
7041 ///
7042 /// Recent searches are deduplicated. More recent searches will be reserved
7043 /// when duplication happens.
7044 ///
7045 /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7046 /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7047 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7048 #[deprecated]
7049 pub recent_search_results:
7050 std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7051
7052 /// A map of matched attribute suggestions. This field is only available for
7053 /// `cloud-retail` dataset.
7054 ///
7055 /// Current supported keys:
7056 ///
7057 /// * `brands`
7058 ///
7059 /// * `categories`
7060 ///
7061 pub attribute_results: std::collections::HashMap<
7062 std::string::String,
7063 crate::model::complete_query_response::AttributeResult,
7064 >,
7065
7066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7067}
7068
7069impl CompleteQueryResponse {
7070 pub fn new() -> Self {
7071 std::default::Default::default()
7072 }
7073
7074 /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7075 ///
7076 /// # Example
7077 /// ```ignore,no_run
7078 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7079 /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7080 /// let x = CompleteQueryResponse::new()
7081 /// .set_completion_results([
7082 /// CompletionResult::default()/* use setters */,
7083 /// CompletionResult::default()/* use (different) setters */,
7084 /// ]);
7085 /// ```
7086 pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7087 where
7088 T: std::iter::IntoIterator<Item = V>,
7089 V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7090 {
7091 use std::iter::Iterator;
7092 self.completion_results = v.into_iter().map(|i| i.into()).collect();
7093 self
7094 }
7095
7096 /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7097 ///
7098 /// # Example
7099 /// ```ignore,no_run
7100 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7101 /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7102 /// ```
7103 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7104 mut self,
7105 v: T,
7106 ) -> Self {
7107 self.attribution_token = v.into();
7108 self
7109 }
7110
7111 /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7112 ///
7113 /// # Example
7114 /// ```ignore,no_run
7115 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7116 /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7117 /// let x = CompleteQueryResponse::new()
7118 /// .set_recent_search_results([
7119 /// RecentSearchResult::default()/* use setters */,
7120 /// RecentSearchResult::default()/* use (different) setters */,
7121 /// ]);
7122 /// ```
7123 #[deprecated]
7124 pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7125 where
7126 T: std::iter::IntoIterator<Item = V>,
7127 V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7128 {
7129 use std::iter::Iterator;
7130 self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7131 self
7132 }
7133
7134 /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7135 ///
7136 /// # Example
7137 /// ```ignore,no_run
7138 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7139 /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7140 /// let x = CompleteQueryResponse::new().set_attribute_results([
7141 /// ("key0", AttributeResult::default()/* use setters */),
7142 /// ("key1", AttributeResult::default()/* use (different) setters */),
7143 /// ]);
7144 /// ```
7145 pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7146 where
7147 T: std::iter::IntoIterator<Item = (K, V)>,
7148 K: std::convert::Into<std::string::String>,
7149 V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7150 {
7151 use std::iter::Iterator;
7152 self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7153 self
7154 }
7155}
7156
7157impl wkt::message::Message for CompleteQueryResponse {
7158 fn typename() -> &'static str {
7159 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7160 }
7161}
7162
7163/// Defines additional types related to [CompleteQueryResponse].
7164pub mod complete_query_response {
7165 #[allow(unused_imports)]
7166 use super::*;
7167
7168 /// Resource that represents completion results.
7169 #[derive(Clone, Default, PartialEq)]
7170 #[non_exhaustive]
7171 pub struct CompletionResult {
7172 /// The suggestion for the query.
7173 pub suggestion: std::string::String,
7174
7175 /// Custom attributes for the suggestion term.
7176 ///
7177 /// * For `user-data`, the attributes are additional custom attributes
7178 /// ingested through BigQuery.
7179 ///
7180 /// * For `cloud-retail`, the attributes are product attributes generated
7181 /// by Cloud Retail. It requires
7182 /// [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7183 /// is imported properly.
7184 ///
7185 ///
7186 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7187 pub attributes:
7188 std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7189
7190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7191 }
7192
7193 impl CompletionResult {
7194 pub fn new() -> Self {
7195 std::default::Default::default()
7196 }
7197
7198 /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7199 ///
7200 /// # Example
7201 /// ```ignore,no_run
7202 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7203 /// let x = CompletionResult::new().set_suggestion("example");
7204 /// ```
7205 pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7206 self.suggestion = v.into();
7207 self
7208 }
7209
7210 /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7211 ///
7212 /// # Example
7213 /// ```ignore,no_run
7214 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7215 /// use google_cloud_retail_v2::model::CustomAttribute;
7216 /// let x = CompletionResult::new().set_attributes([
7217 /// ("key0", CustomAttribute::default()/* use setters */),
7218 /// ("key1", CustomAttribute::default()/* use (different) setters */),
7219 /// ]);
7220 /// ```
7221 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7222 where
7223 T: std::iter::IntoIterator<Item = (K, V)>,
7224 K: std::convert::Into<std::string::String>,
7225 V: std::convert::Into<crate::model::CustomAttribute>,
7226 {
7227 use std::iter::Iterator;
7228 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7229 self
7230 }
7231 }
7232
7233 impl wkt::message::Message for CompletionResult {
7234 fn typename() -> &'static str {
7235 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7236 }
7237 }
7238
7239 /// Deprecated: Recent search of this user.
7240 #[derive(Clone, Default, PartialEq)]
7241 #[non_exhaustive]
7242 #[deprecated]
7243 pub struct RecentSearchResult {
7244 /// The recent search query.
7245 pub recent_search: std::string::String,
7246
7247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7248 }
7249
7250 impl RecentSearchResult {
7251 pub fn new() -> Self {
7252 std::default::Default::default()
7253 }
7254
7255 /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7256 ///
7257 /// # Example
7258 /// ```ignore,no_run
7259 /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7260 /// let x = RecentSearchResult::new().set_recent_search("example");
7261 /// ```
7262 pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7263 mut self,
7264 v: T,
7265 ) -> Self {
7266 self.recent_search = v.into();
7267 self
7268 }
7269 }
7270
7271 impl wkt::message::Message for RecentSearchResult {
7272 fn typename() -> &'static str {
7273 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7274 }
7275 }
7276
7277 /// Resource that represents attribute results.
7278 #[derive(Clone, Default, PartialEq)]
7279 #[non_exhaustive]
7280 pub struct AttributeResult {
7281 /// The list of suggestions for the attribute.
7282 pub suggestions: std::vec::Vec<std::string::String>,
7283
7284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7285 }
7286
7287 impl AttributeResult {
7288 pub fn new() -> Self {
7289 std::default::Default::default()
7290 }
7291
7292 /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7293 ///
7294 /// # Example
7295 /// ```ignore,no_run
7296 /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7297 /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7298 /// ```
7299 pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7300 where
7301 T: std::iter::IntoIterator<Item = V>,
7302 V: std::convert::Into<std::string::String>,
7303 {
7304 use std::iter::Iterator;
7305 self.suggestions = v.into_iter().map(|i| i.into()).collect();
7306 self
7307 }
7308 }
7309
7310 impl wkt::message::Message for AttributeResult {
7311 fn typename() -> &'static str {
7312 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7313 }
7314 }
7315}
7316
7317/// Configures dynamic metadata that can be linked to a
7318/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7319/// recommendation results at serving time.
7320///
7321/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7322#[derive(Clone, Default, PartialEq)]
7323#[non_exhaustive]
7324pub struct Control {
7325 /// Immutable. Fully qualified name
7326 /// `projects/*/locations/global/catalogs/*/controls/*`
7327 pub name: std::string::String,
7328
7329 /// Required. The human readable control display name. Used in Retail UI.
7330 ///
7331 /// This field must be a UTF-8 encoded string with a length limit of 128
7332 /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7333 pub display_name: std::string::String,
7334
7335 /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7336 /// ids that are associated with this control in the same
7337 /// [Catalog][google.cloud.retail.v2.Catalog].
7338 ///
7339 /// Note the association is managed via the
7340 /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7341 /// only denormalized view.
7342 ///
7343 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7344 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7345 pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7346
7347 /// Required. Immutable. The solution types that the control is used for.
7348 /// Currently we support setting only one type of solution at creation time.
7349 ///
7350 /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7351 /// If no solution type is provided at creation time, will default to
7352 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7353 ///
7354 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7355 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7356
7357 /// Specifies the use case for the control.
7358 /// Affects what condition fields can be set.
7359 /// Only settable by search controls.
7360 /// Will default to
7361 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7362 /// if not specified. Currently only allow one search_solution_use_case per
7363 /// control.
7364 ///
7365 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7366 pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7367
7368 /// The behavior/type of the control
7369 ///
7370 /// A behavior/type must be specified on creation. Type cannot be changed once
7371 /// specified (e.g. A Rule control will always be a Rule control.). An
7372 /// INVALID_ARGUMENT will be returned if either condition is violated.
7373 pub control: std::option::Option<crate::model::control::Control>,
7374
7375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7376}
7377
7378impl Control {
7379 pub fn new() -> Self {
7380 std::default::Default::default()
7381 }
7382
7383 /// Sets the value of [name][crate::model::Control::name].
7384 ///
7385 /// # Example
7386 /// ```ignore,no_run
7387 /// # use google_cloud_retail_v2::model::Control;
7388 /// let x = Control::new().set_name("example");
7389 /// ```
7390 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7391 self.name = v.into();
7392 self
7393 }
7394
7395 /// Sets the value of [display_name][crate::model::Control::display_name].
7396 ///
7397 /// # Example
7398 /// ```ignore,no_run
7399 /// # use google_cloud_retail_v2::model::Control;
7400 /// let x = Control::new().set_display_name("example");
7401 /// ```
7402 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7403 self.display_name = v.into();
7404 self
7405 }
7406
7407 /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7408 ///
7409 /// # Example
7410 /// ```ignore,no_run
7411 /// # use google_cloud_retail_v2::model::Control;
7412 /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7413 /// ```
7414 pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7415 where
7416 T: std::iter::IntoIterator<Item = V>,
7417 V: std::convert::Into<std::string::String>,
7418 {
7419 use std::iter::Iterator;
7420 self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7421 self
7422 }
7423
7424 /// Sets the value of [solution_types][crate::model::Control::solution_types].
7425 ///
7426 /// # Example
7427 /// ```ignore,no_run
7428 /// # use google_cloud_retail_v2::model::Control;
7429 /// use google_cloud_retail_v2::model::SolutionType;
7430 /// let x = Control::new().set_solution_types([
7431 /// SolutionType::Recommendation,
7432 /// SolutionType::Search,
7433 /// ]);
7434 /// ```
7435 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7436 where
7437 T: std::iter::IntoIterator<Item = V>,
7438 V: std::convert::Into<crate::model::SolutionType>,
7439 {
7440 use std::iter::Iterator;
7441 self.solution_types = v.into_iter().map(|i| i.into()).collect();
7442 self
7443 }
7444
7445 /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7446 ///
7447 /// # Example
7448 /// ```ignore,no_run
7449 /// # use google_cloud_retail_v2::model::Control;
7450 /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7451 /// let x = Control::new().set_search_solution_use_case([
7452 /// SearchSolutionUseCase::Search,
7453 /// SearchSolutionUseCase::Browse,
7454 /// ]);
7455 /// ```
7456 pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7457 where
7458 T: std::iter::IntoIterator<Item = V>,
7459 V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7460 {
7461 use std::iter::Iterator;
7462 self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7463 self
7464 }
7465
7466 /// Sets the value of [control][crate::model::Control::control].
7467 ///
7468 /// Note that all the setters affecting `control` are mutually
7469 /// exclusive.
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_cloud_retail_v2::model::Control;
7474 /// use google_cloud_retail_v2::model::Rule;
7475 /// let x = Control::new().set_control(Some(
7476 /// google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7477 /// ```
7478 pub fn set_control<
7479 T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7480 >(
7481 mut self,
7482 v: T,
7483 ) -> Self {
7484 self.control = v.into();
7485 self
7486 }
7487
7488 /// The value of [control][crate::model::Control::control]
7489 /// if it holds a `Rule`, `None` if the field is not set or
7490 /// holds a different branch.
7491 pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7492 #[allow(unreachable_patterns)]
7493 self.control.as_ref().and_then(|v| match v {
7494 crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7495 _ => std::option::Option::None,
7496 })
7497 }
7498
7499 /// Sets the value of [control][crate::model::Control::control]
7500 /// to hold a `Rule`.
7501 ///
7502 /// Note that all the setters affecting `control` are
7503 /// mutually exclusive.
7504 ///
7505 /// # Example
7506 /// ```ignore,no_run
7507 /// # use google_cloud_retail_v2::model::Control;
7508 /// use google_cloud_retail_v2::model::Rule;
7509 /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7510 /// assert!(x.rule().is_some());
7511 /// ```
7512 pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7513 mut self,
7514 v: T,
7515 ) -> Self {
7516 self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7517 self
7518 }
7519}
7520
7521impl wkt::message::Message for Control {
7522 fn typename() -> &'static str {
7523 "type.googleapis.com/google.cloud.retail.v2.Control"
7524 }
7525}
7526
7527/// Defines additional types related to [Control].
7528pub mod control {
7529 #[allow(unused_imports)]
7530 use super::*;
7531
7532 /// The behavior/type of the control
7533 ///
7534 /// A behavior/type must be specified on creation. Type cannot be changed once
7535 /// specified (e.g. A Rule control will always be a Rule control.). An
7536 /// INVALID_ARGUMENT will be returned if either condition is violated.
7537 #[derive(Clone, Debug, PartialEq)]
7538 #[non_exhaustive]
7539 pub enum Control {
7540 /// A rule control - a condition-action pair.
7541 /// Enacts a set action when the condition is triggered.
7542 /// For example: Boost "gShoe" when query full matches "Running Shoes".
7543 Rule(std::boxed::Box<crate::model::Rule>),
7544 }
7545}
7546
7547/// Request for CreateControl method.
7548#[derive(Clone, Default, PartialEq)]
7549#[non_exhaustive]
7550pub struct CreateControlRequest {
7551 /// Required. Full resource name of parent catalog. Format:
7552 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7553 pub parent: std::string::String,
7554
7555 /// Required. The Control to create.
7556 pub control: std::option::Option<crate::model::Control>,
7557
7558 /// Required. The ID to use for the Control, which will become the final
7559 /// component of the Control's resource name.
7560 ///
7561 /// This value should be 4-63 characters, and valid characters
7562 /// are /[a-z][0-9]-_/.
7563 pub control_id: std::string::String,
7564
7565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7566}
7567
7568impl CreateControlRequest {
7569 pub fn new() -> Self {
7570 std::default::Default::default()
7571 }
7572
7573 /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7574 ///
7575 /// # Example
7576 /// ```ignore,no_run
7577 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7578 /// let x = CreateControlRequest::new().set_parent("example");
7579 /// ```
7580 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7581 self.parent = v.into();
7582 self
7583 }
7584
7585 /// Sets the value of [control][crate::model::CreateControlRequest::control].
7586 ///
7587 /// # Example
7588 /// ```ignore,no_run
7589 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7590 /// use google_cloud_retail_v2::model::Control;
7591 /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7592 /// ```
7593 pub fn set_control<T>(mut self, v: T) -> Self
7594 where
7595 T: std::convert::Into<crate::model::Control>,
7596 {
7597 self.control = std::option::Option::Some(v.into());
7598 self
7599 }
7600
7601 /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7602 ///
7603 /// # Example
7604 /// ```ignore,no_run
7605 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7606 /// use google_cloud_retail_v2::model::Control;
7607 /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7608 /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7609 /// ```
7610 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7611 where
7612 T: std::convert::Into<crate::model::Control>,
7613 {
7614 self.control = v.map(|x| x.into());
7615 self
7616 }
7617
7618 /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7619 ///
7620 /// # Example
7621 /// ```ignore,no_run
7622 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7623 /// let x = CreateControlRequest::new().set_control_id("example");
7624 /// ```
7625 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7626 self.control_id = v.into();
7627 self
7628 }
7629}
7630
7631impl wkt::message::Message for CreateControlRequest {
7632 fn typename() -> &'static str {
7633 "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7634 }
7635}
7636
7637/// Request for UpdateControl method.
7638#[derive(Clone, Default, PartialEq)]
7639#[non_exhaustive]
7640pub struct UpdateControlRequest {
7641 /// Required. The Control to update.
7642 pub control: std::option::Option<crate::model::Control>,
7643
7644 /// Indicates which fields in the provided
7645 /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7646 /// supported:
7647 ///
7648 /// * [Control.name][google.cloud.retail.v2.Control.name]
7649 ///
7650 /// If not set or empty, all supported fields are updated.
7651 ///
7652 /// [google.cloud.retail.v2.Control]: crate::model::Control
7653 /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7654 pub update_mask: std::option::Option<wkt::FieldMask>,
7655
7656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7657}
7658
7659impl UpdateControlRequest {
7660 pub fn new() -> Self {
7661 std::default::Default::default()
7662 }
7663
7664 /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7665 ///
7666 /// # Example
7667 /// ```ignore,no_run
7668 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7669 /// use google_cloud_retail_v2::model::Control;
7670 /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7671 /// ```
7672 pub fn set_control<T>(mut self, v: T) -> Self
7673 where
7674 T: std::convert::Into<crate::model::Control>,
7675 {
7676 self.control = std::option::Option::Some(v.into());
7677 self
7678 }
7679
7680 /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7681 ///
7682 /// # Example
7683 /// ```ignore,no_run
7684 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7685 /// use google_cloud_retail_v2::model::Control;
7686 /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7687 /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7688 /// ```
7689 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7690 where
7691 T: std::convert::Into<crate::model::Control>,
7692 {
7693 self.control = v.map(|x| x.into());
7694 self
7695 }
7696
7697 /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7698 ///
7699 /// # Example
7700 /// ```ignore,no_run
7701 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7702 /// use wkt::FieldMask;
7703 /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7704 /// ```
7705 pub fn set_update_mask<T>(mut self, v: T) -> Self
7706 where
7707 T: std::convert::Into<wkt::FieldMask>,
7708 {
7709 self.update_mask = std::option::Option::Some(v.into());
7710 self
7711 }
7712
7713 /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7714 ///
7715 /// # Example
7716 /// ```ignore,no_run
7717 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7718 /// use wkt::FieldMask;
7719 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7720 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7721 /// ```
7722 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7723 where
7724 T: std::convert::Into<wkt::FieldMask>,
7725 {
7726 self.update_mask = v.map(|x| x.into());
7727 self
7728 }
7729}
7730
7731impl wkt::message::Message for UpdateControlRequest {
7732 fn typename() -> &'static str {
7733 "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7734 }
7735}
7736
7737/// Request for DeleteControl method.
7738#[derive(Clone, Default, PartialEq)]
7739#[non_exhaustive]
7740pub struct DeleteControlRequest {
7741 /// Required. The resource name of the Control to delete. Format:
7742 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7743 pub name: std::string::String,
7744
7745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7746}
7747
7748impl DeleteControlRequest {
7749 pub fn new() -> Self {
7750 std::default::Default::default()
7751 }
7752
7753 /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7754 ///
7755 /// # Example
7756 /// ```ignore,no_run
7757 /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7758 /// let x = DeleteControlRequest::new().set_name("example");
7759 /// ```
7760 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7761 self.name = v.into();
7762 self
7763 }
7764}
7765
7766impl wkt::message::Message for DeleteControlRequest {
7767 fn typename() -> &'static str {
7768 "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7769 }
7770}
7771
7772/// Request for GetControl method.
7773#[derive(Clone, Default, PartialEq)]
7774#[non_exhaustive]
7775pub struct GetControlRequest {
7776 /// Required. The resource name of the Control to get. Format:
7777 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7778 pub name: std::string::String,
7779
7780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7781}
7782
7783impl GetControlRequest {
7784 pub fn new() -> Self {
7785 std::default::Default::default()
7786 }
7787
7788 /// Sets the value of [name][crate::model::GetControlRequest::name].
7789 ///
7790 /// # Example
7791 /// ```ignore,no_run
7792 /// # use google_cloud_retail_v2::model::GetControlRequest;
7793 /// let x = GetControlRequest::new().set_name("example");
7794 /// ```
7795 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7796 self.name = v.into();
7797 self
7798 }
7799}
7800
7801impl wkt::message::Message for GetControlRequest {
7802 fn typename() -> &'static str {
7803 "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7804 }
7805}
7806
7807/// Request for ListControls method.
7808#[derive(Clone, Default, PartialEq)]
7809#[non_exhaustive]
7810pub struct ListControlsRequest {
7811 /// Required. The catalog resource name. Format:
7812 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7813 pub parent: std::string::String,
7814
7815 /// Optional. Maximum number of results to return. If unspecified, defaults
7816 /// to 50. Max allowed value is 1000.
7817 pub page_size: i32,
7818
7819 /// Optional. A page token, received from a previous `ListControls` call.
7820 /// Provide this to retrieve the subsequent page.
7821 pub page_token: std::string::String,
7822
7823 /// Optional. A filter to apply on the list results. Supported features:
7824 ///
7825 /// * List all the products under the parent branch if
7826 /// [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7827 /// * List controls that are used in a single ServingConfig:
7828 /// 'serving_config = "boosted_home_page_cvr"'
7829 ///
7830 /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7831 pub filter: std::string::String,
7832
7833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7834}
7835
7836impl ListControlsRequest {
7837 pub fn new() -> Self {
7838 std::default::Default::default()
7839 }
7840
7841 /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7842 ///
7843 /// # Example
7844 /// ```ignore,no_run
7845 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7846 /// let x = ListControlsRequest::new().set_parent("example");
7847 /// ```
7848 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7849 self.parent = v.into();
7850 self
7851 }
7852
7853 /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7854 ///
7855 /// # Example
7856 /// ```ignore,no_run
7857 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7858 /// let x = ListControlsRequest::new().set_page_size(42);
7859 /// ```
7860 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7861 self.page_size = v.into();
7862 self
7863 }
7864
7865 /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7866 ///
7867 /// # Example
7868 /// ```ignore,no_run
7869 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7870 /// let x = ListControlsRequest::new().set_page_token("example");
7871 /// ```
7872 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7873 self.page_token = v.into();
7874 self
7875 }
7876
7877 /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7878 ///
7879 /// # Example
7880 /// ```ignore,no_run
7881 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7882 /// let x = ListControlsRequest::new().set_filter("example");
7883 /// ```
7884 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7885 self.filter = v.into();
7886 self
7887 }
7888}
7889
7890impl wkt::message::Message for ListControlsRequest {
7891 fn typename() -> &'static str {
7892 "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
7893 }
7894}
7895
7896/// Response for ListControls method.
7897#[derive(Clone, Default, PartialEq)]
7898#[non_exhaustive]
7899pub struct ListControlsResponse {
7900 /// All the Controls for a given catalog.
7901 pub controls: std::vec::Vec<crate::model::Control>,
7902
7903 /// Pagination token, if not returned indicates the last page.
7904 pub next_page_token: std::string::String,
7905
7906 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7907}
7908
7909impl ListControlsResponse {
7910 pub fn new() -> Self {
7911 std::default::Default::default()
7912 }
7913
7914 /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
7915 ///
7916 /// # Example
7917 /// ```ignore,no_run
7918 /// # use google_cloud_retail_v2::model::ListControlsResponse;
7919 /// use google_cloud_retail_v2::model::Control;
7920 /// let x = ListControlsResponse::new()
7921 /// .set_controls([
7922 /// Control::default()/* use setters */,
7923 /// Control::default()/* use (different) setters */,
7924 /// ]);
7925 /// ```
7926 pub fn set_controls<T, V>(mut self, v: T) -> Self
7927 where
7928 T: std::iter::IntoIterator<Item = V>,
7929 V: std::convert::Into<crate::model::Control>,
7930 {
7931 use std::iter::Iterator;
7932 self.controls = v.into_iter().map(|i| i.into()).collect();
7933 self
7934 }
7935
7936 /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
7937 ///
7938 /// # Example
7939 /// ```ignore,no_run
7940 /// # use google_cloud_retail_v2::model::ListControlsResponse;
7941 /// let x = ListControlsResponse::new().set_next_page_token("example");
7942 /// ```
7943 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7944 self.next_page_token = v.into();
7945 self
7946 }
7947}
7948
7949impl wkt::message::Message for ListControlsResponse {
7950 fn typename() -> &'static str {
7951 "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
7952 }
7953}
7954
7955#[doc(hidden)]
7956impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
7957 type PageItem = crate::model::Control;
7958
7959 fn items(self) -> std::vec::Vec<Self::PageItem> {
7960 self.controls
7961 }
7962
7963 fn next_page_token(&self) -> std::string::String {
7964 use std::clone::Clone;
7965 self.next_page_token.clone()
7966 }
7967}
7968
7969/// Request message for
7970/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
7971/// method.
7972#[derive(Clone, Default, PartialEq)]
7973#[non_exhaustive]
7974pub struct ConversationalSearchRequest {
7975 /// Required. The resource name of the search engine placement, such as
7976 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
7977 /// or
7978 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
7979 /// This field is used to identify the serving config name and the set
7980 /// of models that will be used to make the search.
7981 pub placement: std::string::String,
7982
7983 /// Required. The branch resource name, such as
7984 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
7985 ///
7986 /// Use "default_branch" as the branch ID or leave this field empty, to search
7987 /// products under the default branch.
7988 pub branch: std::string::String,
7989
7990 /// Optional. Raw search query to be searched for.
7991 ///
7992 /// If this field is empty, the request is considered a category browsing
7993 /// request.
7994 pub query: std::string::String,
7995
7996 /// Optional. The categories associated with a category page. Must be set for
7997 /// category navigation queries to achieve good search quality. The format
7998 /// should be the same as
7999 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8000 ///
8001 /// To represent full path of category, use '>' sign to separate different
8002 /// hierarchies. If '>' is part of the category name, replace it with
8003 /// other character(s).
8004 ///
8005 /// Category pages include special pages such as sales or promotions. For
8006 /// instance, a special sale page may have the category hierarchy:
8007 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8008 ///
8009 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8010 pub page_categories: std::vec::Vec<std::string::String>,
8011
8012 /// Optional. This field specifies the conversation id, which maintains the
8013 /// state of the conversation between client side and server side. Use the
8014 /// value from the previous
8015 /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8016 /// For the initial request, this should be empty.
8017 ///
8018 /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8019 pub conversation_id: std::string::String,
8020
8021 /// Optional. Search parameters.
8022 pub search_params:
8023 std::option::Option<crate::model::conversational_search_request::SearchParams>,
8024
8025 /// Required. A unique identifier for tracking visitors. For example, this
8026 /// could be implemented with an HTTP cookie, which should be able to uniquely
8027 /// identify a visitor on a single device. This unique identifier should not
8028 /// change if the visitor logs in or out of the website.
8029 ///
8030 /// This should be the same identifier as
8031 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8032 ///
8033 /// The field must be a UTF-8 encoded string with a length limit of 128
8034 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8035 ///
8036 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8037 pub visitor_id: std::string::String,
8038
8039 /// Optional. User information.
8040 pub user_info: std::option::Option<crate::model::UserInfo>,
8041
8042 /// Optional. This field specifies all conversational filtering related
8043 /// parameters.
8044 pub conversational_filtering_spec: std::option::Option<
8045 crate::model::conversational_search_request::ConversationalFilteringSpec,
8046 >,
8047
8048 /// Optional. The user labels applied to a resource must meet the following
8049 /// requirements:
8050 ///
8051 /// * Each resource can have multiple labels, up to a maximum of 64.
8052 /// * Each label must be a key-value pair.
8053 /// * Keys have a minimum length of 1 character and a maximum length of 63
8054 /// characters and cannot be empty. Values can be empty and have a maximum
8055 /// length of 63 characters.
8056 /// * Keys and values can contain only lowercase letters, numeric characters,
8057 /// underscores, and dashes. All characters must use UTF-8 encoding, and
8058 /// international characters are allowed.
8059 /// * The key portion of a label must be unique. However, you can use the same
8060 /// key with multiple resources.
8061 /// * Keys must start with a lowercase letter or international character.
8062 ///
8063 /// See [Google Cloud
8064 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8065 /// for more details.
8066 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8067
8068 /// Optional. The safety settings to be applied to the generated content.
8069 pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8070
8071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8072}
8073
8074impl ConversationalSearchRequest {
8075 pub fn new() -> Self {
8076 std::default::Default::default()
8077 }
8078
8079 /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8080 ///
8081 /// # Example
8082 /// ```ignore,no_run
8083 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8084 /// let x = ConversationalSearchRequest::new().set_placement("example");
8085 /// ```
8086 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8087 self.placement = v.into();
8088 self
8089 }
8090
8091 /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8092 ///
8093 /// # Example
8094 /// ```ignore,no_run
8095 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8096 /// let x = ConversationalSearchRequest::new().set_branch("example");
8097 /// ```
8098 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8099 self.branch = v.into();
8100 self
8101 }
8102
8103 /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8104 ///
8105 /// # Example
8106 /// ```ignore,no_run
8107 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8108 /// let x = ConversationalSearchRequest::new().set_query("example");
8109 /// ```
8110 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8111 self.query = v.into();
8112 self
8113 }
8114
8115 /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8116 ///
8117 /// # Example
8118 /// ```ignore,no_run
8119 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8120 /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8121 /// ```
8122 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8123 where
8124 T: std::iter::IntoIterator<Item = V>,
8125 V: std::convert::Into<std::string::String>,
8126 {
8127 use std::iter::Iterator;
8128 self.page_categories = v.into_iter().map(|i| i.into()).collect();
8129 self
8130 }
8131
8132 /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8133 ///
8134 /// # Example
8135 /// ```ignore,no_run
8136 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8137 /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8138 /// ```
8139 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8140 self.conversation_id = v.into();
8141 self
8142 }
8143
8144 /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8145 ///
8146 /// # Example
8147 /// ```ignore,no_run
8148 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8149 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8150 /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8151 /// ```
8152 pub fn set_search_params<T>(mut self, v: T) -> Self
8153 where
8154 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8155 {
8156 self.search_params = std::option::Option::Some(v.into());
8157 self
8158 }
8159
8160 /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8161 ///
8162 /// # Example
8163 /// ```ignore,no_run
8164 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8165 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8166 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8167 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8168 /// ```
8169 pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8170 where
8171 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8172 {
8173 self.search_params = v.map(|x| x.into());
8174 self
8175 }
8176
8177 /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8178 ///
8179 /// # Example
8180 /// ```ignore,no_run
8181 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8182 /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8183 /// ```
8184 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8185 self.visitor_id = v.into();
8186 self
8187 }
8188
8189 /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8190 ///
8191 /// # Example
8192 /// ```ignore,no_run
8193 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8194 /// use google_cloud_retail_v2::model::UserInfo;
8195 /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8196 /// ```
8197 pub fn set_user_info<T>(mut self, v: T) -> Self
8198 where
8199 T: std::convert::Into<crate::model::UserInfo>,
8200 {
8201 self.user_info = std::option::Option::Some(v.into());
8202 self
8203 }
8204
8205 /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8206 ///
8207 /// # Example
8208 /// ```ignore,no_run
8209 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8210 /// use google_cloud_retail_v2::model::UserInfo;
8211 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8212 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8213 /// ```
8214 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8215 where
8216 T: std::convert::Into<crate::model::UserInfo>,
8217 {
8218 self.user_info = v.map(|x| x.into());
8219 self
8220 }
8221
8222 /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8223 ///
8224 /// # Example
8225 /// ```ignore,no_run
8226 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8227 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8228 /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8229 /// ```
8230 pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8231 where
8232 T: std::convert::Into<
8233 crate::model::conversational_search_request::ConversationalFilteringSpec,
8234 >,
8235 {
8236 self.conversational_filtering_spec = std::option::Option::Some(v.into());
8237 self
8238 }
8239
8240 /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8241 ///
8242 /// # Example
8243 /// ```ignore,no_run
8244 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8245 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8246 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8247 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8248 /// ```
8249 pub fn set_or_clear_conversational_filtering_spec<T>(
8250 mut self,
8251 v: std::option::Option<T>,
8252 ) -> Self
8253 where
8254 T: std::convert::Into<
8255 crate::model::conversational_search_request::ConversationalFilteringSpec,
8256 >,
8257 {
8258 self.conversational_filtering_spec = v.map(|x| x.into());
8259 self
8260 }
8261
8262 /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8263 ///
8264 /// # Example
8265 /// ```ignore,no_run
8266 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8267 /// let x = ConversationalSearchRequest::new().set_user_labels([
8268 /// ("key0", "abc"),
8269 /// ("key1", "xyz"),
8270 /// ]);
8271 /// ```
8272 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8273 where
8274 T: std::iter::IntoIterator<Item = (K, V)>,
8275 K: std::convert::Into<std::string::String>,
8276 V: std::convert::Into<std::string::String>,
8277 {
8278 use std::iter::Iterator;
8279 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8280 self
8281 }
8282
8283 /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8284 ///
8285 /// # Example
8286 /// ```ignore,no_run
8287 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8288 /// use google_cloud_retail_v2::model::SafetySetting;
8289 /// let x = ConversationalSearchRequest::new()
8290 /// .set_safety_settings([
8291 /// SafetySetting::default()/* use setters */,
8292 /// SafetySetting::default()/* use (different) setters */,
8293 /// ]);
8294 /// ```
8295 pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8296 where
8297 T: std::iter::IntoIterator<Item = V>,
8298 V: std::convert::Into<crate::model::SafetySetting>,
8299 {
8300 use std::iter::Iterator;
8301 self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8302 self
8303 }
8304}
8305
8306impl wkt::message::Message for ConversationalSearchRequest {
8307 fn typename() -> &'static str {
8308 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8309 }
8310}
8311
8312/// Defines additional types related to [ConversationalSearchRequest].
8313pub mod conversational_search_request {
8314 #[allow(unused_imports)]
8315 use super::*;
8316
8317 /// Search parameters.
8318 #[derive(Clone, Default, PartialEq)]
8319 #[non_exhaustive]
8320 pub struct SearchParams {
8321 /// Optional. The filter string to restrict search results.
8322 ///
8323 /// The syntax of the filter string is the same as
8324 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8325 ///
8326 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8327 pub filter: std::string::String,
8328
8329 /// Optional. The canonical filter string to restrict search results.
8330 ///
8331 /// The syntax of the canonical filter string is the same as
8332 /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8333 ///
8334 /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8335 pub canonical_filter: std::string::String,
8336
8337 /// Optional. The sort string to specify the sorting of search results.
8338 ///
8339 /// The syntax of the sort string is the same as
8340 /// [SearchRequest.sort][].
8341 pub sort_by: std::string::String,
8342
8343 /// Optional. The boost spec to specify the boosting of search results.
8344 ///
8345 /// The syntax of the boost spec is the same as
8346 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8347 ///
8348 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8349 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8350
8351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8352 }
8353
8354 impl SearchParams {
8355 pub fn new() -> Self {
8356 std::default::Default::default()
8357 }
8358
8359 /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8360 ///
8361 /// # Example
8362 /// ```ignore,no_run
8363 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8364 /// let x = SearchParams::new().set_filter("example");
8365 /// ```
8366 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8367 self.filter = v.into();
8368 self
8369 }
8370
8371 /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8372 ///
8373 /// # Example
8374 /// ```ignore,no_run
8375 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8376 /// let x = SearchParams::new().set_canonical_filter("example");
8377 /// ```
8378 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8379 mut self,
8380 v: T,
8381 ) -> Self {
8382 self.canonical_filter = v.into();
8383 self
8384 }
8385
8386 /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8387 ///
8388 /// # Example
8389 /// ```ignore,no_run
8390 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8391 /// let x = SearchParams::new().set_sort_by("example");
8392 /// ```
8393 pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8394 self.sort_by = v.into();
8395 self
8396 }
8397
8398 /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8399 ///
8400 /// # Example
8401 /// ```ignore,no_run
8402 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8403 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8404 /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8405 /// ```
8406 pub fn set_boost_spec<T>(mut self, v: T) -> Self
8407 where
8408 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8409 {
8410 self.boost_spec = std::option::Option::Some(v.into());
8411 self
8412 }
8413
8414 /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8415 ///
8416 /// # Example
8417 /// ```ignore,no_run
8418 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8419 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8420 /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8421 /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8422 /// ```
8423 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8424 where
8425 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8426 {
8427 self.boost_spec = v.map(|x| x.into());
8428 self
8429 }
8430 }
8431
8432 impl wkt::message::Message for SearchParams {
8433 fn typename() -> &'static str {
8434 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8435 }
8436 }
8437
8438 /// This field specifies the current user answer during the conversational
8439 /// filtering search. This can be either user selected from suggested answers
8440 /// or user input plain text.
8441 #[derive(Clone, Default, PartialEq)]
8442 #[non_exhaustive]
8443 pub struct UserAnswer {
8444 /// This field specifies the type of user answer.
8445 pub r#type:
8446 std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8447
8448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8449 }
8450
8451 impl UserAnswer {
8452 pub fn new() -> Self {
8453 std::default::Default::default()
8454 }
8455
8456 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8457 ///
8458 /// Note that all the setters affecting `r#type` are mutually
8459 /// exclusive.
8460 ///
8461 /// # Example
8462 /// ```ignore,no_run
8463 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8464 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8465 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8466 /// ```
8467 pub fn set_type<
8468 T: std::convert::Into<
8469 std::option::Option<
8470 crate::model::conversational_search_request::user_answer::Type,
8471 >,
8472 >,
8473 >(
8474 mut self,
8475 v: T,
8476 ) -> Self {
8477 self.r#type = v.into();
8478 self
8479 }
8480
8481 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8482 /// if it holds a `TextAnswer`, `None` if the field is not set or
8483 /// holds a different branch.
8484 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8485 #[allow(unreachable_patterns)]
8486 self.r#type.as_ref().and_then(|v| match v {
8487 crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8488 std::option::Option::Some(v)
8489 }
8490 _ => std::option::Option::None,
8491 })
8492 }
8493
8494 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8495 /// to hold a `TextAnswer`.
8496 ///
8497 /// Note that all the setters affecting `r#type` are
8498 /// mutually exclusive.
8499 ///
8500 /// # Example
8501 /// ```ignore,no_run
8502 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8503 /// let x = UserAnswer::new().set_text_answer("example");
8504 /// assert!(x.text_answer().is_some());
8505 /// assert!(x.selected_answer().is_none());
8506 /// ```
8507 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8508 self.r#type = std::option::Option::Some(
8509 crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8510 v.into(),
8511 ),
8512 );
8513 self
8514 }
8515
8516 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8517 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8518 /// holds a different branch.
8519 pub fn selected_answer(
8520 &self,
8521 ) -> std::option::Option<
8522 &std::boxed::Box<
8523 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8524 >,
8525 > {
8526 #[allow(unreachable_patterns)]
8527 self.r#type.as_ref().and_then(|v| match v {
8528 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8529 v,
8530 ) => std::option::Option::Some(v),
8531 _ => std::option::Option::None,
8532 })
8533 }
8534
8535 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8536 /// to hold a `SelectedAnswer`.
8537 ///
8538 /// Note that all the setters affecting `r#type` are
8539 /// mutually exclusive.
8540 ///
8541 /// # Example
8542 /// ```ignore,no_run
8543 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8544 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8545 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8546 /// assert!(x.selected_answer().is_some());
8547 /// assert!(x.text_answer().is_none());
8548 /// ```
8549 pub fn set_selected_answer<
8550 T: std::convert::Into<
8551 std::boxed::Box<
8552 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8553 >,
8554 >,
8555 >(
8556 mut self,
8557 v: T,
8558 ) -> Self {
8559 self.r#type = std::option::Option::Some(
8560 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8561 v.into(),
8562 ),
8563 );
8564 self
8565 }
8566 }
8567
8568 impl wkt::message::Message for UserAnswer {
8569 fn typename() -> &'static str {
8570 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8571 }
8572 }
8573
8574 /// Defines additional types related to [UserAnswer].
8575 pub mod user_answer {
8576 #[allow(unused_imports)]
8577 use super::*;
8578
8579 /// This field specifies the selected answers during the conversational
8580 /// search.
8581 #[derive(Clone, Default, PartialEq)]
8582 #[non_exhaustive]
8583 pub struct SelectedAnswer {
8584 /// Optional. This field specifies the selected answer which is a attribute
8585 /// key-value.
8586 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8587
8588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8589 }
8590
8591 impl SelectedAnswer {
8592 pub fn new() -> Self {
8593 std::default::Default::default()
8594 }
8595
8596 /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8597 ///
8598 /// # Example
8599 /// ```ignore,no_run
8600 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8601 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8602 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8603 /// ```
8604 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8605 where
8606 T: std::convert::Into<crate::model::ProductAttributeValue>,
8607 {
8608 self.product_attribute_value = std::option::Option::Some(v.into());
8609 self
8610 }
8611
8612 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8613 ///
8614 /// # Example
8615 /// ```ignore,no_run
8616 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8617 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8618 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8619 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8620 /// ```
8621 pub fn set_or_clear_product_attribute_value<T>(
8622 mut self,
8623 v: std::option::Option<T>,
8624 ) -> Self
8625 where
8626 T: std::convert::Into<crate::model::ProductAttributeValue>,
8627 {
8628 self.product_attribute_value = v.map(|x| x.into());
8629 self
8630 }
8631 }
8632
8633 impl wkt::message::Message for SelectedAnswer {
8634 fn typename() -> &'static str {
8635 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8636 }
8637 }
8638
8639 /// This field specifies the type of user answer.
8640 #[derive(Clone, Debug, PartialEq)]
8641 #[non_exhaustive]
8642 pub enum Type {
8643 /// This field specifies the incremental input text from the user during
8644 /// the conversational search.
8645 TextAnswer(std::string::String),
8646 /// Optional. This field specifies the selected answer during the
8647 /// conversational search. This should be a subset of
8648 /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8649 SelectedAnswer(
8650 std::boxed::Box<
8651 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8652 >,
8653 ),
8654 }
8655 }
8656
8657 /// This field specifies all conversational filtering related parameters
8658 /// addition to conversational retail search.
8659 #[derive(Clone, Default, PartialEq)]
8660 #[non_exhaustive]
8661 pub struct ConversationalFilteringSpec {
8662 /// Optional. This field is deprecated. Please use
8663 /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8664 /// instead.
8665 ///
8666 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8667 #[deprecated]
8668 pub enable_conversational_filtering: bool,
8669
8670 /// Optional. This field specifies the current user answer during the
8671 /// conversational filtering search. It can be either user selected from
8672 /// suggested answers or user input plain text.
8673 pub user_answer:
8674 std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8675
8676 /// Optional. Mode to control Conversational Filtering.
8677 /// Defaults to
8678 /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8679 /// if it's unset.
8680 ///
8681 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8682 pub conversational_filtering_mode:
8683 crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8684
8685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8686 }
8687
8688 impl ConversationalFilteringSpec {
8689 pub fn new() -> Self {
8690 std::default::Default::default()
8691 }
8692
8693 /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8694 ///
8695 /// # Example
8696 /// ```ignore,no_run
8697 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8698 /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8699 /// ```
8700 #[deprecated]
8701 pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8702 mut self,
8703 v: T,
8704 ) -> Self {
8705 self.enable_conversational_filtering = v.into();
8706 self
8707 }
8708
8709 /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8710 ///
8711 /// # Example
8712 /// ```ignore,no_run
8713 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8714 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8715 /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8716 /// ```
8717 pub fn set_user_answer<T>(mut self, v: T) -> Self
8718 where
8719 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8720 {
8721 self.user_answer = std::option::Option::Some(v.into());
8722 self
8723 }
8724
8725 /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8726 ///
8727 /// # Example
8728 /// ```ignore,no_run
8729 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8730 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8731 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8732 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8733 /// ```
8734 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8735 where
8736 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8737 {
8738 self.user_answer = v.map(|x| x.into());
8739 self
8740 }
8741
8742 /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8743 ///
8744 /// # Example
8745 /// ```ignore,no_run
8746 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8747 /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8748 /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8749 /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8750 /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8751 /// ```
8752 pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8753 self.conversational_filtering_mode = v.into();
8754 self
8755 }
8756 }
8757
8758 impl wkt::message::Message for ConversationalFilteringSpec {
8759 fn typename() -> &'static str {
8760 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8761 }
8762 }
8763
8764 /// Defines additional types related to [ConversationalFilteringSpec].
8765 pub mod conversational_filtering_spec {
8766 #[allow(unused_imports)]
8767 use super::*;
8768
8769 /// Enum to control Conversational Filtering mode.
8770 /// A single conversation session including multiple turns supports modes for
8771 /// Conversational Search OR Conversational Filtering without
8772 /// Conversational Search, but not both.
8773 ///
8774 /// # Working with unknown values
8775 ///
8776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8777 /// additional enum variants at any time. Adding new variants is not considered
8778 /// a breaking change. Applications should write their code in anticipation of:
8779 ///
8780 /// - New values appearing in future releases of the client library, **and**
8781 /// - New values received dynamically, without application changes.
8782 ///
8783 /// Please consult the [Working with enums] section in the user guide for some
8784 /// guidelines.
8785 ///
8786 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8787 #[derive(Clone, Debug, PartialEq)]
8788 #[non_exhaustive]
8789 pub enum Mode {
8790 /// Default value.
8791 Unspecified,
8792 /// Disables Conversational Filtering when using Conversational Search.
8793 Disabled,
8794 /// Enables Conversational Filtering when using Conversational Search.
8795 Enabled,
8796 /// Enables Conversational Filtering without Conversational Search.
8797 ConversationalFilterOnly,
8798 /// If set, the enum was initialized with an unknown value.
8799 ///
8800 /// Applications can examine the value using [Mode::value] or
8801 /// [Mode::name].
8802 UnknownValue(mode::UnknownValue),
8803 }
8804
8805 #[doc(hidden)]
8806 pub mod mode {
8807 #[allow(unused_imports)]
8808 use super::*;
8809 #[derive(Clone, Debug, PartialEq)]
8810 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8811 }
8812
8813 impl Mode {
8814 /// Gets the enum value.
8815 ///
8816 /// Returns `None` if the enum contains an unknown value deserialized from
8817 /// the string representation of enums.
8818 pub fn value(&self) -> std::option::Option<i32> {
8819 match self {
8820 Self::Unspecified => std::option::Option::Some(0),
8821 Self::Disabled => std::option::Option::Some(1),
8822 Self::Enabled => std::option::Option::Some(2),
8823 Self::ConversationalFilterOnly => std::option::Option::Some(3),
8824 Self::UnknownValue(u) => u.0.value(),
8825 }
8826 }
8827
8828 /// Gets the enum value as a string.
8829 ///
8830 /// Returns `None` if the enum contains an unknown value deserialized from
8831 /// the integer representation of enums.
8832 pub fn name(&self) -> std::option::Option<&str> {
8833 match self {
8834 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8835 Self::Disabled => std::option::Option::Some("DISABLED"),
8836 Self::Enabled => std::option::Option::Some("ENABLED"),
8837 Self::ConversationalFilterOnly => {
8838 std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8839 }
8840 Self::UnknownValue(u) => u.0.name(),
8841 }
8842 }
8843 }
8844
8845 impl std::default::Default for Mode {
8846 fn default() -> Self {
8847 use std::convert::From;
8848 Self::from(0)
8849 }
8850 }
8851
8852 impl std::fmt::Display for Mode {
8853 fn fmt(
8854 &self,
8855 f: &mut std::fmt::Formatter<'_>,
8856 ) -> std::result::Result<(), std::fmt::Error> {
8857 wkt::internal::display_enum(f, self.name(), self.value())
8858 }
8859 }
8860
8861 impl std::convert::From<i32> for Mode {
8862 fn from(value: i32) -> Self {
8863 match value {
8864 0 => Self::Unspecified,
8865 1 => Self::Disabled,
8866 2 => Self::Enabled,
8867 3 => Self::ConversationalFilterOnly,
8868 _ => Self::UnknownValue(mode::UnknownValue(
8869 wkt::internal::UnknownEnumValue::Integer(value),
8870 )),
8871 }
8872 }
8873 }
8874
8875 impl std::convert::From<&str> for Mode {
8876 fn from(value: &str) -> Self {
8877 use std::string::ToString;
8878 match value {
8879 "MODE_UNSPECIFIED" => Self::Unspecified,
8880 "DISABLED" => Self::Disabled,
8881 "ENABLED" => Self::Enabled,
8882 "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
8883 _ => Self::UnknownValue(mode::UnknownValue(
8884 wkt::internal::UnknownEnumValue::String(value.to_string()),
8885 )),
8886 }
8887 }
8888 }
8889
8890 impl serde::ser::Serialize for Mode {
8891 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8892 where
8893 S: serde::Serializer,
8894 {
8895 match self {
8896 Self::Unspecified => serializer.serialize_i32(0),
8897 Self::Disabled => serializer.serialize_i32(1),
8898 Self::Enabled => serializer.serialize_i32(2),
8899 Self::ConversationalFilterOnly => serializer.serialize_i32(3),
8900 Self::UnknownValue(u) => u.0.serialize(serializer),
8901 }
8902 }
8903 }
8904
8905 impl<'de> serde::de::Deserialize<'de> for Mode {
8906 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8907 where
8908 D: serde::Deserializer<'de>,
8909 {
8910 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
8911 ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
8912 }
8913 }
8914 }
8915}
8916
8917/// Response message for
8918/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8919/// method.
8920#[derive(Clone, Default, PartialEq)]
8921#[non_exhaustive]
8922pub struct ConversationalSearchResponse {
8923 /// The types Retail classifies the search query as.
8924 ///
8925 /// Supported values are:
8926 ///
8927 /// - "ORDER_SUPPORT"
8928 /// - "SIMPLE_PRODUCT_SEARCH"
8929 /// - "INTENT_REFINEMENT"
8930 /// - "PRODUCT_DETAILS"
8931 /// - "PRODUCT_COMPARISON"
8932 /// - "DEALS_AND_COUPONS"
8933 /// - "STORE_RELEVANT"
8934 /// - "BLOCKLISTED"
8935 /// - "BEST_PRODUCT"
8936 /// - "RETAIL_SUPPORT"
8937 /// - "DISABLED"
8938 pub user_query_types: std::vec::Vec<std::string::String>,
8939
8940 /// The conversational answer-based text response generated by the Server.
8941 pub conversational_text_response: std::string::String,
8942
8943 /// The conversational followup question generated for Intent refinement.
8944 pub followup_question:
8945 std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
8946
8947 /// Conversation UUID. This field will be stored in client side storage to
8948 /// maintain the conversation session with server and will be used for next
8949 /// search request's
8950 /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
8951 /// to restore conversation state in server.
8952 ///
8953 /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
8954 pub conversation_id: std::string::String,
8955
8956 /// The proposed refined search queries. They can be used to fetch the relevant
8957 /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
8958 /// refined_query from search response will be populated here.
8959 pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
8960
8961 /// This field specifies all related information that is needed on client
8962 /// side for UI rendering of conversational filtering search.
8963 pub conversational_filtering_result: std::option::Option<
8964 crate::model::conversational_search_response::ConversationalFilteringResult,
8965 >,
8966
8967 /// Output only. The state of the response generation.
8968 pub state: crate::model::conversational_search_response::State,
8969
8970 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8971}
8972
8973impl ConversationalSearchResponse {
8974 pub fn new() -> Self {
8975 std::default::Default::default()
8976 }
8977
8978 /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
8979 ///
8980 /// # Example
8981 /// ```ignore,no_run
8982 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
8983 /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
8984 /// ```
8985 pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
8986 where
8987 T: std::iter::IntoIterator<Item = V>,
8988 V: std::convert::Into<std::string::String>,
8989 {
8990 use std::iter::Iterator;
8991 self.user_query_types = v.into_iter().map(|i| i.into()).collect();
8992 self
8993 }
8994
8995 /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
8996 ///
8997 /// # Example
8998 /// ```ignore,no_run
8999 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9000 /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9001 /// ```
9002 pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9003 mut self,
9004 v: T,
9005 ) -> Self {
9006 self.conversational_text_response = v.into();
9007 self
9008 }
9009
9010 /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9011 ///
9012 /// # Example
9013 /// ```ignore,no_run
9014 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9015 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9016 /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9017 /// ```
9018 pub fn set_followup_question<T>(mut self, v: T) -> Self
9019 where
9020 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9021 {
9022 self.followup_question = std::option::Option::Some(v.into());
9023 self
9024 }
9025
9026 /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9027 ///
9028 /// # Example
9029 /// ```ignore,no_run
9030 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9031 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9032 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9033 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9034 /// ```
9035 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9036 where
9037 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9038 {
9039 self.followup_question = v.map(|x| x.into());
9040 self
9041 }
9042
9043 /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9044 ///
9045 /// # Example
9046 /// ```ignore,no_run
9047 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9048 /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9049 /// ```
9050 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9051 self.conversation_id = v.into();
9052 self
9053 }
9054
9055 /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9056 ///
9057 /// # Example
9058 /// ```ignore,no_run
9059 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9060 /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9061 /// let x = ConversationalSearchResponse::new()
9062 /// .set_refined_search([
9063 /// RefinedSearch::default()/* use setters */,
9064 /// RefinedSearch::default()/* use (different) setters */,
9065 /// ]);
9066 /// ```
9067 pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9068 where
9069 T: std::iter::IntoIterator<Item = V>,
9070 V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9071 {
9072 use std::iter::Iterator;
9073 self.refined_search = v.into_iter().map(|i| i.into()).collect();
9074 self
9075 }
9076
9077 /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9078 ///
9079 /// # Example
9080 /// ```ignore,no_run
9081 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9082 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9083 /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9084 /// ```
9085 pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9086 where
9087 T: std::convert::Into<
9088 crate::model::conversational_search_response::ConversationalFilteringResult,
9089 >,
9090 {
9091 self.conversational_filtering_result = std::option::Option::Some(v.into());
9092 self
9093 }
9094
9095 /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9096 ///
9097 /// # Example
9098 /// ```ignore,no_run
9099 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9100 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9101 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9102 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9103 /// ```
9104 pub fn set_or_clear_conversational_filtering_result<T>(
9105 mut self,
9106 v: std::option::Option<T>,
9107 ) -> Self
9108 where
9109 T: std::convert::Into<
9110 crate::model::conversational_search_response::ConversationalFilteringResult,
9111 >,
9112 {
9113 self.conversational_filtering_result = v.map(|x| x.into());
9114 self
9115 }
9116
9117 /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9118 ///
9119 /// # Example
9120 /// ```ignore,no_run
9121 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9122 /// use google_cloud_retail_v2::model::conversational_search_response::State;
9123 /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9124 /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9125 /// ```
9126 pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9127 mut self,
9128 v: T,
9129 ) -> Self {
9130 self.state = v.into();
9131 self
9132 }
9133}
9134
9135impl wkt::message::Message for ConversationalSearchResponse {
9136 fn typename() -> &'static str {
9137 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9138 }
9139}
9140
9141/// Defines additional types related to [ConversationalSearchResponse].
9142pub mod conversational_search_response {
9143 #[allow(unused_imports)]
9144 use super::*;
9145
9146 /// The conversational followup question generated for Intent refinement.
9147 #[derive(Clone, Default, PartialEq)]
9148 #[non_exhaustive]
9149 pub struct FollowupQuestion {
9150 /// The conversational followup question generated for Intent refinement.
9151 pub followup_question: std::string::String,
9152
9153 /// The answer options provided to client for the follow-up question.
9154 pub suggested_answers: std::vec::Vec<
9155 crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9156 >,
9157
9158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9159 }
9160
9161 impl FollowupQuestion {
9162 pub fn new() -> Self {
9163 std::default::Default::default()
9164 }
9165
9166 /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9171 /// let x = FollowupQuestion::new().set_followup_question("example");
9172 /// ```
9173 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9174 mut self,
9175 v: T,
9176 ) -> Self {
9177 self.followup_question = v.into();
9178 self
9179 }
9180
9181 /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9182 ///
9183 /// # Example
9184 /// ```ignore,no_run
9185 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9186 /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9187 /// let x = FollowupQuestion::new()
9188 /// .set_suggested_answers([
9189 /// SuggestedAnswer::default()/* use setters */,
9190 /// SuggestedAnswer::default()/* use (different) setters */,
9191 /// ]);
9192 /// ```
9193 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9194 where
9195 T: std::iter::IntoIterator<Item = V>,
9196 V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9197 {
9198 use std::iter::Iterator;
9199 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9200 self
9201 }
9202 }
9203
9204 impl wkt::message::Message for FollowupQuestion {
9205 fn typename() -> &'static str {
9206 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9207 }
9208 }
9209
9210 /// Defines additional types related to [FollowupQuestion].
9211 pub mod followup_question {
9212 #[allow(unused_imports)]
9213 use super::*;
9214
9215 /// Suggested answers to the follow-up question.
9216 /// If it's numerical attribute, only ProductAttributeInterval will be set.
9217 /// If it's textual attribute, only productAttributeValue will be set.
9218 #[derive(Clone, Default, PartialEq)]
9219 #[non_exhaustive]
9220 pub struct SuggestedAnswer {
9221 /// Product attribute value, including an attribute key and an
9222 /// attribute value. Other types can be added here in the future.
9223 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9224
9225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9226 }
9227
9228 impl SuggestedAnswer {
9229 pub fn new() -> Self {
9230 std::default::Default::default()
9231 }
9232
9233 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9234 ///
9235 /// # Example
9236 /// ```ignore,no_run
9237 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9238 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9239 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9240 /// ```
9241 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9242 where
9243 T: std::convert::Into<crate::model::ProductAttributeValue>,
9244 {
9245 self.product_attribute_value = std::option::Option::Some(v.into());
9246 self
9247 }
9248
9249 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9250 ///
9251 /// # Example
9252 /// ```ignore,no_run
9253 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9254 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9255 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9256 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9257 /// ```
9258 pub fn set_or_clear_product_attribute_value<T>(
9259 mut self,
9260 v: std::option::Option<T>,
9261 ) -> Self
9262 where
9263 T: std::convert::Into<crate::model::ProductAttributeValue>,
9264 {
9265 self.product_attribute_value = v.map(|x| x.into());
9266 self
9267 }
9268 }
9269
9270 impl wkt::message::Message for SuggestedAnswer {
9271 fn typename() -> &'static str {
9272 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9273 }
9274 }
9275 }
9276
9277 /// The proposed refined search for intent-refinement/bundled shopping
9278 /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9279 /// refined_query from search response will be populated here.
9280 #[derive(Clone, Default, PartialEq)]
9281 #[non_exhaustive]
9282 pub struct RefinedSearch {
9283 /// The query to be used for search.
9284 pub query: std::string::String,
9285
9286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9287 }
9288
9289 impl RefinedSearch {
9290 pub fn new() -> Self {
9291 std::default::Default::default()
9292 }
9293
9294 /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9295 ///
9296 /// # Example
9297 /// ```ignore,no_run
9298 /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9299 /// let x = RefinedSearch::new().set_query("example");
9300 /// ```
9301 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9302 self.query = v.into();
9303 self
9304 }
9305 }
9306
9307 impl wkt::message::Message for RefinedSearch {
9308 fn typename() -> &'static str {
9309 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9310 }
9311 }
9312
9313 /// This field specifies all related information that is needed on client
9314 /// side for UI rendering of conversational filtering search.
9315 #[derive(Clone, Default, PartialEq)]
9316 #[non_exhaustive]
9317 pub struct ConversationalFilteringResult {
9318
9319 /// The conversational filtering question.
9320 pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9321
9322 /// This is the incremental additional filters implied from the current
9323 /// user answer. User should add the suggested addition filters to the
9324 /// previous [ConversationalSearchRequest.search_params.filter][] and
9325 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
9326 /// use the merged filter in the follow up requests.
9327 ///
9328 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
9329 pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9330
9331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9332 }
9333
9334 impl ConversationalFilteringResult {
9335 pub fn new() -> Self {
9336 std::default::Default::default()
9337 }
9338
9339 /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9340 ///
9341 /// # Example
9342 /// ```ignore,no_run
9343 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9344 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9345 /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9346 /// ```
9347 pub fn set_followup_question<T>(mut self, v: T) -> Self
9348 where
9349 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9350 {
9351 self.followup_question = std::option::Option::Some(v.into());
9352 self
9353 }
9354
9355 /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9356 ///
9357 /// # Example
9358 /// ```ignore,no_run
9359 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9360 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9361 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9362 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9363 /// ```
9364 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9365 where
9366 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9367 {
9368 self.followup_question = v.map(|x| x.into());
9369 self
9370 }
9371
9372 /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9373 ///
9374 /// # Example
9375 /// ```ignore,no_run
9376 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9377 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9378 /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9379 /// ```
9380 pub fn set_additional_filter<T>(mut self, v: T) -> Self
9381 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9382 {
9383 self.additional_filter = std::option::Option::Some(v.into());
9384 self
9385 }
9386
9387 /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9388 ///
9389 /// # Example
9390 /// ```ignore,no_run
9391 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9392 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9393 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9394 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9395 /// ```
9396 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9397 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9398 {
9399 self.additional_filter = v.map(|x| x.into());
9400 self
9401 }
9402 }
9403
9404 impl wkt::message::Message for ConversationalFilteringResult {
9405 fn typename() -> &'static str {
9406 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9407 }
9408 }
9409
9410 /// Defines additional types related to [ConversationalFilteringResult].
9411 pub mod conversational_filtering_result {
9412 #[allow(unused_imports)]
9413 use super::*;
9414
9415 /// Additional filter that client side need to apply.
9416 #[derive(Clone, Default, PartialEq)]
9417 #[non_exhaustive]
9418 pub struct AdditionalFilter {
9419 /// Product attribute value, including an attribute key and an
9420 /// attribute value. Other types can be added here in the future.
9421 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9422
9423 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9424 }
9425
9426 impl AdditionalFilter {
9427 pub fn new() -> Self {
9428 std::default::Default::default()
9429 }
9430
9431 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9432 ///
9433 /// # Example
9434 /// ```ignore,no_run
9435 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9436 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9437 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9438 /// ```
9439 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9440 where
9441 T: std::convert::Into<crate::model::ProductAttributeValue>,
9442 {
9443 self.product_attribute_value = std::option::Option::Some(v.into());
9444 self
9445 }
9446
9447 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9448 ///
9449 /// # Example
9450 /// ```ignore,no_run
9451 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9452 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9453 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9454 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9455 /// ```
9456 pub fn set_or_clear_product_attribute_value<T>(
9457 mut self,
9458 v: std::option::Option<T>,
9459 ) -> Self
9460 where
9461 T: std::convert::Into<crate::model::ProductAttributeValue>,
9462 {
9463 self.product_attribute_value = v.map(|x| x.into());
9464 self
9465 }
9466 }
9467
9468 impl wkt::message::Message for AdditionalFilter {
9469 fn typename() -> &'static str {
9470 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9471 }
9472 }
9473 }
9474
9475 /// The state of the response generation.
9476 ///
9477 /// # Working with unknown values
9478 ///
9479 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9480 /// additional enum variants at any time. Adding new variants is not considered
9481 /// a breaking change. Applications should write their code in anticipation of:
9482 ///
9483 /// - New values appearing in future releases of the client library, **and**
9484 /// - New values received dynamically, without application changes.
9485 ///
9486 /// Please consult the [Working with enums] section in the user guide for some
9487 /// guidelines.
9488 ///
9489 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9490 #[derive(Clone, Debug, PartialEq)]
9491 #[non_exhaustive]
9492 pub enum State {
9493 /// Unknown.
9494 Unspecified,
9495 /// Response generation is being streamed.
9496 Streaming,
9497 /// Response generation has succeeded.
9498 Succeeded,
9499 /// If set, the enum was initialized with an unknown value.
9500 ///
9501 /// Applications can examine the value using [State::value] or
9502 /// [State::name].
9503 UnknownValue(state::UnknownValue),
9504 }
9505
9506 #[doc(hidden)]
9507 pub mod state {
9508 #[allow(unused_imports)]
9509 use super::*;
9510 #[derive(Clone, Debug, PartialEq)]
9511 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9512 }
9513
9514 impl State {
9515 /// Gets the enum value.
9516 ///
9517 /// Returns `None` if the enum contains an unknown value deserialized from
9518 /// the string representation of enums.
9519 pub fn value(&self) -> std::option::Option<i32> {
9520 match self {
9521 Self::Unspecified => std::option::Option::Some(0),
9522 Self::Streaming => std::option::Option::Some(1),
9523 Self::Succeeded => std::option::Option::Some(2),
9524 Self::UnknownValue(u) => u.0.value(),
9525 }
9526 }
9527
9528 /// Gets the enum value as a string.
9529 ///
9530 /// Returns `None` if the enum contains an unknown value deserialized from
9531 /// the integer representation of enums.
9532 pub fn name(&self) -> std::option::Option<&str> {
9533 match self {
9534 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9535 Self::Streaming => std::option::Option::Some("STREAMING"),
9536 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9537 Self::UnknownValue(u) => u.0.name(),
9538 }
9539 }
9540 }
9541
9542 impl std::default::Default for State {
9543 fn default() -> Self {
9544 use std::convert::From;
9545 Self::from(0)
9546 }
9547 }
9548
9549 impl std::fmt::Display for State {
9550 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9551 wkt::internal::display_enum(f, self.name(), self.value())
9552 }
9553 }
9554
9555 impl std::convert::From<i32> for State {
9556 fn from(value: i32) -> Self {
9557 match value {
9558 0 => Self::Unspecified,
9559 1 => Self::Streaming,
9560 2 => Self::Succeeded,
9561 _ => Self::UnknownValue(state::UnknownValue(
9562 wkt::internal::UnknownEnumValue::Integer(value),
9563 )),
9564 }
9565 }
9566 }
9567
9568 impl std::convert::From<&str> for State {
9569 fn from(value: &str) -> Self {
9570 use std::string::ToString;
9571 match value {
9572 "STATE_UNSPECIFIED" => Self::Unspecified,
9573 "STREAMING" => Self::Streaming,
9574 "SUCCEEDED" => Self::Succeeded,
9575 _ => Self::UnknownValue(state::UnknownValue(
9576 wkt::internal::UnknownEnumValue::String(value.to_string()),
9577 )),
9578 }
9579 }
9580 }
9581
9582 impl serde::ser::Serialize for State {
9583 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9584 where
9585 S: serde::Serializer,
9586 {
9587 match self {
9588 Self::Unspecified => serializer.serialize_i32(0),
9589 Self::Streaming => serializer.serialize_i32(1),
9590 Self::Succeeded => serializer.serialize_i32(2),
9591 Self::UnknownValue(u) => u.0.serialize(serializer),
9592 }
9593 }
9594 }
9595
9596 impl<'de> serde::de::Deserialize<'de> for State {
9597 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9598 where
9599 D: serde::Deserializer<'de>,
9600 {
9601 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9602 ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9603 ))
9604 }
9605 }
9606}
9607
9608/// The output configuration setting.
9609#[derive(Clone, Default, PartialEq)]
9610#[non_exhaustive]
9611pub struct OutputConfig {
9612 /// The configuration of destination for holding output data.
9613 pub destination: std::option::Option<crate::model::output_config::Destination>,
9614
9615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9616}
9617
9618impl OutputConfig {
9619 pub fn new() -> Self {
9620 std::default::Default::default()
9621 }
9622
9623 /// Sets the value of [destination][crate::model::OutputConfig::destination].
9624 ///
9625 /// Note that all the setters affecting `destination` are mutually
9626 /// exclusive.
9627 ///
9628 /// # Example
9629 /// ```ignore,no_run
9630 /// # use google_cloud_retail_v2::model::OutputConfig;
9631 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9632 /// let x = OutputConfig::new().set_destination(Some(
9633 /// google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9634 /// ```
9635 pub fn set_destination<
9636 T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9637 >(
9638 mut self,
9639 v: T,
9640 ) -> Self {
9641 self.destination = v.into();
9642 self
9643 }
9644
9645 /// The value of [destination][crate::model::OutputConfig::destination]
9646 /// if it holds a `GcsDestination`, `None` if the field is not set or
9647 /// holds a different branch.
9648 pub fn gcs_destination(
9649 &self,
9650 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9651 #[allow(unreachable_patterns)]
9652 self.destination.as_ref().and_then(|v| match v {
9653 crate::model::output_config::Destination::GcsDestination(v) => {
9654 std::option::Option::Some(v)
9655 }
9656 _ => std::option::Option::None,
9657 })
9658 }
9659
9660 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9661 /// to hold a `GcsDestination`.
9662 ///
9663 /// Note that all the setters affecting `destination` are
9664 /// mutually exclusive.
9665 ///
9666 /// # Example
9667 /// ```ignore,no_run
9668 /// # use google_cloud_retail_v2::model::OutputConfig;
9669 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9670 /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9671 /// assert!(x.gcs_destination().is_some());
9672 /// assert!(x.bigquery_destination().is_none());
9673 /// ```
9674 pub fn set_gcs_destination<
9675 T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9676 >(
9677 mut self,
9678 v: T,
9679 ) -> Self {
9680 self.destination = std::option::Option::Some(
9681 crate::model::output_config::Destination::GcsDestination(v.into()),
9682 );
9683 self
9684 }
9685
9686 /// The value of [destination][crate::model::OutputConfig::destination]
9687 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9688 /// holds a different branch.
9689 pub fn bigquery_destination(
9690 &self,
9691 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9692 {
9693 #[allow(unreachable_patterns)]
9694 self.destination.as_ref().and_then(|v| match v {
9695 crate::model::output_config::Destination::BigqueryDestination(v) => {
9696 std::option::Option::Some(v)
9697 }
9698 _ => std::option::Option::None,
9699 })
9700 }
9701
9702 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9703 /// to hold a `BigqueryDestination`.
9704 ///
9705 /// Note that all the setters affecting `destination` are
9706 /// mutually exclusive.
9707 ///
9708 /// # Example
9709 /// ```ignore,no_run
9710 /// # use google_cloud_retail_v2::model::OutputConfig;
9711 /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9712 /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9713 /// assert!(x.bigquery_destination().is_some());
9714 /// assert!(x.gcs_destination().is_none());
9715 /// ```
9716 pub fn set_bigquery_destination<
9717 T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9718 >(
9719 mut self,
9720 v: T,
9721 ) -> Self {
9722 self.destination = std::option::Option::Some(
9723 crate::model::output_config::Destination::BigqueryDestination(v.into()),
9724 );
9725 self
9726 }
9727}
9728
9729impl wkt::message::Message for OutputConfig {
9730 fn typename() -> &'static str {
9731 "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9732 }
9733}
9734
9735/// Defines additional types related to [OutputConfig].
9736pub mod output_config {
9737 #[allow(unused_imports)]
9738 use super::*;
9739
9740 /// The Google Cloud Storage output destination configuration.
9741 #[derive(Clone, Default, PartialEq)]
9742 #[non_exhaustive]
9743 pub struct GcsDestination {
9744 /// Required. The output uri prefix for saving output data to json files.
9745 /// Some mapping examples are as follows:
9746 /// output_uri_prefix sample output(assuming the object is foo.json)
9747 /// ======================== =============================================
9748 /// gs://bucket/ gs://bucket/foo.json
9749 /// gs://bucket/folder/ gs://bucket/folder/foo.json
9750 /// gs://bucket/folder/item_ gs://bucket/folder/item_foo.json
9751 pub output_uri_prefix: std::string::String,
9752
9753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9754 }
9755
9756 impl GcsDestination {
9757 pub fn new() -> Self {
9758 std::default::Default::default()
9759 }
9760
9761 /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9762 ///
9763 /// # Example
9764 /// ```ignore,no_run
9765 /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9766 /// let x = GcsDestination::new().set_output_uri_prefix("example");
9767 /// ```
9768 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9769 mut self,
9770 v: T,
9771 ) -> Self {
9772 self.output_uri_prefix = v.into();
9773 self
9774 }
9775 }
9776
9777 impl wkt::message::Message for GcsDestination {
9778 fn typename() -> &'static str {
9779 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9780 }
9781 }
9782
9783 /// The BigQuery output destination configuration.
9784 #[derive(Clone, Default, PartialEq)]
9785 #[non_exhaustive]
9786 pub struct BigQueryDestination {
9787 /// Required. The ID of a BigQuery Dataset.
9788 pub dataset_id: std::string::String,
9789
9790 /// Required. The prefix of exported BigQuery tables.
9791 pub table_id_prefix: std::string::String,
9792
9793 /// Required. Describes the table type. The following values are supported:
9794 ///
9795 /// * `table`: A BigQuery native table.
9796 /// * `view`: A virtual table defined by a SQL query.
9797 pub table_type: std::string::String,
9798
9799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9800 }
9801
9802 impl BigQueryDestination {
9803 pub fn new() -> Self {
9804 std::default::Default::default()
9805 }
9806
9807 /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9808 ///
9809 /// # Example
9810 /// ```ignore,no_run
9811 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9812 /// let x = BigQueryDestination::new().set_dataset_id("example");
9813 /// ```
9814 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9815 self.dataset_id = v.into();
9816 self
9817 }
9818
9819 /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9820 ///
9821 /// # Example
9822 /// ```ignore,no_run
9823 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9824 /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9825 /// ```
9826 pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9827 mut self,
9828 v: T,
9829 ) -> Self {
9830 self.table_id_prefix = v.into();
9831 self
9832 }
9833
9834 /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9835 ///
9836 /// # Example
9837 /// ```ignore,no_run
9838 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9839 /// let x = BigQueryDestination::new().set_table_type("example");
9840 /// ```
9841 pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9842 self.table_type = v.into();
9843 self
9844 }
9845 }
9846
9847 impl wkt::message::Message for BigQueryDestination {
9848 fn typename() -> &'static str {
9849 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9850 }
9851 }
9852
9853 /// The configuration of destination for holding output data.
9854 #[derive(Clone, Debug, PartialEq)]
9855 #[non_exhaustive]
9856 pub enum Destination {
9857 /// The Google Cloud Storage location where the output is to be written to.
9858 GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9859 /// The BigQuery location where the output is to be written to.
9860 BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9861 }
9862}
9863
9864/// Configuration of destination for Export related errors.
9865#[derive(Clone, Default, PartialEq)]
9866#[non_exhaustive]
9867pub struct ExportErrorsConfig {
9868 /// Required. Errors destination.
9869 pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
9870
9871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9872}
9873
9874impl ExportErrorsConfig {
9875 pub fn new() -> Self {
9876 std::default::Default::default()
9877 }
9878
9879 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
9880 ///
9881 /// Note that all the setters affecting `destination` are mutually
9882 /// exclusive.
9883 ///
9884 /// # Example
9885 /// ```ignore,no_run
9886 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9887 /// use google_cloud_retail_v2::model::export_errors_config::Destination;
9888 /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
9889 /// ```
9890 pub fn set_destination<
9891 T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
9892 >(
9893 mut self,
9894 v: T,
9895 ) -> Self {
9896 self.destination = v.into();
9897 self
9898 }
9899
9900 /// The value of [destination][crate::model::ExportErrorsConfig::destination]
9901 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9902 /// holds a different branch.
9903 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
9904 #[allow(unreachable_patterns)]
9905 self.destination.as_ref().and_then(|v| match v {
9906 crate::model::export_errors_config::Destination::GcsPrefix(v) => {
9907 std::option::Option::Some(v)
9908 }
9909 _ => std::option::Option::None,
9910 })
9911 }
9912
9913 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
9914 /// to hold a `GcsPrefix`.
9915 ///
9916 /// Note that all the setters affecting `destination` are
9917 /// mutually exclusive.
9918 ///
9919 /// # Example
9920 /// ```ignore,no_run
9921 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9922 /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
9923 /// assert!(x.gcs_prefix().is_some());
9924 /// ```
9925 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9926 self.destination = std::option::Option::Some(
9927 crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
9928 );
9929 self
9930 }
9931}
9932
9933impl wkt::message::Message for ExportErrorsConfig {
9934 fn typename() -> &'static str {
9935 "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
9936 }
9937}
9938
9939/// Defines additional types related to [ExportErrorsConfig].
9940pub mod export_errors_config {
9941 #[allow(unused_imports)]
9942 use super::*;
9943
9944 /// Required. Errors destination.
9945 #[derive(Clone, Debug, PartialEq)]
9946 #[non_exhaustive]
9947 pub enum Destination {
9948 /// Google Cloud Storage path for import errors. This must be an empty,
9949 /// existing Cloud Storage bucket. Export errors will be written to a file in
9950 /// this bucket, one per line, as a JSON-encoded
9951 /// `google.rpc.Status` message.
9952 GcsPrefix(std::string::String),
9953 }
9954}
9955
9956/// Request message for the `ExportAnalyticsMetrics` method.
9957#[derive(Clone, Default, PartialEq)]
9958#[non_exhaustive]
9959pub struct ExportAnalyticsMetricsRequest {
9960 /// Required. Full resource name of the parent catalog.
9961 /// Expected format: `projects/*/locations/*/catalogs/*`
9962 pub catalog: std::string::String,
9963
9964 /// Required. The output location of the data.
9965 pub output_config: std::option::Option<crate::model::OutputConfig>,
9966
9967 /// A filtering expression to specify restrictions on returned metrics.
9968 /// The expression is a sequence of terms. Each term applies a restriction to
9969 /// the returned metrics. Use this expression to restrict results to a
9970 /// specific time range.
9971 ///
9972 /// Currently we expect only one types of fields:
9973 ///
9974 /// * `timestamp`: This can be specified twice, once with a
9975 /// less than operator and once with a greater than operator. The
9976 /// `timestamp` restriction should result in one, contiguous, valid,
9977 /// `timestamp` range.
9978 ///
9979 /// Some examples of valid filters expressions:
9980 ///
9981 /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
9982 /// timestamp < "2012-04-23T18:30:43.511Z"`
9983 /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
9984 pub filter: std::string::String,
9985
9986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9987}
9988
9989impl ExportAnalyticsMetricsRequest {
9990 pub fn new() -> Self {
9991 std::default::Default::default()
9992 }
9993
9994 /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
9995 ///
9996 /// # Example
9997 /// ```ignore,no_run
9998 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
9999 /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10000 /// ```
10001 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10002 self.catalog = v.into();
10003 self
10004 }
10005
10006 /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10007 ///
10008 /// # Example
10009 /// ```ignore,no_run
10010 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10011 /// use google_cloud_retail_v2::model::OutputConfig;
10012 /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10013 /// ```
10014 pub fn set_output_config<T>(mut self, v: T) -> Self
10015 where
10016 T: std::convert::Into<crate::model::OutputConfig>,
10017 {
10018 self.output_config = std::option::Option::Some(v.into());
10019 self
10020 }
10021
10022 /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10023 ///
10024 /// # Example
10025 /// ```ignore,no_run
10026 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10027 /// use google_cloud_retail_v2::model::OutputConfig;
10028 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10029 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10030 /// ```
10031 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10032 where
10033 T: std::convert::Into<crate::model::OutputConfig>,
10034 {
10035 self.output_config = v.map(|x| x.into());
10036 self
10037 }
10038
10039 /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10040 ///
10041 /// # Example
10042 /// ```ignore,no_run
10043 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10044 /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10045 /// ```
10046 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10047 self.filter = v.into();
10048 self
10049 }
10050}
10051
10052impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10053 fn typename() -> &'static str {
10054 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10055 }
10056}
10057
10058/// Metadata related to the progress of the Export operation. This is
10059/// returned by the google.longrunning.Operation.metadata field.
10060#[derive(Clone, Default, PartialEq)]
10061#[non_exhaustive]
10062pub struct ExportMetadata {
10063 /// Operation create time.
10064 pub create_time: std::option::Option<wkt::Timestamp>,
10065
10066 /// Operation last update time. If the operation is done, this is also the
10067 /// finish time.
10068 pub update_time: std::option::Option<wkt::Timestamp>,
10069
10070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10071}
10072
10073impl ExportMetadata {
10074 pub fn new() -> Self {
10075 std::default::Default::default()
10076 }
10077
10078 /// Sets the value of [create_time][crate::model::ExportMetadata::create_time].
10079 ///
10080 /// # Example
10081 /// ```ignore,no_run
10082 /// # use google_cloud_retail_v2::model::ExportMetadata;
10083 /// use wkt::Timestamp;
10084 /// let x = ExportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10085 /// ```
10086 pub fn set_create_time<T>(mut self, v: T) -> Self
10087 where
10088 T: std::convert::Into<wkt::Timestamp>,
10089 {
10090 self.create_time = std::option::Option::Some(v.into());
10091 self
10092 }
10093
10094 /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10095 ///
10096 /// # Example
10097 /// ```ignore,no_run
10098 /// # use google_cloud_retail_v2::model::ExportMetadata;
10099 /// use wkt::Timestamp;
10100 /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10101 /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10102 /// ```
10103 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10104 where
10105 T: std::convert::Into<wkt::Timestamp>,
10106 {
10107 self.create_time = v.map(|x| x.into());
10108 self
10109 }
10110
10111 /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10112 ///
10113 /// # Example
10114 /// ```ignore,no_run
10115 /// # use google_cloud_retail_v2::model::ExportMetadata;
10116 /// use wkt::Timestamp;
10117 /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10118 /// ```
10119 pub fn set_update_time<T>(mut self, v: T) -> Self
10120 where
10121 T: std::convert::Into<wkt::Timestamp>,
10122 {
10123 self.update_time = std::option::Option::Some(v.into());
10124 self
10125 }
10126
10127 /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10128 ///
10129 /// # Example
10130 /// ```ignore,no_run
10131 /// # use google_cloud_retail_v2::model::ExportMetadata;
10132 /// use wkt::Timestamp;
10133 /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10134 /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10135 /// ```
10136 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10137 where
10138 T: std::convert::Into<wkt::Timestamp>,
10139 {
10140 self.update_time = v.map(|x| x.into());
10141 self
10142 }
10143}
10144
10145impl wkt::message::Message for ExportMetadata {
10146 fn typename() -> &'static str {
10147 "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10148 }
10149}
10150
10151/// Response of the ExportAnalyticsMetricsRequest. If the long running
10152/// operation was successful, then this message is returned by the
10153/// google.longrunning.Operations.response field if the operation was successful.
10154#[derive(Clone, Default, PartialEq)]
10155#[non_exhaustive]
10156pub struct ExportAnalyticsMetricsResponse {
10157 /// A sample of errors encountered while processing the request.
10158 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
10159
10160 /// This field is never set.
10161 pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10162
10163 /// Output result indicating where the data were exported to.
10164 pub output_result: std::option::Option<crate::model::OutputResult>,
10165
10166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10167}
10168
10169impl ExportAnalyticsMetricsResponse {
10170 pub fn new() -> Self {
10171 std::default::Default::default()
10172 }
10173
10174 /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10175 ///
10176 /// # Example
10177 /// ```ignore,no_run
10178 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10179 /// use google_cloud_rpc::model::Status;
10180 /// let x = ExportAnalyticsMetricsResponse::new()
10181 /// .set_error_samples([
10182 /// Status::default()/* use setters */,
10183 /// Status::default()/* use (different) setters */,
10184 /// ]);
10185 /// ```
10186 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10187 where
10188 T: std::iter::IntoIterator<Item = V>,
10189 V: std::convert::Into<google_cloud_rpc::model::Status>,
10190 {
10191 use std::iter::Iterator;
10192 self.error_samples = v.into_iter().map(|i| i.into()).collect();
10193 self
10194 }
10195
10196 /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10197 ///
10198 /// # Example
10199 /// ```ignore,no_run
10200 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10201 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10202 /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10203 /// ```
10204 pub fn set_errors_config<T>(mut self, v: T) -> Self
10205 where
10206 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10207 {
10208 self.errors_config = std::option::Option::Some(v.into());
10209 self
10210 }
10211
10212 /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10213 ///
10214 /// # Example
10215 /// ```ignore,no_run
10216 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10217 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10218 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10219 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10220 /// ```
10221 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10222 where
10223 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10224 {
10225 self.errors_config = v.map(|x| x.into());
10226 self
10227 }
10228
10229 /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10230 ///
10231 /// # Example
10232 /// ```ignore,no_run
10233 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10234 /// use google_cloud_retail_v2::model::OutputResult;
10235 /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10236 /// ```
10237 pub fn set_output_result<T>(mut self, v: T) -> Self
10238 where
10239 T: std::convert::Into<crate::model::OutputResult>,
10240 {
10241 self.output_result = std::option::Option::Some(v.into());
10242 self
10243 }
10244
10245 /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10246 ///
10247 /// # Example
10248 /// ```ignore,no_run
10249 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10250 /// use google_cloud_retail_v2::model::OutputResult;
10251 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10252 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10253 /// ```
10254 pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10255 where
10256 T: std::convert::Into<crate::model::OutputResult>,
10257 {
10258 self.output_result = v.map(|x| x.into());
10259 self
10260 }
10261}
10262
10263impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10264 fn typename() -> &'static str {
10265 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10266 }
10267}
10268
10269/// Output result that stores the information about where the exported data is
10270/// stored.
10271#[derive(Clone, Default, PartialEq)]
10272#[non_exhaustive]
10273pub struct OutputResult {
10274 /// The BigQuery location where the result is stored.
10275 pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10276
10277 /// The Google Cloud Storage location where the result is stored.
10278 pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10279
10280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10281}
10282
10283impl OutputResult {
10284 pub fn new() -> Self {
10285 std::default::Default::default()
10286 }
10287
10288 /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10289 ///
10290 /// # Example
10291 /// ```ignore,no_run
10292 /// # use google_cloud_retail_v2::model::OutputResult;
10293 /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10294 /// let x = OutputResult::new()
10295 /// .set_bigquery_result([
10296 /// BigQueryOutputResult::default()/* use setters */,
10297 /// BigQueryOutputResult::default()/* use (different) setters */,
10298 /// ]);
10299 /// ```
10300 pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10301 where
10302 T: std::iter::IntoIterator<Item = V>,
10303 V: std::convert::Into<crate::model::BigQueryOutputResult>,
10304 {
10305 use std::iter::Iterator;
10306 self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10307 self
10308 }
10309
10310 /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10311 ///
10312 /// # Example
10313 /// ```ignore,no_run
10314 /// # use google_cloud_retail_v2::model::OutputResult;
10315 /// use google_cloud_retail_v2::model::GcsOutputResult;
10316 /// let x = OutputResult::new()
10317 /// .set_gcs_result([
10318 /// GcsOutputResult::default()/* use setters */,
10319 /// GcsOutputResult::default()/* use (different) setters */,
10320 /// ]);
10321 /// ```
10322 pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10323 where
10324 T: std::iter::IntoIterator<Item = V>,
10325 V: std::convert::Into<crate::model::GcsOutputResult>,
10326 {
10327 use std::iter::Iterator;
10328 self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10329 self
10330 }
10331}
10332
10333impl wkt::message::Message for OutputResult {
10334 fn typename() -> &'static str {
10335 "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10336 }
10337}
10338
10339/// A BigQuery output result.
10340#[derive(Clone, Default, PartialEq)]
10341#[non_exhaustive]
10342pub struct BigQueryOutputResult {
10343 /// The ID of a BigQuery Dataset.
10344 pub dataset_id: std::string::String,
10345
10346 /// The ID of a BigQuery Table.
10347 pub table_id: std::string::String,
10348
10349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10350}
10351
10352impl BigQueryOutputResult {
10353 pub fn new() -> Self {
10354 std::default::Default::default()
10355 }
10356
10357 /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10358 ///
10359 /// # Example
10360 /// ```ignore,no_run
10361 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10362 /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10363 /// ```
10364 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10365 self.dataset_id = v.into();
10366 self
10367 }
10368
10369 /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10370 ///
10371 /// # Example
10372 /// ```ignore,no_run
10373 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10374 /// let x = BigQueryOutputResult::new().set_table_id("example");
10375 /// ```
10376 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10377 self.table_id = v.into();
10378 self
10379 }
10380}
10381
10382impl wkt::message::Message for BigQueryOutputResult {
10383 fn typename() -> &'static str {
10384 "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10385 }
10386}
10387
10388/// A Gcs output result.
10389#[derive(Clone, Default, PartialEq)]
10390#[non_exhaustive]
10391pub struct GcsOutputResult {
10392 /// The uri of Gcs output
10393 pub output_uri: std::string::String,
10394
10395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10396}
10397
10398impl GcsOutputResult {
10399 pub fn new() -> Self {
10400 std::default::Default::default()
10401 }
10402
10403 /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10404 ///
10405 /// # Example
10406 /// ```ignore,no_run
10407 /// # use google_cloud_retail_v2::model::GcsOutputResult;
10408 /// let x = GcsOutputResult::new().set_output_uri("example");
10409 /// ```
10410 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10411 self.output_uri = v.into();
10412 self
10413 }
10414}
10415
10416impl wkt::message::Message for GcsOutputResult {
10417 fn typename() -> &'static str {
10418 "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10419 }
10420}
10421
10422/// Configuration for overall generative question feature state.
10423#[derive(Clone, Default, PartialEq)]
10424#[non_exhaustive]
10425pub struct GenerativeQuestionsFeatureConfig {
10426 /// Required. Resource name of the affected catalog.
10427 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10428 pub catalog: std::string::String,
10429
10430 /// Optional. Determines whether questions will be used at serving time.
10431 /// Note: This feature cannot be enabled until initial data requirements are
10432 /// satisfied.
10433 pub feature_enabled: bool,
10434
10435 /// Optional. Minimum number of products in the response to trigger follow-up
10436 /// questions. Value must be 0 or positive.
10437 pub minimum_products: i32,
10438
10439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10440}
10441
10442impl GenerativeQuestionsFeatureConfig {
10443 pub fn new() -> Self {
10444 std::default::Default::default()
10445 }
10446
10447 /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10448 ///
10449 /// # Example
10450 /// ```ignore,no_run
10451 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10452 /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10453 /// ```
10454 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10455 self.catalog = v.into();
10456 self
10457 }
10458
10459 /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10460 ///
10461 /// # Example
10462 /// ```ignore,no_run
10463 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10464 /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10465 /// ```
10466 pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10467 self.feature_enabled = v.into();
10468 self
10469 }
10470
10471 /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10472 ///
10473 /// # Example
10474 /// ```ignore,no_run
10475 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10476 /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10477 /// ```
10478 pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10479 self.minimum_products = v.into();
10480 self
10481 }
10482}
10483
10484impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10485 fn typename() -> &'static str {
10486 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10487 }
10488}
10489
10490/// Configuration for a single generated question.
10491#[derive(Clone, Default, PartialEq)]
10492#[non_exhaustive]
10493pub struct GenerativeQuestionConfig {
10494 /// Required. Resource name of the catalog.
10495 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10496 pub catalog: std::string::String,
10497
10498 /// Required. The facet to which the question is associated.
10499 pub facet: std::string::String,
10500
10501 /// Output only. The LLM generated question.
10502 pub generated_question: std::string::String,
10503
10504 /// Optional. The question that will be used at serving time.
10505 /// Question can have a max length of 300 bytes.
10506 /// When not populated, generated_question should be used.
10507 pub final_question: std::string::String,
10508
10509 /// Output only. Values that can be used to answer the question.
10510 pub example_values: std::vec::Vec<std::string::String>,
10511
10512 /// Output only. The ratio of how often a question was asked.
10513 pub frequency: f32,
10514
10515 /// Optional. Whether the question is asked at serving time.
10516 pub allowed_in_conversation: bool,
10517
10518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10519}
10520
10521impl GenerativeQuestionConfig {
10522 pub fn new() -> Self {
10523 std::default::Default::default()
10524 }
10525
10526 /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10527 ///
10528 /// # Example
10529 /// ```ignore,no_run
10530 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10531 /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10532 /// ```
10533 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10534 self.catalog = v.into();
10535 self
10536 }
10537
10538 /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10539 ///
10540 /// # Example
10541 /// ```ignore,no_run
10542 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10543 /// let x = GenerativeQuestionConfig::new().set_facet("example");
10544 /// ```
10545 pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10546 self.facet = v.into();
10547 self
10548 }
10549
10550 /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10551 ///
10552 /// # Example
10553 /// ```ignore,no_run
10554 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10555 /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10556 /// ```
10557 pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10558 mut self,
10559 v: T,
10560 ) -> Self {
10561 self.generated_question = v.into();
10562 self
10563 }
10564
10565 /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10566 ///
10567 /// # Example
10568 /// ```ignore,no_run
10569 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10570 /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10571 /// ```
10572 pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10573 self.final_question = v.into();
10574 self
10575 }
10576
10577 /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10578 ///
10579 /// # Example
10580 /// ```ignore,no_run
10581 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10582 /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10583 /// ```
10584 pub fn set_example_values<T, V>(mut self, v: T) -> Self
10585 where
10586 T: std::iter::IntoIterator<Item = V>,
10587 V: std::convert::Into<std::string::String>,
10588 {
10589 use std::iter::Iterator;
10590 self.example_values = v.into_iter().map(|i| i.into()).collect();
10591 self
10592 }
10593
10594 /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10595 ///
10596 /// # Example
10597 /// ```ignore,no_run
10598 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10599 /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10600 /// ```
10601 pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10602 self.frequency = v.into();
10603 self
10604 }
10605
10606 /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10607 ///
10608 /// # Example
10609 /// ```ignore,no_run
10610 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10611 /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10612 /// ```
10613 pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10614 self.allowed_in_conversation = v.into();
10615 self
10616 }
10617}
10618
10619impl wkt::message::Message for GenerativeQuestionConfig {
10620 fn typename() -> &'static str {
10621 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10622 }
10623}
10624
10625/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10626#[derive(Clone, Default, PartialEq)]
10627#[non_exhaustive]
10628pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10629 /// Required. The configuration managing the feature state.
10630 pub generative_questions_feature_config:
10631 std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10632
10633 /// Optional. Indicates which fields in the provided
10634 /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10635 /// to update. If not set or empty, all supported fields are updated.
10636 ///
10637 /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10638 pub update_mask: std::option::Option<wkt::FieldMask>,
10639
10640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10641}
10642
10643impl UpdateGenerativeQuestionsFeatureConfigRequest {
10644 pub fn new() -> Self {
10645 std::default::Default::default()
10646 }
10647
10648 /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10649 ///
10650 /// # Example
10651 /// ```ignore,no_run
10652 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10653 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10654 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10655 /// ```
10656 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10657 where
10658 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10659 {
10660 self.generative_questions_feature_config = std::option::Option::Some(v.into());
10661 self
10662 }
10663
10664 /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10665 ///
10666 /// # Example
10667 /// ```ignore,no_run
10668 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10669 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10670 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10671 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10672 /// ```
10673 pub fn set_or_clear_generative_questions_feature_config<T>(
10674 mut self,
10675 v: std::option::Option<T>,
10676 ) -> Self
10677 where
10678 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10679 {
10680 self.generative_questions_feature_config = v.map(|x| x.into());
10681 self
10682 }
10683
10684 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10685 ///
10686 /// # Example
10687 /// ```ignore,no_run
10688 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10689 /// use wkt::FieldMask;
10690 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10691 /// ```
10692 pub fn set_update_mask<T>(mut self, v: T) -> Self
10693 where
10694 T: std::convert::Into<wkt::FieldMask>,
10695 {
10696 self.update_mask = std::option::Option::Some(v.into());
10697 self
10698 }
10699
10700 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10701 ///
10702 /// # Example
10703 /// ```ignore,no_run
10704 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10705 /// use wkt::FieldMask;
10706 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10707 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10708 /// ```
10709 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10710 where
10711 T: std::convert::Into<wkt::FieldMask>,
10712 {
10713 self.update_mask = v.map(|x| x.into());
10714 self
10715 }
10716}
10717
10718impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10719 fn typename() -> &'static str {
10720 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10721 }
10722}
10723
10724/// Request for GetGenerativeQuestionsFeatureConfig method.
10725#[derive(Clone, Default, PartialEq)]
10726#[non_exhaustive]
10727pub struct GetGenerativeQuestionsFeatureConfigRequest {
10728 /// Required. Resource name of the parent catalog.
10729 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10730 pub catalog: std::string::String,
10731
10732 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10733}
10734
10735impl GetGenerativeQuestionsFeatureConfigRequest {
10736 pub fn new() -> Self {
10737 std::default::Default::default()
10738 }
10739
10740 /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10741 ///
10742 /// # Example
10743 /// ```ignore,no_run
10744 /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10745 /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog("example");
10746 /// ```
10747 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10748 self.catalog = v.into();
10749 self
10750 }
10751}
10752
10753impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10754 fn typename() -> &'static str {
10755 "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10756 }
10757}
10758
10759/// Request for ListQuestions method.
10760#[derive(Clone, Default, PartialEq)]
10761#[non_exhaustive]
10762pub struct ListGenerativeQuestionConfigsRequest {
10763 /// Required. Resource name of the parent catalog.
10764 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10765 pub parent: std::string::String,
10766
10767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10768}
10769
10770impl ListGenerativeQuestionConfigsRequest {
10771 pub fn new() -> Self {
10772 std::default::Default::default()
10773 }
10774
10775 /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10776 ///
10777 /// # Example
10778 /// ```ignore,no_run
10779 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10780 /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent("example");
10781 /// ```
10782 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10783 self.parent = v.into();
10784 self
10785 }
10786}
10787
10788impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10789 fn typename() -> &'static str {
10790 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10791 }
10792}
10793
10794/// Response for ListQuestions method.
10795#[derive(Clone, Default, PartialEq)]
10796#[non_exhaustive]
10797pub struct ListGenerativeQuestionConfigsResponse {
10798 /// All the questions for a given catalog.
10799 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10800
10801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10802}
10803
10804impl ListGenerativeQuestionConfigsResponse {
10805 pub fn new() -> Self {
10806 std::default::Default::default()
10807 }
10808
10809 /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10810 ///
10811 /// # Example
10812 /// ```ignore,no_run
10813 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10814 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10815 /// let x = ListGenerativeQuestionConfigsResponse::new()
10816 /// .set_generative_question_configs([
10817 /// GenerativeQuestionConfig::default()/* use setters */,
10818 /// GenerativeQuestionConfig::default()/* use (different) setters */,
10819 /// ]);
10820 /// ```
10821 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10822 where
10823 T: std::iter::IntoIterator<Item = V>,
10824 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10825 {
10826 use std::iter::Iterator;
10827 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10828 self
10829 }
10830}
10831
10832impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10833 fn typename() -> &'static str {
10834 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10835 }
10836}
10837
10838/// Request for UpdateGenerativeQuestionConfig method.
10839#[derive(Clone, Default, PartialEq)]
10840#[non_exhaustive]
10841pub struct UpdateGenerativeQuestionConfigRequest {
10842 /// Required. The question to update.
10843 pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10844
10845 /// Optional. Indicates which fields in the provided
10846 /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10847 /// to update. The following are NOT supported:
10848 ///
10849 /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
10850 ///
10851 /// If not set or empty, all supported fields are updated.
10852 ///
10853 /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
10854 /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
10855 pub update_mask: std::option::Option<wkt::FieldMask>,
10856
10857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10858}
10859
10860impl UpdateGenerativeQuestionConfigRequest {
10861 pub fn new() -> Self {
10862 std::default::Default::default()
10863 }
10864
10865 /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10866 ///
10867 /// # Example
10868 /// ```ignore,no_run
10869 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10870 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10871 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
10872 /// ```
10873 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
10874 where
10875 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10876 {
10877 self.generative_question_config = std::option::Option::Some(v.into());
10878 self
10879 }
10880
10881 /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10882 ///
10883 /// # Example
10884 /// ```ignore,no_run
10885 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10886 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10887 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
10888 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
10889 /// ```
10890 pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
10891 where
10892 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10893 {
10894 self.generative_question_config = v.map(|x| x.into());
10895 self
10896 }
10897
10898 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10899 ///
10900 /// # Example
10901 /// ```ignore,no_run
10902 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10903 /// use wkt::FieldMask;
10904 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10905 /// ```
10906 pub fn set_update_mask<T>(mut self, v: T) -> Self
10907 where
10908 T: std::convert::Into<wkt::FieldMask>,
10909 {
10910 self.update_mask = std::option::Option::Some(v.into());
10911 self
10912 }
10913
10914 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10915 ///
10916 /// # Example
10917 /// ```ignore,no_run
10918 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10919 /// use wkt::FieldMask;
10920 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10921 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10922 /// ```
10923 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10924 where
10925 T: std::convert::Into<wkt::FieldMask>,
10926 {
10927 self.update_mask = v.map(|x| x.into());
10928 self
10929 }
10930}
10931
10932impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
10933 fn typename() -> &'static str {
10934 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
10935 }
10936}
10937
10938/// Request for BatchUpdateGenerativeQuestionConfig method.
10939#[derive(Clone, Default, PartialEq)]
10940#[non_exhaustive]
10941pub struct BatchUpdateGenerativeQuestionConfigsRequest {
10942 /// Optional. Resource name of the parent catalog.
10943 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10944 pub parent: std::string::String,
10945
10946 /// Required. The updates question configs.
10947 pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
10948
10949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10950}
10951
10952impl BatchUpdateGenerativeQuestionConfigsRequest {
10953 pub fn new() -> Self {
10954 std::default::Default::default()
10955 }
10956
10957 /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
10958 ///
10959 /// # Example
10960 /// ```ignore,no_run
10961 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10962 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent("example");
10963 /// ```
10964 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10965 self.parent = v.into();
10966 self
10967 }
10968
10969 /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
10970 ///
10971 /// # Example
10972 /// ```ignore,no_run
10973 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10974 /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10975 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
10976 /// .set_requests([
10977 /// UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
10978 /// UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
10979 /// ]);
10980 /// ```
10981 pub fn set_requests<T, V>(mut self, v: T) -> Self
10982 where
10983 T: std::iter::IntoIterator<Item = V>,
10984 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
10985 {
10986 use std::iter::Iterator;
10987 self.requests = v.into_iter().map(|i| i.into()).collect();
10988 self
10989 }
10990}
10991
10992impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
10993 fn typename() -> &'static str {
10994 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
10995 }
10996}
10997
10998/// Aggregated response for UpdateGenerativeQuestionConfig method.
10999#[derive(Clone, Default, PartialEq)]
11000#[non_exhaustive]
11001pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11002 /// Optional. The updates question configs.
11003 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11004
11005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11006}
11007
11008impl BatchUpdateGenerativeQuestionConfigsResponse {
11009 pub fn new() -> Self {
11010 std::default::Default::default()
11011 }
11012
11013 /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11014 ///
11015 /// # Example
11016 /// ```ignore,no_run
11017 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11018 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11019 /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11020 /// .set_generative_question_configs([
11021 /// GenerativeQuestionConfig::default()/* use setters */,
11022 /// GenerativeQuestionConfig::default()/* use (different) setters */,
11023 /// ]);
11024 /// ```
11025 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11026 where
11027 T: std::iter::IntoIterator<Item = V>,
11028 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11029 {
11030 use std::iter::Iterator;
11031 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11032 self
11033 }
11034}
11035
11036impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11037 fn typename() -> &'static str {
11038 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11039 }
11040}
11041
11042/// Google Cloud Storage location for input content.
11043#[derive(Clone, Default, PartialEq)]
11044#[non_exhaustive]
11045pub struct GcsSource {
11046 /// Required. Google Cloud Storage URIs to input files. URI can be up to
11047 /// 2000 characters long. URIs can match the full object path (for example,
11048 /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11049 /// files, such as `gs://bucket/directory/*.json`. A request can
11050 /// contain at most 100 files, and each file can be up to 2 GB. See
11051 /// [Importing product
11052 /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11053 /// for the expected file format and setup instructions.
11054 pub input_uris: std::vec::Vec<std::string::String>,
11055
11056 /// The schema to use when parsing the data from the source.
11057 ///
11058 /// Supported values for product imports:
11059 ///
11060 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11061 /// per line. Each product must
11062 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11063 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11064 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11065 ///
11066 /// Supported values for user events imports:
11067 ///
11068 /// * `user_event` (default): One JSON
11069 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11070 /// * `user_event_ga360`: Using
11071 /// <https://support.google.com/analytics/answer/3437719>.
11072 ///
11073 /// Supported values for control imports:
11074 ///
11075 /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11076 /// per line.
11077 ///
11078 /// Supported values for catalog attribute imports:
11079 ///
11080 /// * `catalog_attribute` (default): One CSV
11081 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11082 ///
11083 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11084 /// [google.cloud.retail.v2.Control]: crate::model::Control
11085 /// [google.cloud.retail.v2.Product]: crate::model::Product
11086 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11087 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11088 pub data_schema: std::string::String,
11089
11090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11091}
11092
11093impl GcsSource {
11094 pub fn new() -> Self {
11095 std::default::Default::default()
11096 }
11097
11098 /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11099 ///
11100 /// # Example
11101 /// ```ignore,no_run
11102 /// # use google_cloud_retail_v2::model::GcsSource;
11103 /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11104 /// ```
11105 pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11106 where
11107 T: std::iter::IntoIterator<Item = V>,
11108 V: std::convert::Into<std::string::String>,
11109 {
11110 use std::iter::Iterator;
11111 self.input_uris = v.into_iter().map(|i| i.into()).collect();
11112 self
11113 }
11114
11115 /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11116 ///
11117 /// # Example
11118 /// ```ignore,no_run
11119 /// # use google_cloud_retail_v2::model::GcsSource;
11120 /// let x = GcsSource::new().set_data_schema("example");
11121 /// ```
11122 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11123 self.data_schema = v.into();
11124 self
11125 }
11126}
11127
11128impl wkt::message::Message for GcsSource {
11129 fn typename() -> &'static str {
11130 "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11131 }
11132}
11133
11134/// BigQuery source import data from.
11135#[derive(Clone, Default, PartialEq)]
11136#[non_exhaustive]
11137pub struct BigQuerySource {
11138 /// The project ID (can be project # or ID) that the BigQuery source is in with
11139 /// a length limit of 128 characters. If not specified, inherits the project
11140 /// ID from the parent request.
11141 pub project_id: std::string::String,
11142
11143 /// Required. The BigQuery data set to copy the data from with a length limit
11144 /// of 1,024 characters.
11145 pub dataset_id: std::string::String,
11146
11147 /// Required. The BigQuery table to copy the data from with a length limit of
11148 /// 1,024 characters.
11149 pub table_id: std::string::String,
11150
11151 /// Intermediate Cloud Storage directory used for the import with a length
11152 /// limit of 2,000 characters. Can be specified if one wants to have the
11153 /// BigQuery export to a specific Cloud Storage directory.
11154 pub gcs_staging_dir: std::string::String,
11155
11156 /// The schema to use when parsing the data from the source.
11157 ///
11158 /// Supported values for product imports:
11159 ///
11160 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11161 /// per line. Each product must
11162 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11163 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11164 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11165 ///
11166 /// Supported values for user events imports:
11167 ///
11168 /// * `user_event` (default): One JSON
11169 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11170 /// * `user_event_ga360`:
11171 /// The schema is available here:
11172 /// <https://support.google.com/analytics/answer/3437719>.
11173 /// * `user_event_ga4`:
11174 /// The schema is available here:
11175 /// <https://support.google.com/analytics/answer/7029846>.
11176 ///
11177 /// Supported values for autocomplete imports:
11178 ///
11179 /// * `suggestions` (default): One JSON completion suggestion per line.
11180 /// * `denylist`: One JSON deny suggestion per line.
11181 /// * `allowlist`: One JSON allow suggestion per line.
11182 ///
11183 /// [google.cloud.retail.v2.Product]: crate::model::Product
11184 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11185 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11186 pub data_schema: std::string::String,
11187
11188 /// BigQuery table partition info. Leave this empty if the BigQuery table
11189 /// is not partitioned.
11190 pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11191
11192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11193}
11194
11195impl BigQuerySource {
11196 pub fn new() -> Self {
11197 std::default::Default::default()
11198 }
11199
11200 /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11201 ///
11202 /// # Example
11203 /// ```ignore,no_run
11204 /// # use google_cloud_retail_v2::model::BigQuerySource;
11205 /// let x = BigQuerySource::new().set_project_id("example");
11206 /// ```
11207 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11208 self.project_id = v.into();
11209 self
11210 }
11211
11212 /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11213 ///
11214 /// # Example
11215 /// ```ignore,no_run
11216 /// # use google_cloud_retail_v2::model::BigQuerySource;
11217 /// let x = BigQuerySource::new().set_dataset_id("example");
11218 /// ```
11219 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11220 self.dataset_id = v.into();
11221 self
11222 }
11223
11224 /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11225 ///
11226 /// # Example
11227 /// ```ignore,no_run
11228 /// # use google_cloud_retail_v2::model::BigQuerySource;
11229 /// let x = BigQuerySource::new().set_table_id("example");
11230 /// ```
11231 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11232 self.table_id = v.into();
11233 self
11234 }
11235
11236 /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11237 ///
11238 /// # Example
11239 /// ```ignore,no_run
11240 /// # use google_cloud_retail_v2::model::BigQuerySource;
11241 /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11242 /// ```
11243 pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11244 self.gcs_staging_dir = v.into();
11245 self
11246 }
11247
11248 /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11249 ///
11250 /// # Example
11251 /// ```ignore,no_run
11252 /// # use google_cloud_retail_v2::model::BigQuerySource;
11253 /// let x = BigQuerySource::new().set_data_schema("example");
11254 /// ```
11255 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11256 self.data_schema = v.into();
11257 self
11258 }
11259
11260 /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11261 ///
11262 /// Note that all the setters affecting `partition` are mutually
11263 /// exclusive.
11264 ///
11265 /// # Example
11266 /// ```ignore,no_run
11267 /// # use google_cloud_retail_v2::model::BigQuerySource;
11268 /// use google_cloud_type::model::Date;
11269 /// let x = BigQuerySource::new().set_partition(Some(
11270 /// google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11271 /// ```
11272 pub fn set_partition<
11273 T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11274 >(
11275 mut self,
11276 v: T,
11277 ) -> Self {
11278 self.partition = v.into();
11279 self
11280 }
11281
11282 /// The value of [partition][crate::model::BigQuerySource::partition]
11283 /// if it holds a `PartitionDate`, `None` if the field is not set or
11284 /// holds a different branch.
11285 pub fn partition_date(
11286 &self,
11287 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
11288 #[allow(unreachable_patterns)]
11289 self.partition.as_ref().and_then(|v| match v {
11290 crate::model::big_query_source::Partition::PartitionDate(v) => {
11291 std::option::Option::Some(v)
11292 }
11293 _ => std::option::Option::None,
11294 })
11295 }
11296
11297 /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11298 /// to hold a `PartitionDate`.
11299 ///
11300 /// Note that all the setters affecting `partition` are
11301 /// mutually exclusive.
11302 ///
11303 /// # Example
11304 /// ```ignore,no_run
11305 /// # use google_cloud_retail_v2::model::BigQuerySource;
11306 /// use google_cloud_type::model::Date;
11307 /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11308 /// assert!(x.partition_date().is_some());
11309 /// ```
11310 pub fn set_partition_date<
11311 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
11312 >(
11313 mut self,
11314 v: T,
11315 ) -> Self {
11316 self.partition = std::option::Option::Some(
11317 crate::model::big_query_source::Partition::PartitionDate(v.into()),
11318 );
11319 self
11320 }
11321}
11322
11323impl wkt::message::Message for BigQuerySource {
11324 fn typename() -> &'static str {
11325 "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11326 }
11327}
11328
11329/// Defines additional types related to [BigQuerySource].
11330pub mod big_query_source {
11331 #[allow(unused_imports)]
11332 use super::*;
11333
11334 /// BigQuery table partition info. Leave this empty if the BigQuery table
11335 /// is not partitioned.
11336 #[derive(Clone, Debug, PartialEq)]
11337 #[non_exhaustive]
11338 pub enum Partition {
11339 /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11340 PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
11341 }
11342}
11343
11344/// The inline source for the input config for ImportProducts method.
11345#[derive(Clone, Default, PartialEq)]
11346#[non_exhaustive]
11347pub struct ProductInlineSource {
11348 /// Required. A list of products to update/create. Each product must have a
11349 /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11350 /// 100 items.
11351 ///
11352 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11353 pub products: std::vec::Vec<crate::model::Product>,
11354
11355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11356}
11357
11358impl ProductInlineSource {
11359 pub fn new() -> Self {
11360 std::default::Default::default()
11361 }
11362
11363 /// Sets the value of [products][crate::model::ProductInlineSource::products].
11364 ///
11365 /// # Example
11366 /// ```ignore,no_run
11367 /// # use google_cloud_retail_v2::model::ProductInlineSource;
11368 /// use google_cloud_retail_v2::model::Product;
11369 /// let x = ProductInlineSource::new()
11370 /// .set_products([
11371 /// Product::default()/* use setters */,
11372 /// Product::default()/* use (different) setters */,
11373 /// ]);
11374 /// ```
11375 pub fn set_products<T, V>(mut self, v: T) -> Self
11376 where
11377 T: std::iter::IntoIterator<Item = V>,
11378 V: std::convert::Into<crate::model::Product>,
11379 {
11380 use std::iter::Iterator;
11381 self.products = v.into_iter().map(|i| i.into()).collect();
11382 self
11383 }
11384}
11385
11386impl wkt::message::Message for ProductInlineSource {
11387 fn typename() -> &'static str {
11388 "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11389 }
11390}
11391
11392/// The inline source for the input config for ImportUserEvents method.
11393#[derive(Clone, Default, PartialEq)]
11394#[non_exhaustive]
11395pub struct UserEventInlineSource {
11396 /// Required. A list of user events to import. Recommended max of 10k items.
11397 pub user_events: std::vec::Vec<crate::model::UserEvent>,
11398
11399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11400}
11401
11402impl UserEventInlineSource {
11403 pub fn new() -> Self {
11404 std::default::Default::default()
11405 }
11406
11407 /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11408 ///
11409 /// # Example
11410 /// ```ignore,no_run
11411 /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11412 /// use google_cloud_retail_v2::model::UserEvent;
11413 /// let x = UserEventInlineSource::new()
11414 /// .set_user_events([
11415 /// UserEvent::default()/* use setters */,
11416 /// UserEvent::default()/* use (different) setters */,
11417 /// ]);
11418 /// ```
11419 pub fn set_user_events<T, V>(mut self, v: T) -> Self
11420 where
11421 T: std::iter::IntoIterator<Item = V>,
11422 V: std::convert::Into<crate::model::UserEvent>,
11423 {
11424 use std::iter::Iterator;
11425 self.user_events = v.into_iter().map(|i| i.into()).collect();
11426 self
11427 }
11428}
11429
11430impl wkt::message::Message for UserEventInlineSource {
11431 fn typename() -> &'static str {
11432 "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11433 }
11434}
11435
11436/// Configuration of destination for Import related errors.
11437#[derive(Clone, Default, PartialEq)]
11438#[non_exhaustive]
11439pub struct ImportErrorsConfig {
11440 /// Required. Errors destination.
11441 pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11442
11443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11444}
11445
11446impl ImportErrorsConfig {
11447 pub fn new() -> Self {
11448 std::default::Default::default()
11449 }
11450
11451 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11452 ///
11453 /// Note that all the setters affecting `destination` are mutually
11454 /// exclusive.
11455 ///
11456 /// # Example
11457 /// ```ignore,no_run
11458 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11459 /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11460 /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11461 /// ```
11462 pub fn set_destination<
11463 T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11464 >(
11465 mut self,
11466 v: T,
11467 ) -> Self {
11468 self.destination = v.into();
11469 self
11470 }
11471
11472 /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11473 /// if it holds a `GcsPrefix`, `None` if the field is not set or
11474 /// holds a different branch.
11475 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11476 #[allow(unreachable_patterns)]
11477 self.destination.as_ref().and_then(|v| match v {
11478 crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11479 std::option::Option::Some(v)
11480 }
11481 _ => std::option::Option::None,
11482 })
11483 }
11484
11485 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11486 /// to hold a `GcsPrefix`.
11487 ///
11488 /// Note that all the setters affecting `destination` are
11489 /// mutually exclusive.
11490 ///
11491 /// # Example
11492 /// ```ignore,no_run
11493 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11494 /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11495 /// assert!(x.gcs_prefix().is_some());
11496 /// ```
11497 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11498 self.destination = std::option::Option::Some(
11499 crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11500 );
11501 self
11502 }
11503}
11504
11505impl wkt::message::Message for ImportErrorsConfig {
11506 fn typename() -> &'static str {
11507 "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11508 }
11509}
11510
11511/// Defines additional types related to [ImportErrorsConfig].
11512pub mod import_errors_config {
11513 #[allow(unused_imports)]
11514 use super::*;
11515
11516 /// Required. Errors destination.
11517 #[derive(Clone, Debug, PartialEq)]
11518 #[non_exhaustive]
11519 pub enum Destination {
11520 /// Google Cloud Storage prefix for import errors. This must be an empty,
11521 /// existing Cloud Storage directory. Import errors are written to
11522 /// sharded files in this directory, one per line, as a JSON-encoded
11523 /// `google.rpc.Status` message.
11524 GcsPrefix(std::string::String),
11525 }
11526}
11527
11528/// Request message for Import methods.
11529#[derive(Clone, Default, PartialEq)]
11530#[non_exhaustive]
11531pub struct ImportProductsRequest {
11532 /// Required.
11533 /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11534 ///
11535 /// If no updateMask is specified, requires products.create permission.
11536 /// If updateMask is specified, requires products.update permission.
11537 pub parent: std::string::String,
11538
11539 /// Deprecated. This field has no effect.
11540 #[deprecated]
11541 pub request_id: std::string::String,
11542
11543 /// Required. The desired input location of the data.
11544 pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11545
11546 /// The desired location of errors incurred during the Import.
11547 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11548
11549 /// Indicates which fields in the provided imported `products` to update. If
11550 /// not set, all fields are updated. If provided, only the existing product
11551 /// fields are updated. Missing products will not be created.
11552 pub update_mask: std::option::Option<wkt::FieldMask>,
11553
11554 /// The mode of reconciliation between existing products and the products to be
11555 /// imported. Defaults to
11556 /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11557 ///
11558 /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11559 pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11560
11561 /// Full Pub/Sub topic name for receiving notification. If this field is set,
11562 /// when the import is finished, a notification is sent to
11563 /// specified Pub/Sub topic. The message data is JSON string of a
11564 /// [Operation][google.longrunning.Operation].
11565 ///
11566 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11567 /// to be within the same project as
11568 /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11569 /// Make sure that both
11570 /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11571 /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11572 /// have the `pubsub.topics.publish` IAM permission on the topic.
11573 ///
11574 /// Only supported when
11575 /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11576 /// is set to `FULL`.
11577 ///
11578 /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11579 /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11580 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
11581 pub notification_pubsub_topic: std::string::String,
11582
11583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11584}
11585
11586impl ImportProductsRequest {
11587 pub fn new() -> Self {
11588 std::default::Default::default()
11589 }
11590
11591 /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11592 ///
11593 /// # Example
11594 /// ```ignore,no_run
11595 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11596 /// let x = ImportProductsRequest::new().set_parent("example");
11597 /// ```
11598 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11599 self.parent = v.into();
11600 self
11601 }
11602
11603 /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11604 ///
11605 /// # Example
11606 /// ```ignore,no_run
11607 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11608 /// let x = ImportProductsRequest::new().set_request_id("example");
11609 /// ```
11610 #[deprecated]
11611 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11612 self.request_id = v.into();
11613 self
11614 }
11615
11616 /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11617 ///
11618 /// # Example
11619 /// ```ignore,no_run
11620 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11621 /// use google_cloud_retail_v2::model::ProductInputConfig;
11622 /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11623 /// ```
11624 pub fn set_input_config<T>(mut self, v: T) -> Self
11625 where
11626 T: std::convert::Into<crate::model::ProductInputConfig>,
11627 {
11628 self.input_config = std::option::Option::Some(v.into());
11629 self
11630 }
11631
11632 /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11633 ///
11634 /// # Example
11635 /// ```ignore,no_run
11636 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11637 /// use google_cloud_retail_v2::model::ProductInputConfig;
11638 /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11639 /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11640 /// ```
11641 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11642 where
11643 T: std::convert::Into<crate::model::ProductInputConfig>,
11644 {
11645 self.input_config = v.map(|x| x.into());
11646 self
11647 }
11648
11649 /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11650 ///
11651 /// # Example
11652 /// ```ignore,no_run
11653 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11654 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11655 /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11656 /// ```
11657 pub fn set_errors_config<T>(mut self, v: T) -> Self
11658 where
11659 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11660 {
11661 self.errors_config = std::option::Option::Some(v.into());
11662 self
11663 }
11664
11665 /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11666 ///
11667 /// # Example
11668 /// ```ignore,no_run
11669 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11670 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11671 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11672 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11673 /// ```
11674 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11675 where
11676 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11677 {
11678 self.errors_config = v.map(|x| x.into());
11679 self
11680 }
11681
11682 /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11683 ///
11684 /// # Example
11685 /// ```ignore,no_run
11686 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11687 /// use wkt::FieldMask;
11688 /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11689 /// ```
11690 pub fn set_update_mask<T>(mut self, v: T) -> Self
11691 where
11692 T: std::convert::Into<wkt::FieldMask>,
11693 {
11694 self.update_mask = std::option::Option::Some(v.into());
11695 self
11696 }
11697
11698 /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11699 ///
11700 /// # Example
11701 /// ```ignore,no_run
11702 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11703 /// use wkt::FieldMask;
11704 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11705 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11706 /// ```
11707 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11708 where
11709 T: std::convert::Into<wkt::FieldMask>,
11710 {
11711 self.update_mask = v.map(|x| x.into());
11712 self
11713 }
11714
11715 /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11716 ///
11717 /// # Example
11718 /// ```ignore,no_run
11719 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11720 /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11721 /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11722 /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11723 /// ```
11724 pub fn set_reconciliation_mode<
11725 T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11726 >(
11727 mut self,
11728 v: T,
11729 ) -> Self {
11730 self.reconciliation_mode = v.into();
11731 self
11732 }
11733
11734 /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11735 ///
11736 /// # Example
11737 /// ```ignore,no_run
11738 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11739 /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11740 /// ```
11741 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11742 mut self,
11743 v: T,
11744 ) -> Self {
11745 self.notification_pubsub_topic = v.into();
11746 self
11747 }
11748}
11749
11750impl wkt::message::Message for ImportProductsRequest {
11751 fn typename() -> &'static str {
11752 "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11753 }
11754}
11755
11756/// Defines additional types related to [ImportProductsRequest].
11757pub mod import_products_request {
11758 #[allow(unused_imports)]
11759 use super::*;
11760
11761 /// Indicates how imported products are reconciled with the existing products
11762 /// created or imported before.
11763 ///
11764 /// # Working with unknown values
11765 ///
11766 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11767 /// additional enum variants at any time. Adding new variants is not considered
11768 /// a breaking change. Applications should write their code in anticipation of:
11769 ///
11770 /// - New values appearing in future releases of the client library, **and**
11771 /// - New values received dynamically, without application changes.
11772 ///
11773 /// Please consult the [Working with enums] section in the user guide for some
11774 /// guidelines.
11775 ///
11776 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11777 #[derive(Clone, Debug, PartialEq)]
11778 #[non_exhaustive]
11779 pub enum ReconciliationMode {
11780 /// Defaults to INCREMENTAL.
11781 Unspecified,
11782 /// Inserts new products or updates existing products.
11783 Incremental,
11784 /// Calculates diff and replaces the entire product dataset. Existing
11785 /// products may be deleted if they are not present in the source location.
11786 Full,
11787 /// If set, the enum was initialized with an unknown value.
11788 ///
11789 /// Applications can examine the value using [ReconciliationMode::value] or
11790 /// [ReconciliationMode::name].
11791 UnknownValue(reconciliation_mode::UnknownValue),
11792 }
11793
11794 #[doc(hidden)]
11795 pub mod reconciliation_mode {
11796 #[allow(unused_imports)]
11797 use super::*;
11798 #[derive(Clone, Debug, PartialEq)]
11799 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11800 }
11801
11802 impl ReconciliationMode {
11803 /// Gets the enum value.
11804 ///
11805 /// Returns `None` if the enum contains an unknown value deserialized from
11806 /// the string representation of enums.
11807 pub fn value(&self) -> std::option::Option<i32> {
11808 match self {
11809 Self::Unspecified => std::option::Option::Some(0),
11810 Self::Incremental => std::option::Option::Some(1),
11811 Self::Full => std::option::Option::Some(2),
11812 Self::UnknownValue(u) => u.0.value(),
11813 }
11814 }
11815
11816 /// Gets the enum value as a string.
11817 ///
11818 /// Returns `None` if the enum contains an unknown value deserialized from
11819 /// the integer representation of enums.
11820 pub fn name(&self) -> std::option::Option<&str> {
11821 match self {
11822 Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11823 Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11824 Self::Full => std::option::Option::Some("FULL"),
11825 Self::UnknownValue(u) => u.0.name(),
11826 }
11827 }
11828 }
11829
11830 impl std::default::Default for ReconciliationMode {
11831 fn default() -> Self {
11832 use std::convert::From;
11833 Self::from(0)
11834 }
11835 }
11836
11837 impl std::fmt::Display for ReconciliationMode {
11838 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11839 wkt::internal::display_enum(f, self.name(), self.value())
11840 }
11841 }
11842
11843 impl std::convert::From<i32> for ReconciliationMode {
11844 fn from(value: i32) -> Self {
11845 match value {
11846 0 => Self::Unspecified,
11847 1 => Self::Incremental,
11848 2 => Self::Full,
11849 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11850 wkt::internal::UnknownEnumValue::Integer(value),
11851 )),
11852 }
11853 }
11854 }
11855
11856 impl std::convert::From<&str> for ReconciliationMode {
11857 fn from(value: &str) -> Self {
11858 use std::string::ToString;
11859 match value {
11860 "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
11861 "INCREMENTAL" => Self::Incremental,
11862 "FULL" => Self::Full,
11863 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11864 wkt::internal::UnknownEnumValue::String(value.to_string()),
11865 )),
11866 }
11867 }
11868 }
11869
11870 impl serde::ser::Serialize for ReconciliationMode {
11871 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11872 where
11873 S: serde::Serializer,
11874 {
11875 match self {
11876 Self::Unspecified => serializer.serialize_i32(0),
11877 Self::Incremental => serializer.serialize_i32(1),
11878 Self::Full => serializer.serialize_i32(2),
11879 Self::UnknownValue(u) => u.0.serialize(serializer),
11880 }
11881 }
11882 }
11883
11884 impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
11885 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11886 where
11887 D: serde::Deserializer<'de>,
11888 {
11889 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
11890 ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
11891 ))
11892 }
11893 }
11894}
11895
11896/// Request message for the ImportUserEvents request.
11897#[derive(Clone, Default, PartialEq)]
11898#[non_exhaustive]
11899pub struct ImportUserEventsRequest {
11900 /// Required. `projects/1234/locations/global/catalogs/default_catalog`
11901 pub parent: std::string::String,
11902
11903 /// Required. The desired input location of the data.
11904 pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
11905
11906 /// The desired location of errors incurred during the Import. Cannot be set
11907 /// for inline user event imports.
11908 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11909
11910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11911}
11912
11913impl ImportUserEventsRequest {
11914 pub fn new() -> Self {
11915 std::default::Default::default()
11916 }
11917
11918 /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
11919 ///
11920 /// # Example
11921 /// ```ignore,no_run
11922 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11923 /// let x = ImportUserEventsRequest::new().set_parent("example");
11924 /// ```
11925 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11926 self.parent = v.into();
11927 self
11928 }
11929
11930 /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11931 ///
11932 /// # Example
11933 /// ```ignore,no_run
11934 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11935 /// use google_cloud_retail_v2::model::UserEventInputConfig;
11936 /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
11937 /// ```
11938 pub fn set_input_config<T>(mut self, v: T) -> Self
11939 where
11940 T: std::convert::Into<crate::model::UserEventInputConfig>,
11941 {
11942 self.input_config = std::option::Option::Some(v.into());
11943 self
11944 }
11945
11946 /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11951 /// use google_cloud_retail_v2::model::UserEventInputConfig;
11952 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
11953 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
11954 /// ```
11955 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11956 where
11957 T: std::convert::Into<crate::model::UserEventInputConfig>,
11958 {
11959 self.input_config = v.map(|x| x.into());
11960 self
11961 }
11962
11963 /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11964 ///
11965 /// # Example
11966 /// ```ignore,no_run
11967 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11968 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11969 /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11970 /// ```
11971 pub fn set_errors_config<T>(mut self, v: T) -> Self
11972 where
11973 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11974 {
11975 self.errors_config = std::option::Option::Some(v.into());
11976 self
11977 }
11978
11979 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11980 ///
11981 /// # Example
11982 /// ```ignore,no_run
11983 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11984 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11985 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11986 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11987 /// ```
11988 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11989 where
11990 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11991 {
11992 self.errors_config = v.map(|x| x.into());
11993 self
11994 }
11995}
11996
11997impl wkt::message::Message for ImportUserEventsRequest {
11998 fn typename() -> &'static str {
11999 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
12000 }
12001}
12002
12003/// Request message for ImportCompletionData methods.
12004#[derive(Clone, Default, PartialEq)]
12005#[non_exhaustive]
12006pub struct ImportCompletionDataRequest {
12007 /// Required. The catalog which the suggestions dataset belongs to.
12008 ///
12009 /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12010 pub parent: std::string::String,
12011
12012 /// Required. The desired input location of the data.
12013 pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12014
12015 /// Pub/Sub topic for receiving notification. If this field is set,
12016 /// when the import is finished, a notification is sent to
12017 /// specified Pub/Sub topic. The message data is JSON string of a
12018 /// [Operation][google.longrunning.Operation].
12019 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12020 ///
12021 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12022 pub notification_pubsub_topic: std::string::String,
12023
12024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12025}
12026
12027impl ImportCompletionDataRequest {
12028 pub fn new() -> Self {
12029 std::default::Default::default()
12030 }
12031
12032 /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12033 ///
12034 /// # Example
12035 /// ```ignore,no_run
12036 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12037 /// let x = ImportCompletionDataRequest::new().set_parent("example");
12038 /// ```
12039 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12040 self.parent = v.into();
12041 self
12042 }
12043
12044 /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12045 ///
12046 /// # Example
12047 /// ```ignore,no_run
12048 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12049 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12050 /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12051 /// ```
12052 pub fn set_input_config<T>(mut self, v: T) -> Self
12053 where
12054 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12055 {
12056 self.input_config = std::option::Option::Some(v.into());
12057 self
12058 }
12059
12060 /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12061 ///
12062 /// # Example
12063 /// ```ignore,no_run
12064 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12065 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12066 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12067 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12068 /// ```
12069 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12070 where
12071 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12072 {
12073 self.input_config = v.map(|x| x.into());
12074 self
12075 }
12076
12077 /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12078 ///
12079 /// # Example
12080 /// ```ignore,no_run
12081 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12082 /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12083 /// ```
12084 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12085 mut self,
12086 v: T,
12087 ) -> Self {
12088 self.notification_pubsub_topic = v.into();
12089 self
12090 }
12091}
12092
12093impl wkt::message::Message for ImportCompletionDataRequest {
12094 fn typename() -> &'static str {
12095 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12096 }
12097}
12098
12099/// The input config source for products.
12100#[derive(Clone, Default, PartialEq)]
12101#[non_exhaustive]
12102pub struct ProductInputConfig {
12103 /// Required. The source of the input.
12104 pub source: std::option::Option<crate::model::product_input_config::Source>,
12105
12106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12107}
12108
12109impl ProductInputConfig {
12110 pub fn new() -> Self {
12111 std::default::Default::default()
12112 }
12113
12114 /// Sets the value of [source][crate::model::ProductInputConfig::source].
12115 ///
12116 /// Note that all the setters affecting `source` are mutually
12117 /// exclusive.
12118 ///
12119 /// # Example
12120 /// ```ignore,no_run
12121 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12122 /// use google_cloud_retail_v2::model::ProductInlineSource;
12123 /// let x = ProductInputConfig::new().set_source(Some(
12124 /// google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12125 /// ```
12126 pub fn set_source<
12127 T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12128 >(
12129 mut self,
12130 v: T,
12131 ) -> Self {
12132 self.source = v.into();
12133 self
12134 }
12135
12136 /// The value of [source][crate::model::ProductInputConfig::source]
12137 /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12138 /// holds a different branch.
12139 pub fn product_inline_source(
12140 &self,
12141 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12142 #[allow(unreachable_patterns)]
12143 self.source.as_ref().and_then(|v| match v {
12144 crate::model::product_input_config::Source::ProductInlineSource(v) => {
12145 std::option::Option::Some(v)
12146 }
12147 _ => std::option::Option::None,
12148 })
12149 }
12150
12151 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12152 /// to hold a `ProductInlineSource`.
12153 ///
12154 /// Note that all the setters affecting `source` are
12155 /// mutually exclusive.
12156 ///
12157 /// # Example
12158 /// ```ignore,no_run
12159 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12160 /// use google_cloud_retail_v2::model::ProductInlineSource;
12161 /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12162 /// assert!(x.product_inline_source().is_some());
12163 /// assert!(x.gcs_source().is_none());
12164 /// assert!(x.big_query_source().is_none());
12165 /// ```
12166 pub fn set_product_inline_source<
12167 T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12168 >(
12169 mut self,
12170 v: T,
12171 ) -> Self {
12172 self.source = std::option::Option::Some(
12173 crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12174 );
12175 self
12176 }
12177
12178 /// The value of [source][crate::model::ProductInputConfig::source]
12179 /// if it holds a `GcsSource`, `None` if the field is not set or
12180 /// holds a different branch.
12181 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12182 #[allow(unreachable_patterns)]
12183 self.source.as_ref().and_then(|v| match v {
12184 crate::model::product_input_config::Source::GcsSource(v) => {
12185 std::option::Option::Some(v)
12186 }
12187 _ => std::option::Option::None,
12188 })
12189 }
12190
12191 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12192 /// to hold a `GcsSource`.
12193 ///
12194 /// Note that all the setters affecting `source` are
12195 /// mutually exclusive.
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12200 /// use google_cloud_retail_v2::model::GcsSource;
12201 /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12202 /// assert!(x.gcs_source().is_some());
12203 /// assert!(x.product_inline_source().is_none());
12204 /// assert!(x.big_query_source().is_none());
12205 /// ```
12206 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12207 mut self,
12208 v: T,
12209 ) -> Self {
12210 self.source = std::option::Option::Some(
12211 crate::model::product_input_config::Source::GcsSource(v.into()),
12212 );
12213 self
12214 }
12215
12216 /// The value of [source][crate::model::ProductInputConfig::source]
12217 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12218 /// holds a different branch.
12219 pub fn big_query_source(
12220 &self,
12221 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12222 #[allow(unreachable_patterns)]
12223 self.source.as_ref().and_then(|v| match v {
12224 crate::model::product_input_config::Source::BigQuerySource(v) => {
12225 std::option::Option::Some(v)
12226 }
12227 _ => std::option::Option::None,
12228 })
12229 }
12230
12231 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12232 /// to hold a `BigQuerySource`.
12233 ///
12234 /// Note that all the setters affecting `source` are
12235 /// mutually exclusive.
12236 ///
12237 /// # Example
12238 /// ```ignore,no_run
12239 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12240 /// use google_cloud_retail_v2::model::BigQuerySource;
12241 /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12242 /// assert!(x.big_query_source().is_some());
12243 /// assert!(x.product_inline_source().is_none());
12244 /// assert!(x.gcs_source().is_none());
12245 /// ```
12246 pub fn set_big_query_source<
12247 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12248 >(
12249 mut self,
12250 v: T,
12251 ) -> Self {
12252 self.source = std::option::Option::Some(
12253 crate::model::product_input_config::Source::BigQuerySource(v.into()),
12254 );
12255 self
12256 }
12257}
12258
12259impl wkt::message::Message for ProductInputConfig {
12260 fn typename() -> &'static str {
12261 "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12262 }
12263}
12264
12265/// Defines additional types related to [ProductInputConfig].
12266pub mod product_input_config {
12267 #[allow(unused_imports)]
12268 use super::*;
12269
12270 /// Required. The source of the input.
12271 #[derive(Clone, Debug, PartialEq)]
12272 #[non_exhaustive]
12273 pub enum Source {
12274 /// The Inline source for the input content for products.
12275 ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12276 /// Google Cloud Storage location for the input content.
12277 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12278 /// BigQuery input source.
12279 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12280 }
12281}
12282
12283/// The input config source for user events.
12284#[derive(Clone, Default, PartialEq)]
12285#[non_exhaustive]
12286pub struct UserEventInputConfig {
12287 /// The source of the input.
12288 pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12289
12290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12291}
12292
12293impl UserEventInputConfig {
12294 pub fn new() -> Self {
12295 std::default::Default::default()
12296 }
12297
12298 /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12299 ///
12300 /// Note that all the setters affecting `source` are mutually
12301 /// exclusive.
12302 ///
12303 /// # Example
12304 /// ```ignore,no_run
12305 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12306 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12307 /// let x = UserEventInputConfig::new().set_source(Some(
12308 /// google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12309 /// ```
12310 pub fn set_source<
12311 T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12312 >(
12313 mut self,
12314 v: T,
12315 ) -> Self {
12316 self.source = v.into();
12317 self
12318 }
12319
12320 /// The value of [source][crate::model::UserEventInputConfig::source]
12321 /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12322 /// holds a different branch.
12323 pub fn user_event_inline_source(
12324 &self,
12325 ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12326 #[allow(unreachable_patterns)]
12327 self.source.as_ref().and_then(|v| match v {
12328 crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12329 std::option::Option::Some(v)
12330 }
12331 _ => std::option::Option::None,
12332 })
12333 }
12334
12335 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12336 /// to hold a `UserEventInlineSource`.
12337 ///
12338 /// Note that all the setters affecting `source` are
12339 /// mutually exclusive.
12340 ///
12341 /// # Example
12342 /// ```ignore,no_run
12343 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12344 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12345 /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12346 /// assert!(x.user_event_inline_source().is_some());
12347 /// assert!(x.gcs_source().is_none());
12348 /// assert!(x.big_query_source().is_none());
12349 /// ```
12350 pub fn set_user_event_inline_source<
12351 T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12352 >(
12353 mut self,
12354 v: T,
12355 ) -> Self {
12356 self.source = std::option::Option::Some(
12357 crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12358 );
12359 self
12360 }
12361
12362 /// The value of [source][crate::model::UserEventInputConfig::source]
12363 /// if it holds a `GcsSource`, `None` if the field is not set or
12364 /// holds a different branch.
12365 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12366 #[allow(unreachable_patterns)]
12367 self.source.as_ref().and_then(|v| match v {
12368 crate::model::user_event_input_config::Source::GcsSource(v) => {
12369 std::option::Option::Some(v)
12370 }
12371 _ => std::option::Option::None,
12372 })
12373 }
12374
12375 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12376 /// to hold a `GcsSource`.
12377 ///
12378 /// Note that all the setters affecting `source` are
12379 /// mutually exclusive.
12380 ///
12381 /// # Example
12382 /// ```ignore,no_run
12383 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12384 /// use google_cloud_retail_v2::model::GcsSource;
12385 /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12386 /// assert!(x.gcs_source().is_some());
12387 /// assert!(x.user_event_inline_source().is_none());
12388 /// assert!(x.big_query_source().is_none());
12389 /// ```
12390 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12391 mut self,
12392 v: T,
12393 ) -> Self {
12394 self.source = std::option::Option::Some(
12395 crate::model::user_event_input_config::Source::GcsSource(v.into()),
12396 );
12397 self
12398 }
12399
12400 /// The value of [source][crate::model::UserEventInputConfig::source]
12401 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12402 /// holds a different branch.
12403 pub fn big_query_source(
12404 &self,
12405 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12406 #[allow(unreachable_patterns)]
12407 self.source.as_ref().and_then(|v| match v {
12408 crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12409 std::option::Option::Some(v)
12410 }
12411 _ => std::option::Option::None,
12412 })
12413 }
12414
12415 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12416 /// to hold a `BigQuerySource`.
12417 ///
12418 /// Note that all the setters affecting `source` are
12419 /// mutually exclusive.
12420 ///
12421 /// # Example
12422 /// ```ignore,no_run
12423 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12424 /// use google_cloud_retail_v2::model::BigQuerySource;
12425 /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12426 /// assert!(x.big_query_source().is_some());
12427 /// assert!(x.user_event_inline_source().is_none());
12428 /// assert!(x.gcs_source().is_none());
12429 /// ```
12430 pub fn set_big_query_source<
12431 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12432 >(
12433 mut self,
12434 v: T,
12435 ) -> Self {
12436 self.source = std::option::Option::Some(
12437 crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12438 );
12439 self
12440 }
12441}
12442
12443impl wkt::message::Message for UserEventInputConfig {
12444 fn typename() -> &'static str {
12445 "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12446 }
12447}
12448
12449/// Defines additional types related to [UserEventInputConfig].
12450pub mod user_event_input_config {
12451 #[allow(unused_imports)]
12452 use super::*;
12453
12454 /// The source of the input.
12455 #[derive(Clone, Debug, PartialEq)]
12456 #[non_exhaustive]
12457 pub enum Source {
12458 /// Required. The Inline source for the input content for UserEvents.
12459 UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12460 /// Required. Google Cloud Storage location for the input content.
12461 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12462 /// Required. BigQuery input source.
12463 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12464 }
12465}
12466
12467/// The input config source for completion data.
12468#[derive(Clone, Default, PartialEq)]
12469#[non_exhaustive]
12470pub struct CompletionDataInputConfig {
12471 /// The source of the input.
12472 ///
12473 /// Supported
12474 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12475 /// values for suggestions imports:
12476 ///
12477 /// * `suggestions` (default): One JSON completion suggestion per line.
12478 /// * `denylist`: One JSON deny suggestion per line.
12479 /// * `allowlist`: One JSON allow suggestion per line.
12480 ///
12481 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12482 pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12483
12484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12485}
12486
12487impl CompletionDataInputConfig {
12488 pub fn new() -> Self {
12489 std::default::Default::default()
12490 }
12491
12492 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12493 ///
12494 /// Note that all the setters affecting `source` are mutually
12495 /// exclusive.
12496 ///
12497 /// # Example
12498 /// ```ignore,no_run
12499 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12500 /// use google_cloud_retail_v2::model::BigQuerySource;
12501 /// let x = CompletionDataInputConfig::new().set_source(Some(
12502 /// google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12503 /// ```
12504 pub fn set_source<
12505 T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12506 >(
12507 mut self,
12508 v: T,
12509 ) -> Self {
12510 self.source = v.into();
12511 self
12512 }
12513
12514 /// The value of [source][crate::model::CompletionDataInputConfig::source]
12515 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12516 /// holds a different branch.
12517 pub fn big_query_source(
12518 &self,
12519 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12520 #[allow(unreachable_patterns)]
12521 self.source.as_ref().and_then(|v| match v {
12522 crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12523 std::option::Option::Some(v)
12524 }
12525 _ => std::option::Option::None,
12526 })
12527 }
12528
12529 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12530 /// to hold a `BigQuerySource`.
12531 ///
12532 /// Note that all the setters affecting `source` are
12533 /// mutually exclusive.
12534 ///
12535 /// # Example
12536 /// ```ignore,no_run
12537 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12538 /// use google_cloud_retail_v2::model::BigQuerySource;
12539 /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12540 /// assert!(x.big_query_source().is_some());
12541 /// ```
12542 pub fn set_big_query_source<
12543 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12544 >(
12545 mut self,
12546 v: T,
12547 ) -> Self {
12548 self.source = std::option::Option::Some(
12549 crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12550 );
12551 self
12552 }
12553}
12554
12555impl wkt::message::Message for CompletionDataInputConfig {
12556 fn typename() -> &'static str {
12557 "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12558 }
12559}
12560
12561/// Defines additional types related to [CompletionDataInputConfig].
12562pub mod completion_data_input_config {
12563 #[allow(unused_imports)]
12564 use super::*;
12565
12566 /// The source of the input.
12567 ///
12568 /// Supported
12569 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12570 /// values for suggestions imports:
12571 ///
12572 /// * `suggestions` (default): One JSON completion suggestion per line.
12573 /// * `denylist`: One JSON deny suggestion per line.
12574 /// * `allowlist`: One JSON allow suggestion per line.
12575 ///
12576 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12577 #[derive(Clone, Debug, PartialEq)]
12578 #[non_exhaustive]
12579 pub enum Source {
12580 /// Required. BigQuery input source.
12581 ///
12582 /// Add the IAM permission "BigQuery Data Viewer" for
12583 /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12584 /// using this feature otherwise an error is thrown.
12585 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12586 }
12587}
12588
12589/// Metadata related to the progress of the Import operation. This is
12590/// returned by the google.longrunning.Operation.metadata field.
12591#[derive(Clone, Default, PartialEq)]
12592#[non_exhaustive]
12593pub struct ImportMetadata {
12594 /// Operation create time.
12595 pub create_time: std::option::Option<wkt::Timestamp>,
12596
12597 /// Operation last update time. If the operation is done, this is also the
12598 /// finish time.
12599 pub update_time: std::option::Option<wkt::Timestamp>,
12600
12601 /// Count of entries that were processed successfully.
12602 pub success_count: i64,
12603
12604 /// Count of entries that encountered errors while processing.
12605 pub failure_count: i64,
12606
12607 /// Deprecated. This field is never set.
12608 #[deprecated]
12609 pub request_id: std::string::String,
12610
12611 /// Pub/Sub topic for receiving notification. If this field is set,
12612 /// when the import is finished, a notification is sent to
12613 /// specified Pub/Sub topic. The message data is JSON string of a
12614 /// [Operation][google.longrunning.Operation].
12615 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12616 ///
12617 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12618 pub notification_pubsub_topic: std::string::String,
12619
12620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12621}
12622
12623impl ImportMetadata {
12624 pub fn new() -> Self {
12625 std::default::Default::default()
12626 }
12627
12628 /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12629 ///
12630 /// # Example
12631 /// ```ignore,no_run
12632 /// # use google_cloud_retail_v2::model::ImportMetadata;
12633 /// use wkt::Timestamp;
12634 /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12635 /// ```
12636 pub fn set_create_time<T>(mut self, v: T) -> Self
12637 where
12638 T: std::convert::Into<wkt::Timestamp>,
12639 {
12640 self.create_time = std::option::Option::Some(v.into());
12641 self
12642 }
12643
12644 /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12645 ///
12646 /// # Example
12647 /// ```ignore,no_run
12648 /// # use google_cloud_retail_v2::model::ImportMetadata;
12649 /// use wkt::Timestamp;
12650 /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12651 /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12652 /// ```
12653 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12654 where
12655 T: std::convert::Into<wkt::Timestamp>,
12656 {
12657 self.create_time = v.map(|x| x.into());
12658 self
12659 }
12660
12661 /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12662 ///
12663 /// # Example
12664 /// ```ignore,no_run
12665 /// # use google_cloud_retail_v2::model::ImportMetadata;
12666 /// use wkt::Timestamp;
12667 /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12668 /// ```
12669 pub fn set_update_time<T>(mut self, v: T) -> Self
12670 where
12671 T: std::convert::Into<wkt::Timestamp>,
12672 {
12673 self.update_time = std::option::Option::Some(v.into());
12674 self
12675 }
12676
12677 /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12678 ///
12679 /// # Example
12680 /// ```ignore,no_run
12681 /// # use google_cloud_retail_v2::model::ImportMetadata;
12682 /// use wkt::Timestamp;
12683 /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12684 /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12685 /// ```
12686 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12687 where
12688 T: std::convert::Into<wkt::Timestamp>,
12689 {
12690 self.update_time = v.map(|x| x.into());
12691 self
12692 }
12693
12694 /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12695 ///
12696 /// # Example
12697 /// ```ignore,no_run
12698 /// # use google_cloud_retail_v2::model::ImportMetadata;
12699 /// let x = ImportMetadata::new().set_success_count(42);
12700 /// ```
12701 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12702 self.success_count = v.into();
12703 self
12704 }
12705
12706 /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12707 ///
12708 /// # Example
12709 /// ```ignore,no_run
12710 /// # use google_cloud_retail_v2::model::ImportMetadata;
12711 /// let x = ImportMetadata::new().set_failure_count(42);
12712 /// ```
12713 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12714 self.failure_count = v.into();
12715 self
12716 }
12717
12718 /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12719 ///
12720 /// # Example
12721 /// ```ignore,no_run
12722 /// # use google_cloud_retail_v2::model::ImportMetadata;
12723 /// let x = ImportMetadata::new().set_request_id("example");
12724 /// ```
12725 #[deprecated]
12726 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12727 self.request_id = v.into();
12728 self
12729 }
12730
12731 /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12732 ///
12733 /// # Example
12734 /// ```ignore,no_run
12735 /// # use google_cloud_retail_v2::model::ImportMetadata;
12736 /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12737 /// ```
12738 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12739 mut self,
12740 v: T,
12741 ) -> Self {
12742 self.notification_pubsub_topic = v.into();
12743 self
12744 }
12745}
12746
12747impl wkt::message::Message for ImportMetadata {
12748 fn typename() -> &'static str {
12749 "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12750 }
12751}
12752
12753/// Response of the
12754/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12755/// long running operation is done, then this message is returned by the
12756/// google.longrunning.Operations.response field if the operation was successful.
12757///
12758/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12759#[derive(Clone, Default, PartialEq)]
12760#[non_exhaustive]
12761pub struct ImportProductsResponse {
12762 /// A sample of errors encountered while processing the request.
12763 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12764
12765 /// Echoes the destination for the complete errors in the request if set.
12766 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12767
12768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12769}
12770
12771impl ImportProductsResponse {
12772 pub fn new() -> Self {
12773 std::default::Default::default()
12774 }
12775
12776 /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12777 ///
12778 /// # Example
12779 /// ```ignore,no_run
12780 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12781 /// use google_cloud_rpc::model::Status;
12782 /// let x = ImportProductsResponse::new()
12783 /// .set_error_samples([
12784 /// Status::default()/* use setters */,
12785 /// Status::default()/* use (different) setters */,
12786 /// ]);
12787 /// ```
12788 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12789 where
12790 T: std::iter::IntoIterator<Item = V>,
12791 V: std::convert::Into<google_cloud_rpc::model::Status>,
12792 {
12793 use std::iter::Iterator;
12794 self.error_samples = v.into_iter().map(|i| i.into()).collect();
12795 self
12796 }
12797
12798 /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12803 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12804 /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12805 /// ```
12806 pub fn set_errors_config<T>(mut self, v: T) -> Self
12807 where
12808 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12809 {
12810 self.errors_config = std::option::Option::Some(v.into());
12811 self
12812 }
12813
12814 /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12815 ///
12816 /// # Example
12817 /// ```ignore,no_run
12818 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12819 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12820 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12821 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12822 /// ```
12823 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12824 where
12825 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12826 {
12827 self.errors_config = v.map(|x| x.into());
12828 self
12829 }
12830}
12831
12832impl wkt::message::Message for ImportProductsResponse {
12833 fn typename() -> &'static str {
12834 "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
12835 }
12836}
12837
12838/// Response of the ImportUserEventsRequest. If the long running
12839/// operation was successful, then this message is returned by the
12840/// google.longrunning.Operations.response field if the operation was successful.
12841#[derive(Clone, Default, PartialEq)]
12842#[non_exhaustive]
12843pub struct ImportUserEventsResponse {
12844 /// A sample of errors encountered while processing the request.
12845 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12846
12847 /// Echoes the destination for the complete errors if this field was set in
12848 /// the request.
12849 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12850
12851 /// Aggregated statistics of user event import status.
12852 pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
12853
12854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12855}
12856
12857impl ImportUserEventsResponse {
12858 pub fn new() -> Self {
12859 std::default::Default::default()
12860 }
12861
12862 /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
12863 ///
12864 /// # Example
12865 /// ```ignore,no_run
12866 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12867 /// use google_cloud_rpc::model::Status;
12868 /// let x = ImportUserEventsResponse::new()
12869 /// .set_error_samples([
12870 /// Status::default()/* use setters */,
12871 /// Status::default()/* use (different) setters */,
12872 /// ]);
12873 /// ```
12874 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12875 where
12876 T: std::iter::IntoIterator<Item = V>,
12877 V: std::convert::Into<google_cloud_rpc::model::Status>,
12878 {
12879 use std::iter::Iterator;
12880 self.error_samples = v.into_iter().map(|i| i.into()).collect();
12881 self
12882 }
12883
12884 /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12885 ///
12886 /// # Example
12887 /// ```ignore,no_run
12888 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12889 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12890 /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12891 /// ```
12892 pub fn set_errors_config<T>(mut self, v: T) -> Self
12893 where
12894 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12895 {
12896 self.errors_config = std::option::Option::Some(v.into());
12897 self
12898 }
12899
12900 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12901 ///
12902 /// # Example
12903 /// ```ignore,no_run
12904 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12905 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12906 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12907 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12908 /// ```
12909 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12910 where
12911 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12912 {
12913 self.errors_config = v.map(|x| x.into());
12914 self
12915 }
12916
12917 /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12918 ///
12919 /// # Example
12920 /// ```ignore,no_run
12921 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12922 /// use google_cloud_retail_v2::model::UserEventImportSummary;
12923 /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
12924 /// ```
12925 pub fn set_import_summary<T>(mut self, v: T) -> Self
12926 where
12927 T: std::convert::Into<crate::model::UserEventImportSummary>,
12928 {
12929 self.import_summary = std::option::Option::Some(v.into());
12930 self
12931 }
12932
12933 /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12934 ///
12935 /// # Example
12936 /// ```ignore,no_run
12937 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12938 /// use google_cloud_retail_v2::model::UserEventImportSummary;
12939 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
12940 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
12941 /// ```
12942 pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
12943 where
12944 T: std::convert::Into<crate::model::UserEventImportSummary>,
12945 {
12946 self.import_summary = v.map(|x| x.into());
12947 self
12948 }
12949}
12950
12951impl wkt::message::Message for ImportUserEventsResponse {
12952 fn typename() -> &'static str {
12953 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
12954 }
12955}
12956
12957/// A summary of import result. The UserEventImportSummary summarizes
12958/// the import status for user events.
12959#[derive(Clone, Default, PartialEq)]
12960#[non_exhaustive]
12961pub struct UserEventImportSummary {
12962 /// Count of user events imported with complete existing catalog information.
12963 pub joined_events_count: i64,
12964
12965 /// Count of user events imported, but with catalog information not found
12966 /// in the imported catalog.
12967 pub unjoined_events_count: i64,
12968
12969 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12970}
12971
12972impl UserEventImportSummary {
12973 pub fn new() -> Self {
12974 std::default::Default::default()
12975 }
12976
12977 /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
12978 ///
12979 /// # Example
12980 /// ```ignore,no_run
12981 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12982 /// let x = UserEventImportSummary::new().set_joined_events_count(42);
12983 /// ```
12984 pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12985 self.joined_events_count = v.into();
12986 self
12987 }
12988
12989 /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
12990 ///
12991 /// # Example
12992 /// ```ignore,no_run
12993 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12994 /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
12995 /// ```
12996 pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12997 self.unjoined_events_count = v.into();
12998 self
12999 }
13000}
13001
13002impl wkt::message::Message for UserEventImportSummary {
13003 fn typename() -> &'static str {
13004 "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13005 }
13006}
13007
13008/// Response of the
13009/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13010/// If the long running operation is done, this message is returned by the
13011/// google.longrunning.Operations.response field if the operation is successful.
13012///
13013/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13014#[derive(Clone, Default, PartialEq)]
13015#[non_exhaustive]
13016pub struct ImportCompletionDataResponse {
13017 /// A sample of errors encountered while processing the request.
13018 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13019
13020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13021}
13022
13023impl ImportCompletionDataResponse {
13024 pub fn new() -> Self {
13025 std::default::Default::default()
13026 }
13027
13028 /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13029 ///
13030 /// # Example
13031 /// ```ignore,no_run
13032 /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13033 /// use google_cloud_rpc::model::Status;
13034 /// let x = ImportCompletionDataResponse::new()
13035 /// .set_error_samples([
13036 /// Status::default()/* use setters */,
13037 /// Status::default()/* use (different) setters */,
13038 /// ]);
13039 /// ```
13040 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13041 where
13042 T: std::iter::IntoIterator<Item = V>,
13043 V: std::convert::Into<google_cloud_rpc::model::Status>,
13044 {
13045 use std::iter::Iterator;
13046 self.error_samples = v.into_iter().map(|i| i.into()).collect();
13047 self
13048 }
13049}
13050
13051impl wkt::message::Message for ImportCompletionDataResponse {
13052 fn typename() -> &'static str {
13053 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13054 }
13055}
13056
13057/// Metadata that describes the training and serving parameters of a
13058/// [Model][google.cloud.retail.v2.Model]. A
13059/// [Model][google.cloud.retail.v2.Model] can be associated with a
13060/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13061/// through the Predict API.
13062///
13063/// [google.cloud.retail.v2.Model]: crate::model::Model
13064/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13065#[derive(Clone, Default, PartialEq)]
13066#[non_exhaustive]
13067pub struct Model {
13068 /// Required. The fully qualified resource name of the model.
13069 ///
13070 /// Format:
13071 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13072 /// catalog_id has char limit of 50.
13073 /// recommendation_model_id has char limit of 40.
13074 pub name: std::string::String,
13075
13076 /// Required. The display name of the model.
13077 ///
13078 /// Should be human readable, used to display Recommendation Models in the
13079 /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13080 /// characters.
13081 pub display_name: std::string::String,
13082
13083 /// Optional. The training state that the model is in (e.g.
13084 /// `TRAINING` or `PAUSED`).
13085 ///
13086 /// Since part of the cost of running the service
13087 /// is frequency of training - this can be used to determine when to train
13088 /// model in order to control cost. If not specified: the default value for
13089 /// `CreateModel` method is `TRAINING`. The default value for
13090 /// `UpdateModel` method is to keep the state the same as before.
13091 pub training_state: crate::model::model::TrainingState,
13092
13093 /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13094 pub serving_state: crate::model::model::ServingState,
13095
13096 /// Output only. Timestamp the Recommendation Model was created at.
13097 pub create_time: std::option::Option<wkt::Timestamp>,
13098
13099 /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13100 /// if a Recommendation Model was paused - this would be the time the pause was
13101 /// initiated.
13102 pub update_time: std::option::Option<wkt::Timestamp>,
13103
13104 /// Required. The type of model e.g. `home-page`.
13105 ///
13106 /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13107 /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13108 /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13109 ///
13110 /// This field together with
13111 /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13112 /// describe model metadata to use to control model training and serving.
13113 /// See <https://cloud.google.com/retail/docs/models>
13114 /// for more details on what the model metadata control and which combination
13115 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13116 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13117 /// receive an error 400 if you try to create/update a recommendation with
13118 /// this set of knobs.
13119 ///
13120 /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13121 pub r#type: std::string::String,
13122
13123 /// Optional. The optimization objective e.g. `cvr`.
13124 ///
13125 /// Currently supported
13126 /// values: `ctr`, `cvr`, `revenue-per-order`.
13127 ///
13128 /// If not specified, we choose default based on model type.
13129 /// Default depends on type of recommendation:
13130 ///
13131 /// `recommended-for-you` => `ctr`
13132 ///
13133 /// `others-you-may-like` => `ctr`
13134 ///
13135 /// `frequently-bought-together` => `revenue_per_order`
13136 ///
13137 /// This field together with
13138 /// [optimization_objective][google.cloud.retail.v2.Model.type]
13139 /// describe model metadata to use to control model training and serving.
13140 /// See <https://cloud.google.com/retail/docs/models>
13141 /// for more details on what the model metadata control and which combination
13142 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13143 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13144 /// receive an error 400 if you try to create/update a recommendation with
13145 /// this set of knobs.
13146 ///
13147 /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13148 pub optimization_objective: std::string::String,
13149
13150 /// Optional. The state of periodic tuning.
13151 ///
13152 /// The period we use is 3 months - to do a
13153 /// one-off tune earlier use the `TuneModel` method. Default value
13154 /// is `PERIODIC_TUNING_ENABLED`.
13155 pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13156
13157 /// Output only. The timestamp when the latest successful tune finished.
13158 pub last_tune_time: std::option::Option<wkt::Timestamp>,
13159
13160 /// Output only. The tune operation associated with the model.
13161 ///
13162 /// Can be used to determine if there is an ongoing tune for this
13163 /// recommendation. Empty field implies no tune is goig on.
13164 pub tuning_operation: std::string::String,
13165
13166 /// Output only. The state of data requirements for this model: `DATA_OK` and
13167 /// `DATA_ERROR`.
13168 ///
13169 /// Recommendation model cannot be trained if the data is in
13170 /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13171 /// if serving state is `ACTIVE`: models were trained successfully before, but
13172 /// cannot be refreshed because model no longer has sufficient
13173 /// data for training.
13174 pub data_state: crate::model::model::DataState,
13175
13176 /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13177 /// by attributes is enabled for the model.
13178 pub filtering_option: crate::model::RecommendationsFilteringOption,
13179
13180 /// Output only. The list of valid serving configs associated with the
13181 /// PageOptimizationConfig.
13182 pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13183
13184 /// Optional. Additional model features config.
13185 pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13186
13187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13188}
13189
13190impl Model {
13191 pub fn new() -> Self {
13192 std::default::Default::default()
13193 }
13194
13195 /// Sets the value of [name][crate::model::Model::name].
13196 ///
13197 /// # Example
13198 /// ```ignore,no_run
13199 /// # use google_cloud_retail_v2::model::Model;
13200 /// let x = Model::new().set_name("example");
13201 /// ```
13202 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13203 self.name = v.into();
13204 self
13205 }
13206
13207 /// Sets the value of [display_name][crate::model::Model::display_name].
13208 ///
13209 /// # Example
13210 /// ```ignore,no_run
13211 /// # use google_cloud_retail_v2::model::Model;
13212 /// let x = Model::new().set_display_name("example");
13213 /// ```
13214 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13215 self.display_name = v.into();
13216 self
13217 }
13218
13219 /// Sets the value of [training_state][crate::model::Model::training_state].
13220 ///
13221 /// # Example
13222 /// ```ignore,no_run
13223 /// # use google_cloud_retail_v2::model::Model;
13224 /// use google_cloud_retail_v2::model::model::TrainingState;
13225 /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13226 /// let x1 = Model::new().set_training_state(TrainingState::Training);
13227 /// ```
13228 pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13229 mut self,
13230 v: T,
13231 ) -> Self {
13232 self.training_state = v.into();
13233 self
13234 }
13235
13236 /// Sets the value of [serving_state][crate::model::Model::serving_state].
13237 ///
13238 /// # Example
13239 /// ```ignore,no_run
13240 /// # use google_cloud_retail_v2::model::Model;
13241 /// use google_cloud_retail_v2::model::model::ServingState;
13242 /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13243 /// let x1 = Model::new().set_serving_state(ServingState::Active);
13244 /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13245 /// ```
13246 pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13247 mut self,
13248 v: T,
13249 ) -> Self {
13250 self.serving_state = v.into();
13251 self
13252 }
13253
13254 /// Sets the value of [create_time][crate::model::Model::create_time].
13255 ///
13256 /// # Example
13257 /// ```ignore,no_run
13258 /// # use google_cloud_retail_v2::model::Model;
13259 /// use wkt::Timestamp;
13260 /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
13261 /// ```
13262 pub fn set_create_time<T>(mut self, v: T) -> Self
13263 where
13264 T: std::convert::Into<wkt::Timestamp>,
13265 {
13266 self.create_time = std::option::Option::Some(v.into());
13267 self
13268 }
13269
13270 /// Sets or clears the value of [create_time][crate::model::Model::create_time].
13271 ///
13272 /// # Example
13273 /// ```ignore,no_run
13274 /// # use google_cloud_retail_v2::model::Model;
13275 /// use wkt::Timestamp;
13276 /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13277 /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13278 /// ```
13279 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13280 where
13281 T: std::convert::Into<wkt::Timestamp>,
13282 {
13283 self.create_time = v.map(|x| x.into());
13284 self
13285 }
13286
13287 /// Sets the value of [update_time][crate::model::Model::update_time].
13288 ///
13289 /// # Example
13290 /// ```ignore,no_run
13291 /// # use google_cloud_retail_v2::model::Model;
13292 /// use wkt::Timestamp;
13293 /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13294 /// ```
13295 pub fn set_update_time<T>(mut self, v: T) -> Self
13296 where
13297 T: std::convert::Into<wkt::Timestamp>,
13298 {
13299 self.update_time = std::option::Option::Some(v.into());
13300 self
13301 }
13302
13303 /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13304 ///
13305 /// # Example
13306 /// ```ignore,no_run
13307 /// # use google_cloud_retail_v2::model::Model;
13308 /// use wkt::Timestamp;
13309 /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13310 /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13311 /// ```
13312 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13313 where
13314 T: std::convert::Into<wkt::Timestamp>,
13315 {
13316 self.update_time = v.map(|x| x.into());
13317 self
13318 }
13319
13320 /// Sets the value of [r#type][crate::model::Model::type].
13321 ///
13322 /// # Example
13323 /// ```ignore,no_run
13324 /// # use google_cloud_retail_v2::model::Model;
13325 /// let x = Model::new().set_type("example");
13326 /// ```
13327 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13328 self.r#type = v.into();
13329 self
13330 }
13331
13332 /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13333 ///
13334 /// # Example
13335 /// ```ignore,no_run
13336 /// # use google_cloud_retail_v2::model::Model;
13337 /// let x = Model::new().set_optimization_objective("example");
13338 /// ```
13339 pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13340 mut self,
13341 v: T,
13342 ) -> Self {
13343 self.optimization_objective = v.into();
13344 self
13345 }
13346
13347 /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13348 ///
13349 /// # Example
13350 /// ```ignore,no_run
13351 /// # use google_cloud_retail_v2::model::Model;
13352 /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13353 /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13354 /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13355 /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13356 /// ```
13357 pub fn set_periodic_tuning_state<
13358 T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13359 >(
13360 mut self,
13361 v: T,
13362 ) -> Self {
13363 self.periodic_tuning_state = v.into();
13364 self
13365 }
13366
13367 /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13368 ///
13369 /// # Example
13370 /// ```ignore,no_run
13371 /// # use google_cloud_retail_v2::model::Model;
13372 /// use wkt::Timestamp;
13373 /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13374 /// ```
13375 pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13376 where
13377 T: std::convert::Into<wkt::Timestamp>,
13378 {
13379 self.last_tune_time = std::option::Option::Some(v.into());
13380 self
13381 }
13382
13383 /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13384 ///
13385 /// # Example
13386 /// ```ignore,no_run
13387 /// # use google_cloud_retail_v2::model::Model;
13388 /// use wkt::Timestamp;
13389 /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13390 /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13391 /// ```
13392 pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13393 where
13394 T: std::convert::Into<wkt::Timestamp>,
13395 {
13396 self.last_tune_time = v.map(|x| x.into());
13397 self
13398 }
13399
13400 /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_retail_v2::model::Model;
13405 /// let x = Model::new().set_tuning_operation("example");
13406 /// ```
13407 pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13408 mut self,
13409 v: T,
13410 ) -> Self {
13411 self.tuning_operation = v.into();
13412 self
13413 }
13414
13415 /// Sets the value of [data_state][crate::model::Model::data_state].
13416 ///
13417 /// # Example
13418 /// ```ignore,no_run
13419 /// # use google_cloud_retail_v2::model::Model;
13420 /// use google_cloud_retail_v2::model::model::DataState;
13421 /// let x0 = Model::new().set_data_state(DataState::DataOk);
13422 /// let x1 = Model::new().set_data_state(DataState::DataError);
13423 /// ```
13424 pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13425 mut self,
13426 v: T,
13427 ) -> Self {
13428 self.data_state = v.into();
13429 self
13430 }
13431
13432 /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13433 ///
13434 /// # Example
13435 /// ```ignore,no_run
13436 /// # use google_cloud_retail_v2::model::Model;
13437 /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13438 /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13439 /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13440 /// ```
13441 pub fn set_filtering_option<
13442 T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13443 >(
13444 mut self,
13445 v: T,
13446 ) -> Self {
13447 self.filtering_option = v.into();
13448 self
13449 }
13450
13451 /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13452 ///
13453 /// # Example
13454 /// ```ignore,no_run
13455 /// # use google_cloud_retail_v2::model::Model;
13456 /// use google_cloud_retail_v2::model::model::ServingConfigList;
13457 /// let x = Model::new()
13458 /// .set_serving_config_lists([
13459 /// ServingConfigList::default()/* use setters */,
13460 /// ServingConfigList::default()/* use (different) setters */,
13461 /// ]);
13462 /// ```
13463 pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13464 where
13465 T: std::iter::IntoIterator<Item = V>,
13466 V: std::convert::Into<crate::model::model::ServingConfigList>,
13467 {
13468 use std::iter::Iterator;
13469 self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13470 self
13471 }
13472
13473 /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13474 ///
13475 /// # Example
13476 /// ```ignore,no_run
13477 /// # use google_cloud_retail_v2::model::Model;
13478 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13479 /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13480 /// ```
13481 pub fn set_model_features_config<T>(mut self, v: T) -> Self
13482 where
13483 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13484 {
13485 self.model_features_config = std::option::Option::Some(v.into());
13486 self
13487 }
13488
13489 /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13490 ///
13491 /// # Example
13492 /// ```ignore,no_run
13493 /// # use google_cloud_retail_v2::model::Model;
13494 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13495 /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13496 /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13497 /// ```
13498 pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13499 where
13500 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13501 {
13502 self.model_features_config = v.map(|x| x.into());
13503 self
13504 }
13505}
13506
13507impl wkt::message::Message for Model {
13508 fn typename() -> &'static str {
13509 "type.googleapis.com/google.cloud.retail.v2.Model"
13510 }
13511}
13512
13513/// Defines additional types related to [Model].
13514pub mod model {
13515 #[allow(unused_imports)]
13516 use super::*;
13517
13518 /// Represents an ordered combination of valid serving configs, which
13519 /// can be used for `PAGE_OPTIMIZATION` recommendations.
13520 #[derive(Clone, Default, PartialEq)]
13521 #[non_exhaustive]
13522 pub struct ServingConfigList {
13523 /// Optional. A set of valid serving configs that may be used for
13524 /// `PAGE_OPTIMIZATION`.
13525 pub serving_config_ids: std::vec::Vec<std::string::String>,
13526
13527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13528 }
13529
13530 impl ServingConfigList {
13531 pub fn new() -> Self {
13532 std::default::Default::default()
13533 }
13534
13535 /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13536 ///
13537 /// # Example
13538 /// ```ignore,no_run
13539 /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13540 /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13541 /// ```
13542 pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13543 where
13544 T: std::iter::IntoIterator<Item = V>,
13545 V: std::convert::Into<std::string::String>,
13546 {
13547 use std::iter::Iterator;
13548 self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13549 self
13550 }
13551 }
13552
13553 impl wkt::message::Message for ServingConfigList {
13554 fn typename() -> &'static str {
13555 "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13556 }
13557 }
13558
13559 /// Additional configs for the frequently-bought-together model type.
13560 #[derive(Clone, Default, PartialEq)]
13561 #[non_exhaustive]
13562 pub struct FrequentlyBoughtTogetherFeaturesConfig {
13563 /// Optional. Specifies the context of the model when it is used in predict
13564 /// requests. Can only be set for the `frequently-bought-together` type. If
13565 /// it isn't specified, it defaults to
13566 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13567 ///
13568 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13569 pub context_products_type: crate::model::model::ContextProductsType,
13570
13571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13572 }
13573
13574 impl FrequentlyBoughtTogetherFeaturesConfig {
13575 pub fn new() -> Self {
13576 std::default::Default::default()
13577 }
13578
13579 /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13580 ///
13581 /// # Example
13582 /// ```ignore,no_run
13583 /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13584 /// use google_cloud_retail_v2::model::model::ContextProductsType;
13585 /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13586 /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13587 /// ```
13588 pub fn set_context_products_type<
13589 T: std::convert::Into<crate::model::model::ContextProductsType>,
13590 >(
13591 mut self,
13592 v: T,
13593 ) -> Self {
13594 self.context_products_type = v.into();
13595 self
13596 }
13597 }
13598
13599 impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13600 fn typename() -> &'static str {
13601 "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13602 }
13603 }
13604
13605 /// Additional model features config.
13606 #[derive(Clone, Default, PartialEq)]
13607 #[non_exhaustive]
13608 pub struct ModelFeaturesConfig {
13609 pub type_dedicated_config:
13610 std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13611
13612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13613 }
13614
13615 impl ModelFeaturesConfig {
13616 pub fn new() -> Self {
13617 std::default::Default::default()
13618 }
13619
13620 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13621 ///
13622 /// Note that all the setters affecting `type_dedicated_config` are mutually
13623 /// exclusive.
13624 ///
13625 /// # Example
13626 /// ```ignore,no_run
13627 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13628 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13629 /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13630 /// google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13631 /// ```
13632 pub fn set_type_dedicated_config<
13633 T: std::convert::Into<
13634 std::option::Option<
13635 crate::model::model::model_features_config::TypeDedicatedConfig,
13636 >,
13637 >,
13638 >(
13639 mut self,
13640 v: T,
13641 ) -> Self {
13642 self.type_dedicated_config = v.into();
13643 self
13644 }
13645
13646 /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13647 /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13648 /// holds a different branch.
13649 pub fn frequently_bought_together_config(
13650 &self,
13651 ) -> std::option::Option<
13652 &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13653 > {
13654 #[allow(unreachable_patterns)]
13655 self.type_dedicated_config.as_ref().and_then(|v| match v {
13656 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13657 _ => std::option::Option::None,
13658 })
13659 }
13660
13661 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13662 /// to hold a `FrequentlyBoughtTogetherConfig`.
13663 ///
13664 /// Note that all the setters affecting `type_dedicated_config` are
13665 /// mutually exclusive.
13666 ///
13667 /// # Example
13668 /// ```ignore,no_run
13669 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13670 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13671 /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13672 /// assert!(x.frequently_bought_together_config().is_some());
13673 /// ```
13674 pub fn set_frequently_bought_together_config<
13675 T: std::convert::Into<
13676 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13677 >,
13678 >(
13679 mut self,
13680 v: T,
13681 ) -> Self {
13682 self.type_dedicated_config = std::option::Option::Some(
13683 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13684 v.into()
13685 )
13686 );
13687 self
13688 }
13689 }
13690
13691 impl wkt::message::Message for ModelFeaturesConfig {
13692 fn typename() -> &'static str {
13693 "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13694 }
13695 }
13696
13697 /// Defines additional types related to [ModelFeaturesConfig].
13698 pub mod model_features_config {
13699 #[allow(unused_imports)]
13700 use super::*;
13701
13702 #[derive(Clone, Debug, PartialEq)]
13703 #[non_exhaustive]
13704 pub enum TypeDedicatedConfig {
13705 /// Additional configs for frequently-bought-together models.
13706 FrequentlyBoughtTogetherConfig(
13707 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13708 ),
13709 }
13710 }
13711
13712 /// The serving state of the model.
13713 ///
13714 /// # Working with unknown values
13715 ///
13716 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13717 /// additional enum variants at any time. Adding new variants is not considered
13718 /// a breaking change. Applications should write their code in anticipation of:
13719 ///
13720 /// - New values appearing in future releases of the client library, **and**
13721 /// - New values received dynamically, without application changes.
13722 ///
13723 /// Please consult the [Working with enums] section in the user guide for some
13724 /// guidelines.
13725 ///
13726 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13727 #[derive(Clone, Debug, PartialEq)]
13728 #[non_exhaustive]
13729 pub enum ServingState {
13730 /// Unspecified serving state.
13731 Unspecified,
13732 /// The model is not serving.
13733 Inactive,
13734 /// The model is serving and can be queried.
13735 Active,
13736 /// The model is trained on tuned hyperparameters and can be
13737 /// queried.
13738 Tuned,
13739 /// If set, the enum was initialized with an unknown value.
13740 ///
13741 /// Applications can examine the value using [ServingState::value] or
13742 /// [ServingState::name].
13743 UnknownValue(serving_state::UnknownValue),
13744 }
13745
13746 #[doc(hidden)]
13747 pub mod serving_state {
13748 #[allow(unused_imports)]
13749 use super::*;
13750 #[derive(Clone, Debug, PartialEq)]
13751 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13752 }
13753
13754 impl ServingState {
13755 /// Gets the enum value.
13756 ///
13757 /// Returns `None` if the enum contains an unknown value deserialized from
13758 /// the string representation of enums.
13759 pub fn value(&self) -> std::option::Option<i32> {
13760 match self {
13761 Self::Unspecified => std::option::Option::Some(0),
13762 Self::Inactive => std::option::Option::Some(1),
13763 Self::Active => std::option::Option::Some(2),
13764 Self::Tuned => std::option::Option::Some(3),
13765 Self::UnknownValue(u) => u.0.value(),
13766 }
13767 }
13768
13769 /// Gets the enum value as a string.
13770 ///
13771 /// Returns `None` if the enum contains an unknown value deserialized from
13772 /// the integer representation of enums.
13773 pub fn name(&self) -> std::option::Option<&str> {
13774 match self {
13775 Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13776 Self::Inactive => std::option::Option::Some("INACTIVE"),
13777 Self::Active => std::option::Option::Some("ACTIVE"),
13778 Self::Tuned => std::option::Option::Some("TUNED"),
13779 Self::UnknownValue(u) => u.0.name(),
13780 }
13781 }
13782 }
13783
13784 impl std::default::Default for ServingState {
13785 fn default() -> Self {
13786 use std::convert::From;
13787 Self::from(0)
13788 }
13789 }
13790
13791 impl std::fmt::Display for ServingState {
13792 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13793 wkt::internal::display_enum(f, self.name(), self.value())
13794 }
13795 }
13796
13797 impl std::convert::From<i32> for ServingState {
13798 fn from(value: i32) -> Self {
13799 match value {
13800 0 => Self::Unspecified,
13801 1 => Self::Inactive,
13802 2 => Self::Active,
13803 3 => Self::Tuned,
13804 _ => Self::UnknownValue(serving_state::UnknownValue(
13805 wkt::internal::UnknownEnumValue::Integer(value),
13806 )),
13807 }
13808 }
13809 }
13810
13811 impl std::convert::From<&str> for ServingState {
13812 fn from(value: &str) -> Self {
13813 use std::string::ToString;
13814 match value {
13815 "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
13816 "INACTIVE" => Self::Inactive,
13817 "ACTIVE" => Self::Active,
13818 "TUNED" => Self::Tuned,
13819 _ => Self::UnknownValue(serving_state::UnknownValue(
13820 wkt::internal::UnknownEnumValue::String(value.to_string()),
13821 )),
13822 }
13823 }
13824 }
13825
13826 impl serde::ser::Serialize for ServingState {
13827 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13828 where
13829 S: serde::Serializer,
13830 {
13831 match self {
13832 Self::Unspecified => serializer.serialize_i32(0),
13833 Self::Inactive => serializer.serialize_i32(1),
13834 Self::Active => serializer.serialize_i32(2),
13835 Self::Tuned => serializer.serialize_i32(3),
13836 Self::UnknownValue(u) => u.0.serialize(serializer),
13837 }
13838 }
13839 }
13840
13841 impl<'de> serde::de::Deserialize<'de> for ServingState {
13842 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13843 where
13844 D: serde::Deserializer<'de>,
13845 {
13846 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
13847 ".google.cloud.retail.v2.Model.ServingState",
13848 ))
13849 }
13850 }
13851
13852 /// The training state of the model.
13853 ///
13854 /// # Working with unknown values
13855 ///
13856 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13857 /// additional enum variants at any time. Adding new variants is not considered
13858 /// a breaking change. Applications should write their code in anticipation of:
13859 ///
13860 /// - New values appearing in future releases of the client library, **and**
13861 /// - New values received dynamically, without application changes.
13862 ///
13863 /// Please consult the [Working with enums] section in the user guide for some
13864 /// guidelines.
13865 ///
13866 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13867 #[derive(Clone, Debug, PartialEq)]
13868 #[non_exhaustive]
13869 pub enum TrainingState {
13870 /// Unspecified training state.
13871 Unspecified,
13872 /// The model training is paused.
13873 Paused,
13874 /// The model is training.
13875 Training,
13876 /// If set, the enum was initialized with an unknown value.
13877 ///
13878 /// Applications can examine the value using [TrainingState::value] or
13879 /// [TrainingState::name].
13880 UnknownValue(training_state::UnknownValue),
13881 }
13882
13883 #[doc(hidden)]
13884 pub mod training_state {
13885 #[allow(unused_imports)]
13886 use super::*;
13887 #[derive(Clone, Debug, PartialEq)]
13888 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13889 }
13890
13891 impl TrainingState {
13892 /// Gets the enum value.
13893 ///
13894 /// Returns `None` if the enum contains an unknown value deserialized from
13895 /// the string representation of enums.
13896 pub fn value(&self) -> std::option::Option<i32> {
13897 match self {
13898 Self::Unspecified => std::option::Option::Some(0),
13899 Self::Paused => std::option::Option::Some(1),
13900 Self::Training => std::option::Option::Some(2),
13901 Self::UnknownValue(u) => u.0.value(),
13902 }
13903 }
13904
13905 /// Gets the enum value as a string.
13906 ///
13907 /// Returns `None` if the enum contains an unknown value deserialized from
13908 /// the integer representation of enums.
13909 pub fn name(&self) -> std::option::Option<&str> {
13910 match self {
13911 Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
13912 Self::Paused => std::option::Option::Some("PAUSED"),
13913 Self::Training => std::option::Option::Some("TRAINING"),
13914 Self::UnknownValue(u) => u.0.name(),
13915 }
13916 }
13917 }
13918
13919 impl std::default::Default for TrainingState {
13920 fn default() -> Self {
13921 use std::convert::From;
13922 Self::from(0)
13923 }
13924 }
13925
13926 impl std::fmt::Display for TrainingState {
13927 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13928 wkt::internal::display_enum(f, self.name(), self.value())
13929 }
13930 }
13931
13932 impl std::convert::From<i32> for TrainingState {
13933 fn from(value: i32) -> Self {
13934 match value {
13935 0 => Self::Unspecified,
13936 1 => Self::Paused,
13937 2 => Self::Training,
13938 _ => Self::UnknownValue(training_state::UnknownValue(
13939 wkt::internal::UnknownEnumValue::Integer(value),
13940 )),
13941 }
13942 }
13943 }
13944
13945 impl std::convert::From<&str> for TrainingState {
13946 fn from(value: &str) -> Self {
13947 use std::string::ToString;
13948 match value {
13949 "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
13950 "PAUSED" => Self::Paused,
13951 "TRAINING" => Self::Training,
13952 _ => Self::UnknownValue(training_state::UnknownValue(
13953 wkt::internal::UnknownEnumValue::String(value.to_string()),
13954 )),
13955 }
13956 }
13957 }
13958
13959 impl serde::ser::Serialize for TrainingState {
13960 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13961 where
13962 S: serde::Serializer,
13963 {
13964 match self {
13965 Self::Unspecified => serializer.serialize_i32(0),
13966 Self::Paused => serializer.serialize_i32(1),
13967 Self::Training => serializer.serialize_i32(2),
13968 Self::UnknownValue(u) => u.0.serialize(serializer),
13969 }
13970 }
13971 }
13972
13973 impl<'de> serde::de::Deserialize<'de> for TrainingState {
13974 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13975 where
13976 D: serde::Deserializer<'de>,
13977 {
13978 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
13979 ".google.cloud.retail.v2.Model.TrainingState",
13980 ))
13981 }
13982 }
13983
13984 /// Describes whether periodic tuning is enabled for this model
13985 /// or not. Periodic tuning is scheduled at most every three months. You can
13986 /// start a tuning process manually by using the `TuneModel`
13987 /// method, which starts a tuning process immediately and resets the quarterly
13988 /// schedule. Enabling or disabling periodic tuning does not affect any
13989 /// current tuning processes.
13990 ///
13991 /// # Working with unknown values
13992 ///
13993 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13994 /// additional enum variants at any time. Adding new variants is not considered
13995 /// a breaking change. Applications should write their code in anticipation of:
13996 ///
13997 /// - New values appearing in future releases of the client library, **and**
13998 /// - New values received dynamically, without application changes.
13999 ///
14000 /// Please consult the [Working with enums] section in the user guide for some
14001 /// guidelines.
14002 ///
14003 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14004 #[derive(Clone, Debug, PartialEq)]
14005 #[non_exhaustive]
14006 pub enum PeriodicTuningState {
14007 /// Unspecified default value, should never be explicitly set.
14008 Unspecified,
14009 /// The model has periodic tuning disabled. Tuning
14010 /// can be reenabled by calling the `EnableModelPeriodicTuning`
14011 /// method or by calling the `TuneModel` method.
14012 PeriodicTuningDisabled,
14013 /// The model cannot be tuned with periodic tuning OR the
14014 /// `TuneModel` method. Hide the options in customer UI and
14015 /// reject any requests through the backend self serve API.
14016 AllTuningDisabled,
14017 /// The model has periodic tuning enabled. Tuning
14018 /// can be disabled by calling the `DisableModelPeriodicTuning`
14019 /// method.
14020 PeriodicTuningEnabled,
14021 /// If set, the enum was initialized with an unknown value.
14022 ///
14023 /// Applications can examine the value using [PeriodicTuningState::value] or
14024 /// [PeriodicTuningState::name].
14025 UnknownValue(periodic_tuning_state::UnknownValue),
14026 }
14027
14028 #[doc(hidden)]
14029 pub mod periodic_tuning_state {
14030 #[allow(unused_imports)]
14031 use super::*;
14032 #[derive(Clone, Debug, PartialEq)]
14033 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14034 }
14035
14036 impl PeriodicTuningState {
14037 /// Gets the enum value.
14038 ///
14039 /// Returns `None` if the enum contains an unknown value deserialized from
14040 /// the string representation of enums.
14041 pub fn value(&self) -> std::option::Option<i32> {
14042 match self {
14043 Self::Unspecified => std::option::Option::Some(0),
14044 Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14045 Self::AllTuningDisabled => std::option::Option::Some(3),
14046 Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14047 Self::UnknownValue(u) => u.0.value(),
14048 }
14049 }
14050
14051 /// Gets the enum value as a string.
14052 ///
14053 /// Returns `None` if the enum contains an unknown value deserialized from
14054 /// the integer representation of enums.
14055 pub fn name(&self) -> std::option::Option<&str> {
14056 match self {
14057 Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14058 Self::PeriodicTuningDisabled => {
14059 std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14060 }
14061 Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14062 Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14063 Self::UnknownValue(u) => u.0.name(),
14064 }
14065 }
14066 }
14067
14068 impl std::default::Default for PeriodicTuningState {
14069 fn default() -> Self {
14070 use std::convert::From;
14071 Self::from(0)
14072 }
14073 }
14074
14075 impl std::fmt::Display for PeriodicTuningState {
14076 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14077 wkt::internal::display_enum(f, self.name(), self.value())
14078 }
14079 }
14080
14081 impl std::convert::From<i32> for PeriodicTuningState {
14082 fn from(value: i32) -> Self {
14083 match value {
14084 0 => Self::Unspecified,
14085 1 => Self::PeriodicTuningDisabled,
14086 2 => Self::PeriodicTuningEnabled,
14087 3 => Self::AllTuningDisabled,
14088 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14089 wkt::internal::UnknownEnumValue::Integer(value),
14090 )),
14091 }
14092 }
14093 }
14094
14095 impl std::convert::From<&str> for PeriodicTuningState {
14096 fn from(value: &str) -> Self {
14097 use std::string::ToString;
14098 match value {
14099 "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14100 "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14101 "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14102 "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14103 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14104 wkt::internal::UnknownEnumValue::String(value.to_string()),
14105 )),
14106 }
14107 }
14108 }
14109
14110 impl serde::ser::Serialize for PeriodicTuningState {
14111 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14112 where
14113 S: serde::Serializer,
14114 {
14115 match self {
14116 Self::Unspecified => serializer.serialize_i32(0),
14117 Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14118 Self::AllTuningDisabled => serializer.serialize_i32(3),
14119 Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14120 Self::UnknownValue(u) => u.0.serialize(serializer),
14121 }
14122 }
14123 }
14124
14125 impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14126 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14127 where
14128 D: serde::Deserializer<'de>,
14129 {
14130 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14131 ".google.cloud.retail.v2.Model.PeriodicTuningState",
14132 ))
14133 }
14134 }
14135
14136 /// Describes whether this model have sufficient training data
14137 /// to be continuously trained.
14138 ///
14139 /// # Working with unknown values
14140 ///
14141 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14142 /// additional enum variants at any time. Adding new variants is not considered
14143 /// a breaking change. Applications should write their code in anticipation of:
14144 ///
14145 /// - New values appearing in future releases of the client library, **and**
14146 /// - New values received dynamically, without application changes.
14147 ///
14148 /// Please consult the [Working with enums] section in the user guide for some
14149 /// guidelines.
14150 ///
14151 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14152 #[derive(Clone, Debug, PartialEq)]
14153 #[non_exhaustive]
14154 pub enum DataState {
14155 /// Unspecified default value, should never be explicitly set.
14156 Unspecified,
14157 /// The model has sufficient training data.
14158 DataOk,
14159 /// The model does not have sufficient training data. Error
14160 /// messages can be queried via Stackdriver.
14161 DataError,
14162 /// If set, the enum was initialized with an unknown value.
14163 ///
14164 /// Applications can examine the value using [DataState::value] or
14165 /// [DataState::name].
14166 UnknownValue(data_state::UnknownValue),
14167 }
14168
14169 #[doc(hidden)]
14170 pub mod data_state {
14171 #[allow(unused_imports)]
14172 use super::*;
14173 #[derive(Clone, Debug, PartialEq)]
14174 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14175 }
14176
14177 impl DataState {
14178 /// Gets the enum value.
14179 ///
14180 /// Returns `None` if the enum contains an unknown value deserialized from
14181 /// the string representation of enums.
14182 pub fn value(&self) -> std::option::Option<i32> {
14183 match self {
14184 Self::Unspecified => std::option::Option::Some(0),
14185 Self::DataOk => std::option::Option::Some(1),
14186 Self::DataError => std::option::Option::Some(2),
14187 Self::UnknownValue(u) => u.0.value(),
14188 }
14189 }
14190
14191 /// Gets the enum value as a string.
14192 ///
14193 /// Returns `None` if the enum contains an unknown value deserialized from
14194 /// the integer representation of enums.
14195 pub fn name(&self) -> std::option::Option<&str> {
14196 match self {
14197 Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14198 Self::DataOk => std::option::Option::Some("DATA_OK"),
14199 Self::DataError => std::option::Option::Some("DATA_ERROR"),
14200 Self::UnknownValue(u) => u.0.name(),
14201 }
14202 }
14203 }
14204
14205 impl std::default::Default for DataState {
14206 fn default() -> Self {
14207 use std::convert::From;
14208 Self::from(0)
14209 }
14210 }
14211
14212 impl std::fmt::Display for DataState {
14213 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14214 wkt::internal::display_enum(f, self.name(), self.value())
14215 }
14216 }
14217
14218 impl std::convert::From<i32> for DataState {
14219 fn from(value: i32) -> Self {
14220 match value {
14221 0 => Self::Unspecified,
14222 1 => Self::DataOk,
14223 2 => Self::DataError,
14224 _ => Self::UnknownValue(data_state::UnknownValue(
14225 wkt::internal::UnknownEnumValue::Integer(value),
14226 )),
14227 }
14228 }
14229 }
14230
14231 impl std::convert::From<&str> for DataState {
14232 fn from(value: &str) -> Self {
14233 use std::string::ToString;
14234 match value {
14235 "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14236 "DATA_OK" => Self::DataOk,
14237 "DATA_ERROR" => Self::DataError,
14238 _ => Self::UnknownValue(data_state::UnknownValue(
14239 wkt::internal::UnknownEnumValue::String(value.to_string()),
14240 )),
14241 }
14242 }
14243 }
14244
14245 impl serde::ser::Serialize for DataState {
14246 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14247 where
14248 S: serde::Serializer,
14249 {
14250 match self {
14251 Self::Unspecified => serializer.serialize_i32(0),
14252 Self::DataOk => serializer.serialize_i32(1),
14253 Self::DataError => serializer.serialize_i32(2),
14254 Self::UnknownValue(u) => u.0.serialize(serializer),
14255 }
14256 }
14257 }
14258
14259 impl<'de> serde::de::Deserialize<'de> for DataState {
14260 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14261 where
14262 D: serde::Deserializer<'de>,
14263 {
14264 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14265 ".google.cloud.retail.v2.Model.DataState",
14266 ))
14267 }
14268 }
14269
14270 /// Use single or multiple context products for recommendations.
14271 ///
14272 /// # Working with unknown values
14273 ///
14274 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14275 /// additional enum variants at any time. Adding new variants is not considered
14276 /// a breaking change. Applications should write their code in anticipation of:
14277 ///
14278 /// - New values appearing in future releases of the client library, **and**
14279 /// - New values received dynamically, without application changes.
14280 ///
14281 /// Please consult the [Working with enums] section in the user guide for some
14282 /// guidelines.
14283 ///
14284 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14285 #[derive(Clone, Debug, PartialEq)]
14286 #[non_exhaustive]
14287 pub enum ContextProductsType {
14288 /// Unspecified default value, should never be explicitly set.
14289 /// Defaults to
14290 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14291 ///
14292 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14293 Unspecified,
14294 /// Use only a single product as context for the recommendation. Typically
14295 /// used on pages like add-to-cart or product details.
14296 SingleContextProduct,
14297 /// Use one or multiple products as context for the recommendation. Typically
14298 /// used on shopping cart pages.
14299 MultipleContextProducts,
14300 /// If set, the enum was initialized with an unknown value.
14301 ///
14302 /// Applications can examine the value using [ContextProductsType::value] or
14303 /// [ContextProductsType::name].
14304 UnknownValue(context_products_type::UnknownValue),
14305 }
14306
14307 #[doc(hidden)]
14308 pub mod context_products_type {
14309 #[allow(unused_imports)]
14310 use super::*;
14311 #[derive(Clone, Debug, PartialEq)]
14312 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14313 }
14314
14315 impl ContextProductsType {
14316 /// Gets the enum value.
14317 ///
14318 /// Returns `None` if the enum contains an unknown value deserialized from
14319 /// the string representation of enums.
14320 pub fn value(&self) -> std::option::Option<i32> {
14321 match self {
14322 Self::Unspecified => std::option::Option::Some(0),
14323 Self::SingleContextProduct => std::option::Option::Some(1),
14324 Self::MultipleContextProducts => std::option::Option::Some(2),
14325 Self::UnknownValue(u) => u.0.value(),
14326 }
14327 }
14328
14329 /// Gets the enum value as a string.
14330 ///
14331 /// Returns `None` if the enum contains an unknown value deserialized from
14332 /// the integer representation of enums.
14333 pub fn name(&self) -> std::option::Option<&str> {
14334 match self {
14335 Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14336 Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14337 Self::MultipleContextProducts => {
14338 std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14339 }
14340 Self::UnknownValue(u) => u.0.name(),
14341 }
14342 }
14343 }
14344
14345 impl std::default::Default for ContextProductsType {
14346 fn default() -> Self {
14347 use std::convert::From;
14348 Self::from(0)
14349 }
14350 }
14351
14352 impl std::fmt::Display for ContextProductsType {
14353 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14354 wkt::internal::display_enum(f, self.name(), self.value())
14355 }
14356 }
14357
14358 impl std::convert::From<i32> for ContextProductsType {
14359 fn from(value: i32) -> Self {
14360 match value {
14361 0 => Self::Unspecified,
14362 1 => Self::SingleContextProduct,
14363 2 => Self::MultipleContextProducts,
14364 _ => Self::UnknownValue(context_products_type::UnknownValue(
14365 wkt::internal::UnknownEnumValue::Integer(value),
14366 )),
14367 }
14368 }
14369 }
14370
14371 impl std::convert::From<&str> for ContextProductsType {
14372 fn from(value: &str) -> Self {
14373 use std::string::ToString;
14374 match value {
14375 "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14376 "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14377 "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14378 _ => Self::UnknownValue(context_products_type::UnknownValue(
14379 wkt::internal::UnknownEnumValue::String(value.to_string()),
14380 )),
14381 }
14382 }
14383 }
14384
14385 impl serde::ser::Serialize for ContextProductsType {
14386 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14387 where
14388 S: serde::Serializer,
14389 {
14390 match self {
14391 Self::Unspecified => serializer.serialize_i32(0),
14392 Self::SingleContextProduct => serializer.serialize_i32(1),
14393 Self::MultipleContextProducts => serializer.serialize_i32(2),
14394 Self::UnknownValue(u) => u.0.serialize(serializer),
14395 }
14396 }
14397 }
14398
14399 impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14400 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14401 where
14402 D: serde::Deserializer<'de>,
14403 {
14404 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14405 ".google.cloud.retail.v2.Model.ContextProductsType",
14406 ))
14407 }
14408 }
14409}
14410
14411/// Request for creating a model.
14412#[derive(Clone, Default, PartialEq)]
14413#[non_exhaustive]
14414pub struct CreateModelRequest {
14415 /// Required. The parent resource under which to create the model. Format:
14416 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14417 pub parent: std::string::String,
14418
14419 /// Required. The payload of the [Model][google.cloud.retail.v2.Model] to
14420 /// create.
14421 ///
14422 /// [google.cloud.retail.v2.Model]: crate::model::Model
14423 pub model: std::option::Option<crate::model::Model>,
14424
14425 /// Optional. Whether to run a dry run to validate the request (without
14426 /// actually creating the model).
14427 pub dry_run: bool,
14428
14429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14430}
14431
14432impl CreateModelRequest {
14433 pub fn new() -> Self {
14434 std::default::Default::default()
14435 }
14436
14437 /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14438 ///
14439 /// # Example
14440 /// ```ignore,no_run
14441 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14442 /// let x = CreateModelRequest::new().set_parent("example");
14443 /// ```
14444 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14445 self.parent = v.into();
14446 self
14447 }
14448
14449 /// Sets the value of [model][crate::model::CreateModelRequest::model].
14450 ///
14451 /// # Example
14452 /// ```ignore,no_run
14453 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14454 /// use google_cloud_retail_v2::model::Model;
14455 /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14456 /// ```
14457 pub fn set_model<T>(mut self, v: T) -> Self
14458 where
14459 T: std::convert::Into<crate::model::Model>,
14460 {
14461 self.model = std::option::Option::Some(v.into());
14462 self
14463 }
14464
14465 /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14466 ///
14467 /// # Example
14468 /// ```ignore,no_run
14469 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14470 /// use google_cloud_retail_v2::model::Model;
14471 /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14472 /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14473 /// ```
14474 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14475 where
14476 T: std::convert::Into<crate::model::Model>,
14477 {
14478 self.model = v.map(|x| x.into());
14479 self
14480 }
14481
14482 /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14483 ///
14484 /// # Example
14485 /// ```ignore,no_run
14486 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14487 /// let x = CreateModelRequest::new().set_dry_run(true);
14488 /// ```
14489 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14490 self.dry_run = v.into();
14491 self
14492 }
14493}
14494
14495impl wkt::message::Message for CreateModelRequest {
14496 fn typename() -> &'static str {
14497 "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14498 }
14499}
14500
14501/// Request for updating an existing model.
14502#[derive(Clone, Default, PartialEq)]
14503#[non_exhaustive]
14504pub struct UpdateModelRequest {
14505 /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14506 ///
14507 /// [google.cloud.retail.v2.Model]: crate::model::Model
14508 pub model: std::option::Option<crate::model::Model>,
14509
14510 /// Optional. Indicates which fields in the provided 'model' to
14511 /// update. If not set, by default updates all fields.
14512 pub update_mask: std::option::Option<wkt::FieldMask>,
14513
14514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14515}
14516
14517impl UpdateModelRequest {
14518 pub fn new() -> Self {
14519 std::default::Default::default()
14520 }
14521
14522 /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14523 ///
14524 /// # Example
14525 /// ```ignore,no_run
14526 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14527 /// use google_cloud_retail_v2::model::Model;
14528 /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14529 /// ```
14530 pub fn set_model<T>(mut self, v: T) -> Self
14531 where
14532 T: std::convert::Into<crate::model::Model>,
14533 {
14534 self.model = std::option::Option::Some(v.into());
14535 self
14536 }
14537
14538 /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14539 ///
14540 /// # Example
14541 /// ```ignore,no_run
14542 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14543 /// use google_cloud_retail_v2::model::Model;
14544 /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14545 /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14546 /// ```
14547 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14548 where
14549 T: std::convert::Into<crate::model::Model>,
14550 {
14551 self.model = v.map(|x| x.into());
14552 self
14553 }
14554
14555 /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14556 ///
14557 /// # Example
14558 /// ```ignore,no_run
14559 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14560 /// use wkt::FieldMask;
14561 /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14562 /// ```
14563 pub fn set_update_mask<T>(mut self, v: T) -> Self
14564 where
14565 T: std::convert::Into<wkt::FieldMask>,
14566 {
14567 self.update_mask = std::option::Option::Some(v.into());
14568 self
14569 }
14570
14571 /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14572 ///
14573 /// # Example
14574 /// ```ignore,no_run
14575 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14576 /// use wkt::FieldMask;
14577 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14578 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14579 /// ```
14580 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14581 where
14582 T: std::convert::Into<wkt::FieldMask>,
14583 {
14584 self.update_mask = v.map(|x| x.into());
14585 self
14586 }
14587}
14588
14589impl wkt::message::Message for UpdateModelRequest {
14590 fn typename() -> &'static str {
14591 "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14592 }
14593}
14594
14595/// Request for getting a model.
14596#[derive(Clone, Default, PartialEq)]
14597#[non_exhaustive]
14598pub struct GetModelRequest {
14599 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14600 /// get. Format:
14601 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14602 ///
14603 /// [google.cloud.retail.v2.Model]: crate::model::Model
14604 pub name: std::string::String,
14605
14606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14607}
14608
14609impl GetModelRequest {
14610 pub fn new() -> Self {
14611 std::default::Default::default()
14612 }
14613
14614 /// Sets the value of [name][crate::model::GetModelRequest::name].
14615 ///
14616 /// # Example
14617 /// ```ignore,no_run
14618 /// # use google_cloud_retail_v2::model::GetModelRequest;
14619 /// let x = GetModelRequest::new().set_name("example");
14620 /// ```
14621 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14622 self.name = v.into();
14623 self
14624 }
14625}
14626
14627impl wkt::message::Message for GetModelRequest {
14628 fn typename() -> &'static str {
14629 "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14630 }
14631}
14632
14633/// Request for pausing training of a model.
14634#[derive(Clone, Default, PartialEq)]
14635#[non_exhaustive]
14636pub struct PauseModelRequest {
14637 /// Required. The name of the model to pause.
14638 /// Format:
14639 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14640 pub name: std::string::String,
14641
14642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14643}
14644
14645impl PauseModelRequest {
14646 pub fn new() -> Self {
14647 std::default::Default::default()
14648 }
14649
14650 /// Sets the value of [name][crate::model::PauseModelRequest::name].
14651 ///
14652 /// # Example
14653 /// ```ignore,no_run
14654 /// # use google_cloud_retail_v2::model::PauseModelRequest;
14655 /// let x = PauseModelRequest::new().set_name("example");
14656 /// ```
14657 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14658 self.name = v.into();
14659 self
14660 }
14661}
14662
14663impl wkt::message::Message for PauseModelRequest {
14664 fn typename() -> &'static str {
14665 "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14666 }
14667}
14668
14669/// Request for resuming training of a model.
14670#[derive(Clone, Default, PartialEq)]
14671#[non_exhaustive]
14672pub struct ResumeModelRequest {
14673 /// Required. The name of the model to resume.
14674 /// Format:
14675 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14676 pub name: std::string::String,
14677
14678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14679}
14680
14681impl ResumeModelRequest {
14682 pub fn new() -> Self {
14683 std::default::Default::default()
14684 }
14685
14686 /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14687 ///
14688 /// # Example
14689 /// ```ignore,no_run
14690 /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14691 /// let x = ResumeModelRequest::new().set_name("example");
14692 /// ```
14693 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14694 self.name = v.into();
14695 self
14696 }
14697}
14698
14699impl wkt::message::Message for ResumeModelRequest {
14700 fn typename() -> &'static str {
14701 "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14702 }
14703}
14704
14705/// Request for listing models associated with a resource.
14706#[derive(Clone, Default, PartialEq)]
14707#[non_exhaustive]
14708pub struct ListModelsRequest {
14709 /// Required. The parent for which to list models.
14710 /// Format:
14711 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14712 pub parent: std::string::String,
14713
14714 /// Optional. Maximum number of results to return. If unspecified, defaults
14715 /// to 50. Max allowed value is 1000.
14716 pub page_size: i32,
14717
14718 /// Optional. A page token, received from a previous `ListModels`
14719 /// call. Provide this to retrieve the subsequent page.
14720 pub page_token: std::string::String,
14721
14722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14723}
14724
14725impl ListModelsRequest {
14726 pub fn new() -> Self {
14727 std::default::Default::default()
14728 }
14729
14730 /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14731 ///
14732 /// # Example
14733 /// ```ignore,no_run
14734 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14735 /// let x = ListModelsRequest::new().set_parent("example");
14736 /// ```
14737 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14738 self.parent = v.into();
14739 self
14740 }
14741
14742 /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14743 ///
14744 /// # Example
14745 /// ```ignore,no_run
14746 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14747 /// let x = ListModelsRequest::new().set_page_size(42);
14748 /// ```
14749 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14750 self.page_size = v.into();
14751 self
14752 }
14753
14754 /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14755 ///
14756 /// # Example
14757 /// ```ignore,no_run
14758 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14759 /// let x = ListModelsRequest::new().set_page_token("example");
14760 /// ```
14761 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14762 self.page_token = v.into();
14763 self
14764 }
14765}
14766
14767impl wkt::message::Message for ListModelsRequest {
14768 fn typename() -> &'static str {
14769 "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14770 }
14771}
14772
14773/// Request for deleting a model.
14774#[derive(Clone, Default, PartialEq)]
14775#[non_exhaustive]
14776pub struct DeleteModelRequest {
14777 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14778 /// delete. Format:
14779 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14780 ///
14781 /// [google.cloud.retail.v2.Model]: crate::model::Model
14782 pub name: std::string::String,
14783
14784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14785}
14786
14787impl DeleteModelRequest {
14788 pub fn new() -> Self {
14789 std::default::Default::default()
14790 }
14791
14792 /// Sets the value of [name][crate::model::DeleteModelRequest::name].
14793 ///
14794 /// # Example
14795 /// ```ignore,no_run
14796 /// # use google_cloud_retail_v2::model::DeleteModelRequest;
14797 /// let x = DeleteModelRequest::new().set_name("example");
14798 /// ```
14799 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14800 self.name = v.into();
14801 self
14802 }
14803}
14804
14805impl wkt::message::Message for DeleteModelRequest {
14806 fn typename() -> &'static str {
14807 "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
14808 }
14809}
14810
14811/// Response to a ListModelRequest.
14812#[derive(Clone, Default, PartialEq)]
14813#[non_exhaustive]
14814pub struct ListModelsResponse {
14815 /// List of Models.
14816 pub models: std::vec::Vec<crate::model::Model>,
14817
14818 /// Pagination token, if not returned indicates the last page.
14819 pub next_page_token: std::string::String,
14820
14821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14822}
14823
14824impl ListModelsResponse {
14825 pub fn new() -> Self {
14826 std::default::Default::default()
14827 }
14828
14829 /// Sets the value of [models][crate::model::ListModelsResponse::models].
14830 ///
14831 /// # Example
14832 /// ```ignore,no_run
14833 /// # use google_cloud_retail_v2::model::ListModelsResponse;
14834 /// use google_cloud_retail_v2::model::Model;
14835 /// let x = ListModelsResponse::new()
14836 /// .set_models([
14837 /// Model::default()/* use setters */,
14838 /// Model::default()/* use (different) setters */,
14839 /// ]);
14840 /// ```
14841 pub fn set_models<T, V>(mut self, v: T) -> Self
14842 where
14843 T: std::iter::IntoIterator<Item = V>,
14844 V: std::convert::Into<crate::model::Model>,
14845 {
14846 use std::iter::Iterator;
14847 self.models = v.into_iter().map(|i| i.into()).collect();
14848 self
14849 }
14850
14851 /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
14852 ///
14853 /// # Example
14854 /// ```ignore,no_run
14855 /// # use google_cloud_retail_v2::model::ListModelsResponse;
14856 /// let x = ListModelsResponse::new().set_next_page_token("example");
14857 /// ```
14858 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14859 self.next_page_token = v.into();
14860 self
14861 }
14862}
14863
14864impl wkt::message::Message for ListModelsResponse {
14865 fn typename() -> &'static str {
14866 "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
14867 }
14868}
14869
14870#[doc(hidden)]
14871impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
14872 type PageItem = crate::model::Model;
14873
14874 fn items(self) -> std::vec::Vec<Self::PageItem> {
14875 self.models
14876 }
14877
14878 fn next_page_token(&self) -> std::string::String {
14879 use std::clone::Clone;
14880 self.next_page_token.clone()
14881 }
14882}
14883
14884/// Request to manually start a tuning process now (instead of waiting for
14885/// the periodically scheduled tuning to happen).
14886#[derive(Clone, Default, PartialEq)]
14887#[non_exhaustive]
14888pub struct TuneModelRequest {
14889 /// Required. The resource name of the model to tune.
14890 /// Format:
14891 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14892 pub name: std::string::String,
14893
14894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14895}
14896
14897impl TuneModelRequest {
14898 pub fn new() -> Self {
14899 std::default::Default::default()
14900 }
14901
14902 /// Sets the value of [name][crate::model::TuneModelRequest::name].
14903 ///
14904 /// # Example
14905 /// ```ignore,no_run
14906 /// # use google_cloud_retail_v2::model::TuneModelRequest;
14907 /// let x = TuneModelRequest::new().set_name("example");
14908 /// ```
14909 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14910 self.name = v.into();
14911 self
14912 }
14913}
14914
14915impl wkt::message::Message for TuneModelRequest {
14916 fn typename() -> &'static str {
14917 "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
14918 }
14919}
14920
14921/// Metadata associated with a create operation.
14922#[derive(Clone, Default, PartialEq)]
14923#[non_exhaustive]
14924pub struct CreateModelMetadata {
14925 /// The resource name of the model that this create applies to.
14926 /// Format:
14927 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14928 pub model: std::string::String,
14929
14930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14931}
14932
14933impl CreateModelMetadata {
14934 pub fn new() -> Self {
14935 std::default::Default::default()
14936 }
14937
14938 /// Sets the value of [model][crate::model::CreateModelMetadata::model].
14939 ///
14940 /// # Example
14941 /// ```ignore,no_run
14942 /// # use google_cloud_retail_v2::model::CreateModelMetadata;
14943 /// let x = CreateModelMetadata::new().set_model("example");
14944 /// ```
14945 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14946 self.model = v.into();
14947 self
14948 }
14949}
14950
14951impl wkt::message::Message for CreateModelMetadata {
14952 fn typename() -> &'static str {
14953 "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
14954 }
14955}
14956
14957/// Metadata associated with a tune operation.
14958#[derive(Clone, Default, PartialEq)]
14959#[non_exhaustive]
14960pub struct TuneModelMetadata {
14961 /// The resource name of the model that this tune applies to.
14962 /// Format:
14963 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14964 pub model: std::string::String,
14965
14966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14967}
14968
14969impl TuneModelMetadata {
14970 pub fn new() -> Self {
14971 std::default::Default::default()
14972 }
14973
14974 /// Sets the value of [model][crate::model::TuneModelMetadata::model].
14975 ///
14976 /// # Example
14977 /// ```ignore,no_run
14978 /// # use google_cloud_retail_v2::model::TuneModelMetadata;
14979 /// let x = TuneModelMetadata::new().set_model("example");
14980 /// ```
14981 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14982 self.model = v.into();
14983 self
14984 }
14985}
14986
14987impl wkt::message::Message for TuneModelMetadata {
14988 fn typename() -> &'static str {
14989 "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
14990 }
14991}
14992
14993/// Response associated with a tune operation.
14994#[derive(Clone, Default, PartialEq)]
14995#[non_exhaustive]
14996pub struct TuneModelResponse {
14997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14998}
14999
15000impl TuneModelResponse {
15001 pub fn new() -> Self {
15002 std::default::Default::default()
15003 }
15004}
15005
15006impl wkt::message::Message for TuneModelResponse {
15007 fn typename() -> &'static str {
15008 "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15009 }
15010}
15011
15012/// Request message for Predict method.
15013#[derive(Clone, Default, PartialEq)]
15014#[non_exhaustive]
15015pub struct PredictRequest {
15016 /// Required. Full resource name of the format:
15017 /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15018 /// or
15019 /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15020 /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15021 /// resource.
15022 /// The ID of the Recommendations AI serving config or placement.
15023 /// Before you can request predictions from your model, you must create at
15024 /// least one serving config or placement for it. For more information, see
15025 /// [Manage serving configs]
15026 /// (<https://cloud.google.com/retail/docs/manage-configs>).
15027 ///
15028 /// The full list of available serving configs can be seen at
15029 /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15030 pub placement: std::string::String,
15031
15032 /// Required. Context about the user, what they are looking at and what action
15033 /// they took to trigger the predict request. Note that this user event detail
15034 /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15035 /// request is required for event logging.
15036 ///
15037 /// Don't set
15038 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15039 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15040 /// fixed ID for different users. If you are trying to receive non-personalized
15041 /// recommendations (not recommended; this can negatively impact model
15042 /// performance), instead set
15043 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15044 /// random unique ID and leave
15045 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15046 ///
15047 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15048 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15049 pub user_event: std::option::Option<crate::model::UserEvent>,
15050
15051 /// Maximum number of results to return. Set this property to the number of
15052 /// prediction results needed. If zero, the service will choose a reasonable
15053 /// default. The maximum allowed value is 100. Values above 100 will be coerced
15054 /// to 100.
15055 pub page_size: i32,
15056
15057 /// This field is not used; leave it unset.
15058 #[deprecated]
15059 pub page_token: std::string::String,
15060
15061 /// Filter for restricting prediction results with a length limit of 5,000
15062 /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15063 ///
15064 /// * Tag expressions. Restricts predictions to products that match all of the
15065 /// specified tags. Boolean operators `OR` and `NOT` are supported if the
15066 /// expression is enclosed in parentheses, and must be separated from the
15067 /// tag values by a space. `-"tagA"` is also supported and is equivalent to
15068 /// `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15069 /// with a size limit of 1,000 characters.
15070 ///
15071 /// Note: "Recently viewed" models don't support tag filtering at the
15072 /// moment.
15073 ///
15074 /// * filterOutOfStockItems. Restricts predictions to products that do not
15075 /// have a
15076 /// stockState value of OUT_OF_STOCK.
15077 ///
15078 ///
15079 /// Examples:
15080 ///
15081 /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15082 /// * filterOutOfStockItems tag=(-"promotional")
15083 /// * filterOutOfStockItems
15084 ///
15085 /// If your filter blocks all prediction results, the API will return *no*
15086 /// results. If instead you want empty result sets to return generic
15087 /// (unfiltered) popular products, set `strictFiltering` to False in
15088 /// `PredictRequest.params`. Note that the API will never return items with
15089 /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15090 ///
15091 /// If `filterSyntaxV2` is set to true under the `params` field, then
15092 /// attribute-based expressions are expected instead of the above described
15093 /// tag-based syntax. Examples:
15094 ///
15095 /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15096 /// * (availability: ANY("IN_STOCK")) AND
15097 /// (colors: ANY("Red") OR categories: ANY("Phones"))
15098 ///
15099 /// For more information, see
15100 /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15101 pub filter: std::string::String,
15102
15103 /// Use validate only mode for this prediction query. If set to true, a
15104 /// dummy model will be used that returns arbitrary products.
15105 /// Note that the validate only mode should only be used for testing the API,
15106 /// or if the model is not ready.
15107 pub validate_only: bool,
15108
15109 /// Additional domain specific parameters for the predictions.
15110 ///
15111 /// Allowed values:
15112 ///
15113 /// * `returnProduct`: Boolean. If set to true, the associated product
15114 /// object will be returned in the `results.metadata` field in the
15115 /// prediction response.
15116 /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15117 /// corresponding to each returned product will be set in the
15118 /// `results.metadata` field in the prediction response. The given
15119 /// 'score' indicates the probability of a product being clicked/purchased
15120 /// given the user's context and history.
15121 /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15122 /// will return generic (unfiltered) popular products instead of empty if
15123 /// your filter blocks all prediction results.
15124 /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15125 /// it needs to be one of {'no-price-reranking', 'low-price-reranking',
15126 /// 'medium-price-reranking', 'high-price-reranking'}. This gives
15127 /// request-level control and adjusts prediction results based on product
15128 /// price.
15129 /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15130 /// it needs to be one of {'no-diversity', 'low-diversity',
15131 /// 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15132 /// request-level control and adjusts prediction results based on product
15133 /// category.
15134 /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15135 /// field is interpreteted according to the new, attribute-based syntax.
15136 pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15137
15138 /// The labels applied to a resource must meet the following requirements:
15139 ///
15140 /// * Each resource can have multiple labels, up to a maximum of 64.
15141 /// * Each label must be a key-value pair.
15142 /// * Keys have a minimum length of 1 character and a maximum length of 63
15143 /// characters and cannot be empty. Values can be empty and have a maximum
15144 /// length of 63 characters.
15145 /// * Keys and values can contain only lowercase letters, numeric characters,
15146 /// underscores, and dashes. All characters must use UTF-8 encoding, and
15147 /// international characters are allowed.
15148 /// * The key portion of a label must be unique. However, you can use the same
15149 /// key with multiple resources.
15150 /// * Keys must start with a lowercase letter or international character.
15151 ///
15152 /// See [Google Cloud
15153 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15154 /// for more details.
15155 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15156
15157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15158}
15159
15160impl PredictRequest {
15161 pub fn new() -> Self {
15162 std::default::Default::default()
15163 }
15164
15165 /// Sets the value of [placement][crate::model::PredictRequest::placement].
15166 ///
15167 /// # Example
15168 /// ```ignore,no_run
15169 /// # use google_cloud_retail_v2::model::PredictRequest;
15170 /// let x = PredictRequest::new().set_placement("example");
15171 /// ```
15172 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15173 self.placement = v.into();
15174 self
15175 }
15176
15177 /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15178 ///
15179 /// # Example
15180 /// ```ignore,no_run
15181 /// # use google_cloud_retail_v2::model::PredictRequest;
15182 /// use google_cloud_retail_v2::model::UserEvent;
15183 /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15184 /// ```
15185 pub fn set_user_event<T>(mut self, v: T) -> Self
15186 where
15187 T: std::convert::Into<crate::model::UserEvent>,
15188 {
15189 self.user_event = std::option::Option::Some(v.into());
15190 self
15191 }
15192
15193 /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15194 ///
15195 /// # Example
15196 /// ```ignore,no_run
15197 /// # use google_cloud_retail_v2::model::PredictRequest;
15198 /// use google_cloud_retail_v2::model::UserEvent;
15199 /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15200 /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15201 /// ```
15202 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15203 where
15204 T: std::convert::Into<crate::model::UserEvent>,
15205 {
15206 self.user_event = v.map(|x| x.into());
15207 self
15208 }
15209
15210 /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15211 ///
15212 /// # Example
15213 /// ```ignore,no_run
15214 /// # use google_cloud_retail_v2::model::PredictRequest;
15215 /// let x = PredictRequest::new().set_page_size(42);
15216 /// ```
15217 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15218 self.page_size = v.into();
15219 self
15220 }
15221
15222 /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15223 ///
15224 /// # Example
15225 /// ```ignore,no_run
15226 /// # use google_cloud_retail_v2::model::PredictRequest;
15227 /// let x = PredictRequest::new().set_page_token("example");
15228 /// ```
15229 #[deprecated]
15230 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15231 self.page_token = v.into();
15232 self
15233 }
15234
15235 /// Sets the value of [filter][crate::model::PredictRequest::filter].
15236 ///
15237 /// # Example
15238 /// ```ignore,no_run
15239 /// # use google_cloud_retail_v2::model::PredictRequest;
15240 /// let x = PredictRequest::new().set_filter("example");
15241 /// ```
15242 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15243 self.filter = v.into();
15244 self
15245 }
15246
15247 /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15248 ///
15249 /// # Example
15250 /// ```ignore,no_run
15251 /// # use google_cloud_retail_v2::model::PredictRequest;
15252 /// let x = PredictRequest::new().set_validate_only(true);
15253 /// ```
15254 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15255 self.validate_only = v.into();
15256 self
15257 }
15258
15259 /// Sets the value of [params][crate::model::PredictRequest::params].
15260 ///
15261 /// # Example
15262 /// ```ignore,no_run
15263 /// # use google_cloud_retail_v2::model::PredictRequest;
15264 /// use wkt::Value;
15265 /// let x = PredictRequest::new().set_params([
15266 /// ("key0", Value::default()/* use setters */),
15267 /// ("key1", Value::default()/* use (different) setters */),
15268 /// ]);
15269 /// ```
15270 pub fn set_params<T, K, V>(mut self, v: T) -> Self
15271 where
15272 T: std::iter::IntoIterator<Item = (K, V)>,
15273 K: std::convert::Into<std::string::String>,
15274 V: std::convert::Into<wkt::Value>,
15275 {
15276 use std::iter::Iterator;
15277 self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15278 self
15279 }
15280
15281 /// Sets the value of [labels][crate::model::PredictRequest::labels].
15282 ///
15283 /// # Example
15284 /// ```ignore,no_run
15285 /// # use google_cloud_retail_v2::model::PredictRequest;
15286 /// let x = PredictRequest::new().set_labels([
15287 /// ("key0", "abc"),
15288 /// ("key1", "xyz"),
15289 /// ]);
15290 /// ```
15291 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15292 where
15293 T: std::iter::IntoIterator<Item = (K, V)>,
15294 K: std::convert::Into<std::string::String>,
15295 V: std::convert::Into<std::string::String>,
15296 {
15297 use std::iter::Iterator;
15298 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15299 self
15300 }
15301}
15302
15303impl wkt::message::Message for PredictRequest {
15304 fn typename() -> &'static str {
15305 "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15306 }
15307}
15308
15309/// Response message for predict method.
15310#[derive(Clone, Default, PartialEq)]
15311#[non_exhaustive]
15312pub struct PredictResponse {
15313 /// A list of recommended products. The order represents the ranking (from the
15314 /// most relevant product to the least).
15315 pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15316
15317 /// A unique attribution token. This should be included in the
15318 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15319 /// recommendation, which enables accurate attribution of recommendation model
15320 /// performance.
15321 ///
15322 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15323 pub attribution_token: std::string::String,
15324
15325 /// IDs of products in the request that were missing from the inventory.
15326 pub missing_ids: std::vec::Vec<std::string::String>,
15327
15328 /// True if the validateOnly property was set in the request.
15329 pub validate_only: bool,
15330
15331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15332}
15333
15334impl PredictResponse {
15335 pub fn new() -> Self {
15336 std::default::Default::default()
15337 }
15338
15339 /// Sets the value of [results][crate::model::PredictResponse::results].
15340 ///
15341 /// # Example
15342 /// ```ignore,no_run
15343 /// # use google_cloud_retail_v2::model::PredictResponse;
15344 /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15345 /// let x = PredictResponse::new()
15346 /// .set_results([
15347 /// PredictionResult::default()/* use setters */,
15348 /// PredictionResult::default()/* use (different) setters */,
15349 /// ]);
15350 /// ```
15351 pub fn set_results<T, V>(mut self, v: T) -> Self
15352 where
15353 T: std::iter::IntoIterator<Item = V>,
15354 V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15355 {
15356 use std::iter::Iterator;
15357 self.results = v.into_iter().map(|i| i.into()).collect();
15358 self
15359 }
15360
15361 /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15362 ///
15363 /// # Example
15364 /// ```ignore,no_run
15365 /// # use google_cloud_retail_v2::model::PredictResponse;
15366 /// let x = PredictResponse::new().set_attribution_token("example");
15367 /// ```
15368 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15369 mut self,
15370 v: T,
15371 ) -> Self {
15372 self.attribution_token = v.into();
15373 self
15374 }
15375
15376 /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15377 ///
15378 /// # Example
15379 /// ```ignore,no_run
15380 /// # use google_cloud_retail_v2::model::PredictResponse;
15381 /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15382 /// ```
15383 pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15384 where
15385 T: std::iter::IntoIterator<Item = V>,
15386 V: std::convert::Into<std::string::String>,
15387 {
15388 use std::iter::Iterator;
15389 self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15390 self
15391 }
15392
15393 /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15394 ///
15395 /// # Example
15396 /// ```ignore,no_run
15397 /// # use google_cloud_retail_v2::model::PredictResponse;
15398 /// let x = PredictResponse::new().set_validate_only(true);
15399 /// ```
15400 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15401 self.validate_only = v.into();
15402 self
15403 }
15404}
15405
15406impl wkt::message::Message for PredictResponse {
15407 fn typename() -> &'static str {
15408 "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15409 }
15410}
15411
15412/// Defines additional types related to [PredictResponse].
15413pub mod predict_response {
15414 #[allow(unused_imports)]
15415 use super::*;
15416
15417 /// PredictionResult represents the recommendation prediction results.
15418 #[derive(Clone, Default, PartialEq)]
15419 #[non_exhaustive]
15420 pub struct PredictionResult {
15421 /// ID of the recommended product
15422 pub id: std::string::String,
15423
15424 /// Additional product metadata / annotations.
15425 ///
15426 /// Possible values:
15427 ///
15428 /// * `product`: JSON representation of the product. Is set if
15429 /// `returnProduct` is set to true in `PredictRequest.params`.
15430 /// * `score`: Prediction score in double value. Is set if
15431 /// `returnScore` is set to true in `PredictRequest.params`.
15432 pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15433
15434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15435 }
15436
15437 impl PredictionResult {
15438 pub fn new() -> Self {
15439 std::default::Default::default()
15440 }
15441
15442 /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15443 ///
15444 /// # Example
15445 /// ```ignore,no_run
15446 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15447 /// let x = PredictionResult::new().set_id("example");
15448 /// ```
15449 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15450 self.id = v.into();
15451 self
15452 }
15453
15454 /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15455 ///
15456 /// # Example
15457 /// ```ignore,no_run
15458 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15459 /// use wkt::Value;
15460 /// let x = PredictionResult::new().set_metadata([
15461 /// ("key0", Value::default()/* use setters */),
15462 /// ("key1", Value::default()/* use (different) setters */),
15463 /// ]);
15464 /// ```
15465 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15466 where
15467 T: std::iter::IntoIterator<Item = (K, V)>,
15468 K: std::convert::Into<std::string::String>,
15469 V: std::convert::Into<wkt::Value>,
15470 {
15471 use std::iter::Iterator;
15472 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15473 self
15474 }
15475 }
15476
15477 impl wkt::message::Message for PredictionResult {
15478 fn typename() -> &'static str {
15479 "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15480 }
15481 }
15482}
15483
15484/// Product captures all metadata information of items to be recommended or
15485/// searched.
15486#[derive(Clone, Default, PartialEq)]
15487#[non_exhaustive]
15488pub struct Product {
15489 /// Immutable. Full resource name of the product, such as
15490 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15491 pub name: std::string::String,
15492
15493 /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15494 /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15495 /// example, this field is "id_1", if
15496 /// [name][google.cloud.retail.v2.Product.name] is
15497 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15498 ///
15499 /// This field must be a UTF-8 encoded string with a length limit of 128
15500 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15501 ///
15502 /// Corresponding properties: Google Merchant Center property
15503 /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15504 /// property [Product.sku](https://schema.org/sku).
15505 ///
15506 /// [google.cloud.retail.v2.Product]: crate::model::Product
15507 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15508 pub id: std::string::String,
15509
15510 /// Immutable. The type of the product. Default to
15511 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15512 /// if unset.
15513 ///
15514 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15515 pub r#type: crate::model::product::Type,
15516
15517 /// Variant group identifier. Must be an
15518 /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15519 /// this product. Otherwise, an error is thrown.
15520 ///
15521 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15522 /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15523 /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15524 ///
15525 /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15526 /// be empty. A maximum of 2,000 products are allowed to share the same
15527 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15528 /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15529 /// error is returned.
15530 ///
15531 /// Corresponding properties: Google Merchant Center property
15532 /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15533 /// Schema.org property
15534 /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15535 ///
15536 /// [google.cloud.retail.v2.Product]: crate::model::Product
15537 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15538 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15539 pub primary_product_id: std::string::String,
15540
15541 /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15542 /// [type][google.cloud.retail.v2.Product.type] is
15543 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15544 ///
15545 /// Non-existent product ids are allowed.
15546 /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15547 /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15548 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15549 /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15550 /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15551 /// return.
15552 ///
15553 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15554 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15555 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15556 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15557 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15558 pub collection_member_ids: std::vec::Vec<std::string::String>,
15559
15560 /// The Global Trade Item Number (GTIN) of the product.
15561 ///
15562 /// This field must be a UTF-8 encoded string with a length limit of 128
15563 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15564 ///
15565 /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15566 /// returned.
15567 ///
15568 /// Corresponding properties: Google Merchant Center property
15569 /// [gtin](https://support.google.com/merchants/answer/6324461).
15570 /// Schema.org property
15571 /// [Product.isbn](https://schema.org/isbn),
15572 /// [Product.gtin8](https://schema.org/gtin8),
15573 /// [Product.gtin12](https://schema.org/gtin12),
15574 /// [Product.gtin13](https://schema.org/gtin13), or
15575 /// [Product.gtin14](https://schema.org/gtin14).
15576 ///
15577 /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15578 pub gtin: std::string::String,
15579
15580 /// Product categories. This field is repeated for supporting one product
15581 /// belonging to several parallel categories. Strongly recommended using the
15582 /// full path for better search / recommendation quality.
15583 ///
15584 /// To represent full path of category, use '>' sign to separate different
15585 /// hierarchies. If '>' is part of the category name, replace it with
15586 /// other character(s).
15587 ///
15588 /// For example, if a shoes product belongs to both
15589 /// ["Shoes & Accessories" -> "Shoes"] and
15590 /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15591 /// represented as:
15592 ///
15593 /// ```norust
15594 /// "categories": [
15595 /// "Shoes & Accessories > Shoes",
15596 /// "Sports & Fitness > Athletic Clothing > Shoes"
15597 /// ]
15598 /// ```
15599 ///
15600 /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15601 /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15602 /// error is returned.
15603 ///
15604 /// At most 250 values are allowed per
15605 /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15606 /// Google Cloud console. Empty values are not allowed. Each value must be a
15607 /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15608 /// INVALID_ARGUMENT error is returned.
15609 ///
15610 /// Corresponding properties: Google Merchant Center property
15611 /// [google_product_category][mc_google_product_category]. Schema.org property
15612 /// [Product.category] (<https://schema.org/category>).
15613 ///
15614 /// [google.cloud.retail.v2.Product]: crate::model::Product
15615 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15616 pub categories: std::vec::Vec<std::string::String>,
15617
15618 /// Required. Product title.
15619 ///
15620 /// This field must be a UTF-8 encoded string with a length limit of 1,000
15621 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15622 ///
15623 /// Corresponding properties: Google Merchant Center property
15624 /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15625 /// property [Product.name](https://schema.org/name).
15626 pub title: std::string::String,
15627
15628 /// The brands of the product.
15629 ///
15630 /// A maximum of 30 brands are allowed unless overridden through the Google
15631 /// Cloud console. Each
15632 /// brand must be a UTF-8 encoded string with a length limit of 1,000
15633 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15634 ///
15635 /// Corresponding properties: Google Merchant Center property
15636 /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15637 /// property [Product.brand](https://schema.org/brand).
15638 pub brands: std::vec::Vec<std::string::String>,
15639
15640 /// Product description.
15641 ///
15642 /// This field must be a UTF-8 encoded string with a length limit of 5,000
15643 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15644 ///
15645 /// Corresponding properties: Google Merchant Center property
15646 /// [description](https://support.google.com/merchants/answer/6324468).
15647 /// Schema.org property [Product.description](https://schema.org/description).
15648 pub description: std::string::String,
15649
15650 /// Language of the title/description and other string attributes. Use language
15651 /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15652 ///
15653 /// For product prediction, this field is ignored and the model automatically
15654 /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15655 /// can include text in different languages, but duplicating
15656 /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15657 /// languages can result in degraded model performance.
15658 ///
15659 /// For product search this field is in use. It defaults to "en-US" if unset.
15660 ///
15661 /// [google.cloud.retail.v2.Product]: crate::model::Product
15662 pub language_code: std::string::String,
15663
15664 /// Highly encouraged. Extra product attributes to be included. For example,
15665 /// for products, this could include the store name, vendor, style, color, etc.
15666 /// These are very strong signals for recommendation model, thus we highly
15667 /// recommend providing the attributes here.
15668 ///
15669 /// Features that can take on one of a limited number of possible values. Two
15670 /// types of features can be set are:
15671 ///
15672 /// Textual features. some examples would be the brand/maker of a product, or
15673 /// country of a customer. Numerical features. Some examples would be the
15674 /// height/weight of a product, or age of a customer.
15675 ///
15676 /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15677 /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15678 /// }`.
15679 ///
15680 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15681 /// error is returned:
15682 ///
15683 /// * Max entries count: 200.
15684 /// * The key must be a UTF-8 encoded string with a length limit of 128
15685 /// characters.
15686 /// * For indexable attribute, the key must match the pattern:
15687 /// `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15688 /// `KEY_1_LIKE_THIS`.
15689 /// * For text attributes, at most 400 values are allowed. Empty values are not
15690 /// allowed. Each value must be a non-empty UTF-8 encoded string with a
15691 /// length limit of 256 characters.
15692 /// * For number attributes, at most 400 values are allowed.
15693 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15694
15695 /// Custom tags associated with the product.
15696 ///
15697 /// At most 250 values are allowed per
15698 /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15699 /// encoded string with a length limit of 1,000 characters. Otherwise, an
15700 /// INVALID_ARGUMENT error is returned.
15701 ///
15702 /// This tag can be used for filtering recommendation results by passing the
15703 /// tag as part of the
15704 /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15705 ///
15706 /// Corresponding properties: Google Merchant Center property
15707 /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15708 ///
15709 /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15710 /// [google.cloud.retail.v2.Product]: crate::model::Product
15711 pub tags: std::vec::Vec<std::string::String>,
15712
15713 /// Product price and cost information.
15714 ///
15715 /// Corresponding properties: Google Merchant Center property
15716 /// [price](https://support.google.com/merchants/answer/6324371).
15717 pub price_info: std::option::Option<crate::model::PriceInfo>,
15718
15719 /// The rating of this product.
15720 pub rating: std::option::Option<crate::model::Rating>,
15721
15722 /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15723 /// available for
15724 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15725 /// that this is only applicable to
15726 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15727 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15728 /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15729 ///
15730 /// [google.cloud.retail.v2.Product]: crate::model::Product
15731 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15732 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15733 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15734 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15735 pub available_time: std::option::Option<wkt::Timestamp>,
15736
15737 /// The online availability of the [Product][google.cloud.retail.v2.Product].
15738 /// Default to
15739 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15740 ///
15741 /// For primary products with variants set the availability of the primary as
15742 /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15743 /// and set the true availability at the variant level. This way the primary
15744 /// product will be considered "in stock" as long as it has at least one
15745 /// variant in stock.
15746 ///
15747 /// For primary products with no variants set the true availability at the
15748 /// primary level.
15749 ///
15750 /// Corresponding properties: Google Merchant Center property
15751 /// [availability](https://support.google.com/merchants/answer/6324448).
15752 /// Schema.org property [Offer.availability](https://schema.org/availability).
15753 ///
15754 /// [google.cloud.retail.v2.Product]: crate::model::Product
15755 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15756 /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15757 pub availability: crate::model::product::Availability,
15758
15759 /// The available quantity of the item.
15760 pub available_quantity: std::option::Option<wkt::Int32Value>,
15761
15762 /// Fulfillment information, such as the store IDs for in-store pickup or
15763 /// region IDs for different shipping methods.
15764 ///
15765 /// All the elements must have distinct
15766 /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15767 /// Otherwise, an INVALID_ARGUMENT error is returned.
15768 ///
15769 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15770 pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15771
15772 /// Canonical URL directly linking to the product detail page.
15773 ///
15774 /// It is strongly recommended to provide a valid uri for the product,
15775 /// otherwise the service performance could be significantly degraded.
15776 ///
15777 /// This field must be a UTF-8 encoded string with a length limit of 5,000
15778 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15779 ///
15780 /// Corresponding properties: Google Merchant Center property
15781 /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
15782 /// property [Offer.url](https://schema.org/url).
15783 pub uri: std::string::String,
15784
15785 /// Product images for the product. We highly recommend putting the main
15786 /// image first.
15787 ///
15788 /// A maximum of 300 images are allowed.
15789 ///
15790 /// Corresponding properties: Google Merchant Center property
15791 /// [image_link](https://support.google.com/merchants/answer/6324350).
15792 /// Schema.org property [Product.image](https://schema.org/image).
15793 pub images: std::vec::Vec<crate::model::Image>,
15794
15795 /// The target group associated with a given audience (e.g. male, veterans,
15796 /// car owners, musicians, etc.) of the product.
15797 pub audience: std::option::Option<crate::model::Audience>,
15798
15799 /// The color of the product.
15800 ///
15801 /// Corresponding properties: Google Merchant Center property
15802 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
15803 /// property [Product.color](https://schema.org/color).
15804 pub color_info: std::option::Option<crate::model::ColorInfo>,
15805
15806 /// The size of the product. To represent different size systems or size types,
15807 /// consider using this format: [[[size_system:]size_type:]size_value].
15808 ///
15809 /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
15810 /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
15811 /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
15812 /// both size system and size type are empty, while size value is "32 inches".
15813 ///
15814 /// A maximum of 20 values are allowed per
15815 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15816 /// encoded string with a length limit of 128 characters. Otherwise, an
15817 /// INVALID_ARGUMENT error is returned.
15818 ///
15819 /// Corresponding properties: Google Merchant Center property
15820 /// [size](https://support.google.com/merchants/answer/6324492),
15821 /// [size_type](https://support.google.com/merchants/answer/6324497), and
15822 /// [size_system](https://support.google.com/merchants/answer/6324502).
15823 /// Schema.org property [Product.size](https://schema.org/size).
15824 ///
15825 /// [google.cloud.retail.v2.Product]: crate::model::Product
15826 pub sizes: std::vec::Vec<std::string::String>,
15827
15828 /// The material of the product. For example, "leather", "wooden".
15829 ///
15830 /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
15831 /// string with a length limit of 200 characters. Otherwise, an
15832 /// INVALID_ARGUMENT error is returned.
15833 ///
15834 /// Corresponding properties: Google Merchant Center property
15835 /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
15836 /// property [Product.material](https://schema.org/material).
15837 pub materials: std::vec::Vec<std::string::String>,
15838
15839 /// The pattern or graphic print of the product. For example, "striped", "polka
15840 /// dot", "paisley".
15841 ///
15842 /// A maximum of 20 values are allowed per
15843 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15844 /// encoded string with a length limit of 128 characters. Otherwise, an
15845 /// INVALID_ARGUMENT error is returned.
15846 ///
15847 /// Corresponding properties: Google Merchant Center property
15848 /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
15849 /// property [Product.pattern](https://schema.org/pattern).
15850 ///
15851 /// [google.cloud.retail.v2.Product]: crate::model::Product
15852 pub patterns: std::vec::Vec<std::string::String>,
15853
15854 /// The condition of the product. Strongly encouraged to use the standard
15855 /// values: "new", "refurbished", "used".
15856 ///
15857 /// A maximum of 1 value is allowed per
15858 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15859 /// encoded string with a length limit of 128 characters. Otherwise, an
15860 /// INVALID_ARGUMENT error is returned.
15861 ///
15862 /// Corresponding properties: Google Merchant Center property
15863 /// [condition](https://support.google.com/merchants/answer/6324469).
15864 /// Schema.org property
15865 /// [Offer.itemCondition](https://schema.org/itemCondition).
15866 ///
15867 /// [google.cloud.retail.v2.Product]: crate::model::Product
15868 pub conditions: std::vec::Vec<std::string::String>,
15869
15870 /// The promotions applied to the product. A maximum of 10 values are allowed
15871 /// per [Product][google.cloud.retail.v2.Product]. Only
15872 /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
15873 /// will be used, other fields will be ignored if set.
15874 ///
15875 /// [google.cloud.retail.v2.Product]: crate::model::Product
15876 /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
15877 pub promotions: std::vec::Vec<crate::model::Promotion>,
15878
15879 /// The timestamp when the product is published by the retailer for the first
15880 /// time, which indicates the freshness of the products. Note that this field
15881 /// is different from
15882 /// [available_time][google.cloud.retail.v2.Product.available_time], given it
15883 /// purely describes product freshness regardless of when it is available on
15884 /// search and recommendation.
15885 ///
15886 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
15887 pub publish_time: std::option::Option<wkt::Timestamp>,
15888
15889 /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
15890 /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
15891 ///
15892 /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
15893 ///
15894 /// * [audience][google.cloud.retail.v2.Product.audience]
15895 /// * [availability][google.cloud.retail.v2.Product.availability]
15896 /// * [brands][google.cloud.retail.v2.Product.brands]
15897 /// * [color_info][google.cloud.retail.v2.Product.color_info]
15898 /// * [conditions][google.cloud.retail.v2.Product.conditions]
15899 /// * [gtin][google.cloud.retail.v2.Product.gtin]
15900 /// * [materials][google.cloud.retail.v2.Product.materials]
15901 /// * [name][google.cloud.retail.v2.Product.name]
15902 /// * [patterns][google.cloud.retail.v2.Product.patterns]
15903 /// * [price_info][google.cloud.retail.v2.Product.price_info]
15904 /// * [rating][google.cloud.retail.v2.Product.rating]
15905 /// * [sizes][google.cloud.retail.v2.Product.sizes]
15906 /// * [title][google.cloud.retail.v2.Product.title]
15907 /// * [uri][google.cloud.retail.v2.Product.uri]
15908 ///
15909 /// Supported fields only for
15910 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15911 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
15912 ///
15913 /// * [categories][google.cloud.retail.v2.Product.categories]
15914 /// * [description][google.cloud.retail.v2.Product.description]
15915 /// * [images][google.cloud.retail.v2.Product.images]
15916 ///
15917 /// Supported fields only for
15918 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
15919 ///
15920 /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
15921 ///
15922 /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
15923 /// retrievable, include paths of the form "attributes.key" where "key" is the
15924 /// key of a custom attribute, as specified in
15925 /// [attributes][google.cloud.retail.v2.Product.attributes].
15926 ///
15927 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15928 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
15929 /// following fields are always returned in
15930 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
15931 ///
15932 /// * [name][google.cloud.retail.v2.Product.name]
15933 ///
15934 /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
15935 /// following fields are always returned in by default:
15936 ///
15937 /// * [name][google.cloud.retail.v2.Product.name]
15938 /// * [color_info][google.cloud.retail.v2.Product.color_info]
15939 ///
15940 /// Note: Returning more fields in
15941 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
15942 /// response payload size and serving latency.
15943 ///
15944 /// This field is deprecated. Use the retrievable site-wide control instead.
15945 ///
15946 /// [google.cloud.retail.v2.Product]: crate::model::Product
15947 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15948 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15949 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15950 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
15951 /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
15952 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
15953 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
15954 /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
15955 /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
15956 /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
15957 /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
15958 /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
15959 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
15960 /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
15961 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15962 /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
15963 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
15964 /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
15965 /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
15966 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
15967 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15968 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
15969 /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
15970 #[deprecated]
15971 pub retrievable_fields: std::option::Option<wkt::FieldMask>,
15972
15973 /// Output only. Product variants grouped together on primary product which
15974 /// share similar product attributes. It's automatically grouped by
15975 /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
15976 /// all the product variants. Only populated for
15977 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15978 /// [Product][google.cloud.retail.v2.Product]s.
15979 ///
15980 /// Note: This field is OUTPUT_ONLY for
15981 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
15982 /// Do not set this field in API requests.
15983 ///
15984 /// [google.cloud.retail.v2.Product]: crate::model::Product
15985 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15986 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
15987 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
15988 pub variants: std::vec::Vec<crate::model::Product>,
15989
15990 /// Output only. A list of local inventories specific to different places.
15991 ///
15992 /// This field can be managed by
15993 /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
15994 /// and
15995 /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
15996 /// APIs if fine-grained, high-volume updates are necessary.
15997 ///
15998 /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
15999 /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
16000 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
16001
16002 pub expiration: std::option::Option<crate::model::product::Expiration>,
16003
16004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16005}
16006
16007impl Product {
16008 pub fn new() -> Self {
16009 std::default::Default::default()
16010 }
16011
16012 /// Sets the value of [name][crate::model::Product::name].
16013 ///
16014 /// # Example
16015 /// ```ignore,no_run
16016 /// # use google_cloud_retail_v2::model::Product;
16017 /// let x = Product::new().set_name("example");
16018 /// ```
16019 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16020 self.name = v.into();
16021 self
16022 }
16023
16024 /// Sets the value of [id][crate::model::Product::id].
16025 ///
16026 /// # Example
16027 /// ```ignore,no_run
16028 /// # use google_cloud_retail_v2::model::Product;
16029 /// let x = Product::new().set_id("example");
16030 /// ```
16031 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16032 self.id = v.into();
16033 self
16034 }
16035
16036 /// Sets the value of [r#type][crate::model::Product::type].
16037 ///
16038 /// # Example
16039 /// ```ignore,no_run
16040 /// # use google_cloud_retail_v2::model::Product;
16041 /// use google_cloud_retail_v2::model::product::Type;
16042 /// let x0 = Product::new().set_type(Type::Primary);
16043 /// let x1 = Product::new().set_type(Type::Variant);
16044 /// let x2 = Product::new().set_type(Type::Collection);
16045 /// ```
16046 pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16047 self.r#type = v.into();
16048 self
16049 }
16050
16051 /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16052 ///
16053 /// # Example
16054 /// ```ignore,no_run
16055 /// # use google_cloud_retail_v2::model::Product;
16056 /// let x = Product::new().set_primary_product_id("example");
16057 /// ```
16058 pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16059 mut self,
16060 v: T,
16061 ) -> Self {
16062 self.primary_product_id = v.into();
16063 self
16064 }
16065
16066 /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16067 ///
16068 /// # Example
16069 /// ```ignore,no_run
16070 /// # use google_cloud_retail_v2::model::Product;
16071 /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16072 /// ```
16073 pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16074 where
16075 T: std::iter::IntoIterator<Item = V>,
16076 V: std::convert::Into<std::string::String>,
16077 {
16078 use std::iter::Iterator;
16079 self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16080 self
16081 }
16082
16083 /// Sets the value of [gtin][crate::model::Product::gtin].
16084 ///
16085 /// # Example
16086 /// ```ignore,no_run
16087 /// # use google_cloud_retail_v2::model::Product;
16088 /// let x = Product::new().set_gtin("example");
16089 /// ```
16090 pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16091 self.gtin = v.into();
16092 self
16093 }
16094
16095 /// Sets the value of [categories][crate::model::Product::categories].
16096 ///
16097 /// # Example
16098 /// ```ignore,no_run
16099 /// # use google_cloud_retail_v2::model::Product;
16100 /// let x = Product::new().set_categories(["a", "b", "c"]);
16101 /// ```
16102 pub fn set_categories<T, V>(mut self, v: T) -> Self
16103 where
16104 T: std::iter::IntoIterator<Item = V>,
16105 V: std::convert::Into<std::string::String>,
16106 {
16107 use std::iter::Iterator;
16108 self.categories = v.into_iter().map(|i| i.into()).collect();
16109 self
16110 }
16111
16112 /// Sets the value of [title][crate::model::Product::title].
16113 ///
16114 /// # Example
16115 /// ```ignore,no_run
16116 /// # use google_cloud_retail_v2::model::Product;
16117 /// let x = Product::new().set_title("example");
16118 /// ```
16119 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16120 self.title = v.into();
16121 self
16122 }
16123
16124 /// Sets the value of [brands][crate::model::Product::brands].
16125 ///
16126 /// # Example
16127 /// ```ignore,no_run
16128 /// # use google_cloud_retail_v2::model::Product;
16129 /// let x = Product::new().set_brands(["a", "b", "c"]);
16130 /// ```
16131 pub fn set_brands<T, V>(mut self, v: T) -> Self
16132 where
16133 T: std::iter::IntoIterator<Item = V>,
16134 V: std::convert::Into<std::string::String>,
16135 {
16136 use std::iter::Iterator;
16137 self.brands = v.into_iter().map(|i| i.into()).collect();
16138 self
16139 }
16140
16141 /// Sets the value of [description][crate::model::Product::description].
16142 ///
16143 /// # Example
16144 /// ```ignore,no_run
16145 /// # use google_cloud_retail_v2::model::Product;
16146 /// let x = Product::new().set_description("example");
16147 /// ```
16148 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16149 self.description = v.into();
16150 self
16151 }
16152
16153 /// Sets the value of [language_code][crate::model::Product::language_code].
16154 ///
16155 /// # Example
16156 /// ```ignore,no_run
16157 /// # use google_cloud_retail_v2::model::Product;
16158 /// let x = Product::new().set_language_code("example");
16159 /// ```
16160 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16161 self.language_code = v.into();
16162 self
16163 }
16164
16165 /// Sets the value of [attributes][crate::model::Product::attributes].
16166 ///
16167 /// # Example
16168 /// ```ignore,no_run
16169 /// # use google_cloud_retail_v2::model::Product;
16170 /// use google_cloud_retail_v2::model::CustomAttribute;
16171 /// let x = Product::new().set_attributes([
16172 /// ("key0", CustomAttribute::default()/* use setters */),
16173 /// ("key1", CustomAttribute::default()/* use (different) setters */),
16174 /// ]);
16175 /// ```
16176 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16177 where
16178 T: std::iter::IntoIterator<Item = (K, V)>,
16179 K: std::convert::Into<std::string::String>,
16180 V: std::convert::Into<crate::model::CustomAttribute>,
16181 {
16182 use std::iter::Iterator;
16183 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16184 self
16185 }
16186
16187 /// Sets the value of [tags][crate::model::Product::tags].
16188 ///
16189 /// # Example
16190 /// ```ignore,no_run
16191 /// # use google_cloud_retail_v2::model::Product;
16192 /// let x = Product::new().set_tags(["a", "b", "c"]);
16193 /// ```
16194 pub fn set_tags<T, V>(mut self, v: T) -> Self
16195 where
16196 T: std::iter::IntoIterator<Item = V>,
16197 V: std::convert::Into<std::string::String>,
16198 {
16199 use std::iter::Iterator;
16200 self.tags = v.into_iter().map(|i| i.into()).collect();
16201 self
16202 }
16203
16204 /// Sets the value of [price_info][crate::model::Product::price_info].
16205 ///
16206 /// # Example
16207 /// ```ignore,no_run
16208 /// # use google_cloud_retail_v2::model::Product;
16209 /// use google_cloud_retail_v2::model::PriceInfo;
16210 /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16211 /// ```
16212 pub fn set_price_info<T>(mut self, v: T) -> Self
16213 where
16214 T: std::convert::Into<crate::model::PriceInfo>,
16215 {
16216 self.price_info = std::option::Option::Some(v.into());
16217 self
16218 }
16219
16220 /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16221 ///
16222 /// # Example
16223 /// ```ignore,no_run
16224 /// # use google_cloud_retail_v2::model::Product;
16225 /// use google_cloud_retail_v2::model::PriceInfo;
16226 /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16227 /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16228 /// ```
16229 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16230 where
16231 T: std::convert::Into<crate::model::PriceInfo>,
16232 {
16233 self.price_info = v.map(|x| x.into());
16234 self
16235 }
16236
16237 /// Sets the value of [rating][crate::model::Product::rating].
16238 ///
16239 /// # Example
16240 /// ```ignore,no_run
16241 /// # use google_cloud_retail_v2::model::Product;
16242 /// use google_cloud_retail_v2::model::Rating;
16243 /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16244 /// ```
16245 pub fn set_rating<T>(mut self, v: T) -> Self
16246 where
16247 T: std::convert::Into<crate::model::Rating>,
16248 {
16249 self.rating = std::option::Option::Some(v.into());
16250 self
16251 }
16252
16253 /// Sets or clears the value of [rating][crate::model::Product::rating].
16254 ///
16255 /// # Example
16256 /// ```ignore,no_run
16257 /// # use google_cloud_retail_v2::model::Product;
16258 /// use google_cloud_retail_v2::model::Rating;
16259 /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16260 /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16261 /// ```
16262 pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16263 where
16264 T: std::convert::Into<crate::model::Rating>,
16265 {
16266 self.rating = v.map(|x| x.into());
16267 self
16268 }
16269
16270 /// Sets the value of [available_time][crate::model::Product::available_time].
16271 ///
16272 /// # Example
16273 /// ```ignore,no_run
16274 /// # use google_cloud_retail_v2::model::Product;
16275 /// use wkt::Timestamp;
16276 /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16277 /// ```
16278 pub fn set_available_time<T>(mut self, v: T) -> Self
16279 where
16280 T: std::convert::Into<wkt::Timestamp>,
16281 {
16282 self.available_time = std::option::Option::Some(v.into());
16283 self
16284 }
16285
16286 /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16287 ///
16288 /// # Example
16289 /// ```ignore,no_run
16290 /// # use google_cloud_retail_v2::model::Product;
16291 /// use wkt::Timestamp;
16292 /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16293 /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16294 /// ```
16295 pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16296 where
16297 T: std::convert::Into<wkt::Timestamp>,
16298 {
16299 self.available_time = v.map(|x| x.into());
16300 self
16301 }
16302
16303 /// Sets the value of [availability][crate::model::Product::availability].
16304 ///
16305 /// # Example
16306 /// ```ignore,no_run
16307 /// # use google_cloud_retail_v2::model::Product;
16308 /// use google_cloud_retail_v2::model::product::Availability;
16309 /// let x0 = Product::new().set_availability(Availability::InStock);
16310 /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16311 /// let x2 = Product::new().set_availability(Availability::Preorder);
16312 /// ```
16313 pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16314 mut self,
16315 v: T,
16316 ) -> Self {
16317 self.availability = v.into();
16318 self
16319 }
16320
16321 /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16322 ///
16323 /// # Example
16324 /// ```ignore,no_run
16325 /// # use google_cloud_retail_v2::model::Product;
16326 /// use wkt::Int32Value;
16327 /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16328 /// ```
16329 pub fn set_available_quantity<T>(mut self, v: T) -> Self
16330 where
16331 T: std::convert::Into<wkt::Int32Value>,
16332 {
16333 self.available_quantity = std::option::Option::Some(v.into());
16334 self
16335 }
16336
16337 /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16338 ///
16339 /// # Example
16340 /// ```ignore,no_run
16341 /// # use google_cloud_retail_v2::model::Product;
16342 /// use wkt::Int32Value;
16343 /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16344 /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16345 /// ```
16346 pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16347 where
16348 T: std::convert::Into<wkt::Int32Value>,
16349 {
16350 self.available_quantity = v.map(|x| x.into());
16351 self
16352 }
16353
16354 /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16355 ///
16356 /// # Example
16357 /// ```ignore,no_run
16358 /// # use google_cloud_retail_v2::model::Product;
16359 /// use google_cloud_retail_v2::model::FulfillmentInfo;
16360 /// let x = Product::new()
16361 /// .set_fulfillment_info([
16362 /// FulfillmentInfo::default()/* use setters */,
16363 /// FulfillmentInfo::default()/* use (different) setters */,
16364 /// ]);
16365 /// ```
16366 pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16367 where
16368 T: std::iter::IntoIterator<Item = V>,
16369 V: std::convert::Into<crate::model::FulfillmentInfo>,
16370 {
16371 use std::iter::Iterator;
16372 self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16373 self
16374 }
16375
16376 /// Sets the value of [uri][crate::model::Product::uri].
16377 ///
16378 /// # Example
16379 /// ```ignore,no_run
16380 /// # use google_cloud_retail_v2::model::Product;
16381 /// let x = Product::new().set_uri("example");
16382 /// ```
16383 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16384 self.uri = v.into();
16385 self
16386 }
16387
16388 /// Sets the value of [images][crate::model::Product::images].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_retail_v2::model::Product;
16393 /// use google_cloud_retail_v2::model::Image;
16394 /// let x = Product::new()
16395 /// .set_images([
16396 /// Image::default()/* use setters */,
16397 /// Image::default()/* use (different) setters */,
16398 /// ]);
16399 /// ```
16400 pub fn set_images<T, V>(mut self, v: T) -> Self
16401 where
16402 T: std::iter::IntoIterator<Item = V>,
16403 V: std::convert::Into<crate::model::Image>,
16404 {
16405 use std::iter::Iterator;
16406 self.images = v.into_iter().map(|i| i.into()).collect();
16407 self
16408 }
16409
16410 /// Sets the value of [audience][crate::model::Product::audience].
16411 ///
16412 /// # Example
16413 /// ```ignore,no_run
16414 /// # use google_cloud_retail_v2::model::Product;
16415 /// use google_cloud_retail_v2::model::Audience;
16416 /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16417 /// ```
16418 pub fn set_audience<T>(mut self, v: T) -> Self
16419 where
16420 T: std::convert::Into<crate::model::Audience>,
16421 {
16422 self.audience = std::option::Option::Some(v.into());
16423 self
16424 }
16425
16426 /// Sets or clears the value of [audience][crate::model::Product::audience].
16427 ///
16428 /// # Example
16429 /// ```ignore,no_run
16430 /// # use google_cloud_retail_v2::model::Product;
16431 /// use google_cloud_retail_v2::model::Audience;
16432 /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16433 /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16434 /// ```
16435 pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16436 where
16437 T: std::convert::Into<crate::model::Audience>,
16438 {
16439 self.audience = v.map(|x| x.into());
16440 self
16441 }
16442
16443 /// Sets the value of [color_info][crate::model::Product::color_info].
16444 ///
16445 /// # Example
16446 /// ```ignore,no_run
16447 /// # use google_cloud_retail_v2::model::Product;
16448 /// use google_cloud_retail_v2::model::ColorInfo;
16449 /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16450 /// ```
16451 pub fn set_color_info<T>(mut self, v: T) -> Self
16452 where
16453 T: std::convert::Into<crate::model::ColorInfo>,
16454 {
16455 self.color_info = std::option::Option::Some(v.into());
16456 self
16457 }
16458
16459 /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16460 ///
16461 /// # Example
16462 /// ```ignore,no_run
16463 /// # use google_cloud_retail_v2::model::Product;
16464 /// use google_cloud_retail_v2::model::ColorInfo;
16465 /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16466 /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16467 /// ```
16468 pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16469 where
16470 T: std::convert::Into<crate::model::ColorInfo>,
16471 {
16472 self.color_info = v.map(|x| x.into());
16473 self
16474 }
16475
16476 /// Sets the value of [sizes][crate::model::Product::sizes].
16477 ///
16478 /// # Example
16479 /// ```ignore,no_run
16480 /// # use google_cloud_retail_v2::model::Product;
16481 /// let x = Product::new().set_sizes(["a", "b", "c"]);
16482 /// ```
16483 pub fn set_sizes<T, V>(mut self, v: T) -> Self
16484 where
16485 T: std::iter::IntoIterator<Item = V>,
16486 V: std::convert::Into<std::string::String>,
16487 {
16488 use std::iter::Iterator;
16489 self.sizes = v.into_iter().map(|i| i.into()).collect();
16490 self
16491 }
16492
16493 /// Sets the value of [materials][crate::model::Product::materials].
16494 ///
16495 /// # Example
16496 /// ```ignore,no_run
16497 /// # use google_cloud_retail_v2::model::Product;
16498 /// let x = Product::new().set_materials(["a", "b", "c"]);
16499 /// ```
16500 pub fn set_materials<T, V>(mut self, v: T) -> Self
16501 where
16502 T: std::iter::IntoIterator<Item = V>,
16503 V: std::convert::Into<std::string::String>,
16504 {
16505 use std::iter::Iterator;
16506 self.materials = v.into_iter().map(|i| i.into()).collect();
16507 self
16508 }
16509
16510 /// Sets the value of [patterns][crate::model::Product::patterns].
16511 ///
16512 /// # Example
16513 /// ```ignore,no_run
16514 /// # use google_cloud_retail_v2::model::Product;
16515 /// let x = Product::new().set_patterns(["a", "b", "c"]);
16516 /// ```
16517 pub fn set_patterns<T, V>(mut self, v: T) -> Self
16518 where
16519 T: std::iter::IntoIterator<Item = V>,
16520 V: std::convert::Into<std::string::String>,
16521 {
16522 use std::iter::Iterator;
16523 self.patterns = v.into_iter().map(|i| i.into()).collect();
16524 self
16525 }
16526
16527 /// Sets the value of [conditions][crate::model::Product::conditions].
16528 ///
16529 /// # Example
16530 /// ```ignore,no_run
16531 /// # use google_cloud_retail_v2::model::Product;
16532 /// let x = Product::new().set_conditions(["a", "b", "c"]);
16533 /// ```
16534 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16535 where
16536 T: std::iter::IntoIterator<Item = V>,
16537 V: std::convert::Into<std::string::String>,
16538 {
16539 use std::iter::Iterator;
16540 self.conditions = v.into_iter().map(|i| i.into()).collect();
16541 self
16542 }
16543
16544 /// Sets the value of [promotions][crate::model::Product::promotions].
16545 ///
16546 /// # Example
16547 /// ```ignore,no_run
16548 /// # use google_cloud_retail_v2::model::Product;
16549 /// use google_cloud_retail_v2::model::Promotion;
16550 /// let x = Product::new()
16551 /// .set_promotions([
16552 /// Promotion::default()/* use setters */,
16553 /// Promotion::default()/* use (different) setters */,
16554 /// ]);
16555 /// ```
16556 pub fn set_promotions<T, V>(mut self, v: T) -> Self
16557 where
16558 T: std::iter::IntoIterator<Item = V>,
16559 V: std::convert::Into<crate::model::Promotion>,
16560 {
16561 use std::iter::Iterator;
16562 self.promotions = v.into_iter().map(|i| i.into()).collect();
16563 self
16564 }
16565
16566 /// Sets the value of [publish_time][crate::model::Product::publish_time].
16567 ///
16568 /// # Example
16569 /// ```ignore,no_run
16570 /// # use google_cloud_retail_v2::model::Product;
16571 /// use wkt::Timestamp;
16572 /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16573 /// ```
16574 pub fn set_publish_time<T>(mut self, v: T) -> Self
16575 where
16576 T: std::convert::Into<wkt::Timestamp>,
16577 {
16578 self.publish_time = std::option::Option::Some(v.into());
16579 self
16580 }
16581
16582 /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16583 ///
16584 /// # Example
16585 /// ```ignore,no_run
16586 /// # use google_cloud_retail_v2::model::Product;
16587 /// use wkt::Timestamp;
16588 /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16589 /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16590 /// ```
16591 pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16592 where
16593 T: std::convert::Into<wkt::Timestamp>,
16594 {
16595 self.publish_time = v.map(|x| x.into());
16596 self
16597 }
16598
16599 /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16600 ///
16601 /// # Example
16602 /// ```ignore,no_run
16603 /// # use google_cloud_retail_v2::model::Product;
16604 /// use wkt::FieldMask;
16605 /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16606 /// ```
16607 #[deprecated]
16608 pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16609 where
16610 T: std::convert::Into<wkt::FieldMask>,
16611 {
16612 self.retrievable_fields = std::option::Option::Some(v.into());
16613 self
16614 }
16615
16616 /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16617 ///
16618 /// # Example
16619 /// ```ignore,no_run
16620 /// # use google_cloud_retail_v2::model::Product;
16621 /// use wkt::FieldMask;
16622 /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16623 /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16624 /// ```
16625 #[deprecated]
16626 pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16627 where
16628 T: std::convert::Into<wkt::FieldMask>,
16629 {
16630 self.retrievable_fields = v.map(|x| x.into());
16631 self
16632 }
16633
16634 /// Sets the value of [variants][crate::model::Product::variants].
16635 ///
16636 /// # Example
16637 /// ```ignore,no_run
16638 /// # use google_cloud_retail_v2::model::Product;
16639 /// let x = Product::new()
16640 /// .set_variants([
16641 /// Product::default()/* use setters */,
16642 /// Product::default()/* use (different) setters */,
16643 /// ]);
16644 /// ```
16645 pub fn set_variants<T, V>(mut self, v: T) -> Self
16646 where
16647 T: std::iter::IntoIterator<Item = V>,
16648 V: std::convert::Into<crate::model::Product>,
16649 {
16650 use std::iter::Iterator;
16651 self.variants = v.into_iter().map(|i| i.into()).collect();
16652 self
16653 }
16654
16655 /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16656 ///
16657 /// # Example
16658 /// ```ignore,no_run
16659 /// # use google_cloud_retail_v2::model::Product;
16660 /// use google_cloud_retail_v2::model::LocalInventory;
16661 /// let x = Product::new()
16662 /// .set_local_inventories([
16663 /// LocalInventory::default()/* use setters */,
16664 /// LocalInventory::default()/* use (different) setters */,
16665 /// ]);
16666 /// ```
16667 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16668 where
16669 T: std::iter::IntoIterator<Item = V>,
16670 V: std::convert::Into<crate::model::LocalInventory>,
16671 {
16672 use std::iter::Iterator;
16673 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16674 self
16675 }
16676
16677 /// Sets the value of [expiration][crate::model::Product::expiration].
16678 ///
16679 /// Note that all the setters affecting `expiration` are mutually
16680 /// exclusive.
16681 ///
16682 /// # Example
16683 /// ```ignore,no_run
16684 /// # use google_cloud_retail_v2::model::Product;
16685 /// use wkt::Timestamp;
16686 /// let x = Product::new().set_expiration(Some(
16687 /// google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16688 /// ```
16689 pub fn set_expiration<
16690 T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16691 >(
16692 mut self,
16693 v: T,
16694 ) -> Self {
16695 self.expiration = v.into();
16696 self
16697 }
16698
16699 /// The value of [expiration][crate::model::Product::expiration]
16700 /// if it holds a `ExpireTime`, `None` if the field is not set or
16701 /// holds a different branch.
16702 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16703 #[allow(unreachable_patterns)]
16704 self.expiration.as_ref().and_then(|v| match v {
16705 crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16706 _ => std::option::Option::None,
16707 })
16708 }
16709
16710 /// Sets the value of [expiration][crate::model::Product::expiration]
16711 /// to hold a `ExpireTime`.
16712 ///
16713 /// Note that all the setters affecting `expiration` are
16714 /// mutually exclusive.
16715 ///
16716 /// # Example
16717 /// ```ignore,no_run
16718 /// # use google_cloud_retail_v2::model::Product;
16719 /// use wkt::Timestamp;
16720 /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16721 /// assert!(x.expire_time().is_some());
16722 /// assert!(x.ttl().is_none());
16723 /// ```
16724 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16725 mut self,
16726 v: T,
16727 ) -> Self {
16728 self.expiration =
16729 std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16730 self
16731 }
16732
16733 /// The value of [expiration][crate::model::Product::expiration]
16734 /// if it holds a `Ttl`, `None` if the field is not set or
16735 /// holds a different branch.
16736 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16737 #[allow(unreachable_patterns)]
16738 self.expiration.as_ref().and_then(|v| match v {
16739 crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16740 _ => std::option::Option::None,
16741 })
16742 }
16743
16744 /// Sets the value of [expiration][crate::model::Product::expiration]
16745 /// to hold a `Ttl`.
16746 ///
16747 /// Note that all the setters affecting `expiration` are
16748 /// mutually exclusive.
16749 ///
16750 /// # Example
16751 /// ```ignore,no_run
16752 /// # use google_cloud_retail_v2::model::Product;
16753 /// use wkt::Duration;
16754 /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16755 /// assert!(x.ttl().is_some());
16756 /// assert!(x.expire_time().is_none());
16757 /// ```
16758 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16759 self.expiration =
16760 std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16761 self
16762 }
16763}
16764
16765impl wkt::message::Message for Product {
16766 fn typename() -> &'static str {
16767 "type.googleapis.com/google.cloud.retail.v2.Product"
16768 }
16769}
16770
16771/// Defines additional types related to [Product].
16772pub mod product {
16773 #[allow(unused_imports)]
16774 use super::*;
16775
16776 /// The type of this product.
16777 ///
16778 /// # Working with unknown values
16779 ///
16780 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16781 /// additional enum variants at any time. Adding new variants is not considered
16782 /// a breaking change. Applications should write their code in anticipation of:
16783 ///
16784 /// - New values appearing in future releases of the client library, **and**
16785 /// - New values received dynamically, without application changes.
16786 ///
16787 /// Please consult the [Working with enums] section in the user guide for some
16788 /// guidelines.
16789 ///
16790 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16791 #[derive(Clone, Debug, PartialEq)]
16792 #[non_exhaustive]
16793 pub enum Type {
16794 /// Default value. Default to
16795 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
16796 /// if unset.
16797 ///
16798 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
16799 Unspecified,
16800 /// The primary type.
16801 ///
16802 /// As the primary unit for predicting, indexing and search serving, a
16803 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16804 /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
16805 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16806 /// [Product][google.cloud.retail.v2.Product]s.
16807 ///
16808 /// [google.cloud.retail.v2.Product]: crate::model::Product
16809 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16810 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16811 Primary,
16812 /// The variant type.
16813 ///
16814 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16815 /// [Product][google.cloud.retail.v2.Product]s usually share some common
16816 /// attributes on the same
16817 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16818 /// [Product][google.cloud.retail.v2.Product]s, but they have variant
16819 /// attributes like different colors, sizes and prices, etc.
16820 ///
16821 /// [google.cloud.retail.v2.Product]: crate::model::Product
16822 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16823 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16824 Variant,
16825 /// The collection type. Collection products are bundled
16826 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16827 /// [Product][google.cloud.retail.v2.Product]s or
16828 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16829 /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
16830 /// as a jewelry set with necklaces, earrings and rings, etc.
16831 ///
16832 /// [google.cloud.retail.v2.Product]: crate::model::Product
16833 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16834 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16835 Collection,
16836 /// If set, the enum was initialized with an unknown value.
16837 ///
16838 /// Applications can examine the value using [Type::value] or
16839 /// [Type::name].
16840 UnknownValue(r#type::UnknownValue),
16841 }
16842
16843 #[doc(hidden)]
16844 pub mod r#type {
16845 #[allow(unused_imports)]
16846 use super::*;
16847 #[derive(Clone, Debug, PartialEq)]
16848 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16849 }
16850
16851 impl Type {
16852 /// Gets the enum value.
16853 ///
16854 /// Returns `None` if the enum contains an unknown value deserialized from
16855 /// the string representation of enums.
16856 pub fn value(&self) -> std::option::Option<i32> {
16857 match self {
16858 Self::Unspecified => std::option::Option::Some(0),
16859 Self::Primary => std::option::Option::Some(1),
16860 Self::Variant => std::option::Option::Some(2),
16861 Self::Collection => std::option::Option::Some(3),
16862 Self::UnknownValue(u) => u.0.value(),
16863 }
16864 }
16865
16866 /// Gets the enum value as a string.
16867 ///
16868 /// Returns `None` if the enum contains an unknown value deserialized from
16869 /// the integer representation of enums.
16870 pub fn name(&self) -> std::option::Option<&str> {
16871 match self {
16872 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
16873 Self::Primary => std::option::Option::Some("PRIMARY"),
16874 Self::Variant => std::option::Option::Some("VARIANT"),
16875 Self::Collection => std::option::Option::Some("COLLECTION"),
16876 Self::UnknownValue(u) => u.0.name(),
16877 }
16878 }
16879 }
16880
16881 impl std::default::Default for Type {
16882 fn default() -> Self {
16883 use std::convert::From;
16884 Self::from(0)
16885 }
16886 }
16887
16888 impl std::fmt::Display for Type {
16889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16890 wkt::internal::display_enum(f, self.name(), self.value())
16891 }
16892 }
16893
16894 impl std::convert::From<i32> for Type {
16895 fn from(value: i32) -> Self {
16896 match value {
16897 0 => Self::Unspecified,
16898 1 => Self::Primary,
16899 2 => Self::Variant,
16900 3 => Self::Collection,
16901 _ => Self::UnknownValue(r#type::UnknownValue(
16902 wkt::internal::UnknownEnumValue::Integer(value),
16903 )),
16904 }
16905 }
16906 }
16907
16908 impl std::convert::From<&str> for Type {
16909 fn from(value: &str) -> Self {
16910 use std::string::ToString;
16911 match value {
16912 "TYPE_UNSPECIFIED" => Self::Unspecified,
16913 "PRIMARY" => Self::Primary,
16914 "VARIANT" => Self::Variant,
16915 "COLLECTION" => Self::Collection,
16916 _ => Self::UnknownValue(r#type::UnknownValue(
16917 wkt::internal::UnknownEnumValue::String(value.to_string()),
16918 )),
16919 }
16920 }
16921 }
16922
16923 impl serde::ser::Serialize for Type {
16924 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16925 where
16926 S: serde::Serializer,
16927 {
16928 match self {
16929 Self::Unspecified => serializer.serialize_i32(0),
16930 Self::Primary => serializer.serialize_i32(1),
16931 Self::Variant => serializer.serialize_i32(2),
16932 Self::Collection => serializer.serialize_i32(3),
16933 Self::UnknownValue(u) => u.0.serialize(serializer),
16934 }
16935 }
16936 }
16937
16938 impl<'de> serde::de::Deserialize<'de> for Type {
16939 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16940 where
16941 D: serde::Deserializer<'de>,
16942 {
16943 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
16944 ".google.cloud.retail.v2.Product.Type",
16945 ))
16946 }
16947 }
16948
16949 /// Product availability. If this field is unspecified, the product is
16950 /// assumed to be in stock.
16951 ///
16952 /// # Working with unknown values
16953 ///
16954 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16955 /// additional enum variants at any time. Adding new variants is not considered
16956 /// a breaking change. Applications should write their code in anticipation of:
16957 ///
16958 /// - New values appearing in future releases of the client library, **and**
16959 /// - New values received dynamically, without application changes.
16960 ///
16961 /// Please consult the [Working with enums] section in the user guide for some
16962 /// guidelines.
16963 ///
16964 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16965 #[derive(Clone, Debug, PartialEq)]
16966 #[non_exhaustive]
16967 pub enum Availability {
16968 /// Default product availability. Default to
16969 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
16970 /// if unset.
16971 ///
16972 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
16973 Unspecified,
16974 /// Product in stock.
16975 InStock,
16976 /// Product out of stock.
16977 OutOfStock,
16978 /// Product that is in pre-order state.
16979 Preorder,
16980 /// Product that is back-ordered (i.e. temporarily out of stock).
16981 Backorder,
16982 /// If set, the enum was initialized with an unknown value.
16983 ///
16984 /// Applications can examine the value using [Availability::value] or
16985 /// [Availability::name].
16986 UnknownValue(availability::UnknownValue),
16987 }
16988
16989 #[doc(hidden)]
16990 pub mod availability {
16991 #[allow(unused_imports)]
16992 use super::*;
16993 #[derive(Clone, Debug, PartialEq)]
16994 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16995 }
16996
16997 impl Availability {
16998 /// Gets the enum value.
16999 ///
17000 /// Returns `None` if the enum contains an unknown value deserialized from
17001 /// the string representation of enums.
17002 pub fn value(&self) -> std::option::Option<i32> {
17003 match self {
17004 Self::Unspecified => std::option::Option::Some(0),
17005 Self::InStock => std::option::Option::Some(1),
17006 Self::OutOfStock => std::option::Option::Some(2),
17007 Self::Preorder => std::option::Option::Some(3),
17008 Self::Backorder => std::option::Option::Some(4),
17009 Self::UnknownValue(u) => u.0.value(),
17010 }
17011 }
17012
17013 /// Gets the enum value as a string.
17014 ///
17015 /// Returns `None` if the enum contains an unknown value deserialized from
17016 /// the integer representation of enums.
17017 pub fn name(&self) -> std::option::Option<&str> {
17018 match self {
17019 Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17020 Self::InStock => std::option::Option::Some("IN_STOCK"),
17021 Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17022 Self::Preorder => std::option::Option::Some("PREORDER"),
17023 Self::Backorder => std::option::Option::Some("BACKORDER"),
17024 Self::UnknownValue(u) => u.0.name(),
17025 }
17026 }
17027 }
17028
17029 impl std::default::Default for Availability {
17030 fn default() -> Self {
17031 use std::convert::From;
17032 Self::from(0)
17033 }
17034 }
17035
17036 impl std::fmt::Display for Availability {
17037 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17038 wkt::internal::display_enum(f, self.name(), self.value())
17039 }
17040 }
17041
17042 impl std::convert::From<i32> for Availability {
17043 fn from(value: i32) -> Self {
17044 match value {
17045 0 => Self::Unspecified,
17046 1 => Self::InStock,
17047 2 => Self::OutOfStock,
17048 3 => Self::Preorder,
17049 4 => Self::Backorder,
17050 _ => Self::UnknownValue(availability::UnknownValue(
17051 wkt::internal::UnknownEnumValue::Integer(value),
17052 )),
17053 }
17054 }
17055 }
17056
17057 impl std::convert::From<&str> for Availability {
17058 fn from(value: &str) -> Self {
17059 use std::string::ToString;
17060 match value {
17061 "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17062 "IN_STOCK" => Self::InStock,
17063 "OUT_OF_STOCK" => Self::OutOfStock,
17064 "PREORDER" => Self::Preorder,
17065 "BACKORDER" => Self::Backorder,
17066 _ => Self::UnknownValue(availability::UnknownValue(
17067 wkt::internal::UnknownEnumValue::String(value.to_string()),
17068 )),
17069 }
17070 }
17071 }
17072
17073 impl serde::ser::Serialize for Availability {
17074 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17075 where
17076 S: serde::Serializer,
17077 {
17078 match self {
17079 Self::Unspecified => serializer.serialize_i32(0),
17080 Self::InStock => serializer.serialize_i32(1),
17081 Self::OutOfStock => serializer.serialize_i32(2),
17082 Self::Preorder => serializer.serialize_i32(3),
17083 Self::Backorder => serializer.serialize_i32(4),
17084 Self::UnknownValue(u) => u.0.serialize(serializer),
17085 }
17086 }
17087 }
17088
17089 impl<'de> serde::de::Deserialize<'de> for Availability {
17090 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17091 where
17092 D: serde::Deserializer<'de>,
17093 {
17094 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17095 ".google.cloud.retail.v2.Product.Availability",
17096 ))
17097 }
17098 }
17099
17100 #[derive(Clone, Debug, PartialEq)]
17101 #[non_exhaustive]
17102 pub enum Expiration {
17103 /// Note that this field is applied in the following ways:
17104 ///
17105 /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17106 /// when it is uploaded, this product
17107 /// is not indexed for search.
17108 ///
17109 /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17110 /// is uploaded, only the
17111 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17112 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17113 /// expireTime is respected, and
17114 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17115 /// expireTime is not used.
17116 ///
17117 ///
17118 /// In general, we suggest the users to delete the stale
17119 /// products explicitly, instead of using this field to determine staleness.
17120 ///
17121 /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17122 /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17123 /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17124 /// INVALID_ARGUMENT error is thrown.
17125 ///
17126 /// Corresponding properties: Google Merchant Center property
17127 /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17128 ///
17129 /// [google.cloud.retail.v2.Product]: crate::model::Product
17130 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17131 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17132 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17133 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17134 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17135 /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17136 ExpireTime(std::boxed::Box<wkt::Timestamp>),
17137 /// Input only. The TTL (time to live) of the product. Note that this is only
17138 /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17139 /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17140 /// and ignored for
17141 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17142 /// we suggest the users to delete the stale products explicitly, instead of
17143 /// using this field to determine staleness.
17144 ///
17145 /// If it is set, it must be a non-negative value, and
17146 /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17147 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17148 /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17149 /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17150 /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17151 ///
17152 /// If it is set, the product is not available for
17153 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17154 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17155 /// However, the product can still be retrieved by
17156 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17157 /// and
17158 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17159 ///
17160 /// [google.cloud.retail.v2.Product]: crate::model::Product
17161 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17162 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17163 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17164 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17165 /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17166 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17167 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17168 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17169 Ttl(std::boxed::Box<wkt::Duration>),
17170 }
17171}
17172
17173/// Request message for
17174/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17175/// method.
17176///
17177/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17178#[derive(Clone, Default, PartialEq)]
17179#[non_exhaustive]
17180pub struct CreateProductRequest {
17181 /// Required. The parent catalog resource name, such as
17182 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17183 pub parent: std::string::String,
17184
17185 /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17186 ///
17187 /// [google.cloud.retail.v2.Product]: crate::model::Product
17188 pub product: std::option::Option<crate::model::Product>,
17189
17190 /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17191 /// which will become the final component of the
17192 /// [Product.name][google.cloud.retail.v2.Product.name].
17193 ///
17194 /// If the caller does not have permission to create the
17195 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17196 /// exists, a PERMISSION_DENIED error is returned.
17197 ///
17198 /// This field must be unique among all
17199 /// [Product][google.cloud.retail.v2.Product]s with the same
17200 /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17201 /// ALREADY_EXISTS error is returned.
17202 ///
17203 /// This field must be a UTF-8 encoded string with a length limit of 128
17204 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17205 ///
17206 /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17207 /// [google.cloud.retail.v2.Product]: crate::model::Product
17208 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17209 pub product_id: std::string::String,
17210
17211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17212}
17213
17214impl CreateProductRequest {
17215 pub fn new() -> Self {
17216 std::default::Default::default()
17217 }
17218
17219 /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17220 ///
17221 /// # Example
17222 /// ```ignore,no_run
17223 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17224 /// let x = CreateProductRequest::new().set_parent("example");
17225 /// ```
17226 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17227 self.parent = v.into();
17228 self
17229 }
17230
17231 /// Sets the value of [product][crate::model::CreateProductRequest::product].
17232 ///
17233 /// # Example
17234 /// ```ignore,no_run
17235 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17236 /// use google_cloud_retail_v2::model::Product;
17237 /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17238 /// ```
17239 pub fn set_product<T>(mut self, v: T) -> Self
17240 where
17241 T: std::convert::Into<crate::model::Product>,
17242 {
17243 self.product = std::option::Option::Some(v.into());
17244 self
17245 }
17246
17247 /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17248 ///
17249 /// # Example
17250 /// ```ignore,no_run
17251 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17252 /// use google_cloud_retail_v2::model::Product;
17253 /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17254 /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17255 /// ```
17256 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17257 where
17258 T: std::convert::Into<crate::model::Product>,
17259 {
17260 self.product = v.map(|x| x.into());
17261 self
17262 }
17263
17264 /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17265 ///
17266 /// # Example
17267 /// ```ignore,no_run
17268 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17269 /// let x = CreateProductRequest::new().set_product_id("example");
17270 /// ```
17271 pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17272 self.product_id = v.into();
17273 self
17274 }
17275}
17276
17277impl wkt::message::Message for CreateProductRequest {
17278 fn typename() -> &'static str {
17279 "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17280 }
17281}
17282
17283/// Request message for
17284/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17285/// method.
17286///
17287/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17288#[derive(Clone, Default, PartialEq)]
17289#[non_exhaustive]
17290pub struct GetProductRequest {
17291 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17292 /// such as
17293 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17294 ///
17295 /// If the caller does not have permission to access the
17296 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17297 /// exists, a PERMISSION_DENIED error is returned.
17298 ///
17299 /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17300 /// a NOT_FOUND error is returned.
17301 ///
17302 /// [google.cloud.retail.v2.Product]: crate::model::Product
17303 pub name: std::string::String,
17304
17305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17306}
17307
17308impl GetProductRequest {
17309 pub fn new() -> Self {
17310 std::default::Default::default()
17311 }
17312
17313 /// Sets the value of [name][crate::model::GetProductRequest::name].
17314 ///
17315 /// # Example
17316 /// ```ignore,no_run
17317 /// # use google_cloud_retail_v2::model::GetProductRequest;
17318 /// let x = GetProductRequest::new().set_name("example");
17319 /// ```
17320 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17321 self.name = v.into();
17322 self
17323 }
17324}
17325
17326impl wkt::message::Message for GetProductRequest {
17327 fn typename() -> &'static str {
17328 "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17329 }
17330}
17331
17332/// Request message for
17333/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17334/// method.
17335///
17336/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17337#[derive(Clone, Default, PartialEq)]
17338#[non_exhaustive]
17339pub struct UpdateProductRequest {
17340 /// Required. The product to update/create.
17341 ///
17342 /// If the caller does not have permission to update the
17343 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17344 /// exists, a PERMISSION_DENIED error is returned.
17345 ///
17346 /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17347 /// and
17348 /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17349 /// is not set, a NOT_FOUND error is returned.
17350 ///
17351 /// [google.cloud.retail.v2.Product]: crate::model::Product
17352 /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17353 pub product: std::option::Option<crate::model::Product>,
17354
17355 /// Indicates which fields in the provided
17356 /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17357 /// output only fields are NOT supported. If not set, all supported fields (the
17358 /// fields that are neither immutable nor output only) are updated.
17359 ///
17360 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17361 /// is returned.
17362 ///
17363 /// The attribute key can be updated by setting the mask path as
17364 /// "attributes.${key_name}". If a key name is present in the mask but not in
17365 /// the patching product from the request, this key will be deleted after the
17366 /// update.
17367 ///
17368 /// [google.cloud.retail.v2.Product]: crate::model::Product
17369 pub update_mask: std::option::Option<wkt::FieldMask>,
17370
17371 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17372 /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17373 /// this situation, `update_mask` is ignored.
17374 ///
17375 /// [google.cloud.retail.v2.Product]: crate::model::Product
17376 pub allow_missing: bool,
17377
17378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17379}
17380
17381impl UpdateProductRequest {
17382 pub fn new() -> Self {
17383 std::default::Default::default()
17384 }
17385
17386 /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17387 ///
17388 /// # Example
17389 /// ```ignore,no_run
17390 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17391 /// use google_cloud_retail_v2::model::Product;
17392 /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17393 /// ```
17394 pub fn set_product<T>(mut self, v: T) -> Self
17395 where
17396 T: std::convert::Into<crate::model::Product>,
17397 {
17398 self.product = std::option::Option::Some(v.into());
17399 self
17400 }
17401
17402 /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17403 ///
17404 /// # Example
17405 /// ```ignore,no_run
17406 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17407 /// use google_cloud_retail_v2::model::Product;
17408 /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17409 /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17410 /// ```
17411 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17412 where
17413 T: std::convert::Into<crate::model::Product>,
17414 {
17415 self.product = v.map(|x| x.into());
17416 self
17417 }
17418
17419 /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17420 ///
17421 /// # Example
17422 /// ```ignore,no_run
17423 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17424 /// use wkt::FieldMask;
17425 /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17426 /// ```
17427 pub fn set_update_mask<T>(mut self, v: T) -> Self
17428 where
17429 T: std::convert::Into<wkt::FieldMask>,
17430 {
17431 self.update_mask = std::option::Option::Some(v.into());
17432 self
17433 }
17434
17435 /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17436 ///
17437 /// # Example
17438 /// ```ignore,no_run
17439 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17440 /// use wkt::FieldMask;
17441 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17442 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17443 /// ```
17444 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17445 where
17446 T: std::convert::Into<wkt::FieldMask>,
17447 {
17448 self.update_mask = v.map(|x| x.into());
17449 self
17450 }
17451
17452 /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17453 ///
17454 /// # Example
17455 /// ```ignore,no_run
17456 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17457 /// let x = UpdateProductRequest::new().set_allow_missing(true);
17458 /// ```
17459 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17460 self.allow_missing = v.into();
17461 self
17462 }
17463}
17464
17465impl wkt::message::Message for UpdateProductRequest {
17466 fn typename() -> &'static str {
17467 "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17468 }
17469}
17470
17471/// Request message for
17472/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17473/// method.
17474///
17475/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17476#[derive(Clone, Default, PartialEq)]
17477#[non_exhaustive]
17478pub struct DeleteProductRequest {
17479 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17480 /// such as
17481 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17482 ///
17483 /// If the caller does not have permission to delete the
17484 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17485 /// exists, a PERMISSION_DENIED error is returned.
17486 ///
17487 /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17488 /// a NOT_FOUND error is returned.
17489 ///
17490 /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17491 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17492 /// [Product][google.cloud.retail.v2.Product] member nor a
17493 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17494 /// [Product][google.cloud.retail.v2.Product] with more than one
17495 /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17496 /// INVALID_ARGUMENT error is returned.
17497 ///
17498 /// All inventory information for the named
17499 /// [Product][google.cloud.retail.v2.Product] will be deleted.
17500 ///
17501 /// [google.cloud.retail.v2.Product]: crate::model::Product
17502 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17503 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17504 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17505 pub name: std::string::String,
17506
17507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17508}
17509
17510impl DeleteProductRequest {
17511 pub fn new() -> Self {
17512 std::default::Default::default()
17513 }
17514
17515 /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17516 ///
17517 /// # Example
17518 /// ```ignore,no_run
17519 /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17520 /// let x = DeleteProductRequest::new().set_name("example");
17521 /// ```
17522 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17523 self.name = v.into();
17524 self
17525 }
17526}
17527
17528impl wkt::message::Message for DeleteProductRequest {
17529 fn typename() -> &'static str {
17530 "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17531 }
17532}
17533
17534/// Request message for
17535/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17536/// method.
17537///
17538/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17539#[derive(Clone, Default, PartialEq)]
17540#[non_exhaustive]
17541pub struct ListProductsRequest {
17542 /// Required. The parent branch resource name, such as
17543 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17544 /// `default_branch` as the branch ID, to list products under the default
17545 /// branch.
17546 ///
17547 /// If the caller does not have permission to list
17548 /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17549 /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17550 ///
17551 /// [google.cloud.retail.v2.Product]: crate::model::Product
17552 pub parent: std::string::String,
17553
17554 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17555 /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17556 /// above 1000 will be coerced to 1000.
17557 ///
17558 /// If this field is negative, an INVALID_ARGUMENT error is returned.
17559 ///
17560 /// [google.cloud.retail.v2.Product]: crate::model::Product
17561 pub page_size: i32,
17562
17563 /// A page token
17564 /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17565 /// received from a previous
17566 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17567 /// call. Provide this to retrieve the subsequent page.
17568 ///
17569 /// When paginating, all other parameters provided to
17570 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17571 /// must match the call that provided the page token. Otherwise, an
17572 /// INVALID_ARGUMENT error is returned.
17573 ///
17574 /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17575 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17576 pub page_token: std::string::String,
17577
17578 /// A filter to apply on the list results. Supported features:
17579 ///
17580 /// * List all the products under the parent branch if
17581 /// [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17582 /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17583 /// [Product][google.cloud.retail.v2.Product]s sharing the same
17584 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17585 /// [Product][google.cloud.retail.v2.Product]. For example:
17586 /// `primary_product_id = "some_product_id"`
17587 /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17588 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17589 /// [Product][google.cloud.retail.v2.Product].
17590 /// For example:
17591 /// `collection_product_id = "some_product_id"`
17592 /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17593 /// For example:
17594 /// `type = "PRIMARY"`
17595 /// `type = "VARIANT"`
17596 /// `type = "COLLECTION"`
17597 ///
17598 /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17599 ///
17600 /// If the specified
17601 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17602 /// [Product][google.cloud.retail.v2.Product] or
17603 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17604 /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17605 /// is returned.
17606 ///
17607 /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17608 /// [google.cloud.retail.v2.Product]: crate::model::Product
17609 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17610 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17611 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17612 pub filter: std::string::String,
17613
17614 /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17615 /// responses. If not set or empty, the following fields are returned:
17616 ///
17617 /// * [Product.name][google.cloud.retail.v2.Product.name]
17618 /// * [Product.id][google.cloud.retail.v2.Product.id]
17619 /// * [Product.title][google.cloud.retail.v2.Product.title]
17620 /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17621 /// * [Product.images][google.cloud.retail.v2.Product.images]
17622 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17623 /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17624 ///
17625 /// If "*" is provided, all fields are returned.
17626 /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17627 /// matter what mask is set.
17628 ///
17629 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17630 /// is returned.
17631 ///
17632 /// [google.cloud.retail.v2.Product]: crate::model::Product
17633 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17634 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17635 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17636 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17637 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17638 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17639 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17640 pub read_mask: std::option::Option<wkt::FieldMask>,
17641
17642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17643}
17644
17645impl ListProductsRequest {
17646 pub fn new() -> Self {
17647 std::default::Default::default()
17648 }
17649
17650 /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17651 ///
17652 /// # Example
17653 /// ```ignore,no_run
17654 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17655 /// let x = ListProductsRequest::new().set_parent("example");
17656 /// ```
17657 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17658 self.parent = v.into();
17659 self
17660 }
17661
17662 /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17663 ///
17664 /// # Example
17665 /// ```ignore,no_run
17666 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17667 /// let x = ListProductsRequest::new().set_page_size(42);
17668 /// ```
17669 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17670 self.page_size = v.into();
17671 self
17672 }
17673
17674 /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17675 ///
17676 /// # Example
17677 /// ```ignore,no_run
17678 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17679 /// let x = ListProductsRequest::new().set_page_token("example");
17680 /// ```
17681 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17682 self.page_token = v.into();
17683 self
17684 }
17685
17686 /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17687 ///
17688 /// # Example
17689 /// ```ignore,no_run
17690 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17691 /// let x = ListProductsRequest::new().set_filter("example");
17692 /// ```
17693 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17694 self.filter = v.into();
17695 self
17696 }
17697
17698 /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17699 ///
17700 /// # Example
17701 /// ```ignore,no_run
17702 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17703 /// use wkt::FieldMask;
17704 /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17705 /// ```
17706 pub fn set_read_mask<T>(mut self, v: T) -> Self
17707 where
17708 T: std::convert::Into<wkt::FieldMask>,
17709 {
17710 self.read_mask = std::option::Option::Some(v.into());
17711 self
17712 }
17713
17714 /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17715 ///
17716 /// # Example
17717 /// ```ignore,no_run
17718 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17719 /// use wkt::FieldMask;
17720 /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17721 /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17722 /// ```
17723 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17724 where
17725 T: std::convert::Into<wkt::FieldMask>,
17726 {
17727 self.read_mask = v.map(|x| x.into());
17728 self
17729 }
17730}
17731
17732impl wkt::message::Message for ListProductsRequest {
17733 fn typename() -> &'static str {
17734 "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17735 }
17736}
17737
17738/// Response message for
17739/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17740/// method.
17741///
17742/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17743#[derive(Clone, Default, PartialEq)]
17744#[non_exhaustive]
17745pub struct ListProductsResponse {
17746 /// The [Product][google.cloud.retail.v2.Product]s.
17747 ///
17748 /// [google.cloud.retail.v2.Product]: crate::model::Product
17749 pub products: std::vec::Vec<crate::model::Product>,
17750
17751 /// A token that can be sent as
17752 /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
17753 /// to retrieve the next page. If this field is omitted, there are no
17754 /// subsequent pages.
17755 ///
17756 /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
17757 pub next_page_token: std::string::String,
17758
17759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17760}
17761
17762impl ListProductsResponse {
17763 pub fn new() -> Self {
17764 std::default::Default::default()
17765 }
17766
17767 /// Sets the value of [products][crate::model::ListProductsResponse::products].
17768 ///
17769 /// # Example
17770 /// ```ignore,no_run
17771 /// # use google_cloud_retail_v2::model::ListProductsResponse;
17772 /// use google_cloud_retail_v2::model::Product;
17773 /// let x = ListProductsResponse::new()
17774 /// .set_products([
17775 /// Product::default()/* use setters */,
17776 /// Product::default()/* use (different) setters */,
17777 /// ]);
17778 /// ```
17779 pub fn set_products<T, V>(mut self, v: T) -> Self
17780 where
17781 T: std::iter::IntoIterator<Item = V>,
17782 V: std::convert::Into<crate::model::Product>,
17783 {
17784 use std::iter::Iterator;
17785 self.products = v.into_iter().map(|i| i.into()).collect();
17786 self
17787 }
17788
17789 /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
17790 ///
17791 /// # Example
17792 /// ```ignore,no_run
17793 /// # use google_cloud_retail_v2::model::ListProductsResponse;
17794 /// let x = ListProductsResponse::new().set_next_page_token("example");
17795 /// ```
17796 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17797 self.next_page_token = v.into();
17798 self
17799 }
17800}
17801
17802impl wkt::message::Message for ListProductsResponse {
17803 fn typename() -> &'static str {
17804 "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
17805 }
17806}
17807
17808#[doc(hidden)]
17809impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
17810 type PageItem = crate::model::Product;
17811
17812 fn items(self) -> std::vec::Vec<Self::PageItem> {
17813 self.products
17814 }
17815
17816 fn next_page_token(&self) -> std::string::String {
17817 use std::clone::Clone;
17818 self.next_page_token.clone()
17819 }
17820}
17821
17822/// Request message for
17823/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
17824/// method.
17825///
17826/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
17827#[derive(Clone, Default, PartialEq)]
17828#[non_exhaustive]
17829pub struct SetInventoryRequest {
17830 /// Required. The inventory information to update. The allowable fields to
17831 /// update are:
17832 ///
17833 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17834 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17835 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17836 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17837 /// The updated inventory fields must be specified in
17838 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
17839 ///
17840 /// If
17841 /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
17842 /// is empty or invalid, an INVALID_ARGUMENT error is returned.
17843 ///
17844 /// If the caller does not have permission to update the
17845 /// [Product][google.cloud.retail.v2.Product] named in
17846 /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
17847 /// or not it exists, a PERMISSION_DENIED error is returned.
17848 ///
17849 /// If the [Product][google.cloud.retail.v2.Product] to update does not have
17850 /// existing inventory information, the provided inventory information will be
17851 /// inserted.
17852 ///
17853 /// If the [Product][google.cloud.retail.v2.Product] to update has existing
17854 /// inventory information, the provided inventory information will be merged
17855 /// while respecting the last update time for each inventory field, using the
17856 /// provided or default value for
17857 /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
17858 ///
17859 /// The caller can replace place IDs for a subset of fulfillment types in the
17860 /// following ways:
17861 ///
17862 /// * Adds "fulfillment_info" in
17863 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17864 /// * Specifies only the desired fulfillment types and corresponding place IDs
17865 /// to update in
17866 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17867 ///
17868 /// The caller can clear all place IDs from a subset of fulfillment types in
17869 /// the following ways:
17870 ///
17871 /// * Adds "fulfillment_info" in
17872 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17873 /// * Specifies only the desired fulfillment types to clear in
17874 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17875 /// * Checks that only the desired fulfillment info types have empty
17876 /// [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
17877 ///
17878 /// The last update time is recorded for the following inventory fields:
17879 ///
17880 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17881 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17882 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17883 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17884 ///
17885 /// If a full overwrite of inventory information while ignoring timestamps is
17886 /// needed,
17887 /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17888 /// should be invoked instead.
17889 ///
17890 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
17891 /// [google.cloud.retail.v2.Product]: crate::model::Product
17892 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
17893 /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
17894 /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
17895 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17896 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17897 /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17898 /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
17899 /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
17900 pub inventory: std::option::Option<crate::model::Product>,
17901
17902 /// Indicates which inventory fields in the provided
17903 /// [Product][google.cloud.retail.v2.Product] to update.
17904 ///
17905 /// At least one field must be provided.
17906 ///
17907 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17908 /// is returned and the entire update will be ignored.
17909 ///
17910 /// [google.cloud.retail.v2.Product]: crate::model::Product
17911 pub set_mask: std::option::Option<wkt::FieldMask>,
17912
17913 /// The time when the request is issued, used to prevent
17914 /// out-of-order updates on inventory fields with the last update time
17915 /// recorded. If not provided, the internal system time will be used.
17916 pub set_time: std::option::Option<wkt::Timestamp>,
17917
17918 /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
17919 /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
17920 /// inventory update will still be processed and retained for at most 1 day
17921 /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
17922 /// false, a NOT_FOUND error is returned if the
17923 /// [Product][google.cloud.retail.v2.Product] is not found.
17924 ///
17925 /// [google.cloud.retail.v2.Product]: crate::model::Product
17926 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17927 pub allow_missing: bool,
17928
17929 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17930}
17931
17932impl SetInventoryRequest {
17933 pub fn new() -> Self {
17934 std::default::Default::default()
17935 }
17936
17937 /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
17938 ///
17939 /// # Example
17940 /// ```ignore,no_run
17941 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17942 /// use google_cloud_retail_v2::model::Product;
17943 /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
17944 /// ```
17945 pub fn set_inventory<T>(mut self, v: T) -> Self
17946 where
17947 T: std::convert::Into<crate::model::Product>,
17948 {
17949 self.inventory = std::option::Option::Some(v.into());
17950 self
17951 }
17952
17953 /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
17954 ///
17955 /// # Example
17956 /// ```ignore,no_run
17957 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17958 /// use google_cloud_retail_v2::model::Product;
17959 /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
17960 /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
17961 /// ```
17962 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
17963 where
17964 T: std::convert::Into<crate::model::Product>,
17965 {
17966 self.inventory = v.map(|x| x.into());
17967 self
17968 }
17969
17970 /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17971 ///
17972 /// # Example
17973 /// ```ignore,no_run
17974 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17975 /// use wkt::FieldMask;
17976 /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
17977 /// ```
17978 pub fn set_set_mask<T>(mut self, v: T) -> Self
17979 where
17980 T: std::convert::Into<wkt::FieldMask>,
17981 {
17982 self.set_mask = std::option::Option::Some(v.into());
17983 self
17984 }
17985
17986 /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17987 ///
17988 /// # Example
17989 /// ```ignore,no_run
17990 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17991 /// use wkt::FieldMask;
17992 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
17993 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
17994 /// ```
17995 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
17996 where
17997 T: std::convert::Into<wkt::FieldMask>,
17998 {
17999 self.set_mask = v.map(|x| x.into());
18000 self
18001 }
18002
18003 /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18004 ///
18005 /// # Example
18006 /// ```ignore,no_run
18007 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18008 /// use wkt::Timestamp;
18009 /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18010 /// ```
18011 pub fn set_set_time<T>(mut self, v: T) -> Self
18012 where
18013 T: std::convert::Into<wkt::Timestamp>,
18014 {
18015 self.set_time = std::option::Option::Some(v.into());
18016 self
18017 }
18018
18019 /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18020 ///
18021 /// # Example
18022 /// ```ignore,no_run
18023 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18024 /// use wkt::Timestamp;
18025 /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18026 /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18027 /// ```
18028 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18029 where
18030 T: std::convert::Into<wkt::Timestamp>,
18031 {
18032 self.set_time = v.map(|x| x.into());
18033 self
18034 }
18035
18036 /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18037 ///
18038 /// # Example
18039 /// ```ignore,no_run
18040 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18041 /// let x = SetInventoryRequest::new().set_allow_missing(true);
18042 /// ```
18043 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18044 self.allow_missing = v.into();
18045 self
18046 }
18047}
18048
18049impl wkt::message::Message for SetInventoryRequest {
18050 fn typename() -> &'static str {
18051 "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18052 }
18053}
18054
18055/// Metadata related to the progress of the SetInventory operation.
18056/// Currently empty because there is no meaningful metadata populated from the
18057/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18058/// method.
18059///
18060/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18061#[derive(Clone, Default, PartialEq)]
18062#[non_exhaustive]
18063pub struct SetInventoryMetadata {
18064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18065}
18066
18067impl SetInventoryMetadata {
18068 pub fn new() -> Self {
18069 std::default::Default::default()
18070 }
18071}
18072
18073impl wkt::message::Message for SetInventoryMetadata {
18074 fn typename() -> &'static str {
18075 "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18076 }
18077}
18078
18079/// Response of the SetInventoryRequest. Currently empty because
18080/// there is no meaningful response populated from the
18081/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18082/// method.
18083///
18084/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18085#[derive(Clone, Default, PartialEq)]
18086#[non_exhaustive]
18087pub struct SetInventoryResponse {
18088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18089}
18090
18091impl SetInventoryResponse {
18092 pub fn new() -> Self {
18093 std::default::Default::default()
18094 }
18095}
18096
18097impl wkt::message::Message for SetInventoryResponse {
18098 fn typename() -> &'static str {
18099 "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18100 }
18101}
18102
18103/// Request message for
18104/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18105/// method.
18106///
18107/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18108#[derive(Clone, Default, PartialEq)]
18109#[non_exhaustive]
18110pub struct AddFulfillmentPlacesRequest {
18111 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18112 /// such as
18113 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18114 ///
18115 /// If the caller does not have permission to access the
18116 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18117 /// exists, a PERMISSION_DENIED error is returned.
18118 ///
18119 /// [google.cloud.retail.v2.Product]: crate::model::Product
18120 pub product: std::string::String,
18121
18122 /// Required. The fulfillment type, including commonly used types (such as
18123 /// pickup in store and same day delivery), and custom types.
18124 ///
18125 /// Supported values:
18126 ///
18127 /// * "pickup-in-store"
18128 /// * "ship-to-store"
18129 /// * "same-day-delivery"
18130 /// * "next-day-delivery"
18131 /// * "custom-type-1"
18132 /// * "custom-type-2"
18133 /// * "custom-type-3"
18134 /// * "custom-type-4"
18135 /// * "custom-type-5"
18136 ///
18137 /// If this field is set to an invalid value other than these, an
18138 /// INVALID_ARGUMENT error is returned.
18139 ///
18140 /// This field directly corresponds to
18141 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18142 ///
18143 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18144 pub r#type: std::string::String,
18145
18146 /// Required. The IDs for this
18147 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18148 /// the store IDs for "pickup-in-store" or the region IDs for
18149 /// "same-day-delivery" to be added for this
18150 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18151 /// IDs will be automatically ignored.
18152 ///
18153 /// At least 1 value is required, and a maximum of 2000 values are allowed.
18154 /// Each value must be a string with a length limit of 10 characters, matching
18155 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18156 /// INVALID_ARGUMENT error is returned.
18157 ///
18158 /// If the total number of place IDs exceeds 2000 for this
18159 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18160 /// adding, then the update will be rejected.
18161 ///
18162 /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18163 pub place_ids: std::vec::Vec<std::string::String>,
18164
18165 /// The time when the fulfillment updates are issued, used to prevent
18166 /// out-of-order updates on fulfillment information. If not provided, the
18167 /// internal system time will be used.
18168 pub add_time: std::option::Option<wkt::Timestamp>,
18169
18170 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18171 /// found, the fulfillment information will still be processed and retained for
18172 /// at most 1 day and processed once the
18173 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18174 /// NOT_FOUND error is returned if the
18175 /// [Product][google.cloud.retail.v2.Product] is not found.
18176 ///
18177 /// [google.cloud.retail.v2.Product]: crate::model::Product
18178 pub allow_missing: bool,
18179
18180 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18181}
18182
18183impl AddFulfillmentPlacesRequest {
18184 pub fn new() -> Self {
18185 std::default::Default::default()
18186 }
18187
18188 /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18189 ///
18190 /// # Example
18191 /// ```ignore,no_run
18192 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18193 /// let x = AddFulfillmentPlacesRequest::new().set_product("example");
18194 /// ```
18195 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18196 self.product = v.into();
18197 self
18198 }
18199
18200 /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18201 ///
18202 /// # Example
18203 /// ```ignore,no_run
18204 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18205 /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18206 /// ```
18207 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18208 self.r#type = v.into();
18209 self
18210 }
18211
18212 /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18213 ///
18214 /// # Example
18215 /// ```ignore,no_run
18216 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18217 /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18218 /// ```
18219 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18220 where
18221 T: std::iter::IntoIterator<Item = V>,
18222 V: std::convert::Into<std::string::String>,
18223 {
18224 use std::iter::Iterator;
18225 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18226 self
18227 }
18228
18229 /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18230 ///
18231 /// # Example
18232 /// ```ignore,no_run
18233 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18234 /// use wkt::Timestamp;
18235 /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18236 /// ```
18237 pub fn set_add_time<T>(mut self, v: T) -> Self
18238 where
18239 T: std::convert::Into<wkt::Timestamp>,
18240 {
18241 self.add_time = std::option::Option::Some(v.into());
18242 self
18243 }
18244
18245 /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18246 ///
18247 /// # Example
18248 /// ```ignore,no_run
18249 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18250 /// use wkt::Timestamp;
18251 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18252 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18253 /// ```
18254 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18255 where
18256 T: std::convert::Into<wkt::Timestamp>,
18257 {
18258 self.add_time = v.map(|x| x.into());
18259 self
18260 }
18261
18262 /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18263 ///
18264 /// # Example
18265 /// ```ignore,no_run
18266 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18267 /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18268 /// ```
18269 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18270 self.allow_missing = v.into();
18271 self
18272 }
18273}
18274
18275impl wkt::message::Message for AddFulfillmentPlacesRequest {
18276 fn typename() -> &'static str {
18277 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18278 }
18279}
18280
18281/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18282/// Currently empty because there is no meaningful metadata populated from the
18283/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18284/// method.
18285///
18286/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18287#[derive(Clone, Default, PartialEq)]
18288#[non_exhaustive]
18289pub struct AddFulfillmentPlacesMetadata {
18290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18291}
18292
18293impl AddFulfillmentPlacesMetadata {
18294 pub fn new() -> Self {
18295 std::default::Default::default()
18296 }
18297}
18298
18299impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18300 fn typename() -> &'static str {
18301 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18302 }
18303}
18304
18305/// Response of the AddFulfillmentPlacesRequest. Currently empty because
18306/// there is no meaningful response populated from the
18307/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18308/// method.
18309///
18310/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18311#[derive(Clone, Default, PartialEq)]
18312#[non_exhaustive]
18313pub struct AddFulfillmentPlacesResponse {
18314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18315}
18316
18317impl AddFulfillmentPlacesResponse {
18318 pub fn new() -> Self {
18319 std::default::Default::default()
18320 }
18321}
18322
18323impl wkt::message::Message for AddFulfillmentPlacesResponse {
18324 fn typename() -> &'static str {
18325 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18326 }
18327}
18328
18329/// Request message for
18330/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18331/// method.
18332///
18333/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18334#[derive(Clone, Default, PartialEq)]
18335#[non_exhaustive]
18336pub struct AddLocalInventoriesRequest {
18337 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18338 /// such as
18339 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18340 ///
18341 /// If the caller does not have permission to access the
18342 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18343 /// exists, a PERMISSION_DENIED error is returned.
18344 ///
18345 /// [google.cloud.retail.v2.Product]: crate::model::Product
18346 pub product: std::string::String,
18347
18348 /// Required. A list of inventory information at difference places. Each place
18349 /// is identified by its place ID. At most 3000 inventories are allowed per
18350 /// request.
18351 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18352
18353 /// Indicates which inventory fields in the provided list of
18354 /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18355 /// field is updated to the provided value.
18356 ///
18357 /// If a field is set while the place does not have a previous local inventory,
18358 /// the local inventory at that store is created.
18359 ///
18360 /// If a field is set while the value of that field is not provided, the
18361 /// original field value, if it exists, is deleted.
18362 ///
18363 /// If the mask is not set or set with empty paths, all inventory fields will
18364 /// be updated.
18365 ///
18366 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18367 /// is returned and the entire update will be ignored.
18368 ///
18369 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18370 pub add_mask: std::option::Option<wkt::FieldMask>,
18371
18372 /// The time when the inventory updates are issued. Used to prevent
18373 /// out-of-order updates on local inventory fields. If not provided, the
18374 /// internal system time will be used.
18375 pub add_time: std::option::Option<wkt::Timestamp>,
18376
18377 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18378 /// found, the local inventory will still be processed and retained for at most
18379 /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18380 /// created. If set to false, a NOT_FOUND error is returned if the
18381 /// [Product][google.cloud.retail.v2.Product] is not found.
18382 ///
18383 /// [google.cloud.retail.v2.Product]: crate::model::Product
18384 pub allow_missing: bool,
18385
18386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18387}
18388
18389impl AddLocalInventoriesRequest {
18390 pub fn new() -> Self {
18391 std::default::Default::default()
18392 }
18393
18394 /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18395 ///
18396 /// # Example
18397 /// ```ignore,no_run
18398 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18399 /// let x = AddLocalInventoriesRequest::new().set_product("example");
18400 /// ```
18401 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18402 self.product = v.into();
18403 self
18404 }
18405
18406 /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18407 ///
18408 /// # Example
18409 /// ```ignore,no_run
18410 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18411 /// use google_cloud_retail_v2::model::LocalInventory;
18412 /// let x = AddLocalInventoriesRequest::new()
18413 /// .set_local_inventories([
18414 /// LocalInventory::default()/* use setters */,
18415 /// LocalInventory::default()/* use (different) setters */,
18416 /// ]);
18417 /// ```
18418 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18419 where
18420 T: std::iter::IntoIterator<Item = V>,
18421 V: std::convert::Into<crate::model::LocalInventory>,
18422 {
18423 use std::iter::Iterator;
18424 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18425 self
18426 }
18427
18428 /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18429 ///
18430 /// # Example
18431 /// ```ignore,no_run
18432 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18433 /// use wkt::FieldMask;
18434 /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18435 /// ```
18436 pub fn set_add_mask<T>(mut self, v: T) -> Self
18437 where
18438 T: std::convert::Into<wkt::FieldMask>,
18439 {
18440 self.add_mask = std::option::Option::Some(v.into());
18441 self
18442 }
18443
18444 /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18445 ///
18446 /// # Example
18447 /// ```ignore,no_run
18448 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18449 /// use wkt::FieldMask;
18450 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18451 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18452 /// ```
18453 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18454 where
18455 T: std::convert::Into<wkt::FieldMask>,
18456 {
18457 self.add_mask = v.map(|x| x.into());
18458 self
18459 }
18460
18461 /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18462 ///
18463 /// # Example
18464 /// ```ignore,no_run
18465 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18466 /// use wkt::Timestamp;
18467 /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18468 /// ```
18469 pub fn set_add_time<T>(mut self, v: T) -> Self
18470 where
18471 T: std::convert::Into<wkt::Timestamp>,
18472 {
18473 self.add_time = std::option::Option::Some(v.into());
18474 self
18475 }
18476
18477 /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18478 ///
18479 /// # Example
18480 /// ```ignore,no_run
18481 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18482 /// use wkt::Timestamp;
18483 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18484 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18485 /// ```
18486 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18487 where
18488 T: std::convert::Into<wkt::Timestamp>,
18489 {
18490 self.add_time = v.map(|x| x.into());
18491 self
18492 }
18493
18494 /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18495 ///
18496 /// # Example
18497 /// ```ignore,no_run
18498 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18499 /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18500 /// ```
18501 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18502 self.allow_missing = v.into();
18503 self
18504 }
18505}
18506
18507impl wkt::message::Message for AddLocalInventoriesRequest {
18508 fn typename() -> &'static str {
18509 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18510 }
18511}
18512
18513/// Metadata related to the progress of the AddLocalInventories operation.
18514/// Currently empty because there is no meaningful metadata populated from the
18515/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18516/// method.
18517///
18518/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18519#[derive(Clone, Default, PartialEq)]
18520#[non_exhaustive]
18521pub struct AddLocalInventoriesMetadata {
18522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18523}
18524
18525impl AddLocalInventoriesMetadata {
18526 pub fn new() -> Self {
18527 std::default::Default::default()
18528 }
18529}
18530
18531impl wkt::message::Message for AddLocalInventoriesMetadata {
18532 fn typename() -> &'static str {
18533 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18534 }
18535}
18536
18537/// Response of the
18538/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18539/// API. Currently empty because there is no meaningful response populated from
18540/// the
18541/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18542/// method.
18543///
18544/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18545#[derive(Clone, Default, PartialEq)]
18546#[non_exhaustive]
18547pub struct AddLocalInventoriesResponse {
18548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18549}
18550
18551impl AddLocalInventoriesResponse {
18552 pub fn new() -> Self {
18553 std::default::Default::default()
18554 }
18555}
18556
18557impl wkt::message::Message for AddLocalInventoriesResponse {
18558 fn typename() -> &'static str {
18559 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18560 }
18561}
18562
18563/// Request message for
18564/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18565/// method.
18566///
18567/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18568#[derive(Clone, Default, PartialEq)]
18569#[non_exhaustive]
18570pub struct RemoveLocalInventoriesRequest {
18571 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18572 /// such as
18573 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18574 ///
18575 /// If the caller does not have permission to access the
18576 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18577 /// exists, a PERMISSION_DENIED error is returned.
18578 ///
18579 /// [google.cloud.retail.v2.Product]: crate::model::Product
18580 pub product: std::string::String,
18581
18582 /// Required. A list of place IDs to have their inventory deleted.
18583 /// At most 3000 place IDs are allowed per request.
18584 pub place_ids: std::vec::Vec<std::string::String>,
18585
18586 /// The time when the inventory deletions are issued. Used to prevent
18587 /// out-of-order updates and deletions on local inventory fields. If not
18588 /// provided, the internal system time will be used.
18589 pub remove_time: std::option::Option<wkt::Timestamp>,
18590
18591 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18592 /// found, the local inventory removal request will still be processed and
18593 /// retained for at most 1 day and processed once the
18594 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18595 /// NOT_FOUND error is returned if the
18596 /// [Product][google.cloud.retail.v2.Product] is not found.
18597 ///
18598 /// [google.cloud.retail.v2.Product]: crate::model::Product
18599 pub allow_missing: bool,
18600
18601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18602}
18603
18604impl RemoveLocalInventoriesRequest {
18605 pub fn new() -> Self {
18606 std::default::Default::default()
18607 }
18608
18609 /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18610 ///
18611 /// # Example
18612 /// ```ignore,no_run
18613 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18614 /// let x = RemoveLocalInventoriesRequest::new().set_product("example");
18615 /// ```
18616 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18617 self.product = v.into();
18618 self
18619 }
18620
18621 /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18622 ///
18623 /// # Example
18624 /// ```ignore,no_run
18625 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18626 /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18627 /// ```
18628 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18629 where
18630 T: std::iter::IntoIterator<Item = V>,
18631 V: std::convert::Into<std::string::String>,
18632 {
18633 use std::iter::Iterator;
18634 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18635 self
18636 }
18637
18638 /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18639 ///
18640 /// # Example
18641 /// ```ignore,no_run
18642 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18643 /// use wkt::Timestamp;
18644 /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18645 /// ```
18646 pub fn set_remove_time<T>(mut self, v: T) -> Self
18647 where
18648 T: std::convert::Into<wkt::Timestamp>,
18649 {
18650 self.remove_time = std::option::Option::Some(v.into());
18651 self
18652 }
18653
18654 /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18655 ///
18656 /// # Example
18657 /// ```ignore,no_run
18658 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18659 /// use wkt::Timestamp;
18660 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18661 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18662 /// ```
18663 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18664 where
18665 T: std::convert::Into<wkt::Timestamp>,
18666 {
18667 self.remove_time = v.map(|x| x.into());
18668 self
18669 }
18670
18671 /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18672 ///
18673 /// # Example
18674 /// ```ignore,no_run
18675 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18676 /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18677 /// ```
18678 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18679 self.allow_missing = v.into();
18680 self
18681 }
18682}
18683
18684impl wkt::message::Message for RemoveLocalInventoriesRequest {
18685 fn typename() -> &'static str {
18686 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18687 }
18688}
18689
18690/// Metadata related to the progress of the RemoveLocalInventories operation.
18691/// Currently empty because there is no meaningful metadata populated from the
18692/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18693/// method.
18694///
18695/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18696#[derive(Clone, Default, PartialEq)]
18697#[non_exhaustive]
18698pub struct RemoveLocalInventoriesMetadata {
18699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18700}
18701
18702impl RemoveLocalInventoriesMetadata {
18703 pub fn new() -> Self {
18704 std::default::Default::default()
18705 }
18706}
18707
18708impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18709 fn typename() -> &'static str {
18710 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18711 }
18712}
18713
18714/// Response of the
18715/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18716/// API. Currently empty because there is no meaningful response populated from
18717/// the
18718/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18719/// method.
18720///
18721/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18722#[derive(Clone, Default, PartialEq)]
18723#[non_exhaustive]
18724pub struct RemoveLocalInventoriesResponse {
18725 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18726}
18727
18728impl RemoveLocalInventoriesResponse {
18729 pub fn new() -> Self {
18730 std::default::Default::default()
18731 }
18732}
18733
18734impl wkt::message::Message for RemoveLocalInventoriesResponse {
18735 fn typename() -> &'static str {
18736 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
18737 }
18738}
18739
18740/// Request message for
18741/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18742/// method.
18743///
18744/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18745#[derive(Clone, Default, PartialEq)]
18746#[non_exhaustive]
18747pub struct RemoveFulfillmentPlacesRequest {
18748 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18749 /// such as
18750 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18751 ///
18752 /// If the caller does not have permission to access the
18753 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18754 /// exists, a PERMISSION_DENIED error is returned.
18755 ///
18756 /// [google.cloud.retail.v2.Product]: crate::model::Product
18757 pub product: std::string::String,
18758
18759 /// Required. The fulfillment type, including commonly used types (such as
18760 /// pickup in store and same day delivery), and custom types.
18761 ///
18762 /// Supported values:
18763 ///
18764 /// * "pickup-in-store"
18765 /// * "ship-to-store"
18766 /// * "same-day-delivery"
18767 /// * "next-day-delivery"
18768 /// * "custom-type-1"
18769 /// * "custom-type-2"
18770 /// * "custom-type-3"
18771 /// * "custom-type-4"
18772 /// * "custom-type-5"
18773 ///
18774 /// If this field is set to an invalid value other than these, an
18775 /// INVALID_ARGUMENT error is returned.
18776 ///
18777 /// This field directly corresponds to
18778 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18779 ///
18780 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18781 pub r#type: std::string::String,
18782
18783 /// Required. The IDs for this
18784 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
18785 /// the store IDs for "pickup-in-store" or the region IDs for
18786 /// "same-day-delivery", to be removed for this
18787 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
18788 ///
18789 /// At least 1 value is required, and a maximum of 2000 values are allowed.
18790 /// Each value must be a string with a length limit of 10 characters, matching
18791 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18792 /// INVALID_ARGUMENT error is returned.
18793 ///
18794 /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
18795 pub place_ids: std::vec::Vec<std::string::String>,
18796
18797 /// The time when the fulfillment updates are issued, used to prevent
18798 /// out-of-order updates on fulfillment information. If not provided, the
18799 /// internal system time will be used.
18800 pub remove_time: std::option::Option<wkt::Timestamp>,
18801
18802 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18803 /// found, the fulfillment information will still be processed and retained for
18804 /// at most 1 day and processed once the
18805 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18806 /// NOT_FOUND error is returned if the
18807 /// [Product][google.cloud.retail.v2.Product] is not found.
18808 ///
18809 /// [google.cloud.retail.v2.Product]: crate::model::Product
18810 pub allow_missing: bool,
18811
18812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18813}
18814
18815impl RemoveFulfillmentPlacesRequest {
18816 pub fn new() -> Self {
18817 std::default::Default::default()
18818 }
18819
18820 /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
18821 ///
18822 /// # Example
18823 /// ```ignore,no_run
18824 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18825 /// let x = RemoveFulfillmentPlacesRequest::new().set_product("example");
18826 /// ```
18827 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18828 self.product = v.into();
18829 self
18830 }
18831
18832 /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
18833 ///
18834 /// # Example
18835 /// ```ignore,no_run
18836 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18837 /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
18838 /// ```
18839 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18840 self.r#type = v.into();
18841 self
18842 }
18843
18844 /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
18845 ///
18846 /// # Example
18847 /// ```ignore,no_run
18848 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18849 /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18850 /// ```
18851 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18852 where
18853 T: std::iter::IntoIterator<Item = V>,
18854 V: std::convert::Into<std::string::String>,
18855 {
18856 use std::iter::Iterator;
18857 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18858 self
18859 }
18860
18861 /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18862 ///
18863 /// # Example
18864 /// ```ignore,no_run
18865 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18866 /// use wkt::Timestamp;
18867 /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18868 /// ```
18869 pub fn set_remove_time<T>(mut self, v: T) -> Self
18870 where
18871 T: std::convert::Into<wkt::Timestamp>,
18872 {
18873 self.remove_time = std::option::Option::Some(v.into());
18874 self
18875 }
18876
18877 /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18878 ///
18879 /// # Example
18880 /// ```ignore,no_run
18881 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18882 /// use wkt::Timestamp;
18883 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18884 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18885 /// ```
18886 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18887 where
18888 T: std::convert::Into<wkt::Timestamp>,
18889 {
18890 self.remove_time = v.map(|x| x.into());
18891 self
18892 }
18893
18894 /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
18895 ///
18896 /// # Example
18897 /// ```ignore,no_run
18898 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18899 /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
18900 /// ```
18901 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18902 self.allow_missing = v.into();
18903 self
18904 }
18905}
18906
18907impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
18908 fn typename() -> &'static str {
18909 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
18910 }
18911}
18912
18913/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
18914/// Currently empty because there is no meaningful metadata populated from the
18915/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18916/// method.
18917///
18918/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18919#[derive(Clone, Default, PartialEq)]
18920#[non_exhaustive]
18921pub struct RemoveFulfillmentPlacesMetadata {
18922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18923}
18924
18925impl RemoveFulfillmentPlacesMetadata {
18926 pub fn new() -> Self {
18927 std::default::Default::default()
18928 }
18929}
18930
18931impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
18932 fn typename() -> &'static str {
18933 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
18934 }
18935}
18936
18937/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
18938/// is no meaningful response populated from the
18939/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18940/// method.
18941///
18942/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18943#[derive(Clone, Default, PartialEq)]
18944#[non_exhaustive]
18945pub struct RemoveFulfillmentPlacesResponse {
18946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18947}
18948
18949impl RemoveFulfillmentPlacesResponse {
18950 pub fn new() -> Self {
18951 std::default::Default::default()
18952 }
18953}
18954
18955impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
18956 fn typename() -> &'static str {
18957 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
18958 }
18959}
18960
18961/// Promotion information.
18962#[derive(Clone, Default, PartialEq)]
18963#[non_exhaustive]
18964pub struct Promotion {
18965 /// ID of the promotion. For example, "free gift".
18966 ///
18967 /// The value must be a UTF-8 encoded string with a length limit of 128
18968 /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
18969 /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
18970 /// returned.
18971 ///
18972 /// Corresponds to Google Merchant Center property
18973 /// [promotion_id](https://support.google.com/merchants/answer/7050148).
18974 pub promotion_id: std::string::String,
18975
18976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18977}
18978
18979impl Promotion {
18980 pub fn new() -> Self {
18981 std::default::Default::default()
18982 }
18983
18984 /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
18985 ///
18986 /// # Example
18987 /// ```ignore,no_run
18988 /// # use google_cloud_retail_v2::model::Promotion;
18989 /// let x = Promotion::new().set_promotion_id("example");
18990 /// ```
18991 pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18992 self.promotion_id = v.into();
18993 self
18994 }
18995}
18996
18997impl wkt::message::Message for Promotion {
18998 fn typename() -> &'static str {
18999 "type.googleapis.com/google.cloud.retail.v2.Promotion"
19000 }
19001}
19002
19003/// Metadata related to the progress of the Purge operation.
19004/// This will be returned by the google.longrunning.Operation.metadata field.
19005#[derive(Clone, Default, PartialEq)]
19006#[non_exhaustive]
19007pub struct PurgeMetadata {
19008 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19009}
19010
19011impl PurgeMetadata {
19012 pub fn new() -> Self {
19013 std::default::Default::default()
19014 }
19015}
19016
19017impl wkt::message::Message for PurgeMetadata {
19018 fn typename() -> &'static str {
19019 "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19020 }
19021}
19022
19023/// Metadata related to the progress of the PurgeProducts operation.
19024/// This will be returned by the google.longrunning.Operation.metadata field.
19025#[derive(Clone, Default, PartialEq)]
19026#[non_exhaustive]
19027pub struct PurgeProductsMetadata {
19028 /// Operation create time.
19029 pub create_time: std::option::Option<wkt::Timestamp>,
19030
19031 /// Operation last update time. If the operation is done, this is also the
19032 /// finish time.
19033 pub update_time: std::option::Option<wkt::Timestamp>,
19034
19035 /// Count of entries that were deleted successfully.
19036 pub success_count: i64,
19037
19038 /// Count of entries that encountered errors while processing.
19039 pub failure_count: i64,
19040
19041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19042}
19043
19044impl PurgeProductsMetadata {
19045 pub fn new() -> Self {
19046 std::default::Default::default()
19047 }
19048
19049 /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19050 ///
19051 /// # Example
19052 /// ```ignore,no_run
19053 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19054 /// use wkt::Timestamp;
19055 /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19056 /// ```
19057 pub fn set_create_time<T>(mut self, v: T) -> Self
19058 where
19059 T: std::convert::Into<wkt::Timestamp>,
19060 {
19061 self.create_time = std::option::Option::Some(v.into());
19062 self
19063 }
19064
19065 /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19066 ///
19067 /// # Example
19068 /// ```ignore,no_run
19069 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19070 /// use wkt::Timestamp;
19071 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19072 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19073 /// ```
19074 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19075 where
19076 T: std::convert::Into<wkt::Timestamp>,
19077 {
19078 self.create_time = v.map(|x| x.into());
19079 self
19080 }
19081
19082 /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19083 ///
19084 /// # Example
19085 /// ```ignore,no_run
19086 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19087 /// use wkt::Timestamp;
19088 /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19089 /// ```
19090 pub fn set_update_time<T>(mut self, v: T) -> Self
19091 where
19092 T: std::convert::Into<wkt::Timestamp>,
19093 {
19094 self.update_time = std::option::Option::Some(v.into());
19095 self
19096 }
19097
19098 /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19099 ///
19100 /// # Example
19101 /// ```ignore,no_run
19102 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19103 /// use wkt::Timestamp;
19104 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19105 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19106 /// ```
19107 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19108 where
19109 T: std::convert::Into<wkt::Timestamp>,
19110 {
19111 self.update_time = v.map(|x| x.into());
19112 self
19113 }
19114
19115 /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19116 ///
19117 /// # Example
19118 /// ```ignore,no_run
19119 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19120 /// let x = PurgeProductsMetadata::new().set_success_count(42);
19121 /// ```
19122 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19123 self.success_count = v.into();
19124 self
19125 }
19126
19127 /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19128 ///
19129 /// # Example
19130 /// ```ignore,no_run
19131 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19132 /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19133 /// ```
19134 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19135 self.failure_count = v.into();
19136 self
19137 }
19138}
19139
19140impl wkt::message::Message for PurgeProductsMetadata {
19141 fn typename() -> &'static str {
19142 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19143 }
19144}
19145
19146/// Request message for PurgeProducts method.
19147#[derive(Clone, Default, PartialEq)]
19148#[non_exhaustive]
19149pub struct PurgeProductsRequest {
19150 /// Required. The resource name of the branch under which the products are
19151 /// created. The format is
19152 /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19153 pub parent: std::string::String,
19154
19155 /// Required. The filter string to specify the products to be deleted with a
19156 /// length limit of 5,000 characters.
19157 ///
19158 /// Empty string filter is not allowed. "*" implies delete all items in a
19159 /// branch.
19160 ///
19161 /// The eligible fields for filtering are:
19162 ///
19163 /// * `availability`: Double quoted
19164 /// [Product.availability][google.cloud.retail.v2.Product.availability] string.
19165 /// * `create_time` : in ISO 8601 "zulu" format.
19166 ///
19167 /// Supported syntax:
19168 ///
19169 /// * Comparators (">", "<", ">=", "<=", "=").
19170 /// Examples:
19171 ///
19172 /// * create_time <= "2015-02-13T17:05:46Z"
19173 /// * availability = "IN_STOCK"
19174 /// * Conjunctions ("AND")
19175 /// Examples:
19176 ///
19177 /// * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19178 /// * Disjunctions ("OR")
19179 /// Examples:
19180 ///
19181 /// * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19182 /// * Can support nested queries.
19183 /// Examples:
19184 ///
19185 /// * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19186 /// OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19187 /// * Filter Limits:
19188 ///
19189 /// * Filter should not contain more than 6 conditions.
19190 /// * Max nesting depth should not exceed 2 levels.
19191 ///
19192 /// Examples queries:
19193 ///
19194 /// * Delete back order products created before a timestamp.
19195 /// create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19196 ///
19197 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19198 pub filter: std::string::String,
19199
19200 /// Actually perform the purge.
19201 /// If `force` is set to false, the method will return the expected purge count
19202 /// without deleting any products.
19203 pub force: bool,
19204
19205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19206}
19207
19208impl PurgeProductsRequest {
19209 pub fn new() -> Self {
19210 std::default::Default::default()
19211 }
19212
19213 /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19214 ///
19215 /// # Example
19216 /// ```ignore,no_run
19217 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19218 /// let x = PurgeProductsRequest::new().set_parent("example");
19219 /// ```
19220 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19221 self.parent = v.into();
19222 self
19223 }
19224
19225 /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19226 ///
19227 /// # Example
19228 /// ```ignore,no_run
19229 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19230 /// let x = PurgeProductsRequest::new().set_filter("example");
19231 /// ```
19232 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19233 self.filter = v.into();
19234 self
19235 }
19236
19237 /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19238 ///
19239 /// # Example
19240 /// ```ignore,no_run
19241 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19242 /// let x = PurgeProductsRequest::new().set_force(true);
19243 /// ```
19244 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19245 self.force = v.into();
19246 self
19247 }
19248}
19249
19250impl wkt::message::Message for PurgeProductsRequest {
19251 fn typename() -> &'static str {
19252 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19253 }
19254}
19255
19256/// Response of the PurgeProductsRequest. If the long running operation is
19257/// successfully done, then this message is returned by the
19258/// google.longrunning.Operations.response field.
19259#[derive(Clone, Default, PartialEq)]
19260#[non_exhaustive]
19261pub struct PurgeProductsResponse {
19262 /// The total count of products purged as a result of the operation.
19263 pub purge_count: i64,
19264
19265 /// A sample of the product names that will be deleted.
19266 /// Only populated if `force` is set to false. A max of 100 names will be
19267 /// returned and the names are chosen at random.
19268 pub purge_sample: std::vec::Vec<std::string::String>,
19269
19270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19271}
19272
19273impl PurgeProductsResponse {
19274 pub fn new() -> Self {
19275 std::default::Default::default()
19276 }
19277
19278 /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19279 ///
19280 /// # Example
19281 /// ```ignore,no_run
19282 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19283 /// let x = PurgeProductsResponse::new().set_purge_count(42);
19284 /// ```
19285 pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19286 self.purge_count = v.into();
19287 self
19288 }
19289
19290 /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19291 ///
19292 /// # Example
19293 /// ```ignore,no_run
19294 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19295 /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19296 /// ```
19297 pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19298 where
19299 T: std::iter::IntoIterator<Item = V>,
19300 V: std::convert::Into<std::string::String>,
19301 {
19302 use std::iter::Iterator;
19303 self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19304 self
19305 }
19306}
19307
19308impl wkt::message::Message for PurgeProductsResponse {
19309 fn typename() -> &'static str {
19310 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19311 }
19312}
19313
19314/// Request message for PurgeUserEvents method.
19315#[derive(Clone, Default, PartialEq)]
19316#[non_exhaustive]
19317pub struct PurgeUserEventsRequest {
19318 /// Required. The resource name of the catalog under which the events are
19319 /// created. The format is
19320 /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19321 pub parent: std::string::String,
19322
19323 /// Required. The filter string to specify the events to be deleted with a
19324 /// length limit of 5,000 characters. Empty string filter is not allowed. The
19325 /// eligible fields for filtering are:
19326 ///
19327 /// * `eventType`: Double quoted
19328 /// [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19329 /// * `eventTime`: in ISO 8601 "zulu" format.
19330 /// * `visitorId`: Double quoted string. Specifying this will delete all
19331 /// events associated with a visitor.
19332 /// * `userId`: Double quoted string. Specifying this will delete all events
19333 /// associated with a user.
19334 ///
19335 /// Examples:
19336 ///
19337 /// * Deleting all events in a time range:
19338 /// `eventTime > "2012-04-23T18:25:43.511Z"
19339 /// eventTime < "2012-04-23T18:30:43.511Z"`
19340 /// * Deleting specific eventType in time range:
19341 /// `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19342 /// * Deleting all events for a specific visitor:
19343 /// `visitorId = "visitor1024"`
19344 ///
19345 /// The filtering fields are assumed to have an implicit AND.
19346 ///
19347 /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19348 pub filter: std::string::String,
19349
19350 /// Actually perform the purge.
19351 /// If `force` is set to false, the method will return the expected purge count
19352 /// without deleting any user events.
19353 pub force: bool,
19354
19355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19356}
19357
19358impl PurgeUserEventsRequest {
19359 pub fn new() -> Self {
19360 std::default::Default::default()
19361 }
19362
19363 /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19364 ///
19365 /// # Example
19366 /// ```ignore,no_run
19367 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19368 /// let x = PurgeUserEventsRequest::new().set_parent("example");
19369 /// ```
19370 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19371 self.parent = v.into();
19372 self
19373 }
19374
19375 /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19376 ///
19377 /// # Example
19378 /// ```ignore,no_run
19379 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19380 /// let x = PurgeUserEventsRequest::new().set_filter("example");
19381 /// ```
19382 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19383 self.filter = v.into();
19384 self
19385 }
19386
19387 /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19388 ///
19389 /// # Example
19390 /// ```ignore,no_run
19391 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19392 /// let x = PurgeUserEventsRequest::new().set_force(true);
19393 /// ```
19394 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19395 self.force = v.into();
19396 self
19397 }
19398}
19399
19400impl wkt::message::Message for PurgeUserEventsRequest {
19401 fn typename() -> &'static str {
19402 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19403 }
19404}
19405
19406/// Response of the PurgeUserEventsRequest. If the long running operation is
19407/// successfully done, then this message is returned by the
19408/// google.longrunning.Operations.response field.
19409#[derive(Clone, Default, PartialEq)]
19410#[non_exhaustive]
19411pub struct PurgeUserEventsResponse {
19412 /// The total count of events purged as a result of the operation.
19413 pub purged_events_count: i64,
19414
19415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19416}
19417
19418impl PurgeUserEventsResponse {
19419 pub fn new() -> Self {
19420 std::default::Default::default()
19421 }
19422
19423 /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19424 ///
19425 /// # Example
19426 /// ```ignore,no_run
19427 /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19428 /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19429 /// ```
19430 pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19431 self.purged_events_count = v.into();
19432 self
19433 }
19434}
19435
19436impl wkt::message::Message for PurgeUserEventsResponse {
19437 fn typename() -> &'static str {
19438 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19439 }
19440}
19441
19442/// Safety settings.
19443#[derive(Clone, Default, PartialEq)]
19444#[non_exhaustive]
19445pub struct SafetySetting {
19446 /// Harm category.
19447 pub category: crate::model::HarmCategory,
19448
19449 /// The harm block threshold.
19450 pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19451
19452 /// Optional. Specify if the threshold is used for probability or severity
19453 /// score. If not specified, the threshold is used for probability score.
19454 pub method: crate::model::safety_setting::HarmBlockMethod,
19455
19456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19457}
19458
19459impl SafetySetting {
19460 pub fn new() -> Self {
19461 std::default::Default::default()
19462 }
19463
19464 /// Sets the value of [category][crate::model::SafetySetting::category].
19465 ///
19466 /// # Example
19467 /// ```ignore,no_run
19468 /// # use google_cloud_retail_v2::model::SafetySetting;
19469 /// use google_cloud_retail_v2::model::HarmCategory;
19470 /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19471 /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19472 /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19473 /// ```
19474 pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19475 self.category = v.into();
19476 self
19477 }
19478
19479 /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19480 ///
19481 /// # Example
19482 /// ```ignore,no_run
19483 /// # use google_cloud_retail_v2::model::SafetySetting;
19484 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19485 /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19486 /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19487 /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19488 /// ```
19489 pub fn set_threshold<
19490 T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19491 >(
19492 mut self,
19493 v: T,
19494 ) -> Self {
19495 self.threshold = v.into();
19496 self
19497 }
19498
19499 /// Sets the value of [method][crate::model::SafetySetting::method].
19500 ///
19501 /// # Example
19502 /// ```ignore,no_run
19503 /// # use google_cloud_retail_v2::model::SafetySetting;
19504 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19505 /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19506 /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19507 /// ```
19508 pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19509 mut self,
19510 v: T,
19511 ) -> Self {
19512 self.method = v.into();
19513 self
19514 }
19515}
19516
19517impl wkt::message::Message for SafetySetting {
19518 fn typename() -> &'static str {
19519 "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19520 }
19521}
19522
19523/// Defines additional types related to [SafetySetting].
19524pub mod safety_setting {
19525 #[allow(unused_imports)]
19526 use super::*;
19527
19528 /// Probability based thresholds levels for blocking.
19529 ///
19530 /// # Working with unknown values
19531 ///
19532 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19533 /// additional enum variants at any time. Adding new variants is not considered
19534 /// a breaking change. Applications should write their code in anticipation of:
19535 ///
19536 /// - New values appearing in future releases of the client library, **and**
19537 /// - New values received dynamically, without application changes.
19538 ///
19539 /// Please consult the [Working with enums] section in the user guide for some
19540 /// guidelines.
19541 ///
19542 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19543 #[derive(Clone, Debug, PartialEq)]
19544 #[non_exhaustive]
19545 pub enum HarmBlockThreshold {
19546 /// Unspecified harm block threshold.
19547 Unspecified,
19548 /// Block low threshold and above (i.e. block more).
19549 BlockLowAndAbove,
19550 /// Block medium threshold and above.
19551 BlockMediumAndAbove,
19552 /// Block only high threshold (i.e. block less).
19553 BlockOnlyHigh,
19554 /// Block none.
19555 BlockNone,
19556 /// Turn off the safety filter.
19557 Off,
19558 /// If set, the enum was initialized with an unknown value.
19559 ///
19560 /// Applications can examine the value using [HarmBlockThreshold::value] or
19561 /// [HarmBlockThreshold::name].
19562 UnknownValue(harm_block_threshold::UnknownValue),
19563 }
19564
19565 #[doc(hidden)]
19566 pub mod harm_block_threshold {
19567 #[allow(unused_imports)]
19568 use super::*;
19569 #[derive(Clone, Debug, PartialEq)]
19570 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19571 }
19572
19573 impl HarmBlockThreshold {
19574 /// Gets the enum value.
19575 ///
19576 /// Returns `None` if the enum contains an unknown value deserialized from
19577 /// the string representation of enums.
19578 pub fn value(&self) -> std::option::Option<i32> {
19579 match self {
19580 Self::Unspecified => std::option::Option::Some(0),
19581 Self::BlockLowAndAbove => std::option::Option::Some(1),
19582 Self::BlockMediumAndAbove => std::option::Option::Some(2),
19583 Self::BlockOnlyHigh => std::option::Option::Some(3),
19584 Self::BlockNone => std::option::Option::Some(4),
19585 Self::Off => std::option::Option::Some(5),
19586 Self::UnknownValue(u) => u.0.value(),
19587 }
19588 }
19589
19590 /// Gets the enum value as a string.
19591 ///
19592 /// Returns `None` if the enum contains an unknown value deserialized from
19593 /// the integer representation of enums.
19594 pub fn name(&self) -> std::option::Option<&str> {
19595 match self {
19596 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19597 Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19598 Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19599 Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19600 Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19601 Self::Off => std::option::Option::Some("OFF"),
19602 Self::UnknownValue(u) => u.0.name(),
19603 }
19604 }
19605 }
19606
19607 impl std::default::Default for HarmBlockThreshold {
19608 fn default() -> Self {
19609 use std::convert::From;
19610 Self::from(0)
19611 }
19612 }
19613
19614 impl std::fmt::Display for HarmBlockThreshold {
19615 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19616 wkt::internal::display_enum(f, self.name(), self.value())
19617 }
19618 }
19619
19620 impl std::convert::From<i32> for HarmBlockThreshold {
19621 fn from(value: i32) -> Self {
19622 match value {
19623 0 => Self::Unspecified,
19624 1 => Self::BlockLowAndAbove,
19625 2 => Self::BlockMediumAndAbove,
19626 3 => Self::BlockOnlyHigh,
19627 4 => Self::BlockNone,
19628 5 => Self::Off,
19629 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19630 wkt::internal::UnknownEnumValue::Integer(value),
19631 )),
19632 }
19633 }
19634 }
19635
19636 impl std::convert::From<&str> for HarmBlockThreshold {
19637 fn from(value: &str) -> Self {
19638 use std::string::ToString;
19639 match value {
19640 "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19641 "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19642 "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19643 "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19644 "BLOCK_NONE" => Self::BlockNone,
19645 "OFF" => Self::Off,
19646 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19647 wkt::internal::UnknownEnumValue::String(value.to_string()),
19648 )),
19649 }
19650 }
19651 }
19652
19653 impl serde::ser::Serialize for HarmBlockThreshold {
19654 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19655 where
19656 S: serde::Serializer,
19657 {
19658 match self {
19659 Self::Unspecified => serializer.serialize_i32(0),
19660 Self::BlockLowAndAbove => serializer.serialize_i32(1),
19661 Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19662 Self::BlockOnlyHigh => serializer.serialize_i32(3),
19663 Self::BlockNone => serializer.serialize_i32(4),
19664 Self::Off => serializer.serialize_i32(5),
19665 Self::UnknownValue(u) => u.0.serialize(serializer),
19666 }
19667 }
19668 }
19669
19670 impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19671 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19672 where
19673 D: serde::Deserializer<'de>,
19674 {
19675 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19676 ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19677 ))
19678 }
19679 }
19680
19681 /// Probability vs severity.
19682 ///
19683 /// # Working with unknown values
19684 ///
19685 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19686 /// additional enum variants at any time. Adding new variants is not considered
19687 /// a breaking change. Applications should write their code in anticipation of:
19688 ///
19689 /// - New values appearing in future releases of the client library, **and**
19690 /// - New values received dynamically, without application changes.
19691 ///
19692 /// Please consult the [Working with enums] section in the user guide for some
19693 /// guidelines.
19694 ///
19695 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19696 #[derive(Clone, Debug, PartialEq)]
19697 #[non_exhaustive]
19698 pub enum HarmBlockMethod {
19699 /// The harm block method is unspecified.
19700 Unspecified,
19701 /// The harm block method uses both probability and severity scores.
19702 Severity,
19703 /// The harm block method uses the probability score.
19704 Probability,
19705 /// If set, the enum was initialized with an unknown value.
19706 ///
19707 /// Applications can examine the value using [HarmBlockMethod::value] or
19708 /// [HarmBlockMethod::name].
19709 UnknownValue(harm_block_method::UnknownValue),
19710 }
19711
19712 #[doc(hidden)]
19713 pub mod harm_block_method {
19714 #[allow(unused_imports)]
19715 use super::*;
19716 #[derive(Clone, Debug, PartialEq)]
19717 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19718 }
19719
19720 impl HarmBlockMethod {
19721 /// Gets the enum value.
19722 ///
19723 /// Returns `None` if the enum contains an unknown value deserialized from
19724 /// the string representation of enums.
19725 pub fn value(&self) -> std::option::Option<i32> {
19726 match self {
19727 Self::Unspecified => std::option::Option::Some(0),
19728 Self::Severity => std::option::Option::Some(1),
19729 Self::Probability => std::option::Option::Some(2),
19730 Self::UnknownValue(u) => u.0.value(),
19731 }
19732 }
19733
19734 /// Gets the enum value as a string.
19735 ///
19736 /// Returns `None` if the enum contains an unknown value deserialized from
19737 /// the integer representation of enums.
19738 pub fn name(&self) -> std::option::Option<&str> {
19739 match self {
19740 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
19741 Self::Severity => std::option::Option::Some("SEVERITY"),
19742 Self::Probability => std::option::Option::Some("PROBABILITY"),
19743 Self::UnknownValue(u) => u.0.name(),
19744 }
19745 }
19746 }
19747
19748 impl std::default::Default for HarmBlockMethod {
19749 fn default() -> Self {
19750 use std::convert::From;
19751 Self::from(0)
19752 }
19753 }
19754
19755 impl std::fmt::Display for HarmBlockMethod {
19756 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19757 wkt::internal::display_enum(f, self.name(), self.value())
19758 }
19759 }
19760
19761 impl std::convert::From<i32> for HarmBlockMethod {
19762 fn from(value: i32) -> Self {
19763 match value {
19764 0 => Self::Unspecified,
19765 1 => Self::Severity,
19766 2 => Self::Probability,
19767 _ => Self::UnknownValue(harm_block_method::UnknownValue(
19768 wkt::internal::UnknownEnumValue::Integer(value),
19769 )),
19770 }
19771 }
19772 }
19773
19774 impl std::convert::From<&str> for HarmBlockMethod {
19775 fn from(value: &str) -> Self {
19776 use std::string::ToString;
19777 match value {
19778 "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
19779 "SEVERITY" => Self::Severity,
19780 "PROBABILITY" => Self::Probability,
19781 _ => Self::UnknownValue(harm_block_method::UnknownValue(
19782 wkt::internal::UnknownEnumValue::String(value.to_string()),
19783 )),
19784 }
19785 }
19786 }
19787
19788 impl serde::ser::Serialize for HarmBlockMethod {
19789 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19790 where
19791 S: serde::Serializer,
19792 {
19793 match self {
19794 Self::Unspecified => serializer.serialize_i32(0),
19795 Self::Severity => serializer.serialize_i32(1),
19796 Self::Probability => serializer.serialize_i32(2),
19797 Self::UnknownValue(u) => u.0.serialize(serializer),
19798 }
19799 }
19800 }
19801
19802 impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
19803 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19804 where
19805 D: serde::Deserializer<'de>,
19806 {
19807 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
19808 ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
19809 ))
19810 }
19811 }
19812}
19813
19814/// Product attribute which structured by an attribute name and value. This
19815/// structure is used in conversational search filters and answers. For example,
19816/// if we have `name=color` and `value=red`, this means that the color is `red`.
19817#[derive(Clone, Default, PartialEq)]
19818#[non_exhaustive]
19819pub struct ProductAttributeValue {
19820 /// The attribute name.
19821 pub name: std::string::String,
19822
19823 /// The attribute value.
19824 pub value: std::string::String,
19825
19826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19827}
19828
19829impl ProductAttributeValue {
19830 pub fn new() -> Self {
19831 std::default::Default::default()
19832 }
19833
19834 /// Sets the value of [name][crate::model::ProductAttributeValue::name].
19835 ///
19836 /// # Example
19837 /// ```ignore,no_run
19838 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19839 /// let x = ProductAttributeValue::new().set_name("example");
19840 /// ```
19841 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19842 self.name = v.into();
19843 self
19844 }
19845
19846 /// Sets the value of [value][crate::model::ProductAttributeValue::value].
19847 ///
19848 /// # Example
19849 /// ```ignore,no_run
19850 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19851 /// let x = ProductAttributeValue::new().set_value("example");
19852 /// ```
19853 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19854 self.value = v.into();
19855 self
19856 }
19857}
19858
19859impl wkt::message::Message for ProductAttributeValue {
19860 fn typename() -> &'static str {
19861 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
19862 }
19863}
19864
19865/// Product attribute name and numeric interval.
19866#[derive(Clone, Default, PartialEq)]
19867#[non_exhaustive]
19868pub struct ProductAttributeInterval {
19869 /// The attribute name (e.g. "length")
19870 pub name: std::string::String,
19871
19872 /// The numeric interval (e.g. [10, 20))
19873 pub interval: std::option::Option<crate::model::Interval>,
19874
19875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19876}
19877
19878impl ProductAttributeInterval {
19879 pub fn new() -> Self {
19880 std::default::Default::default()
19881 }
19882
19883 /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
19884 ///
19885 /// # Example
19886 /// ```ignore,no_run
19887 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19888 /// let x = ProductAttributeInterval::new().set_name("example");
19889 /// ```
19890 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19891 self.name = v.into();
19892 self
19893 }
19894
19895 /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
19896 ///
19897 /// # Example
19898 /// ```ignore,no_run
19899 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19900 /// use google_cloud_retail_v2::model::Interval;
19901 /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
19902 /// ```
19903 pub fn set_interval<T>(mut self, v: T) -> Self
19904 where
19905 T: std::convert::Into<crate::model::Interval>,
19906 {
19907 self.interval = std::option::Option::Some(v.into());
19908 self
19909 }
19910
19911 /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
19912 ///
19913 /// # Example
19914 /// ```ignore,no_run
19915 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19916 /// use google_cloud_retail_v2::model::Interval;
19917 /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
19918 /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
19919 /// ```
19920 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
19921 where
19922 T: std::convert::Into<crate::model::Interval>,
19923 {
19924 self.interval = v.map(|x| x.into());
19925 self
19926 }
19927}
19928
19929impl wkt::message::Message for ProductAttributeInterval {
19930 fn typename() -> &'static str {
19931 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
19932 }
19933}
19934
19935/// This field specifies the tile information including an attribute key,
19936/// attribute value. More fields will be added in the future, eg: product id
19937/// or product counts, etc.
19938#[derive(Clone, Default, PartialEq)]
19939#[non_exhaustive]
19940pub struct Tile {
19941 /// The representative product id for this tile.
19942 pub representative_product_id: std::string::String,
19943
19944 /// The attribute key and value for the tile.
19945 pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
19946
19947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19948}
19949
19950impl Tile {
19951 pub fn new() -> Self {
19952 std::default::Default::default()
19953 }
19954
19955 /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
19956 ///
19957 /// # Example
19958 /// ```ignore,no_run
19959 /// # use google_cloud_retail_v2::model::Tile;
19960 /// let x = Tile::new().set_representative_product_id("example");
19961 /// ```
19962 pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
19963 mut self,
19964 v: T,
19965 ) -> Self {
19966 self.representative_product_id = v.into();
19967 self
19968 }
19969
19970 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
19971 ///
19972 /// Note that all the setters affecting `product_attribute` are mutually
19973 /// exclusive.
19974 ///
19975 /// # Example
19976 /// ```ignore,no_run
19977 /// # use google_cloud_retail_v2::model::Tile;
19978 /// use google_cloud_retail_v2::model::ProductAttributeValue;
19979 /// let x = Tile::new().set_product_attribute(Some(
19980 /// google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
19981 /// ```
19982 pub fn set_product_attribute<
19983 T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
19984 >(
19985 mut self,
19986 v: T,
19987 ) -> Self {
19988 self.product_attribute = v.into();
19989 self
19990 }
19991
19992 /// The value of [product_attribute][crate::model::Tile::product_attribute]
19993 /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
19994 /// holds a different branch.
19995 pub fn product_attribute_value(
19996 &self,
19997 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
19998 #[allow(unreachable_patterns)]
19999 self.product_attribute.as_ref().and_then(|v| match v {
20000 crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
20001 std::option::Option::Some(v)
20002 }
20003 _ => std::option::Option::None,
20004 })
20005 }
20006
20007 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20008 /// to hold a `ProductAttributeValue`.
20009 ///
20010 /// Note that all the setters affecting `product_attribute` are
20011 /// mutually exclusive.
20012 ///
20013 /// # Example
20014 /// ```ignore,no_run
20015 /// # use google_cloud_retail_v2::model::Tile;
20016 /// use google_cloud_retail_v2::model::ProductAttributeValue;
20017 /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20018 /// assert!(x.product_attribute_value().is_some());
20019 /// assert!(x.product_attribute_interval().is_none());
20020 /// ```
20021 pub fn set_product_attribute_value<
20022 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20023 >(
20024 mut self,
20025 v: T,
20026 ) -> Self {
20027 self.product_attribute = std::option::Option::Some(
20028 crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20029 );
20030 self
20031 }
20032
20033 /// The value of [product_attribute][crate::model::Tile::product_attribute]
20034 /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20035 /// holds a different branch.
20036 pub fn product_attribute_interval(
20037 &self,
20038 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20039 #[allow(unreachable_patterns)]
20040 self.product_attribute.as_ref().and_then(|v| match v {
20041 crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20042 std::option::Option::Some(v)
20043 }
20044 _ => std::option::Option::None,
20045 })
20046 }
20047
20048 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20049 /// to hold a `ProductAttributeInterval`.
20050 ///
20051 /// Note that all the setters affecting `product_attribute` are
20052 /// mutually exclusive.
20053 ///
20054 /// # Example
20055 /// ```ignore,no_run
20056 /// # use google_cloud_retail_v2::model::Tile;
20057 /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20058 /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20059 /// assert!(x.product_attribute_interval().is_some());
20060 /// assert!(x.product_attribute_value().is_none());
20061 /// ```
20062 pub fn set_product_attribute_interval<
20063 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20064 >(
20065 mut self,
20066 v: T,
20067 ) -> Self {
20068 self.product_attribute = std::option::Option::Some(
20069 crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20070 );
20071 self
20072 }
20073}
20074
20075impl wkt::message::Message for Tile {
20076 fn typename() -> &'static str {
20077 "type.googleapis.com/google.cloud.retail.v2.Tile"
20078 }
20079}
20080
20081/// Defines additional types related to [Tile].
20082pub mod tile {
20083 #[allow(unused_imports)]
20084 use super::*;
20085
20086 /// The attribute key and value for the tile.
20087 #[derive(Clone, Debug, PartialEq)]
20088 #[non_exhaustive]
20089 pub enum ProductAttribute {
20090 /// The product attribute key-value.
20091 ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20092 /// The product attribute key-numeric interval.
20093 ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20094 }
20095}
20096
20097/// Request message for
20098/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20099///
20100/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20101#[derive(Clone, Default, PartialEq)]
20102#[non_exhaustive]
20103pub struct SearchRequest {
20104 /// Required. The resource name of the Retail Search serving config, such as
20105 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20106 /// or the name of the legacy placement resource, such as
20107 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20108 /// This field is used to identify the serving config name and the set
20109 /// of models that are used to make the search.
20110 pub placement: std::string::String,
20111
20112 /// The branch resource name, such as
20113 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20114 ///
20115 /// Use "default_branch" as the branch ID or leave this field empty, to search
20116 /// products under the default branch.
20117 pub branch: std::string::String,
20118
20119 /// Raw search query.
20120 ///
20121 /// If this field is empty, the request is considered a category browsing
20122 /// request and returned results are based on
20123 /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20124 /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20125 ///
20126 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20127 /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20128 pub query: std::string::String,
20129
20130 /// Required. A unique identifier for tracking visitors. For example, this
20131 /// could be implemented with an HTTP cookie, which should be able to uniquely
20132 /// identify a visitor on a single device. This unique identifier should not
20133 /// change if the visitor logs in or out of the website.
20134 ///
20135 /// This should be the same identifier as
20136 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20137 ///
20138 /// The field must be a UTF-8 encoded string with a length limit of 128
20139 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20140 ///
20141 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20142 pub visitor_id: std::string::String,
20143
20144 /// User information.
20145 pub user_info: std::option::Option<crate::model::UserInfo>,
20146
20147 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20148 /// unspecified, defaults to a reasonable value. The maximum allowed value is
20149 /// 120. Values above 120 will be coerced to 120.
20150 ///
20151 /// If this field is negative, an INVALID_ARGUMENT is returned.
20152 ///
20153 /// [google.cloud.retail.v2.Product]: crate::model::Product
20154 pub page_size: i32,
20155
20156 /// A page token
20157 /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20158 /// received from a previous
20159 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20160 /// Provide this to retrieve the subsequent page.
20161 ///
20162 /// When paginating, all other parameters provided to
20163 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20164 /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20165 /// error is returned.
20166 ///
20167 /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20168 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20169 pub page_token: std::string::String,
20170
20171 /// A 0-indexed integer that specifies the current offset (that is, starting
20172 /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20173 /// deemed by the API as relevant) in search results. This field is only
20174 /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20175 /// is unset.
20176 ///
20177 /// If this field is negative, an INVALID_ARGUMENT is returned.
20178 ///
20179 /// [google.cloud.retail.v2.Product]: crate::model::Product
20180 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20181 pub offset: i32,
20182
20183 /// The filter syntax consists of an expression language for constructing a
20184 /// predicate from one or more fields of the products being filtered. Filter
20185 /// expression is case-sensitive. For more information, see
20186 /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20187 ///
20188 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20189 pub filter: std::string::String,
20190
20191 /// The default filter that is applied when a user performs a search without
20192 /// checking any filters on the search page.
20193 ///
20194 /// The filter applied to every search request when quality improvement such as
20195 /// query expansion is needed. In the case a query does not have a sufficient
20196 /// amount of results this filter will be used to determine whether or not to
20197 /// enable the query expansion flow. The original filter will still be used for
20198 /// the query expanded search.
20199 /// This field is strongly recommended to achieve high search quality.
20200 ///
20201 /// For more information about filter syntax, see
20202 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20203 ///
20204 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20205 pub canonical_filter: std::string::String,
20206
20207 /// The order in which products are returned. Products can be ordered by
20208 /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20209 /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20210 /// more information, see
20211 /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20212 ///
20213 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20214 ///
20215 /// [google.cloud.retail.v2.Product]: crate::model::Product
20216 pub order_by: std::string::String,
20217
20218 /// Facet specifications for faceted search. If empty, no facets are returned.
20219 ///
20220 /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20221 /// is returned.
20222 pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20223
20224 /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20225 /// to enable dynamic facets. Do not set this field.
20226 ///
20227 /// The specification for dynamically generated facets. Notice that only
20228 /// textual facets can be dynamically generated.
20229 #[deprecated]
20230 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20231
20232 /// Boost specification to boost certain products. For more information, see
20233 /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20234 ///
20235 /// Notice that if both
20236 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20237 /// and
20238 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20239 /// are set, the boost conditions from both places are evaluated. If a search
20240 /// request matches multiple boost conditions, the final boost score is equal
20241 /// to the sum of the boost scores from all matched boost conditions.
20242 ///
20243 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20244 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20245 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20246
20247 /// The query expansion specification that specifies the conditions under which
20248 /// query expansion occurs. For more information, see [Query
20249 /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20250 pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20251
20252 /// The keys to fetch and rollup the matching
20253 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20254 /// [Product][google.cloud.retail.v2.Product]s attributes,
20255 /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20256 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20257 /// attributes from all the matching
20258 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20259 /// [Product][google.cloud.retail.v2.Product]s or
20260 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20261 /// de-duplicated. Notice that rollup attributes will lead to extra query
20262 /// latency. Maximum number of keys is 30.
20263 ///
20264 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20265 /// fulfillment type and a fulfillment ID must be provided in the format of
20266 /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20267 /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20268 ///
20269 /// Supported keys are:
20270 ///
20271 /// * colorFamilies
20272 /// * price
20273 /// * originalPrice
20274 /// * discount
20275 /// * variantId
20276 /// * inventory(place_id,price)
20277 /// * inventory(place_id,original_price)
20278 /// * inventory(place_id,attributes.key), where key is any key in the
20279 /// [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20280 /// map.
20281 /// * attributes.key, where key is any key in the
20282 /// [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20283 /// * pickupInStore.id, where id is any
20284 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20285 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20286 /// "pickup-in-store".
20287 /// * shipToStore.id, where id is any
20288 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20289 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20290 /// "ship-to-store".
20291 /// * sameDayDelivery.id, where id is any
20292 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20293 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20294 /// "same-day-delivery".
20295 /// * nextDayDelivery.id, where id is any
20296 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20297 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20298 /// "next-day-delivery".
20299 /// * customFulfillment1.id, where id is any
20300 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20301 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20302 /// "custom-type-1".
20303 /// * customFulfillment2.id, where id is any
20304 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20305 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20306 /// "custom-type-2".
20307 /// * customFulfillment3.id, where id is any
20308 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20309 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20310 /// "custom-type-3".
20311 /// * customFulfillment4.id, where id is any
20312 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20313 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20314 /// "custom-type-4".
20315 /// * customFulfillment5.id, where id is any
20316 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20317 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20318 /// "custom-type-5".
20319 ///
20320 /// If this field is set to an invalid value other than these, an
20321 /// INVALID_ARGUMENT error is returned.
20322 ///
20323 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20324 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20325 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20326 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20327 /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20328 /// [google.cloud.retail.v2.Product]: crate::model::Product
20329 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20330 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20331 pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20332
20333 /// The categories associated with a category page. Must be set for category
20334 /// navigation queries to achieve good search quality. The format should be
20335 /// the same as
20336 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20337 ///
20338 /// To represent full path of category, use '>' sign to separate different
20339 /// hierarchies. If '>' is part of the category name, replace it with
20340 /// other character(s).
20341 ///
20342 /// Category pages include special pages such as sales or promotions. For
20343 /// instance, a special sale page may have the category hierarchy:
20344 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20345 ///
20346 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20347 pub page_categories: std::vec::Vec<std::string::String>,
20348
20349 /// The search mode of the search request. If not specified, a single search
20350 /// request triggers both product search and faceted search.
20351 pub search_mode: crate::model::search_request::SearchMode,
20352
20353 /// The specification for personalization.
20354 ///
20355 /// Notice that if both
20356 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20357 /// and
20358 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20359 /// are set.
20360 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20361 /// will override
20362 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20363 ///
20364 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20365 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20366 pub personalization_spec:
20367 std::option::Option<crate::model::search_request::PersonalizationSpec>,
20368
20369 /// The labels applied to a resource must meet the following requirements:
20370 ///
20371 /// * Each resource can have multiple labels, up to a maximum of 64.
20372 /// * Each label must be a key-value pair.
20373 /// * Keys have a minimum length of 1 character and a maximum length of 63
20374 /// characters and cannot be empty. Values can be empty and have a maximum
20375 /// length of 63 characters.
20376 /// * Keys and values can contain only lowercase letters, numeric characters,
20377 /// underscores, and dashes. All characters must use UTF-8 encoding, and
20378 /// international characters are allowed.
20379 /// * The key portion of a label must be unique. However, you can use the same
20380 /// key with multiple resources.
20381 /// * Keys must start with a lowercase letter or international character.
20382 ///
20383 /// For more information, see [Requirements for
20384 /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20385 /// in the Resource Manager documentation.
20386 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20387
20388 /// The spell correction specification that specifies the mode under
20389 /// which spell correction will take effect.
20390 pub spell_correction_spec:
20391 std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20392
20393 /// The entity for customers that may run multiple different entities, domains,
20394 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20395 /// `google.com`, `youtube.com`, etc.
20396 /// If this is set, it should be exactly matched with
20397 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20398 /// results boosted by entity.
20399 ///
20400 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20401 pub entity: std::string::String,
20402
20403 /// Optional. This field specifies all conversational related parameters
20404 /// addition to traditional retail search.
20405 pub conversational_search_spec:
20406 std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20407
20408 /// Optional. This field specifies tile navigation related parameters.
20409 pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20410
20411 /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20412 /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20413 /// information, see [Standardized codes](https://google.aip.dev/143). This
20414 /// field helps to better interpret the query. If a value isn't specified, the
20415 /// query language code is automatically detected, which may not be accurate.
20416 pub language_code: std::string::String,
20417
20418 /// Optional. The Unicode country/region code (CLDR) of a location, such as
20419 /// "US" and "419"
20420 /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20421 /// For more information, see [Standardized codes](https://google.aip.dev/143).
20422 /// If set, then results will be boosted based on the region_code provided.
20423 pub region_code: std::string::String,
20424
20425 /// Optional. An id corresponding to a place, such as a store id or region id.
20426 /// When specified, we use the price from the local inventory with the matching
20427 /// product's
20428 /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20429 /// for revenue optimization.
20430 ///
20431 /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20432 pub place_id: std::string::String,
20433
20434 /// Optional. The user attributes that could be used for personalization of
20435 /// search results.
20436 ///
20437 /// * Populate at most 100 key-value pairs per query.
20438 /// * Only supports string keys and repeated string values.
20439 /// * Duplicate keys are not allowed within a single query.
20440 ///
20441 /// Example:
20442 /// user_attributes: [
20443 /// { key: "pets"
20444 /// value {
20445 /// values: "dog"
20446 /// values: "cat"
20447 /// }
20448 /// },
20449 /// { key: "state"
20450 /// value {
20451 /// values: "CA"
20452 /// }
20453 /// }
20454 /// ]
20455 pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20456
20457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20458}
20459
20460impl SearchRequest {
20461 pub fn new() -> Self {
20462 std::default::Default::default()
20463 }
20464
20465 /// Sets the value of [placement][crate::model::SearchRequest::placement].
20466 ///
20467 /// # Example
20468 /// ```ignore,no_run
20469 /// # use google_cloud_retail_v2::model::SearchRequest;
20470 /// let x = SearchRequest::new().set_placement("example");
20471 /// ```
20472 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20473 self.placement = v.into();
20474 self
20475 }
20476
20477 /// Sets the value of [branch][crate::model::SearchRequest::branch].
20478 ///
20479 /// # Example
20480 /// ```ignore,no_run
20481 /// # use google_cloud_retail_v2::model::SearchRequest;
20482 /// let x = SearchRequest::new().set_branch("example");
20483 /// ```
20484 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20485 self.branch = v.into();
20486 self
20487 }
20488
20489 /// Sets the value of [query][crate::model::SearchRequest::query].
20490 ///
20491 /// # Example
20492 /// ```ignore,no_run
20493 /// # use google_cloud_retail_v2::model::SearchRequest;
20494 /// let x = SearchRequest::new().set_query("example");
20495 /// ```
20496 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20497 self.query = v.into();
20498 self
20499 }
20500
20501 /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20502 ///
20503 /// # Example
20504 /// ```ignore,no_run
20505 /// # use google_cloud_retail_v2::model::SearchRequest;
20506 /// let x = SearchRequest::new().set_visitor_id("example");
20507 /// ```
20508 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20509 self.visitor_id = v.into();
20510 self
20511 }
20512
20513 /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20514 ///
20515 /// # Example
20516 /// ```ignore,no_run
20517 /// # use google_cloud_retail_v2::model::SearchRequest;
20518 /// use google_cloud_retail_v2::model::UserInfo;
20519 /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20520 /// ```
20521 pub fn set_user_info<T>(mut self, v: T) -> Self
20522 where
20523 T: std::convert::Into<crate::model::UserInfo>,
20524 {
20525 self.user_info = std::option::Option::Some(v.into());
20526 self
20527 }
20528
20529 /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20530 ///
20531 /// # Example
20532 /// ```ignore,no_run
20533 /// # use google_cloud_retail_v2::model::SearchRequest;
20534 /// use google_cloud_retail_v2::model::UserInfo;
20535 /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20536 /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20537 /// ```
20538 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20539 where
20540 T: std::convert::Into<crate::model::UserInfo>,
20541 {
20542 self.user_info = v.map(|x| x.into());
20543 self
20544 }
20545
20546 /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20547 ///
20548 /// # Example
20549 /// ```ignore,no_run
20550 /// # use google_cloud_retail_v2::model::SearchRequest;
20551 /// let x = SearchRequest::new().set_page_size(42);
20552 /// ```
20553 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20554 self.page_size = v.into();
20555 self
20556 }
20557
20558 /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20559 ///
20560 /// # Example
20561 /// ```ignore,no_run
20562 /// # use google_cloud_retail_v2::model::SearchRequest;
20563 /// let x = SearchRequest::new().set_page_token("example");
20564 /// ```
20565 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20566 self.page_token = v.into();
20567 self
20568 }
20569
20570 /// Sets the value of [offset][crate::model::SearchRequest::offset].
20571 ///
20572 /// # Example
20573 /// ```ignore,no_run
20574 /// # use google_cloud_retail_v2::model::SearchRequest;
20575 /// let x = SearchRequest::new().set_offset(42);
20576 /// ```
20577 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20578 self.offset = v.into();
20579 self
20580 }
20581
20582 /// Sets the value of [filter][crate::model::SearchRequest::filter].
20583 ///
20584 /// # Example
20585 /// ```ignore,no_run
20586 /// # use google_cloud_retail_v2::model::SearchRequest;
20587 /// let x = SearchRequest::new().set_filter("example");
20588 /// ```
20589 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20590 self.filter = v.into();
20591 self
20592 }
20593
20594 /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20595 ///
20596 /// # Example
20597 /// ```ignore,no_run
20598 /// # use google_cloud_retail_v2::model::SearchRequest;
20599 /// let x = SearchRequest::new().set_canonical_filter("example");
20600 /// ```
20601 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20602 mut self,
20603 v: T,
20604 ) -> Self {
20605 self.canonical_filter = v.into();
20606 self
20607 }
20608
20609 /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20610 ///
20611 /// # Example
20612 /// ```ignore,no_run
20613 /// # use google_cloud_retail_v2::model::SearchRequest;
20614 /// let x = SearchRequest::new().set_order_by("example");
20615 /// ```
20616 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20617 self.order_by = v.into();
20618 self
20619 }
20620
20621 /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20622 ///
20623 /// # Example
20624 /// ```ignore,no_run
20625 /// # use google_cloud_retail_v2::model::SearchRequest;
20626 /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20627 /// let x = SearchRequest::new()
20628 /// .set_facet_specs([
20629 /// FacetSpec::default()/* use setters */,
20630 /// FacetSpec::default()/* use (different) setters */,
20631 /// ]);
20632 /// ```
20633 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20634 where
20635 T: std::iter::IntoIterator<Item = V>,
20636 V: std::convert::Into<crate::model::search_request::FacetSpec>,
20637 {
20638 use std::iter::Iterator;
20639 self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20640 self
20641 }
20642
20643 /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20644 ///
20645 /// # Example
20646 /// ```ignore,no_run
20647 /// # use google_cloud_retail_v2::model::SearchRequest;
20648 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20649 /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20650 /// ```
20651 #[deprecated]
20652 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20653 where
20654 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20655 {
20656 self.dynamic_facet_spec = std::option::Option::Some(v.into());
20657 self
20658 }
20659
20660 /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20661 ///
20662 /// # Example
20663 /// ```ignore,no_run
20664 /// # use google_cloud_retail_v2::model::SearchRequest;
20665 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20666 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20667 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20668 /// ```
20669 #[deprecated]
20670 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20671 where
20672 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20673 {
20674 self.dynamic_facet_spec = v.map(|x| x.into());
20675 self
20676 }
20677
20678 /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20679 ///
20680 /// # Example
20681 /// ```ignore,no_run
20682 /// # use google_cloud_retail_v2::model::SearchRequest;
20683 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20684 /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20685 /// ```
20686 pub fn set_boost_spec<T>(mut self, v: T) -> Self
20687 where
20688 T: std::convert::Into<crate::model::search_request::BoostSpec>,
20689 {
20690 self.boost_spec = std::option::Option::Some(v.into());
20691 self
20692 }
20693
20694 /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20695 ///
20696 /// # Example
20697 /// ```ignore,no_run
20698 /// # use google_cloud_retail_v2::model::SearchRequest;
20699 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20700 /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
20701 /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
20702 /// ```
20703 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
20704 where
20705 T: std::convert::Into<crate::model::search_request::BoostSpec>,
20706 {
20707 self.boost_spec = v.map(|x| x.into());
20708 self
20709 }
20710
20711 /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20712 ///
20713 /// # Example
20714 /// ```ignore,no_run
20715 /// # use google_cloud_retail_v2::model::SearchRequest;
20716 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20717 /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
20718 /// ```
20719 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
20720 where
20721 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20722 {
20723 self.query_expansion_spec = std::option::Option::Some(v.into());
20724 self
20725 }
20726
20727 /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20728 ///
20729 /// # Example
20730 /// ```ignore,no_run
20731 /// # use google_cloud_retail_v2::model::SearchRequest;
20732 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20733 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
20734 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
20735 /// ```
20736 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
20737 where
20738 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20739 {
20740 self.query_expansion_spec = v.map(|x| x.into());
20741 self
20742 }
20743
20744 /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
20745 ///
20746 /// # Example
20747 /// ```ignore,no_run
20748 /// # use google_cloud_retail_v2::model::SearchRequest;
20749 /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
20750 /// ```
20751 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
20752 where
20753 T: std::iter::IntoIterator<Item = V>,
20754 V: std::convert::Into<std::string::String>,
20755 {
20756 use std::iter::Iterator;
20757 self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
20758 self
20759 }
20760
20761 /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
20762 ///
20763 /// # Example
20764 /// ```ignore,no_run
20765 /// # use google_cloud_retail_v2::model::SearchRequest;
20766 /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
20767 /// ```
20768 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
20769 where
20770 T: std::iter::IntoIterator<Item = V>,
20771 V: std::convert::Into<std::string::String>,
20772 {
20773 use std::iter::Iterator;
20774 self.page_categories = v.into_iter().map(|i| i.into()).collect();
20775 self
20776 }
20777
20778 /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
20779 ///
20780 /// # Example
20781 /// ```ignore,no_run
20782 /// # use google_cloud_retail_v2::model::SearchRequest;
20783 /// use google_cloud_retail_v2::model::search_request::SearchMode;
20784 /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
20785 /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
20786 /// ```
20787 pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
20788 mut self,
20789 v: T,
20790 ) -> Self {
20791 self.search_mode = v.into();
20792 self
20793 }
20794
20795 /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20796 ///
20797 /// # Example
20798 /// ```ignore,no_run
20799 /// # use google_cloud_retail_v2::model::SearchRequest;
20800 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20801 /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
20802 /// ```
20803 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
20804 where
20805 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20806 {
20807 self.personalization_spec = std::option::Option::Some(v.into());
20808 self
20809 }
20810
20811 /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20812 ///
20813 /// # Example
20814 /// ```ignore,no_run
20815 /// # use google_cloud_retail_v2::model::SearchRequest;
20816 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20817 /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
20818 /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
20819 /// ```
20820 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
20821 where
20822 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20823 {
20824 self.personalization_spec = v.map(|x| x.into());
20825 self
20826 }
20827
20828 /// Sets the value of [labels][crate::model::SearchRequest::labels].
20829 ///
20830 /// # Example
20831 /// ```ignore,no_run
20832 /// # use google_cloud_retail_v2::model::SearchRequest;
20833 /// let x = SearchRequest::new().set_labels([
20834 /// ("key0", "abc"),
20835 /// ("key1", "xyz"),
20836 /// ]);
20837 /// ```
20838 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
20839 where
20840 T: std::iter::IntoIterator<Item = (K, V)>,
20841 K: std::convert::Into<std::string::String>,
20842 V: std::convert::Into<std::string::String>,
20843 {
20844 use std::iter::Iterator;
20845 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20846 self
20847 }
20848
20849 /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20850 ///
20851 /// # Example
20852 /// ```ignore,no_run
20853 /// # use google_cloud_retail_v2::model::SearchRequest;
20854 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20855 /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
20856 /// ```
20857 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
20858 where
20859 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20860 {
20861 self.spell_correction_spec = std::option::Option::Some(v.into());
20862 self
20863 }
20864
20865 /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20866 ///
20867 /// # Example
20868 /// ```ignore,no_run
20869 /// # use google_cloud_retail_v2::model::SearchRequest;
20870 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20871 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
20872 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
20873 /// ```
20874 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
20875 where
20876 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20877 {
20878 self.spell_correction_spec = v.map(|x| x.into());
20879 self
20880 }
20881
20882 /// Sets the value of [entity][crate::model::SearchRequest::entity].
20883 ///
20884 /// # Example
20885 /// ```ignore,no_run
20886 /// # use google_cloud_retail_v2::model::SearchRequest;
20887 /// let x = SearchRequest::new().set_entity("example");
20888 /// ```
20889 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20890 self.entity = v.into();
20891 self
20892 }
20893
20894 /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20895 ///
20896 /// # Example
20897 /// ```ignore,no_run
20898 /// # use google_cloud_retail_v2::model::SearchRequest;
20899 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20900 /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
20901 /// ```
20902 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
20903 where
20904 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20905 {
20906 self.conversational_search_spec = std::option::Option::Some(v.into());
20907 self
20908 }
20909
20910 /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20911 ///
20912 /// # Example
20913 /// ```ignore,no_run
20914 /// # use google_cloud_retail_v2::model::SearchRequest;
20915 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20916 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
20917 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
20918 /// ```
20919 pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
20920 where
20921 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20922 {
20923 self.conversational_search_spec = v.map(|x| x.into());
20924 self
20925 }
20926
20927 /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20928 ///
20929 /// # Example
20930 /// ```ignore,no_run
20931 /// # use google_cloud_retail_v2::model::SearchRequest;
20932 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20933 /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
20934 /// ```
20935 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
20936 where
20937 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20938 {
20939 self.tile_navigation_spec = std::option::Option::Some(v.into());
20940 self
20941 }
20942
20943 /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20944 ///
20945 /// # Example
20946 /// ```ignore,no_run
20947 /// # use google_cloud_retail_v2::model::SearchRequest;
20948 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20949 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
20950 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
20951 /// ```
20952 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
20953 where
20954 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20955 {
20956 self.tile_navigation_spec = v.map(|x| x.into());
20957 self
20958 }
20959
20960 /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
20961 ///
20962 /// # Example
20963 /// ```ignore,no_run
20964 /// # use google_cloud_retail_v2::model::SearchRequest;
20965 /// let x = SearchRequest::new().set_language_code("example");
20966 /// ```
20967 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20968 self.language_code = v.into();
20969 self
20970 }
20971
20972 /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
20973 ///
20974 /// # Example
20975 /// ```ignore,no_run
20976 /// # use google_cloud_retail_v2::model::SearchRequest;
20977 /// let x = SearchRequest::new().set_region_code("example");
20978 /// ```
20979 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20980 self.region_code = v.into();
20981 self
20982 }
20983
20984 /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
20985 ///
20986 /// # Example
20987 /// ```ignore,no_run
20988 /// # use google_cloud_retail_v2::model::SearchRequest;
20989 /// let x = SearchRequest::new().set_place_id("example");
20990 /// ```
20991 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20992 self.place_id = v.into();
20993 self
20994 }
20995
20996 /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
20997 ///
20998 /// # Example
20999 /// ```ignore,no_run
21000 /// # use google_cloud_retail_v2::model::SearchRequest;
21001 /// use google_cloud_retail_v2::model::StringList;
21002 /// let x = SearchRequest::new().set_user_attributes([
21003 /// ("key0", StringList::default()/* use setters */),
21004 /// ("key1", StringList::default()/* use (different) setters */),
21005 /// ]);
21006 /// ```
21007 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21008 where
21009 T: std::iter::IntoIterator<Item = (K, V)>,
21010 K: std::convert::Into<std::string::String>,
21011 V: std::convert::Into<crate::model::StringList>,
21012 {
21013 use std::iter::Iterator;
21014 self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21015 self
21016 }
21017}
21018
21019impl wkt::message::Message for SearchRequest {
21020 fn typename() -> &'static str {
21021 "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21022 }
21023}
21024
21025/// Defines additional types related to [SearchRequest].
21026pub mod search_request {
21027 #[allow(unused_imports)]
21028 use super::*;
21029
21030 /// A facet specification to perform faceted search.
21031 #[derive(Clone, Default, PartialEq)]
21032 #[non_exhaustive]
21033 pub struct FacetSpec {
21034 /// Required. The facet key specification.
21035 pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21036
21037 /// Maximum of facet values that should be returned for this facet. If
21038 /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21039 /// above 300 will be coerced to 300.
21040 ///
21041 /// If this field is negative, an INVALID_ARGUMENT is returned.
21042 pub limit: i32,
21043
21044 /// List of keys to exclude when faceting.
21045 ///
21046 /// By default,
21047 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21048 /// is not excluded from the filter unless it is listed in this field.
21049 ///
21050 /// Listing a facet key in this field allows its values to appear as facet
21051 /// results, even when they are filtered out of search results. Using this
21052 /// field does not affect what search results are returned.
21053 ///
21054 /// For example, suppose there are 100 products with the color facet "Red"
21055 /// and 200 products with the color facet "Blue". A query containing the
21056 /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21057 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21058 /// would by default return only "Red" products in the search results, and
21059 /// also return "Red" with count 100 as the only color facet. Although there
21060 /// are also blue products available, "Blue" would not be shown as an
21061 /// available facet value.
21062 ///
21063 /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21064 /// returns the facet values "Red" with count 100 and "Blue" with count
21065 /// 200, because the "colorFamilies" key is now excluded from the filter.
21066 /// Because this field doesn't affect search results, the search results
21067 /// are still correctly filtered to return only "Red" products.
21068 ///
21069 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21070 /// is returned.
21071 ///
21072 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21073 pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21074
21075 /// Enables dynamic position for this facet. If set to true, the position of
21076 /// this facet among all facets in the response is determined by Google
21077 /// Retail Search. It is ordered together with dynamic facets if dynamic
21078 /// facets is enabled. If set to false, the position of this facet in the
21079 /// response is the same as in the request, and it is ranked before
21080 /// the facets with dynamic position enable and all dynamic facets.
21081 ///
21082 /// For example, you may always want to have rating facet returned in
21083 /// the response, but it's not necessarily to always display the rating facet
21084 /// at the top. In that case, you can set enable_dynamic_position to true so
21085 /// that the position of rating facet in response is determined by
21086 /// Google Retail Search.
21087 ///
21088 /// Another example, assuming you have the following facets in the request:
21089 ///
21090 /// * "rating", enable_dynamic_position = true
21091 ///
21092 /// * "price", enable_dynamic_position = false
21093 ///
21094 /// * "brands", enable_dynamic_position = false
21095 ///
21096 ///
21097 /// And also you have a dynamic facets enable, which generates a facet
21098 /// "gender". Then, the final order of the facets in the response can be
21099 /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21100 /// "rating") depends on how Google Retail Search orders "gender" and
21101 /// "rating" facets. However, notice that "price" and "brands" are always
21102 /// ranked at first and second position because their enable_dynamic_position
21103 /// values are false.
21104 pub enable_dynamic_position: bool,
21105
21106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21107 }
21108
21109 impl FacetSpec {
21110 pub fn new() -> Self {
21111 std::default::Default::default()
21112 }
21113
21114 /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21115 ///
21116 /// # Example
21117 /// ```ignore,no_run
21118 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21119 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21120 /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21121 /// ```
21122 pub fn set_facet_key<T>(mut self, v: T) -> Self
21123 where
21124 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21125 {
21126 self.facet_key = std::option::Option::Some(v.into());
21127 self
21128 }
21129
21130 /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21131 ///
21132 /// # Example
21133 /// ```ignore,no_run
21134 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21135 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21136 /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21137 /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21138 /// ```
21139 pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21140 where
21141 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21142 {
21143 self.facet_key = v.map(|x| x.into());
21144 self
21145 }
21146
21147 /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21148 ///
21149 /// # Example
21150 /// ```ignore,no_run
21151 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21152 /// let x = FacetSpec::new().set_limit(42);
21153 /// ```
21154 pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21155 self.limit = v.into();
21156 self
21157 }
21158
21159 /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21160 ///
21161 /// # Example
21162 /// ```ignore,no_run
21163 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21164 /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21165 /// ```
21166 pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21167 where
21168 T: std::iter::IntoIterator<Item = V>,
21169 V: std::convert::Into<std::string::String>,
21170 {
21171 use std::iter::Iterator;
21172 self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21173 self
21174 }
21175
21176 /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21177 ///
21178 /// # Example
21179 /// ```ignore,no_run
21180 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21181 /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21182 /// ```
21183 pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21184 self.enable_dynamic_position = v.into();
21185 self
21186 }
21187 }
21188
21189 impl wkt::message::Message for FacetSpec {
21190 fn typename() -> &'static str {
21191 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21192 }
21193 }
21194
21195 /// Defines additional types related to [FacetSpec].
21196 pub mod facet_spec {
21197 #[allow(unused_imports)]
21198 use super::*;
21199
21200 /// Specifies how a facet is computed.
21201 #[derive(Clone, Default, PartialEq)]
21202 #[non_exhaustive]
21203 pub struct FacetKey {
21204 /// Required. Supported textual and numerical facet keys in
21205 /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21206 /// values are computed. Facet key is case-sensitive.
21207 ///
21208 /// Allowed facet keys when
21209 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21210 /// is not specified:
21211 ///
21212 /// * textual_field =
21213 ///
21214 /// * "brands"
21215 /// * "categories"
21216 /// * "genders"
21217 /// * "ageGroups"
21218 /// * "availability"
21219 /// * "colorFamilies"
21220 /// * "colors"
21221 /// * "sizes"
21222 /// * "materials"
21223 /// * "patterns"
21224 /// * "conditions"
21225 /// * "attributes.key"
21226 /// * "pickupInStore"
21227 /// * "shipToStore"
21228 /// * "sameDayDelivery"
21229 /// * "nextDayDelivery"
21230 /// * "customFulfillment1"
21231 /// * "customFulfillment2"
21232 /// * "customFulfillment3"
21233 /// * "customFulfillment4"
21234 /// * "customFulfillment5"
21235 /// * "inventory(place_id,attributes.key)"
21236 /// * numerical_field =
21237 ///
21238 /// * "price"
21239 /// * "discount"
21240 /// * "rating"
21241 /// * "ratingCount"
21242 /// * "attributes.key"
21243 /// * "inventory(place_id,price)"
21244 /// * "inventory(place_id,original_price)"
21245 /// * "inventory(place_id,attributes.key)"
21246 ///
21247 /// [google.cloud.retail.v2.Product]: crate::model::Product
21248 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21249 pub key: std::string::String,
21250
21251 /// Set only if values should be bucketized into intervals. Must be set
21252 /// for facets with numerical values. Must not be set for facet with text
21253 /// values. Maximum number of intervals is 40.
21254 ///
21255 /// For all numerical facet keys that appear in the list of products from
21256 /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21257 /// computed from their distribution weekly. If the model assigns a high
21258 /// score to a numerical facet key and its intervals are not specified in
21259 /// the search request, these percentiles become the bounds
21260 /// for its intervals and are returned in the response. If the
21261 /// facet key intervals are specified in the request, then the specified
21262 /// intervals are returned instead.
21263 pub intervals: std::vec::Vec<crate::model::Interval>,
21264
21265 /// Only get facet for the given restricted values. For example, when using
21266 /// "pickupInStore" as key and set restricted values to
21267 /// ["store123", "store456"], only facets for "store123" and "store456" are
21268 /// returned. Only supported on predefined textual fields, custom textual
21269 /// attributes and fulfillments. Maximum is 20.
21270 ///
21271 /// Must be set for the fulfillment facet keys:
21272 ///
21273 /// * pickupInStore
21274 ///
21275 /// * shipToStore
21276 ///
21277 /// * sameDayDelivery
21278 ///
21279 /// * nextDayDelivery
21280 ///
21281 /// * customFulfillment1
21282 ///
21283 /// * customFulfillment2
21284 ///
21285 /// * customFulfillment3
21286 ///
21287 /// * customFulfillment4
21288 ///
21289 /// * customFulfillment5
21290 ///
21291 pub restricted_values: std::vec::Vec<std::string::String>,
21292
21293 /// Only get facet values that start with the given string prefix. For
21294 /// example, suppose "categories" has three values "Women > Shoe",
21295 /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21296 /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21297 /// Only supported on textual fields. Maximum is 10.
21298 pub prefixes: std::vec::Vec<std::string::String>,
21299
21300 /// Only get facet values that contains the given strings. For example,
21301 /// suppose "categories" has three values "Women > Shoe",
21302 /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21303 /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21304 /// Only supported on textual fields. Maximum is 10.
21305 pub contains: std::vec::Vec<std::string::String>,
21306
21307 /// True to make facet keys case insensitive when getting faceting
21308 /// values with prefixes or contains; false otherwise.
21309 pub case_insensitive: bool,
21310
21311 /// The order in which
21312 /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21313 /// are returned.
21314 ///
21315 /// Allowed values are:
21316 ///
21317 /// * "count desc", which means order by
21318 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21319 /// descending.
21320 ///
21321 /// * "value desc", which means order by
21322 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21323 /// descending.
21324 /// Only applies to textual facets.
21325 ///
21326 ///
21327 /// If not set, textual values are sorted in [natural
21328 /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21329 /// intervals are sorted in the order given by
21330 /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21331 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21332 /// are sorted in the order given by
21333 /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21334 ///
21335 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21336 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21337 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21338 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21339 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21340 /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21341 pub order_by: std::string::String,
21342
21343 /// The query that is used to compute facet for the given facet key.
21344 /// When provided, it overrides the default behavior of facet
21345 /// computation. The query syntax is the same as a filter expression. See
21346 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21347 /// detail syntax and limitations. Notice that there is no limitation on
21348 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21349 /// when query is specified.
21350 ///
21351 /// In the response,
21352 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21353 /// is always "1" and
21354 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21355 /// is the number of results that match the query.
21356 ///
21357 /// For example, you can set a customized facet for "shipToStore",
21358 /// where
21359 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21360 /// is "customizedShipToStore", and
21361 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21362 /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21363 /// Then the facet counts the products that are both in stock and ship
21364 /// to store "123".
21365 ///
21366 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21367 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21368 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21369 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21370 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21371 pub query: std::string::String,
21372
21373 /// Returns the min and max value for each numerical facet intervals.
21374 /// Ignored for textual facets.
21375 pub return_min_max: bool,
21376
21377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21378 }
21379
21380 impl FacetKey {
21381 pub fn new() -> Self {
21382 std::default::Default::default()
21383 }
21384
21385 /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21386 ///
21387 /// # Example
21388 /// ```ignore,no_run
21389 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21390 /// let x = FacetKey::new().set_key("example");
21391 /// ```
21392 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21393 self.key = v.into();
21394 self
21395 }
21396
21397 /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21398 ///
21399 /// # Example
21400 /// ```ignore,no_run
21401 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21402 /// use google_cloud_retail_v2::model::Interval;
21403 /// let x = FacetKey::new()
21404 /// .set_intervals([
21405 /// Interval::default()/* use setters */,
21406 /// Interval::default()/* use (different) setters */,
21407 /// ]);
21408 /// ```
21409 pub fn set_intervals<T, V>(mut self, v: T) -> Self
21410 where
21411 T: std::iter::IntoIterator<Item = V>,
21412 V: std::convert::Into<crate::model::Interval>,
21413 {
21414 use std::iter::Iterator;
21415 self.intervals = v.into_iter().map(|i| i.into()).collect();
21416 self
21417 }
21418
21419 /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21420 ///
21421 /// # Example
21422 /// ```ignore,no_run
21423 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21424 /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21425 /// ```
21426 pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21427 where
21428 T: std::iter::IntoIterator<Item = V>,
21429 V: std::convert::Into<std::string::String>,
21430 {
21431 use std::iter::Iterator;
21432 self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21433 self
21434 }
21435
21436 /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21437 ///
21438 /// # Example
21439 /// ```ignore,no_run
21440 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21441 /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21442 /// ```
21443 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21444 where
21445 T: std::iter::IntoIterator<Item = V>,
21446 V: std::convert::Into<std::string::String>,
21447 {
21448 use std::iter::Iterator;
21449 self.prefixes = v.into_iter().map(|i| i.into()).collect();
21450 self
21451 }
21452
21453 /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21454 ///
21455 /// # Example
21456 /// ```ignore,no_run
21457 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21458 /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21459 /// ```
21460 pub fn set_contains<T, V>(mut self, v: T) -> Self
21461 where
21462 T: std::iter::IntoIterator<Item = V>,
21463 V: std::convert::Into<std::string::String>,
21464 {
21465 use std::iter::Iterator;
21466 self.contains = v.into_iter().map(|i| i.into()).collect();
21467 self
21468 }
21469
21470 /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21471 ///
21472 /// # Example
21473 /// ```ignore,no_run
21474 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21475 /// let x = FacetKey::new().set_case_insensitive(true);
21476 /// ```
21477 pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21478 self.case_insensitive = v.into();
21479 self
21480 }
21481
21482 /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21483 ///
21484 /// # Example
21485 /// ```ignore,no_run
21486 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21487 /// let x = FacetKey::new().set_order_by("example");
21488 /// ```
21489 pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21490 mut self,
21491 v: T,
21492 ) -> Self {
21493 self.order_by = v.into();
21494 self
21495 }
21496
21497 /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21498 ///
21499 /// # Example
21500 /// ```ignore,no_run
21501 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21502 /// let x = FacetKey::new().set_query("example");
21503 /// ```
21504 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21505 self.query = v.into();
21506 self
21507 }
21508
21509 /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21510 ///
21511 /// # Example
21512 /// ```ignore,no_run
21513 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21514 /// let x = FacetKey::new().set_return_min_max(true);
21515 /// ```
21516 pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21517 self.return_min_max = v.into();
21518 self
21519 }
21520 }
21521
21522 impl wkt::message::Message for FacetKey {
21523 fn typename() -> &'static str {
21524 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21525 }
21526 }
21527 }
21528
21529 /// The specifications of dynamically generated facets.
21530 #[derive(Clone, Default, PartialEq)]
21531 #[non_exhaustive]
21532 pub struct DynamicFacetSpec {
21533 /// Mode of the DynamicFacet feature.
21534 /// Defaults to
21535 /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21536 /// if it's unset.
21537 ///
21538 /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21539 pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21540
21541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21542 }
21543
21544 impl DynamicFacetSpec {
21545 pub fn new() -> Self {
21546 std::default::Default::default()
21547 }
21548
21549 /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21550 ///
21551 /// # Example
21552 /// ```ignore,no_run
21553 /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21554 /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21555 /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21556 /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21557 /// ```
21558 pub fn set_mode<
21559 T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21560 >(
21561 mut self,
21562 v: T,
21563 ) -> Self {
21564 self.mode = v.into();
21565 self
21566 }
21567 }
21568
21569 impl wkt::message::Message for DynamicFacetSpec {
21570 fn typename() -> &'static str {
21571 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21572 }
21573 }
21574
21575 /// Defines additional types related to [DynamicFacetSpec].
21576 pub mod dynamic_facet_spec {
21577 #[allow(unused_imports)]
21578 use super::*;
21579
21580 /// Enum to control DynamicFacet mode
21581 ///
21582 /// # Working with unknown values
21583 ///
21584 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21585 /// additional enum variants at any time. Adding new variants is not considered
21586 /// a breaking change. Applications should write their code in anticipation of:
21587 ///
21588 /// - New values appearing in future releases of the client library, **and**
21589 /// - New values received dynamically, without application changes.
21590 ///
21591 /// Please consult the [Working with enums] section in the user guide for some
21592 /// guidelines.
21593 ///
21594 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21595 #[derive(Clone, Debug, PartialEq)]
21596 #[non_exhaustive]
21597 pub enum Mode {
21598 /// Default value.
21599 Unspecified,
21600 /// Disable Dynamic Facet.
21601 Disabled,
21602 /// Automatic mode built by Google Retail Search.
21603 Enabled,
21604 /// If set, the enum was initialized with an unknown value.
21605 ///
21606 /// Applications can examine the value using [Mode::value] or
21607 /// [Mode::name].
21608 UnknownValue(mode::UnknownValue),
21609 }
21610
21611 #[doc(hidden)]
21612 pub mod mode {
21613 #[allow(unused_imports)]
21614 use super::*;
21615 #[derive(Clone, Debug, PartialEq)]
21616 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21617 }
21618
21619 impl Mode {
21620 /// Gets the enum value.
21621 ///
21622 /// Returns `None` if the enum contains an unknown value deserialized from
21623 /// the string representation of enums.
21624 pub fn value(&self) -> std::option::Option<i32> {
21625 match self {
21626 Self::Unspecified => std::option::Option::Some(0),
21627 Self::Disabled => std::option::Option::Some(1),
21628 Self::Enabled => std::option::Option::Some(2),
21629 Self::UnknownValue(u) => u.0.value(),
21630 }
21631 }
21632
21633 /// Gets the enum value as a string.
21634 ///
21635 /// Returns `None` if the enum contains an unknown value deserialized from
21636 /// the integer representation of enums.
21637 pub fn name(&self) -> std::option::Option<&str> {
21638 match self {
21639 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21640 Self::Disabled => std::option::Option::Some("DISABLED"),
21641 Self::Enabled => std::option::Option::Some("ENABLED"),
21642 Self::UnknownValue(u) => u.0.name(),
21643 }
21644 }
21645 }
21646
21647 impl std::default::Default for Mode {
21648 fn default() -> Self {
21649 use std::convert::From;
21650 Self::from(0)
21651 }
21652 }
21653
21654 impl std::fmt::Display for Mode {
21655 fn fmt(
21656 &self,
21657 f: &mut std::fmt::Formatter<'_>,
21658 ) -> std::result::Result<(), std::fmt::Error> {
21659 wkt::internal::display_enum(f, self.name(), self.value())
21660 }
21661 }
21662
21663 impl std::convert::From<i32> for Mode {
21664 fn from(value: i32) -> Self {
21665 match value {
21666 0 => Self::Unspecified,
21667 1 => Self::Disabled,
21668 2 => Self::Enabled,
21669 _ => Self::UnknownValue(mode::UnknownValue(
21670 wkt::internal::UnknownEnumValue::Integer(value),
21671 )),
21672 }
21673 }
21674 }
21675
21676 impl std::convert::From<&str> for Mode {
21677 fn from(value: &str) -> Self {
21678 use std::string::ToString;
21679 match value {
21680 "MODE_UNSPECIFIED" => Self::Unspecified,
21681 "DISABLED" => Self::Disabled,
21682 "ENABLED" => Self::Enabled,
21683 _ => Self::UnknownValue(mode::UnknownValue(
21684 wkt::internal::UnknownEnumValue::String(value.to_string()),
21685 )),
21686 }
21687 }
21688 }
21689
21690 impl serde::ser::Serialize for Mode {
21691 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21692 where
21693 S: serde::Serializer,
21694 {
21695 match self {
21696 Self::Unspecified => serializer.serialize_i32(0),
21697 Self::Disabled => serializer.serialize_i32(1),
21698 Self::Enabled => serializer.serialize_i32(2),
21699 Self::UnknownValue(u) => u.0.serialize(serializer),
21700 }
21701 }
21702 }
21703
21704 impl<'de> serde::de::Deserialize<'de> for Mode {
21705 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21706 where
21707 D: serde::Deserializer<'de>,
21708 {
21709 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
21710 ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
21711 ))
21712 }
21713 }
21714 }
21715
21716 /// Boost specification to boost certain items.
21717 #[derive(Clone, Default, PartialEq)]
21718 #[non_exhaustive]
21719 pub struct BoostSpec {
21720 /// Condition boost specifications. If a product matches multiple conditions
21721 /// in the specifications, boost scores from these specifications are all
21722 /// applied and combined in a non-linear way. Maximum number of
21723 /// specifications is 20.
21724 pub condition_boost_specs:
21725 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21726
21727 /// Whether to skip boostspec validation. If this field is set to true,
21728 /// invalid
21729 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21730 /// will be ignored and valid
21731 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21732 /// will still be applied.
21733 ///
21734 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
21735 pub skip_boost_spec_validation: std::option::Option<bool>,
21736
21737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21738 }
21739
21740 impl BoostSpec {
21741 pub fn new() -> Self {
21742 std::default::Default::default()
21743 }
21744
21745 /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
21746 ///
21747 /// # Example
21748 /// ```ignore,no_run
21749 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21750 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21751 /// let x = BoostSpec::new()
21752 /// .set_condition_boost_specs([
21753 /// ConditionBoostSpec::default()/* use setters */,
21754 /// ConditionBoostSpec::default()/* use (different) setters */,
21755 /// ]);
21756 /// ```
21757 pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
21758 where
21759 T: std::iter::IntoIterator<Item = V>,
21760 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21761 {
21762 use std::iter::Iterator;
21763 self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
21764 self
21765 }
21766
21767 /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21768 ///
21769 /// # Example
21770 /// ```ignore,no_run
21771 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21772 /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
21773 /// ```
21774 pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
21775 where
21776 T: std::convert::Into<bool>,
21777 {
21778 self.skip_boost_spec_validation = std::option::Option::Some(v.into());
21779 self
21780 }
21781
21782 /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21783 ///
21784 /// # Example
21785 /// ```ignore,no_run
21786 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21787 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
21788 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
21789 /// ```
21790 pub fn set_or_clear_skip_boost_spec_validation<T>(
21791 mut self,
21792 v: std::option::Option<T>,
21793 ) -> Self
21794 where
21795 T: std::convert::Into<bool>,
21796 {
21797 self.skip_boost_spec_validation = v.map(|x| x.into());
21798 self
21799 }
21800 }
21801
21802 impl wkt::message::Message for BoostSpec {
21803 fn typename() -> &'static str {
21804 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
21805 }
21806 }
21807
21808 /// Defines additional types related to [BoostSpec].
21809 pub mod boost_spec {
21810 #[allow(unused_imports)]
21811 use super::*;
21812
21813 /// Boost applies to products which match a condition.
21814 #[derive(Clone, Default, PartialEq)]
21815 #[non_exhaustive]
21816 pub struct ConditionBoostSpec {
21817 /// An expression which specifies a boost condition. The syntax and
21818 /// supported fields are the same as a filter expression. See
21819 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21820 /// detail syntax and limitations.
21821 ///
21822 /// Examples:
21823 ///
21824 /// * To boost products with product ID "product_1" or "product_2", and
21825 /// color
21826 /// "Red" or "Blue":
21827 /// * (id: ANY("product_1", "product_2")) AND (colorFamilies:
21828 /// ANY("Red","Blue"))
21829 ///
21830 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21831 pub condition: std::string::String,
21832
21833 /// Strength of the condition boost, which should be in [-1, 1]. Negative
21834 /// boost means demotion. Default is 0.0.
21835 ///
21836 /// Setting to 1.0 gives the item a big promotion. However, it does not
21837 /// necessarily mean that the boosted item will be the top result at all
21838 /// times, nor that other items will be excluded. Results could still be
21839 /// shown even when none of them matches the condition. And results that
21840 /// are significantly more relevant to the search query can still trump
21841 /// your heavily favored but irrelevant items.
21842 ///
21843 /// Setting to -1.0 gives the item a big demotion. However, results that
21844 /// are deeply relevant might still be shown. The item will have an
21845 /// upstream battle to get a fairly high ranking, but it is not blocked out
21846 /// completely.
21847 ///
21848 /// Setting to 0.0 means no boost applied. The boosting condition is
21849 /// ignored.
21850 pub boost: f32,
21851
21852 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21853 }
21854
21855 impl ConditionBoostSpec {
21856 pub fn new() -> Self {
21857 std::default::Default::default()
21858 }
21859
21860 /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
21861 ///
21862 /// # Example
21863 /// ```ignore,no_run
21864 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21865 /// let x = ConditionBoostSpec::new().set_condition("example");
21866 /// ```
21867 pub fn set_condition<T: std::convert::Into<std::string::String>>(
21868 mut self,
21869 v: T,
21870 ) -> Self {
21871 self.condition = v.into();
21872 self
21873 }
21874
21875 /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
21876 ///
21877 /// # Example
21878 /// ```ignore,no_run
21879 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21880 /// let x = ConditionBoostSpec::new().set_boost(42.0);
21881 /// ```
21882 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
21883 self.boost = v.into();
21884 self
21885 }
21886 }
21887
21888 impl wkt::message::Message for ConditionBoostSpec {
21889 fn typename() -> &'static str {
21890 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
21891 }
21892 }
21893 }
21894
21895 /// Specification to determine under which conditions query expansion should
21896 /// occur.
21897 #[derive(Clone, Default, PartialEq)]
21898 #[non_exhaustive]
21899 pub struct QueryExpansionSpec {
21900 /// The condition under which query expansion should occur. Default to
21901 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21902 ///
21903 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21904 pub condition: crate::model::search_request::query_expansion_spec::Condition,
21905
21906 /// Whether to pin unexpanded results. The default value is false. If this
21907 /// field is set to true,
21908 /// unexpanded products are always at the top of the search results, followed
21909 /// by the expanded results.
21910 pub pin_unexpanded_results: bool,
21911
21912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21913 }
21914
21915 impl QueryExpansionSpec {
21916 pub fn new() -> Self {
21917 std::default::Default::default()
21918 }
21919
21920 /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
21921 ///
21922 /// # Example
21923 /// ```ignore,no_run
21924 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21925 /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
21926 /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
21927 /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
21928 /// ```
21929 pub fn set_condition<
21930 T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
21931 >(
21932 mut self,
21933 v: T,
21934 ) -> Self {
21935 self.condition = v.into();
21936 self
21937 }
21938
21939 /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
21940 ///
21941 /// # Example
21942 /// ```ignore,no_run
21943 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21944 /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
21945 /// ```
21946 pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21947 self.pin_unexpanded_results = v.into();
21948 self
21949 }
21950 }
21951
21952 impl wkt::message::Message for QueryExpansionSpec {
21953 fn typename() -> &'static str {
21954 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
21955 }
21956 }
21957
21958 /// Defines additional types related to [QueryExpansionSpec].
21959 pub mod query_expansion_spec {
21960 #[allow(unused_imports)]
21961 use super::*;
21962
21963 /// Enum describing under which condition query expansion should occur.
21964 ///
21965 /// # Working with unknown values
21966 ///
21967 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21968 /// additional enum variants at any time. Adding new variants is not considered
21969 /// a breaking change. Applications should write their code in anticipation of:
21970 ///
21971 /// - New values appearing in future releases of the client library, **and**
21972 /// - New values received dynamically, without application changes.
21973 ///
21974 /// Please consult the [Working with enums] section in the user guide for some
21975 /// guidelines.
21976 ///
21977 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21978 #[derive(Clone, Debug, PartialEq)]
21979 #[non_exhaustive]
21980 pub enum Condition {
21981 /// Unspecified query expansion condition. In this case, server behavior
21982 /// defaults to
21983 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21984 ///
21985 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21986 Unspecified,
21987 /// Disabled query expansion. Only the exact search query is used, even if
21988 /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
21989 /// is zero.
21990 ///
21991 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
21992 Disabled,
21993 /// Automatic query expansion built by Google Retail Search.
21994 Auto,
21995 /// If set, the enum was initialized with an unknown value.
21996 ///
21997 /// Applications can examine the value using [Condition::value] or
21998 /// [Condition::name].
21999 UnknownValue(condition::UnknownValue),
22000 }
22001
22002 #[doc(hidden)]
22003 pub mod condition {
22004 #[allow(unused_imports)]
22005 use super::*;
22006 #[derive(Clone, Debug, PartialEq)]
22007 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22008 }
22009
22010 impl Condition {
22011 /// Gets the enum value.
22012 ///
22013 /// Returns `None` if the enum contains an unknown value deserialized from
22014 /// the string representation of enums.
22015 pub fn value(&self) -> std::option::Option<i32> {
22016 match self {
22017 Self::Unspecified => std::option::Option::Some(0),
22018 Self::Disabled => std::option::Option::Some(1),
22019 Self::Auto => std::option::Option::Some(3),
22020 Self::UnknownValue(u) => u.0.value(),
22021 }
22022 }
22023
22024 /// Gets the enum value as a string.
22025 ///
22026 /// Returns `None` if the enum contains an unknown value deserialized from
22027 /// the integer representation of enums.
22028 pub fn name(&self) -> std::option::Option<&str> {
22029 match self {
22030 Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22031 Self::Disabled => std::option::Option::Some("DISABLED"),
22032 Self::Auto => std::option::Option::Some("AUTO"),
22033 Self::UnknownValue(u) => u.0.name(),
22034 }
22035 }
22036 }
22037
22038 impl std::default::Default for Condition {
22039 fn default() -> Self {
22040 use std::convert::From;
22041 Self::from(0)
22042 }
22043 }
22044
22045 impl std::fmt::Display for Condition {
22046 fn fmt(
22047 &self,
22048 f: &mut std::fmt::Formatter<'_>,
22049 ) -> std::result::Result<(), std::fmt::Error> {
22050 wkt::internal::display_enum(f, self.name(), self.value())
22051 }
22052 }
22053
22054 impl std::convert::From<i32> for Condition {
22055 fn from(value: i32) -> Self {
22056 match value {
22057 0 => Self::Unspecified,
22058 1 => Self::Disabled,
22059 3 => Self::Auto,
22060 _ => Self::UnknownValue(condition::UnknownValue(
22061 wkt::internal::UnknownEnumValue::Integer(value),
22062 )),
22063 }
22064 }
22065 }
22066
22067 impl std::convert::From<&str> for Condition {
22068 fn from(value: &str) -> Self {
22069 use std::string::ToString;
22070 match value {
22071 "CONDITION_UNSPECIFIED" => Self::Unspecified,
22072 "DISABLED" => Self::Disabled,
22073 "AUTO" => Self::Auto,
22074 _ => Self::UnknownValue(condition::UnknownValue(
22075 wkt::internal::UnknownEnumValue::String(value.to_string()),
22076 )),
22077 }
22078 }
22079 }
22080
22081 impl serde::ser::Serialize for Condition {
22082 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22083 where
22084 S: serde::Serializer,
22085 {
22086 match self {
22087 Self::Unspecified => serializer.serialize_i32(0),
22088 Self::Disabled => serializer.serialize_i32(1),
22089 Self::Auto => serializer.serialize_i32(3),
22090 Self::UnknownValue(u) => u.0.serialize(serializer),
22091 }
22092 }
22093 }
22094
22095 impl<'de> serde::de::Deserialize<'de> for Condition {
22096 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22097 where
22098 D: serde::Deserializer<'de>,
22099 {
22100 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22101 ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22102 ))
22103 }
22104 }
22105 }
22106
22107 /// The specification for personalization.
22108 #[derive(Clone, Default, PartialEq)]
22109 #[non_exhaustive]
22110 pub struct PersonalizationSpec {
22111 /// Defaults to
22112 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22113 ///
22114 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22115 pub mode: crate::model::search_request::personalization_spec::Mode,
22116
22117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22118 }
22119
22120 impl PersonalizationSpec {
22121 pub fn new() -> Self {
22122 std::default::Default::default()
22123 }
22124
22125 /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22126 ///
22127 /// # Example
22128 /// ```ignore,no_run
22129 /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22130 /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22131 /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22132 /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22133 /// ```
22134 pub fn set_mode<
22135 T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22136 >(
22137 mut self,
22138 v: T,
22139 ) -> Self {
22140 self.mode = v.into();
22141 self
22142 }
22143 }
22144
22145 impl wkt::message::Message for PersonalizationSpec {
22146 fn typename() -> &'static str {
22147 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22148 }
22149 }
22150
22151 /// Defines additional types related to [PersonalizationSpec].
22152 pub mod personalization_spec {
22153 #[allow(unused_imports)]
22154 use super::*;
22155
22156 /// The personalization mode of each search request.
22157 ///
22158 /// # Working with unknown values
22159 ///
22160 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22161 /// additional enum variants at any time. Adding new variants is not considered
22162 /// a breaking change. Applications should write their code in anticipation of:
22163 ///
22164 /// - New values appearing in future releases of the client library, **and**
22165 /// - New values received dynamically, without application changes.
22166 ///
22167 /// Please consult the [Working with enums] section in the user guide for some
22168 /// guidelines.
22169 ///
22170 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22171 #[derive(Clone, Debug, PartialEq)]
22172 #[non_exhaustive]
22173 pub enum Mode {
22174 /// Default value. In this case, server behavior defaults to
22175 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22176 ///
22177 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22178 Unspecified,
22179 /// Let CRS decide whether to use personalization based on quality of user
22180 /// event data.
22181 Auto,
22182 /// Disable personalization.
22183 Disabled,
22184 /// If set, the enum was initialized with an unknown value.
22185 ///
22186 /// Applications can examine the value using [Mode::value] or
22187 /// [Mode::name].
22188 UnknownValue(mode::UnknownValue),
22189 }
22190
22191 #[doc(hidden)]
22192 pub mod mode {
22193 #[allow(unused_imports)]
22194 use super::*;
22195 #[derive(Clone, Debug, PartialEq)]
22196 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22197 }
22198
22199 impl Mode {
22200 /// Gets the enum value.
22201 ///
22202 /// Returns `None` if the enum contains an unknown value deserialized from
22203 /// the string representation of enums.
22204 pub fn value(&self) -> std::option::Option<i32> {
22205 match self {
22206 Self::Unspecified => std::option::Option::Some(0),
22207 Self::Auto => std::option::Option::Some(1),
22208 Self::Disabled => std::option::Option::Some(2),
22209 Self::UnknownValue(u) => u.0.value(),
22210 }
22211 }
22212
22213 /// Gets the enum value as a string.
22214 ///
22215 /// Returns `None` if the enum contains an unknown value deserialized from
22216 /// the integer representation of enums.
22217 pub fn name(&self) -> std::option::Option<&str> {
22218 match self {
22219 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22220 Self::Auto => std::option::Option::Some("AUTO"),
22221 Self::Disabled => std::option::Option::Some("DISABLED"),
22222 Self::UnknownValue(u) => u.0.name(),
22223 }
22224 }
22225 }
22226
22227 impl std::default::Default for Mode {
22228 fn default() -> Self {
22229 use std::convert::From;
22230 Self::from(0)
22231 }
22232 }
22233
22234 impl std::fmt::Display for Mode {
22235 fn fmt(
22236 &self,
22237 f: &mut std::fmt::Formatter<'_>,
22238 ) -> std::result::Result<(), std::fmt::Error> {
22239 wkt::internal::display_enum(f, self.name(), self.value())
22240 }
22241 }
22242
22243 impl std::convert::From<i32> for Mode {
22244 fn from(value: i32) -> Self {
22245 match value {
22246 0 => Self::Unspecified,
22247 1 => Self::Auto,
22248 2 => Self::Disabled,
22249 _ => Self::UnknownValue(mode::UnknownValue(
22250 wkt::internal::UnknownEnumValue::Integer(value),
22251 )),
22252 }
22253 }
22254 }
22255
22256 impl std::convert::From<&str> for Mode {
22257 fn from(value: &str) -> Self {
22258 use std::string::ToString;
22259 match value {
22260 "MODE_UNSPECIFIED" => Self::Unspecified,
22261 "AUTO" => Self::Auto,
22262 "DISABLED" => Self::Disabled,
22263 _ => Self::UnknownValue(mode::UnknownValue(
22264 wkt::internal::UnknownEnumValue::String(value.to_string()),
22265 )),
22266 }
22267 }
22268 }
22269
22270 impl serde::ser::Serialize for Mode {
22271 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22272 where
22273 S: serde::Serializer,
22274 {
22275 match self {
22276 Self::Unspecified => serializer.serialize_i32(0),
22277 Self::Auto => serializer.serialize_i32(1),
22278 Self::Disabled => serializer.serialize_i32(2),
22279 Self::UnknownValue(u) => u.0.serialize(serializer),
22280 }
22281 }
22282 }
22283
22284 impl<'de> serde::de::Deserialize<'de> for Mode {
22285 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22286 where
22287 D: serde::Deserializer<'de>,
22288 {
22289 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22290 ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22291 ))
22292 }
22293 }
22294 }
22295
22296 /// The specification for query spell correction.
22297 #[derive(Clone, Default, PartialEq)]
22298 #[non_exhaustive]
22299 pub struct SpellCorrectionSpec {
22300 /// The mode under which spell correction should take effect to
22301 /// replace the original search query. Default to
22302 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22303 ///
22304 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22305 pub mode: crate::model::search_request::spell_correction_spec::Mode,
22306
22307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22308 }
22309
22310 impl SpellCorrectionSpec {
22311 pub fn new() -> Self {
22312 std::default::Default::default()
22313 }
22314
22315 /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22316 ///
22317 /// # Example
22318 /// ```ignore,no_run
22319 /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22320 /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22321 /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22322 /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22323 /// ```
22324 pub fn set_mode<
22325 T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22326 >(
22327 mut self,
22328 v: T,
22329 ) -> Self {
22330 self.mode = v.into();
22331 self
22332 }
22333 }
22334
22335 impl wkt::message::Message for SpellCorrectionSpec {
22336 fn typename() -> &'static str {
22337 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22338 }
22339 }
22340
22341 /// Defines additional types related to [SpellCorrectionSpec].
22342 pub mod spell_correction_spec {
22343 #[allow(unused_imports)]
22344 use super::*;
22345
22346 /// Enum describing under which mode spell correction should occur.
22347 ///
22348 /// # Working with unknown values
22349 ///
22350 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22351 /// additional enum variants at any time. Adding new variants is not considered
22352 /// a breaking change. Applications should write their code in anticipation of:
22353 ///
22354 /// - New values appearing in future releases of the client library, **and**
22355 /// - New values received dynamically, without application changes.
22356 ///
22357 /// Please consult the [Working with enums] section in the user guide for some
22358 /// guidelines.
22359 ///
22360 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22361 #[derive(Clone, Debug, PartialEq)]
22362 #[non_exhaustive]
22363 pub enum Mode {
22364 /// Unspecified spell correction mode. In this case, server behavior
22365 /// defaults to
22366 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22367 ///
22368 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22369 Unspecified,
22370 /// Google Retail Search will try to find a spell suggestion if there
22371 /// is any and put in the
22372 /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22373 /// The spell suggestion will not be used as the search query.
22374 ///
22375 /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22376 SuggestionOnly,
22377 /// Automatic spell correction built by Google Retail Search. Search will
22378 /// be based on the corrected query if found.
22379 Auto,
22380 /// If set, the enum was initialized with an unknown value.
22381 ///
22382 /// Applications can examine the value using [Mode::value] or
22383 /// [Mode::name].
22384 UnknownValue(mode::UnknownValue),
22385 }
22386
22387 #[doc(hidden)]
22388 pub mod mode {
22389 #[allow(unused_imports)]
22390 use super::*;
22391 #[derive(Clone, Debug, PartialEq)]
22392 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22393 }
22394
22395 impl Mode {
22396 /// Gets the enum value.
22397 ///
22398 /// Returns `None` if the enum contains an unknown value deserialized from
22399 /// the string representation of enums.
22400 pub fn value(&self) -> std::option::Option<i32> {
22401 match self {
22402 Self::Unspecified => std::option::Option::Some(0),
22403 Self::SuggestionOnly => std::option::Option::Some(1),
22404 Self::Auto => std::option::Option::Some(2),
22405 Self::UnknownValue(u) => u.0.value(),
22406 }
22407 }
22408
22409 /// Gets the enum value as a string.
22410 ///
22411 /// Returns `None` if the enum contains an unknown value deserialized from
22412 /// the integer representation of enums.
22413 pub fn name(&self) -> std::option::Option<&str> {
22414 match self {
22415 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22416 Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22417 Self::Auto => std::option::Option::Some("AUTO"),
22418 Self::UnknownValue(u) => u.0.name(),
22419 }
22420 }
22421 }
22422
22423 impl std::default::Default for Mode {
22424 fn default() -> Self {
22425 use std::convert::From;
22426 Self::from(0)
22427 }
22428 }
22429
22430 impl std::fmt::Display for Mode {
22431 fn fmt(
22432 &self,
22433 f: &mut std::fmt::Formatter<'_>,
22434 ) -> std::result::Result<(), std::fmt::Error> {
22435 wkt::internal::display_enum(f, self.name(), self.value())
22436 }
22437 }
22438
22439 impl std::convert::From<i32> for Mode {
22440 fn from(value: i32) -> Self {
22441 match value {
22442 0 => Self::Unspecified,
22443 1 => Self::SuggestionOnly,
22444 2 => Self::Auto,
22445 _ => Self::UnknownValue(mode::UnknownValue(
22446 wkt::internal::UnknownEnumValue::Integer(value),
22447 )),
22448 }
22449 }
22450 }
22451
22452 impl std::convert::From<&str> for Mode {
22453 fn from(value: &str) -> Self {
22454 use std::string::ToString;
22455 match value {
22456 "MODE_UNSPECIFIED" => Self::Unspecified,
22457 "SUGGESTION_ONLY" => Self::SuggestionOnly,
22458 "AUTO" => Self::Auto,
22459 _ => Self::UnknownValue(mode::UnknownValue(
22460 wkt::internal::UnknownEnumValue::String(value.to_string()),
22461 )),
22462 }
22463 }
22464 }
22465
22466 impl serde::ser::Serialize for Mode {
22467 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22468 where
22469 S: serde::Serializer,
22470 {
22471 match self {
22472 Self::Unspecified => serializer.serialize_i32(0),
22473 Self::SuggestionOnly => serializer.serialize_i32(1),
22474 Self::Auto => serializer.serialize_i32(2),
22475 Self::UnknownValue(u) => u.0.serialize(serializer),
22476 }
22477 }
22478 }
22479
22480 impl<'de> serde::de::Deserialize<'de> for Mode {
22481 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22482 where
22483 D: serde::Deserializer<'de>,
22484 {
22485 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22486 ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22487 ))
22488 }
22489 }
22490 }
22491
22492 /// This field specifies all conversational related parameters addition to
22493 /// traditional retail search.
22494 #[derive(Clone, Default, PartialEq)]
22495 #[non_exhaustive]
22496 pub struct ConversationalSearchSpec {
22497 /// This field specifies whether the customer would like to do conversational
22498 /// search. If this field is set to true, conversational related extra
22499 /// information will be returned from server side, including follow-up
22500 /// question, answer options, etc.
22501 pub followup_conversation_requested: bool,
22502
22503 /// This field specifies the conversation id, which maintains the state of
22504 /// the conversation between client side and server side. Use the value from
22505 /// the previous [ConversationalSearchResult.conversation_id][]. For the
22506 /// initial request, this should be empty.
22507 pub conversation_id: std::string::String,
22508
22509 /// This field specifies the current user answer during the conversational
22510 /// search. This can be either user selected from suggested answers or user
22511 /// input plain text.
22512 pub user_answer: std::option::Option<
22513 crate::model::search_request::conversational_search_spec::UserAnswer,
22514 >,
22515
22516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22517 }
22518
22519 impl ConversationalSearchSpec {
22520 pub fn new() -> Self {
22521 std::default::Default::default()
22522 }
22523
22524 /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22525 ///
22526 /// # Example
22527 /// ```ignore,no_run
22528 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22529 /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22530 /// ```
22531 pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22532 mut self,
22533 v: T,
22534 ) -> Self {
22535 self.followup_conversation_requested = v.into();
22536 self
22537 }
22538
22539 /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22540 ///
22541 /// # Example
22542 /// ```ignore,no_run
22543 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22544 /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22545 /// ```
22546 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22547 mut self,
22548 v: T,
22549 ) -> Self {
22550 self.conversation_id = v.into();
22551 self
22552 }
22553
22554 /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22555 ///
22556 /// # Example
22557 /// ```ignore,no_run
22558 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22559 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22560 /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22561 /// ```
22562 pub fn set_user_answer<T>(mut self, v: T) -> Self
22563 where
22564 T: std::convert::Into<
22565 crate::model::search_request::conversational_search_spec::UserAnswer,
22566 >,
22567 {
22568 self.user_answer = std::option::Option::Some(v.into());
22569 self
22570 }
22571
22572 /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22573 ///
22574 /// # Example
22575 /// ```ignore,no_run
22576 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22577 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22578 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22579 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22580 /// ```
22581 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22582 where
22583 T: std::convert::Into<
22584 crate::model::search_request::conversational_search_spec::UserAnswer,
22585 >,
22586 {
22587 self.user_answer = v.map(|x| x.into());
22588 self
22589 }
22590 }
22591
22592 impl wkt::message::Message for ConversationalSearchSpec {
22593 fn typename() -> &'static str {
22594 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22595 }
22596 }
22597
22598 /// Defines additional types related to [ConversationalSearchSpec].
22599 pub mod conversational_search_spec {
22600 #[allow(unused_imports)]
22601 use super::*;
22602
22603 /// This field specifies the current user answer during the conversational
22604 /// search. This can be either user selected from suggested answers or user
22605 /// input plain text.
22606 #[derive(Clone, Default, PartialEq)]
22607 #[non_exhaustive]
22608 pub struct UserAnswer {
22609 /// This field specifies the type of user answer.
22610 pub r#type: std::option::Option<
22611 crate::model::search_request::conversational_search_spec::user_answer::Type,
22612 >,
22613
22614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22615 }
22616
22617 impl UserAnswer {
22618 pub fn new() -> Self {
22619 std::default::Default::default()
22620 }
22621
22622 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22623 ///
22624 /// Note that all the setters affecting `r#type` are mutually
22625 /// exclusive.
22626 ///
22627 /// # Example
22628 /// ```ignore,no_run
22629 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22630 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22631 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22632 /// ```
22633 pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::search_request::conversational_search_spec::user_answer::Type>>>(mut self, v: T) -> Self
22634 {
22635 self.r#type = v.into();
22636 self
22637 }
22638
22639 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22640 /// if it holds a `TextAnswer`, `None` if the field is not set or
22641 /// holds a different branch.
22642 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22643 #[allow(unreachable_patterns)]
22644 self.r#type.as_ref().and_then(|v| match v {
22645 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22646 _ => std::option::Option::None,
22647 })
22648 }
22649
22650 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22651 /// to hold a `TextAnswer`.
22652 ///
22653 /// Note that all the setters affecting `r#type` are
22654 /// mutually exclusive.
22655 ///
22656 /// # Example
22657 /// ```ignore,no_run
22658 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22659 /// let x = UserAnswer::new().set_text_answer("example");
22660 /// assert!(x.text_answer().is_some());
22661 /// assert!(x.selected_answer().is_none());
22662 /// ```
22663 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22664 mut self,
22665 v: T,
22666 ) -> Self {
22667 self.r#type = std::option::Option::Some(
22668 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22669 v.into()
22670 )
22671 );
22672 self
22673 }
22674
22675 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22676 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22677 /// holds a different branch.
22678 pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22679 #[allow(unreachable_patterns)]
22680 self.r#type.as_ref().and_then(|v| match v {
22681 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22682 _ => std::option::Option::None,
22683 })
22684 }
22685
22686 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22687 /// to hold a `SelectedAnswer`.
22688 ///
22689 /// Note that all the setters affecting `r#type` are
22690 /// mutually exclusive.
22691 ///
22692 /// # Example
22693 /// ```ignore,no_run
22694 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22695 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22696 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
22697 /// assert!(x.selected_answer().is_some());
22698 /// assert!(x.text_answer().is_none());
22699 /// ```
22700 pub fn set_selected_answer<T: std::convert::Into<std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>>(mut self, v: T) -> Self{
22701 self.r#type = std::option::Option::Some(
22702 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
22703 v.into()
22704 )
22705 );
22706 self
22707 }
22708 }
22709
22710 impl wkt::message::Message for UserAnswer {
22711 fn typename() -> &'static str {
22712 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
22713 }
22714 }
22715
22716 /// Defines additional types related to [UserAnswer].
22717 pub mod user_answer {
22718 #[allow(unused_imports)]
22719 use super::*;
22720
22721 /// This field specifies the selected answers during the conversational
22722 /// search.
22723 #[derive(Clone, Default, PartialEq)]
22724 #[non_exhaustive]
22725 pub struct SelectedAnswer {
22726 /// This field is deprecated and should not be set.
22727 #[deprecated]
22728 pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
22729
22730 /// This field specifies the selected answer which is a attribute
22731 /// key-value.
22732 pub product_attribute_value:
22733 std::option::Option<crate::model::ProductAttributeValue>,
22734
22735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22736 }
22737
22738 impl SelectedAnswer {
22739 pub fn new() -> Self {
22740 std::default::Default::default()
22741 }
22742
22743 /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
22744 ///
22745 /// # Example
22746 /// ```ignore,no_run
22747 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22748 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22749 /// let x = SelectedAnswer::new()
22750 /// .set_product_attribute_values([
22751 /// ProductAttributeValue::default()/* use setters */,
22752 /// ProductAttributeValue::default()/* use (different) setters */,
22753 /// ]);
22754 /// ```
22755 #[deprecated]
22756 pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
22757 where
22758 T: std::iter::IntoIterator<Item = V>,
22759 V: std::convert::Into<crate::model::ProductAttributeValue>,
22760 {
22761 use std::iter::Iterator;
22762 self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
22763 self
22764 }
22765
22766 /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22767 ///
22768 /// # Example
22769 /// ```ignore,no_run
22770 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22771 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22772 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
22773 /// ```
22774 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
22775 where
22776 T: std::convert::Into<crate::model::ProductAttributeValue>,
22777 {
22778 self.product_attribute_value = std::option::Option::Some(v.into());
22779 self
22780 }
22781
22782 /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22783 ///
22784 /// # Example
22785 /// ```ignore,no_run
22786 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22787 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22788 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
22789 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
22790 /// ```
22791 pub fn set_or_clear_product_attribute_value<T>(
22792 mut self,
22793 v: std::option::Option<T>,
22794 ) -> Self
22795 where
22796 T: std::convert::Into<crate::model::ProductAttributeValue>,
22797 {
22798 self.product_attribute_value = v.map(|x| x.into());
22799 self
22800 }
22801 }
22802
22803 impl wkt::message::Message for SelectedAnswer {
22804 fn typename() -> &'static str {
22805 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
22806 }
22807 }
22808
22809 /// This field specifies the type of user answer.
22810 #[derive(Clone, Debug, PartialEq)]
22811 #[non_exhaustive]
22812 pub enum Type {
22813 /// This field specifies the incremental input text from the user during
22814 /// the conversational search.
22815 TextAnswer(std::string::String),
22816 /// This field specifies the selected attributes during the
22817 /// conversational search. This should be a subset of
22818 /// [ConversationalSearchResult.suggested_answers][].
22819 SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
22820 }
22821 }
22822 }
22823
22824 /// This field specifies tile navigation related parameters.
22825 #[derive(Clone, Default, PartialEq)]
22826 #[non_exhaustive]
22827 pub struct TileNavigationSpec {
22828 /// This field specifies whether the customer would like to request tile
22829 /// navigation.
22830 pub tile_navigation_requested: bool,
22831
22832 /// This optional field specifies the tiles which are already clicked in
22833 /// client side. While the feature works without this field set, particularly
22834 /// for an initial query, it is highly recommended to set this field because
22835 /// it can improve the quality of the search response and removes possible
22836 /// duplicate tiles.
22837 ///
22838 /// NOTE: This field is not being used for filtering search
22839 /// products. Client side should also put all the applied tiles in
22840 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
22841 ///
22842 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22843 pub applied_tiles: std::vec::Vec<crate::model::Tile>,
22844
22845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22846 }
22847
22848 impl TileNavigationSpec {
22849 pub fn new() -> Self {
22850 std::default::Default::default()
22851 }
22852
22853 /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
22854 ///
22855 /// # Example
22856 /// ```ignore,no_run
22857 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22858 /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
22859 /// ```
22860 pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22861 self.tile_navigation_requested = v.into();
22862 self
22863 }
22864
22865 /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
22866 ///
22867 /// # Example
22868 /// ```ignore,no_run
22869 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22870 /// use google_cloud_retail_v2::model::Tile;
22871 /// let x = TileNavigationSpec::new()
22872 /// .set_applied_tiles([
22873 /// Tile::default()/* use setters */,
22874 /// Tile::default()/* use (different) setters */,
22875 /// ]);
22876 /// ```
22877 pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
22878 where
22879 T: std::iter::IntoIterator<Item = V>,
22880 V: std::convert::Into<crate::model::Tile>,
22881 {
22882 use std::iter::Iterator;
22883 self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
22884 self
22885 }
22886 }
22887
22888 impl wkt::message::Message for TileNavigationSpec {
22889 fn typename() -> &'static str {
22890 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
22891 }
22892 }
22893
22894 /// The search mode of each search request.
22895 ///
22896 /// # Working with unknown values
22897 ///
22898 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22899 /// additional enum variants at any time. Adding new variants is not considered
22900 /// a breaking change. Applications should write their code in anticipation of:
22901 ///
22902 /// - New values appearing in future releases of the client library, **and**
22903 /// - New values received dynamically, without application changes.
22904 ///
22905 /// Please consult the [Working with enums] section in the user guide for some
22906 /// guidelines.
22907 ///
22908 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22909 #[derive(Clone, Debug, PartialEq)]
22910 #[non_exhaustive]
22911 pub enum SearchMode {
22912 /// Default value. In this case both product search and faceted search will
22913 /// be performed. Both
22914 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22915 /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
22916 /// will be returned.
22917 ///
22918 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22919 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22920 Unspecified,
22921 /// Only product search will be performed. The faceted search will be
22922 /// disabled.
22923 ///
22924 /// Only
22925 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22926 /// will be returned.
22927 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22928 /// not be returned, even if
22929 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22930 /// or
22931 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22932 /// is set.
22933 ///
22934 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22935 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22936 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22937 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22938 ProductSearchOnly,
22939 /// Only faceted search will be performed. The product search will be
22940 /// disabled.
22941 ///
22942 /// When in this mode, one or both of
22943 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22944 /// and
22945 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22946 /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
22947 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22948 /// be returned.
22949 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22950 /// will not be returned.
22951 ///
22952 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22953 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22954 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22955 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22956 FacetedSearchOnly,
22957 /// If set, the enum was initialized with an unknown value.
22958 ///
22959 /// Applications can examine the value using [SearchMode::value] or
22960 /// [SearchMode::name].
22961 UnknownValue(search_mode::UnknownValue),
22962 }
22963
22964 #[doc(hidden)]
22965 pub mod search_mode {
22966 #[allow(unused_imports)]
22967 use super::*;
22968 #[derive(Clone, Debug, PartialEq)]
22969 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22970 }
22971
22972 impl SearchMode {
22973 /// Gets the enum value.
22974 ///
22975 /// Returns `None` if the enum contains an unknown value deserialized from
22976 /// the string representation of enums.
22977 pub fn value(&self) -> std::option::Option<i32> {
22978 match self {
22979 Self::Unspecified => std::option::Option::Some(0),
22980 Self::ProductSearchOnly => std::option::Option::Some(1),
22981 Self::FacetedSearchOnly => std::option::Option::Some(2),
22982 Self::UnknownValue(u) => u.0.value(),
22983 }
22984 }
22985
22986 /// Gets the enum value as a string.
22987 ///
22988 /// Returns `None` if the enum contains an unknown value deserialized from
22989 /// the integer representation of enums.
22990 pub fn name(&self) -> std::option::Option<&str> {
22991 match self {
22992 Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
22993 Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
22994 Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
22995 Self::UnknownValue(u) => u.0.name(),
22996 }
22997 }
22998 }
22999
23000 impl std::default::Default for SearchMode {
23001 fn default() -> Self {
23002 use std::convert::From;
23003 Self::from(0)
23004 }
23005 }
23006
23007 impl std::fmt::Display for SearchMode {
23008 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23009 wkt::internal::display_enum(f, self.name(), self.value())
23010 }
23011 }
23012
23013 impl std::convert::From<i32> for SearchMode {
23014 fn from(value: i32) -> Self {
23015 match value {
23016 0 => Self::Unspecified,
23017 1 => Self::ProductSearchOnly,
23018 2 => Self::FacetedSearchOnly,
23019 _ => Self::UnknownValue(search_mode::UnknownValue(
23020 wkt::internal::UnknownEnumValue::Integer(value),
23021 )),
23022 }
23023 }
23024 }
23025
23026 impl std::convert::From<&str> for SearchMode {
23027 fn from(value: &str) -> Self {
23028 use std::string::ToString;
23029 match value {
23030 "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23031 "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23032 "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23033 _ => Self::UnknownValue(search_mode::UnknownValue(
23034 wkt::internal::UnknownEnumValue::String(value.to_string()),
23035 )),
23036 }
23037 }
23038 }
23039
23040 impl serde::ser::Serialize for SearchMode {
23041 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23042 where
23043 S: serde::Serializer,
23044 {
23045 match self {
23046 Self::Unspecified => serializer.serialize_i32(0),
23047 Self::ProductSearchOnly => serializer.serialize_i32(1),
23048 Self::FacetedSearchOnly => serializer.serialize_i32(2),
23049 Self::UnknownValue(u) => u.0.serialize(serializer),
23050 }
23051 }
23052 }
23053
23054 impl<'de> serde::de::Deserialize<'de> for SearchMode {
23055 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23056 where
23057 D: serde::Deserializer<'de>,
23058 {
23059 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23060 ".google.cloud.retail.v2.SearchRequest.SearchMode",
23061 ))
23062 }
23063 }
23064}
23065
23066/// Response message for
23067/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23068///
23069/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23070#[derive(Clone, Default, PartialEq)]
23071#[non_exhaustive]
23072pub struct SearchResponse {
23073 /// A list of matched items. The order represents the ranking.
23074 pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23075
23076 /// Results of facets requested by user.
23077 pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23078
23079 /// The estimated total count of matched items irrespective of pagination. The
23080 /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23081 /// by pagination may be less than the
23082 /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23083 /// matches.
23084 ///
23085 /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23086 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23087 pub total_size: i32,
23088
23089 /// Contains the spell corrected query, if found. If the spell correction type
23090 /// is AUTOMATIC, then the search results are based on corrected_query.
23091 /// Otherwise the original query is used for search.
23092 pub corrected_query: std::string::String,
23093
23094 /// A unique search token. This should be included in the
23095 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23096 /// search, which enables accurate attribution of search model performance.
23097 ///
23098 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23099 pub attribution_token: std::string::String,
23100
23101 /// A token that can be sent as
23102 /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23103 /// to retrieve the next page. If this field is omitted, there are no
23104 /// subsequent pages.
23105 ///
23106 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23107 pub next_page_token: std::string::String,
23108
23109 /// Query expansion information for the returned results.
23110 pub query_expansion_info:
23111 std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23112
23113 /// The URI of a customer-defined redirect page. If redirect action is
23114 /// triggered, no search is performed, and only
23115 /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23116 /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23117 /// are set in the response.
23118 ///
23119 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23120 /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23121 pub redirect_uri: std::string::String,
23122
23123 /// The fully qualified resource name of applied
23124 /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23125 pub applied_controls: std::vec::Vec<std::string::String>,
23126
23127 /// Metadata for pin controls which were applicable to the request.
23128 /// This contains two map fields, one for all matched pins and one for pins
23129 /// which were matched but not applied.
23130 ///
23131 /// The two maps are keyed by pin position, and the values are the product ids
23132 /// which were matched to that pin.
23133 pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23134
23135 /// The invalid
23136 /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23137 /// that are not applied during serving.
23138 ///
23139 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23140 pub invalid_condition_boost_specs:
23141 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23142
23143 /// Metadata related to A/B testing experiment associated with this
23144 /// response. Only exists when an experiment is triggered.
23145 pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23146
23147 /// This field specifies all related information that is needed on client
23148 /// side for UI rendering of conversational retail search.
23149 pub conversational_search_result:
23150 std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23151
23152 /// This field specifies all related information for tile navigation that will
23153 /// be used in client side.
23154 pub tile_navigation_result:
23155 std::option::Option<crate::model::search_response::TileNavigationResult>,
23156
23157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23158}
23159
23160impl SearchResponse {
23161 pub fn new() -> Self {
23162 std::default::Default::default()
23163 }
23164
23165 /// Sets the value of [results][crate::model::SearchResponse::results].
23166 ///
23167 /// # Example
23168 /// ```ignore,no_run
23169 /// # use google_cloud_retail_v2::model::SearchResponse;
23170 /// use google_cloud_retail_v2::model::search_response::SearchResult;
23171 /// let x = SearchResponse::new()
23172 /// .set_results([
23173 /// SearchResult::default()/* use setters */,
23174 /// SearchResult::default()/* use (different) setters */,
23175 /// ]);
23176 /// ```
23177 pub fn set_results<T, V>(mut self, v: T) -> Self
23178 where
23179 T: std::iter::IntoIterator<Item = V>,
23180 V: std::convert::Into<crate::model::search_response::SearchResult>,
23181 {
23182 use std::iter::Iterator;
23183 self.results = v.into_iter().map(|i| i.into()).collect();
23184 self
23185 }
23186
23187 /// Sets the value of [facets][crate::model::SearchResponse::facets].
23188 ///
23189 /// # Example
23190 /// ```ignore,no_run
23191 /// # use google_cloud_retail_v2::model::SearchResponse;
23192 /// use google_cloud_retail_v2::model::search_response::Facet;
23193 /// let x = SearchResponse::new()
23194 /// .set_facets([
23195 /// Facet::default()/* use setters */,
23196 /// Facet::default()/* use (different) setters */,
23197 /// ]);
23198 /// ```
23199 pub fn set_facets<T, V>(mut self, v: T) -> Self
23200 where
23201 T: std::iter::IntoIterator<Item = V>,
23202 V: std::convert::Into<crate::model::search_response::Facet>,
23203 {
23204 use std::iter::Iterator;
23205 self.facets = v.into_iter().map(|i| i.into()).collect();
23206 self
23207 }
23208
23209 /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23210 ///
23211 /// # Example
23212 /// ```ignore,no_run
23213 /// # use google_cloud_retail_v2::model::SearchResponse;
23214 /// let x = SearchResponse::new().set_total_size(42);
23215 /// ```
23216 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23217 self.total_size = v.into();
23218 self
23219 }
23220
23221 /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23222 ///
23223 /// # Example
23224 /// ```ignore,no_run
23225 /// # use google_cloud_retail_v2::model::SearchResponse;
23226 /// let x = SearchResponse::new().set_corrected_query("example");
23227 /// ```
23228 pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23229 self.corrected_query = v.into();
23230 self
23231 }
23232
23233 /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23234 ///
23235 /// # Example
23236 /// ```ignore,no_run
23237 /// # use google_cloud_retail_v2::model::SearchResponse;
23238 /// let x = SearchResponse::new().set_attribution_token("example");
23239 /// ```
23240 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23241 mut self,
23242 v: T,
23243 ) -> Self {
23244 self.attribution_token = v.into();
23245 self
23246 }
23247
23248 /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23249 ///
23250 /// # Example
23251 /// ```ignore,no_run
23252 /// # use google_cloud_retail_v2::model::SearchResponse;
23253 /// let x = SearchResponse::new().set_next_page_token("example");
23254 /// ```
23255 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23256 self.next_page_token = v.into();
23257 self
23258 }
23259
23260 /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23261 ///
23262 /// # Example
23263 /// ```ignore,no_run
23264 /// # use google_cloud_retail_v2::model::SearchResponse;
23265 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23266 /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23267 /// ```
23268 pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23269 where
23270 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23271 {
23272 self.query_expansion_info = std::option::Option::Some(v.into());
23273 self
23274 }
23275
23276 /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23277 ///
23278 /// # Example
23279 /// ```ignore,no_run
23280 /// # use google_cloud_retail_v2::model::SearchResponse;
23281 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23282 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23283 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23284 /// ```
23285 pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23286 where
23287 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23288 {
23289 self.query_expansion_info = v.map(|x| x.into());
23290 self
23291 }
23292
23293 /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23294 ///
23295 /// # Example
23296 /// ```ignore,no_run
23297 /// # use google_cloud_retail_v2::model::SearchResponse;
23298 /// let x = SearchResponse::new().set_redirect_uri("example");
23299 /// ```
23300 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23301 self.redirect_uri = v.into();
23302 self
23303 }
23304
23305 /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23306 ///
23307 /// # Example
23308 /// ```ignore,no_run
23309 /// # use google_cloud_retail_v2::model::SearchResponse;
23310 /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23311 /// ```
23312 pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23313 where
23314 T: std::iter::IntoIterator<Item = V>,
23315 V: std::convert::Into<std::string::String>,
23316 {
23317 use std::iter::Iterator;
23318 self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23319 self
23320 }
23321
23322 /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23323 ///
23324 /// # Example
23325 /// ```ignore,no_run
23326 /// # use google_cloud_retail_v2::model::SearchResponse;
23327 /// use google_cloud_retail_v2::model::PinControlMetadata;
23328 /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23329 /// ```
23330 pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23331 where
23332 T: std::convert::Into<crate::model::PinControlMetadata>,
23333 {
23334 self.pin_control_metadata = std::option::Option::Some(v.into());
23335 self
23336 }
23337
23338 /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23339 ///
23340 /// # Example
23341 /// ```ignore,no_run
23342 /// # use google_cloud_retail_v2::model::SearchResponse;
23343 /// use google_cloud_retail_v2::model::PinControlMetadata;
23344 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23345 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23346 /// ```
23347 pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23348 where
23349 T: std::convert::Into<crate::model::PinControlMetadata>,
23350 {
23351 self.pin_control_metadata = v.map(|x| x.into());
23352 self
23353 }
23354
23355 /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23356 ///
23357 /// # Example
23358 /// ```ignore,no_run
23359 /// # use google_cloud_retail_v2::model::SearchResponse;
23360 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23361 /// let x = SearchResponse::new()
23362 /// .set_invalid_condition_boost_specs([
23363 /// ConditionBoostSpec::default()/* use setters */,
23364 /// ConditionBoostSpec::default()/* use (different) setters */,
23365 /// ]);
23366 /// ```
23367 pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23368 where
23369 T: std::iter::IntoIterator<Item = V>,
23370 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23371 {
23372 use std::iter::Iterator;
23373 self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23374 self
23375 }
23376
23377 /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23378 ///
23379 /// # Example
23380 /// ```ignore,no_run
23381 /// # use google_cloud_retail_v2::model::SearchResponse;
23382 /// use google_cloud_retail_v2::model::ExperimentInfo;
23383 /// let x = SearchResponse::new()
23384 /// .set_experiment_info([
23385 /// ExperimentInfo::default()/* use setters */,
23386 /// ExperimentInfo::default()/* use (different) setters */,
23387 /// ]);
23388 /// ```
23389 pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23390 where
23391 T: std::iter::IntoIterator<Item = V>,
23392 V: std::convert::Into<crate::model::ExperimentInfo>,
23393 {
23394 use std::iter::Iterator;
23395 self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23396 self
23397 }
23398
23399 /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23400 ///
23401 /// # Example
23402 /// ```ignore,no_run
23403 /// # use google_cloud_retail_v2::model::SearchResponse;
23404 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23405 /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23406 /// ```
23407 pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23408 where
23409 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23410 {
23411 self.conversational_search_result = std::option::Option::Some(v.into());
23412 self
23413 }
23414
23415 /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23416 ///
23417 /// # Example
23418 /// ```ignore,no_run
23419 /// # use google_cloud_retail_v2::model::SearchResponse;
23420 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23421 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23422 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23423 /// ```
23424 pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23425 where
23426 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23427 {
23428 self.conversational_search_result = v.map(|x| x.into());
23429 self
23430 }
23431
23432 /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23433 ///
23434 /// # Example
23435 /// ```ignore,no_run
23436 /// # use google_cloud_retail_v2::model::SearchResponse;
23437 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23438 /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23439 /// ```
23440 pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23441 where
23442 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23443 {
23444 self.tile_navigation_result = std::option::Option::Some(v.into());
23445 self
23446 }
23447
23448 /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23449 ///
23450 /// # Example
23451 /// ```ignore,no_run
23452 /// # use google_cloud_retail_v2::model::SearchResponse;
23453 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23454 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23455 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23456 /// ```
23457 pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23458 where
23459 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23460 {
23461 self.tile_navigation_result = v.map(|x| x.into());
23462 self
23463 }
23464}
23465
23466impl wkt::message::Message for SearchResponse {
23467 fn typename() -> &'static str {
23468 "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23469 }
23470}
23471
23472#[doc(hidden)]
23473impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
23474 type PageItem = crate::model::search_response::SearchResult;
23475
23476 fn items(self) -> std::vec::Vec<Self::PageItem> {
23477 self.results
23478 }
23479
23480 fn next_page_token(&self) -> std::string::String {
23481 use std::clone::Clone;
23482 self.next_page_token.clone()
23483 }
23484}
23485
23486/// Defines additional types related to [SearchResponse].
23487pub mod search_response {
23488 #[allow(unused_imports)]
23489 use super::*;
23490
23491 /// Represents the search results.
23492 #[derive(Clone, Default, PartialEq)]
23493 #[non_exhaustive]
23494 pub struct SearchResult {
23495 /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23496 /// [Product][google.cloud.retail.v2.Product].
23497 ///
23498 /// [google.cloud.retail.v2.Product]: crate::model::Product
23499 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23500 pub id: std::string::String,
23501
23502 /// The product data snippet in the search response. Only
23503 /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23504 /// populated.
23505 ///
23506 /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23507 /// product variants that match the search query. If there are multiple
23508 /// product variants matching the query, top 5 most relevant product variants
23509 /// are returned and ordered by relevancy.
23510 ///
23511 /// If relevancy can be deternmined, use
23512 /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23513 /// to look up matched product variants fields. If relevancy cannot be
23514 /// determined, e.g. when searching "shoe" all products in a shoe product can
23515 /// be a match, 5 product variants are returned but order is meaningless.
23516 ///
23517 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23518 /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23519 /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23520 pub product: std::option::Option<crate::model::Product>,
23521
23522 /// The count of matched
23523 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23524 /// [Product][google.cloud.retail.v2.Product]s.
23525 ///
23526 /// [google.cloud.retail.v2.Product]: crate::model::Product
23527 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23528 pub matching_variant_count: i32,
23529
23530 /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23531 /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23532 /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23533 /// matched. The key is the
23534 /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23535 /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23536 /// matched attributes cannot be determined, this map will be empty.
23537 ///
23538 /// For example, a key "sku1" with field mask
23539 /// "products.color_info" indicates there is a match between
23540 /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23541 ///
23542 /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23543 /// [google.cloud.retail.v2.Product]: crate::model::Product
23544 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23545 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23546 pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23547
23548 /// The rollup matching
23549 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23550 /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23551 /// the
23552 /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23553 /// The values are the merged and de-duplicated
23554 /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23555 /// rollup values are respect filter. For example, when filtering by
23556 /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23557 /// returned.
23558 ///
23559 /// For textual and numerical attributes, the rollup values is a list of
23560 /// string or double values with type
23561 /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23562 /// there are two variants with colors "red" and "blue", the rollup values
23563 /// are
23564 ///
23565 /// ```norust
23566 /// { key: "colorFamilies"
23567 /// value {
23568 /// list_value {
23569 /// values { string_value: "red" }
23570 /// values { string_value: "blue" }
23571 /// }
23572 /// }
23573 /// }
23574 /// ```
23575 ///
23576 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23577 /// values is a double value with type
23578 /// [google.protobuf.Value][google.protobuf.Value]. For example,
23579 /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23580 /// are 10 variants in this product are available in the store "store1".
23581 ///
23582 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23583 /// [google.cloud.retail.v2.Product]: crate::model::Product
23584 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23585 /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23586 /// [google.protobuf.ListValue]: wkt::ListValue
23587 /// [google.protobuf.Value]: wkt::Value
23588 pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23589
23590 /// Specifies previous events related to this product for this user based on
23591 /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23592 /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23593 /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23594 ///
23595 /// This is set only when
23596 /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23597 /// is
23598 /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23599 ///
23600 /// Possible values:
23601 ///
23602 /// * `purchased`: Indicates that this product has been purchased before.
23603 ///
23604 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23605 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23606 /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23607 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23608 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23609 pub personal_labels: std::vec::Vec<std::string::String>,
23610
23611 /// Google provided available scores.
23612 pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23613
23614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23615 }
23616
23617 impl SearchResult {
23618 pub fn new() -> Self {
23619 std::default::Default::default()
23620 }
23621
23622 /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23623 ///
23624 /// # Example
23625 /// ```ignore,no_run
23626 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23627 /// let x = SearchResult::new().set_id("example");
23628 /// ```
23629 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23630 self.id = v.into();
23631 self
23632 }
23633
23634 /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23635 ///
23636 /// # Example
23637 /// ```ignore,no_run
23638 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23639 /// use google_cloud_retail_v2::model::Product;
23640 /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23641 /// ```
23642 pub fn set_product<T>(mut self, v: T) -> Self
23643 where
23644 T: std::convert::Into<crate::model::Product>,
23645 {
23646 self.product = std::option::Option::Some(v.into());
23647 self
23648 }
23649
23650 /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23651 ///
23652 /// # Example
23653 /// ```ignore,no_run
23654 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23655 /// use google_cloud_retail_v2::model::Product;
23656 /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23657 /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23658 /// ```
23659 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23660 where
23661 T: std::convert::Into<crate::model::Product>,
23662 {
23663 self.product = v.map(|x| x.into());
23664 self
23665 }
23666
23667 /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23668 ///
23669 /// # Example
23670 /// ```ignore,no_run
23671 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23672 /// let x = SearchResult::new().set_matching_variant_count(42);
23673 /// ```
23674 pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23675 self.matching_variant_count = v.into();
23676 self
23677 }
23678
23679 /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23680 ///
23681 /// # Example
23682 /// ```ignore,no_run
23683 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23684 /// use wkt::FieldMask;
23685 /// let x = SearchResult::new().set_matching_variant_fields([
23686 /// ("key0", FieldMask::default()/* use setters */),
23687 /// ("key1", FieldMask::default()/* use (different) setters */),
23688 /// ]);
23689 /// ```
23690 pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
23691 where
23692 T: std::iter::IntoIterator<Item = (K, V)>,
23693 K: std::convert::Into<std::string::String>,
23694 V: std::convert::Into<wkt::FieldMask>,
23695 {
23696 use std::iter::Iterator;
23697 self.matching_variant_fields =
23698 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23699 self
23700 }
23701
23702 /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
23703 ///
23704 /// # Example
23705 /// ```ignore,no_run
23706 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23707 /// use wkt::Value;
23708 /// let x = SearchResult::new().set_variant_rollup_values([
23709 /// ("key0", Value::default()/* use setters */),
23710 /// ("key1", Value::default()/* use (different) setters */),
23711 /// ]);
23712 /// ```
23713 pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
23714 where
23715 T: std::iter::IntoIterator<Item = (K, V)>,
23716 K: std::convert::Into<std::string::String>,
23717 V: std::convert::Into<wkt::Value>,
23718 {
23719 use std::iter::Iterator;
23720 self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23721 self
23722 }
23723
23724 /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
23725 ///
23726 /// # Example
23727 /// ```ignore,no_run
23728 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23729 /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
23730 /// ```
23731 pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
23732 where
23733 T: std::iter::IntoIterator<Item = V>,
23734 V: std::convert::Into<std::string::String>,
23735 {
23736 use std::iter::Iterator;
23737 self.personal_labels = v.into_iter().map(|i| i.into()).collect();
23738 self
23739 }
23740
23741 /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
23742 ///
23743 /// # Example
23744 /// ```ignore,no_run
23745 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23746 /// use google_cloud_retail_v2::model::DoubleList;
23747 /// let x = SearchResult::new().set_model_scores([
23748 /// ("key0", DoubleList::default()/* use setters */),
23749 /// ("key1", DoubleList::default()/* use (different) setters */),
23750 /// ]);
23751 /// ```
23752 pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
23753 where
23754 T: std::iter::IntoIterator<Item = (K, V)>,
23755 K: std::convert::Into<std::string::String>,
23756 V: std::convert::Into<crate::model::DoubleList>,
23757 {
23758 use std::iter::Iterator;
23759 self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23760 self
23761 }
23762 }
23763
23764 impl wkt::message::Message for SearchResult {
23765 fn typename() -> &'static str {
23766 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
23767 }
23768 }
23769
23770 /// A facet result.
23771 #[derive(Clone, Default, PartialEq)]
23772 #[non_exhaustive]
23773 pub struct Facet {
23774 /// The key for this facet. E.g., "colorFamilies" or "price" or
23775 /// "attributes.attr1".
23776 pub key: std::string::String,
23777
23778 /// The facet values for this field.
23779 pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
23780
23781 /// Whether the facet is dynamically generated.
23782 pub dynamic_facet: bool,
23783
23784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23785 }
23786
23787 impl Facet {
23788 pub fn new() -> Self {
23789 std::default::Default::default()
23790 }
23791
23792 /// Sets the value of [key][crate::model::search_response::Facet::key].
23793 ///
23794 /// # Example
23795 /// ```ignore,no_run
23796 /// # use google_cloud_retail_v2::model::search_response::Facet;
23797 /// let x = Facet::new().set_key("example");
23798 /// ```
23799 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23800 self.key = v.into();
23801 self
23802 }
23803
23804 /// Sets the value of [values][crate::model::search_response::Facet::values].
23805 ///
23806 /// # Example
23807 /// ```ignore,no_run
23808 /// # use google_cloud_retail_v2::model::search_response::Facet;
23809 /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23810 /// let x = Facet::new()
23811 /// .set_values([
23812 /// FacetValue::default()/* use setters */,
23813 /// FacetValue::default()/* use (different) setters */,
23814 /// ]);
23815 /// ```
23816 pub fn set_values<T, V>(mut self, v: T) -> Self
23817 where
23818 T: std::iter::IntoIterator<Item = V>,
23819 V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
23820 {
23821 use std::iter::Iterator;
23822 self.values = v.into_iter().map(|i| i.into()).collect();
23823 self
23824 }
23825
23826 /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
23827 ///
23828 /// # Example
23829 /// ```ignore,no_run
23830 /// # use google_cloud_retail_v2::model::search_response::Facet;
23831 /// let x = Facet::new().set_dynamic_facet(true);
23832 /// ```
23833 pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23834 self.dynamic_facet = v.into();
23835 self
23836 }
23837 }
23838
23839 impl wkt::message::Message for Facet {
23840 fn typename() -> &'static str {
23841 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
23842 }
23843 }
23844
23845 /// Defines additional types related to [Facet].
23846 pub mod facet {
23847 #[allow(unused_imports)]
23848 use super::*;
23849
23850 /// A facet value which contains value names and their count.
23851 #[derive(Clone, Default, PartialEq)]
23852 #[non_exhaustive]
23853 pub struct FacetValue {
23854 /// Number of items that have this facet value.
23855 pub count: i64,
23856
23857 /// The minimum value in the
23858 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23859 /// Only supported on numerical facets and returned if
23860 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23861 /// is true.
23862 ///
23863 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23864 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23865 pub min_value: f64,
23866
23867 /// The maximum value in the
23868 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23869 /// Only supported on numerical facets and returned if
23870 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23871 /// is true.
23872 ///
23873 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23874 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23875 pub max_value: f64,
23876
23877 /// A facet value which contains values.
23878 pub facet_value:
23879 std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
23880
23881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23882 }
23883
23884 impl FacetValue {
23885 pub fn new() -> Self {
23886 std::default::Default::default()
23887 }
23888
23889 /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
23890 ///
23891 /// # Example
23892 /// ```ignore,no_run
23893 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23894 /// let x = FacetValue::new().set_count(42);
23895 /// ```
23896 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23897 self.count = v.into();
23898 self
23899 }
23900
23901 /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
23902 ///
23903 /// # Example
23904 /// ```ignore,no_run
23905 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23906 /// let x = FacetValue::new().set_min_value(42.0);
23907 /// ```
23908 pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23909 self.min_value = v.into();
23910 self
23911 }
23912
23913 /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
23914 ///
23915 /// # Example
23916 /// ```ignore,no_run
23917 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23918 /// let x = FacetValue::new().set_max_value(42.0);
23919 /// ```
23920 pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23921 self.max_value = v.into();
23922 self
23923 }
23924
23925 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
23926 ///
23927 /// Note that all the setters affecting `facet_value` are mutually
23928 /// exclusive.
23929 ///
23930 /// # Example
23931 /// ```ignore,no_run
23932 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23933 /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
23934 /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
23935 /// ```
23936 pub fn set_facet_value<
23937 T: std::convert::Into<
23938 std::option::Option<
23939 crate::model::search_response::facet::facet_value::FacetValue,
23940 >,
23941 >,
23942 >(
23943 mut self,
23944 v: T,
23945 ) -> Self {
23946 self.facet_value = v.into();
23947 self
23948 }
23949
23950 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23951 /// if it holds a `Value`, `None` if the field is not set or
23952 /// holds a different branch.
23953 pub fn value(&self) -> std::option::Option<&std::string::String> {
23954 #[allow(unreachable_patterns)]
23955 self.facet_value.as_ref().and_then(|v| match v {
23956 crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
23957 std::option::Option::Some(v)
23958 }
23959 _ => std::option::Option::None,
23960 })
23961 }
23962
23963 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23964 /// to hold a `Value`.
23965 ///
23966 /// Note that all the setters affecting `facet_value` are
23967 /// mutually exclusive.
23968 ///
23969 /// # Example
23970 /// ```ignore,no_run
23971 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23972 /// let x = FacetValue::new().set_value("example");
23973 /// assert!(x.value().is_some());
23974 /// assert!(x.interval().is_none());
23975 /// ```
23976 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23977 self.facet_value = std::option::Option::Some(
23978 crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
23979 );
23980 self
23981 }
23982
23983 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23984 /// if it holds a `Interval`, `None` if the field is not set or
23985 /// holds a different branch.
23986 pub fn interval(
23987 &self,
23988 ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
23989 #[allow(unreachable_patterns)]
23990 self.facet_value.as_ref().and_then(|v| match v {
23991 crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
23992 std::option::Option::Some(v)
23993 }
23994 _ => std::option::Option::None,
23995 })
23996 }
23997
23998 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23999 /// to hold a `Interval`.
24000 ///
24001 /// Note that all the setters affecting `facet_value` are
24002 /// mutually exclusive.
24003 ///
24004 /// # Example
24005 /// ```ignore,no_run
24006 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24007 /// use google_cloud_retail_v2::model::Interval;
24008 /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24009 /// assert!(x.interval().is_some());
24010 /// assert!(x.value().is_none());
24011 /// ```
24012 pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24013 mut self,
24014 v: T,
24015 ) -> Self {
24016 self.facet_value = std::option::Option::Some(
24017 crate::model::search_response::facet::facet_value::FacetValue::Interval(
24018 v.into(),
24019 ),
24020 );
24021 self
24022 }
24023 }
24024
24025 impl wkt::message::Message for FacetValue {
24026 fn typename() -> &'static str {
24027 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24028 }
24029 }
24030
24031 /// Defines additional types related to [FacetValue].
24032 pub mod facet_value {
24033 #[allow(unused_imports)]
24034 use super::*;
24035
24036 /// A facet value which contains values.
24037 #[derive(Clone, Debug, PartialEq)]
24038 #[non_exhaustive]
24039 pub enum FacetValue {
24040 /// Text value of a facet, such as "Black" for facet "colorFamilies".
24041 Value(std::string::String),
24042 /// Interval value for a facet, such as [10, 20) for facet "price".
24043 Interval(std::boxed::Box<crate::model::Interval>),
24044 }
24045 }
24046 }
24047
24048 /// Information describing query expansion including whether expansion has
24049 /// occurred.
24050 #[derive(Clone, Default, PartialEq)]
24051 #[non_exhaustive]
24052 pub struct QueryExpansionInfo {
24053 /// Bool describing whether query expansion has occurred.
24054 pub expanded_query: bool,
24055
24056 /// Number of pinned results. This field will only be set when expansion
24057 /// happens and
24058 /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24059 /// is set to true.
24060 ///
24061 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24062 pub pinned_result_count: i64,
24063
24064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24065 }
24066
24067 impl QueryExpansionInfo {
24068 pub fn new() -> Self {
24069 std::default::Default::default()
24070 }
24071
24072 /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24073 ///
24074 /// # Example
24075 /// ```ignore,no_run
24076 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24077 /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24078 /// ```
24079 pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24080 self.expanded_query = v.into();
24081 self
24082 }
24083
24084 /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24085 ///
24086 /// # Example
24087 /// ```ignore,no_run
24088 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24089 /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24090 /// ```
24091 pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24092 self.pinned_result_count = v.into();
24093 self
24094 }
24095 }
24096
24097 impl wkt::message::Message for QueryExpansionInfo {
24098 fn typename() -> &'static str {
24099 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24100 }
24101 }
24102
24103 /// This field specifies all related information that is needed on client
24104 /// side for UI rendering of conversational retail search.
24105 #[derive(Clone, Default, PartialEq)]
24106 #[non_exhaustive]
24107 pub struct ConversationalSearchResult {
24108 /// Conversation UUID. This field will be stored in client side storage to
24109 /// maintain the conversation session with server and will be used for next
24110 /// search request's
24111 /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24112 /// to restore conversation state in server.
24113 ///
24114 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24115 pub conversation_id: std::string::String,
24116
24117 /// The current refined query for the conversational search. This field
24118 /// will be used in customer UI that the query in the search bar should be
24119 /// replaced with the refined query. For example, if
24120 /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24121 /// `dress` and next
24122 /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24123 /// is `red color`, which does not match any product attribute value filters,
24124 /// the refined query will be `dress, red color`.
24125 ///
24126 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24127 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24128 pub refined_query: std::string::String,
24129
24130 /// This field is deprecated but will be kept for backward compatibility.
24131 /// There is expected to have only one additional filter and the value will
24132 /// be the same to the same as field `additional_filter`.
24133 #[deprecated]
24134 pub additional_filters: std::vec::Vec<
24135 crate::model::search_response::conversational_search_result::AdditionalFilter,
24136 >,
24137
24138 /// The follow-up question. e.g., `What is the color?`
24139 pub followup_question: std::string::String,
24140
24141 /// The answer options provided to client for the follow-up question.
24142 pub suggested_answers: std::vec::Vec<
24143 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24144 >,
24145
24146 /// This is the incremental additional filters implied from the current
24147 /// user answer. User should add the suggested addition filters to the
24148 /// previous
24149 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
24150 /// use the merged filter in the follow up search request.
24151 ///
24152 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24153 pub additional_filter: std::option::Option<
24154 crate::model::search_response::conversational_search_result::AdditionalFilter,
24155 >,
24156
24157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24158 }
24159
24160 impl ConversationalSearchResult {
24161 pub fn new() -> Self {
24162 std::default::Default::default()
24163 }
24164
24165 /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24166 ///
24167 /// # Example
24168 /// ```ignore,no_run
24169 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24170 /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24171 /// ```
24172 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24173 mut self,
24174 v: T,
24175 ) -> Self {
24176 self.conversation_id = v.into();
24177 self
24178 }
24179
24180 /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24181 ///
24182 /// # Example
24183 /// ```ignore,no_run
24184 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24185 /// let x = ConversationalSearchResult::new().set_refined_query("example");
24186 /// ```
24187 pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24188 mut self,
24189 v: T,
24190 ) -> Self {
24191 self.refined_query = v.into();
24192 self
24193 }
24194
24195 /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24196 ///
24197 /// # Example
24198 /// ```ignore,no_run
24199 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24200 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24201 /// let x = ConversationalSearchResult::new()
24202 /// .set_additional_filters([
24203 /// AdditionalFilter::default()/* use setters */,
24204 /// AdditionalFilter::default()/* use (different) setters */,
24205 /// ]);
24206 /// ```
24207 #[deprecated]
24208 pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24209 where
24210 T: std::iter::IntoIterator<Item = V>,
24211 V: std::convert::Into<
24212 crate::model::search_response::conversational_search_result::AdditionalFilter,
24213 >,
24214 {
24215 use std::iter::Iterator;
24216 self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24217 self
24218 }
24219
24220 /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24221 ///
24222 /// # Example
24223 /// ```ignore,no_run
24224 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24225 /// let x = ConversationalSearchResult::new().set_followup_question("example");
24226 /// ```
24227 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24228 mut self,
24229 v: T,
24230 ) -> Self {
24231 self.followup_question = v.into();
24232 self
24233 }
24234
24235 /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24236 ///
24237 /// # Example
24238 /// ```ignore,no_run
24239 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24240 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24241 /// let x = ConversationalSearchResult::new()
24242 /// .set_suggested_answers([
24243 /// SuggestedAnswer::default()/* use setters */,
24244 /// SuggestedAnswer::default()/* use (different) setters */,
24245 /// ]);
24246 /// ```
24247 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24248 where
24249 T: std::iter::IntoIterator<Item = V>,
24250 V: std::convert::Into<
24251 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24252 >,
24253 {
24254 use std::iter::Iterator;
24255 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24256 self
24257 }
24258
24259 /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24260 ///
24261 /// # Example
24262 /// ```ignore,no_run
24263 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24264 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24265 /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24266 /// ```
24267 pub fn set_additional_filter<T>(mut self, v: T) -> Self
24268 where
24269 T: std::convert::Into<
24270 crate::model::search_response::conversational_search_result::AdditionalFilter,
24271 >,
24272 {
24273 self.additional_filter = std::option::Option::Some(v.into());
24274 self
24275 }
24276
24277 /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24278 ///
24279 /// # Example
24280 /// ```ignore,no_run
24281 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24282 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24283 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24284 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24285 /// ```
24286 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24287 where
24288 T: std::convert::Into<
24289 crate::model::search_response::conversational_search_result::AdditionalFilter,
24290 >,
24291 {
24292 self.additional_filter = v.map(|x| x.into());
24293 self
24294 }
24295 }
24296
24297 impl wkt::message::Message for ConversationalSearchResult {
24298 fn typename() -> &'static str {
24299 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24300 }
24301 }
24302
24303 /// Defines additional types related to [ConversationalSearchResult].
24304 pub mod conversational_search_result {
24305 #[allow(unused_imports)]
24306 use super::*;
24307
24308 /// Suggested answers to the follow-up question.
24309 #[derive(Clone, Default, PartialEq)]
24310 #[non_exhaustive]
24311 pub struct SuggestedAnswer {
24312 /// Product attribute value, including an attribute key and an
24313 /// attribute value. Other types can be added here in the future.
24314 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24315
24316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24317 }
24318
24319 impl SuggestedAnswer {
24320 pub fn new() -> Self {
24321 std::default::Default::default()
24322 }
24323
24324 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24325 ///
24326 /// # Example
24327 /// ```ignore,no_run
24328 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24329 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24330 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24331 /// ```
24332 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24333 where
24334 T: std::convert::Into<crate::model::ProductAttributeValue>,
24335 {
24336 self.product_attribute_value = std::option::Option::Some(v.into());
24337 self
24338 }
24339
24340 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24341 ///
24342 /// # Example
24343 /// ```ignore,no_run
24344 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24345 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24346 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24347 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24348 /// ```
24349 pub fn set_or_clear_product_attribute_value<T>(
24350 mut self,
24351 v: std::option::Option<T>,
24352 ) -> Self
24353 where
24354 T: std::convert::Into<crate::model::ProductAttributeValue>,
24355 {
24356 self.product_attribute_value = v.map(|x| x.into());
24357 self
24358 }
24359 }
24360
24361 impl wkt::message::Message for SuggestedAnswer {
24362 fn typename() -> &'static str {
24363 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24364 }
24365 }
24366
24367 /// Additional filter that client side need to apply.
24368 #[derive(Clone, Default, PartialEq)]
24369 #[non_exhaustive]
24370 pub struct AdditionalFilter {
24371 /// Product attribute value, including an attribute key and an
24372 /// attribute value. Other types can be added here in the future.
24373 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24374
24375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24376 }
24377
24378 impl AdditionalFilter {
24379 pub fn new() -> Self {
24380 std::default::Default::default()
24381 }
24382
24383 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24384 ///
24385 /// # Example
24386 /// ```ignore,no_run
24387 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24388 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24389 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24390 /// ```
24391 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24392 where
24393 T: std::convert::Into<crate::model::ProductAttributeValue>,
24394 {
24395 self.product_attribute_value = std::option::Option::Some(v.into());
24396 self
24397 }
24398
24399 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24400 ///
24401 /// # Example
24402 /// ```ignore,no_run
24403 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24404 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24405 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24406 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24407 /// ```
24408 pub fn set_or_clear_product_attribute_value<T>(
24409 mut self,
24410 v: std::option::Option<T>,
24411 ) -> Self
24412 where
24413 T: std::convert::Into<crate::model::ProductAttributeValue>,
24414 {
24415 self.product_attribute_value = v.map(|x| x.into());
24416 self
24417 }
24418 }
24419
24420 impl wkt::message::Message for AdditionalFilter {
24421 fn typename() -> &'static str {
24422 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24423 }
24424 }
24425 }
24426
24427 /// This field specifies all related information for tile navigation that will
24428 /// be used in client side.
24429 #[derive(Clone, Default, PartialEq)]
24430 #[non_exhaustive]
24431 pub struct TileNavigationResult {
24432 /// The current tiles that are used for tile navigation, sorted by
24433 /// engagement.
24434 pub tiles: std::vec::Vec<crate::model::Tile>,
24435
24436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24437 }
24438
24439 impl TileNavigationResult {
24440 pub fn new() -> Self {
24441 std::default::Default::default()
24442 }
24443
24444 /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24445 ///
24446 /// # Example
24447 /// ```ignore,no_run
24448 /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24449 /// use google_cloud_retail_v2::model::Tile;
24450 /// let x = TileNavigationResult::new()
24451 /// .set_tiles([
24452 /// Tile::default()/* use setters */,
24453 /// Tile::default()/* use (different) setters */,
24454 /// ]);
24455 /// ```
24456 pub fn set_tiles<T, V>(mut self, v: T) -> Self
24457 where
24458 T: std::iter::IntoIterator<Item = V>,
24459 V: std::convert::Into<crate::model::Tile>,
24460 {
24461 use std::iter::Iterator;
24462 self.tiles = v.into_iter().map(|i| i.into()).collect();
24463 self
24464 }
24465 }
24466
24467 impl wkt::message::Message for TileNavigationResult {
24468 fn typename() -> &'static str {
24469 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24470 }
24471 }
24472}
24473
24474/// Metadata for active A/B testing experiment.
24475#[derive(Clone, Default, PartialEq)]
24476#[non_exhaustive]
24477pub struct ExperimentInfo {
24478 /// The fully qualified resource name of the experiment that provides the
24479 /// serving config under test, should an active experiment exist. For example:
24480 /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24481 pub experiment: std::string::String,
24482
24483 /// Information associated with the specific experiment entity being recorded.
24484 pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24485
24486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24487}
24488
24489impl ExperimentInfo {
24490 pub fn new() -> Self {
24491 std::default::Default::default()
24492 }
24493
24494 /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24495 ///
24496 /// # Example
24497 /// ```ignore,no_run
24498 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24499 /// let x = ExperimentInfo::new().set_experiment("example");
24500 /// ```
24501 pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24502 self.experiment = v.into();
24503 self
24504 }
24505
24506 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24507 ///
24508 /// Note that all the setters affecting `experiment_metadata` are mutually
24509 /// exclusive.
24510 ///
24511 /// # Example
24512 /// ```ignore,no_run
24513 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24514 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24515 /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24516 /// google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24517 /// ```
24518 pub fn set_experiment_metadata<
24519 T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24520 >(
24521 mut self,
24522 v: T,
24523 ) -> Self {
24524 self.experiment_metadata = v.into();
24525 self
24526 }
24527
24528 /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24529 /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24530 /// holds a different branch.
24531 pub fn serving_config_experiment(
24532 &self,
24533 ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24534 {
24535 #[allow(unreachable_patterns)]
24536 self.experiment_metadata.as_ref().and_then(|v| match v {
24537 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24538 std::option::Option::Some(v)
24539 }
24540 _ => std::option::Option::None,
24541 })
24542 }
24543
24544 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24545 /// to hold a `ServingConfigExperiment`.
24546 ///
24547 /// Note that all the setters affecting `experiment_metadata` are
24548 /// mutually exclusive.
24549 ///
24550 /// # Example
24551 /// ```ignore,no_run
24552 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24553 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24554 /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24555 /// assert!(x.serving_config_experiment().is_some());
24556 /// ```
24557 pub fn set_serving_config_experiment<
24558 T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24559 >(
24560 mut self,
24561 v: T,
24562 ) -> Self {
24563 self.experiment_metadata = std::option::Option::Some(
24564 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24565 );
24566 self
24567 }
24568}
24569
24570impl wkt::message::Message for ExperimentInfo {
24571 fn typename() -> &'static str {
24572 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24573 }
24574}
24575
24576/// Defines additional types related to [ExperimentInfo].
24577pub mod experiment_info {
24578 #[allow(unused_imports)]
24579 use super::*;
24580
24581 /// Metadata for active serving config A/B tests.
24582 #[derive(Clone, Default, PartialEq)]
24583 #[non_exhaustive]
24584 pub struct ServingConfigExperiment {
24585 /// The fully qualified resource name of the original
24586 /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24587 /// in the search request prior to reassignment by experiment API. For
24588 /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24589 ///
24590 /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24591 pub original_serving_config: std::string::String,
24592
24593 /// The fully qualified resource name of the serving config
24594 /// `Experiment.VariantArm.serving_config_id` responsible for generating
24595 /// the search response. For example:
24596 /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24597 pub experiment_serving_config: std::string::String,
24598
24599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24600 }
24601
24602 impl ServingConfigExperiment {
24603 pub fn new() -> Self {
24604 std::default::Default::default()
24605 }
24606
24607 /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24608 ///
24609 /// # Example
24610 /// ```ignore,no_run
24611 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24612 /// let x = ServingConfigExperiment::new().set_original_serving_config("example");
24613 /// ```
24614 pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24615 mut self,
24616 v: T,
24617 ) -> Self {
24618 self.original_serving_config = v.into();
24619 self
24620 }
24621
24622 /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24623 ///
24624 /// # Example
24625 /// ```ignore,no_run
24626 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24627 /// let x = ServingConfigExperiment::new().set_experiment_serving_config("example");
24628 /// ```
24629 pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24630 mut self,
24631 v: T,
24632 ) -> Self {
24633 self.experiment_serving_config = v.into();
24634 self
24635 }
24636 }
24637
24638 impl wkt::message::Message for ServingConfigExperiment {
24639 fn typename() -> &'static str {
24640 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24641 }
24642 }
24643
24644 /// Information associated with the specific experiment entity being recorded.
24645 #[derive(Clone, Debug, PartialEq)]
24646 #[non_exhaustive]
24647 pub enum ExperimentMetadata {
24648 /// A/B test between existing Cloud Retail Search
24649 /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24650 ///
24651 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24652 ServingConfigExperiment(
24653 std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24654 ),
24655 }
24656}
24657
24658/// Configures metadata that is used to generate serving time results (e.g.
24659/// search results or recommendation predictions).
24660#[derive(Clone, Default, PartialEq)]
24661#[non_exhaustive]
24662pub struct ServingConfig {
24663 /// Immutable. Fully qualified name
24664 /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24665 pub name: std::string::String,
24666
24667 /// Required. The human readable serving config display name. Used in Retail
24668 /// UI.
24669 ///
24670 /// This field must be a UTF-8 encoded string with a length limit of 128
24671 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
24672 pub display_name: std::string::String,
24673
24674 /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
24675 /// to use at serving time. Currently only RecommendationModels are supported:
24676 /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
24677 /// Can be changed but only to a compatible model (e.g.
24678 /// others-you-may-like CTR to others-you-may-like CVR).
24679 ///
24680 /// Required when
24681 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24682 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24683 ///
24684 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24685 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24686 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24687 pub model_id: std::string::String,
24688
24689 /// How much price ranking we want in serving results.
24690 /// Price reranking causes product items with a similar
24691 /// recommendation probability to be ordered by price, with the
24692 /// highest-priced items first. This setting could result in a decrease in
24693 /// click-through and conversion rates.
24694 /// Allowed values are:
24695 ///
24696 /// * `no-price-reranking`
24697 /// * `low-price-reranking`
24698 /// * `medium-price-reranking`
24699 /// * `high-price-reranking`
24700 ///
24701 /// If not specified, we choose default based on model type. Default value:
24702 /// `no-price-reranking`.
24703 ///
24704 /// Can only be set if
24705 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24706 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24707 ///
24708 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24709 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24710 pub price_reranking_level: std::string::String,
24711
24712 /// Facet specifications for faceted search. If empty, no facets are returned.
24713 /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
24714 /// resources with only the Facet control set. These controls are assumed to be
24715 /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
24716 /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
24717 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
24718 /// is returned.
24719 ///
24720 /// Can only be set if
24721 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24722 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24723 ///
24724 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24725 /// [google.cloud.retail.v2.Control]: crate::model::Control
24726 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24727 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24728 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24729 pub facet_control_ids: std::vec::Vec<std::string::String>,
24730
24731 /// The specification for dynamically generated facets. Notice that only
24732 /// textual facets can be dynamically generated.
24733 ///
24734 /// Can only be set if
24735 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24736 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24737 ///
24738 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24739 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24740 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
24741
24742 /// Condition boost specifications. If a product matches multiple conditions
24743 /// in the specifications, boost scores from these specifications are all
24744 /// applied and combined in a non-linear way. Maximum number of
24745 /// specifications is 100.
24746 ///
24747 /// Notice that if both
24748 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
24749 /// and
24750 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
24751 /// are set, the boost conditions from both places are evaluated. If a search
24752 /// request matches multiple boost conditions, the final boost score is equal
24753 /// to the sum of the boost scores from all matched boost conditions.
24754 ///
24755 /// Can only be set if
24756 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24757 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24758 ///
24759 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
24760 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
24761 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24762 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24763 pub boost_control_ids: std::vec::Vec<std::string::String>,
24764
24765 /// Condition filter specifications. If a product matches multiple conditions
24766 /// in the specifications, filters from these specifications are all
24767 /// applied and combined via the AND operator. Maximum number of
24768 /// specifications is 100.
24769 ///
24770 /// Can only be set if
24771 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24772 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24773 ///
24774 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24775 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24776 pub filter_control_ids: std::vec::Vec<std::string::String>,
24777
24778 /// Condition redirect specifications. Only the first triggered redirect action
24779 /// is applied, even if multiple apply. Maximum number of specifications is
24780 /// 1000.
24781 ///
24782 /// Can only be set if
24783 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24784 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24785 ///
24786 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24787 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24788 pub redirect_control_ids: std::vec::Vec<std::string::String>,
24789
24790 /// Condition synonyms specifications. If multiple syonyms conditions match,
24791 /// all matching synonyms control in the list will execute. Order of controls
24792 /// in the list will not matter. Maximum number of specifications is
24793 /// 100.
24794 ///
24795 /// Can only be set if
24796 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24797 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24798 ///
24799 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24800 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24801 pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24802
24803 /// Condition oneway synonyms specifications. If multiple oneway synonyms
24804 /// conditions match, all matching oneway synonyms controls in the list will
24805 /// execute. Order of controls in the list will not matter. Maximum number of
24806 /// specifications is 100.
24807 ///
24808 /// Can only be set if
24809 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24810 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24811 ///
24812 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24813 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24814 pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24815
24816 /// Condition do not associate specifications. If multiple do not associate
24817 /// conditions match, all matching do not associate controls in the list will
24818 /// execute.
24819 ///
24820 /// - Order does not matter.
24821 /// - Maximum number of specifications is 100.
24822 ///
24823 /// Can only be set if
24824 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24825 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24826 ///
24827 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24828 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24829 pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
24830
24831 /// Condition replacement specifications.
24832 ///
24833 /// - Applied according to the order in the list.
24834 /// - A previously replaced term can not be re-replaced.
24835 /// - Maximum number of specifications is 100.
24836 ///
24837 /// Can only be set if
24838 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24839 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24840 ///
24841 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24842 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24843 pub replacement_control_ids: std::vec::Vec<std::string::String>,
24844
24845 /// Condition ignore specifications. If multiple ignore
24846 /// conditions match, all matching ignore controls in the list will
24847 /// execute.
24848 ///
24849 /// - Order does not matter.
24850 /// - Maximum number of specifications is 100.
24851 ///
24852 /// Can only be set if
24853 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24854 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24855 ///
24856 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24857 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24858 pub ignore_control_ids: std::vec::Vec<std::string::String>,
24859
24860 /// How much diversity to use in recommendation model results e.g.
24861 /// `medium-diversity` or `high-diversity`. Currently supported values:
24862 ///
24863 /// * `no-diversity`
24864 /// * `low-diversity`
24865 /// * `medium-diversity`
24866 /// * `high-diversity`
24867 /// * `auto-diversity`
24868 ///
24869 /// If not specified, we choose default based on recommendation model
24870 /// type. Default value: `no-diversity`.
24871 ///
24872 /// Can only be set if
24873 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24874 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24875 ///
24876 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24877 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24878 pub diversity_level: std::string::String,
24879
24880 /// What kind of diversity to use - data driven or rule based. If unset, the
24881 /// server behavior defaults to
24882 /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
24883 ///
24884 /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
24885 pub diversity_type: crate::model::serving_config::DiversityType,
24886
24887 /// Whether to add additional category filters on the `similar-items` model.
24888 /// If not specified, we enable it by default.
24889 /// Allowed values are:
24890 ///
24891 /// * `no-category-match`: No additional filtering of original results from
24892 /// the model and the customer's filters.
24893 /// * `relaxed-category-match`: Only keep results with categories that match
24894 /// at least one item categories in the PredictRequests's context item.
24895 /// * If customer also sends filters in the PredictRequest, then the results
24896 /// will satisfy both conditions (user given and category match).
24897 ///
24898 /// Can only be set if
24899 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24900 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24901 ///
24902 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24903 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24904 pub enable_category_filter_level: std::string::String,
24905
24906 /// When the flag is enabled, the products in the denylist will not be filtered
24907 /// out in the recommendation filtering results.
24908 pub ignore_recs_denylist: bool,
24909
24910 /// The specification for personalization spec.
24911 ///
24912 /// Can only be set if
24913 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24914 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24915 ///
24916 /// Notice that if both
24917 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
24918 /// and
24919 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24920 /// are set.
24921 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24922 /// will override
24923 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
24924 ///
24925 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
24926 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
24927 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24928 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24929 pub personalization_spec:
24930 std::option::Option<crate::model::search_request::PersonalizationSpec>,
24931
24932 /// Required. Immutable. Specifies the solution types that a serving config can
24933 /// be associated with. Currently we support setting only one type of solution.
24934 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
24935
24936 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24937}
24938
24939impl ServingConfig {
24940 pub fn new() -> Self {
24941 std::default::Default::default()
24942 }
24943
24944 /// Sets the value of [name][crate::model::ServingConfig::name].
24945 ///
24946 /// # Example
24947 /// ```ignore,no_run
24948 /// # use google_cloud_retail_v2::model::ServingConfig;
24949 /// let x = ServingConfig::new().set_name("example");
24950 /// ```
24951 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24952 self.name = v.into();
24953 self
24954 }
24955
24956 /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
24957 ///
24958 /// # Example
24959 /// ```ignore,no_run
24960 /// # use google_cloud_retail_v2::model::ServingConfig;
24961 /// let x = ServingConfig::new().set_display_name("example");
24962 /// ```
24963 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24964 self.display_name = v.into();
24965 self
24966 }
24967
24968 /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
24969 ///
24970 /// # Example
24971 /// ```ignore,no_run
24972 /// # use google_cloud_retail_v2::model::ServingConfig;
24973 /// let x = ServingConfig::new().set_model_id("example");
24974 /// ```
24975 pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24976 self.model_id = v.into();
24977 self
24978 }
24979
24980 /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
24981 ///
24982 /// # Example
24983 /// ```ignore,no_run
24984 /// # use google_cloud_retail_v2::model::ServingConfig;
24985 /// let x = ServingConfig::new().set_price_reranking_level("example");
24986 /// ```
24987 pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
24988 mut self,
24989 v: T,
24990 ) -> Self {
24991 self.price_reranking_level = v.into();
24992 self
24993 }
24994
24995 /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
24996 ///
24997 /// # Example
24998 /// ```ignore,no_run
24999 /// # use google_cloud_retail_v2::model::ServingConfig;
25000 /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
25001 /// ```
25002 pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25003 where
25004 T: std::iter::IntoIterator<Item = V>,
25005 V: std::convert::Into<std::string::String>,
25006 {
25007 use std::iter::Iterator;
25008 self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25009 self
25010 }
25011
25012 /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25013 ///
25014 /// # Example
25015 /// ```ignore,no_run
25016 /// # use google_cloud_retail_v2::model::ServingConfig;
25017 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25018 /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25019 /// ```
25020 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25021 where
25022 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25023 {
25024 self.dynamic_facet_spec = std::option::Option::Some(v.into());
25025 self
25026 }
25027
25028 /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25029 ///
25030 /// # Example
25031 /// ```ignore,no_run
25032 /// # use google_cloud_retail_v2::model::ServingConfig;
25033 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25034 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25035 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25036 /// ```
25037 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25038 where
25039 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25040 {
25041 self.dynamic_facet_spec = v.map(|x| x.into());
25042 self
25043 }
25044
25045 /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25046 ///
25047 /// # Example
25048 /// ```ignore,no_run
25049 /// # use google_cloud_retail_v2::model::ServingConfig;
25050 /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25051 /// ```
25052 pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25053 where
25054 T: std::iter::IntoIterator<Item = V>,
25055 V: std::convert::Into<std::string::String>,
25056 {
25057 use std::iter::Iterator;
25058 self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25059 self
25060 }
25061
25062 /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25063 ///
25064 /// # Example
25065 /// ```ignore,no_run
25066 /// # use google_cloud_retail_v2::model::ServingConfig;
25067 /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25068 /// ```
25069 pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25070 where
25071 T: std::iter::IntoIterator<Item = V>,
25072 V: std::convert::Into<std::string::String>,
25073 {
25074 use std::iter::Iterator;
25075 self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25076 self
25077 }
25078
25079 /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25080 ///
25081 /// # Example
25082 /// ```ignore,no_run
25083 /// # use google_cloud_retail_v2::model::ServingConfig;
25084 /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25085 /// ```
25086 pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25087 where
25088 T: std::iter::IntoIterator<Item = V>,
25089 V: std::convert::Into<std::string::String>,
25090 {
25091 use std::iter::Iterator;
25092 self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25093 self
25094 }
25095
25096 /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25097 ///
25098 /// # Example
25099 /// ```ignore,no_run
25100 /// # use google_cloud_retail_v2::model::ServingConfig;
25101 /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25102 /// ```
25103 pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25104 where
25105 T: std::iter::IntoIterator<Item = V>,
25106 V: std::convert::Into<std::string::String>,
25107 {
25108 use std::iter::Iterator;
25109 self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25110 self
25111 }
25112
25113 /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25114 ///
25115 /// # Example
25116 /// ```ignore,no_run
25117 /// # use google_cloud_retail_v2::model::ServingConfig;
25118 /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25119 /// ```
25120 pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25121 where
25122 T: std::iter::IntoIterator<Item = V>,
25123 V: std::convert::Into<std::string::String>,
25124 {
25125 use std::iter::Iterator;
25126 self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25127 self
25128 }
25129
25130 /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25131 ///
25132 /// # Example
25133 /// ```ignore,no_run
25134 /// # use google_cloud_retail_v2::model::ServingConfig;
25135 /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25136 /// ```
25137 pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25138 where
25139 T: std::iter::IntoIterator<Item = V>,
25140 V: std::convert::Into<std::string::String>,
25141 {
25142 use std::iter::Iterator;
25143 self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25144 self
25145 }
25146
25147 /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25148 ///
25149 /// # Example
25150 /// ```ignore,no_run
25151 /// # use google_cloud_retail_v2::model::ServingConfig;
25152 /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25153 /// ```
25154 pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25155 where
25156 T: std::iter::IntoIterator<Item = V>,
25157 V: std::convert::Into<std::string::String>,
25158 {
25159 use std::iter::Iterator;
25160 self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25161 self
25162 }
25163
25164 /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25165 ///
25166 /// # Example
25167 /// ```ignore,no_run
25168 /// # use google_cloud_retail_v2::model::ServingConfig;
25169 /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25170 /// ```
25171 pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25172 where
25173 T: std::iter::IntoIterator<Item = V>,
25174 V: std::convert::Into<std::string::String>,
25175 {
25176 use std::iter::Iterator;
25177 self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25178 self
25179 }
25180
25181 /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25182 ///
25183 /// # Example
25184 /// ```ignore,no_run
25185 /// # use google_cloud_retail_v2::model::ServingConfig;
25186 /// let x = ServingConfig::new().set_diversity_level("example");
25187 /// ```
25188 pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25189 self.diversity_level = v.into();
25190 self
25191 }
25192
25193 /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25194 ///
25195 /// # Example
25196 /// ```ignore,no_run
25197 /// # use google_cloud_retail_v2::model::ServingConfig;
25198 /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25199 /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25200 /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25201 /// ```
25202 pub fn set_diversity_type<
25203 T: std::convert::Into<crate::model::serving_config::DiversityType>,
25204 >(
25205 mut self,
25206 v: T,
25207 ) -> Self {
25208 self.diversity_type = v.into();
25209 self
25210 }
25211
25212 /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25213 ///
25214 /// # Example
25215 /// ```ignore,no_run
25216 /// # use google_cloud_retail_v2::model::ServingConfig;
25217 /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25218 /// ```
25219 pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25220 mut self,
25221 v: T,
25222 ) -> Self {
25223 self.enable_category_filter_level = v.into();
25224 self
25225 }
25226
25227 /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25228 ///
25229 /// # Example
25230 /// ```ignore,no_run
25231 /// # use google_cloud_retail_v2::model::ServingConfig;
25232 /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25233 /// ```
25234 pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25235 self.ignore_recs_denylist = v.into();
25236 self
25237 }
25238
25239 /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25240 ///
25241 /// # Example
25242 /// ```ignore,no_run
25243 /// # use google_cloud_retail_v2::model::ServingConfig;
25244 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25245 /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25246 /// ```
25247 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25248 where
25249 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25250 {
25251 self.personalization_spec = std::option::Option::Some(v.into());
25252 self
25253 }
25254
25255 /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25256 ///
25257 /// # Example
25258 /// ```ignore,no_run
25259 /// # use google_cloud_retail_v2::model::ServingConfig;
25260 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25261 /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25262 /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25263 /// ```
25264 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25265 where
25266 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25267 {
25268 self.personalization_spec = v.map(|x| x.into());
25269 self
25270 }
25271
25272 /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25273 ///
25274 /// # Example
25275 /// ```ignore,no_run
25276 /// # use google_cloud_retail_v2::model::ServingConfig;
25277 /// use google_cloud_retail_v2::model::SolutionType;
25278 /// let x = ServingConfig::new().set_solution_types([
25279 /// SolutionType::Recommendation,
25280 /// SolutionType::Search,
25281 /// ]);
25282 /// ```
25283 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25284 where
25285 T: std::iter::IntoIterator<Item = V>,
25286 V: std::convert::Into<crate::model::SolutionType>,
25287 {
25288 use std::iter::Iterator;
25289 self.solution_types = v.into_iter().map(|i| i.into()).collect();
25290 self
25291 }
25292}
25293
25294impl wkt::message::Message for ServingConfig {
25295 fn typename() -> &'static str {
25296 "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25297 }
25298}
25299
25300/// Defines additional types related to [ServingConfig].
25301pub mod serving_config {
25302 #[allow(unused_imports)]
25303 use super::*;
25304
25305 /// What type of diversity - data or rule based.
25306 ///
25307 /// # Working with unknown values
25308 ///
25309 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25310 /// additional enum variants at any time. Adding new variants is not considered
25311 /// a breaking change. Applications should write their code in anticipation of:
25312 ///
25313 /// - New values appearing in future releases of the client library, **and**
25314 /// - New values received dynamically, without application changes.
25315 ///
25316 /// Please consult the [Working with enums] section in the user guide for some
25317 /// guidelines.
25318 ///
25319 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25320 #[derive(Clone, Debug, PartialEq)]
25321 #[non_exhaustive]
25322 pub enum DiversityType {
25323 /// Default value.
25324 Unspecified,
25325 /// Rule based diversity.
25326 RuleBasedDiversity,
25327 /// Data driven diversity.
25328 DataDrivenDiversity,
25329 /// If set, the enum was initialized with an unknown value.
25330 ///
25331 /// Applications can examine the value using [DiversityType::value] or
25332 /// [DiversityType::name].
25333 UnknownValue(diversity_type::UnknownValue),
25334 }
25335
25336 #[doc(hidden)]
25337 pub mod diversity_type {
25338 #[allow(unused_imports)]
25339 use super::*;
25340 #[derive(Clone, Debug, PartialEq)]
25341 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25342 }
25343
25344 impl DiversityType {
25345 /// Gets the enum value.
25346 ///
25347 /// Returns `None` if the enum contains an unknown value deserialized from
25348 /// the string representation of enums.
25349 pub fn value(&self) -> std::option::Option<i32> {
25350 match self {
25351 Self::Unspecified => std::option::Option::Some(0),
25352 Self::RuleBasedDiversity => std::option::Option::Some(2),
25353 Self::DataDrivenDiversity => std::option::Option::Some(3),
25354 Self::UnknownValue(u) => u.0.value(),
25355 }
25356 }
25357
25358 /// Gets the enum value as a string.
25359 ///
25360 /// Returns `None` if the enum contains an unknown value deserialized from
25361 /// the integer representation of enums.
25362 pub fn name(&self) -> std::option::Option<&str> {
25363 match self {
25364 Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25365 Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25366 Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25367 Self::UnknownValue(u) => u.0.name(),
25368 }
25369 }
25370 }
25371
25372 impl std::default::Default for DiversityType {
25373 fn default() -> Self {
25374 use std::convert::From;
25375 Self::from(0)
25376 }
25377 }
25378
25379 impl std::fmt::Display for DiversityType {
25380 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25381 wkt::internal::display_enum(f, self.name(), self.value())
25382 }
25383 }
25384
25385 impl std::convert::From<i32> for DiversityType {
25386 fn from(value: i32) -> Self {
25387 match value {
25388 0 => Self::Unspecified,
25389 2 => Self::RuleBasedDiversity,
25390 3 => Self::DataDrivenDiversity,
25391 _ => Self::UnknownValue(diversity_type::UnknownValue(
25392 wkt::internal::UnknownEnumValue::Integer(value),
25393 )),
25394 }
25395 }
25396 }
25397
25398 impl std::convert::From<&str> for DiversityType {
25399 fn from(value: &str) -> Self {
25400 use std::string::ToString;
25401 match value {
25402 "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25403 "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25404 "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25405 _ => Self::UnknownValue(diversity_type::UnknownValue(
25406 wkt::internal::UnknownEnumValue::String(value.to_string()),
25407 )),
25408 }
25409 }
25410 }
25411
25412 impl serde::ser::Serialize for DiversityType {
25413 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25414 where
25415 S: serde::Serializer,
25416 {
25417 match self {
25418 Self::Unspecified => serializer.serialize_i32(0),
25419 Self::RuleBasedDiversity => serializer.serialize_i32(2),
25420 Self::DataDrivenDiversity => serializer.serialize_i32(3),
25421 Self::UnknownValue(u) => u.0.serialize(serializer),
25422 }
25423 }
25424 }
25425
25426 impl<'de> serde::de::Deserialize<'de> for DiversityType {
25427 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25428 where
25429 D: serde::Deserializer<'de>,
25430 {
25431 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25432 ".google.cloud.retail.v2.ServingConfig.DiversityType",
25433 ))
25434 }
25435 }
25436}
25437
25438/// Request for CreateServingConfig method.
25439#[derive(Clone, Default, PartialEq)]
25440#[non_exhaustive]
25441pub struct CreateServingConfigRequest {
25442 /// Required. Full resource name of parent. Format:
25443 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25444 pub parent: std::string::String,
25445
25446 /// Required. The ServingConfig to create.
25447 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25448
25449 /// Required. The ID to use for the ServingConfig, which will become the final
25450 /// component of the ServingConfig's resource name.
25451 ///
25452 /// This value should be 4-63 characters, and valid characters
25453 /// are /[a-z][0-9]-_/.
25454 pub serving_config_id: std::string::String,
25455
25456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25457}
25458
25459impl CreateServingConfigRequest {
25460 pub fn new() -> Self {
25461 std::default::Default::default()
25462 }
25463
25464 /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25465 ///
25466 /// # Example
25467 /// ```ignore,no_run
25468 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25469 /// let x = CreateServingConfigRequest::new().set_parent("example");
25470 /// ```
25471 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25472 self.parent = v.into();
25473 self
25474 }
25475
25476 /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25477 ///
25478 /// # Example
25479 /// ```ignore,no_run
25480 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25481 /// use google_cloud_retail_v2::model::ServingConfig;
25482 /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25483 /// ```
25484 pub fn set_serving_config<T>(mut self, v: T) -> Self
25485 where
25486 T: std::convert::Into<crate::model::ServingConfig>,
25487 {
25488 self.serving_config = std::option::Option::Some(v.into());
25489 self
25490 }
25491
25492 /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25493 ///
25494 /// # Example
25495 /// ```ignore,no_run
25496 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25497 /// use google_cloud_retail_v2::model::ServingConfig;
25498 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25499 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25500 /// ```
25501 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25502 where
25503 T: std::convert::Into<crate::model::ServingConfig>,
25504 {
25505 self.serving_config = v.map(|x| x.into());
25506 self
25507 }
25508
25509 /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25510 ///
25511 /// # Example
25512 /// ```ignore,no_run
25513 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25514 /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25515 /// ```
25516 pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25517 mut self,
25518 v: T,
25519 ) -> Self {
25520 self.serving_config_id = v.into();
25521 self
25522 }
25523}
25524
25525impl wkt::message::Message for CreateServingConfigRequest {
25526 fn typename() -> &'static str {
25527 "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25528 }
25529}
25530
25531/// Request for UpdateServingConfig method.
25532#[derive(Clone, Default, PartialEq)]
25533#[non_exhaustive]
25534pub struct UpdateServingConfigRequest {
25535 /// Required. The ServingConfig to update.
25536 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25537
25538 /// Indicates which fields in the provided
25539 /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25540 /// following are NOT supported:
25541 ///
25542 /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25543 ///
25544 /// If not set, all supported fields are updated.
25545 ///
25546 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25547 /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25548 pub update_mask: std::option::Option<wkt::FieldMask>,
25549
25550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25551}
25552
25553impl UpdateServingConfigRequest {
25554 pub fn new() -> Self {
25555 std::default::Default::default()
25556 }
25557
25558 /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25559 ///
25560 /// # Example
25561 /// ```ignore,no_run
25562 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25563 /// use google_cloud_retail_v2::model::ServingConfig;
25564 /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25565 /// ```
25566 pub fn set_serving_config<T>(mut self, v: T) -> Self
25567 where
25568 T: std::convert::Into<crate::model::ServingConfig>,
25569 {
25570 self.serving_config = std::option::Option::Some(v.into());
25571 self
25572 }
25573
25574 /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25575 ///
25576 /// # Example
25577 /// ```ignore,no_run
25578 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25579 /// use google_cloud_retail_v2::model::ServingConfig;
25580 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25581 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25582 /// ```
25583 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25584 where
25585 T: std::convert::Into<crate::model::ServingConfig>,
25586 {
25587 self.serving_config = v.map(|x| x.into());
25588 self
25589 }
25590
25591 /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25592 ///
25593 /// # Example
25594 /// ```ignore,no_run
25595 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25596 /// use wkt::FieldMask;
25597 /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25598 /// ```
25599 pub fn set_update_mask<T>(mut self, v: T) -> Self
25600 where
25601 T: std::convert::Into<wkt::FieldMask>,
25602 {
25603 self.update_mask = std::option::Option::Some(v.into());
25604 self
25605 }
25606
25607 /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25608 ///
25609 /// # Example
25610 /// ```ignore,no_run
25611 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25612 /// use wkt::FieldMask;
25613 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25614 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25615 /// ```
25616 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25617 where
25618 T: std::convert::Into<wkt::FieldMask>,
25619 {
25620 self.update_mask = v.map(|x| x.into());
25621 self
25622 }
25623}
25624
25625impl wkt::message::Message for UpdateServingConfigRequest {
25626 fn typename() -> &'static str {
25627 "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25628 }
25629}
25630
25631/// Request for DeleteServingConfig method.
25632#[derive(Clone, Default, PartialEq)]
25633#[non_exhaustive]
25634pub struct DeleteServingConfigRequest {
25635 /// Required. The resource name of the ServingConfig to delete. Format:
25636 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25637 pub name: std::string::String,
25638
25639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25640}
25641
25642impl DeleteServingConfigRequest {
25643 pub fn new() -> Self {
25644 std::default::Default::default()
25645 }
25646
25647 /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25648 ///
25649 /// # Example
25650 /// ```ignore,no_run
25651 /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25652 /// let x = DeleteServingConfigRequest::new().set_name("example");
25653 /// ```
25654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25655 self.name = v.into();
25656 self
25657 }
25658}
25659
25660impl wkt::message::Message for DeleteServingConfigRequest {
25661 fn typename() -> &'static str {
25662 "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
25663 }
25664}
25665
25666/// Request for GetServingConfig method.
25667#[derive(Clone, Default, PartialEq)]
25668#[non_exhaustive]
25669pub struct GetServingConfigRequest {
25670 /// Required. The resource name of the ServingConfig to get. Format:
25671 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25672 pub name: std::string::String,
25673
25674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25675}
25676
25677impl GetServingConfigRequest {
25678 pub fn new() -> Self {
25679 std::default::Default::default()
25680 }
25681
25682 /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
25683 ///
25684 /// # Example
25685 /// ```ignore,no_run
25686 /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
25687 /// let x = GetServingConfigRequest::new().set_name("example");
25688 /// ```
25689 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25690 self.name = v.into();
25691 self
25692 }
25693}
25694
25695impl wkt::message::Message for GetServingConfigRequest {
25696 fn typename() -> &'static str {
25697 "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
25698 }
25699}
25700
25701/// Request for ListServingConfigs method.
25702#[derive(Clone, Default, PartialEq)]
25703#[non_exhaustive]
25704pub struct ListServingConfigsRequest {
25705 /// Required. The catalog resource name. Format:
25706 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25707 pub parent: std::string::String,
25708
25709 /// Optional. Maximum number of results to return. If unspecified, defaults
25710 /// to 100. If a value greater than 100 is provided, at most 100 results are
25711 /// returned.
25712 pub page_size: i32,
25713
25714 /// Optional. A page token, received from a previous `ListServingConfigs` call.
25715 /// Provide this to retrieve the subsequent page.
25716 pub page_token: std::string::String,
25717
25718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25719}
25720
25721impl ListServingConfigsRequest {
25722 pub fn new() -> Self {
25723 std::default::Default::default()
25724 }
25725
25726 /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
25727 ///
25728 /// # Example
25729 /// ```ignore,no_run
25730 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25731 /// let x = ListServingConfigsRequest::new().set_parent("example");
25732 /// ```
25733 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25734 self.parent = v.into();
25735 self
25736 }
25737
25738 /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
25739 ///
25740 /// # Example
25741 /// ```ignore,no_run
25742 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25743 /// let x = ListServingConfigsRequest::new().set_page_size(42);
25744 /// ```
25745 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25746 self.page_size = v.into();
25747 self
25748 }
25749
25750 /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
25751 ///
25752 /// # Example
25753 /// ```ignore,no_run
25754 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25755 /// let x = ListServingConfigsRequest::new().set_page_token("example");
25756 /// ```
25757 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25758 self.page_token = v.into();
25759 self
25760 }
25761}
25762
25763impl wkt::message::Message for ListServingConfigsRequest {
25764 fn typename() -> &'static str {
25765 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
25766 }
25767}
25768
25769/// Response for ListServingConfigs method.
25770#[derive(Clone, Default, PartialEq)]
25771#[non_exhaustive]
25772pub struct ListServingConfigsResponse {
25773 /// All the ServingConfigs for a given catalog.
25774 pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
25775
25776 /// Pagination token, if not returned indicates the last page.
25777 pub next_page_token: std::string::String,
25778
25779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25780}
25781
25782impl ListServingConfigsResponse {
25783 pub fn new() -> Self {
25784 std::default::Default::default()
25785 }
25786
25787 /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
25788 ///
25789 /// # Example
25790 /// ```ignore,no_run
25791 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25792 /// use google_cloud_retail_v2::model::ServingConfig;
25793 /// let x = ListServingConfigsResponse::new()
25794 /// .set_serving_configs([
25795 /// ServingConfig::default()/* use setters */,
25796 /// ServingConfig::default()/* use (different) setters */,
25797 /// ]);
25798 /// ```
25799 pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
25800 where
25801 T: std::iter::IntoIterator<Item = V>,
25802 V: std::convert::Into<crate::model::ServingConfig>,
25803 {
25804 use std::iter::Iterator;
25805 self.serving_configs = v.into_iter().map(|i| i.into()).collect();
25806 self
25807 }
25808
25809 /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
25810 ///
25811 /// # Example
25812 /// ```ignore,no_run
25813 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25814 /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
25815 /// ```
25816 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25817 self.next_page_token = v.into();
25818 self
25819 }
25820}
25821
25822impl wkt::message::Message for ListServingConfigsResponse {
25823 fn typename() -> &'static str {
25824 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
25825 }
25826}
25827
25828#[doc(hidden)]
25829impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
25830 type PageItem = crate::model::ServingConfig;
25831
25832 fn items(self) -> std::vec::Vec<Self::PageItem> {
25833 self.serving_configs
25834 }
25835
25836 fn next_page_token(&self) -> std::string::String {
25837 use std::clone::Clone;
25838 self.next_page_token.clone()
25839 }
25840}
25841
25842/// Request for AddControl method.
25843#[derive(Clone, Default, PartialEq)]
25844#[non_exhaustive]
25845pub struct AddControlRequest {
25846 /// Required. The source ServingConfig resource name . Format:
25847 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25848 pub serving_config: std::string::String,
25849
25850 /// Required. The id of the control to apply. Assumed to be in the same catalog
25851 /// as the serving config - if id is not found a NOT_FOUND error is returned.
25852 pub control_id: std::string::String,
25853
25854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25855}
25856
25857impl AddControlRequest {
25858 pub fn new() -> Self {
25859 std::default::Default::default()
25860 }
25861
25862 /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
25863 ///
25864 /// # Example
25865 /// ```ignore,no_run
25866 /// # use google_cloud_retail_v2::model::AddControlRequest;
25867 /// let x = AddControlRequest::new().set_serving_config("example");
25868 /// ```
25869 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25870 self.serving_config = v.into();
25871 self
25872 }
25873
25874 /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
25875 ///
25876 /// # Example
25877 /// ```ignore,no_run
25878 /// # use google_cloud_retail_v2::model::AddControlRequest;
25879 /// let x = AddControlRequest::new().set_control_id("example");
25880 /// ```
25881 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25882 self.control_id = v.into();
25883 self
25884 }
25885}
25886
25887impl wkt::message::Message for AddControlRequest {
25888 fn typename() -> &'static str {
25889 "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
25890 }
25891}
25892
25893/// Request for RemoveControl method.
25894#[derive(Clone, Default, PartialEq)]
25895#[non_exhaustive]
25896pub struct RemoveControlRequest {
25897 /// Required. The source ServingConfig resource name . Format:
25898 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25899 pub serving_config: std::string::String,
25900
25901 /// Required. The id of the control to apply. Assumed to be in the same catalog
25902 /// as the serving config.
25903 pub control_id: std::string::String,
25904
25905 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25906}
25907
25908impl RemoveControlRequest {
25909 pub fn new() -> Self {
25910 std::default::Default::default()
25911 }
25912
25913 /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
25914 ///
25915 /// # Example
25916 /// ```ignore,no_run
25917 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25918 /// let x = RemoveControlRequest::new().set_serving_config("example");
25919 /// ```
25920 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25921 self.serving_config = v.into();
25922 self
25923 }
25924
25925 /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
25926 ///
25927 /// # Example
25928 /// ```ignore,no_run
25929 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25930 /// let x = RemoveControlRequest::new().set_control_id("example");
25931 /// ```
25932 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25933 self.control_id = v.into();
25934 self
25935 }
25936}
25937
25938impl wkt::message::Message for RemoveControlRequest {
25939 fn typename() -> &'static str {
25940 "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
25941 }
25942}
25943
25944/// UserEvent captures all metadata information Retail API needs to know about
25945/// how end users interact with customers' website.
25946#[derive(Clone, Default, PartialEq)]
25947#[non_exhaustive]
25948pub struct UserEvent {
25949 /// Required. User event type. Allowed values are:
25950 ///
25951 /// * `add-to-cart`: Products being added to cart.
25952 /// * `remove-from-cart`: Products being removed from cart.
25953 /// * `category-page-view`: Special pages such as sale or promotion pages
25954 /// viewed.
25955 /// * `detail-page-view`: Products detail page viewed.
25956 /// * `home-page-view`: Homepage viewed.
25957 /// * `purchase-complete`: User finishing a purchase.
25958 /// * `search`: Product search.
25959 /// * `shopping-cart-page-view`: User viewing a shopping cart.
25960 pub event_type: std::string::String,
25961
25962 /// Required. A unique identifier for tracking visitors.
25963 ///
25964 /// For example, this could be implemented with an HTTP cookie, which should be
25965 /// able to uniquely identify a visitor on a single device. This unique
25966 /// identifier should not change if the visitor log in/out of the website.
25967 ///
25968 /// Don't set the field to the same fixed ID for different users. This mixes
25969 /// the event history of those users together, which results in degraded model
25970 /// quality.
25971 ///
25972 /// The field must be a UTF-8 encoded string with a length limit of 128
25973 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
25974 ///
25975 /// The field should not contain PII or user-data. We recommend to use Google
25976 /// Analytics [Client
25977 /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
25978 /// for this field.
25979 pub visitor_id: std::string::String,
25980
25981 /// A unique identifier for tracking a visitor session with a length limit of
25982 /// 128 bytes. A session is an aggregation of an end user behavior in a time
25983 /// span.
25984 ///
25985 /// A general guideline to populate the session_id:
25986 ///
25987 /// 1. If user has no activity for 30 min, a new session_id should be assigned.
25988 /// 1. The session_id should be unique across users, suggest use uuid or add
25989 /// visitor_id as prefix.
25990 pub session_id: std::string::String,
25991
25992 /// Only required for
25993 /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
25994 /// method. Timestamp of when the user event happened.
25995 ///
25996 /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
25997 pub event_time: std::option::Option<wkt::Timestamp>,
25998
25999 /// A list of identifiers for the independent experiment groups this user event
26000 /// belongs to. This is used to distinguish between user events associated with
26001 /// different experiment setups (e.g. using Retail API, using different
26002 /// recommendation models).
26003 pub experiment_ids: std::vec::Vec<std::string::String>,
26004
26005 /// Highly recommended for user events that are the result of
26006 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26007 /// This field enables accurate attribution of recommendation model
26008 /// performance.
26009 ///
26010 /// The value must be a valid
26011 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26012 /// for user events that are the result of
26013 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26014 /// The value must be a valid
26015 /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26016 /// for user events that are the result of
26017 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26018 ///
26019 /// This token enables us to accurately attribute page view or purchase back to
26020 /// the event and the particular predict response containing this
26021 /// clicked/purchased product. If user clicks on product K in the
26022 /// recommendation results, pass
26023 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26024 /// as a URL parameter to product K's page. When recording events on product
26025 /// K's page, log the
26026 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26027 /// to this field.
26028 ///
26029 /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26030 /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26031 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26032 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26033 pub attribution_token: std::string::String,
26034
26035 /// The main product details related to the event.
26036 ///
26037 /// This field is optional except for the following event types:
26038 ///
26039 /// * `add-to-cart`
26040 /// * `detail-page-view`
26041 /// * `purchase-complete`
26042 ///
26043 /// In a `search` event, this field represents the products returned to the end
26044 /// user on the current page (the end user may have not finished browsing the
26045 /// whole page yet). When a new page is returned to the end user, after
26046 /// pagination/filtering/ordering even for the same query, a new `search` event
26047 /// with different
26048 /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26049 /// desired. The end user may have not finished browsing the whole page yet.
26050 ///
26051 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26052 pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26053
26054 /// The main auto-completion details related to the event.
26055 ///
26056 /// This field should be set for `search` event when autocomplete function is
26057 /// enabled and the user clicks a suggestion for search.
26058 pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26059
26060 /// Extra user event features to include in the recommendation model.
26061 ///
26062 /// If you provide custom attributes for ingested user events, also include
26063 /// them in the user events that you associate with prediction requests. Custom
26064 /// attribute formatting must be consistent between imported events and events
26065 /// provided with prediction requests. This lets the Retail API use
26066 /// those custom attributes when training models and serving predictions, which
26067 /// helps improve recommendation quality.
26068 ///
26069 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26070 /// error is returned:
26071 ///
26072 /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26073 /// characters.
26074 /// * For text attributes, at most 400 values are allowed. Empty values are not
26075 /// allowed. Each value must be a UTF-8 encoded string with a length limit of
26076 /// 256 characters.
26077 /// * For number attributes, at most 400 values are allowed.
26078 ///
26079 /// For product recommendations, an example of extra user information is
26080 /// traffic_channel, which is how a user arrives at the site. Users can arrive
26081 /// at the site by coming to the site directly, coming through Google
26082 /// search, or in other ways.
26083 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26084
26085 /// The ID or name of the associated shopping cart. This ID is used
26086 /// to associate multiple items added or present in the cart before purchase.
26087 ///
26088 /// This can only be set for `add-to-cart`, `purchase-complete`, or
26089 /// `shopping-cart-page-view` events.
26090 pub cart_id: std::string::String,
26091
26092 /// A transaction represents the entire purchase transaction.
26093 ///
26094 /// Required for `purchase-complete` events. Other event types should not set
26095 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26096 pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26097
26098 /// The user's search query.
26099 ///
26100 /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26101 /// definition.
26102 ///
26103 /// The value must be a UTF-8 encoded string with a length limit of 5,000
26104 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26105 ///
26106 /// At least one of
26107 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26108 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26109 /// required for `search` events. Other event types should not set this field.
26110 /// Otherwise, an INVALID_ARGUMENT error is returned.
26111 ///
26112 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26113 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26114 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26115 pub search_query: std::string::String,
26116
26117 /// The filter syntax consists of an expression language for constructing a
26118 /// predicate from one or more fields of the products being filtered.
26119 ///
26120 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26121 /// definition and syntax.
26122 ///
26123 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26124 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26125 ///
26126 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26127 pub filter: std::string::String,
26128
26129 /// The order in which products are returned.
26130 ///
26131 /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26132 /// for definition and syntax.
26133 ///
26134 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26135 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26136 ///
26137 /// This can only be set for `search` events. Other event types should not set
26138 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26139 ///
26140 /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26141 pub order_by: std::string::String,
26142
26143 /// An integer that specifies the current offset for pagination (the 0-indexed
26144 /// starting location, amongst the products deemed by the API as relevant).
26145 ///
26146 /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26147 /// definition.
26148 ///
26149 /// If this field is negative, an INVALID_ARGUMENT is returned.
26150 ///
26151 /// This can only be set for `search` events. Other event types should not set
26152 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26153 ///
26154 /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26155 pub offset: i32,
26156
26157 /// The categories associated with a category page.
26158 ///
26159 /// To represent full path of category, use '>' sign to separate different
26160 /// hierarchies. If '>' is part of the category name, replace it with
26161 /// other character(s).
26162 ///
26163 /// Category pages include special pages such as sales or promotions. For
26164 /// instance, a special sale page may have the category hierarchy:
26165 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26166 ///
26167 /// Required for `category-page-view` events. At least one of
26168 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26169 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26170 /// required for `search` events. Other event types should not set this field.
26171 /// Otherwise, an INVALID_ARGUMENT error is returned.
26172 ///
26173 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26174 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26175 pub page_categories: std::vec::Vec<std::string::String>,
26176
26177 /// User information.
26178 pub user_info: std::option::Option<crate::model::UserInfo>,
26179
26180 /// Complete URL (window.location.href) of the user's current page.
26181 ///
26182 /// When using the client side event reporting with JavaScript pixel and Google
26183 /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26184 /// characters.
26185 pub uri: std::string::String,
26186
26187 /// The referrer URL of the current page.
26188 ///
26189 /// When using the client side event reporting with JavaScript pixel and Google
26190 /// Tag Manager, this value is filled in automatically.
26191 pub referrer_uri: std::string::String,
26192
26193 /// A unique ID of a web page view.
26194 ///
26195 /// This should be kept the same for all user events triggered from the same
26196 /// pageview. For example, an item detail page view could trigger multiple
26197 /// events as the user is browsing the page. The `pageViewId` property should
26198 /// be kept the same for all these events so that they can be grouped together
26199 /// properly.
26200 ///
26201 /// When using the client side event reporting with JavaScript pixel and Google
26202 /// Tag Manager, this value is filled in automatically.
26203 pub page_view_id: std::string::String,
26204
26205 /// The entity for customers that may run multiple different entities, domains,
26206 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26207 /// `google.com`, `youtube.com`, etc.
26208 /// We recommend that you set this field to get better per-entity search,
26209 /// completion, and prediction results.
26210 pub entity: std::string::String,
26211
26212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26213}
26214
26215impl UserEvent {
26216 pub fn new() -> Self {
26217 std::default::Default::default()
26218 }
26219
26220 /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26221 ///
26222 /// # Example
26223 /// ```ignore,no_run
26224 /// # use google_cloud_retail_v2::model::UserEvent;
26225 /// let x = UserEvent::new().set_event_type("example");
26226 /// ```
26227 pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26228 self.event_type = v.into();
26229 self
26230 }
26231
26232 /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26233 ///
26234 /// # Example
26235 /// ```ignore,no_run
26236 /// # use google_cloud_retail_v2::model::UserEvent;
26237 /// let x = UserEvent::new().set_visitor_id("example");
26238 /// ```
26239 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26240 self.visitor_id = v.into();
26241 self
26242 }
26243
26244 /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26245 ///
26246 /// # Example
26247 /// ```ignore,no_run
26248 /// # use google_cloud_retail_v2::model::UserEvent;
26249 /// let x = UserEvent::new().set_session_id("example");
26250 /// ```
26251 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26252 self.session_id = v.into();
26253 self
26254 }
26255
26256 /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26257 ///
26258 /// # Example
26259 /// ```ignore,no_run
26260 /// # use google_cloud_retail_v2::model::UserEvent;
26261 /// use wkt::Timestamp;
26262 /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26263 /// ```
26264 pub fn set_event_time<T>(mut self, v: T) -> Self
26265 where
26266 T: std::convert::Into<wkt::Timestamp>,
26267 {
26268 self.event_time = std::option::Option::Some(v.into());
26269 self
26270 }
26271
26272 /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26273 ///
26274 /// # Example
26275 /// ```ignore,no_run
26276 /// # use google_cloud_retail_v2::model::UserEvent;
26277 /// use wkt::Timestamp;
26278 /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26279 /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26280 /// ```
26281 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26282 where
26283 T: std::convert::Into<wkt::Timestamp>,
26284 {
26285 self.event_time = v.map(|x| x.into());
26286 self
26287 }
26288
26289 /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26290 ///
26291 /// # Example
26292 /// ```ignore,no_run
26293 /// # use google_cloud_retail_v2::model::UserEvent;
26294 /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26295 /// ```
26296 pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
26297 where
26298 T: std::iter::IntoIterator<Item = V>,
26299 V: std::convert::Into<std::string::String>,
26300 {
26301 use std::iter::Iterator;
26302 self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26303 self
26304 }
26305
26306 /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26307 ///
26308 /// # Example
26309 /// ```ignore,no_run
26310 /// # use google_cloud_retail_v2::model::UserEvent;
26311 /// let x = UserEvent::new().set_attribution_token("example");
26312 /// ```
26313 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26314 mut self,
26315 v: T,
26316 ) -> Self {
26317 self.attribution_token = v.into();
26318 self
26319 }
26320
26321 /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26322 ///
26323 /// # Example
26324 /// ```ignore,no_run
26325 /// # use google_cloud_retail_v2::model::UserEvent;
26326 /// use google_cloud_retail_v2::model::ProductDetail;
26327 /// let x = UserEvent::new()
26328 /// .set_product_details([
26329 /// ProductDetail::default()/* use setters */,
26330 /// ProductDetail::default()/* use (different) setters */,
26331 /// ]);
26332 /// ```
26333 pub fn set_product_details<T, V>(mut self, v: T) -> Self
26334 where
26335 T: std::iter::IntoIterator<Item = V>,
26336 V: std::convert::Into<crate::model::ProductDetail>,
26337 {
26338 use std::iter::Iterator;
26339 self.product_details = v.into_iter().map(|i| i.into()).collect();
26340 self
26341 }
26342
26343 /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26344 ///
26345 /// # Example
26346 /// ```ignore,no_run
26347 /// # use google_cloud_retail_v2::model::UserEvent;
26348 /// use google_cloud_retail_v2::model::CompletionDetail;
26349 /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26350 /// ```
26351 pub fn set_completion_detail<T>(mut self, v: T) -> Self
26352 where
26353 T: std::convert::Into<crate::model::CompletionDetail>,
26354 {
26355 self.completion_detail = std::option::Option::Some(v.into());
26356 self
26357 }
26358
26359 /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26360 ///
26361 /// # Example
26362 /// ```ignore,no_run
26363 /// # use google_cloud_retail_v2::model::UserEvent;
26364 /// use google_cloud_retail_v2::model::CompletionDetail;
26365 /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26366 /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26367 /// ```
26368 pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26369 where
26370 T: std::convert::Into<crate::model::CompletionDetail>,
26371 {
26372 self.completion_detail = v.map(|x| x.into());
26373 self
26374 }
26375
26376 /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26377 ///
26378 /// # Example
26379 /// ```ignore,no_run
26380 /// # use google_cloud_retail_v2::model::UserEvent;
26381 /// use google_cloud_retail_v2::model::CustomAttribute;
26382 /// let x = UserEvent::new().set_attributes([
26383 /// ("key0", CustomAttribute::default()/* use setters */),
26384 /// ("key1", CustomAttribute::default()/* use (different) setters */),
26385 /// ]);
26386 /// ```
26387 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26388 where
26389 T: std::iter::IntoIterator<Item = (K, V)>,
26390 K: std::convert::Into<std::string::String>,
26391 V: std::convert::Into<crate::model::CustomAttribute>,
26392 {
26393 use std::iter::Iterator;
26394 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26395 self
26396 }
26397
26398 /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26399 ///
26400 /// # Example
26401 /// ```ignore,no_run
26402 /// # use google_cloud_retail_v2::model::UserEvent;
26403 /// let x = UserEvent::new().set_cart_id("example");
26404 /// ```
26405 pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26406 self.cart_id = v.into();
26407 self
26408 }
26409
26410 /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26411 ///
26412 /// # Example
26413 /// ```ignore,no_run
26414 /// # use google_cloud_retail_v2::model::UserEvent;
26415 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26416 /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26417 /// ```
26418 pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26419 where
26420 T: std::convert::Into<crate::model::PurchaseTransaction>,
26421 {
26422 self.purchase_transaction = std::option::Option::Some(v.into());
26423 self
26424 }
26425
26426 /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26427 ///
26428 /// # Example
26429 /// ```ignore,no_run
26430 /// # use google_cloud_retail_v2::model::UserEvent;
26431 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26432 /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26433 /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26434 /// ```
26435 pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26436 where
26437 T: std::convert::Into<crate::model::PurchaseTransaction>,
26438 {
26439 self.purchase_transaction = v.map(|x| x.into());
26440 self
26441 }
26442
26443 /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26444 ///
26445 /// # Example
26446 /// ```ignore,no_run
26447 /// # use google_cloud_retail_v2::model::UserEvent;
26448 /// let x = UserEvent::new().set_search_query("example");
26449 /// ```
26450 pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26451 self.search_query = v.into();
26452 self
26453 }
26454
26455 /// Sets the value of [filter][crate::model::UserEvent::filter].
26456 ///
26457 /// # Example
26458 /// ```ignore,no_run
26459 /// # use google_cloud_retail_v2::model::UserEvent;
26460 /// let x = UserEvent::new().set_filter("example");
26461 /// ```
26462 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26463 self.filter = v.into();
26464 self
26465 }
26466
26467 /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26468 ///
26469 /// # Example
26470 /// ```ignore,no_run
26471 /// # use google_cloud_retail_v2::model::UserEvent;
26472 /// let x = UserEvent::new().set_order_by("example");
26473 /// ```
26474 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26475 self.order_by = v.into();
26476 self
26477 }
26478
26479 /// Sets the value of [offset][crate::model::UserEvent::offset].
26480 ///
26481 /// # Example
26482 /// ```ignore,no_run
26483 /// # use google_cloud_retail_v2::model::UserEvent;
26484 /// let x = UserEvent::new().set_offset(42);
26485 /// ```
26486 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26487 self.offset = v.into();
26488 self
26489 }
26490
26491 /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26492 ///
26493 /// # Example
26494 /// ```ignore,no_run
26495 /// # use google_cloud_retail_v2::model::UserEvent;
26496 /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26497 /// ```
26498 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26499 where
26500 T: std::iter::IntoIterator<Item = V>,
26501 V: std::convert::Into<std::string::String>,
26502 {
26503 use std::iter::Iterator;
26504 self.page_categories = v.into_iter().map(|i| i.into()).collect();
26505 self
26506 }
26507
26508 /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26509 ///
26510 /// # Example
26511 /// ```ignore,no_run
26512 /// # use google_cloud_retail_v2::model::UserEvent;
26513 /// use google_cloud_retail_v2::model::UserInfo;
26514 /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26515 /// ```
26516 pub fn set_user_info<T>(mut self, v: T) -> Self
26517 where
26518 T: std::convert::Into<crate::model::UserInfo>,
26519 {
26520 self.user_info = std::option::Option::Some(v.into());
26521 self
26522 }
26523
26524 /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26525 ///
26526 /// # Example
26527 /// ```ignore,no_run
26528 /// # use google_cloud_retail_v2::model::UserEvent;
26529 /// use google_cloud_retail_v2::model::UserInfo;
26530 /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26531 /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26532 /// ```
26533 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26534 where
26535 T: std::convert::Into<crate::model::UserInfo>,
26536 {
26537 self.user_info = v.map(|x| x.into());
26538 self
26539 }
26540
26541 /// Sets the value of [uri][crate::model::UserEvent::uri].
26542 ///
26543 /// # Example
26544 /// ```ignore,no_run
26545 /// # use google_cloud_retail_v2::model::UserEvent;
26546 /// let x = UserEvent::new().set_uri("example");
26547 /// ```
26548 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26549 self.uri = v.into();
26550 self
26551 }
26552
26553 /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26554 ///
26555 /// # Example
26556 /// ```ignore,no_run
26557 /// # use google_cloud_retail_v2::model::UserEvent;
26558 /// let x = UserEvent::new().set_referrer_uri("example");
26559 /// ```
26560 pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26561 self.referrer_uri = v.into();
26562 self
26563 }
26564
26565 /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26566 ///
26567 /// # Example
26568 /// ```ignore,no_run
26569 /// # use google_cloud_retail_v2::model::UserEvent;
26570 /// let x = UserEvent::new().set_page_view_id("example");
26571 /// ```
26572 pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26573 self.page_view_id = v.into();
26574 self
26575 }
26576
26577 /// Sets the value of [entity][crate::model::UserEvent::entity].
26578 ///
26579 /// # Example
26580 /// ```ignore,no_run
26581 /// # use google_cloud_retail_v2::model::UserEvent;
26582 /// let x = UserEvent::new().set_entity("example");
26583 /// ```
26584 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26585 self.entity = v.into();
26586 self
26587 }
26588}
26589
26590impl wkt::message::Message for UserEvent {
26591 fn typename() -> &'static str {
26592 "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26593 }
26594}
26595
26596/// Detailed product information associated with a user event.
26597#[derive(Clone, Default, PartialEq)]
26598#[non_exhaustive]
26599pub struct ProductDetail {
26600 /// Required. [Product][google.cloud.retail.v2.Product] information.
26601 ///
26602 /// Required field(s):
26603 ///
26604 /// * [Product.id][google.cloud.retail.v2.Product.id]
26605 ///
26606 /// Optional override field(s):
26607 ///
26608 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26609 ///
26610 /// If any supported optional fields are provided, we will treat them as a full
26611 /// override when looking up product information from the catalog. Thus, it is
26612 /// important to ensure that the overriding fields are accurate and
26613 /// complete.
26614 ///
26615 /// All other product fields are ignored and instead populated via catalog
26616 /// lookup after event ingestion.
26617 ///
26618 /// [google.cloud.retail.v2.Product]: crate::model::Product
26619 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26620 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26621 pub product: std::option::Option<crate::model::Product>,
26622
26623 /// Quantity of the product associated with the user event.
26624 ///
26625 /// For example, this field will be 2 if two products are added to the shopping
26626 /// cart for `purchase-complete` event. Required for `add-to-cart` and
26627 /// `purchase-complete` event types.
26628 pub quantity: std::option::Option<wkt::Int32Value>,
26629
26630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26631}
26632
26633impl ProductDetail {
26634 pub fn new() -> Self {
26635 std::default::Default::default()
26636 }
26637
26638 /// Sets the value of [product][crate::model::ProductDetail::product].
26639 ///
26640 /// # Example
26641 /// ```ignore,no_run
26642 /// # use google_cloud_retail_v2::model::ProductDetail;
26643 /// use google_cloud_retail_v2::model::Product;
26644 /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
26645 /// ```
26646 pub fn set_product<T>(mut self, v: T) -> Self
26647 where
26648 T: std::convert::Into<crate::model::Product>,
26649 {
26650 self.product = std::option::Option::Some(v.into());
26651 self
26652 }
26653
26654 /// Sets or clears the value of [product][crate::model::ProductDetail::product].
26655 ///
26656 /// # Example
26657 /// ```ignore,no_run
26658 /// # use google_cloud_retail_v2::model::ProductDetail;
26659 /// use google_cloud_retail_v2::model::Product;
26660 /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
26661 /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
26662 /// ```
26663 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
26664 where
26665 T: std::convert::Into<crate::model::Product>,
26666 {
26667 self.product = v.map(|x| x.into());
26668 self
26669 }
26670
26671 /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
26672 ///
26673 /// # Example
26674 /// ```ignore,no_run
26675 /// # use google_cloud_retail_v2::model::ProductDetail;
26676 /// use wkt::Int32Value;
26677 /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
26678 /// ```
26679 pub fn set_quantity<T>(mut self, v: T) -> Self
26680 where
26681 T: std::convert::Into<wkt::Int32Value>,
26682 {
26683 self.quantity = std::option::Option::Some(v.into());
26684 self
26685 }
26686
26687 /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
26688 ///
26689 /// # Example
26690 /// ```ignore,no_run
26691 /// # use google_cloud_retail_v2::model::ProductDetail;
26692 /// use wkt::Int32Value;
26693 /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
26694 /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
26695 /// ```
26696 pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
26697 where
26698 T: std::convert::Into<wkt::Int32Value>,
26699 {
26700 self.quantity = v.map(|x| x.into());
26701 self
26702 }
26703}
26704
26705impl wkt::message::Message for ProductDetail {
26706 fn typename() -> &'static str {
26707 "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
26708 }
26709}
26710
26711/// Detailed completion information including completion attribution token and
26712/// clicked completion info.
26713#[derive(Clone, Default, PartialEq)]
26714#[non_exhaustive]
26715pub struct CompletionDetail {
26716 /// Completion attribution token in
26717 /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
26718 ///
26719 /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
26720 pub completion_attribution_token: std::string::String,
26721
26722 /// End user selected
26723 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
26724 ///
26725 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26726 pub selected_suggestion: std::string::String,
26727
26728 /// End user selected
26729 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
26730 /// position, starting from 0.
26731 ///
26732 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26733 pub selected_position: i32,
26734
26735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26736}
26737
26738impl CompletionDetail {
26739 pub fn new() -> Self {
26740 std::default::Default::default()
26741 }
26742
26743 /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
26744 ///
26745 /// # Example
26746 /// ```ignore,no_run
26747 /// # use google_cloud_retail_v2::model::CompletionDetail;
26748 /// let x = CompletionDetail::new().set_completion_attribution_token("example");
26749 /// ```
26750 pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
26751 mut self,
26752 v: T,
26753 ) -> Self {
26754 self.completion_attribution_token = v.into();
26755 self
26756 }
26757
26758 /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
26759 ///
26760 /// # Example
26761 /// ```ignore,no_run
26762 /// # use google_cloud_retail_v2::model::CompletionDetail;
26763 /// let x = CompletionDetail::new().set_selected_suggestion("example");
26764 /// ```
26765 pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
26766 mut self,
26767 v: T,
26768 ) -> Self {
26769 self.selected_suggestion = v.into();
26770 self
26771 }
26772
26773 /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
26774 ///
26775 /// # Example
26776 /// ```ignore,no_run
26777 /// # use google_cloud_retail_v2::model::CompletionDetail;
26778 /// let x = CompletionDetail::new().set_selected_position(42);
26779 /// ```
26780 pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26781 self.selected_position = v.into();
26782 self
26783 }
26784}
26785
26786impl wkt::message::Message for CompletionDetail {
26787 fn typename() -> &'static str {
26788 "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
26789 }
26790}
26791
26792/// A transaction represents the entire purchase transaction.
26793#[derive(Clone, Default, PartialEq)]
26794#[non_exhaustive]
26795pub struct PurchaseTransaction {
26796 /// The transaction ID with a length limit of 128 characters.
26797 pub id: std::string::String,
26798
26799 /// Required. Total non-zero revenue or grand total associated with the
26800 /// transaction. This value include shipping, tax, or other adjustments to
26801 /// total revenue that you want to include as part of your revenue
26802 /// calculations.
26803 pub revenue: f32,
26804
26805 /// All the taxes associated with the transaction.
26806 pub tax: f32,
26807
26808 /// All the costs associated with the products. These can be manufacturing
26809 /// costs, shipping expenses not borne by the end user, or any other costs,
26810 /// such that:
26811 ///
26812 /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
26813 /// [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
26814 /// [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
26815 ///
26816 /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
26817 /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
26818 /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
26819 pub cost: f32,
26820
26821 /// Required. Currency code. Use three-character ISO-4217 code.
26822 pub currency_code: std::string::String,
26823
26824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26825}
26826
26827impl PurchaseTransaction {
26828 pub fn new() -> Self {
26829 std::default::Default::default()
26830 }
26831
26832 /// Sets the value of [id][crate::model::PurchaseTransaction::id].
26833 ///
26834 /// # Example
26835 /// ```ignore,no_run
26836 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26837 /// let x = PurchaseTransaction::new().set_id("example");
26838 /// ```
26839 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26840 self.id = v.into();
26841 self
26842 }
26843
26844 /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
26845 ///
26846 /// # Example
26847 /// ```ignore,no_run
26848 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26849 /// let x = PurchaseTransaction::new().set_revenue(42.0);
26850 /// ```
26851 pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26852 self.revenue = v.into();
26853 self
26854 }
26855
26856 /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
26857 ///
26858 /// # Example
26859 /// ```ignore,no_run
26860 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26861 /// let x = PurchaseTransaction::new().set_tax(42.0);
26862 /// ```
26863 pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26864 self.tax = v.into();
26865 self
26866 }
26867
26868 /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
26869 ///
26870 /// # Example
26871 /// ```ignore,no_run
26872 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26873 /// let x = PurchaseTransaction::new().set_cost(42.0);
26874 /// ```
26875 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26876 self.cost = v.into();
26877 self
26878 }
26879
26880 /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
26881 ///
26882 /// # Example
26883 /// ```ignore,no_run
26884 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26885 /// let x = PurchaseTransaction::new().set_currency_code("example");
26886 /// ```
26887 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26888 self.currency_code = v.into();
26889 self
26890 }
26891}
26892
26893impl wkt::message::Message for PurchaseTransaction {
26894 fn typename() -> &'static str {
26895 "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
26896 }
26897}
26898
26899/// Request message for WriteUserEvent method.
26900#[derive(Clone, Default, PartialEq)]
26901#[non_exhaustive]
26902pub struct WriteUserEventRequest {
26903 /// Required. The parent catalog resource name, such as
26904 /// `projects/1234/locations/global/catalogs/default_catalog`.
26905 pub parent: std::string::String,
26906
26907 /// Required. User event to write.
26908 pub user_event: std::option::Option<crate::model::UserEvent>,
26909
26910 /// If set to true, the user event will be written asynchronously after
26911 /// validation, and the API will respond without waiting for the write.
26912 /// Therefore, silent failures can occur even if the API returns success. In
26913 /// case of silent failures, error messages can be found in Stackdriver logs.
26914 pub write_async: bool,
26915
26916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26917}
26918
26919impl WriteUserEventRequest {
26920 pub fn new() -> Self {
26921 std::default::Default::default()
26922 }
26923
26924 /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
26925 ///
26926 /// # Example
26927 /// ```ignore,no_run
26928 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26929 /// let x = WriteUserEventRequest::new().set_parent("example");
26930 /// ```
26931 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26932 self.parent = v.into();
26933 self
26934 }
26935
26936 /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26937 ///
26938 /// # Example
26939 /// ```ignore,no_run
26940 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26941 /// use google_cloud_retail_v2::model::UserEvent;
26942 /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
26943 /// ```
26944 pub fn set_user_event<T>(mut self, v: T) -> Self
26945 where
26946 T: std::convert::Into<crate::model::UserEvent>,
26947 {
26948 self.user_event = std::option::Option::Some(v.into());
26949 self
26950 }
26951
26952 /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26953 ///
26954 /// # Example
26955 /// ```ignore,no_run
26956 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26957 /// use google_cloud_retail_v2::model::UserEvent;
26958 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
26959 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
26960 /// ```
26961 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
26962 where
26963 T: std::convert::Into<crate::model::UserEvent>,
26964 {
26965 self.user_event = v.map(|x| x.into());
26966 self
26967 }
26968
26969 /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
26970 ///
26971 /// # Example
26972 /// ```ignore,no_run
26973 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26974 /// let x = WriteUserEventRequest::new().set_write_async(true);
26975 /// ```
26976 pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
26977 self.write_async = v.into();
26978 self
26979 }
26980}
26981
26982impl wkt::message::Message for WriteUserEventRequest {
26983 fn typename() -> &'static str {
26984 "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
26985 }
26986}
26987
26988/// Request message for CollectUserEvent method.
26989#[derive(Clone, Default, PartialEq)]
26990#[non_exhaustive]
26991pub struct CollectUserEventRequest {
26992 /// Required. The parent catalog name, such as
26993 /// `projects/1234/locations/global/catalogs/default_catalog`.
26994 pub parent: std::string::String,
26995
26996 /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
26997 /// characters.
26998 pub user_event: std::string::String,
26999
27000 /// The URL including cgi-parameters but excluding the hash fragment with a
27001 /// length limit of 5,000 characters. This is often more useful than the
27002 /// referer URL, because many browsers only send the domain for 3rd party
27003 /// requests.
27004 pub uri: std::string::String,
27005
27006 /// The event timestamp in milliseconds. This prevents browser caching of
27007 /// otherwise identical get requests. The name is abbreviated to reduce the
27008 /// payload bytes.
27009 pub ets: i64,
27010
27011 /// An arbitrary serialized JSON string that contains necessary information
27012 /// that can comprise a user event. When this field is specified, the
27013 /// user_event field will be ignored. Note: line-delimited JSON is not
27014 /// supported, a single JSON only.
27015 pub raw_json: std::string::String,
27016
27017 /// The rule that can convert the raw_json to a user event. It is needed
27018 /// only when the raw_json is set.
27019 pub conversion_rule:
27020 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27021
27022 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27023}
27024
27025impl CollectUserEventRequest {
27026 pub fn new() -> Self {
27027 std::default::Default::default()
27028 }
27029
27030 /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27031 ///
27032 /// # Example
27033 /// ```ignore,no_run
27034 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27035 /// let x = CollectUserEventRequest::new().set_parent("example");
27036 /// ```
27037 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27038 self.parent = v.into();
27039 self
27040 }
27041
27042 /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27043 ///
27044 /// # Example
27045 /// ```ignore,no_run
27046 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27047 /// let x = CollectUserEventRequest::new().set_user_event("example");
27048 /// ```
27049 pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27050 self.user_event = v.into();
27051 self
27052 }
27053
27054 /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27055 ///
27056 /// # Example
27057 /// ```ignore,no_run
27058 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27059 /// let x = CollectUserEventRequest::new().set_uri("example");
27060 /// ```
27061 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27062 self.uri = v.into();
27063 self
27064 }
27065
27066 /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27067 ///
27068 /// # Example
27069 /// ```ignore,no_run
27070 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27071 /// let x = CollectUserEventRequest::new().set_ets(42);
27072 /// ```
27073 pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27074 self.ets = v.into();
27075 self
27076 }
27077
27078 /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27079 ///
27080 /// # Example
27081 /// ```ignore,no_run
27082 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27083 /// let x = CollectUserEventRequest::new().set_raw_json("example");
27084 /// ```
27085 pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27086 self.raw_json = v.into();
27087 self
27088 }
27089
27090 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27091 ///
27092 /// Note that all the setters affecting `conversion_rule` are mutually
27093 /// exclusive.
27094 ///
27095 /// # Example
27096 /// ```ignore,no_run
27097 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27098 /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27099 /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27100 /// ```
27101 pub fn set_conversion_rule<
27102 T: std::convert::Into<
27103 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27104 >,
27105 >(
27106 mut self,
27107 v: T,
27108 ) -> Self {
27109 self.conversion_rule = v.into();
27110 self
27111 }
27112
27113 /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27114 /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27115 /// holds a different branch.
27116 pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27117 #[allow(unreachable_patterns)]
27118 self.conversion_rule.as_ref().and_then(|v| match v {
27119 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27120 std::option::Option::Some(v)
27121 }
27122 _ => std::option::Option::None,
27123 })
27124 }
27125
27126 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27127 /// to hold a `PrebuiltRule`.
27128 ///
27129 /// Note that all the setters affecting `conversion_rule` are
27130 /// mutually exclusive.
27131 ///
27132 /// # Example
27133 /// ```ignore,no_run
27134 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27135 /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27136 /// assert!(x.prebuilt_rule().is_some());
27137 /// ```
27138 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27139 self.conversion_rule = std::option::Option::Some(
27140 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27141 );
27142 self
27143 }
27144}
27145
27146impl wkt::message::Message for CollectUserEventRequest {
27147 fn typename() -> &'static str {
27148 "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27149 }
27150}
27151
27152/// Defines additional types related to [CollectUserEventRequest].
27153pub mod collect_user_event_request {
27154 #[allow(unused_imports)]
27155 use super::*;
27156
27157 /// The rule that can convert the raw_json to a user event. It is needed
27158 /// only when the raw_json is set.
27159 #[derive(Clone, Debug, PartialEq)]
27160 #[non_exhaustive]
27161 pub enum ConversionRule {
27162 /// The prebuilt rule name that can convert a specific type of raw_json.
27163 /// For example: "ga4_bq" rule for the GA4 user event schema.
27164 PrebuiltRule(std::string::String),
27165 }
27166}
27167
27168/// Request message for RejoinUserEvents method.
27169#[derive(Clone, Default, PartialEq)]
27170#[non_exhaustive]
27171pub struct RejoinUserEventsRequest {
27172 /// Required. The parent catalog resource name, such as
27173 /// `projects/1234/locations/global/catalogs/default_catalog`.
27174 pub parent: std::string::String,
27175
27176 /// The type of the user event rejoin to define the scope and range of the user
27177 /// events to be rejoined with the latest product catalog. Defaults to
27178 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27179 /// an invalid integer value.
27180 pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27181
27182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27183}
27184
27185impl RejoinUserEventsRequest {
27186 pub fn new() -> Self {
27187 std::default::Default::default()
27188 }
27189
27190 /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27191 ///
27192 /// # Example
27193 /// ```ignore,no_run
27194 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27195 /// let x = RejoinUserEventsRequest::new().set_parent("example");
27196 /// ```
27197 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27198 self.parent = v.into();
27199 self
27200 }
27201
27202 /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27203 ///
27204 /// # Example
27205 /// ```ignore,no_run
27206 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27207 /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27208 /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27209 /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27210 /// ```
27211 pub fn set_user_event_rejoin_scope<
27212 T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27213 >(
27214 mut self,
27215 v: T,
27216 ) -> Self {
27217 self.user_event_rejoin_scope = v.into();
27218 self
27219 }
27220}
27221
27222impl wkt::message::Message for RejoinUserEventsRequest {
27223 fn typename() -> &'static str {
27224 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27225 }
27226}
27227
27228/// Defines additional types related to [RejoinUserEventsRequest].
27229pub mod rejoin_user_events_request {
27230 #[allow(unused_imports)]
27231 use super::*;
27232
27233 /// The scope of user events to be rejoined with the latest product catalog.
27234 /// If the rejoining aims at reducing number of unjoined events, set
27235 /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27236 /// If the rejoining aims at correcting product catalog information in joined
27237 /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27238 /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27239 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27240 ///
27241 /// # Working with unknown values
27242 ///
27243 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27244 /// additional enum variants at any time. Adding new variants is not considered
27245 /// a breaking change. Applications should write their code in anticipation of:
27246 ///
27247 /// - New values appearing in future releases of the client library, **and**
27248 /// - New values received dynamically, without application changes.
27249 ///
27250 /// Please consult the [Working with enums] section in the user guide for some
27251 /// guidelines.
27252 ///
27253 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27254 #[derive(Clone, Debug, PartialEq)]
27255 #[non_exhaustive]
27256 pub enum UserEventRejoinScope {
27257 /// Rejoin all events with the latest product catalog, including both joined
27258 /// events and unjoined events.
27259 Unspecified,
27260 /// Only rejoin joined events with the latest product catalog.
27261 JoinedEvents,
27262 /// Only rejoin unjoined events with the latest product catalog.
27263 UnjoinedEvents,
27264 /// If set, the enum was initialized with an unknown value.
27265 ///
27266 /// Applications can examine the value using [UserEventRejoinScope::value] or
27267 /// [UserEventRejoinScope::name].
27268 UnknownValue(user_event_rejoin_scope::UnknownValue),
27269 }
27270
27271 #[doc(hidden)]
27272 pub mod user_event_rejoin_scope {
27273 #[allow(unused_imports)]
27274 use super::*;
27275 #[derive(Clone, Debug, PartialEq)]
27276 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27277 }
27278
27279 impl UserEventRejoinScope {
27280 /// Gets the enum value.
27281 ///
27282 /// Returns `None` if the enum contains an unknown value deserialized from
27283 /// the string representation of enums.
27284 pub fn value(&self) -> std::option::Option<i32> {
27285 match self {
27286 Self::Unspecified => std::option::Option::Some(0),
27287 Self::JoinedEvents => std::option::Option::Some(1),
27288 Self::UnjoinedEvents => std::option::Option::Some(2),
27289 Self::UnknownValue(u) => u.0.value(),
27290 }
27291 }
27292
27293 /// Gets the enum value as a string.
27294 ///
27295 /// Returns `None` if the enum contains an unknown value deserialized from
27296 /// the integer representation of enums.
27297 pub fn name(&self) -> std::option::Option<&str> {
27298 match self {
27299 Self::Unspecified => {
27300 std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27301 }
27302 Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27303 Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27304 Self::UnknownValue(u) => u.0.name(),
27305 }
27306 }
27307 }
27308
27309 impl std::default::Default for UserEventRejoinScope {
27310 fn default() -> Self {
27311 use std::convert::From;
27312 Self::from(0)
27313 }
27314 }
27315
27316 impl std::fmt::Display for UserEventRejoinScope {
27317 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27318 wkt::internal::display_enum(f, self.name(), self.value())
27319 }
27320 }
27321
27322 impl std::convert::From<i32> for UserEventRejoinScope {
27323 fn from(value: i32) -> Self {
27324 match value {
27325 0 => Self::Unspecified,
27326 1 => Self::JoinedEvents,
27327 2 => Self::UnjoinedEvents,
27328 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27329 wkt::internal::UnknownEnumValue::Integer(value),
27330 )),
27331 }
27332 }
27333 }
27334
27335 impl std::convert::From<&str> for UserEventRejoinScope {
27336 fn from(value: &str) -> Self {
27337 use std::string::ToString;
27338 match value {
27339 "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27340 "JOINED_EVENTS" => Self::JoinedEvents,
27341 "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27342 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27343 wkt::internal::UnknownEnumValue::String(value.to_string()),
27344 )),
27345 }
27346 }
27347 }
27348
27349 impl serde::ser::Serialize for UserEventRejoinScope {
27350 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27351 where
27352 S: serde::Serializer,
27353 {
27354 match self {
27355 Self::Unspecified => serializer.serialize_i32(0),
27356 Self::JoinedEvents => serializer.serialize_i32(1),
27357 Self::UnjoinedEvents => serializer.serialize_i32(2),
27358 Self::UnknownValue(u) => u.0.serialize(serializer),
27359 }
27360 }
27361 }
27362
27363 impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27364 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27365 where
27366 D: serde::Deserializer<'de>,
27367 {
27368 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27369 ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27370 ))
27371 }
27372 }
27373}
27374
27375/// Response message for `RejoinUserEvents` method.
27376#[derive(Clone, Default, PartialEq)]
27377#[non_exhaustive]
27378pub struct RejoinUserEventsResponse {
27379 /// Number of user events that were joined with latest product catalog.
27380 pub rejoined_user_events_count: i64,
27381
27382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27383}
27384
27385impl RejoinUserEventsResponse {
27386 pub fn new() -> Self {
27387 std::default::Default::default()
27388 }
27389
27390 /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27391 ///
27392 /// # Example
27393 /// ```ignore,no_run
27394 /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27395 /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27396 /// ```
27397 pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27398 self.rejoined_user_events_count = v.into();
27399 self
27400 }
27401}
27402
27403impl wkt::message::Message for RejoinUserEventsResponse {
27404 fn typename() -> &'static str {
27405 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27406 }
27407}
27408
27409/// Metadata for `RejoinUserEvents` method.
27410#[derive(Clone, Default, PartialEq)]
27411#[non_exhaustive]
27412pub struct RejoinUserEventsMetadata {
27413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27414}
27415
27416impl RejoinUserEventsMetadata {
27417 pub fn new() -> Self {
27418 std::default::Default::default()
27419 }
27420}
27421
27422impl wkt::message::Message for RejoinUserEventsMetadata {
27423 fn typename() -> &'static str {
27424 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27425 }
27426}
27427
27428/// At which level we offer configuration for attributes.
27429///
27430/// # Working with unknown values
27431///
27432/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27433/// additional enum variants at any time. Adding new variants is not considered
27434/// a breaking change. Applications should write their code in anticipation of:
27435///
27436/// - New values appearing in future releases of the client library, **and**
27437/// - New values received dynamically, without application changes.
27438///
27439/// Please consult the [Working with enums] section in the user guide for some
27440/// guidelines.
27441///
27442/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27443#[derive(Clone, Debug, PartialEq)]
27444#[non_exhaustive]
27445pub enum AttributeConfigLevel {
27446 /// Value used when unset. In this case, server behavior defaults to
27447 /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27448 ///
27449 /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27450 Unspecified,
27451 /// At this level, we honor the attribute configurations set in
27452 /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27453 ///
27454 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27455 ProductLevelAttributeConfig,
27456 /// At this level, we honor the attribute configurations set in
27457 /// `CatalogConfig.attribute_configs`.
27458 CatalogLevelAttributeConfig,
27459 /// If set, the enum was initialized with an unknown value.
27460 ///
27461 /// Applications can examine the value using [AttributeConfigLevel::value] or
27462 /// [AttributeConfigLevel::name].
27463 UnknownValue(attribute_config_level::UnknownValue),
27464}
27465
27466#[doc(hidden)]
27467pub mod attribute_config_level {
27468 #[allow(unused_imports)]
27469 use super::*;
27470 #[derive(Clone, Debug, PartialEq)]
27471 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27472}
27473
27474impl AttributeConfigLevel {
27475 /// Gets the enum value.
27476 ///
27477 /// Returns `None` if the enum contains an unknown value deserialized from
27478 /// the string representation of enums.
27479 pub fn value(&self) -> std::option::Option<i32> {
27480 match self {
27481 Self::Unspecified => std::option::Option::Some(0),
27482 Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27483 Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27484 Self::UnknownValue(u) => u.0.value(),
27485 }
27486 }
27487
27488 /// Gets the enum value as a string.
27489 ///
27490 /// Returns `None` if the enum contains an unknown value deserialized from
27491 /// the integer representation of enums.
27492 pub fn name(&self) -> std::option::Option<&str> {
27493 match self {
27494 Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27495 Self::ProductLevelAttributeConfig => {
27496 std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27497 }
27498 Self::CatalogLevelAttributeConfig => {
27499 std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27500 }
27501 Self::UnknownValue(u) => u.0.name(),
27502 }
27503 }
27504}
27505
27506impl std::default::Default for AttributeConfigLevel {
27507 fn default() -> Self {
27508 use std::convert::From;
27509 Self::from(0)
27510 }
27511}
27512
27513impl std::fmt::Display for AttributeConfigLevel {
27514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27515 wkt::internal::display_enum(f, self.name(), self.value())
27516 }
27517}
27518
27519impl std::convert::From<i32> for AttributeConfigLevel {
27520 fn from(value: i32) -> Self {
27521 match value {
27522 0 => Self::Unspecified,
27523 1 => Self::ProductLevelAttributeConfig,
27524 2 => Self::CatalogLevelAttributeConfig,
27525 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27526 wkt::internal::UnknownEnumValue::Integer(value),
27527 )),
27528 }
27529 }
27530}
27531
27532impl std::convert::From<&str> for AttributeConfigLevel {
27533 fn from(value: &str) -> Self {
27534 use std::string::ToString;
27535 match value {
27536 "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27537 "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27538 "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27539 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27540 wkt::internal::UnknownEnumValue::String(value.to_string()),
27541 )),
27542 }
27543 }
27544}
27545
27546impl serde::ser::Serialize for AttributeConfigLevel {
27547 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27548 where
27549 S: serde::Serializer,
27550 {
27551 match self {
27552 Self::Unspecified => serializer.serialize_i32(0),
27553 Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27554 Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27555 Self::UnknownValue(u) => u.0.serialize(serializer),
27556 }
27557 }
27558}
27559
27560impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27561 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27562 where
27563 D: serde::Deserializer<'de>,
27564 {
27565 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27566 ".google.cloud.retail.v2.AttributeConfigLevel",
27567 ))
27568 }
27569}
27570
27571/// The type of solution.
27572///
27573/// # Working with unknown values
27574///
27575/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27576/// additional enum variants at any time. Adding new variants is not considered
27577/// a breaking change. Applications should write their code in anticipation of:
27578///
27579/// - New values appearing in future releases of the client library, **and**
27580/// - New values received dynamically, without application changes.
27581///
27582/// Please consult the [Working with enums] section in the user guide for some
27583/// guidelines.
27584///
27585/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27586#[derive(Clone, Debug, PartialEq)]
27587#[non_exhaustive]
27588pub enum SolutionType {
27589 /// Default value.
27590 Unspecified,
27591 /// Used for Recommendations AI.
27592 Recommendation,
27593 /// Used for Retail Search.
27594 Search,
27595 /// If set, the enum was initialized with an unknown value.
27596 ///
27597 /// Applications can examine the value using [SolutionType::value] or
27598 /// [SolutionType::name].
27599 UnknownValue(solution_type::UnknownValue),
27600}
27601
27602#[doc(hidden)]
27603pub mod solution_type {
27604 #[allow(unused_imports)]
27605 use super::*;
27606 #[derive(Clone, Debug, PartialEq)]
27607 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27608}
27609
27610impl SolutionType {
27611 /// Gets the enum value.
27612 ///
27613 /// Returns `None` if the enum contains an unknown value deserialized from
27614 /// the string representation of enums.
27615 pub fn value(&self) -> std::option::Option<i32> {
27616 match self {
27617 Self::Unspecified => std::option::Option::Some(0),
27618 Self::Recommendation => std::option::Option::Some(1),
27619 Self::Search => std::option::Option::Some(2),
27620 Self::UnknownValue(u) => u.0.value(),
27621 }
27622 }
27623
27624 /// Gets the enum value as a string.
27625 ///
27626 /// Returns `None` if the enum contains an unknown value deserialized from
27627 /// the integer representation of enums.
27628 pub fn name(&self) -> std::option::Option<&str> {
27629 match self {
27630 Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
27631 Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
27632 Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
27633 Self::UnknownValue(u) => u.0.name(),
27634 }
27635 }
27636}
27637
27638impl std::default::Default for SolutionType {
27639 fn default() -> Self {
27640 use std::convert::From;
27641 Self::from(0)
27642 }
27643}
27644
27645impl std::fmt::Display for SolutionType {
27646 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27647 wkt::internal::display_enum(f, self.name(), self.value())
27648 }
27649}
27650
27651impl std::convert::From<i32> for SolutionType {
27652 fn from(value: i32) -> Self {
27653 match value {
27654 0 => Self::Unspecified,
27655 1 => Self::Recommendation,
27656 2 => Self::Search,
27657 _ => Self::UnknownValue(solution_type::UnknownValue(
27658 wkt::internal::UnknownEnumValue::Integer(value),
27659 )),
27660 }
27661 }
27662}
27663
27664impl std::convert::From<&str> for SolutionType {
27665 fn from(value: &str) -> Self {
27666 use std::string::ToString;
27667 match value {
27668 "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
27669 "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
27670 "SOLUTION_TYPE_SEARCH" => Self::Search,
27671 _ => Self::UnknownValue(solution_type::UnknownValue(
27672 wkt::internal::UnknownEnumValue::String(value.to_string()),
27673 )),
27674 }
27675 }
27676}
27677
27678impl serde::ser::Serialize for SolutionType {
27679 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27680 where
27681 S: serde::Serializer,
27682 {
27683 match self {
27684 Self::Unspecified => serializer.serialize_i32(0),
27685 Self::Recommendation => serializer.serialize_i32(1),
27686 Self::Search => serializer.serialize_i32(2),
27687 Self::UnknownValue(u) => u.0.serialize(serializer),
27688 }
27689 }
27690}
27691
27692impl<'de> serde::de::Deserialize<'de> for SolutionType {
27693 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27694 where
27695 D: serde::Deserializer<'de>,
27696 {
27697 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
27698 ".google.cloud.retail.v2.SolutionType",
27699 ))
27700 }
27701}
27702
27703/// If filtering for recommendations is enabled.
27704///
27705/// # Working with unknown values
27706///
27707/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27708/// additional enum variants at any time. Adding new variants is not considered
27709/// a breaking change. Applications should write their code in anticipation of:
27710///
27711/// - New values appearing in future releases of the client library, **and**
27712/// - New values received dynamically, without application changes.
27713///
27714/// Please consult the [Working with enums] section in the user guide for some
27715/// guidelines.
27716///
27717/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27718#[derive(Clone, Debug, PartialEq)]
27719#[non_exhaustive]
27720pub enum RecommendationsFilteringOption {
27721 /// Value used when unset.
27722 /// In this case, server behavior defaults to
27723 /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
27724 ///
27725 /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
27726 Unspecified,
27727 /// Recommendation filtering is disabled.
27728 RecommendationsFilteringDisabled,
27729 /// Recommendation filtering is enabled.
27730 RecommendationsFilteringEnabled,
27731 /// If set, the enum was initialized with an unknown value.
27732 ///
27733 /// Applications can examine the value using [RecommendationsFilteringOption::value] or
27734 /// [RecommendationsFilteringOption::name].
27735 UnknownValue(recommendations_filtering_option::UnknownValue),
27736}
27737
27738#[doc(hidden)]
27739pub mod recommendations_filtering_option {
27740 #[allow(unused_imports)]
27741 use super::*;
27742 #[derive(Clone, Debug, PartialEq)]
27743 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27744}
27745
27746impl RecommendationsFilteringOption {
27747 /// Gets the enum value.
27748 ///
27749 /// Returns `None` if the enum contains an unknown value deserialized from
27750 /// the string representation of enums.
27751 pub fn value(&self) -> std::option::Option<i32> {
27752 match self {
27753 Self::Unspecified => std::option::Option::Some(0),
27754 Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
27755 Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
27756 Self::UnknownValue(u) => u.0.value(),
27757 }
27758 }
27759
27760 /// Gets the enum value as a string.
27761 ///
27762 /// Returns `None` if the enum contains an unknown value deserialized from
27763 /// the integer representation of enums.
27764 pub fn name(&self) -> std::option::Option<&str> {
27765 match self {
27766 Self::Unspecified => {
27767 std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
27768 }
27769 Self::RecommendationsFilteringDisabled => {
27770 std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
27771 }
27772 Self::RecommendationsFilteringEnabled => {
27773 std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
27774 }
27775 Self::UnknownValue(u) => u.0.name(),
27776 }
27777 }
27778}
27779
27780impl std::default::Default for RecommendationsFilteringOption {
27781 fn default() -> Self {
27782 use std::convert::From;
27783 Self::from(0)
27784 }
27785}
27786
27787impl std::fmt::Display for RecommendationsFilteringOption {
27788 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27789 wkt::internal::display_enum(f, self.name(), self.value())
27790 }
27791}
27792
27793impl std::convert::From<i32> for RecommendationsFilteringOption {
27794 fn from(value: i32) -> Self {
27795 match value {
27796 0 => Self::Unspecified,
27797 1 => Self::RecommendationsFilteringDisabled,
27798 3 => Self::RecommendationsFilteringEnabled,
27799 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27800 wkt::internal::UnknownEnumValue::Integer(value),
27801 )),
27802 }
27803 }
27804}
27805
27806impl std::convert::From<&str> for RecommendationsFilteringOption {
27807 fn from(value: &str) -> Self {
27808 use std::string::ToString;
27809 match value {
27810 "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
27811 "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
27812 "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
27813 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27814 wkt::internal::UnknownEnumValue::String(value.to_string()),
27815 )),
27816 }
27817 }
27818}
27819
27820impl serde::ser::Serialize for RecommendationsFilteringOption {
27821 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27822 where
27823 S: serde::Serializer,
27824 {
27825 match self {
27826 Self::Unspecified => serializer.serialize_i32(0),
27827 Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
27828 Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
27829 Self::UnknownValue(u) => u.0.serialize(serializer),
27830 }
27831 }
27832}
27833
27834impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
27835 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27836 where
27837 D: serde::Deserializer<'de>,
27838 {
27839 deserializer.deserialize_any(
27840 wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
27841 ".google.cloud.retail.v2.RecommendationsFilteringOption",
27842 ),
27843 )
27844 }
27845}
27846
27847/// The use case of Cloud Retail Search.
27848///
27849/// # Working with unknown values
27850///
27851/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27852/// additional enum variants at any time. Adding new variants is not considered
27853/// a breaking change. Applications should write their code in anticipation of:
27854///
27855/// - New values appearing in future releases of the client library, **and**
27856/// - New values received dynamically, without application changes.
27857///
27858/// Please consult the [Working with enums] section in the user guide for some
27859/// guidelines.
27860///
27861/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27862#[derive(Clone, Debug, PartialEq)]
27863#[non_exhaustive]
27864pub enum SearchSolutionUseCase {
27865 /// The value when it's unspecified. In this case, server behavior defaults to
27866 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
27867 ///
27868 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
27869 Unspecified,
27870 /// Search use case. Expects the traffic has a non-empty
27871 /// [query][google.cloud.retail.v2.SearchRequest.query].
27872 ///
27873 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27874 Search,
27875 /// Browse use case. Expects the traffic has an empty
27876 /// [query][google.cloud.retail.v2.SearchRequest.query].
27877 ///
27878 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27879 Browse,
27880 /// If set, the enum was initialized with an unknown value.
27881 ///
27882 /// Applications can examine the value using [SearchSolutionUseCase::value] or
27883 /// [SearchSolutionUseCase::name].
27884 UnknownValue(search_solution_use_case::UnknownValue),
27885}
27886
27887#[doc(hidden)]
27888pub mod search_solution_use_case {
27889 #[allow(unused_imports)]
27890 use super::*;
27891 #[derive(Clone, Debug, PartialEq)]
27892 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27893}
27894
27895impl SearchSolutionUseCase {
27896 /// Gets the enum value.
27897 ///
27898 /// Returns `None` if the enum contains an unknown value deserialized from
27899 /// the string representation of enums.
27900 pub fn value(&self) -> std::option::Option<i32> {
27901 match self {
27902 Self::Unspecified => std::option::Option::Some(0),
27903 Self::Search => std::option::Option::Some(1),
27904 Self::Browse => std::option::Option::Some(2),
27905 Self::UnknownValue(u) => u.0.value(),
27906 }
27907 }
27908
27909 /// Gets the enum value as a string.
27910 ///
27911 /// Returns `None` if the enum contains an unknown value deserialized from
27912 /// the integer representation of enums.
27913 pub fn name(&self) -> std::option::Option<&str> {
27914 match self {
27915 Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
27916 Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
27917 Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
27918 Self::UnknownValue(u) => u.0.name(),
27919 }
27920 }
27921}
27922
27923impl std::default::Default for SearchSolutionUseCase {
27924 fn default() -> Self {
27925 use std::convert::From;
27926 Self::from(0)
27927 }
27928}
27929
27930impl std::fmt::Display for SearchSolutionUseCase {
27931 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27932 wkt::internal::display_enum(f, self.name(), self.value())
27933 }
27934}
27935
27936impl std::convert::From<i32> for SearchSolutionUseCase {
27937 fn from(value: i32) -> Self {
27938 match value {
27939 0 => Self::Unspecified,
27940 1 => Self::Search,
27941 2 => Self::Browse,
27942 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27943 wkt::internal::UnknownEnumValue::Integer(value),
27944 )),
27945 }
27946 }
27947}
27948
27949impl std::convert::From<&str> for SearchSolutionUseCase {
27950 fn from(value: &str) -> Self {
27951 use std::string::ToString;
27952 match value {
27953 "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
27954 "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
27955 "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
27956 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27957 wkt::internal::UnknownEnumValue::String(value.to_string()),
27958 )),
27959 }
27960 }
27961}
27962
27963impl serde::ser::Serialize for SearchSolutionUseCase {
27964 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27965 where
27966 S: serde::Serializer,
27967 {
27968 match self {
27969 Self::Unspecified => serializer.serialize_i32(0),
27970 Self::Search => serializer.serialize_i32(1),
27971 Self::Browse => serializer.serialize_i32(2),
27972 Self::UnknownValue(u) => u.0.serialize(serializer),
27973 }
27974 }
27975}
27976
27977impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
27978 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27979 where
27980 D: serde::Deserializer<'de>,
27981 {
27982 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
27983 ".google.cloud.retail.v2.SearchSolutionUseCase",
27984 ))
27985 }
27986}
27987
27988/// Harm categories that will block the content.
27989///
27990/// # Working with unknown values
27991///
27992/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27993/// additional enum variants at any time. Adding new variants is not considered
27994/// a breaking change. Applications should write their code in anticipation of:
27995///
27996/// - New values appearing in future releases of the client library, **and**
27997/// - New values received dynamically, without application changes.
27998///
27999/// Please consult the [Working with enums] section in the user guide for some
28000/// guidelines.
28001///
28002/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28003#[derive(Clone, Debug, PartialEq)]
28004#[non_exhaustive]
28005pub enum HarmCategory {
28006 /// The harm category is unspecified.
28007 Unspecified,
28008 /// The harm category is hate speech.
28009 HateSpeech,
28010 /// The harm category is dangerous content.
28011 DangerousContent,
28012 /// The harm category is harassment.
28013 Harassment,
28014 /// The harm category is sexually explicit content.
28015 SexuallyExplicit,
28016 /// The harm category is civic integrity.
28017 CivicIntegrity,
28018 /// If set, the enum was initialized with an unknown value.
28019 ///
28020 /// Applications can examine the value using [HarmCategory::value] or
28021 /// [HarmCategory::name].
28022 UnknownValue(harm_category::UnknownValue),
28023}
28024
28025#[doc(hidden)]
28026pub mod harm_category {
28027 #[allow(unused_imports)]
28028 use super::*;
28029 #[derive(Clone, Debug, PartialEq)]
28030 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28031}
28032
28033impl HarmCategory {
28034 /// Gets the enum value.
28035 ///
28036 /// Returns `None` if the enum contains an unknown value deserialized from
28037 /// the string representation of enums.
28038 pub fn value(&self) -> std::option::Option<i32> {
28039 match self {
28040 Self::Unspecified => std::option::Option::Some(0),
28041 Self::HateSpeech => std::option::Option::Some(1),
28042 Self::DangerousContent => std::option::Option::Some(2),
28043 Self::Harassment => std::option::Option::Some(3),
28044 Self::SexuallyExplicit => std::option::Option::Some(4),
28045 Self::CivicIntegrity => std::option::Option::Some(5),
28046 Self::UnknownValue(u) => u.0.value(),
28047 }
28048 }
28049
28050 /// Gets the enum value as a string.
28051 ///
28052 /// Returns `None` if the enum contains an unknown value deserialized from
28053 /// the integer representation of enums.
28054 pub fn name(&self) -> std::option::Option<&str> {
28055 match self {
28056 Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28057 Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28058 Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28059 Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28060 Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28061 Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28062 Self::UnknownValue(u) => u.0.name(),
28063 }
28064 }
28065}
28066
28067impl std::default::Default for HarmCategory {
28068 fn default() -> Self {
28069 use std::convert::From;
28070 Self::from(0)
28071 }
28072}
28073
28074impl std::fmt::Display for HarmCategory {
28075 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28076 wkt::internal::display_enum(f, self.name(), self.value())
28077 }
28078}
28079
28080impl std::convert::From<i32> for HarmCategory {
28081 fn from(value: i32) -> Self {
28082 match value {
28083 0 => Self::Unspecified,
28084 1 => Self::HateSpeech,
28085 2 => Self::DangerousContent,
28086 3 => Self::Harassment,
28087 4 => Self::SexuallyExplicit,
28088 5 => Self::CivicIntegrity,
28089 _ => Self::UnknownValue(harm_category::UnknownValue(
28090 wkt::internal::UnknownEnumValue::Integer(value),
28091 )),
28092 }
28093 }
28094}
28095
28096impl std::convert::From<&str> for HarmCategory {
28097 fn from(value: &str) -> Self {
28098 use std::string::ToString;
28099 match value {
28100 "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28101 "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28102 "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28103 "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28104 "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28105 "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28106 _ => Self::UnknownValue(harm_category::UnknownValue(
28107 wkt::internal::UnknownEnumValue::String(value.to_string()),
28108 )),
28109 }
28110 }
28111}
28112
28113impl serde::ser::Serialize for HarmCategory {
28114 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28115 where
28116 S: serde::Serializer,
28117 {
28118 match self {
28119 Self::Unspecified => serializer.serialize_i32(0),
28120 Self::HateSpeech => serializer.serialize_i32(1),
28121 Self::DangerousContent => serializer.serialize_i32(2),
28122 Self::Harassment => serializer.serialize_i32(3),
28123 Self::SexuallyExplicit => serializer.serialize_i32(4),
28124 Self::CivicIntegrity => serializer.serialize_i32(5),
28125 Self::UnknownValue(u) => u.0.serialize(serializer),
28126 }
28127 }
28128}
28129
28130impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28132 where
28133 D: serde::Deserializer<'de>,
28134 {
28135 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28136 ".google.cloud.retail.v2.HarmCategory",
28137 ))
28138 }
28139}