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 /// Creates a new default instance.
109 pub fn new() -> Self {
110 std::default::Default::default()
111 }
112
113 /// Sets the value of [ingestion_product_type][crate::model::ProductLevelConfig::ingestion_product_type].
114 ///
115 /// # Example
116 /// ```ignore,no_run
117 /// # use google_cloud_retail_v2::model::ProductLevelConfig;
118 /// let x = ProductLevelConfig::new().set_ingestion_product_type("example");
119 /// ```
120 pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
121 mut self,
122 v: T,
123 ) -> Self {
124 self.ingestion_product_type = v.into();
125 self
126 }
127
128 /// Sets the value of [merchant_center_product_id_field][crate::model::ProductLevelConfig::merchant_center_product_id_field].
129 ///
130 /// # Example
131 /// ```ignore,no_run
132 /// # use google_cloud_retail_v2::model::ProductLevelConfig;
133 /// let x = ProductLevelConfig::new().set_merchant_center_product_id_field("example");
134 /// ```
135 pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
136 mut self,
137 v: T,
138 ) -> Self {
139 self.merchant_center_product_id_field = v.into();
140 self
141 }
142}
143
144impl wkt::message::Message for ProductLevelConfig {
145 fn typename() -> &'static str {
146 "type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
147 }
148}
149
150/// Catalog level attribute config for an attribute. For example, if customers
151/// want to enable/disable facet for a specific attribute.
152#[derive(Clone, Default, PartialEq)]
153#[non_exhaustive]
154pub struct CatalogAttribute {
155 /// Required. Attribute name.
156 /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
157 /// `attributes.xyz`.
158 /// To be indexable, the attribute name can contain only alpha-numeric
159 /// characters and underscores. For example, an attribute named
160 /// `attributes.abc_xyz` can be indexed, but an attribute named
161 /// `attributes.abc-xyz` cannot be indexed.
162 ///
163 /// If the attribute key starts with `attributes.`, then the attribute is a
164 /// custom attribute. Attributes such as `brands`, `patterns`, and `title` are
165 /// built-in and called system attributes.
166 pub key: std::string::String,
167
168 /// Output only. Indicates whether this attribute has been used by any
169 /// products. `True` if at least one [Product][google.cloud.retail.v2.Product]
170 /// is using this attribute in
171 /// [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
172 /// this field is `False`.
173 ///
174 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
175 /// pre-loaded by using
176 /// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
177 /// or
178 /// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
179 /// APIs. This field is `False` for pre-loaded
180 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
181 ///
182 /// Only pre-loaded [catalog
183 /// attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in
184 /// use by products nor predefined can be deleted. [Catalog
185 /// attributes][google.cloud.retail.v2.CatalogAttribute] that are
186 /// either in use by products or are predefined attributes cannot be deleted;
187 /// however, their configuration properties will reset to default values upon
188 /// removal request.
189 ///
190 /// After catalog changes, it takes about 10 minutes for this field to update.
191 ///
192 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
193 /// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
194 /// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
195 /// [google.cloud.retail.v2.Product]: crate::model::Product
196 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
197 pub in_use: bool,
198
199 /// Output only. The type of this attribute. This is derived from the attribute
200 /// in [Product.attributes][google.cloud.retail.v2.Product.attributes].
201 ///
202 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
203 pub r#type: crate::model::catalog_attribute::AttributeType,
204
205 /// When
206 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
207 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
208 /// are indexed so that it can be filtered, faceted, or boosted in
209 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
210 ///
211 /// Must be specified when
212 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
213 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
214 ///
215 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
216 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
217 pub indexable_option: crate::model::catalog_attribute::IndexableOption,
218
219 /// If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
220 /// facet. Could only be DYNAMIC_FACETABLE_DISABLED if
221 /// [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
222 /// is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
223 ///
224 /// Must be specified, otherwise throws INVALID_FORMAT error.
225 ///
226 /// [google.cloud.retail.v2.CatalogAttribute.indexable_option]: crate::model::CatalogAttribute::indexable_option
227 pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
228
229 /// When
230 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
231 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
232 /// are searchable by text queries in
233 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
234 ///
235 /// If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
236 /// will not be searchable by text queries in
237 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
238 /// there are no text values associated to numerical attributes.
239 ///
240 /// Must be specified, when
241 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
242 /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
243 ///
244 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
245 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
246 pub searchable_option: crate::model::catalog_attribute::SearchableOption,
247
248 /// If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable.
249 /// This property only applies to textual custom attributes and requires
250 /// indexable set to enabled to enable exact-searchable. If unset, the server
251 /// behavior defaults to
252 /// [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED].
253 ///
254 /// [google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]: crate::model::catalog_attribute::ExactSearchableOption::ExactSearchableDisabled
255 pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
256
257 /// If RETRIEVABLE_ENABLED, attribute values are retrievable in the search
258 /// results. If unset, the server behavior defaults to
259 /// [RETRIEVABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED].
260 ///
261 /// [google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]: crate::model::catalog_attribute::RetrievableOption::RetrievableDisabled
262 pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
263
264 /// Contains facet options.
265 pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
266
267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
268}
269
270impl CatalogAttribute {
271 /// Creates a new default instance.
272 pub fn new() -> Self {
273 std::default::Default::default()
274 }
275
276 /// Sets the value of [key][crate::model::CatalogAttribute::key].
277 ///
278 /// # Example
279 /// ```ignore,no_run
280 /// # use google_cloud_retail_v2::model::CatalogAttribute;
281 /// let x = CatalogAttribute::new().set_key("example");
282 /// ```
283 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
284 self.key = v.into();
285 self
286 }
287
288 /// Sets the value of [in_use][crate::model::CatalogAttribute::in_use].
289 ///
290 /// # Example
291 /// ```ignore,no_run
292 /// # use google_cloud_retail_v2::model::CatalogAttribute;
293 /// let x = CatalogAttribute::new().set_in_use(true);
294 /// ```
295 pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
296 self.in_use = v.into();
297 self
298 }
299
300 /// Sets the value of [r#type][crate::model::CatalogAttribute::type].
301 ///
302 /// # Example
303 /// ```ignore,no_run
304 /// # use google_cloud_retail_v2::model::CatalogAttribute;
305 /// use google_cloud_retail_v2::model::catalog_attribute::AttributeType;
306 /// let x0 = CatalogAttribute::new().set_type(AttributeType::Textual);
307 /// let x1 = CatalogAttribute::new().set_type(AttributeType::Numerical);
308 /// ```
309 pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
310 mut self,
311 v: T,
312 ) -> Self {
313 self.r#type = v.into();
314 self
315 }
316
317 /// Sets the value of [indexable_option][crate::model::CatalogAttribute::indexable_option].
318 ///
319 /// # Example
320 /// ```ignore,no_run
321 /// # use google_cloud_retail_v2::model::CatalogAttribute;
322 /// use google_cloud_retail_v2::model::catalog_attribute::IndexableOption;
323 /// let x0 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableEnabled);
324 /// let x1 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableDisabled);
325 /// ```
326 pub fn set_indexable_option<
327 T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
328 >(
329 mut self,
330 v: T,
331 ) -> Self {
332 self.indexable_option = v.into();
333 self
334 }
335
336 /// Sets the value of [dynamic_facetable_option][crate::model::CatalogAttribute::dynamic_facetable_option].
337 ///
338 /// # Example
339 /// ```ignore,no_run
340 /// # use google_cloud_retail_v2::model::CatalogAttribute;
341 /// use google_cloud_retail_v2::model::catalog_attribute::DynamicFacetableOption;
342 /// let x0 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableEnabled);
343 /// let x1 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableDisabled);
344 /// ```
345 pub fn set_dynamic_facetable_option<
346 T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
347 >(
348 mut self,
349 v: T,
350 ) -> Self {
351 self.dynamic_facetable_option = v.into();
352 self
353 }
354
355 /// Sets the value of [searchable_option][crate::model::CatalogAttribute::searchable_option].
356 ///
357 /// # Example
358 /// ```ignore,no_run
359 /// # use google_cloud_retail_v2::model::CatalogAttribute;
360 /// use google_cloud_retail_v2::model::catalog_attribute::SearchableOption;
361 /// let x0 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableEnabled);
362 /// let x1 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableDisabled);
363 /// ```
364 pub fn set_searchable_option<
365 T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
366 >(
367 mut self,
368 v: T,
369 ) -> Self {
370 self.searchable_option = v.into();
371 self
372 }
373
374 /// Sets the value of [exact_searchable_option][crate::model::CatalogAttribute::exact_searchable_option].
375 ///
376 /// # Example
377 /// ```ignore,no_run
378 /// # use google_cloud_retail_v2::model::CatalogAttribute;
379 /// use google_cloud_retail_v2::model::catalog_attribute::ExactSearchableOption;
380 /// let x0 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableEnabled);
381 /// let x1 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableDisabled);
382 /// ```
383 pub fn set_exact_searchable_option<
384 T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
385 >(
386 mut self,
387 v: T,
388 ) -> Self {
389 self.exact_searchable_option = v.into();
390 self
391 }
392
393 /// Sets the value of [retrievable_option][crate::model::CatalogAttribute::retrievable_option].
394 ///
395 /// # Example
396 /// ```ignore,no_run
397 /// # use google_cloud_retail_v2::model::CatalogAttribute;
398 /// use google_cloud_retail_v2::model::catalog_attribute::RetrievableOption;
399 /// let x0 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableEnabled);
400 /// let x1 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableDisabled);
401 /// ```
402 pub fn set_retrievable_option<
403 T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
404 >(
405 mut self,
406 v: T,
407 ) -> Self {
408 self.retrievable_option = v.into();
409 self
410 }
411
412 /// Sets the value of [facet_config][crate::model::CatalogAttribute::facet_config].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_retail_v2::model::CatalogAttribute;
417 /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
418 /// let x = CatalogAttribute::new().set_facet_config(FacetConfig::default()/* use setters */);
419 /// ```
420 pub fn set_facet_config<T>(mut self, v: T) -> Self
421 where
422 T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
423 {
424 self.facet_config = std::option::Option::Some(v.into());
425 self
426 }
427
428 /// Sets or clears the value of [facet_config][crate::model::CatalogAttribute::facet_config].
429 ///
430 /// # Example
431 /// ```ignore,no_run
432 /// # use google_cloud_retail_v2::model::CatalogAttribute;
433 /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
434 /// let x = CatalogAttribute::new().set_or_clear_facet_config(Some(FacetConfig::default()/* use setters */));
435 /// let x = CatalogAttribute::new().set_or_clear_facet_config(None::<FacetConfig>);
436 /// ```
437 pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
438 where
439 T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
440 {
441 self.facet_config = v.map(|x| x.into());
442 self
443 }
444}
445
446impl wkt::message::Message for CatalogAttribute {
447 fn typename() -> &'static str {
448 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
449 }
450}
451
452/// Defines additional types related to [CatalogAttribute].
453pub mod catalog_attribute {
454 #[allow(unused_imports)]
455 use super::*;
456
457 /// Possible options for the facet that corresponds to the current attribute
458 /// config.
459 #[derive(Clone, Default, PartialEq)]
460 #[non_exhaustive]
461 pub struct FacetConfig {
462 /// If you don't set the facet
463 /// [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
464 /// in the request to a numerical attribute, then we use the computed
465 /// intervals with rounded bounds obtained from all its product numerical
466 /// attribute values. The computed intervals might not be ideal for some
467 /// attributes. Therefore, we give you the option to overwrite them with the
468 /// facet_intervals field. The maximum of facet intervals per
469 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
470 /// interval must have a lower bound or an upper bound. If both bounds are
471 /// provided, then the lower bound must be smaller or equal than the upper
472 /// bound.
473 ///
474 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
475 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
476 pub facet_intervals: std::vec::Vec<crate::model::Interval>,
477
478 /// Each instance represents a list of attribute values to ignore as facet
479 /// values for a specific time range. The maximum number of instances per
480 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
481 ///
482 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
483 pub ignored_facet_values:
484 std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
485
486 /// Each instance replaces a list of facet values by a merged facet
487 /// value. If a facet value is not in any list, then it will stay the same.
488 /// To avoid conflicts, only paths of length 1 are accepted. In other words,
489 /// if "dark_blue" merged into "BLUE", then the latter can't merge into
490 /// "blues" because this would create a path of length 2. The maximum number
491 /// of instances of MergedFacetValue per
492 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
493 /// feature is available only for textual custom attributes.
494 ///
495 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
496 pub merged_facet_values:
497 std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
498
499 /// Use this field only if you want to merge a facet key into another facet
500 /// key.
501 pub merged_facet:
502 std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
503
504 /// Set this field only if you want to rerank based on facet values engaged
505 /// by the user for the current key. This option is only possible for custom
506 /// facetable textual keys.
507 pub rerank_config:
508 std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
509
510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
511 }
512
513 impl FacetConfig {
514 /// Creates a new default instance.
515 pub fn new() -> Self {
516 std::default::Default::default()
517 }
518
519 /// Sets the value of [facet_intervals][crate::model::catalog_attribute::FacetConfig::facet_intervals].
520 ///
521 /// # Example
522 /// ```ignore,no_run
523 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
524 /// use google_cloud_retail_v2::model::Interval;
525 /// let x = FacetConfig::new()
526 /// .set_facet_intervals([
527 /// Interval::default()/* use setters */,
528 /// Interval::default()/* use (different) setters */,
529 /// ]);
530 /// ```
531 pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
532 where
533 T: std::iter::IntoIterator<Item = V>,
534 V: std::convert::Into<crate::model::Interval>,
535 {
536 use std::iter::Iterator;
537 self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
538 self
539 }
540
541 /// Sets the value of [ignored_facet_values][crate::model::catalog_attribute::FacetConfig::ignored_facet_values].
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
546 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
547 /// let x = FacetConfig::new()
548 /// .set_ignored_facet_values([
549 /// IgnoredFacetValues::default()/* use setters */,
550 /// IgnoredFacetValues::default()/* use (different) setters */,
551 /// ]);
552 /// ```
553 pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
554 where
555 T: std::iter::IntoIterator<Item = V>,
556 V: std::convert::Into<
557 crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
558 >,
559 {
560 use std::iter::Iterator;
561 self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
562 self
563 }
564
565 /// Sets the value of [merged_facet_values][crate::model::catalog_attribute::FacetConfig::merged_facet_values].
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
570 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
571 /// let x = FacetConfig::new()
572 /// .set_merged_facet_values([
573 /// MergedFacetValue::default()/* use setters */,
574 /// MergedFacetValue::default()/* use (different) setters */,
575 /// ]);
576 /// ```
577 pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
578 where
579 T: std::iter::IntoIterator<Item = V>,
580 V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
581 {
582 use std::iter::Iterator;
583 self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
584 self
585 }
586
587 /// Sets the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
588 ///
589 /// # Example
590 /// ```ignore,no_run
591 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
592 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
593 /// let x = FacetConfig::new().set_merged_facet(MergedFacet::default()/* use setters */);
594 /// ```
595 pub fn set_merged_facet<T>(mut self, v: T) -> Self
596 where
597 T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
598 {
599 self.merged_facet = std::option::Option::Some(v.into());
600 self
601 }
602
603 /// Sets or clears the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
604 ///
605 /// # Example
606 /// ```ignore,no_run
607 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
608 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
609 /// let x = FacetConfig::new().set_or_clear_merged_facet(Some(MergedFacet::default()/* use setters */));
610 /// let x = FacetConfig::new().set_or_clear_merged_facet(None::<MergedFacet>);
611 /// ```
612 pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
613 where
614 T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
615 {
616 self.merged_facet = v.map(|x| x.into());
617 self
618 }
619
620 /// Sets the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
621 ///
622 /// # Example
623 /// ```ignore,no_run
624 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
625 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
626 /// let x = FacetConfig::new().set_rerank_config(RerankConfig::default()/* use setters */);
627 /// ```
628 pub fn set_rerank_config<T>(mut self, v: T) -> Self
629 where
630 T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
631 {
632 self.rerank_config = std::option::Option::Some(v.into());
633 self
634 }
635
636 /// Sets or clears the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
637 ///
638 /// # Example
639 /// ```ignore,no_run
640 /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
641 /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
642 /// let x = FacetConfig::new().set_or_clear_rerank_config(Some(RerankConfig::default()/* use setters */));
643 /// let x = FacetConfig::new().set_or_clear_rerank_config(None::<RerankConfig>);
644 /// ```
645 pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
646 where
647 T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
648 {
649 self.rerank_config = v.map(|x| x.into());
650 self
651 }
652 }
653
654 impl wkt::message::Message for FacetConfig {
655 fn typename() -> &'static str {
656 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
657 }
658 }
659
660 /// Defines additional types related to [FacetConfig].
661 pub mod facet_config {
662 #[allow(unused_imports)]
663 use super::*;
664
665 /// [Facet values][google.cloud.retail.v2.SearchResponse.Facet.values] to
666 /// ignore on [facets][google.cloud.retail.v2.SearchResponse.Facet] during
667 /// the specified time range for the given
668 /// [SearchResponse.Facet.key][google.cloud.retail.v2.SearchResponse.Facet.key]
669 /// attribute.
670 ///
671 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
672 /// [google.cloud.retail.v2.SearchResponse.Facet.key]: crate::model::search_response::Facet::key
673 /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
674 #[derive(Clone, Default, PartialEq)]
675 #[non_exhaustive]
676 pub struct IgnoredFacetValues {
677 /// List of facet values to ignore for the following time range. The facet
678 /// values are the same as the attribute values. There is a limit of 10
679 /// values per instance of IgnoredFacetValues. Each value can have at most
680 /// 128 characters.
681 pub values: std::vec::Vec<std::string::String>,
682
683 /// Time range for the current list of facet values to ignore.
684 /// If multiple time ranges are specified for an facet value for the
685 /// current attribute, consider all of them. If both are empty, ignore
686 /// always. If start time and end time are set, then start time
687 /// must be before end time.
688 /// If start time is not empty and end time is empty, then will ignore
689 /// these facet values after the start time.
690 pub start_time: std::option::Option<wkt::Timestamp>,
691
692 /// If start time is empty and end time is not empty, then ignore these
693 /// facet values before end time.
694 pub end_time: std::option::Option<wkt::Timestamp>,
695
696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
697 }
698
699 impl IgnoredFacetValues {
700 /// Creates a new default instance.
701 pub fn new() -> Self {
702 std::default::Default::default()
703 }
704
705 /// Sets the value of [values][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::values].
706 ///
707 /// # Example
708 /// ```ignore,no_run
709 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
710 /// let x = IgnoredFacetValues::new().set_values(["a", "b", "c"]);
711 /// ```
712 pub fn set_values<T, V>(mut self, v: T) -> Self
713 where
714 T: std::iter::IntoIterator<Item = V>,
715 V: std::convert::Into<std::string::String>,
716 {
717 use std::iter::Iterator;
718 self.values = v.into_iter().map(|i| i.into()).collect();
719 self
720 }
721
722 /// Sets the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
723 ///
724 /// # Example
725 /// ```ignore,no_run
726 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
727 /// use wkt::Timestamp;
728 /// let x = IgnoredFacetValues::new().set_start_time(Timestamp::default()/* use setters */);
729 /// ```
730 pub fn set_start_time<T>(mut self, v: T) -> Self
731 where
732 T: std::convert::Into<wkt::Timestamp>,
733 {
734 self.start_time = std::option::Option::Some(v.into());
735 self
736 }
737
738 /// Sets or clears the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
743 /// use wkt::Timestamp;
744 /// let x = IgnoredFacetValues::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
745 /// let x = IgnoredFacetValues::new().set_or_clear_start_time(None::<Timestamp>);
746 /// ```
747 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
748 where
749 T: std::convert::Into<wkt::Timestamp>,
750 {
751 self.start_time = v.map(|x| x.into());
752 self
753 }
754
755 /// Sets the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
756 ///
757 /// # Example
758 /// ```ignore,no_run
759 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
760 /// use wkt::Timestamp;
761 /// let x = IgnoredFacetValues::new().set_end_time(Timestamp::default()/* use setters */);
762 /// ```
763 pub fn set_end_time<T>(mut self, v: T) -> Self
764 where
765 T: std::convert::Into<wkt::Timestamp>,
766 {
767 self.end_time = std::option::Option::Some(v.into());
768 self
769 }
770
771 /// Sets or clears the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
772 ///
773 /// # Example
774 /// ```ignore,no_run
775 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
776 /// use wkt::Timestamp;
777 /// let x = IgnoredFacetValues::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
778 /// let x = IgnoredFacetValues::new().set_or_clear_end_time(None::<Timestamp>);
779 /// ```
780 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
781 where
782 T: std::convert::Into<wkt::Timestamp>,
783 {
784 self.end_time = v.map(|x| x.into());
785 self
786 }
787 }
788
789 impl wkt::message::Message for IgnoredFacetValues {
790 fn typename() -> &'static str {
791 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
792 }
793 }
794
795 /// Replaces a set of textual facet values by the same (possibly different)
796 /// merged facet value. Each facet value should appear at most once as a
797 /// value per [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
798 /// This feature is available only for textual custom attributes.
799 ///
800 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
801 #[derive(Clone, Default, PartialEq)]
802 #[non_exhaustive]
803 pub struct MergedFacetValue {
804 /// All the facet values that are replaces by the same
805 /// [merged_value][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]
806 /// that follows. The maximum number of values per MergedFacetValue is 25.
807 /// Each value can have up to 128 characters.
808 ///
809 /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]: crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value
810 pub values: std::vec::Vec<std::string::String>,
811
812 /// All the previous values are replaced by this merged facet value.
813 /// This merged_value must be non-empty and can have up to 128 characters.
814 pub merged_value: std::string::String,
815
816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
817 }
818
819 impl MergedFacetValue {
820 /// Creates a new default instance.
821 pub fn new() -> Self {
822 std::default::Default::default()
823 }
824
825 /// Sets the value of [values][crate::model::catalog_attribute::facet_config::MergedFacetValue::values].
826 ///
827 /// # Example
828 /// ```ignore,no_run
829 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
830 /// let x = MergedFacetValue::new().set_values(["a", "b", "c"]);
831 /// ```
832 pub fn set_values<T, V>(mut self, v: T) -> Self
833 where
834 T: std::iter::IntoIterator<Item = V>,
835 V: std::convert::Into<std::string::String>,
836 {
837 use std::iter::Iterator;
838 self.values = v.into_iter().map(|i| i.into()).collect();
839 self
840 }
841
842 /// Sets the value of [merged_value][crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value].
843 ///
844 /// # Example
845 /// ```ignore,no_run
846 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
847 /// let x = MergedFacetValue::new().set_merged_value("example");
848 /// ```
849 pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
850 mut self,
851 v: T,
852 ) -> Self {
853 self.merged_value = v.into();
854 self
855 }
856 }
857
858 impl wkt::message::Message for MergedFacetValue {
859 fn typename() -> &'static str {
860 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
861 }
862 }
863
864 /// The current facet key (i.e. attribute config) maps into the
865 /// [merged_facet_key][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key].
866 /// A facet key can have at most one child. The current facet key and the
867 /// merged facet key need both to be textual custom attributes or both
868 /// numerical custom attributes (same type).
869 ///
870 /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]: crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key
871 #[derive(Clone, Default, PartialEq)]
872 #[non_exhaustive]
873 pub struct MergedFacet {
874 /// The merged facet key should be a valid facet key that is different than
875 /// the facet key of the current catalog attribute. We refer this is
876 /// merged facet key as the child of the current catalog attribute. This
877 /// merged facet key can't be a parent of another facet key (i.e. no
878 /// directed path of length 2). This merged facet key needs to be either a
879 /// textual custom attribute or a numerical custom attribute.
880 pub merged_facet_key: std::string::String,
881
882 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
883 }
884
885 impl MergedFacet {
886 /// Creates a new default instance.
887 pub fn new() -> Self {
888 std::default::Default::default()
889 }
890
891 /// Sets the value of [merged_facet_key][crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key].
892 ///
893 /// # Example
894 /// ```ignore,no_run
895 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
896 /// let x = MergedFacet::new().set_merged_facet_key("example");
897 /// ```
898 pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
899 mut self,
900 v: T,
901 ) -> Self {
902 self.merged_facet_key = v.into();
903 self
904 }
905 }
906
907 impl wkt::message::Message for MergedFacet {
908 fn typename() -> &'static str {
909 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
910 }
911 }
912
913 /// Options to rerank based on facet values engaged by the user for the
914 /// current key. That key needs to be a custom textual key and facetable.
915 /// To use this control, you also need to pass all the facet keys engaged by
916 /// the user in the request using the field [SearchRequest.FacetSpec]. In
917 /// particular, if you don't pass the facet keys engaged that you want to
918 /// rerank on, this control won't be effective. Moreover, to obtain better
919 /// results, the facet values that you want to rerank on should be close to
920 /// English (ideally made of words, underscores, and spaces).
921 #[derive(Clone, Default, PartialEq)]
922 #[non_exhaustive]
923 pub struct RerankConfig {
924 /// If set to true, then we also rerank the dynamic facets based on the
925 /// facet values engaged by the user for the current attribute key during
926 /// serving.
927 pub rerank_facet: bool,
928
929 /// If empty, rerank on all facet values for the current key. Otherwise,
930 /// will rerank on the facet values from this list only.
931 pub facet_values: std::vec::Vec<std::string::String>,
932
933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
934 }
935
936 impl RerankConfig {
937 /// Creates a new default instance.
938 pub fn new() -> Self {
939 std::default::Default::default()
940 }
941
942 /// Sets the value of [rerank_facet][crate::model::catalog_attribute::facet_config::RerankConfig::rerank_facet].
943 ///
944 /// # Example
945 /// ```ignore,no_run
946 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
947 /// let x = RerankConfig::new().set_rerank_facet(true);
948 /// ```
949 pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
950 self.rerank_facet = v.into();
951 self
952 }
953
954 /// Sets the value of [facet_values][crate::model::catalog_attribute::facet_config::RerankConfig::facet_values].
955 ///
956 /// # Example
957 /// ```ignore,no_run
958 /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
959 /// let x = RerankConfig::new().set_facet_values(["a", "b", "c"]);
960 /// ```
961 pub fn set_facet_values<T, V>(mut self, v: T) -> Self
962 where
963 T: std::iter::IntoIterator<Item = V>,
964 V: std::convert::Into<std::string::String>,
965 {
966 use std::iter::Iterator;
967 self.facet_values = v.into_iter().map(|i| i.into()).collect();
968 self
969 }
970 }
971
972 impl wkt::message::Message for RerankConfig {
973 fn typename() -> &'static str {
974 "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
975 }
976 }
977 }
978
979 /// The type of an attribute.
980 ///
981 /// # Working with unknown values
982 ///
983 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
984 /// additional enum variants at any time. Adding new variants is not considered
985 /// a breaking change. Applications should write their code in anticipation of:
986 ///
987 /// - New values appearing in future releases of the client library, **and**
988 /// - New values received dynamically, without application changes.
989 ///
990 /// Please consult the [Working with enums] section in the user guide for some
991 /// guidelines.
992 ///
993 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
994 #[derive(Clone, Debug, PartialEq)]
995 #[non_exhaustive]
996 pub enum AttributeType {
997 /// The type of the attribute is unknown.
998 ///
999 /// Used when type cannot be derived from attribute that is not
1000 /// [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
1001 ///
1002 /// [google.cloud.retail.v2.CatalogAttribute.in_use]: crate::model::CatalogAttribute::in_use
1003 Unknown,
1004 /// Textual attribute.
1005 Textual,
1006 /// Numerical attribute.
1007 Numerical,
1008 /// If set, the enum was initialized with an unknown value.
1009 ///
1010 /// Applications can examine the value using [AttributeType::value] or
1011 /// [AttributeType::name].
1012 UnknownValue(attribute_type::UnknownValue),
1013 }
1014
1015 #[doc(hidden)]
1016 pub mod attribute_type {
1017 #[allow(unused_imports)]
1018 use super::*;
1019 #[derive(Clone, Debug, PartialEq)]
1020 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1021 }
1022
1023 impl AttributeType {
1024 /// Gets the enum value.
1025 ///
1026 /// Returns `None` if the enum contains an unknown value deserialized from
1027 /// the string representation of enums.
1028 pub fn value(&self) -> std::option::Option<i32> {
1029 match self {
1030 Self::Unknown => std::option::Option::Some(0),
1031 Self::Textual => std::option::Option::Some(1),
1032 Self::Numerical => std::option::Option::Some(2),
1033 Self::UnknownValue(u) => u.0.value(),
1034 }
1035 }
1036
1037 /// Gets the enum value as a string.
1038 ///
1039 /// Returns `None` if the enum contains an unknown value deserialized from
1040 /// the integer representation of enums.
1041 pub fn name(&self) -> std::option::Option<&str> {
1042 match self {
1043 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1044 Self::Textual => std::option::Option::Some("TEXTUAL"),
1045 Self::Numerical => std::option::Option::Some("NUMERICAL"),
1046 Self::UnknownValue(u) => u.0.name(),
1047 }
1048 }
1049 }
1050
1051 impl std::default::Default for AttributeType {
1052 fn default() -> Self {
1053 use std::convert::From;
1054 Self::from(0)
1055 }
1056 }
1057
1058 impl std::fmt::Display for AttributeType {
1059 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1060 wkt::internal::display_enum(f, self.name(), self.value())
1061 }
1062 }
1063
1064 impl std::convert::From<i32> for AttributeType {
1065 fn from(value: i32) -> Self {
1066 match value {
1067 0 => Self::Unknown,
1068 1 => Self::Textual,
1069 2 => Self::Numerical,
1070 _ => Self::UnknownValue(attribute_type::UnknownValue(
1071 wkt::internal::UnknownEnumValue::Integer(value),
1072 )),
1073 }
1074 }
1075 }
1076
1077 impl std::convert::From<&str> for AttributeType {
1078 fn from(value: &str) -> Self {
1079 use std::string::ToString;
1080 match value {
1081 "UNKNOWN" => Self::Unknown,
1082 "TEXTUAL" => Self::Textual,
1083 "NUMERICAL" => Self::Numerical,
1084 _ => Self::UnknownValue(attribute_type::UnknownValue(
1085 wkt::internal::UnknownEnumValue::String(value.to_string()),
1086 )),
1087 }
1088 }
1089 }
1090
1091 impl serde::ser::Serialize for AttributeType {
1092 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1093 where
1094 S: serde::Serializer,
1095 {
1096 match self {
1097 Self::Unknown => serializer.serialize_i32(0),
1098 Self::Textual => serializer.serialize_i32(1),
1099 Self::Numerical => serializer.serialize_i32(2),
1100 Self::UnknownValue(u) => u.0.serialize(serializer),
1101 }
1102 }
1103 }
1104
1105 impl<'de> serde::de::Deserialize<'de> for AttributeType {
1106 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1107 where
1108 D: serde::Deserializer<'de>,
1109 {
1110 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
1111 ".google.cloud.retail.v2.CatalogAttribute.AttributeType",
1112 ))
1113 }
1114 }
1115
1116 /// The status of the indexable option of a catalog attribute.
1117 ///
1118 /// # Working with unknown values
1119 ///
1120 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1121 /// additional enum variants at any time. Adding new variants is not considered
1122 /// a breaking change. Applications should write their code in anticipation of:
1123 ///
1124 /// - New values appearing in future releases of the client library, **and**
1125 /// - New values received dynamically, without application changes.
1126 ///
1127 /// Please consult the [Working with enums] section in the user guide for some
1128 /// guidelines.
1129 ///
1130 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1131 #[derive(Clone, Debug, PartialEq)]
1132 #[non_exhaustive]
1133 pub enum IndexableOption {
1134 /// Value used when unset.
1135 Unspecified,
1136 /// Indexable option enabled for an attribute.
1137 IndexableEnabled,
1138 /// Indexable option disabled for an attribute.
1139 IndexableDisabled,
1140 /// If set, the enum was initialized with an unknown value.
1141 ///
1142 /// Applications can examine the value using [IndexableOption::value] or
1143 /// [IndexableOption::name].
1144 UnknownValue(indexable_option::UnknownValue),
1145 }
1146
1147 #[doc(hidden)]
1148 pub mod indexable_option {
1149 #[allow(unused_imports)]
1150 use super::*;
1151 #[derive(Clone, Debug, PartialEq)]
1152 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1153 }
1154
1155 impl IndexableOption {
1156 /// Gets the enum value.
1157 ///
1158 /// Returns `None` if the enum contains an unknown value deserialized from
1159 /// the string representation of enums.
1160 pub fn value(&self) -> std::option::Option<i32> {
1161 match self {
1162 Self::Unspecified => std::option::Option::Some(0),
1163 Self::IndexableEnabled => std::option::Option::Some(1),
1164 Self::IndexableDisabled => std::option::Option::Some(2),
1165 Self::UnknownValue(u) => u.0.value(),
1166 }
1167 }
1168
1169 /// Gets the enum value as a string.
1170 ///
1171 /// Returns `None` if the enum contains an unknown value deserialized from
1172 /// the integer representation of enums.
1173 pub fn name(&self) -> std::option::Option<&str> {
1174 match self {
1175 Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
1176 Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
1177 Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
1178 Self::UnknownValue(u) => u.0.name(),
1179 }
1180 }
1181 }
1182
1183 impl std::default::Default for IndexableOption {
1184 fn default() -> Self {
1185 use std::convert::From;
1186 Self::from(0)
1187 }
1188 }
1189
1190 impl std::fmt::Display for IndexableOption {
1191 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1192 wkt::internal::display_enum(f, self.name(), self.value())
1193 }
1194 }
1195
1196 impl std::convert::From<i32> for IndexableOption {
1197 fn from(value: i32) -> Self {
1198 match value {
1199 0 => Self::Unspecified,
1200 1 => Self::IndexableEnabled,
1201 2 => Self::IndexableDisabled,
1202 _ => Self::UnknownValue(indexable_option::UnknownValue(
1203 wkt::internal::UnknownEnumValue::Integer(value),
1204 )),
1205 }
1206 }
1207 }
1208
1209 impl std::convert::From<&str> for IndexableOption {
1210 fn from(value: &str) -> Self {
1211 use std::string::ToString;
1212 match value {
1213 "INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1214 "INDEXABLE_ENABLED" => Self::IndexableEnabled,
1215 "INDEXABLE_DISABLED" => Self::IndexableDisabled,
1216 _ => Self::UnknownValue(indexable_option::UnknownValue(
1217 wkt::internal::UnknownEnumValue::String(value.to_string()),
1218 )),
1219 }
1220 }
1221 }
1222
1223 impl serde::ser::Serialize for IndexableOption {
1224 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1225 where
1226 S: serde::Serializer,
1227 {
1228 match self {
1229 Self::Unspecified => serializer.serialize_i32(0),
1230 Self::IndexableEnabled => serializer.serialize_i32(1),
1231 Self::IndexableDisabled => serializer.serialize_i32(2),
1232 Self::UnknownValue(u) => u.0.serialize(serializer),
1233 }
1234 }
1235 }
1236
1237 impl<'de> serde::de::Deserialize<'de> for IndexableOption {
1238 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1239 where
1240 D: serde::Deserializer<'de>,
1241 {
1242 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
1243 ".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
1244 ))
1245 }
1246 }
1247
1248 /// The status of the dynamic facetable option of a catalog attribute.
1249 ///
1250 /// # Working with unknown values
1251 ///
1252 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1253 /// additional enum variants at any time. Adding new variants is not considered
1254 /// a breaking change. Applications should write their code in anticipation of:
1255 ///
1256 /// - New values appearing in future releases of the client library, **and**
1257 /// - New values received dynamically, without application changes.
1258 ///
1259 /// Please consult the [Working with enums] section in the user guide for some
1260 /// guidelines.
1261 ///
1262 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1263 #[derive(Clone, Debug, PartialEq)]
1264 #[non_exhaustive]
1265 pub enum DynamicFacetableOption {
1266 /// Value used when unset.
1267 Unspecified,
1268 /// Dynamic facetable option enabled for an attribute.
1269 DynamicFacetableEnabled,
1270 /// Dynamic facetable option disabled for an attribute.
1271 DynamicFacetableDisabled,
1272 /// If set, the enum was initialized with an unknown value.
1273 ///
1274 /// Applications can examine the value using [DynamicFacetableOption::value] or
1275 /// [DynamicFacetableOption::name].
1276 UnknownValue(dynamic_facetable_option::UnknownValue),
1277 }
1278
1279 #[doc(hidden)]
1280 pub mod dynamic_facetable_option {
1281 #[allow(unused_imports)]
1282 use super::*;
1283 #[derive(Clone, Debug, PartialEq)]
1284 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1285 }
1286
1287 impl DynamicFacetableOption {
1288 /// Gets the enum value.
1289 ///
1290 /// Returns `None` if the enum contains an unknown value deserialized from
1291 /// the string representation of enums.
1292 pub fn value(&self) -> std::option::Option<i32> {
1293 match self {
1294 Self::Unspecified => std::option::Option::Some(0),
1295 Self::DynamicFacetableEnabled => std::option::Option::Some(1),
1296 Self::DynamicFacetableDisabled => std::option::Option::Some(2),
1297 Self::UnknownValue(u) => u.0.value(),
1298 }
1299 }
1300
1301 /// Gets the enum value as a string.
1302 ///
1303 /// Returns `None` if the enum contains an unknown value deserialized from
1304 /// the integer representation of enums.
1305 pub fn name(&self) -> std::option::Option<&str> {
1306 match self {
1307 Self::Unspecified => {
1308 std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
1309 }
1310 Self::DynamicFacetableEnabled => {
1311 std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
1312 }
1313 Self::DynamicFacetableDisabled => {
1314 std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
1315 }
1316 Self::UnknownValue(u) => u.0.name(),
1317 }
1318 }
1319 }
1320
1321 impl std::default::Default for DynamicFacetableOption {
1322 fn default() -> Self {
1323 use std::convert::From;
1324 Self::from(0)
1325 }
1326 }
1327
1328 impl std::fmt::Display for DynamicFacetableOption {
1329 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1330 wkt::internal::display_enum(f, self.name(), self.value())
1331 }
1332 }
1333
1334 impl std::convert::From<i32> for DynamicFacetableOption {
1335 fn from(value: i32) -> Self {
1336 match value {
1337 0 => Self::Unspecified,
1338 1 => Self::DynamicFacetableEnabled,
1339 2 => Self::DynamicFacetableDisabled,
1340 _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1341 wkt::internal::UnknownEnumValue::Integer(value),
1342 )),
1343 }
1344 }
1345 }
1346
1347 impl std::convert::From<&str> for DynamicFacetableOption {
1348 fn from(value: &str) -> Self {
1349 use std::string::ToString;
1350 match value {
1351 "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1352 "DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
1353 "DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
1354 _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1355 wkt::internal::UnknownEnumValue::String(value.to_string()),
1356 )),
1357 }
1358 }
1359 }
1360
1361 impl serde::ser::Serialize for DynamicFacetableOption {
1362 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1363 where
1364 S: serde::Serializer,
1365 {
1366 match self {
1367 Self::Unspecified => serializer.serialize_i32(0),
1368 Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
1369 Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
1370 Self::UnknownValue(u) => u.0.serialize(serializer),
1371 }
1372 }
1373 }
1374
1375 impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
1376 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1377 where
1378 D: serde::Deserializer<'de>,
1379 {
1380 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
1381 ".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
1382 ))
1383 }
1384 }
1385
1386 /// The status of the searchable option of a catalog attribute.
1387 ///
1388 /// # Working with unknown values
1389 ///
1390 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1391 /// additional enum variants at any time. Adding new variants is not considered
1392 /// a breaking change. Applications should write their code in anticipation of:
1393 ///
1394 /// - New values appearing in future releases of the client library, **and**
1395 /// - New values received dynamically, without application changes.
1396 ///
1397 /// Please consult the [Working with enums] section in the user guide for some
1398 /// guidelines.
1399 ///
1400 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1401 #[derive(Clone, Debug, PartialEq)]
1402 #[non_exhaustive]
1403 pub enum SearchableOption {
1404 /// Value used when unset.
1405 Unspecified,
1406 /// Searchable option enabled for an attribute.
1407 SearchableEnabled,
1408 /// Searchable option disabled for an attribute.
1409 SearchableDisabled,
1410 /// If set, the enum was initialized with an unknown value.
1411 ///
1412 /// Applications can examine the value using [SearchableOption::value] or
1413 /// [SearchableOption::name].
1414 UnknownValue(searchable_option::UnknownValue),
1415 }
1416
1417 #[doc(hidden)]
1418 pub mod searchable_option {
1419 #[allow(unused_imports)]
1420 use super::*;
1421 #[derive(Clone, Debug, PartialEq)]
1422 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1423 }
1424
1425 impl SearchableOption {
1426 /// Gets the enum value.
1427 ///
1428 /// Returns `None` if the enum contains an unknown value deserialized from
1429 /// the string representation of enums.
1430 pub fn value(&self) -> std::option::Option<i32> {
1431 match self {
1432 Self::Unspecified => std::option::Option::Some(0),
1433 Self::SearchableEnabled => std::option::Option::Some(1),
1434 Self::SearchableDisabled => std::option::Option::Some(2),
1435 Self::UnknownValue(u) => u.0.value(),
1436 }
1437 }
1438
1439 /// Gets the enum value as a string.
1440 ///
1441 /// Returns `None` if the enum contains an unknown value deserialized from
1442 /// the integer representation of enums.
1443 pub fn name(&self) -> std::option::Option<&str> {
1444 match self {
1445 Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
1446 Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
1447 Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
1448 Self::UnknownValue(u) => u.0.name(),
1449 }
1450 }
1451 }
1452
1453 impl std::default::Default for SearchableOption {
1454 fn default() -> Self {
1455 use std::convert::From;
1456 Self::from(0)
1457 }
1458 }
1459
1460 impl std::fmt::Display for SearchableOption {
1461 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1462 wkt::internal::display_enum(f, self.name(), self.value())
1463 }
1464 }
1465
1466 impl std::convert::From<i32> for SearchableOption {
1467 fn from(value: i32) -> Self {
1468 match value {
1469 0 => Self::Unspecified,
1470 1 => Self::SearchableEnabled,
1471 2 => Self::SearchableDisabled,
1472 _ => Self::UnknownValue(searchable_option::UnknownValue(
1473 wkt::internal::UnknownEnumValue::Integer(value),
1474 )),
1475 }
1476 }
1477 }
1478
1479 impl std::convert::From<&str> for SearchableOption {
1480 fn from(value: &str) -> Self {
1481 use std::string::ToString;
1482 match value {
1483 "SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1484 "SEARCHABLE_ENABLED" => Self::SearchableEnabled,
1485 "SEARCHABLE_DISABLED" => Self::SearchableDisabled,
1486 _ => Self::UnknownValue(searchable_option::UnknownValue(
1487 wkt::internal::UnknownEnumValue::String(value.to_string()),
1488 )),
1489 }
1490 }
1491 }
1492
1493 impl serde::ser::Serialize for SearchableOption {
1494 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1495 where
1496 S: serde::Serializer,
1497 {
1498 match self {
1499 Self::Unspecified => serializer.serialize_i32(0),
1500 Self::SearchableEnabled => serializer.serialize_i32(1),
1501 Self::SearchableDisabled => serializer.serialize_i32(2),
1502 Self::UnknownValue(u) => u.0.serialize(serializer),
1503 }
1504 }
1505 }
1506
1507 impl<'de> serde::de::Deserialize<'de> for SearchableOption {
1508 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1509 where
1510 D: serde::Deserializer<'de>,
1511 {
1512 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
1513 ".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
1514 ))
1515 }
1516 }
1517
1518 /// The status of the exact-searchable option of a catalog attribute.
1519 ///
1520 /// # Working with unknown values
1521 ///
1522 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1523 /// additional enum variants at any time. Adding new variants is not considered
1524 /// a breaking change. Applications should write their code in anticipation of:
1525 ///
1526 /// - New values appearing in future releases of the client library, **and**
1527 /// - New values received dynamically, without application changes.
1528 ///
1529 /// Please consult the [Working with enums] section in the user guide for some
1530 /// guidelines.
1531 ///
1532 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1533 #[derive(Clone, Debug, PartialEq)]
1534 #[non_exhaustive]
1535 pub enum ExactSearchableOption {
1536 /// Value used when unset.
1537 Unspecified,
1538 /// Exact searchable option enabled for an attribute.
1539 ExactSearchableEnabled,
1540 /// Exact searchable option disabled for an attribute.
1541 ExactSearchableDisabled,
1542 /// If set, the enum was initialized with an unknown value.
1543 ///
1544 /// Applications can examine the value using [ExactSearchableOption::value] or
1545 /// [ExactSearchableOption::name].
1546 UnknownValue(exact_searchable_option::UnknownValue),
1547 }
1548
1549 #[doc(hidden)]
1550 pub mod exact_searchable_option {
1551 #[allow(unused_imports)]
1552 use super::*;
1553 #[derive(Clone, Debug, PartialEq)]
1554 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1555 }
1556
1557 impl ExactSearchableOption {
1558 /// Gets the enum value.
1559 ///
1560 /// Returns `None` if the enum contains an unknown value deserialized from
1561 /// the string representation of enums.
1562 pub fn value(&self) -> std::option::Option<i32> {
1563 match self {
1564 Self::Unspecified => std::option::Option::Some(0),
1565 Self::ExactSearchableEnabled => std::option::Option::Some(1),
1566 Self::ExactSearchableDisabled => std::option::Option::Some(2),
1567 Self::UnknownValue(u) => u.0.value(),
1568 }
1569 }
1570
1571 /// Gets the enum value as a string.
1572 ///
1573 /// Returns `None` if the enum contains an unknown value deserialized from
1574 /// the integer representation of enums.
1575 pub fn name(&self) -> std::option::Option<&str> {
1576 match self {
1577 Self::Unspecified => {
1578 std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
1579 }
1580 Self::ExactSearchableEnabled => {
1581 std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
1582 }
1583 Self::ExactSearchableDisabled => {
1584 std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
1585 }
1586 Self::UnknownValue(u) => u.0.name(),
1587 }
1588 }
1589 }
1590
1591 impl std::default::Default for ExactSearchableOption {
1592 fn default() -> Self {
1593 use std::convert::From;
1594 Self::from(0)
1595 }
1596 }
1597
1598 impl std::fmt::Display for ExactSearchableOption {
1599 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1600 wkt::internal::display_enum(f, self.name(), self.value())
1601 }
1602 }
1603
1604 impl std::convert::From<i32> for ExactSearchableOption {
1605 fn from(value: i32) -> Self {
1606 match value {
1607 0 => Self::Unspecified,
1608 1 => Self::ExactSearchableEnabled,
1609 2 => Self::ExactSearchableDisabled,
1610 _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1611 wkt::internal::UnknownEnumValue::Integer(value),
1612 )),
1613 }
1614 }
1615 }
1616
1617 impl std::convert::From<&str> for ExactSearchableOption {
1618 fn from(value: &str) -> Self {
1619 use std::string::ToString;
1620 match value {
1621 "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1622 "EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
1623 "EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
1624 _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1625 wkt::internal::UnknownEnumValue::String(value.to_string()),
1626 )),
1627 }
1628 }
1629 }
1630
1631 impl serde::ser::Serialize for ExactSearchableOption {
1632 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1633 where
1634 S: serde::Serializer,
1635 {
1636 match self {
1637 Self::Unspecified => serializer.serialize_i32(0),
1638 Self::ExactSearchableEnabled => serializer.serialize_i32(1),
1639 Self::ExactSearchableDisabled => serializer.serialize_i32(2),
1640 Self::UnknownValue(u) => u.0.serialize(serializer),
1641 }
1642 }
1643 }
1644
1645 impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
1646 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1647 where
1648 D: serde::Deserializer<'de>,
1649 {
1650 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
1651 ".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
1652 ))
1653 }
1654 }
1655
1656 /// The status of the retrievable option of a catalog attribute.
1657 ///
1658 /// # Working with unknown values
1659 ///
1660 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1661 /// additional enum variants at any time. Adding new variants is not considered
1662 /// a breaking change. Applications should write their code in anticipation of:
1663 ///
1664 /// - New values appearing in future releases of the client library, **and**
1665 /// - New values received dynamically, without application changes.
1666 ///
1667 /// Please consult the [Working with enums] section in the user guide for some
1668 /// guidelines.
1669 ///
1670 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1671 #[derive(Clone, Debug, PartialEq)]
1672 #[non_exhaustive]
1673 pub enum RetrievableOption {
1674 /// Value used when unset.
1675 Unspecified,
1676 /// Retrievable option enabled for an attribute.
1677 RetrievableEnabled,
1678 /// Retrievable option disabled for an attribute.
1679 RetrievableDisabled,
1680 /// If set, the enum was initialized with an unknown value.
1681 ///
1682 /// Applications can examine the value using [RetrievableOption::value] or
1683 /// [RetrievableOption::name].
1684 UnknownValue(retrievable_option::UnknownValue),
1685 }
1686
1687 #[doc(hidden)]
1688 pub mod retrievable_option {
1689 #[allow(unused_imports)]
1690 use super::*;
1691 #[derive(Clone, Debug, PartialEq)]
1692 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1693 }
1694
1695 impl RetrievableOption {
1696 /// Gets the enum value.
1697 ///
1698 /// Returns `None` if the enum contains an unknown value deserialized from
1699 /// the string representation of enums.
1700 pub fn value(&self) -> std::option::Option<i32> {
1701 match self {
1702 Self::Unspecified => std::option::Option::Some(0),
1703 Self::RetrievableEnabled => std::option::Option::Some(1),
1704 Self::RetrievableDisabled => std::option::Option::Some(2),
1705 Self::UnknownValue(u) => u.0.value(),
1706 }
1707 }
1708
1709 /// Gets the enum value as a string.
1710 ///
1711 /// Returns `None` if the enum contains an unknown value deserialized from
1712 /// the integer representation of enums.
1713 pub fn name(&self) -> std::option::Option<&str> {
1714 match self {
1715 Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
1716 Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
1717 Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
1718 Self::UnknownValue(u) => u.0.name(),
1719 }
1720 }
1721 }
1722
1723 impl std::default::Default for RetrievableOption {
1724 fn default() -> Self {
1725 use std::convert::From;
1726 Self::from(0)
1727 }
1728 }
1729
1730 impl std::fmt::Display for RetrievableOption {
1731 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1732 wkt::internal::display_enum(f, self.name(), self.value())
1733 }
1734 }
1735
1736 impl std::convert::From<i32> for RetrievableOption {
1737 fn from(value: i32) -> Self {
1738 match value {
1739 0 => Self::Unspecified,
1740 1 => Self::RetrievableEnabled,
1741 2 => Self::RetrievableDisabled,
1742 _ => Self::UnknownValue(retrievable_option::UnknownValue(
1743 wkt::internal::UnknownEnumValue::Integer(value),
1744 )),
1745 }
1746 }
1747 }
1748
1749 impl std::convert::From<&str> for RetrievableOption {
1750 fn from(value: &str) -> Self {
1751 use std::string::ToString;
1752 match value {
1753 "RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1754 "RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
1755 "RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
1756 _ => Self::UnknownValue(retrievable_option::UnknownValue(
1757 wkt::internal::UnknownEnumValue::String(value.to_string()),
1758 )),
1759 }
1760 }
1761 }
1762
1763 impl serde::ser::Serialize for RetrievableOption {
1764 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1765 where
1766 S: serde::Serializer,
1767 {
1768 match self {
1769 Self::Unspecified => serializer.serialize_i32(0),
1770 Self::RetrievableEnabled => serializer.serialize_i32(1),
1771 Self::RetrievableDisabled => serializer.serialize_i32(2),
1772 Self::UnknownValue(u) => u.0.serialize(serializer),
1773 }
1774 }
1775 }
1776
1777 impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
1778 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1779 where
1780 D: serde::Deserializer<'de>,
1781 {
1782 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
1783 ".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
1784 ))
1785 }
1786 }
1787}
1788
1789/// Catalog level attribute config.
1790#[derive(Clone, Default, PartialEq)]
1791#[non_exhaustive]
1792pub struct AttributesConfig {
1793 /// Required. Immutable. The fully qualified resource name of the attribute
1794 /// config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
1795 pub name: std::string::String,
1796
1797 /// Enable attribute(s) config at catalog level.
1798 /// For example, indexable, dynamic_facetable, or searchable for each
1799 /// attribute.
1800 ///
1801 /// The key is catalog attribute's name.
1802 /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
1803 /// `attributes.xyz`.
1804 ///
1805 /// The maximum number of catalog attributes allowed in a request is 1000.
1806 pub catalog_attributes:
1807 std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
1808
1809 /// Output only. The
1810 /// [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
1811 /// for this catalog.
1812 ///
1813 /// [google.cloud.retail.v2.AttributeConfigLevel]: crate::model::AttributeConfigLevel
1814 pub attribute_config_level: crate::model::AttributeConfigLevel,
1815
1816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1817}
1818
1819impl AttributesConfig {
1820 /// Creates a new default instance.
1821 pub fn new() -> Self {
1822 std::default::Default::default()
1823 }
1824
1825 /// Sets the value of [name][crate::model::AttributesConfig::name].
1826 ///
1827 /// # Example
1828 /// ```ignore,no_run
1829 /// # use google_cloud_retail_v2::model::AttributesConfig;
1830 /// let x = AttributesConfig::new().set_name("example");
1831 /// ```
1832 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1833 self.name = v.into();
1834 self
1835 }
1836
1837 /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1838 ///
1839 /// # Example
1840 /// ```ignore,no_run
1841 /// # use google_cloud_retail_v2::model::AttributesConfig;
1842 /// use google_cloud_retail_v2::model::CatalogAttribute;
1843 /// let x = AttributesConfig::new().set_catalog_attributes([
1844 /// ("key0", CatalogAttribute::default()/* use setters */),
1845 /// ("key1", CatalogAttribute::default()/* use (different) setters */),
1846 /// ]);
1847 /// ```
1848 pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1849 where
1850 T: std::iter::IntoIterator<Item = (K, V)>,
1851 K: std::convert::Into<std::string::String>,
1852 V: std::convert::Into<crate::model::CatalogAttribute>,
1853 {
1854 use std::iter::Iterator;
1855 self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1856 self
1857 }
1858
1859 /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1860 ///
1861 /// # Example
1862 /// ```ignore,no_run
1863 /// # use google_cloud_retail_v2::model::AttributesConfig;
1864 /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1865 /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1866 /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1867 /// ```
1868 pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1869 mut self,
1870 v: T,
1871 ) -> Self {
1872 self.attribute_config_level = v.into();
1873 self
1874 }
1875}
1876
1877impl wkt::message::Message for AttributesConfig {
1878 fn typename() -> &'static str {
1879 "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1880 }
1881}
1882
1883/// Catalog level autocomplete config for customers to customize autocomplete
1884/// feature's settings.
1885#[derive(Clone, Default, PartialEq)]
1886#[non_exhaustive]
1887pub struct CompletionConfig {
1888 /// Required. Immutable. Fully qualified name
1889 /// `projects/*/locations/*/catalogs/*/completionConfig`
1890 pub name: std::string::String,
1891
1892 /// Specifies the matching order for autocomplete suggestions, e.g., a query
1893 /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1894 /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1895 /// suggest "red shoes". Currently supported values:
1896 ///
1897 /// * 'out-of-order'
1898 /// * 'exact-prefix'
1899 ///
1900 /// Default value: 'exact-prefix'.
1901 pub matching_order: std::string::String,
1902
1903 /// The maximum number of autocomplete suggestions returned per term. Default
1904 /// value is 20. If left unset or set to 0, then will fallback to default
1905 /// value.
1906 ///
1907 /// Value range is 1 to 20.
1908 pub max_suggestions: i32,
1909
1910 /// The minimum number of characters needed to be typed in order to get
1911 /// suggestions. Default value is 2. If left unset or set to 0, then will
1912 /// fallback to default value.
1913 ///
1914 /// Value range is 1 to 20.
1915 pub min_prefix_length: i32,
1916
1917 /// If set to true, the auto learning function is enabled. Auto learning uses
1918 /// user data to generate suggestions using ML techniques. Default value is
1919 /// false. Only after enabling auto learning can users use `cloud-retail`
1920 /// data in
1921 /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1922 ///
1923 /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1924 pub auto_learning: bool,
1925
1926 /// Output only. The source data for the latest import of the autocomplete
1927 /// suggestion phrases.
1928 pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1929
1930 /// Output only. Name of the LRO corresponding to the latest suggestion terms
1931 /// list import.
1932 ///
1933 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1934 /// method to retrieve the latest state of the Long Running Operation.
1935 pub last_suggestions_import_operation: std::string::String,
1936
1937 /// Output only. The source data for the latest import of the autocomplete
1938 /// denylist phrases.
1939 pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1940
1941 /// Output only. Name of the LRO corresponding to the latest denylist import.
1942 ///
1943 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1944 /// retrieve the latest state of the Long Running Operation.
1945 pub last_denylist_import_operation: std::string::String,
1946
1947 /// Output only. The source data for the latest import of the autocomplete
1948 /// allowlist phrases.
1949 pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1950
1951 /// Output only. Name of the LRO corresponding to the latest allowlist import.
1952 ///
1953 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1954 /// retrieve the latest state of the Long Running Operation.
1955 pub last_allowlist_import_operation: std::string::String,
1956
1957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1958}
1959
1960impl CompletionConfig {
1961 /// Creates a new default instance.
1962 pub fn new() -> Self {
1963 std::default::Default::default()
1964 }
1965
1966 /// Sets the value of [name][crate::model::CompletionConfig::name].
1967 ///
1968 /// # Example
1969 /// ```ignore,no_run
1970 /// # use google_cloud_retail_v2::model::CompletionConfig;
1971 /// let x = CompletionConfig::new().set_name("example");
1972 /// ```
1973 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1974 self.name = v.into();
1975 self
1976 }
1977
1978 /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1979 ///
1980 /// # Example
1981 /// ```ignore,no_run
1982 /// # use google_cloud_retail_v2::model::CompletionConfig;
1983 /// let x = CompletionConfig::new().set_matching_order("example");
1984 /// ```
1985 pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1986 self.matching_order = v.into();
1987 self
1988 }
1989
1990 /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1991 ///
1992 /// # Example
1993 /// ```ignore,no_run
1994 /// # use google_cloud_retail_v2::model::CompletionConfig;
1995 /// let x = CompletionConfig::new().set_max_suggestions(42);
1996 /// ```
1997 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1998 self.max_suggestions = v.into();
1999 self
2000 }
2001
2002 /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
2003 ///
2004 /// # Example
2005 /// ```ignore,no_run
2006 /// # use google_cloud_retail_v2::model::CompletionConfig;
2007 /// let x = CompletionConfig::new().set_min_prefix_length(42);
2008 /// ```
2009 pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2010 self.min_prefix_length = v.into();
2011 self
2012 }
2013
2014 /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2015 ///
2016 /// # Example
2017 /// ```ignore,no_run
2018 /// # use google_cloud_retail_v2::model::CompletionConfig;
2019 /// let x = CompletionConfig::new().set_auto_learning(true);
2020 /// ```
2021 pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2022 self.auto_learning = v.into();
2023 self
2024 }
2025
2026 /// Sets the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2027 ///
2028 /// # Example
2029 /// ```ignore,no_run
2030 /// # use google_cloud_retail_v2::model::CompletionConfig;
2031 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2032 /// let x = CompletionConfig::new().set_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2033 /// ```
2034 pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2035 where
2036 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2037 {
2038 self.suggestions_input_config = std::option::Option::Some(v.into());
2039 self
2040 }
2041
2042 /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2043 ///
2044 /// # Example
2045 /// ```ignore,no_run
2046 /// # use google_cloud_retail_v2::model::CompletionConfig;
2047 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2048 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2049 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2050 /// ```
2051 pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2052 where
2053 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2054 {
2055 self.suggestions_input_config = v.map(|x| x.into());
2056 self
2057 }
2058
2059 /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2060 ///
2061 /// # Example
2062 /// ```ignore,no_run
2063 /// # use google_cloud_retail_v2::model::CompletionConfig;
2064 /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2065 /// ```
2066 pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2067 mut self,
2068 v: T,
2069 ) -> Self {
2070 self.last_suggestions_import_operation = v.into();
2071 self
2072 }
2073
2074 /// Sets the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2075 ///
2076 /// # Example
2077 /// ```ignore,no_run
2078 /// # use google_cloud_retail_v2::model::CompletionConfig;
2079 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2080 /// let x = CompletionConfig::new().set_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2081 /// ```
2082 pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2083 where
2084 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2085 {
2086 self.denylist_input_config = std::option::Option::Some(v.into());
2087 self
2088 }
2089
2090 /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2091 ///
2092 /// # Example
2093 /// ```ignore,no_run
2094 /// # use google_cloud_retail_v2::model::CompletionConfig;
2095 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2096 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2097 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2098 /// ```
2099 pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2100 where
2101 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2102 {
2103 self.denylist_input_config = v.map(|x| x.into());
2104 self
2105 }
2106
2107 /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2108 ///
2109 /// # Example
2110 /// ```ignore,no_run
2111 /// # use google_cloud_retail_v2::model::CompletionConfig;
2112 /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2113 /// ```
2114 pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2115 mut self,
2116 v: T,
2117 ) -> Self {
2118 self.last_denylist_import_operation = v.into();
2119 self
2120 }
2121
2122 /// Sets the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2123 ///
2124 /// # Example
2125 /// ```ignore,no_run
2126 /// # use google_cloud_retail_v2::model::CompletionConfig;
2127 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2128 /// let x = CompletionConfig::new().set_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2129 /// ```
2130 pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2131 where
2132 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2133 {
2134 self.allowlist_input_config = std::option::Option::Some(v.into());
2135 self
2136 }
2137
2138 /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2139 ///
2140 /// # Example
2141 /// ```ignore,no_run
2142 /// # use google_cloud_retail_v2::model::CompletionConfig;
2143 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2144 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2145 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2146 /// ```
2147 pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2148 where
2149 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2150 {
2151 self.allowlist_input_config = v.map(|x| x.into());
2152 self
2153 }
2154
2155 /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2156 ///
2157 /// # Example
2158 /// ```ignore,no_run
2159 /// # use google_cloud_retail_v2::model::CompletionConfig;
2160 /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2161 /// ```
2162 pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2163 mut self,
2164 v: T,
2165 ) -> Self {
2166 self.last_allowlist_import_operation = v.into();
2167 self
2168 }
2169}
2170
2171impl wkt::message::Message for CompletionConfig {
2172 fn typename() -> &'static str {
2173 "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2174 }
2175}
2176
2177/// The catalog configuration.
2178#[derive(Clone, Default, PartialEq)]
2179#[non_exhaustive]
2180pub struct Catalog {
2181 /// Required. Immutable. The fully qualified resource name of the catalog.
2182 pub name: std::string::String,
2183
2184 /// Required. Immutable. The catalog display name.
2185 ///
2186 /// This field must be a UTF-8 encoded string with a length limit of 128
2187 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2188 pub display_name: std::string::String,
2189
2190 /// Required. The product level configuration.
2191 pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2192
2193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2194}
2195
2196impl Catalog {
2197 /// Creates a new default instance.
2198 pub fn new() -> Self {
2199 std::default::Default::default()
2200 }
2201
2202 /// Sets the value of [name][crate::model::Catalog::name].
2203 ///
2204 /// # Example
2205 /// ```ignore,no_run
2206 /// # use google_cloud_retail_v2::model::Catalog;
2207 /// let x = Catalog::new().set_name("example");
2208 /// ```
2209 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2210 self.name = v.into();
2211 self
2212 }
2213
2214 /// Sets the value of [display_name][crate::model::Catalog::display_name].
2215 ///
2216 /// # Example
2217 /// ```ignore,no_run
2218 /// # use google_cloud_retail_v2::model::Catalog;
2219 /// let x = Catalog::new().set_display_name("example");
2220 /// ```
2221 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2222 self.display_name = v.into();
2223 self
2224 }
2225
2226 /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2227 ///
2228 /// # Example
2229 /// ```ignore,no_run
2230 /// # use google_cloud_retail_v2::model::Catalog;
2231 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2232 /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2233 /// ```
2234 pub fn set_product_level_config<T>(mut self, v: T) -> Self
2235 where
2236 T: std::convert::Into<crate::model::ProductLevelConfig>,
2237 {
2238 self.product_level_config = std::option::Option::Some(v.into());
2239 self
2240 }
2241
2242 /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2243 ///
2244 /// # Example
2245 /// ```ignore,no_run
2246 /// # use google_cloud_retail_v2::model::Catalog;
2247 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2248 /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2249 /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2250 /// ```
2251 pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2252 where
2253 T: std::convert::Into<crate::model::ProductLevelConfig>,
2254 {
2255 self.product_level_config = v.map(|x| x.into());
2256 self
2257 }
2258}
2259
2260impl wkt::message::Message for Catalog {
2261 fn typename() -> &'static str {
2262 "type.googleapis.com/google.cloud.retail.v2.Catalog"
2263 }
2264}
2265
2266/// Request for
2267/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2268/// method.
2269///
2270/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2271#[derive(Clone, Default, PartialEq)]
2272#[non_exhaustive]
2273pub struct ListCatalogsRequest {
2274 /// Required. The account resource name with an associated location.
2275 ///
2276 /// If the caller does not have permission to list
2277 /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2278 /// of whether or not this location exists, a PERMISSION_DENIED error is
2279 /// returned.
2280 ///
2281 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2282 pub parent: std::string::String,
2283
2284 /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2285 /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2286 /// above 1000 will be coerced to 1000.
2287 ///
2288 /// If this field is negative, an INVALID_ARGUMENT is returned.
2289 ///
2290 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2291 pub page_size: i32,
2292
2293 /// A page token
2294 /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2295 /// received from a previous
2296 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2297 /// call. Provide this to retrieve the subsequent page.
2298 ///
2299 /// When paginating, all other parameters provided to
2300 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2301 /// must match the call that provided the page token. Otherwise, an
2302 /// INVALID_ARGUMENT error is returned.
2303 ///
2304 /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2305 /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2306 pub page_token: std::string::String,
2307
2308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2309}
2310
2311impl ListCatalogsRequest {
2312 /// Creates a new default instance.
2313 pub fn new() -> Self {
2314 std::default::Default::default()
2315 }
2316
2317 /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2318 ///
2319 /// # Example
2320 /// ```ignore,no_run
2321 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2322 /// let x = ListCatalogsRequest::new().set_parent("example");
2323 /// ```
2324 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2325 self.parent = v.into();
2326 self
2327 }
2328
2329 /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2330 ///
2331 /// # Example
2332 /// ```ignore,no_run
2333 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2334 /// let x = ListCatalogsRequest::new().set_page_size(42);
2335 /// ```
2336 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2337 self.page_size = v.into();
2338 self
2339 }
2340
2341 /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2342 ///
2343 /// # Example
2344 /// ```ignore,no_run
2345 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2346 /// let x = ListCatalogsRequest::new().set_page_token("example");
2347 /// ```
2348 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2349 self.page_token = v.into();
2350 self
2351 }
2352}
2353
2354impl wkt::message::Message for ListCatalogsRequest {
2355 fn typename() -> &'static str {
2356 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2357 }
2358}
2359
2360/// Response for
2361/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2362/// method.
2363///
2364/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2365#[derive(Clone, Default, PartialEq)]
2366#[non_exhaustive]
2367pub struct ListCatalogsResponse {
2368 /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2369 ///
2370 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2371 pub catalogs: std::vec::Vec<crate::model::Catalog>,
2372
2373 /// A token that can be sent as
2374 /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2375 /// to retrieve the next page. If this field is omitted, there are no
2376 /// subsequent pages.
2377 ///
2378 /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2379 pub next_page_token: std::string::String,
2380
2381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2382}
2383
2384impl ListCatalogsResponse {
2385 /// Creates a new default instance.
2386 pub fn new() -> Self {
2387 std::default::Default::default()
2388 }
2389
2390 /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2391 ///
2392 /// # Example
2393 /// ```ignore,no_run
2394 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2395 /// use google_cloud_retail_v2::model::Catalog;
2396 /// let x = ListCatalogsResponse::new()
2397 /// .set_catalogs([
2398 /// Catalog::default()/* use setters */,
2399 /// Catalog::default()/* use (different) setters */,
2400 /// ]);
2401 /// ```
2402 pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2403 where
2404 T: std::iter::IntoIterator<Item = V>,
2405 V: std::convert::Into<crate::model::Catalog>,
2406 {
2407 use std::iter::Iterator;
2408 self.catalogs = v.into_iter().map(|i| i.into()).collect();
2409 self
2410 }
2411
2412 /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2413 ///
2414 /// # Example
2415 /// ```ignore,no_run
2416 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2417 /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2418 /// ```
2419 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2420 self.next_page_token = v.into();
2421 self
2422 }
2423}
2424
2425impl wkt::message::Message for ListCatalogsResponse {
2426 fn typename() -> &'static str {
2427 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2428 }
2429}
2430
2431#[doc(hidden)]
2432impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2433 type PageItem = crate::model::Catalog;
2434
2435 fn items(self) -> std::vec::Vec<Self::PageItem> {
2436 self.catalogs
2437 }
2438
2439 fn next_page_token(&self) -> std::string::String {
2440 use std::clone::Clone;
2441 self.next_page_token.clone()
2442 }
2443}
2444
2445/// Request for
2446/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2447/// method.
2448///
2449/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2450#[derive(Clone, Default, PartialEq)]
2451#[non_exhaustive]
2452pub struct UpdateCatalogRequest {
2453 /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2454 ///
2455 /// If the caller does not have permission to update the
2456 /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2457 /// exists, a PERMISSION_DENIED error is returned.
2458 ///
2459 /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2460 /// a NOT_FOUND error is returned.
2461 ///
2462 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2463 pub catalog: std::option::Option<crate::model::Catalog>,
2464
2465 /// Indicates which fields in the provided
2466 /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2467 ///
2468 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2469 /// is returned.
2470 ///
2471 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2472 pub update_mask: std::option::Option<wkt::FieldMask>,
2473
2474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2475}
2476
2477impl UpdateCatalogRequest {
2478 /// Creates a new default instance.
2479 pub fn new() -> Self {
2480 std::default::Default::default()
2481 }
2482
2483 /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2484 ///
2485 /// # Example
2486 /// ```ignore,no_run
2487 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2488 /// use google_cloud_retail_v2::model::Catalog;
2489 /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2490 /// ```
2491 pub fn set_catalog<T>(mut self, v: T) -> Self
2492 where
2493 T: std::convert::Into<crate::model::Catalog>,
2494 {
2495 self.catalog = std::option::Option::Some(v.into());
2496 self
2497 }
2498
2499 /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2500 ///
2501 /// # Example
2502 /// ```ignore,no_run
2503 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2504 /// use google_cloud_retail_v2::model::Catalog;
2505 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2506 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2507 /// ```
2508 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2509 where
2510 T: std::convert::Into<crate::model::Catalog>,
2511 {
2512 self.catalog = v.map(|x| x.into());
2513 self
2514 }
2515
2516 /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2517 ///
2518 /// # Example
2519 /// ```ignore,no_run
2520 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2521 /// use wkt::FieldMask;
2522 /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2523 /// ```
2524 pub fn set_update_mask<T>(mut self, v: T) -> Self
2525 where
2526 T: std::convert::Into<wkt::FieldMask>,
2527 {
2528 self.update_mask = std::option::Option::Some(v.into());
2529 self
2530 }
2531
2532 /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2533 ///
2534 /// # Example
2535 /// ```ignore,no_run
2536 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2537 /// use wkt::FieldMask;
2538 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2539 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2540 /// ```
2541 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2542 where
2543 T: std::convert::Into<wkt::FieldMask>,
2544 {
2545 self.update_mask = v.map(|x| x.into());
2546 self
2547 }
2548}
2549
2550impl wkt::message::Message for UpdateCatalogRequest {
2551 fn typename() -> &'static str {
2552 "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2553 }
2554}
2555
2556/// Request message to set a specified branch as new default_branch.
2557#[derive(Clone, Default, PartialEq)]
2558#[non_exhaustive]
2559pub struct SetDefaultBranchRequest {
2560 /// Full resource name of the catalog, such as
2561 /// `projects/*/locations/global/catalogs/default_catalog`.
2562 pub catalog: std::string::String,
2563
2564 /// The final component of the resource name of a branch.
2565 ///
2566 /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2567 /// error is returned.
2568 ///
2569 /// If there are no sufficient active products in the targeted branch and
2570 /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2571 /// FAILED_PRECONDITION error is returned.
2572 ///
2573 /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2574 pub branch_id: std::string::String,
2575
2576 /// Some note on this request, this can be retrieved by
2577 /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2578 /// before next valid default branch set occurs.
2579 ///
2580 /// This field must be a UTF-8 encoded string with a length limit of 1,000
2581 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2582 ///
2583 /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2584 pub note: std::string::String,
2585
2586 /// If set to true, it permits switching to a branch with
2587 /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2588 /// if it has no sufficient active products.
2589 ///
2590 /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2591 pub force: bool,
2592
2593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2594}
2595
2596impl SetDefaultBranchRequest {
2597 /// Creates a new default instance.
2598 pub fn new() -> Self {
2599 std::default::Default::default()
2600 }
2601
2602 /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2603 ///
2604 /// # Example
2605 /// ```ignore,no_run
2606 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2607 /// let x = SetDefaultBranchRequest::new().set_catalog("example");
2608 /// ```
2609 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.catalog = v.into();
2611 self
2612 }
2613
2614 /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2615 ///
2616 /// # Example
2617 /// ```ignore,no_run
2618 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2619 /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2620 /// ```
2621 pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2622 self.branch_id = v.into();
2623 self
2624 }
2625
2626 /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2631 /// let x = SetDefaultBranchRequest::new().set_note("example");
2632 /// ```
2633 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2634 self.note = v.into();
2635 self
2636 }
2637
2638 /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2643 /// let x = SetDefaultBranchRequest::new().set_force(true);
2644 /// ```
2645 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2646 self.force = v.into();
2647 self
2648 }
2649}
2650
2651impl wkt::message::Message for SetDefaultBranchRequest {
2652 fn typename() -> &'static str {
2653 "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2654 }
2655}
2656
2657/// Request message to show which branch is currently the default branch.
2658#[derive(Clone, Default, PartialEq)]
2659#[non_exhaustive]
2660pub struct GetDefaultBranchRequest {
2661 /// The parent catalog resource name, such as
2662 /// `projects/*/locations/global/catalogs/default_catalog`.
2663 pub catalog: std::string::String,
2664
2665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2666}
2667
2668impl GetDefaultBranchRequest {
2669 /// Creates a new default instance.
2670 pub fn new() -> Self {
2671 std::default::Default::default()
2672 }
2673
2674 /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2675 ///
2676 /// # Example
2677 /// ```ignore,no_run
2678 /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2679 /// let x = GetDefaultBranchRequest::new().set_catalog("example");
2680 /// ```
2681 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2682 self.catalog = v.into();
2683 self
2684 }
2685}
2686
2687impl wkt::message::Message for GetDefaultBranchRequest {
2688 fn typename() -> &'static str {
2689 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2690 }
2691}
2692
2693/// Response message of
2694/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2695///
2696/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2697#[derive(Clone, Default, PartialEq)]
2698#[non_exhaustive]
2699pub struct GetDefaultBranchResponse {
2700 /// Full resource name of the branch id currently set as default branch.
2701 pub branch: std::string::String,
2702
2703 /// The time when this branch is set to default.
2704 pub set_time: std::option::Option<wkt::Timestamp>,
2705
2706 /// This corresponds to
2707 /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2708 /// field, when this branch was set as default.
2709 ///
2710 /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2711 pub note: std::string::String,
2712
2713 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2714}
2715
2716impl GetDefaultBranchResponse {
2717 /// Creates a new default instance.
2718 pub fn new() -> Self {
2719 std::default::Default::default()
2720 }
2721
2722 /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2723 ///
2724 /// # Example
2725 /// ```ignore,no_run
2726 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2727 /// let x = GetDefaultBranchResponse::new().set_branch("example");
2728 /// ```
2729 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2730 self.branch = v.into();
2731 self
2732 }
2733
2734 /// Sets 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_set_time(Timestamp::default()/* use setters */);
2741 /// ```
2742 pub fn set_set_time<T>(mut self, v: T) -> Self
2743 where
2744 T: std::convert::Into<wkt::Timestamp>,
2745 {
2746 self.set_time = std::option::Option::Some(v.into());
2747 self
2748 }
2749
2750 /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2751 ///
2752 /// # Example
2753 /// ```ignore,no_run
2754 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2755 /// use wkt::Timestamp;
2756 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2757 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2758 /// ```
2759 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2760 where
2761 T: std::convert::Into<wkt::Timestamp>,
2762 {
2763 self.set_time = v.map(|x| x.into());
2764 self
2765 }
2766
2767 /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2768 ///
2769 /// # Example
2770 /// ```ignore,no_run
2771 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2772 /// let x = GetDefaultBranchResponse::new().set_note("example");
2773 /// ```
2774 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2775 self.note = v.into();
2776 self
2777 }
2778}
2779
2780impl wkt::message::Message for GetDefaultBranchResponse {
2781 fn typename() -> &'static str {
2782 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2783 }
2784}
2785
2786/// Request for
2787/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2788/// method.
2789///
2790/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2791#[derive(Clone, Default, PartialEq)]
2792#[non_exhaustive]
2793pub struct GetCompletionConfigRequest {
2794 /// Required. Full CompletionConfig resource name. Format:
2795 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2796 pub name: std::string::String,
2797
2798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2799}
2800
2801impl GetCompletionConfigRequest {
2802 /// Creates a new default instance.
2803 pub fn new() -> Self {
2804 std::default::Default::default()
2805 }
2806
2807 /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2808 ///
2809 /// # Example
2810 /// ```ignore,no_run
2811 /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2812 /// let x = GetCompletionConfigRequest::new().set_name("example");
2813 /// ```
2814 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2815 self.name = v.into();
2816 self
2817 }
2818}
2819
2820impl wkt::message::Message for GetCompletionConfigRequest {
2821 fn typename() -> &'static str {
2822 "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2823 }
2824}
2825
2826/// Request for
2827/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2828/// method.
2829///
2830/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2831#[derive(Clone, Default, PartialEq)]
2832#[non_exhaustive]
2833pub struct UpdateCompletionConfigRequest {
2834 /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2835 /// to update.
2836 ///
2837 /// If the caller does not have permission to update the
2838 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2839 /// PERMISSION_DENIED error is returned.
2840 ///
2841 /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2842 /// update does not exist, a NOT_FOUND error is returned.
2843 ///
2844 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2845 pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2846
2847 /// Indicates which fields in the provided
2848 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2849 /// following are the only supported fields:
2850 ///
2851 /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2852 /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2853 /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2854 /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2855 ///
2856 /// If not set, all supported fields are updated.
2857 ///
2858 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2859 /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2860 /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2861 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2862 /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2863 pub update_mask: std::option::Option<wkt::FieldMask>,
2864
2865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2866}
2867
2868impl UpdateCompletionConfigRequest {
2869 /// Creates a new default instance.
2870 pub fn new() -> Self {
2871 std::default::Default::default()
2872 }
2873
2874 /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2875 ///
2876 /// # Example
2877 /// ```ignore,no_run
2878 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2879 /// use google_cloud_retail_v2::model::CompletionConfig;
2880 /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2881 /// ```
2882 pub fn set_completion_config<T>(mut self, v: T) -> Self
2883 where
2884 T: std::convert::Into<crate::model::CompletionConfig>,
2885 {
2886 self.completion_config = std::option::Option::Some(v.into());
2887 self
2888 }
2889
2890 /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2891 ///
2892 /// # Example
2893 /// ```ignore,no_run
2894 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2895 /// use google_cloud_retail_v2::model::CompletionConfig;
2896 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2897 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2898 /// ```
2899 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2900 where
2901 T: std::convert::Into<crate::model::CompletionConfig>,
2902 {
2903 self.completion_config = v.map(|x| x.into());
2904 self
2905 }
2906
2907 /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2908 ///
2909 /// # Example
2910 /// ```ignore,no_run
2911 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2912 /// use wkt::FieldMask;
2913 /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2914 /// ```
2915 pub fn set_update_mask<T>(mut self, v: T) -> Self
2916 where
2917 T: std::convert::Into<wkt::FieldMask>,
2918 {
2919 self.update_mask = std::option::Option::Some(v.into());
2920 self
2921 }
2922
2923 /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2924 ///
2925 /// # Example
2926 /// ```ignore,no_run
2927 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2928 /// use wkt::FieldMask;
2929 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2930 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2931 /// ```
2932 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2933 where
2934 T: std::convert::Into<wkt::FieldMask>,
2935 {
2936 self.update_mask = v.map(|x| x.into());
2937 self
2938 }
2939}
2940
2941impl wkt::message::Message for UpdateCompletionConfigRequest {
2942 fn typename() -> &'static str {
2943 "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2944 }
2945}
2946
2947/// Request for
2948/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2949/// method.
2950///
2951/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2952#[derive(Clone, Default, PartialEq)]
2953#[non_exhaustive]
2954pub struct GetAttributesConfigRequest {
2955 /// Required. Full AttributesConfig resource name. Format:
2956 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2957 pub name: std::string::String,
2958
2959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2960}
2961
2962impl GetAttributesConfigRequest {
2963 /// Creates a new default instance.
2964 pub fn new() -> Self {
2965 std::default::Default::default()
2966 }
2967
2968 /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2969 ///
2970 /// # Example
2971 /// ```ignore,no_run
2972 /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2973 /// let x = GetAttributesConfigRequest::new().set_name("example");
2974 /// ```
2975 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2976 self.name = v.into();
2977 self
2978 }
2979}
2980
2981impl wkt::message::Message for GetAttributesConfigRequest {
2982 fn typename() -> &'static str {
2983 "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
2984 }
2985}
2986
2987/// Request for
2988/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
2989/// method.
2990///
2991/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
2992#[derive(Clone, Default, PartialEq)]
2993#[non_exhaustive]
2994pub struct UpdateAttributesConfigRequest {
2995 /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
2996 /// to update.
2997 ///
2998 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2999 pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
3000
3001 /// Indicates which fields in the provided
3002 /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
3003 /// following is the only supported field:
3004 ///
3005 /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
3006 ///
3007 /// If not set, all supported fields are updated.
3008 ///
3009 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
3010 /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
3011 pub update_mask: std::option::Option<wkt::FieldMask>,
3012
3013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3014}
3015
3016impl UpdateAttributesConfigRequest {
3017 /// Creates a new default instance.
3018 pub fn new() -> Self {
3019 std::default::Default::default()
3020 }
3021
3022 /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3023 ///
3024 /// # Example
3025 /// ```ignore,no_run
3026 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3027 /// use google_cloud_retail_v2::model::AttributesConfig;
3028 /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3029 /// ```
3030 pub fn set_attributes_config<T>(mut self, v: T) -> Self
3031 where
3032 T: std::convert::Into<crate::model::AttributesConfig>,
3033 {
3034 self.attributes_config = std::option::Option::Some(v.into());
3035 self
3036 }
3037
3038 /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3039 ///
3040 /// # Example
3041 /// ```ignore,no_run
3042 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3043 /// use google_cloud_retail_v2::model::AttributesConfig;
3044 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3045 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3046 /// ```
3047 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3048 where
3049 T: std::convert::Into<crate::model::AttributesConfig>,
3050 {
3051 self.attributes_config = v.map(|x| x.into());
3052 self
3053 }
3054
3055 /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3056 ///
3057 /// # Example
3058 /// ```ignore,no_run
3059 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3060 /// use wkt::FieldMask;
3061 /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3062 /// ```
3063 pub fn set_update_mask<T>(mut self, v: T) -> Self
3064 where
3065 T: std::convert::Into<wkt::FieldMask>,
3066 {
3067 self.update_mask = std::option::Option::Some(v.into());
3068 self
3069 }
3070
3071 /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3072 ///
3073 /// # Example
3074 /// ```ignore,no_run
3075 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3076 /// use wkt::FieldMask;
3077 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3078 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3079 /// ```
3080 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3081 where
3082 T: std::convert::Into<wkt::FieldMask>,
3083 {
3084 self.update_mask = v.map(|x| x.into());
3085 self
3086 }
3087}
3088
3089impl wkt::message::Message for UpdateAttributesConfigRequest {
3090 fn typename() -> &'static str {
3091 "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3092 }
3093}
3094
3095/// Request for
3096/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3097/// method.
3098///
3099/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3100#[derive(Clone, Default, PartialEq)]
3101#[non_exhaustive]
3102pub struct AddCatalogAttributeRequest {
3103 /// Required. Full AttributesConfig resource name. Format:
3104 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3105 pub attributes_config: std::string::String,
3106
3107 /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3108 /// to add.
3109 ///
3110 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3111 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3112
3113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3114}
3115
3116impl AddCatalogAttributeRequest {
3117 /// Creates a new default instance.
3118 pub fn new() -> Self {
3119 std::default::Default::default()
3120 }
3121
3122 /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3123 ///
3124 /// # Example
3125 /// ```ignore,no_run
3126 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3127 /// let x = AddCatalogAttributeRequest::new().set_attributes_config("example");
3128 /// ```
3129 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3130 mut self,
3131 v: T,
3132 ) -> Self {
3133 self.attributes_config = v.into();
3134 self
3135 }
3136
3137 /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3138 ///
3139 /// # Example
3140 /// ```ignore,no_run
3141 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3142 /// use google_cloud_retail_v2::model::CatalogAttribute;
3143 /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3144 /// ```
3145 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3146 where
3147 T: std::convert::Into<crate::model::CatalogAttribute>,
3148 {
3149 self.catalog_attribute = std::option::Option::Some(v.into());
3150 self
3151 }
3152
3153 /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3154 ///
3155 /// # Example
3156 /// ```ignore,no_run
3157 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3158 /// use google_cloud_retail_v2::model::CatalogAttribute;
3159 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3160 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3161 /// ```
3162 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3163 where
3164 T: std::convert::Into<crate::model::CatalogAttribute>,
3165 {
3166 self.catalog_attribute = v.map(|x| x.into());
3167 self
3168 }
3169}
3170
3171impl wkt::message::Message for AddCatalogAttributeRequest {
3172 fn typename() -> &'static str {
3173 "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3174 }
3175}
3176
3177/// Request for
3178/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3179/// method.
3180///
3181/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3182#[derive(Clone, Default, PartialEq)]
3183#[non_exhaustive]
3184pub struct RemoveCatalogAttributeRequest {
3185 /// Required. Full AttributesConfig resource name. Format:
3186 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3187 pub attributes_config: std::string::String,
3188
3189 /// Required. The attribute name key of the
3190 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3191 ///
3192 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3193 pub key: std::string::String,
3194
3195 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3196}
3197
3198impl RemoveCatalogAttributeRequest {
3199 /// Creates a new default instance.
3200 pub fn new() -> Self {
3201 std::default::Default::default()
3202 }
3203
3204 /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3205 ///
3206 /// # Example
3207 /// ```ignore,no_run
3208 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3209 /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config("example");
3210 /// ```
3211 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3212 mut self,
3213 v: T,
3214 ) -> Self {
3215 self.attributes_config = v.into();
3216 self
3217 }
3218
3219 /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3220 ///
3221 /// # Example
3222 /// ```ignore,no_run
3223 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3224 /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3225 /// ```
3226 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3227 self.key = v.into();
3228 self
3229 }
3230}
3231
3232impl wkt::message::Message for RemoveCatalogAttributeRequest {
3233 fn typename() -> &'static str {
3234 "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3235 }
3236}
3237
3238/// Request for
3239/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3240/// method.
3241///
3242/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3243#[derive(Clone, Default, PartialEq)]
3244#[non_exhaustive]
3245pub struct ReplaceCatalogAttributeRequest {
3246 /// Required. Full AttributesConfig resource name. Format:
3247 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3248 pub attributes_config: std::string::String,
3249
3250 /// Required. The updated
3251 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3252 ///
3253 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3254 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3255
3256 /// Indicates which fields in the provided
3257 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3258 /// following are NOT supported:
3259 ///
3260 /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3261 ///
3262 /// If not set, all supported fields are updated.
3263 ///
3264 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3265 /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3266 pub update_mask: std::option::Option<wkt::FieldMask>,
3267
3268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3269}
3270
3271impl ReplaceCatalogAttributeRequest {
3272 /// Creates a new default instance.
3273 pub fn new() -> Self {
3274 std::default::Default::default()
3275 }
3276
3277 /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3282 /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config("example");
3283 /// ```
3284 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3285 mut self,
3286 v: T,
3287 ) -> Self {
3288 self.attributes_config = v.into();
3289 self
3290 }
3291
3292 /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3293 ///
3294 /// # Example
3295 /// ```ignore,no_run
3296 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3297 /// use google_cloud_retail_v2::model::CatalogAttribute;
3298 /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3299 /// ```
3300 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3301 where
3302 T: std::convert::Into<crate::model::CatalogAttribute>,
3303 {
3304 self.catalog_attribute = std::option::Option::Some(v.into());
3305 self
3306 }
3307
3308 /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3309 ///
3310 /// # Example
3311 /// ```ignore,no_run
3312 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3313 /// use google_cloud_retail_v2::model::CatalogAttribute;
3314 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3315 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3316 /// ```
3317 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3318 where
3319 T: std::convert::Into<crate::model::CatalogAttribute>,
3320 {
3321 self.catalog_attribute = v.map(|x| x.into());
3322 self
3323 }
3324
3325 /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3326 ///
3327 /// # Example
3328 /// ```ignore,no_run
3329 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3330 /// use wkt::FieldMask;
3331 /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3332 /// ```
3333 pub fn set_update_mask<T>(mut self, v: T) -> Self
3334 where
3335 T: std::convert::Into<wkt::FieldMask>,
3336 {
3337 self.update_mask = std::option::Option::Some(v.into());
3338 self
3339 }
3340
3341 /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3342 ///
3343 /// # Example
3344 /// ```ignore,no_run
3345 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3346 /// use wkt::FieldMask;
3347 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3348 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3349 /// ```
3350 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3351 where
3352 T: std::convert::Into<wkt::FieldMask>,
3353 {
3354 self.update_mask = v.map(|x| x.into());
3355 self
3356 }
3357}
3358
3359impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3360 fn typename() -> &'static str {
3361 "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3362 }
3363}
3364
3365/// Metadata that is used to define a condition that triggers an action.
3366/// A valid condition must specify at least one of 'query_terms' or
3367/// 'products_filter'. If multiple fields are specified, the condition is met if
3368/// all the fields are satisfied e.g. if a set of query terms and product_filter
3369/// are set, then only items matching the product_filter for requests with a
3370/// query matching the query terms wil get boosted.
3371#[derive(Clone, Default, PartialEq)]
3372#[non_exhaustive]
3373pub struct Condition {
3374 /// A list (up to 10 entries) of terms to match the query on. If not
3375 /// specified, match all queries.
3376 /// If many query terms are specified, the condition
3377 /// is matched if any of the terms is a match (i.e. using the OR operator).
3378 pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3379
3380 /// Range of time(s) specifying when Condition is active.
3381 /// Condition true if any time range matches.
3382 pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3383
3384 /// Used to support browse uses cases.
3385 /// A list (up to 10 entries) of categories or departments.
3386 /// The format should be the same as
3387 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3388 ///
3389 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3390 pub page_categories: std::vec::Vec<std::string::String>,
3391
3392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3393}
3394
3395impl Condition {
3396 /// Creates a new default instance.
3397 pub fn new() -> Self {
3398 std::default::Default::default()
3399 }
3400
3401 /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3402 ///
3403 /// # Example
3404 /// ```ignore,no_run
3405 /// # use google_cloud_retail_v2::model::Condition;
3406 /// use google_cloud_retail_v2::model::condition::QueryTerm;
3407 /// let x = Condition::new()
3408 /// .set_query_terms([
3409 /// QueryTerm::default()/* use setters */,
3410 /// QueryTerm::default()/* use (different) setters */,
3411 /// ]);
3412 /// ```
3413 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3414 where
3415 T: std::iter::IntoIterator<Item = V>,
3416 V: std::convert::Into<crate::model::condition::QueryTerm>,
3417 {
3418 use std::iter::Iterator;
3419 self.query_terms = v.into_iter().map(|i| i.into()).collect();
3420 self
3421 }
3422
3423 /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3424 ///
3425 /// # Example
3426 /// ```ignore,no_run
3427 /// # use google_cloud_retail_v2::model::Condition;
3428 /// use google_cloud_retail_v2::model::condition::TimeRange;
3429 /// let x = Condition::new()
3430 /// .set_active_time_range([
3431 /// TimeRange::default()/* use setters */,
3432 /// TimeRange::default()/* use (different) setters */,
3433 /// ]);
3434 /// ```
3435 pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3436 where
3437 T: std::iter::IntoIterator<Item = V>,
3438 V: std::convert::Into<crate::model::condition::TimeRange>,
3439 {
3440 use std::iter::Iterator;
3441 self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3442 self
3443 }
3444
3445 /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3446 ///
3447 /// # Example
3448 /// ```ignore,no_run
3449 /// # use google_cloud_retail_v2::model::Condition;
3450 /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3451 /// ```
3452 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3453 where
3454 T: std::iter::IntoIterator<Item = V>,
3455 V: std::convert::Into<std::string::String>,
3456 {
3457 use std::iter::Iterator;
3458 self.page_categories = v.into_iter().map(|i| i.into()).collect();
3459 self
3460 }
3461}
3462
3463impl wkt::message::Message for Condition {
3464 fn typename() -> &'static str {
3465 "type.googleapis.com/google.cloud.retail.v2.Condition"
3466 }
3467}
3468
3469/// Defines additional types related to [Condition].
3470pub mod condition {
3471 #[allow(unused_imports)]
3472 use super::*;
3473
3474 /// Query terms that we want to match on.
3475 #[derive(Clone, Default, PartialEq)]
3476 #[non_exhaustive]
3477 pub struct QueryTerm {
3478 /// The value of the term to match on.
3479 /// Value cannot be empty.
3480 /// Value can have at most 3 terms if specified as a partial match. Each
3481 /// space separated string is considered as one term.
3482 /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3483 /// and not allowed for a partial match.
3484 pub value: std::string::String,
3485
3486 /// Whether this is supposed to be a full or partial match.
3487 pub full_match: bool,
3488
3489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3490 }
3491
3492 impl QueryTerm {
3493 /// Creates a new default instance.
3494 pub fn new() -> Self {
3495 std::default::Default::default()
3496 }
3497
3498 /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3499 ///
3500 /// # Example
3501 /// ```ignore,no_run
3502 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3503 /// let x = QueryTerm::new().set_value("example");
3504 /// ```
3505 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3506 self.value = v.into();
3507 self
3508 }
3509
3510 /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3511 ///
3512 /// # Example
3513 /// ```ignore,no_run
3514 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3515 /// let x = QueryTerm::new().set_full_match(true);
3516 /// ```
3517 pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3518 self.full_match = v.into();
3519 self
3520 }
3521 }
3522
3523 impl wkt::message::Message for QueryTerm {
3524 fn typename() -> &'static str {
3525 "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3526 }
3527 }
3528
3529 /// Used for time-dependent conditions.
3530 /// Example: Want to have rule applied for week long sale.
3531 #[derive(Clone, Default, PartialEq)]
3532 #[non_exhaustive]
3533 pub struct TimeRange {
3534 /// Start of time range. Range is inclusive.
3535 pub start_time: std::option::Option<wkt::Timestamp>,
3536
3537 /// End of time range. Range is inclusive.
3538 pub end_time: std::option::Option<wkt::Timestamp>,
3539
3540 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3541 }
3542
3543 impl TimeRange {
3544 /// Creates a new default instance.
3545 pub fn new() -> Self {
3546 std::default::Default::default()
3547 }
3548
3549 /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3550 ///
3551 /// # Example
3552 /// ```ignore,no_run
3553 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3554 /// use wkt::Timestamp;
3555 /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3556 /// ```
3557 pub fn set_start_time<T>(mut self, v: T) -> Self
3558 where
3559 T: std::convert::Into<wkt::Timestamp>,
3560 {
3561 self.start_time = std::option::Option::Some(v.into());
3562 self
3563 }
3564
3565 /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3570 /// use wkt::Timestamp;
3571 /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3572 /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3573 /// ```
3574 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3575 where
3576 T: std::convert::Into<wkt::Timestamp>,
3577 {
3578 self.start_time = v.map(|x| x.into());
3579 self
3580 }
3581
3582 /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3583 ///
3584 /// # Example
3585 /// ```ignore,no_run
3586 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3587 /// use wkt::Timestamp;
3588 /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3589 /// ```
3590 pub fn set_end_time<T>(mut self, v: T) -> Self
3591 where
3592 T: std::convert::Into<wkt::Timestamp>,
3593 {
3594 self.end_time = std::option::Option::Some(v.into());
3595 self
3596 }
3597
3598 /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3603 /// use wkt::Timestamp;
3604 /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3605 /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3606 /// ```
3607 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3608 where
3609 T: std::convert::Into<wkt::Timestamp>,
3610 {
3611 self.end_time = v.map(|x| x.into());
3612 self
3613 }
3614 }
3615
3616 impl wkt::message::Message for TimeRange {
3617 fn typename() -> &'static str {
3618 "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3619 }
3620 }
3621}
3622
3623/// A rule is a condition-action pair
3624///
3625/// * A condition defines when a rule is to be triggered.
3626/// * An action specifies what occurs on that trigger.
3627/// Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3628/// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3629///
3630/// [google.cloud.retail.v2.Control]: crate::model::Control
3631/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3632#[derive(Clone, Default, PartialEq)]
3633#[non_exhaustive]
3634pub struct Rule {
3635 /// Required. The condition that triggers the rule.
3636 /// If the condition is empty, the rule will always apply.
3637 pub condition: std::option::Option<crate::model::Condition>,
3638
3639 /// An action must be provided.
3640 pub action: std::option::Option<crate::model::rule::Action>,
3641
3642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3643}
3644
3645impl Rule {
3646 /// Creates a new default instance.
3647 pub fn new() -> Self {
3648 std::default::Default::default()
3649 }
3650
3651 /// Sets the value of [condition][crate::model::Rule::condition].
3652 ///
3653 /// # Example
3654 /// ```ignore,no_run
3655 /// # use google_cloud_retail_v2::model::Rule;
3656 /// use google_cloud_retail_v2::model::Condition;
3657 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3658 /// ```
3659 pub fn set_condition<T>(mut self, v: T) -> Self
3660 where
3661 T: std::convert::Into<crate::model::Condition>,
3662 {
3663 self.condition = std::option::Option::Some(v.into());
3664 self
3665 }
3666
3667 /// Sets or clears the value of [condition][crate::model::Rule::condition].
3668 ///
3669 /// # Example
3670 /// ```ignore,no_run
3671 /// # use google_cloud_retail_v2::model::Rule;
3672 /// use google_cloud_retail_v2::model::Condition;
3673 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3674 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3675 /// ```
3676 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3677 where
3678 T: std::convert::Into<crate::model::Condition>,
3679 {
3680 self.condition = v.map(|x| x.into());
3681 self
3682 }
3683
3684 /// Sets the value of [action][crate::model::Rule::action].
3685 ///
3686 /// Note that all the setters affecting `action` are mutually
3687 /// exclusive.
3688 ///
3689 /// # Example
3690 /// ```ignore,no_run
3691 /// # use google_cloud_retail_v2::model::Rule;
3692 /// use google_cloud_retail_v2::model::rule::BoostAction;
3693 /// let x = Rule::new().set_action(Some(
3694 /// google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3695 /// ```
3696 pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3697 mut self,
3698 v: T,
3699 ) -> Self {
3700 self.action = v.into();
3701 self
3702 }
3703
3704 /// The value of [action][crate::model::Rule::action]
3705 /// if it holds a `BoostAction`, `None` if the field is not set or
3706 /// holds a different branch.
3707 pub fn boost_action(
3708 &self,
3709 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3710 #[allow(unreachable_patterns)]
3711 self.action.as_ref().and_then(|v| match v {
3712 crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3713 _ => std::option::Option::None,
3714 })
3715 }
3716
3717 /// Sets the value of [action][crate::model::Rule::action]
3718 /// to hold a `BoostAction`.
3719 ///
3720 /// Note that all the setters affecting `action` are
3721 /// mutually exclusive.
3722 ///
3723 /// # Example
3724 /// ```ignore,no_run
3725 /// # use google_cloud_retail_v2::model::Rule;
3726 /// use google_cloud_retail_v2::model::rule::BoostAction;
3727 /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3728 /// assert!(x.boost_action().is_some());
3729 /// assert!(x.redirect_action().is_none());
3730 /// assert!(x.oneway_synonyms_action().is_none());
3731 /// assert!(x.do_not_associate_action().is_none());
3732 /// assert!(x.replacement_action().is_none());
3733 /// assert!(x.ignore_action().is_none());
3734 /// assert!(x.filter_action().is_none());
3735 /// assert!(x.twoway_synonyms_action().is_none());
3736 /// assert!(x.force_return_facet_action().is_none());
3737 /// assert!(x.remove_facet_action().is_none());
3738 /// assert!(x.pin_action().is_none());
3739 /// ```
3740 pub fn set_boost_action<
3741 T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3742 >(
3743 mut self,
3744 v: T,
3745 ) -> Self {
3746 self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3747 self
3748 }
3749
3750 /// The value of [action][crate::model::Rule::action]
3751 /// if it holds a `RedirectAction`, `None` if the field is not set or
3752 /// holds a different branch.
3753 pub fn redirect_action(
3754 &self,
3755 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3756 #[allow(unreachable_patterns)]
3757 self.action.as_ref().and_then(|v| match v {
3758 crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3759 _ => std::option::Option::None,
3760 })
3761 }
3762
3763 /// Sets the value of [action][crate::model::Rule::action]
3764 /// to hold a `RedirectAction`.
3765 ///
3766 /// Note that all the setters affecting `action` are
3767 /// mutually exclusive.
3768 ///
3769 /// # Example
3770 /// ```ignore,no_run
3771 /// # use google_cloud_retail_v2::model::Rule;
3772 /// use google_cloud_retail_v2::model::rule::RedirectAction;
3773 /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3774 /// assert!(x.redirect_action().is_some());
3775 /// assert!(x.boost_action().is_none());
3776 /// assert!(x.oneway_synonyms_action().is_none());
3777 /// assert!(x.do_not_associate_action().is_none());
3778 /// assert!(x.replacement_action().is_none());
3779 /// assert!(x.ignore_action().is_none());
3780 /// assert!(x.filter_action().is_none());
3781 /// assert!(x.twoway_synonyms_action().is_none());
3782 /// assert!(x.force_return_facet_action().is_none());
3783 /// assert!(x.remove_facet_action().is_none());
3784 /// assert!(x.pin_action().is_none());
3785 /// ```
3786 pub fn set_redirect_action<
3787 T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3788 >(
3789 mut self,
3790 v: T,
3791 ) -> Self {
3792 self.action =
3793 std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3794 self
3795 }
3796
3797 /// The value of [action][crate::model::Rule::action]
3798 /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3799 /// holds a different branch.
3800 pub fn oneway_synonyms_action(
3801 &self,
3802 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3803 #[allow(unreachable_patterns)]
3804 self.action.as_ref().and_then(|v| match v {
3805 crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3806 _ => std::option::Option::None,
3807 })
3808 }
3809
3810 /// Sets the value of [action][crate::model::Rule::action]
3811 /// to hold a `OnewaySynonymsAction`.
3812 ///
3813 /// Note that all the setters affecting `action` are
3814 /// mutually exclusive.
3815 ///
3816 /// # Example
3817 /// ```ignore,no_run
3818 /// # use google_cloud_retail_v2::model::Rule;
3819 /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3820 /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3821 /// assert!(x.oneway_synonyms_action().is_some());
3822 /// assert!(x.boost_action().is_none());
3823 /// assert!(x.redirect_action().is_none());
3824 /// assert!(x.do_not_associate_action().is_none());
3825 /// assert!(x.replacement_action().is_none());
3826 /// assert!(x.ignore_action().is_none());
3827 /// assert!(x.filter_action().is_none());
3828 /// assert!(x.twoway_synonyms_action().is_none());
3829 /// assert!(x.force_return_facet_action().is_none());
3830 /// assert!(x.remove_facet_action().is_none());
3831 /// assert!(x.pin_action().is_none());
3832 /// ```
3833 pub fn set_oneway_synonyms_action<
3834 T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3835 >(
3836 mut self,
3837 v: T,
3838 ) -> Self {
3839 self.action =
3840 std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3841 self
3842 }
3843
3844 /// The value of [action][crate::model::Rule::action]
3845 /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3846 /// holds a different branch.
3847 pub fn do_not_associate_action(
3848 &self,
3849 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3850 #[allow(unreachable_patterns)]
3851 self.action.as_ref().and_then(|v| match v {
3852 crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3853 _ => std::option::Option::None,
3854 })
3855 }
3856
3857 /// Sets the value of [action][crate::model::Rule::action]
3858 /// to hold a `DoNotAssociateAction`.
3859 ///
3860 /// Note that all the setters affecting `action` are
3861 /// mutually exclusive.
3862 ///
3863 /// # Example
3864 /// ```ignore,no_run
3865 /// # use google_cloud_retail_v2::model::Rule;
3866 /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3867 /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3868 /// assert!(x.do_not_associate_action().is_some());
3869 /// assert!(x.boost_action().is_none());
3870 /// assert!(x.redirect_action().is_none());
3871 /// assert!(x.oneway_synonyms_action().is_none());
3872 /// assert!(x.replacement_action().is_none());
3873 /// assert!(x.ignore_action().is_none());
3874 /// assert!(x.filter_action().is_none());
3875 /// assert!(x.twoway_synonyms_action().is_none());
3876 /// assert!(x.force_return_facet_action().is_none());
3877 /// assert!(x.remove_facet_action().is_none());
3878 /// assert!(x.pin_action().is_none());
3879 /// ```
3880 pub fn set_do_not_associate_action<
3881 T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3882 >(
3883 mut self,
3884 v: T,
3885 ) -> Self {
3886 self.action =
3887 std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3888 self
3889 }
3890
3891 /// The value of [action][crate::model::Rule::action]
3892 /// if it holds a `ReplacementAction`, `None` if the field is not set or
3893 /// holds a different branch.
3894 pub fn replacement_action(
3895 &self,
3896 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3897 #[allow(unreachable_patterns)]
3898 self.action.as_ref().and_then(|v| match v {
3899 crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3900 _ => std::option::Option::None,
3901 })
3902 }
3903
3904 /// Sets the value of [action][crate::model::Rule::action]
3905 /// to hold a `ReplacementAction`.
3906 ///
3907 /// Note that all the setters affecting `action` are
3908 /// mutually exclusive.
3909 ///
3910 /// # Example
3911 /// ```ignore,no_run
3912 /// # use google_cloud_retail_v2::model::Rule;
3913 /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3914 /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3915 /// assert!(x.replacement_action().is_some());
3916 /// assert!(x.boost_action().is_none());
3917 /// assert!(x.redirect_action().is_none());
3918 /// assert!(x.oneway_synonyms_action().is_none());
3919 /// assert!(x.do_not_associate_action().is_none());
3920 /// assert!(x.ignore_action().is_none());
3921 /// assert!(x.filter_action().is_none());
3922 /// assert!(x.twoway_synonyms_action().is_none());
3923 /// assert!(x.force_return_facet_action().is_none());
3924 /// assert!(x.remove_facet_action().is_none());
3925 /// assert!(x.pin_action().is_none());
3926 /// ```
3927 pub fn set_replacement_action<
3928 T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3929 >(
3930 mut self,
3931 v: T,
3932 ) -> Self {
3933 self.action =
3934 std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3935 self
3936 }
3937
3938 /// The value of [action][crate::model::Rule::action]
3939 /// if it holds a `IgnoreAction`, `None` if the field is not set or
3940 /// holds a different branch.
3941 pub fn ignore_action(
3942 &self,
3943 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3944 #[allow(unreachable_patterns)]
3945 self.action.as_ref().and_then(|v| match v {
3946 crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3947 _ => std::option::Option::None,
3948 })
3949 }
3950
3951 /// Sets the value of [action][crate::model::Rule::action]
3952 /// to hold a `IgnoreAction`.
3953 ///
3954 /// Note that all the setters affecting `action` are
3955 /// mutually exclusive.
3956 ///
3957 /// # Example
3958 /// ```ignore,no_run
3959 /// # use google_cloud_retail_v2::model::Rule;
3960 /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3961 /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3962 /// assert!(x.ignore_action().is_some());
3963 /// assert!(x.boost_action().is_none());
3964 /// assert!(x.redirect_action().is_none());
3965 /// assert!(x.oneway_synonyms_action().is_none());
3966 /// assert!(x.do_not_associate_action().is_none());
3967 /// assert!(x.replacement_action().is_none());
3968 /// assert!(x.filter_action().is_none());
3969 /// assert!(x.twoway_synonyms_action().is_none());
3970 /// assert!(x.force_return_facet_action().is_none());
3971 /// assert!(x.remove_facet_action().is_none());
3972 /// assert!(x.pin_action().is_none());
3973 /// ```
3974 pub fn set_ignore_action<
3975 T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
3976 >(
3977 mut self,
3978 v: T,
3979 ) -> Self {
3980 self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
3981 self
3982 }
3983
3984 /// The value of [action][crate::model::Rule::action]
3985 /// if it holds a `FilterAction`, `None` if the field is not set or
3986 /// holds a different branch.
3987 pub fn filter_action(
3988 &self,
3989 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
3990 #[allow(unreachable_patterns)]
3991 self.action.as_ref().and_then(|v| match v {
3992 crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
3993 _ => std::option::Option::None,
3994 })
3995 }
3996
3997 /// Sets the value of [action][crate::model::Rule::action]
3998 /// to hold a `FilterAction`.
3999 ///
4000 /// Note that all the setters affecting `action` are
4001 /// mutually exclusive.
4002 ///
4003 /// # Example
4004 /// ```ignore,no_run
4005 /// # use google_cloud_retail_v2::model::Rule;
4006 /// use google_cloud_retail_v2::model::rule::FilterAction;
4007 /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
4008 /// assert!(x.filter_action().is_some());
4009 /// assert!(x.boost_action().is_none());
4010 /// assert!(x.redirect_action().is_none());
4011 /// assert!(x.oneway_synonyms_action().is_none());
4012 /// assert!(x.do_not_associate_action().is_none());
4013 /// assert!(x.replacement_action().is_none());
4014 /// assert!(x.ignore_action().is_none());
4015 /// assert!(x.twoway_synonyms_action().is_none());
4016 /// assert!(x.force_return_facet_action().is_none());
4017 /// assert!(x.remove_facet_action().is_none());
4018 /// assert!(x.pin_action().is_none());
4019 /// ```
4020 pub fn set_filter_action<
4021 T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
4022 >(
4023 mut self,
4024 v: T,
4025 ) -> Self {
4026 self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4027 self
4028 }
4029
4030 /// The value of [action][crate::model::Rule::action]
4031 /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4032 /// holds a different branch.
4033 pub fn twoway_synonyms_action(
4034 &self,
4035 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4036 #[allow(unreachable_patterns)]
4037 self.action.as_ref().and_then(|v| match v {
4038 crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4039 _ => std::option::Option::None,
4040 })
4041 }
4042
4043 /// Sets the value of [action][crate::model::Rule::action]
4044 /// to hold a `TwowaySynonymsAction`.
4045 ///
4046 /// Note that all the setters affecting `action` are
4047 /// mutually exclusive.
4048 ///
4049 /// # Example
4050 /// ```ignore,no_run
4051 /// # use google_cloud_retail_v2::model::Rule;
4052 /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4053 /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4054 /// assert!(x.twoway_synonyms_action().is_some());
4055 /// assert!(x.boost_action().is_none());
4056 /// assert!(x.redirect_action().is_none());
4057 /// assert!(x.oneway_synonyms_action().is_none());
4058 /// assert!(x.do_not_associate_action().is_none());
4059 /// assert!(x.replacement_action().is_none());
4060 /// assert!(x.ignore_action().is_none());
4061 /// assert!(x.filter_action().is_none());
4062 /// assert!(x.force_return_facet_action().is_none());
4063 /// assert!(x.remove_facet_action().is_none());
4064 /// assert!(x.pin_action().is_none());
4065 /// ```
4066 pub fn set_twoway_synonyms_action<
4067 T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4068 >(
4069 mut self,
4070 v: T,
4071 ) -> Self {
4072 self.action =
4073 std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4074 self
4075 }
4076
4077 /// The value of [action][crate::model::Rule::action]
4078 /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4079 /// holds a different branch.
4080 pub fn force_return_facet_action(
4081 &self,
4082 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4083 #[allow(unreachable_patterns)]
4084 self.action.as_ref().and_then(|v| match v {
4085 crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4086 _ => std::option::Option::None,
4087 })
4088 }
4089
4090 /// Sets the value of [action][crate::model::Rule::action]
4091 /// to hold a `ForceReturnFacetAction`.
4092 ///
4093 /// Note that all the setters affecting `action` are
4094 /// mutually exclusive.
4095 ///
4096 /// # Example
4097 /// ```ignore,no_run
4098 /// # use google_cloud_retail_v2::model::Rule;
4099 /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4100 /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4101 /// assert!(x.force_return_facet_action().is_some());
4102 /// assert!(x.boost_action().is_none());
4103 /// assert!(x.redirect_action().is_none());
4104 /// assert!(x.oneway_synonyms_action().is_none());
4105 /// assert!(x.do_not_associate_action().is_none());
4106 /// assert!(x.replacement_action().is_none());
4107 /// assert!(x.ignore_action().is_none());
4108 /// assert!(x.filter_action().is_none());
4109 /// assert!(x.twoway_synonyms_action().is_none());
4110 /// assert!(x.remove_facet_action().is_none());
4111 /// assert!(x.pin_action().is_none());
4112 /// ```
4113 pub fn set_force_return_facet_action<
4114 T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4115 >(
4116 mut self,
4117 v: T,
4118 ) -> Self {
4119 self.action =
4120 std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4121 self
4122 }
4123
4124 /// The value of [action][crate::model::Rule::action]
4125 /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4126 /// holds a different branch.
4127 pub fn remove_facet_action(
4128 &self,
4129 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4130 #[allow(unreachable_patterns)]
4131 self.action.as_ref().and_then(|v| match v {
4132 crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4133 _ => std::option::Option::None,
4134 })
4135 }
4136
4137 /// Sets the value of [action][crate::model::Rule::action]
4138 /// to hold a `RemoveFacetAction`.
4139 ///
4140 /// Note that all the setters affecting `action` are
4141 /// mutually exclusive.
4142 ///
4143 /// # Example
4144 /// ```ignore,no_run
4145 /// # use google_cloud_retail_v2::model::Rule;
4146 /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4147 /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4148 /// assert!(x.remove_facet_action().is_some());
4149 /// assert!(x.boost_action().is_none());
4150 /// assert!(x.redirect_action().is_none());
4151 /// assert!(x.oneway_synonyms_action().is_none());
4152 /// assert!(x.do_not_associate_action().is_none());
4153 /// assert!(x.replacement_action().is_none());
4154 /// assert!(x.ignore_action().is_none());
4155 /// assert!(x.filter_action().is_none());
4156 /// assert!(x.twoway_synonyms_action().is_none());
4157 /// assert!(x.force_return_facet_action().is_none());
4158 /// assert!(x.pin_action().is_none());
4159 /// ```
4160 pub fn set_remove_facet_action<
4161 T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4162 >(
4163 mut self,
4164 v: T,
4165 ) -> Self {
4166 self.action =
4167 std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4168 self
4169 }
4170
4171 /// The value of [action][crate::model::Rule::action]
4172 /// if it holds a `PinAction`, `None` if the field is not set or
4173 /// holds a different branch.
4174 pub fn pin_action(
4175 &self,
4176 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4177 #[allow(unreachable_patterns)]
4178 self.action.as_ref().and_then(|v| match v {
4179 crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4180 _ => std::option::Option::None,
4181 })
4182 }
4183
4184 /// Sets the value of [action][crate::model::Rule::action]
4185 /// to hold a `PinAction`.
4186 ///
4187 /// Note that all the setters affecting `action` are
4188 /// mutually exclusive.
4189 ///
4190 /// # Example
4191 /// ```ignore,no_run
4192 /// # use google_cloud_retail_v2::model::Rule;
4193 /// use google_cloud_retail_v2::model::rule::PinAction;
4194 /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4195 /// assert!(x.pin_action().is_some());
4196 /// assert!(x.boost_action().is_none());
4197 /// assert!(x.redirect_action().is_none());
4198 /// assert!(x.oneway_synonyms_action().is_none());
4199 /// assert!(x.do_not_associate_action().is_none());
4200 /// assert!(x.replacement_action().is_none());
4201 /// assert!(x.ignore_action().is_none());
4202 /// assert!(x.filter_action().is_none());
4203 /// assert!(x.twoway_synonyms_action().is_none());
4204 /// assert!(x.force_return_facet_action().is_none());
4205 /// assert!(x.remove_facet_action().is_none());
4206 /// ```
4207 pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4208 mut self,
4209 v: T,
4210 ) -> Self {
4211 self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4212 self
4213 }
4214}
4215
4216impl wkt::message::Message for Rule {
4217 fn typename() -> &'static str {
4218 "type.googleapis.com/google.cloud.retail.v2.Rule"
4219 }
4220}
4221
4222/// Defines additional types related to [Rule].
4223pub mod rule {
4224 #[allow(unused_imports)]
4225 use super::*;
4226
4227 /// A boost action to apply to results matching condition specified above.
4228 #[derive(Clone, Default, PartialEq)]
4229 #[non_exhaustive]
4230 pub struct BoostAction {
4231 /// Strength of the condition boost, which must be in [-1, 1]. Negative
4232 /// boost means demotion. Default is 0.0.
4233 ///
4234 /// Setting to 1.0 gives the item a big promotion. However, it does not
4235 /// necessarily mean that the boosted item will be the top result at all
4236 /// times, nor that other items will be excluded. Results could still be
4237 /// shown even when none of them matches the condition. And results that
4238 /// are significantly more relevant to the search query can still trump
4239 /// your heavily favored but irrelevant items.
4240 ///
4241 /// Setting to -1.0 gives the item a big demotion. However, results that
4242 /// are deeply relevant might still be shown. The item will have an
4243 /// upstream battle to get a fairly high ranking, but it is not blocked out
4244 /// completely.
4245 ///
4246 /// Setting to 0.0 means no boost applied. The boosting condition is
4247 /// ignored.
4248 pub boost: f32,
4249
4250 /// The filter can have a max size of 5000 characters.
4251 /// An expression which specifies which products to apply an action to.
4252 /// The syntax and supported fields are the same as a filter expression. See
4253 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4254 /// detail syntax and limitations.
4255 ///
4256 /// Examples:
4257 ///
4258 /// * To boost products with product ID "product_1" or "product_2", and
4259 /// color
4260 /// "Red" or "Blue":\<br\>
4261 /// *(id: ANY("product_1", "product_2"))<br>*
4262 /// *AND<br>*
4263 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4264 ///
4265 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4266 pub products_filter: std::string::String,
4267
4268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4269 }
4270
4271 impl BoostAction {
4272 /// Creates a new default instance.
4273 pub fn new() -> Self {
4274 std::default::Default::default()
4275 }
4276
4277 /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4278 ///
4279 /// # Example
4280 /// ```ignore,no_run
4281 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4282 /// let x = BoostAction::new().set_boost(42.0);
4283 /// ```
4284 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4285 self.boost = v.into();
4286 self
4287 }
4288
4289 /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4290 ///
4291 /// # Example
4292 /// ```ignore,no_run
4293 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4294 /// let x = BoostAction::new().set_products_filter("example");
4295 /// ```
4296 pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4297 mut self,
4298 v: T,
4299 ) -> Self {
4300 self.products_filter = v.into();
4301 self
4302 }
4303 }
4304
4305 impl wkt::message::Message for BoostAction {
4306 fn typename() -> &'static str {
4307 "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4308 }
4309 }
4310
4311 /// * Rule Condition:
4312 ///
4313 /// - No
4314 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4315 /// provided is a global match.
4316 /// - 1 or more
4317 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4318 /// provided are combined with OR operator.
4319 /// * Action Input: The request query and filter that are applied to the
4320 /// retrieved products, in addition to any filters already provided with the
4321 /// SearchRequest. The AND operator is used to combine the query's existing
4322 /// filters with the filter rule(s). NOTE: May result in 0 results when
4323 /// filters conflict.
4324 ///
4325 /// * Action Result: Filters the returned objects to be ONLY those that passed
4326 /// the filter.
4327 ///
4328 ///
4329 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4330 #[derive(Clone, Default, PartialEq)]
4331 #[non_exhaustive]
4332 pub struct FilterAction {
4333 /// A filter to apply on the matching condition results. Supported features:
4334 ///
4335 /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4336 /// * Filter syntax is identical to
4337 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4338 /// more
4339 /// information, see [Filter](/retail/docs/filter-and-order#filter).
4340 /// * To filter products with product ID "product_1" or "product_2", and
4341 /// color
4342 /// "Red" or "Blue":\<br\>
4343 /// *(id: ANY("product_1", "product_2"))<br>*
4344 /// *AND<br>*
4345 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4346 ///
4347 /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4348 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4349 pub filter: std::string::String,
4350
4351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4352 }
4353
4354 impl FilterAction {
4355 /// Creates a new default instance.
4356 pub fn new() -> Self {
4357 std::default::Default::default()
4358 }
4359
4360 /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4361 ///
4362 /// # Example
4363 /// ```ignore,no_run
4364 /// # use google_cloud_retail_v2::model::rule::FilterAction;
4365 /// let x = FilterAction::new().set_filter("example");
4366 /// ```
4367 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4368 self.filter = v.into();
4369 self
4370 }
4371 }
4372
4373 impl wkt::message::Message for FilterAction {
4374 fn typename() -> &'static str {
4375 "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4376 }
4377 }
4378
4379 /// Redirects a shopper to a specific page.
4380 ///
4381 /// * Rule Condition:
4382 /// Must specify
4383 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4384 /// * Action Input: Request Query
4385 /// * Action Result: Redirects shopper to provided uri.
4386 ///
4387 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4388 #[derive(Clone, Default, PartialEq)]
4389 #[non_exhaustive]
4390 pub struct RedirectAction {
4391 /// URL must have length equal or less than 2000 characters.
4392 pub redirect_uri: std::string::String,
4393
4394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4395 }
4396
4397 impl RedirectAction {
4398 /// Creates a new default instance.
4399 pub fn new() -> Self {
4400 std::default::Default::default()
4401 }
4402
4403 /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4404 ///
4405 /// # Example
4406 /// ```ignore,no_run
4407 /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4408 /// let x = RedirectAction::new().set_redirect_uri("example");
4409 /// ```
4410 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4411 mut self,
4412 v: T,
4413 ) -> Self {
4414 self.redirect_uri = v.into();
4415 self
4416 }
4417 }
4418
4419 impl wkt::message::Message for RedirectAction {
4420 fn typename() -> &'static str {
4421 "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4422 }
4423 }
4424
4425 /// Creates a set of terms that will be treated as synonyms of each other.
4426 /// Example: synonyms of "sneakers" and "shoes":
4427 ///
4428 /// * "sneakers" will use a synonym of "shoes".
4429 /// * "shoes" will use a synonym of "sneakers".
4430 #[derive(Clone, Default, PartialEq)]
4431 #[non_exhaustive]
4432 pub struct TwowaySynonymsAction {
4433 /// Defines a set of synonyms.
4434 /// Can specify up to 100 synonyms.
4435 /// Must specify at least 2 synonyms.
4436 pub synonyms: std::vec::Vec<std::string::String>,
4437
4438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4439 }
4440
4441 impl TwowaySynonymsAction {
4442 /// Creates a new default instance.
4443 pub fn new() -> Self {
4444 std::default::Default::default()
4445 }
4446
4447 /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4448 ///
4449 /// # Example
4450 /// ```ignore,no_run
4451 /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4452 /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4453 /// ```
4454 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4455 where
4456 T: std::iter::IntoIterator<Item = V>,
4457 V: std::convert::Into<std::string::String>,
4458 {
4459 use std::iter::Iterator;
4460 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4461 self
4462 }
4463 }
4464
4465 impl wkt::message::Message for TwowaySynonymsAction {
4466 fn typename() -> &'static str {
4467 "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4468 }
4469 }
4470
4471 /// Maps a set of terms to a set of synonyms.
4472 /// Set of synonyms will be treated as synonyms of each query term only.
4473 /// `query_terms` will not be treated as synonyms of each other.
4474 /// Example: "sneakers" will use a synonym of "shoes".
4475 /// "shoes" will not use a synonym of "sneakers".
4476 #[derive(Clone, Default, PartialEq)]
4477 #[non_exhaustive]
4478 pub struct OnewaySynonymsAction {
4479 /// Terms from the search query.
4480 /// Will treat synonyms as their synonyms.
4481 /// Not themselves synonyms of the synonyms.
4482 /// Can specify up to 100 terms.
4483 pub query_terms: std::vec::Vec<std::string::String>,
4484
4485 /// Defines a set of synonyms.
4486 /// Cannot contain duplicates.
4487 /// Can specify up to 100 synonyms.
4488 pub synonyms: std::vec::Vec<std::string::String>,
4489
4490 /// Will be [deprecated = true] post migration;
4491 pub oneway_terms: std::vec::Vec<std::string::String>,
4492
4493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4494 }
4495
4496 impl OnewaySynonymsAction {
4497 /// Creates a new default instance.
4498 pub fn new() -> Self {
4499 std::default::Default::default()
4500 }
4501
4502 /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4503 ///
4504 /// # Example
4505 /// ```ignore,no_run
4506 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4507 /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4508 /// ```
4509 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4510 where
4511 T: std::iter::IntoIterator<Item = V>,
4512 V: std::convert::Into<std::string::String>,
4513 {
4514 use std::iter::Iterator;
4515 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4516 self
4517 }
4518
4519 /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4520 ///
4521 /// # Example
4522 /// ```ignore,no_run
4523 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4524 /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4525 /// ```
4526 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4527 where
4528 T: std::iter::IntoIterator<Item = V>,
4529 V: std::convert::Into<std::string::String>,
4530 {
4531 use std::iter::Iterator;
4532 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4533 self
4534 }
4535
4536 /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4537 ///
4538 /// # Example
4539 /// ```ignore,no_run
4540 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4541 /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4542 /// ```
4543 pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4544 where
4545 T: std::iter::IntoIterator<Item = V>,
4546 V: std::convert::Into<std::string::String>,
4547 {
4548 use std::iter::Iterator;
4549 self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4550 self
4551 }
4552 }
4553
4554 impl wkt::message::Message for OnewaySynonymsAction {
4555 fn typename() -> &'static str {
4556 "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4557 }
4558 }
4559
4560 /// Prevents `query_term` from being associated with specified terms during
4561 /// search.
4562 /// Example: Don't associate "gShoe" and "cheap".
4563 #[derive(Clone, Default, PartialEq)]
4564 #[non_exhaustive]
4565 pub struct DoNotAssociateAction {
4566 /// Terms from the search query.
4567 /// Will not consider do_not_associate_terms for search if in search query.
4568 /// Can specify up to 100 terms.
4569 pub query_terms: std::vec::Vec<std::string::String>,
4570
4571 /// Cannot contain duplicates or the query term.
4572 /// Can specify up to 100 terms.
4573 pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4574
4575 /// Will be [deprecated = true] post migration;
4576 pub terms: std::vec::Vec<std::string::String>,
4577
4578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4579 }
4580
4581 impl DoNotAssociateAction {
4582 /// Creates a new default instance.
4583 pub fn new() -> Self {
4584 std::default::Default::default()
4585 }
4586
4587 /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4588 ///
4589 /// # Example
4590 /// ```ignore,no_run
4591 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4592 /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4593 /// ```
4594 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4595 where
4596 T: std::iter::IntoIterator<Item = V>,
4597 V: std::convert::Into<std::string::String>,
4598 {
4599 use std::iter::Iterator;
4600 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4601 self
4602 }
4603
4604 /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4605 ///
4606 /// # Example
4607 /// ```ignore,no_run
4608 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4609 /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4610 /// ```
4611 pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4612 where
4613 T: std::iter::IntoIterator<Item = V>,
4614 V: std::convert::Into<std::string::String>,
4615 {
4616 use std::iter::Iterator;
4617 self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4618 self
4619 }
4620
4621 /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4622 ///
4623 /// # Example
4624 /// ```ignore,no_run
4625 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4626 /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4627 /// ```
4628 pub fn set_terms<T, V>(mut self, v: T) -> Self
4629 where
4630 T: std::iter::IntoIterator<Item = V>,
4631 V: std::convert::Into<std::string::String>,
4632 {
4633 use std::iter::Iterator;
4634 self.terms = v.into_iter().map(|i| i.into()).collect();
4635 self
4636 }
4637 }
4638
4639 impl wkt::message::Message for DoNotAssociateAction {
4640 fn typename() -> &'static str {
4641 "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4642 }
4643 }
4644
4645 /// Replaces a term in the query. Multiple replacement candidates can be
4646 /// specified. All `query_terms` will be replaced with the replacement term.
4647 /// Example: Replace "gShoe" with "google shoe".
4648 #[derive(Clone, Default, PartialEq)]
4649 #[non_exhaustive]
4650 pub struct ReplacementAction {
4651 /// Terms from the search query.
4652 /// Will be replaced by replacement term.
4653 /// Can specify up to 100 terms.
4654 pub query_terms: std::vec::Vec<std::string::String>,
4655
4656 /// Term that will be used for replacement.
4657 pub replacement_term: std::string::String,
4658
4659 /// Will be [deprecated = true] post migration;
4660 pub term: std::string::String,
4661
4662 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4663 }
4664
4665 impl ReplacementAction {
4666 /// Creates a new default instance.
4667 pub fn new() -> Self {
4668 std::default::Default::default()
4669 }
4670
4671 /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4672 ///
4673 /// # Example
4674 /// ```ignore,no_run
4675 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4676 /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4677 /// ```
4678 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4679 where
4680 T: std::iter::IntoIterator<Item = V>,
4681 V: std::convert::Into<std::string::String>,
4682 {
4683 use std::iter::Iterator;
4684 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4685 self
4686 }
4687
4688 /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4689 ///
4690 /// # Example
4691 /// ```ignore,no_run
4692 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4693 /// let x = ReplacementAction::new().set_replacement_term("example");
4694 /// ```
4695 pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4696 mut self,
4697 v: T,
4698 ) -> Self {
4699 self.replacement_term = v.into();
4700 self
4701 }
4702
4703 /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4704 ///
4705 /// # Example
4706 /// ```ignore,no_run
4707 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4708 /// let x = ReplacementAction::new().set_term("example");
4709 /// ```
4710 pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4711 self.term = v.into();
4712 self
4713 }
4714 }
4715
4716 impl wkt::message::Message for ReplacementAction {
4717 fn typename() -> &'static str {
4718 "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4719 }
4720 }
4721
4722 /// Prevents a term in the query from being used in search.
4723 /// Example: Don't search for "shoddy".
4724 #[derive(Clone, Default, PartialEq)]
4725 #[non_exhaustive]
4726 pub struct IgnoreAction {
4727 /// Terms to ignore in the search query.
4728 pub ignore_terms: std::vec::Vec<std::string::String>,
4729
4730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4731 }
4732
4733 impl IgnoreAction {
4734 /// Creates a new default instance.
4735 pub fn new() -> Self {
4736 std::default::Default::default()
4737 }
4738
4739 /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4740 ///
4741 /// # Example
4742 /// ```ignore,no_run
4743 /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4744 /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4745 /// ```
4746 pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4747 where
4748 T: std::iter::IntoIterator<Item = V>,
4749 V: std::convert::Into<std::string::String>,
4750 {
4751 use std::iter::Iterator;
4752 self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4753 self
4754 }
4755 }
4756
4757 impl wkt::message::Message for IgnoreAction {
4758 fn typename() -> &'static str {
4759 "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4760 }
4761 }
4762
4763 /// Force returns an attribute/facet in the request around a certain position
4764 /// or above.
4765 ///
4766 /// * Rule Condition:
4767 /// Must specify non-empty
4768 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4769 /// (for search only) or
4770 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4771 /// (for browse only), but can't specify both.
4772 ///
4773 /// * Action Inputs: attribute name, position
4774 ///
4775 /// * Action Result: Will force return a facet key around a certain position
4776 /// or above if the condition is satisfied.
4777 ///
4778 ///
4779 /// Example: Suppose the query is "shoes", the
4780 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4781 /// "shoes", the
4782 /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4783 /// is "size" and the
4784 /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4785 /// is 8.
4786 ///
4787 /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4788 /// the facet "size" will appear at a position close to 8. b) The facet key
4789 /// "size" in among the top 8 positions in the request, then it will stay at
4790 /// its current rank.
4791 ///
4792 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4793 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4794 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4795 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4796 #[derive(Clone, Default, PartialEq)]
4797 #[non_exhaustive]
4798 pub struct ForceReturnFacetAction {
4799 /// Each instance corresponds to a force return attribute for the given
4800 /// condition. There can't be more 15 instances here.
4801 pub facet_position_adjustments:
4802 std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4803
4804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4805 }
4806
4807 impl ForceReturnFacetAction {
4808 /// Creates a new default instance.
4809 pub fn new() -> Self {
4810 std::default::Default::default()
4811 }
4812
4813 /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4814 ///
4815 /// # Example
4816 /// ```ignore,no_run
4817 /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4818 /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4819 /// let x = ForceReturnFacetAction::new()
4820 /// .set_facet_position_adjustments([
4821 /// FacetPositionAdjustment::default()/* use setters */,
4822 /// FacetPositionAdjustment::default()/* use (different) setters */,
4823 /// ]);
4824 /// ```
4825 pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4826 where
4827 T: std::iter::IntoIterator<Item = V>,
4828 V: std::convert::Into<
4829 crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4830 >,
4831 {
4832 use std::iter::Iterator;
4833 self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4834 self
4835 }
4836 }
4837
4838 impl wkt::message::Message for ForceReturnFacetAction {
4839 fn typename() -> &'static str {
4840 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4841 }
4842 }
4843
4844 /// Defines additional types related to [ForceReturnFacetAction].
4845 pub mod force_return_facet_action {
4846 #[allow(unused_imports)]
4847 use super::*;
4848
4849 /// Each facet position adjustment consists of a single attribute name (i.e.
4850 /// facet key) along with a specified position.
4851 #[derive(Clone, Default, PartialEq)]
4852 #[non_exhaustive]
4853 pub struct FacetPositionAdjustment {
4854 /// The attribute name to force return as a facet. Each attribute name
4855 /// should be a valid attribute name, be non-empty and contain at most 80
4856 /// characters long.
4857 pub attribute_name: std::string::String,
4858
4859 /// This is the position in the request as explained above. It should be
4860 /// strictly positive be at most 100.
4861 pub position: i32,
4862
4863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4864 }
4865
4866 impl FacetPositionAdjustment {
4867 /// Creates a new default instance.
4868 pub fn new() -> Self {
4869 std::default::Default::default()
4870 }
4871
4872 /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4873 ///
4874 /// # Example
4875 /// ```ignore,no_run
4876 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4877 /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4878 /// ```
4879 pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4880 mut self,
4881 v: T,
4882 ) -> Self {
4883 self.attribute_name = v.into();
4884 self
4885 }
4886
4887 /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4888 ///
4889 /// # Example
4890 /// ```ignore,no_run
4891 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4892 /// let x = FacetPositionAdjustment::new().set_position(42);
4893 /// ```
4894 pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4895 self.position = v.into();
4896 self
4897 }
4898 }
4899
4900 impl wkt::message::Message for FacetPositionAdjustment {
4901 fn typename() -> &'static str {
4902 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4903 }
4904 }
4905 }
4906
4907 /// Removes an attribute/facet in the request if is present.
4908 ///
4909 /// * Rule Condition:
4910 /// Must specify non-empty
4911 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4912 /// (for search only) or
4913 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4914 /// (for browse only), but can't specify both.
4915 ///
4916 /// * Action Input: attribute name
4917 ///
4918 /// * Action Result: Will remove the attribute (as a facet) from the request
4919 /// if it is present.
4920 ///
4921 ///
4922 /// Example: Suppose the query is "shoes", the
4923 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4924 /// "shoes" and the attribute name "size", then facet key "size" will be
4925 /// removed from the request (if it is present).
4926 ///
4927 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4928 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4929 #[derive(Clone, Default, PartialEq)]
4930 #[non_exhaustive]
4931 pub struct RemoveFacetAction {
4932 /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4933 /// (if present in the request). There can't be more 3 attribute names.
4934 /// Each attribute name should be a valid attribute name, be non-empty and
4935 /// contain at most 80 characters.
4936 pub attribute_names: std::vec::Vec<std::string::String>,
4937
4938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4939 }
4940
4941 impl RemoveFacetAction {
4942 /// Creates a new default instance.
4943 pub fn new() -> Self {
4944 std::default::Default::default()
4945 }
4946
4947 /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4948 ///
4949 /// # Example
4950 /// ```ignore,no_run
4951 /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4952 /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4953 /// ```
4954 pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4955 where
4956 T: std::iter::IntoIterator<Item = V>,
4957 V: std::convert::Into<std::string::String>,
4958 {
4959 use std::iter::Iterator;
4960 self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4961 self
4962 }
4963 }
4964
4965 impl wkt::message::Message for RemoveFacetAction {
4966 fn typename() -> &'static str {
4967 "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
4968 }
4969 }
4970
4971 /// Pins one or more specified products to a specific position in the
4972 /// results.
4973 ///
4974 /// * Rule Condition:
4975 /// Must specify non-empty
4976 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4977 /// (for search only) or
4978 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4979 /// (for browse only), but can't specify both.
4980 ///
4981 /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
4982 /// uses 1-based indexing).
4983 ///
4984 /// * Action Result: Will pin products with matching ids to the position
4985 /// specified in the final result order.
4986 ///
4987 ///
4988 /// Example: Suppose the query is `shoes`, the
4989 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4990 /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
4991 /// pinned to the top position in the final results.
4992 ///
4993 /// If multiple PinActions are matched to a single request the actions will
4994 /// be processed from most to least recently updated.
4995 ///
4996 /// Pins to positions larger than the max allowed page size of 120 are not
4997 /// allowed.
4998 ///
4999 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
5000 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
5001 #[derive(Clone, Default, PartialEq)]
5002 #[non_exhaustive]
5003 pub struct PinAction {
5004 /// Required. A map of positions to product_ids.
5005 ///
5006 /// Partial matches per action are allowed, if a certain position in the map
5007 /// is already filled that `[position, product_id]` pair will be ignored
5008 /// but the rest may still be applied. This case will only occur if multiple
5009 /// pin actions are matched to a single request, as the map guarantees that
5010 /// pin positions are unique within the same action.
5011 ///
5012 /// Duplicate product_ids are not permitted within a single pin map.
5013 ///
5014 /// The max size of this map is 120, equivalent to the max [request page
5015 /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
5016 pub pin_map: std::collections::HashMap<i64, std::string::String>,
5017
5018 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5019 }
5020
5021 impl PinAction {
5022 /// Creates a new default instance.
5023 pub fn new() -> Self {
5024 std::default::Default::default()
5025 }
5026
5027 /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
5028 ///
5029 /// # Example
5030 /// ```ignore,no_run
5031 /// # use google_cloud_retail_v2::model::rule::PinAction;
5032 /// let x = PinAction::new().set_pin_map([
5033 /// (0, "abc"),
5034 /// (1, "xyz"),
5035 /// ]);
5036 /// ```
5037 pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
5038 where
5039 T: std::iter::IntoIterator<Item = (K, V)>,
5040 K: std::convert::Into<i64>,
5041 V: std::convert::Into<std::string::String>,
5042 {
5043 use std::iter::Iterator;
5044 self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5045 self
5046 }
5047 }
5048
5049 impl wkt::message::Message for PinAction {
5050 fn typename() -> &'static str {
5051 "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5052 }
5053 }
5054
5055 /// An action must be provided.
5056 #[derive(Clone, Debug, PartialEq)]
5057 #[non_exhaustive]
5058 pub enum Action {
5059 /// A boost action.
5060 BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5061 /// Redirects a shopper to a specific page.
5062 RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5063 /// Treats specific term as a synonym with a group of terms.
5064 /// Group of terms will not be treated as synonyms with the specific term.
5065 OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5066 /// Prevents term from being associated with other terms.
5067 DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5068 /// Replaces specific terms in the query.
5069 ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5070 /// Ignores specific terms from query during search.
5071 IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5072 /// Filters results.
5073 FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5074 /// Treats a set of terms as synonyms of one another.
5075 TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5076 /// Force returns an attribute as a facet in the request.
5077 ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5078 /// Remove an attribute as a facet in the request (if present).
5079 RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5080 /// Pins one or more specified products to a specific position in the
5081 /// results.
5082 PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5083 }
5084}
5085
5086/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5087/// whom it's sold.
5088///
5089/// [google.cloud.retail.v2.Product]: crate::model::Product
5090#[derive(Clone, Default, PartialEq)]
5091#[non_exhaustive]
5092pub struct Audience {
5093 /// The genders of the audience. Strongly encouraged to use the standard
5094 /// values: "male", "female", "unisex".
5095 ///
5096 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5097 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5098 /// is returned.
5099 ///
5100 /// Google Merchant Center property
5101 /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5102 /// property
5103 /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5104 pub genders: std::vec::Vec<std::string::String>,
5105
5106 /// The age groups of the audience. Strongly encouraged to use the standard
5107 /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5108 /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5109 /// teens or older).
5110 ///
5111 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5112 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5113 /// is returned.
5114 ///
5115 /// Google Merchant Center property
5116 /// [age_group](https://support.google.com/merchants/answer/6324463).
5117 /// Schema.org property
5118 /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5119 /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5120 pub age_groups: std::vec::Vec<std::string::String>,
5121
5122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5123}
5124
5125impl Audience {
5126 /// Creates a new default instance.
5127 pub fn new() -> Self {
5128 std::default::Default::default()
5129 }
5130
5131 /// Sets the value of [genders][crate::model::Audience::genders].
5132 ///
5133 /// # Example
5134 /// ```ignore,no_run
5135 /// # use google_cloud_retail_v2::model::Audience;
5136 /// let x = Audience::new().set_genders(["a", "b", "c"]);
5137 /// ```
5138 pub fn set_genders<T, V>(mut self, v: T) -> Self
5139 where
5140 T: std::iter::IntoIterator<Item = V>,
5141 V: std::convert::Into<std::string::String>,
5142 {
5143 use std::iter::Iterator;
5144 self.genders = v.into_iter().map(|i| i.into()).collect();
5145 self
5146 }
5147
5148 /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5149 ///
5150 /// # Example
5151 /// ```ignore,no_run
5152 /// # use google_cloud_retail_v2::model::Audience;
5153 /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5154 /// ```
5155 pub fn set_age_groups<T, V>(mut self, v: T) -> Self
5156 where
5157 T: std::iter::IntoIterator<Item = V>,
5158 V: std::convert::Into<std::string::String>,
5159 {
5160 use std::iter::Iterator;
5161 self.age_groups = v.into_iter().map(|i| i.into()).collect();
5162 self
5163 }
5164}
5165
5166impl wkt::message::Message for Audience {
5167 fn typename() -> &'static str {
5168 "type.googleapis.com/google.cloud.retail.v2.Audience"
5169 }
5170}
5171
5172/// The color information of a [Product][google.cloud.retail.v2.Product].
5173///
5174/// [google.cloud.retail.v2.Product]: crate::model::Product
5175#[derive(Clone, Default, PartialEq)]
5176#[non_exhaustive]
5177pub struct ColorInfo {
5178 /// The standard color families. Strongly recommended to use the following
5179 /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5180 /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5181 /// Normally it is expected to have only 1 color family. May consider using
5182 /// single "Mixed" instead of multiple values.
5183 ///
5184 /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5185 /// string with a length limit of 128 characters. Otherwise, an
5186 /// INVALID_ARGUMENT error is returned.
5187 ///
5188 /// Google Merchant Center property
5189 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5190 /// property [Product.color](https://schema.org/color).
5191 ///
5192 /// The colorFamilies field as a system attribute is not a required field but
5193 /// strongly recommended to be specified. Google Search models treat this field
5194 /// as more important than a custom product attribute when specified.
5195 pub color_families: std::vec::Vec<std::string::String>,
5196
5197 /// The color display names, which may be different from standard color family
5198 /// names, such as the color aliases used in the website frontend. Normally
5199 /// it is expected to have only 1 color. May consider using single "Mixed"
5200 /// instead of multiple values.
5201 ///
5202 /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5203 /// string with a length limit of 128 characters. Otherwise, an
5204 /// INVALID_ARGUMENT error is returned.
5205 ///
5206 /// Google Merchant Center property
5207 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5208 /// property [Product.color](https://schema.org/color).
5209 pub colors: std::vec::Vec<std::string::String>,
5210
5211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5212}
5213
5214impl ColorInfo {
5215 /// Creates a new default instance.
5216 pub fn new() -> Self {
5217 std::default::Default::default()
5218 }
5219
5220 /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_retail_v2::model::ColorInfo;
5225 /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5226 /// ```
5227 pub fn set_color_families<T, V>(mut self, v: T) -> Self
5228 where
5229 T: std::iter::IntoIterator<Item = V>,
5230 V: std::convert::Into<std::string::String>,
5231 {
5232 use std::iter::Iterator;
5233 self.color_families = v.into_iter().map(|i| i.into()).collect();
5234 self
5235 }
5236
5237 /// Sets the value of [colors][crate::model::ColorInfo::colors].
5238 ///
5239 /// # Example
5240 /// ```ignore,no_run
5241 /// # use google_cloud_retail_v2::model::ColorInfo;
5242 /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5243 /// ```
5244 pub fn set_colors<T, V>(mut self, v: T) -> Self
5245 where
5246 T: std::iter::IntoIterator<Item = V>,
5247 V: std::convert::Into<std::string::String>,
5248 {
5249 use std::iter::Iterator;
5250 self.colors = v.into_iter().map(|i| i.into()).collect();
5251 self
5252 }
5253}
5254
5255impl wkt::message::Message for ColorInfo {
5256 fn typename() -> &'static str {
5257 "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5258 }
5259}
5260
5261/// A custom attribute that is not explicitly modeled in
5262/// [Product][google.cloud.retail.v2.Product].
5263///
5264/// [google.cloud.retail.v2.Product]: crate::model::Product
5265#[derive(Clone, Default, PartialEq)]
5266#[non_exhaustive]
5267pub struct CustomAttribute {
5268 /// The textual values of this custom attribute. For example, `["yellow",
5269 /// "green"]` when the key is "color".
5270 ///
5271 /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5272 /// returned.
5273 ///
5274 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5275 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5276 /// Otherwise, an INVALID_ARGUMENT error is returned.
5277 ///
5278 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5279 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5280 pub text: std::vec::Vec<std::string::String>,
5281
5282 /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5283 /// when the key is "lengths_cm".
5284 ///
5285 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5286 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5287 /// Otherwise, an INVALID_ARGUMENT error is returned.
5288 ///
5289 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5290 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5291 pub numbers: std::vec::Vec<f64>,
5292
5293 /// This field is normally ignored unless
5294 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5295 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5296 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5297 /// attribute configuration, see [Configuration
5298 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5299 /// If true, custom attribute values are searchable by text queries in
5300 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5301 ///
5302 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5303 ///
5304 /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5305 /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5306 ///
5307 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5308 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5309 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5310 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5311 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5312 #[deprecated]
5313 pub searchable: std::option::Option<bool>,
5314
5315 /// This field is normally ignored unless
5316 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5317 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5318 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5319 /// attribute configuration, see [Configuration
5320 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5321 /// If true, custom attribute values are indexed, so that they can be filtered,
5322 /// faceted or boosted in
5323 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5324 ///
5325 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5326 ///
5327 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5328 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5329 /// and
5330 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5331 /// for more details.
5332 ///
5333 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5334 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5335 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5336 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5337 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5338 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5339 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5340 #[deprecated]
5341 pub indexable: std::option::Option<bool>,
5342
5343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5344}
5345
5346impl CustomAttribute {
5347 /// Creates a new default instance.
5348 pub fn new() -> Self {
5349 std::default::Default::default()
5350 }
5351
5352 /// Sets the value of [text][crate::model::CustomAttribute::text].
5353 ///
5354 /// # Example
5355 /// ```ignore,no_run
5356 /// # use google_cloud_retail_v2::model::CustomAttribute;
5357 /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5358 /// ```
5359 pub fn set_text<T, V>(mut self, v: T) -> Self
5360 where
5361 T: std::iter::IntoIterator<Item = V>,
5362 V: std::convert::Into<std::string::String>,
5363 {
5364 use std::iter::Iterator;
5365 self.text = v.into_iter().map(|i| i.into()).collect();
5366 self
5367 }
5368
5369 /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5370 ///
5371 /// # Example
5372 /// ```ignore,no_run
5373 /// # use google_cloud_retail_v2::model::CustomAttribute;
5374 /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5375 /// ```
5376 pub fn set_numbers<T, V>(mut self, v: T) -> Self
5377 where
5378 T: std::iter::IntoIterator<Item = V>,
5379 V: std::convert::Into<f64>,
5380 {
5381 use std::iter::Iterator;
5382 self.numbers = v.into_iter().map(|i| i.into()).collect();
5383 self
5384 }
5385
5386 /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5387 ///
5388 /// # Example
5389 /// ```ignore,no_run
5390 /// # use google_cloud_retail_v2::model::CustomAttribute;
5391 /// let x = CustomAttribute::new().set_searchable(true);
5392 /// ```
5393 #[deprecated]
5394 pub fn set_searchable<T>(mut self, v: T) -> Self
5395 where
5396 T: std::convert::Into<bool>,
5397 {
5398 self.searchable = std::option::Option::Some(v.into());
5399 self
5400 }
5401
5402 /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5403 ///
5404 /// # Example
5405 /// ```ignore,no_run
5406 /// # use google_cloud_retail_v2::model::CustomAttribute;
5407 /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5408 /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5409 /// ```
5410 #[deprecated]
5411 pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5412 where
5413 T: std::convert::Into<bool>,
5414 {
5415 self.searchable = v.map(|x| x.into());
5416 self
5417 }
5418
5419 /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5420 ///
5421 /// # Example
5422 /// ```ignore,no_run
5423 /// # use google_cloud_retail_v2::model::CustomAttribute;
5424 /// let x = CustomAttribute::new().set_indexable(true);
5425 /// ```
5426 #[deprecated]
5427 pub fn set_indexable<T>(mut self, v: T) -> Self
5428 where
5429 T: std::convert::Into<bool>,
5430 {
5431 self.indexable = std::option::Option::Some(v.into());
5432 self
5433 }
5434
5435 /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5436 ///
5437 /// # Example
5438 /// ```ignore,no_run
5439 /// # use google_cloud_retail_v2::model::CustomAttribute;
5440 /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5441 /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5442 /// ```
5443 #[deprecated]
5444 pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5445 where
5446 T: std::convert::Into<bool>,
5447 {
5448 self.indexable = v.map(|x| x.into());
5449 self
5450 }
5451}
5452
5453impl wkt::message::Message for CustomAttribute {
5454 fn typename() -> &'static str {
5455 "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5456 }
5457}
5458
5459/// Fulfillment information, such as the store IDs for in-store pickup or region
5460/// IDs for different shipping methods.
5461#[derive(Clone, Default, PartialEq)]
5462#[non_exhaustive]
5463pub struct FulfillmentInfo {
5464 /// The fulfillment type, including commonly used types (such as pickup in
5465 /// store and same day delivery), and custom types. Customers have to map
5466 /// custom types to their display names before rendering UI.
5467 ///
5468 /// Supported values:
5469 ///
5470 /// * "pickup-in-store"
5471 /// * "ship-to-store"
5472 /// * "same-day-delivery"
5473 /// * "next-day-delivery"
5474 /// * "custom-type-1"
5475 /// * "custom-type-2"
5476 /// * "custom-type-3"
5477 /// * "custom-type-4"
5478 /// * "custom-type-5"
5479 ///
5480 /// If this field is set to an invalid value other than these, an
5481 /// INVALID_ARGUMENT error is returned.
5482 pub r#type: std::string::String,
5483
5484 /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5485 /// as the store IDs for
5486 /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5487 /// or the region IDs for
5488 /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5489 ///
5490 /// A maximum of 3000 values are allowed. Each value must be a string with a
5491 /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5492 /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5493 /// returned.
5494 ///
5495 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5496 pub place_ids: std::vec::Vec<std::string::String>,
5497
5498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5499}
5500
5501impl FulfillmentInfo {
5502 /// Creates a new default instance.
5503 pub fn new() -> Self {
5504 std::default::Default::default()
5505 }
5506
5507 /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5508 ///
5509 /// # Example
5510 /// ```ignore,no_run
5511 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5512 /// let x = FulfillmentInfo::new().set_type("example");
5513 /// ```
5514 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5515 self.r#type = v.into();
5516 self
5517 }
5518
5519 /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5520 ///
5521 /// # Example
5522 /// ```ignore,no_run
5523 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5524 /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5525 /// ```
5526 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5527 where
5528 T: std::iter::IntoIterator<Item = V>,
5529 V: std::convert::Into<std::string::String>,
5530 {
5531 use std::iter::Iterator;
5532 self.place_ids = v.into_iter().map(|i| i.into()).collect();
5533 self
5534 }
5535}
5536
5537impl wkt::message::Message for FulfillmentInfo {
5538 fn typename() -> &'static str {
5539 "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5540 }
5541}
5542
5543/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5544/// Retail Search use product images to improve prediction and search results.
5545/// Product images can be returned in results, and are shown in prediction or
5546/// search previews in the console. Please try to provide correct product images
5547/// and avoid using images with size too small.
5548///
5549/// [google.cloud.retail.v2.Product]: crate::model::Product
5550#[derive(Clone, Default, PartialEq)]
5551#[non_exhaustive]
5552pub struct Image {
5553 /// Required. URI of the image.
5554 ///
5555 /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5556 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5557 ///
5558 /// Google Merchant Center property
5559 /// [image_link](https://support.google.com/merchants/answer/6324350).
5560 /// Schema.org property [Product.image](https://schema.org/image).
5561 pub uri: std::string::String,
5562
5563 /// Height of the image in number of pixels.
5564 ///
5565 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5566 /// returned.
5567 pub height: i32,
5568
5569 /// Width of the image in number of pixels.
5570 ///
5571 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5572 /// returned.
5573 pub width: i32,
5574
5575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5576}
5577
5578impl Image {
5579 /// Creates a new default instance.
5580 pub fn new() -> Self {
5581 std::default::Default::default()
5582 }
5583
5584 /// Sets the value of [uri][crate::model::Image::uri].
5585 ///
5586 /// # Example
5587 /// ```ignore,no_run
5588 /// # use google_cloud_retail_v2::model::Image;
5589 /// let x = Image::new().set_uri("example");
5590 /// ```
5591 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5592 self.uri = v.into();
5593 self
5594 }
5595
5596 /// Sets the value of [height][crate::model::Image::height].
5597 ///
5598 /// # Example
5599 /// ```ignore,no_run
5600 /// # use google_cloud_retail_v2::model::Image;
5601 /// let x = Image::new().set_height(42);
5602 /// ```
5603 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5604 self.height = v.into();
5605 self
5606 }
5607
5608 /// Sets the value of [width][crate::model::Image::width].
5609 ///
5610 /// # Example
5611 /// ```ignore,no_run
5612 /// # use google_cloud_retail_v2::model::Image;
5613 /// let x = Image::new().set_width(42);
5614 /// ```
5615 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5616 self.width = v.into();
5617 self
5618 }
5619}
5620
5621impl wkt::message::Message for Image {
5622 fn typename() -> &'static str {
5623 "type.googleapis.com/google.cloud.retail.v2.Image"
5624 }
5625}
5626
5627/// A floating point interval.
5628#[derive(Clone, Default, PartialEq)]
5629#[non_exhaustive]
5630pub struct Interval {
5631 /// The lower bound of the interval. If neither of the min fields are set, then
5632 /// the lower bound is negative infinity.
5633 ///
5634 /// This field must not be larger than max.
5635 /// Otherwise, an INVALID_ARGUMENT error is returned.
5636 pub min: std::option::Option<crate::model::interval::Min>,
5637
5638 /// The upper bound of the interval. If neither of the max fields are set, then
5639 /// the upper bound is positive infinity.
5640 ///
5641 /// This field must be not smaller than min.
5642 /// Otherwise, an INVALID_ARGUMENT error is returned.
5643 pub max: std::option::Option<crate::model::interval::Max>,
5644
5645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5646}
5647
5648impl Interval {
5649 /// Creates a new default instance.
5650 pub fn new() -> Self {
5651 std::default::Default::default()
5652 }
5653
5654 /// Sets the value of [min][crate::model::Interval::min].
5655 ///
5656 /// Note that all the setters affecting `min` are mutually
5657 /// exclusive.
5658 ///
5659 /// # Example
5660 /// ```ignore,no_run
5661 /// # use google_cloud_retail_v2::model::Interval;
5662 /// use google_cloud_retail_v2::model::interval::Min;
5663 /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5664 /// ```
5665 pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5666 mut self,
5667 v: T,
5668 ) -> Self {
5669 self.min = v.into();
5670 self
5671 }
5672
5673 /// The value of [min][crate::model::Interval::min]
5674 /// if it holds a `Minimum`, `None` if the field is not set or
5675 /// holds a different branch.
5676 pub fn minimum(&self) -> std::option::Option<&f64> {
5677 #[allow(unreachable_patterns)]
5678 self.min.as_ref().and_then(|v| match v {
5679 crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5680 _ => std::option::Option::None,
5681 })
5682 }
5683
5684 /// Sets the value of [min][crate::model::Interval::min]
5685 /// to hold a `Minimum`.
5686 ///
5687 /// Note that all the setters affecting `min` are
5688 /// mutually exclusive.
5689 ///
5690 /// # Example
5691 /// ```ignore,no_run
5692 /// # use google_cloud_retail_v2::model::Interval;
5693 /// let x = Interval::new().set_minimum(42.0);
5694 /// assert!(x.minimum().is_some());
5695 /// assert!(x.exclusive_minimum().is_none());
5696 /// ```
5697 pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5698 self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5699 self
5700 }
5701
5702 /// The value of [min][crate::model::Interval::min]
5703 /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5704 /// holds a different branch.
5705 pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5706 #[allow(unreachable_patterns)]
5707 self.min.as_ref().and_then(|v| match v {
5708 crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5709 _ => std::option::Option::None,
5710 })
5711 }
5712
5713 /// Sets the value of [min][crate::model::Interval::min]
5714 /// to hold a `ExclusiveMinimum`.
5715 ///
5716 /// Note that all the setters affecting `min` are
5717 /// mutually exclusive.
5718 ///
5719 /// # Example
5720 /// ```ignore,no_run
5721 /// # use google_cloud_retail_v2::model::Interval;
5722 /// let x = Interval::new().set_exclusive_minimum(42.0);
5723 /// assert!(x.exclusive_minimum().is_some());
5724 /// assert!(x.minimum().is_none());
5725 /// ```
5726 pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5727 self.min =
5728 std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5729 self
5730 }
5731
5732 /// Sets the value of [max][crate::model::Interval::max].
5733 ///
5734 /// Note that all the setters affecting `max` are mutually
5735 /// exclusive.
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_retail_v2::model::Interval;
5740 /// use google_cloud_retail_v2::model::interval::Max;
5741 /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5742 /// ```
5743 pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5744 mut self,
5745 v: T,
5746 ) -> Self {
5747 self.max = v.into();
5748 self
5749 }
5750
5751 /// The value of [max][crate::model::Interval::max]
5752 /// if it holds a `Maximum`, `None` if the field is not set or
5753 /// holds a different branch.
5754 pub fn maximum(&self) -> std::option::Option<&f64> {
5755 #[allow(unreachable_patterns)]
5756 self.max.as_ref().and_then(|v| match v {
5757 crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5758 _ => std::option::Option::None,
5759 })
5760 }
5761
5762 /// Sets the value of [max][crate::model::Interval::max]
5763 /// to hold a `Maximum`.
5764 ///
5765 /// Note that all the setters affecting `max` are
5766 /// mutually exclusive.
5767 ///
5768 /// # Example
5769 /// ```ignore,no_run
5770 /// # use google_cloud_retail_v2::model::Interval;
5771 /// let x = Interval::new().set_maximum(42.0);
5772 /// assert!(x.maximum().is_some());
5773 /// assert!(x.exclusive_maximum().is_none());
5774 /// ```
5775 pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5776 self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5777 self
5778 }
5779
5780 /// The value of [max][crate::model::Interval::max]
5781 /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5782 /// holds a different branch.
5783 pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5784 #[allow(unreachable_patterns)]
5785 self.max.as_ref().and_then(|v| match v {
5786 crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5787 _ => std::option::Option::None,
5788 })
5789 }
5790
5791 /// Sets the value of [max][crate::model::Interval::max]
5792 /// to hold a `ExclusiveMaximum`.
5793 ///
5794 /// Note that all the setters affecting `max` are
5795 /// mutually exclusive.
5796 ///
5797 /// # Example
5798 /// ```ignore,no_run
5799 /// # use google_cloud_retail_v2::model::Interval;
5800 /// let x = Interval::new().set_exclusive_maximum(42.0);
5801 /// assert!(x.exclusive_maximum().is_some());
5802 /// assert!(x.maximum().is_none());
5803 /// ```
5804 pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5805 self.max =
5806 std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5807 self
5808 }
5809}
5810
5811impl wkt::message::Message for Interval {
5812 fn typename() -> &'static str {
5813 "type.googleapis.com/google.cloud.retail.v2.Interval"
5814 }
5815}
5816
5817/// Defines additional types related to [Interval].
5818pub mod interval {
5819 #[allow(unused_imports)]
5820 use super::*;
5821
5822 /// The lower bound of the interval. If neither of the min fields are set, then
5823 /// the lower bound is negative infinity.
5824 ///
5825 /// This field must not be larger than max.
5826 /// Otherwise, an INVALID_ARGUMENT error is returned.
5827 #[derive(Clone, Debug, PartialEq)]
5828 #[non_exhaustive]
5829 pub enum Min {
5830 /// Inclusive lower bound.
5831 Minimum(f64),
5832 /// Exclusive lower bound.
5833 ExclusiveMinimum(f64),
5834 }
5835
5836 /// The upper bound of the interval. If neither of the max fields are set, then
5837 /// the upper bound is positive infinity.
5838 ///
5839 /// This field must be not smaller than min.
5840 /// Otherwise, an INVALID_ARGUMENT error is returned.
5841 #[derive(Clone, Debug, PartialEq)]
5842 #[non_exhaustive]
5843 pub enum Max {
5844 /// Inclusive upper bound.
5845 Maximum(f64),
5846 /// Exclusive upper bound.
5847 ExclusiveMaximum(f64),
5848 }
5849}
5850
5851/// The price information of a [Product][google.cloud.retail.v2.Product].
5852///
5853/// [google.cloud.retail.v2.Product]: crate::model::Product
5854#[derive(Clone, Default, PartialEq)]
5855#[non_exhaustive]
5856pub struct PriceInfo {
5857 /// The 3-letter currency code defined in [ISO
5858 /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5859 ///
5860 /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5861 /// error is returned.
5862 ///
5863 /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5864 /// [Product][google.cloud.retail.v2.Product]s with the same
5865 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5866 /// must share the same
5867 /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5868 /// a FAILED_PRECONDITION error is returned.
5869 ///
5870 /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5871 /// [google.cloud.retail.v2.Product]: crate::model::Product
5872 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5873 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5874 pub currency_code: std::string::String,
5875
5876 /// Price of the product.
5877 ///
5878 /// Google Merchant Center property
5879 /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5880 /// property [Offer.price](https://schema.org/price).
5881 pub price: f32,
5882
5883 /// Price of the product without any discount. If zero, by default set to be
5884 /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5885 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5886 /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5887 /// otherwise an INVALID_ARGUMENT error is thrown.
5888 ///
5889 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5890 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5891 pub original_price: f32,
5892
5893 /// The costs associated with the sale of a particular product. Used for gross
5894 /// profit reporting.
5895 ///
5896 /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5897 /// [cost][google.cloud.retail.v2.PriceInfo.cost]
5898 ///
5899 /// Google Merchant Center property
5900 /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5901 ///
5902 /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5903 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5904 pub cost: f32,
5905
5906 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5907 /// starts to be effective. This can be set as a future timestamp, and the
5908 /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5909 /// after
5910 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5911 /// If so, the
5912 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5913 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5914 /// is used before
5915 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5916 ///
5917 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5918 /// effective because it will cause additional latency during search.
5919 ///
5920 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5921 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5922 /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5923 pub price_effective_time: std::option::Option<wkt::Timestamp>,
5924
5925 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5926 /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5927 /// is used for search before
5928 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5929 /// this field is set, the
5930 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5931 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5932 /// is used after
5933 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5934 ///
5935 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5936 /// effective because it will cause additional latency during search.
5937 ///
5938 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5939 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5940 /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5941 pub price_expire_time: std::option::Option<wkt::Timestamp>,
5942
5943 /// Output only. The price range of all the child
5944 /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5945 /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5946 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5947 /// [Product][google.cloud.retail.v2.Product]. Only populated for
5948 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5949 /// [Product][google.cloud.retail.v2.Product]s.
5950 ///
5951 /// Note: This field is OUTPUT_ONLY for
5952 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5953 /// Do not set this field in API requests.
5954 ///
5955 /// [google.cloud.retail.v2.Product]: crate::model::Product
5956 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5957 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5958 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5959 pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5960
5961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5962}
5963
5964impl PriceInfo {
5965 /// Creates a new default instance.
5966 pub fn new() -> Self {
5967 std::default::Default::default()
5968 }
5969
5970 /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
5971 ///
5972 /// # Example
5973 /// ```ignore,no_run
5974 /// # use google_cloud_retail_v2::model::PriceInfo;
5975 /// let x = PriceInfo::new().set_currency_code("example");
5976 /// ```
5977 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5978 self.currency_code = v.into();
5979 self
5980 }
5981
5982 /// Sets the value of [price][crate::model::PriceInfo::price].
5983 ///
5984 /// # Example
5985 /// ```ignore,no_run
5986 /// # use google_cloud_retail_v2::model::PriceInfo;
5987 /// let x = PriceInfo::new().set_price(42.0);
5988 /// ```
5989 pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5990 self.price = v.into();
5991 self
5992 }
5993
5994 /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
5995 ///
5996 /// # Example
5997 /// ```ignore,no_run
5998 /// # use google_cloud_retail_v2::model::PriceInfo;
5999 /// let x = PriceInfo::new().set_original_price(42.0);
6000 /// ```
6001 pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6002 self.original_price = v.into();
6003 self
6004 }
6005
6006 /// Sets the value of [cost][crate::model::PriceInfo::cost].
6007 ///
6008 /// # Example
6009 /// ```ignore,no_run
6010 /// # use google_cloud_retail_v2::model::PriceInfo;
6011 /// let x = PriceInfo::new().set_cost(42.0);
6012 /// ```
6013 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6014 self.cost = v.into();
6015 self
6016 }
6017
6018 /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6019 ///
6020 /// # Example
6021 /// ```ignore,no_run
6022 /// # use google_cloud_retail_v2::model::PriceInfo;
6023 /// use wkt::Timestamp;
6024 /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
6025 /// ```
6026 pub fn set_price_effective_time<T>(mut self, v: T) -> Self
6027 where
6028 T: std::convert::Into<wkt::Timestamp>,
6029 {
6030 self.price_effective_time = std::option::Option::Some(v.into());
6031 self
6032 }
6033
6034 /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6035 ///
6036 /// # Example
6037 /// ```ignore,no_run
6038 /// # use google_cloud_retail_v2::model::PriceInfo;
6039 /// use wkt::Timestamp;
6040 /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
6041 /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
6042 /// ```
6043 pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6044 where
6045 T: std::convert::Into<wkt::Timestamp>,
6046 {
6047 self.price_effective_time = v.map(|x| x.into());
6048 self
6049 }
6050
6051 /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6052 ///
6053 /// # Example
6054 /// ```ignore,no_run
6055 /// # use google_cloud_retail_v2::model::PriceInfo;
6056 /// use wkt::Timestamp;
6057 /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6058 /// ```
6059 pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6060 where
6061 T: std::convert::Into<wkt::Timestamp>,
6062 {
6063 self.price_expire_time = std::option::Option::Some(v.into());
6064 self
6065 }
6066
6067 /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6068 ///
6069 /// # Example
6070 /// ```ignore,no_run
6071 /// # use google_cloud_retail_v2::model::PriceInfo;
6072 /// use wkt::Timestamp;
6073 /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6074 /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6075 /// ```
6076 pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6077 where
6078 T: std::convert::Into<wkt::Timestamp>,
6079 {
6080 self.price_expire_time = v.map(|x| x.into());
6081 self
6082 }
6083
6084 /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6085 ///
6086 /// # Example
6087 /// ```ignore,no_run
6088 /// # use google_cloud_retail_v2::model::PriceInfo;
6089 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6090 /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6091 /// ```
6092 pub fn set_price_range<T>(mut self, v: T) -> Self
6093 where
6094 T: std::convert::Into<crate::model::price_info::PriceRange>,
6095 {
6096 self.price_range = std::option::Option::Some(v.into());
6097 self
6098 }
6099
6100 /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_retail_v2::model::PriceInfo;
6105 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6106 /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6107 /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6108 /// ```
6109 pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6110 where
6111 T: std::convert::Into<crate::model::price_info::PriceRange>,
6112 {
6113 self.price_range = v.map(|x| x.into());
6114 self
6115 }
6116}
6117
6118impl wkt::message::Message for PriceInfo {
6119 fn typename() -> &'static str {
6120 "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6121 }
6122}
6123
6124/// Defines additional types related to [PriceInfo].
6125pub mod price_info {
6126 #[allow(unused_imports)]
6127 use super::*;
6128
6129 /// The price range of all
6130 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6131 /// [Product][google.cloud.retail.v2.Product] having the same
6132 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6133 ///
6134 /// [google.cloud.retail.v2.Product]: crate::model::Product
6135 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6136 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6137 #[derive(Clone, Default, PartialEq)]
6138 #[non_exhaustive]
6139 pub struct PriceRange {
6140 /// The inclusive
6141 /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6142 /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6143 /// [Product][google.cloud.retail.v2.Product] having the same
6144 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6145 ///
6146 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6147 /// [google.cloud.retail.v2.Product]: crate::model::Product
6148 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6149 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6150 pub price: std::option::Option<crate::model::Interval>,
6151
6152 /// The inclusive
6153 /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6154 /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6155 /// [Product][google.cloud.retail.v2.Product] having the same
6156 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6157 ///
6158 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6159 /// [google.cloud.retail.v2.Product]: crate::model::Product
6160 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6161 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6162 pub original_price: std::option::Option<crate::model::Interval>,
6163
6164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6165 }
6166
6167 impl PriceRange {
6168 /// Creates a new default instance.
6169 pub fn new() -> Self {
6170 std::default::Default::default()
6171 }
6172
6173 /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6174 ///
6175 /// # Example
6176 /// ```ignore,no_run
6177 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6178 /// use google_cloud_retail_v2::model::Interval;
6179 /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6180 /// ```
6181 pub fn set_price<T>(mut self, v: T) -> Self
6182 where
6183 T: std::convert::Into<crate::model::Interval>,
6184 {
6185 self.price = std::option::Option::Some(v.into());
6186 self
6187 }
6188
6189 /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6190 ///
6191 /// # Example
6192 /// ```ignore,no_run
6193 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6194 /// use google_cloud_retail_v2::model::Interval;
6195 /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6196 /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6197 /// ```
6198 pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6199 where
6200 T: std::convert::Into<crate::model::Interval>,
6201 {
6202 self.price = v.map(|x| x.into());
6203 self
6204 }
6205
6206 /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6207 ///
6208 /// # Example
6209 /// ```ignore,no_run
6210 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6211 /// use google_cloud_retail_v2::model::Interval;
6212 /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6213 /// ```
6214 pub fn set_original_price<T>(mut self, v: T) -> Self
6215 where
6216 T: std::convert::Into<crate::model::Interval>,
6217 {
6218 self.original_price = std::option::Option::Some(v.into());
6219 self
6220 }
6221
6222 /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6223 ///
6224 /// # Example
6225 /// ```ignore,no_run
6226 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6227 /// use google_cloud_retail_v2::model::Interval;
6228 /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6229 /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6230 /// ```
6231 pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6232 where
6233 T: std::convert::Into<crate::model::Interval>,
6234 {
6235 self.original_price = v.map(|x| x.into());
6236 self
6237 }
6238 }
6239
6240 impl wkt::message::Message for PriceRange {
6241 fn typename() -> &'static str {
6242 "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6243 }
6244 }
6245}
6246
6247/// The rating of a [Product][google.cloud.retail.v2.Product].
6248///
6249/// [google.cloud.retail.v2.Product]: crate::model::Product
6250#[derive(Clone, Default, PartialEq)]
6251#[non_exhaustive]
6252pub struct Rating {
6253 /// The total number of ratings. This value is independent of the value of
6254 /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6255 ///
6256 /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6257 /// returned.
6258 ///
6259 /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6260 pub rating_count: i32,
6261
6262 /// The average rating of the [Product][google.cloud.retail.v2.Product].
6263 ///
6264 /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6265 /// returned.
6266 ///
6267 /// [google.cloud.retail.v2.Product]: crate::model::Product
6268 pub average_rating: f32,
6269
6270 /// List of rating counts per rating value (index = rating - 1). The list is
6271 /// empty if there is no rating. If the list is non-empty, its size is
6272 /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6273 ///
6274 /// For example, [41, 14, 13, 47, 303]. It means that the
6275 /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6276 /// ratings with 2 star, and so on.
6277 ///
6278 /// [google.cloud.retail.v2.Product]: crate::model::Product
6279 pub rating_histogram: std::vec::Vec<i32>,
6280
6281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6282}
6283
6284impl Rating {
6285 /// Creates a new default instance.
6286 pub fn new() -> Self {
6287 std::default::Default::default()
6288 }
6289
6290 /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6291 ///
6292 /// # Example
6293 /// ```ignore,no_run
6294 /// # use google_cloud_retail_v2::model::Rating;
6295 /// let x = Rating::new().set_rating_count(42);
6296 /// ```
6297 pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6298 self.rating_count = v.into();
6299 self
6300 }
6301
6302 /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6303 ///
6304 /// # Example
6305 /// ```ignore,no_run
6306 /// # use google_cloud_retail_v2::model::Rating;
6307 /// let x = Rating::new().set_average_rating(42.0);
6308 /// ```
6309 pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6310 self.average_rating = v.into();
6311 self
6312 }
6313
6314 /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6315 ///
6316 /// # Example
6317 /// ```ignore,no_run
6318 /// # use google_cloud_retail_v2::model::Rating;
6319 /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6320 /// ```
6321 pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6322 where
6323 T: std::iter::IntoIterator<Item = V>,
6324 V: std::convert::Into<i32>,
6325 {
6326 use std::iter::Iterator;
6327 self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6328 self
6329 }
6330}
6331
6332impl wkt::message::Message for Rating {
6333 fn typename() -> &'static str {
6334 "type.googleapis.com/google.cloud.retail.v2.Rating"
6335 }
6336}
6337
6338/// Information of an end user.
6339#[derive(Clone, Default, PartialEq)]
6340#[non_exhaustive]
6341pub struct UserInfo {
6342 /// Highly recommended for logged-in users. Unique identifier for logged-in
6343 /// user, such as a user name. Don't set for anonymous users.
6344 ///
6345 /// Always use a hashed value for this ID.
6346 ///
6347 /// Don't set the field to the same fixed ID for different users. This mixes
6348 /// the event history of those users together, which results in degraded
6349 /// model quality.
6350 ///
6351 /// The field must be a UTF-8 encoded string with a length limit of 128
6352 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6353 pub user_id: std::string::String,
6354
6355 /// The end user's IP address. This field is used to extract location
6356 /// information for personalization.
6357 ///
6358 /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6359 /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6360 /// INVALID_ARGUMENT error is returned.
6361 ///
6362 /// This should not be set when:
6363 ///
6364 /// * setting
6365 /// [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6366 /// * using the JavaScript tag in
6367 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6368 /// or if
6369 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6370 /// is set.
6371 ///
6372 /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6373 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6374 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6375 pub ip_address: std::string::String,
6376
6377 /// User agent as included in the HTTP header.
6378 /// The field must be a UTF-8 encoded string with a length limit of 1,000
6379 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6380 ///
6381 /// This should not be set when using the client side event reporting with
6382 /// GTM or JavaScript tag in
6383 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6384 /// or if
6385 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6386 /// is set.
6387 ///
6388 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6389 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6390 pub user_agent: std::string::String,
6391
6392 /// True if the request is made directly from the end user, in which case the
6393 /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6394 /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6395 /// from the HTTP request. This flag should be set only if the API request is
6396 /// made directly from the end user such as a mobile app (and not if a gateway
6397 /// or a server is processing and pushing the user events).
6398 ///
6399 /// This should not be set when using the JavaScript tag in
6400 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6401 ///
6402 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6403 /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6404 /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6405 pub direct_user_request: bool,
6406
6407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6408}
6409
6410impl UserInfo {
6411 /// Creates a new default instance.
6412 pub fn new() -> Self {
6413 std::default::Default::default()
6414 }
6415
6416 /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6417 ///
6418 /// # Example
6419 /// ```ignore,no_run
6420 /// # use google_cloud_retail_v2::model::UserInfo;
6421 /// let x = UserInfo::new().set_user_id("example");
6422 /// ```
6423 pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6424 self.user_id = v.into();
6425 self
6426 }
6427
6428 /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6429 ///
6430 /// # Example
6431 /// ```ignore,no_run
6432 /// # use google_cloud_retail_v2::model::UserInfo;
6433 /// let x = UserInfo::new().set_ip_address("example");
6434 /// ```
6435 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6436 self.ip_address = v.into();
6437 self
6438 }
6439
6440 /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6441 ///
6442 /// # Example
6443 /// ```ignore,no_run
6444 /// # use google_cloud_retail_v2::model::UserInfo;
6445 /// let x = UserInfo::new().set_user_agent("example");
6446 /// ```
6447 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6448 self.user_agent = v.into();
6449 self
6450 }
6451
6452 /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6453 ///
6454 /// # Example
6455 /// ```ignore,no_run
6456 /// # use google_cloud_retail_v2::model::UserInfo;
6457 /// let x = UserInfo::new().set_direct_user_request(true);
6458 /// ```
6459 pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6460 self.direct_user_request = v.into();
6461 self
6462 }
6463}
6464
6465impl wkt::message::Message for UserInfo {
6466 fn typename() -> &'static str {
6467 "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6468 }
6469}
6470
6471/// The inventory information at a place (e.g. a store) identified
6472/// by a place ID.
6473#[derive(Clone, Default, PartialEq)]
6474#[non_exhaustive]
6475pub struct LocalInventory {
6476 /// Optional. The place ID for the current set of inventory information.
6477 pub place_id: std::string::String,
6478
6479 /// Optional. Product price and cost information.
6480 ///
6481 /// Google Merchant Center property
6482 /// [price](https://support.google.com/merchants/answer/6324371).
6483 pub price_info: std::option::Option<crate::model::PriceInfo>,
6484
6485 /// Optional. Additional local inventory attributes, for example, store name,
6486 /// promotion tags, etc.
6487 ///
6488 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6489 /// error is returned:
6490 ///
6491 /// * At most 30 attributes are allowed.
6492 /// * The key must be a UTF-8 encoded string with a length limit of 32
6493 /// characters.
6494 /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6495 /// key0LikeThis or KEY_1_LIKE_THIS.
6496 /// * The attribute values must be of the same type (text or number).
6497 /// * Only 1 value is allowed for each attribute.
6498 /// * For text values, the length limit is 256 UTF-8 characters.
6499 /// * The attribute does not support search. The `searchable` field should be
6500 /// unset or set to false.
6501 /// * The max summed total bytes of custom attribute keys and values per
6502 /// product is 5MiB.
6503 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6504
6505 /// Optional. Supported fulfillment types. Valid fulfillment type values
6506 /// include commonly used types (such as pickup in store and same day
6507 /// delivery), and custom types. Customers have to map custom types to their
6508 /// display names before rendering UI.
6509 ///
6510 /// Supported values:
6511 ///
6512 /// * "pickup-in-store"
6513 /// * "ship-to-store"
6514 /// * "same-day-delivery"
6515 /// * "next-day-delivery"
6516 /// * "custom-type-1"
6517 /// * "custom-type-2"
6518 /// * "custom-type-3"
6519 /// * "custom-type-4"
6520 /// * "custom-type-5"
6521 ///
6522 /// If this field is set to an invalid value other than these, an
6523 /// INVALID_ARGUMENT error is returned.
6524 ///
6525 /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6526 /// returned.
6527 pub fulfillment_types: std::vec::Vec<std::string::String>,
6528
6529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6530}
6531
6532impl LocalInventory {
6533 /// Creates a new default instance.
6534 pub fn new() -> Self {
6535 std::default::Default::default()
6536 }
6537
6538 /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6539 ///
6540 /// # Example
6541 /// ```ignore,no_run
6542 /// # use google_cloud_retail_v2::model::LocalInventory;
6543 /// let x = LocalInventory::new().set_place_id("example");
6544 /// ```
6545 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6546 self.place_id = v.into();
6547 self
6548 }
6549
6550 /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6551 ///
6552 /// # Example
6553 /// ```ignore,no_run
6554 /// # use google_cloud_retail_v2::model::LocalInventory;
6555 /// use google_cloud_retail_v2::model::PriceInfo;
6556 /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6557 /// ```
6558 pub fn set_price_info<T>(mut self, v: T) -> Self
6559 where
6560 T: std::convert::Into<crate::model::PriceInfo>,
6561 {
6562 self.price_info = std::option::Option::Some(v.into());
6563 self
6564 }
6565
6566 /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6567 ///
6568 /// # Example
6569 /// ```ignore,no_run
6570 /// # use google_cloud_retail_v2::model::LocalInventory;
6571 /// use google_cloud_retail_v2::model::PriceInfo;
6572 /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6573 /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6574 /// ```
6575 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6576 where
6577 T: std::convert::Into<crate::model::PriceInfo>,
6578 {
6579 self.price_info = v.map(|x| x.into());
6580 self
6581 }
6582
6583 /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6584 ///
6585 /// # Example
6586 /// ```ignore,no_run
6587 /// # use google_cloud_retail_v2::model::LocalInventory;
6588 /// use google_cloud_retail_v2::model::CustomAttribute;
6589 /// let x = LocalInventory::new().set_attributes([
6590 /// ("key0", CustomAttribute::default()/* use setters */),
6591 /// ("key1", CustomAttribute::default()/* use (different) setters */),
6592 /// ]);
6593 /// ```
6594 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6595 where
6596 T: std::iter::IntoIterator<Item = (K, V)>,
6597 K: std::convert::Into<std::string::String>,
6598 V: std::convert::Into<crate::model::CustomAttribute>,
6599 {
6600 use std::iter::Iterator;
6601 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6602 self
6603 }
6604
6605 /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6606 ///
6607 /// # Example
6608 /// ```ignore,no_run
6609 /// # use google_cloud_retail_v2::model::LocalInventory;
6610 /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6611 /// ```
6612 pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6613 where
6614 T: std::iter::IntoIterator<Item = V>,
6615 V: std::convert::Into<std::string::String>,
6616 {
6617 use std::iter::Iterator;
6618 self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6619 self
6620 }
6621}
6622
6623impl wkt::message::Message for LocalInventory {
6624 fn typename() -> &'static str {
6625 "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6626 }
6627}
6628
6629/// Metadata for pinning to be returned in the response.
6630/// This is used for distinguishing between applied vs dropped pins.
6631#[derive(Clone, Default, PartialEq)]
6632#[non_exhaustive]
6633pub struct PinControlMetadata {
6634 /// Map of all matched pins, keyed by pin position.
6635 pub all_matched_pins:
6636 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6637
6638 /// Map of pins that were dropped due to overlap with other matching pins,
6639 /// keyed by pin position.
6640 pub dropped_pins:
6641 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6642
6643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6644}
6645
6646impl PinControlMetadata {
6647 /// Creates a new default instance.
6648 pub fn new() -> Self {
6649 std::default::Default::default()
6650 }
6651
6652 /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6653 ///
6654 /// # Example
6655 /// ```ignore,no_run
6656 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6657 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6658 /// let x = PinControlMetadata::new().set_all_matched_pins([
6659 /// (0, ProductPins::default()/* use setters */),
6660 /// (1, ProductPins::default()/* use (different) setters */),
6661 /// ]);
6662 /// ```
6663 pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6664 where
6665 T: std::iter::IntoIterator<Item = (K, V)>,
6666 K: std::convert::Into<i64>,
6667 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6668 {
6669 use std::iter::Iterator;
6670 self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6671 self
6672 }
6673
6674 /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6675 ///
6676 /// # Example
6677 /// ```ignore,no_run
6678 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6679 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6680 /// let x = PinControlMetadata::new().set_dropped_pins([
6681 /// (0, ProductPins::default()/* use setters */),
6682 /// (1, ProductPins::default()/* use (different) setters */),
6683 /// ]);
6684 /// ```
6685 pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6686 where
6687 T: std::iter::IntoIterator<Item = (K, V)>,
6688 K: std::convert::Into<i64>,
6689 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6690 {
6691 use std::iter::Iterator;
6692 self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6693 self
6694 }
6695}
6696
6697impl wkt::message::Message for PinControlMetadata {
6698 fn typename() -> &'static str {
6699 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6700 }
6701}
6702
6703/// Defines additional types related to [PinControlMetadata].
6704pub mod pin_control_metadata {
6705 #[allow(unused_imports)]
6706 use super::*;
6707
6708 /// List of product ids which have associated pins.
6709 #[derive(Clone, Default, PartialEq)]
6710 #[non_exhaustive]
6711 pub struct ProductPins {
6712 /// List of product ids which have associated pins.
6713 pub product_id: std::vec::Vec<std::string::String>,
6714
6715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6716 }
6717
6718 impl ProductPins {
6719 /// Creates a new default instance.
6720 pub fn new() -> Self {
6721 std::default::Default::default()
6722 }
6723
6724 /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6725 ///
6726 /// # Example
6727 /// ```ignore,no_run
6728 /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6729 /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6730 /// ```
6731 pub fn set_product_id<T, V>(mut self, v: T) -> Self
6732 where
6733 T: std::iter::IntoIterator<Item = V>,
6734 V: std::convert::Into<std::string::String>,
6735 {
6736 use std::iter::Iterator;
6737 self.product_id = v.into_iter().map(|i| i.into()).collect();
6738 self
6739 }
6740 }
6741
6742 impl wkt::message::Message for ProductPins {
6743 fn typename() -> &'static str {
6744 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6745 }
6746 }
6747}
6748
6749/// A list of string values.
6750#[derive(Clone, Default, PartialEq)]
6751#[non_exhaustive]
6752pub struct StringList {
6753 /// String values.
6754 pub values: std::vec::Vec<std::string::String>,
6755
6756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6757}
6758
6759impl StringList {
6760 /// Creates a new default instance.
6761 pub fn new() -> Self {
6762 std::default::Default::default()
6763 }
6764
6765 /// Sets the value of [values][crate::model::StringList::values].
6766 ///
6767 /// # Example
6768 /// ```ignore,no_run
6769 /// # use google_cloud_retail_v2::model::StringList;
6770 /// let x = StringList::new().set_values(["a", "b", "c"]);
6771 /// ```
6772 pub fn set_values<T, V>(mut self, v: T) -> Self
6773 where
6774 T: std::iter::IntoIterator<Item = V>,
6775 V: std::convert::Into<std::string::String>,
6776 {
6777 use std::iter::Iterator;
6778 self.values = v.into_iter().map(|i| i.into()).collect();
6779 self
6780 }
6781}
6782
6783impl wkt::message::Message for StringList {
6784 fn typename() -> &'static str {
6785 "type.googleapis.com/google.cloud.retail.v2.StringList"
6786 }
6787}
6788
6789/// A message with a list of double values.
6790#[derive(Clone, Default, PartialEq)]
6791#[non_exhaustive]
6792pub struct DoubleList {
6793 /// The list of double values.
6794 pub values: std::vec::Vec<f64>,
6795
6796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6797}
6798
6799impl DoubleList {
6800 /// Creates a new default instance.
6801 pub fn new() -> Self {
6802 std::default::Default::default()
6803 }
6804
6805 /// Sets the value of [values][crate::model::DoubleList::values].
6806 ///
6807 /// # Example
6808 /// ```ignore,no_run
6809 /// # use google_cloud_retail_v2::model::DoubleList;
6810 /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6811 /// ```
6812 pub fn set_values<T, V>(mut self, v: T) -> Self
6813 where
6814 T: std::iter::IntoIterator<Item = V>,
6815 V: std::convert::Into<f64>,
6816 {
6817 use std::iter::Iterator;
6818 self.values = v.into_iter().map(|i| i.into()).collect();
6819 self
6820 }
6821}
6822
6823impl wkt::message::Message for DoubleList {
6824 fn typename() -> &'static str {
6825 "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6826 }
6827}
6828
6829/// Autocomplete parameters.
6830#[derive(Clone, Default, PartialEq)]
6831#[non_exhaustive]
6832pub struct CompleteQueryRequest {
6833 /// Required. Catalog for which the completion is performed.
6834 ///
6835 /// Full resource name of catalog, such as
6836 /// `projects/*/locations/global/catalogs/default_catalog`.
6837 pub catalog: std::string::String,
6838
6839 /// Required. The query used to generate suggestions.
6840 ///
6841 /// The maximum number of allowed characters is 255.
6842 pub query: std::string::String,
6843
6844 /// Recommended field. A unique identifier for tracking visitors. For example,
6845 /// this could be implemented with an HTTP cookie, which should be able to
6846 /// uniquely identify a visitor on a single device. This unique identifier
6847 /// should not change if the visitor logs in or out of the website.
6848 ///
6849 /// The field must be a UTF-8 encoded string with a length limit of 128
6850 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6851 pub visitor_id: std::string::String,
6852
6853 /// Note that this field applies for `user-data` dataset only. For requests
6854 /// with `cloud-retail` dataset, setting this field has no effect.
6855 ///
6856 /// The language filters applied to the output suggestions. If set, it should
6857 /// contain the language of the query. If not set, suggestions are returned
6858 /// without considering language restrictions. This is the BCP-47 language
6859 /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6860 /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6861 /// number of language codes is 3.
6862 pub language_codes: std::vec::Vec<std::string::String>,
6863
6864 /// The device type context for completion suggestions. We recommend that you
6865 /// leave this field empty.
6866 ///
6867 /// It can apply different suggestions on different device types, e.g.
6868 /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6869 /// types.
6870 ///
6871 /// Supported formats:
6872 ///
6873 /// * `UNKNOWN_DEVICE_TYPE`
6874 ///
6875 /// * `DESKTOP`
6876 ///
6877 /// * `MOBILE`
6878 ///
6879 /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6880 ///
6881 pub device_type: std::string::String,
6882
6883 /// Determines which dataset to use for fetching completion. "user-data" will
6884 /// use the dataset imported through
6885 /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6886 /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6887 /// events. If left empty, completions will be fetched from the `user-data`
6888 /// dataset.
6889 ///
6890 /// Current supported values:
6891 ///
6892 /// * user-data
6893 ///
6894 /// * cloud-retail:
6895 /// This option requires enabling auto-learning function first. See
6896 /// [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6897 ///
6898 ///
6899 /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6900 pub dataset: std::string::String,
6901
6902 /// Completion max suggestions. If left unset or set to 0, then will fallback
6903 /// to the configured value
6904 /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6905 ///
6906 /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6907 /// capped by 20.
6908 ///
6909 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6910 pub max_suggestions: i32,
6911
6912 /// If true, attribute suggestions are enabled and provided in the response.
6913 ///
6914 /// This field is only available for the `cloud-retail` dataset.
6915 pub enable_attribute_suggestions: bool,
6916
6917 /// The entity for customers who run multiple entities, domains, sites, or
6918 /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6919 /// `google.com`, `youtube.com`, etc.
6920 /// If this is set, it must be an exact match with
6921 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6922 /// per-entity autocomplete results. This field will be applied to
6923 /// `completion_results` only. It has no effect on the `attribute_results`.
6924 /// Also, this entity should be limited to 256 characters, if too long, it will
6925 /// be truncated to 256 characters in both generation and serving time, and may
6926 /// lead to mis-match. To ensure it works, please set the entity with string
6927 /// within 256 characters.
6928 ///
6929 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6930 pub entity: std::string::String,
6931
6932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6933}
6934
6935impl CompleteQueryRequest {
6936 /// Creates a new default instance.
6937 pub fn new() -> Self {
6938 std::default::Default::default()
6939 }
6940
6941 /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6942 ///
6943 /// # Example
6944 /// ```ignore,no_run
6945 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6946 /// let x = CompleteQueryRequest::new().set_catalog("example");
6947 /// ```
6948 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6949 self.catalog = v.into();
6950 self
6951 }
6952
6953 /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6954 ///
6955 /// # Example
6956 /// ```ignore,no_run
6957 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6958 /// let x = CompleteQueryRequest::new().set_query("example");
6959 /// ```
6960 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6961 self.query = v.into();
6962 self
6963 }
6964
6965 /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
6966 ///
6967 /// # Example
6968 /// ```ignore,no_run
6969 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6970 /// let x = CompleteQueryRequest::new().set_visitor_id("example");
6971 /// ```
6972 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6973 self.visitor_id = v.into();
6974 self
6975 }
6976
6977 /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
6978 ///
6979 /// # Example
6980 /// ```ignore,no_run
6981 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6982 /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
6983 /// ```
6984 pub fn set_language_codes<T, V>(mut self, v: T) -> Self
6985 where
6986 T: std::iter::IntoIterator<Item = V>,
6987 V: std::convert::Into<std::string::String>,
6988 {
6989 use std::iter::Iterator;
6990 self.language_codes = v.into_iter().map(|i| i.into()).collect();
6991 self
6992 }
6993
6994 /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
6995 ///
6996 /// # Example
6997 /// ```ignore,no_run
6998 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6999 /// let x = CompleteQueryRequest::new().set_device_type("example");
7000 /// ```
7001 pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7002 self.device_type = v.into();
7003 self
7004 }
7005
7006 /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
7007 ///
7008 /// # Example
7009 /// ```ignore,no_run
7010 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7011 /// let x = CompleteQueryRequest::new().set_dataset("example");
7012 /// ```
7013 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7014 self.dataset = v.into();
7015 self
7016 }
7017
7018 /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
7019 ///
7020 /// # Example
7021 /// ```ignore,no_run
7022 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7023 /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
7024 /// ```
7025 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7026 self.max_suggestions = v.into();
7027 self
7028 }
7029
7030 /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
7031 ///
7032 /// # Example
7033 /// ```ignore,no_run
7034 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7035 /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
7036 /// ```
7037 pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7038 self.enable_attribute_suggestions = v.into();
7039 self
7040 }
7041
7042 /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
7043 ///
7044 /// # Example
7045 /// ```ignore,no_run
7046 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7047 /// let x = CompleteQueryRequest::new().set_entity("example");
7048 /// ```
7049 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7050 self.entity = v.into();
7051 self
7052 }
7053}
7054
7055impl wkt::message::Message for CompleteQueryRequest {
7056 fn typename() -> &'static str {
7057 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7058 }
7059}
7060
7061/// Response of the autocomplete query.
7062#[derive(Clone, Default, PartialEq)]
7063#[non_exhaustive]
7064pub struct CompleteQueryResponse {
7065 /// Results of the matching suggestions. The result list is ordered and the
7066 /// first result is top suggestion.
7067 pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7068
7069 /// A unique complete token. This should be included in the
7070 /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7071 /// for search events resulting from this completion, which enables accurate
7072 /// attribution of complete model performance.
7073 ///
7074 /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7075 pub attribution_token: std::string::String,
7076
7077 /// Deprecated. Matched recent searches of this user. The maximum number of
7078 /// recent searches is 10. This field is a restricted feature. If you want to
7079 /// enable it, contact Retail Search support.
7080 ///
7081 /// This feature is only available when
7082 /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7083 /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7084 /// The recent searches satisfy the follow rules:
7085 ///
7086 /// * They are ordered from latest to oldest.
7087 ///
7088 /// * They are matched with
7089 /// [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7090 /// case insensitively.
7091 ///
7092 /// * They are transformed to lower case.
7093 ///
7094 /// * They are UTF-8 safe.
7095 ///
7096 ///
7097 /// Recent searches are deduplicated. More recent searches will be reserved
7098 /// when duplication happens.
7099 ///
7100 /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7101 /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7102 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7103 #[deprecated]
7104 pub recent_search_results:
7105 std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7106
7107 /// A map of matched attribute suggestions. This field is only available for
7108 /// `cloud-retail` dataset.
7109 ///
7110 /// Current supported keys:
7111 ///
7112 /// * `brands`
7113 ///
7114 /// * `categories`
7115 ///
7116 pub attribute_results: std::collections::HashMap<
7117 std::string::String,
7118 crate::model::complete_query_response::AttributeResult,
7119 >,
7120
7121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7122}
7123
7124impl CompleteQueryResponse {
7125 /// Creates a new default instance.
7126 pub fn new() -> Self {
7127 std::default::Default::default()
7128 }
7129
7130 /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7131 ///
7132 /// # Example
7133 /// ```ignore,no_run
7134 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7135 /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7136 /// let x = CompleteQueryResponse::new()
7137 /// .set_completion_results([
7138 /// CompletionResult::default()/* use setters */,
7139 /// CompletionResult::default()/* use (different) setters */,
7140 /// ]);
7141 /// ```
7142 pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7143 where
7144 T: std::iter::IntoIterator<Item = V>,
7145 V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7146 {
7147 use std::iter::Iterator;
7148 self.completion_results = v.into_iter().map(|i| i.into()).collect();
7149 self
7150 }
7151
7152 /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7153 ///
7154 /// # Example
7155 /// ```ignore,no_run
7156 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7157 /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7158 /// ```
7159 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7160 mut self,
7161 v: T,
7162 ) -> Self {
7163 self.attribution_token = v.into();
7164 self
7165 }
7166
7167 /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7168 ///
7169 /// # Example
7170 /// ```ignore,no_run
7171 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7172 /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7173 /// let x = CompleteQueryResponse::new()
7174 /// .set_recent_search_results([
7175 /// RecentSearchResult::default()/* use setters */,
7176 /// RecentSearchResult::default()/* use (different) setters */,
7177 /// ]);
7178 /// ```
7179 #[deprecated]
7180 pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7181 where
7182 T: std::iter::IntoIterator<Item = V>,
7183 V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7184 {
7185 use std::iter::Iterator;
7186 self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7187 self
7188 }
7189
7190 /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7191 ///
7192 /// # Example
7193 /// ```ignore,no_run
7194 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7195 /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7196 /// let x = CompleteQueryResponse::new().set_attribute_results([
7197 /// ("key0", AttributeResult::default()/* use setters */),
7198 /// ("key1", AttributeResult::default()/* use (different) setters */),
7199 /// ]);
7200 /// ```
7201 pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7202 where
7203 T: std::iter::IntoIterator<Item = (K, V)>,
7204 K: std::convert::Into<std::string::String>,
7205 V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7206 {
7207 use std::iter::Iterator;
7208 self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7209 self
7210 }
7211}
7212
7213impl wkt::message::Message for CompleteQueryResponse {
7214 fn typename() -> &'static str {
7215 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7216 }
7217}
7218
7219/// Defines additional types related to [CompleteQueryResponse].
7220pub mod complete_query_response {
7221 #[allow(unused_imports)]
7222 use super::*;
7223
7224 /// Resource that represents completion results.
7225 #[derive(Clone, Default, PartialEq)]
7226 #[non_exhaustive]
7227 pub struct CompletionResult {
7228 /// The suggestion for the query.
7229 pub suggestion: std::string::String,
7230
7231 /// Custom attributes for the suggestion term.
7232 ///
7233 /// * For `user-data`, the attributes are additional custom attributes
7234 /// ingested through BigQuery.
7235 ///
7236 /// * For `cloud-retail`, the attributes are product attributes generated
7237 /// by Cloud Retail. It requires
7238 /// [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7239 /// is imported properly.
7240 ///
7241 ///
7242 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7243 pub attributes:
7244 std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7245
7246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7247 }
7248
7249 impl CompletionResult {
7250 /// Creates a new default instance.
7251 pub fn new() -> Self {
7252 std::default::Default::default()
7253 }
7254
7255 /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7256 ///
7257 /// # Example
7258 /// ```ignore,no_run
7259 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7260 /// let x = CompletionResult::new().set_suggestion("example");
7261 /// ```
7262 pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7263 self.suggestion = v.into();
7264 self
7265 }
7266
7267 /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7268 ///
7269 /// # Example
7270 /// ```ignore,no_run
7271 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7272 /// use google_cloud_retail_v2::model::CustomAttribute;
7273 /// let x = CompletionResult::new().set_attributes([
7274 /// ("key0", CustomAttribute::default()/* use setters */),
7275 /// ("key1", CustomAttribute::default()/* use (different) setters */),
7276 /// ]);
7277 /// ```
7278 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7279 where
7280 T: std::iter::IntoIterator<Item = (K, V)>,
7281 K: std::convert::Into<std::string::String>,
7282 V: std::convert::Into<crate::model::CustomAttribute>,
7283 {
7284 use std::iter::Iterator;
7285 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7286 self
7287 }
7288 }
7289
7290 impl wkt::message::Message for CompletionResult {
7291 fn typename() -> &'static str {
7292 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7293 }
7294 }
7295
7296 /// Deprecated: Recent search of this user.
7297 #[derive(Clone, Default, PartialEq)]
7298 #[non_exhaustive]
7299 #[deprecated]
7300 pub struct RecentSearchResult {
7301 /// The recent search query.
7302 pub recent_search: std::string::String,
7303
7304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7305 }
7306
7307 impl RecentSearchResult {
7308 /// Creates a new default instance.
7309 pub fn new() -> Self {
7310 std::default::Default::default()
7311 }
7312
7313 /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7314 ///
7315 /// # Example
7316 /// ```ignore,no_run
7317 /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7318 /// let x = RecentSearchResult::new().set_recent_search("example");
7319 /// ```
7320 pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7321 mut self,
7322 v: T,
7323 ) -> Self {
7324 self.recent_search = v.into();
7325 self
7326 }
7327 }
7328
7329 impl wkt::message::Message for RecentSearchResult {
7330 fn typename() -> &'static str {
7331 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7332 }
7333 }
7334
7335 /// Resource that represents attribute results.
7336 #[derive(Clone, Default, PartialEq)]
7337 #[non_exhaustive]
7338 pub struct AttributeResult {
7339 /// The list of suggestions for the attribute.
7340 pub suggestions: std::vec::Vec<std::string::String>,
7341
7342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7343 }
7344
7345 impl AttributeResult {
7346 /// Creates a new default instance.
7347 pub fn new() -> Self {
7348 std::default::Default::default()
7349 }
7350
7351 /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7352 ///
7353 /// # Example
7354 /// ```ignore,no_run
7355 /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7356 /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7357 /// ```
7358 pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7359 where
7360 T: std::iter::IntoIterator<Item = V>,
7361 V: std::convert::Into<std::string::String>,
7362 {
7363 use std::iter::Iterator;
7364 self.suggestions = v.into_iter().map(|i| i.into()).collect();
7365 self
7366 }
7367 }
7368
7369 impl wkt::message::Message for AttributeResult {
7370 fn typename() -> &'static str {
7371 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7372 }
7373 }
7374}
7375
7376/// Configures dynamic metadata that can be linked to a
7377/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7378/// recommendation results at serving time.
7379///
7380/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7381#[derive(Clone, Default, PartialEq)]
7382#[non_exhaustive]
7383pub struct Control {
7384 /// Immutable. Fully qualified name
7385 /// `projects/*/locations/global/catalogs/*/controls/*`
7386 pub name: std::string::String,
7387
7388 /// Required. The human readable control display name. Used in Retail UI.
7389 ///
7390 /// This field must be a UTF-8 encoded string with a length limit of 128
7391 /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7392 pub display_name: std::string::String,
7393
7394 /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7395 /// ids that are associated with this control in the same
7396 /// [Catalog][google.cloud.retail.v2.Catalog].
7397 ///
7398 /// Note the association is managed via the
7399 /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7400 /// only denormalized view.
7401 ///
7402 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7403 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7404 pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7405
7406 /// Required. Immutable. The solution types that the control is used for.
7407 /// Currently we support setting only one type of solution at creation time.
7408 ///
7409 /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7410 /// If no solution type is provided at creation time, will default to
7411 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7412 ///
7413 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7414 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7415
7416 /// Specifies the use case for the control.
7417 /// Affects what condition fields can be set.
7418 /// Only settable by search controls.
7419 /// Will default to
7420 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7421 /// if not specified. Currently only allow one search_solution_use_case per
7422 /// control.
7423 ///
7424 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7425 pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7426
7427 /// The behavior/type of the control
7428 ///
7429 /// A behavior/type must be specified on creation. Type cannot be changed once
7430 /// specified (e.g. A Rule control will always be a Rule control.). An
7431 /// INVALID_ARGUMENT will be returned if either condition is violated.
7432 pub control: std::option::Option<crate::model::control::Control>,
7433
7434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7435}
7436
7437impl Control {
7438 /// Creates a new default instance.
7439 pub fn new() -> Self {
7440 std::default::Default::default()
7441 }
7442
7443 /// Sets the value of [name][crate::model::Control::name].
7444 ///
7445 /// # Example
7446 /// ```ignore,no_run
7447 /// # use google_cloud_retail_v2::model::Control;
7448 /// let x = Control::new().set_name("example");
7449 /// ```
7450 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7451 self.name = v.into();
7452 self
7453 }
7454
7455 /// Sets the value of [display_name][crate::model::Control::display_name].
7456 ///
7457 /// # Example
7458 /// ```ignore,no_run
7459 /// # use google_cloud_retail_v2::model::Control;
7460 /// let x = Control::new().set_display_name("example");
7461 /// ```
7462 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7463 self.display_name = v.into();
7464 self
7465 }
7466
7467 /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7468 ///
7469 /// # Example
7470 /// ```ignore,no_run
7471 /// # use google_cloud_retail_v2::model::Control;
7472 /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7473 /// ```
7474 pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7475 where
7476 T: std::iter::IntoIterator<Item = V>,
7477 V: std::convert::Into<std::string::String>,
7478 {
7479 use std::iter::Iterator;
7480 self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7481 self
7482 }
7483
7484 /// Sets the value of [solution_types][crate::model::Control::solution_types].
7485 ///
7486 /// # Example
7487 /// ```ignore,no_run
7488 /// # use google_cloud_retail_v2::model::Control;
7489 /// use google_cloud_retail_v2::model::SolutionType;
7490 /// let x = Control::new().set_solution_types([
7491 /// SolutionType::Recommendation,
7492 /// SolutionType::Search,
7493 /// ]);
7494 /// ```
7495 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7496 where
7497 T: std::iter::IntoIterator<Item = V>,
7498 V: std::convert::Into<crate::model::SolutionType>,
7499 {
7500 use std::iter::Iterator;
7501 self.solution_types = v.into_iter().map(|i| i.into()).collect();
7502 self
7503 }
7504
7505 /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7506 ///
7507 /// # Example
7508 /// ```ignore,no_run
7509 /// # use google_cloud_retail_v2::model::Control;
7510 /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7511 /// let x = Control::new().set_search_solution_use_case([
7512 /// SearchSolutionUseCase::Search,
7513 /// SearchSolutionUseCase::Browse,
7514 /// ]);
7515 /// ```
7516 pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7517 where
7518 T: std::iter::IntoIterator<Item = V>,
7519 V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7520 {
7521 use std::iter::Iterator;
7522 self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7523 self
7524 }
7525
7526 /// Sets the value of [control][crate::model::Control::control].
7527 ///
7528 /// Note that all the setters affecting `control` are mutually
7529 /// exclusive.
7530 ///
7531 /// # Example
7532 /// ```ignore,no_run
7533 /// # use google_cloud_retail_v2::model::Control;
7534 /// use google_cloud_retail_v2::model::Rule;
7535 /// let x = Control::new().set_control(Some(
7536 /// google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7537 /// ```
7538 pub fn set_control<
7539 T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7540 >(
7541 mut self,
7542 v: T,
7543 ) -> Self {
7544 self.control = v.into();
7545 self
7546 }
7547
7548 /// The value of [control][crate::model::Control::control]
7549 /// if it holds a `Rule`, `None` if the field is not set or
7550 /// holds a different branch.
7551 pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7552 #[allow(unreachable_patterns)]
7553 self.control.as_ref().and_then(|v| match v {
7554 crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7555 _ => std::option::Option::None,
7556 })
7557 }
7558
7559 /// Sets the value of [control][crate::model::Control::control]
7560 /// to hold a `Rule`.
7561 ///
7562 /// Note that all the setters affecting `control` are
7563 /// mutually exclusive.
7564 ///
7565 /// # Example
7566 /// ```ignore,no_run
7567 /// # use google_cloud_retail_v2::model::Control;
7568 /// use google_cloud_retail_v2::model::Rule;
7569 /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7570 /// assert!(x.rule().is_some());
7571 /// ```
7572 pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7573 mut self,
7574 v: T,
7575 ) -> Self {
7576 self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7577 self
7578 }
7579}
7580
7581impl wkt::message::Message for Control {
7582 fn typename() -> &'static str {
7583 "type.googleapis.com/google.cloud.retail.v2.Control"
7584 }
7585}
7586
7587/// Defines additional types related to [Control].
7588pub mod control {
7589 #[allow(unused_imports)]
7590 use super::*;
7591
7592 /// The behavior/type of the control
7593 ///
7594 /// A behavior/type must be specified on creation. Type cannot be changed once
7595 /// specified (e.g. A Rule control will always be a Rule control.). An
7596 /// INVALID_ARGUMENT will be returned if either condition is violated.
7597 #[derive(Clone, Debug, PartialEq)]
7598 #[non_exhaustive]
7599 pub enum Control {
7600 /// A rule control - a condition-action pair.
7601 /// Enacts a set action when the condition is triggered.
7602 /// For example: Boost "gShoe" when query full matches "Running Shoes".
7603 Rule(std::boxed::Box<crate::model::Rule>),
7604 }
7605}
7606
7607/// Request for CreateControl method.
7608#[derive(Clone, Default, PartialEq)]
7609#[non_exhaustive]
7610pub struct CreateControlRequest {
7611 /// Required. Full resource name of parent catalog. Format:
7612 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7613 pub parent: std::string::String,
7614
7615 /// Required. The Control to create.
7616 pub control: std::option::Option<crate::model::Control>,
7617
7618 /// Required. The ID to use for the Control, which will become the final
7619 /// component of the Control's resource name.
7620 ///
7621 /// This value should be 4-63 characters, and valid characters
7622 /// are /[a-z][0-9]-_/.
7623 pub control_id: std::string::String,
7624
7625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7626}
7627
7628impl CreateControlRequest {
7629 /// Creates a new default instance.
7630 pub fn new() -> Self {
7631 std::default::Default::default()
7632 }
7633
7634 /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7635 ///
7636 /// # Example
7637 /// ```ignore,no_run
7638 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7639 /// let x = CreateControlRequest::new().set_parent("example");
7640 /// ```
7641 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7642 self.parent = v.into();
7643 self
7644 }
7645
7646 /// Sets the value of [control][crate::model::CreateControlRequest::control].
7647 ///
7648 /// # Example
7649 /// ```ignore,no_run
7650 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7651 /// use google_cloud_retail_v2::model::Control;
7652 /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7653 /// ```
7654 pub fn set_control<T>(mut self, v: T) -> Self
7655 where
7656 T: std::convert::Into<crate::model::Control>,
7657 {
7658 self.control = std::option::Option::Some(v.into());
7659 self
7660 }
7661
7662 /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7663 ///
7664 /// # Example
7665 /// ```ignore,no_run
7666 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7667 /// use google_cloud_retail_v2::model::Control;
7668 /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7669 /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7670 /// ```
7671 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7672 where
7673 T: std::convert::Into<crate::model::Control>,
7674 {
7675 self.control = v.map(|x| x.into());
7676 self
7677 }
7678
7679 /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7680 ///
7681 /// # Example
7682 /// ```ignore,no_run
7683 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7684 /// let x = CreateControlRequest::new().set_control_id("example");
7685 /// ```
7686 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7687 self.control_id = v.into();
7688 self
7689 }
7690}
7691
7692impl wkt::message::Message for CreateControlRequest {
7693 fn typename() -> &'static str {
7694 "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7695 }
7696}
7697
7698/// Request for UpdateControl method.
7699#[derive(Clone, Default, PartialEq)]
7700#[non_exhaustive]
7701pub struct UpdateControlRequest {
7702 /// Required. The Control to update.
7703 pub control: std::option::Option<crate::model::Control>,
7704
7705 /// Indicates which fields in the provided
7706 /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7707 /// supported:
7708 ///
7709 /// * [Control.name][google.cloud.retail.v2.Control.name]
7710 ///
7711 /// If not set or empty, all supported fields are updated.
7712 ///
7713 /// [google.cloud.retail.v2.Control]: crate::model::Control
7714 /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7715 pub update_mask: std::option::Option<wkt::FieldMask>,
7716
7717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7718}
7719
7720impl UpdateControlRequest {
7721 /// Creates a new default instance.
7722 pub fn new() -> Self {
7723 std::default::Default::default()
7724 }
7725
7726 /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7727 ///
7728 /// # Example
7729 /// ```ignore,no_run
7730 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7731 /// use google_cloud_retail_v2::model::Control;
7732 /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7733 /// ```
7734 pub fn set_control<T>(mut self, v: T) -> Self
7735 where
7736 T: std::convert::Into<crate::model::Control>,
7737 {
7738 self.control = std::option::Option::Some(v.into());
7739 self
7740 }
7741
7742 /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7743 ///
7744 /// # Example
7745 /// ```ignore,no_run
7746 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7747 /// use google_cloud_retail_v2::model::Control;
7748 /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7749 /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7750 /// ```
7751 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7752 where
7753 T: std::convert::Into<crate::model::Control>,
7754 {
7755 self.control = v.map(|x| x.into());
7756 self
7757 }
7758
7759 /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7760 ///
7761 /// # Example
7762 /// ```ignore,no_run
7763 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7764 /// use wkt::FieldMask;
7765 /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7766 /// ```
7767 pub fn set_update_mask<T>(mut self, v: T) -> Self
7768 where
7769 T: std::convert::Into<wkt::FieldMask>,
7770 {
7771 self.update_mask = std::option::Option::Some(v.into());
7772 self
7773 }
7774
7775 /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7776 ///
7777 /// # Example
7778 /// ```ignore,no_run
7779 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7780 /// use wkt::FieldMask;
7781 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7782 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7783 /// ```
7784 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7785 where
7786 T: std::convert::Into<wkt::FieldMask>,
7787 {
7788 self.update_mask = v.map(|x| x.into());
7789 self
7790 }
7791}
7792
7793impl wkt::message::Message for UpdateControlRequest {
7794 fn typename() -> &'static str {
7795 "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7796 }
7797}
7798
7799/// Request for DeleteControl method.
7800#[derive(Clone, Default, PartialEq)]
7801#[non_exhaustive]
7802pub struct DeleteControlRequest {
7803 /// Required. The resource name of the Control to delete. Format:
7804 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7805 pub name: std::string::String,
7806
7807 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7808}
7809
7810impl DeleteControlRequest {
7811 /// Creates a new default instance.
7812 pub fn new() -> Self {
7813 std::default::Default::default()
7814 }
7815
7816 /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7817 ///
7818 /// # Example
7819 /// ```ignore,no_run
7820 /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7821 /// let x = DeleteControlRequest::new().set_name("example");
7822 /// ```
7823 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7824 self.name = v.into();
7825 self
7826 }
7827}
7828
7829impl wkt::message::Message for DeleteControlRequest {
7830 fn typename() -> &'static str {
7831 "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7832 }
7833}
7834
7835/// Request for GetControl method.
7836#[derive(Clone, Default, PartialEq)]
7837#[non_exhaustive]
7838pub struct GetControlRequest {
7839 /// Required. The resource name of the Control to get. Format:
7840 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7841 pub name: std::string::String,
7842
7843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7844}
7845
7846impl GetControlRequest {
7847 /// Creates a new default instance.
7848 pub fn new() -> Self {
7849 std::default::Default::default()
7850 }
7851
7852 /// Sets the value of [name][crate::model::GetControlRequest::name].
7853 ///
7854 /// # Example
7855 /// ```ignore,no_run
7856 /// # use google_cloud_retail_v2::model::GetControlRequest;
7857 /// let x = GetControlRequest::new().set_name("example");
7858 /// ```
7859 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7860 self.name = v.into();
7861 self
7862 }
7863}
7864
7865impl wkt::message::Message for GetControlRequest {
7866 fn typename() -> &'static str {
7867 "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7868 }
7869}
7870
7871/// Request for ListControls method.
7872#[derive(Clone, Default, PartialEq)]
7873#[non_exhaustive]
7874pub struct ListControlsRequest {
7875 /// Required. The catalog resource name. Format:
7876 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7877 pub parent: std::string::String,
7878
7879 /// Optional. Maximum number of results to return. If unspecified, defaults
7880 /// to 50. Max allowed value is 1000.
7881 pub page_size: i32,
7882
7883 /// Optional. A page token, received from a previous `ListControls` call.
7884 /// Provide this to retrieve the subsequent page.
7885 pub page_token: std::string::String,
7886
7887 /// Optional. A filter to apply on the list results. Supported features:
7888 ///
7889 /// * List all the products under the parent branch if
7890 /// [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7891 /// * List controls that are used in a single ServingConfig:
7892 /// 'serving_config = "boosted_home_page_cvr"'
7893 ///
7894 /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7895 pub filter: std::string::String,
7896
7897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7898}
7899
7900impl ListControlsRequest {
7901 /// Creates a new default instance.
7902 pub fn new() -> Self {
7903 std::default::Default::default()
7904 }
7905
7906 /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7907 ///
7908 /// # Example
7909 /// ```ignore,no_run
7910 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7911 /// let x = ListControlsRequest::new().set_parent("example");
7912 /// ```
7913 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7914 self.parent = v.into();
7915 self
7916 }
7917
7918 /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7919 ///
7920 /// # Example
7921 /// ```ignore,no_run
7922 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7923 /// let x = ListControlsRequest::new().set_page_size(42);
7924 /// ```
7925 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7926 self.page_size = v.into();
7927 self
7928 }
7929
7930 /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7931 ///
7932 /// # Example
7933 /// ```ignore,no_run
7934 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7935 /// let x = ListControlsRequest::new().set_page_token("example");
7936 /// ```
7937 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7938 self.page_token = v.into();
7939 self
7940 }
7941
7942 /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7943 ///
7944 /// # Example
7945 /// ```ignore,no_run
7946 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7947 /// let x = ListControlsRequest::new().set_filter("example");
7948 /// ```
7949 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7950 self.filter = v.into();
7951 self
7952 }
7953}
7954
7955impl wkt::message::Message for ListControlsRequest {
7956 fn typename() -> &'static str {
7957 "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
7958 }
7959}
7960
7961/// Response for ListControls method.
7962#[derive(Clone, Default, PartialEq)]
7963#[non_exhaustive]
7964pub struct ListControlsResponse {
7965 /// All the Controls for a given catalog.
7966 pub controls: std::vec::Vec<crate::model::Control>,
7967
7968 /// Pagination token, if not returned indicates the last page.
7969 pub next_page_token: std::string::String,
7970
7971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7972}
7973
7974impl ListControlsResponse {
7975 /// Creates a new default instance.
7976 pub fn new() -> Self {
7977 std::default::Default::default()
7978 }
7979
7980 /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
7981 ///
7982 /// # Example
7983 /// ```ignore,no_run
7984 /// # use google_cloud_retail_v2::model::ListControlsResponse;
7985 /// use google_cloud_retail_v2::model::Control;
7986 /// let x = ListControlsResponse::new()
7987 /// .set_controls([
7988 /// Control::default()/* use setters */,
7989 /// Control::default()/* use (different) setters */,
7990 /// ]);
7991 /// ```
7992 pub fn set_controls<T, V>(mut self, v: T) -> Self
7993 where
7994 T: std::iter::IntoIterator<Item = V>,
7995 V: std::convert::Into<crate::model::Control>,
7996 {
7997 use std::iter::Iterator;
7998 self.controls = v.into_iter().map(|i| i.into()).collect();
7999 self
8000 }
8001
8002 /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
8003 ///
8004 /// # Example
8005 /// ```ignore,no_run
8006 /// # use google_cloud_retail_v2::model::ListControlsResponse;
8007 /// let x = ListControlsResponse::new().set_next_page_token("example");
8008 /// ```
8009 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8010 self.next_page_token = v.into();
8011 self
8012 }
8013}
8014
8015impl wkt::message::Message for ListControlsResponse {
8016 fn typename() -> &'static str {
8017 "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
8018 }
8019}
8020
8021#[doc(hidden)]
8022impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
8023 type PageItem = crate::model::Control;
8024
8025 fn items(self) -> std::vec::Vec<Self::PageItem> {
8026 self.controls
8027 }
8028
8029 fn next_page_token(&self) -> std::string::String {
8030 use std::clone::Clone;
8031 self.next_page_token.clone()
8032 }
8033}
8034
8035/// Request message for
8036/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8037/// method.
8038#[derive(Clone, Default, PartialEq)]
8039#[non_exhaustive]
8040pub struct ConversationalSearchRequest {
8041 /// Required. The resource name of the search engine placement, such as
8042 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
8043 /// or
8044 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
8045 /// This field is used to identify the serving config name and the set
8046 /// of models that will be used to make the search.
8047 pub placement: std::string::String,
8048
8049 /// Required. The branch resource name, such as
8050 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
8051 ///
8052 /// Use "default_branch" as the branch ID or leave this field empty, to search
8053 /// products under the default branch.
8054 pub branch: std::string::String,
8055
8056 /// Optional. Raw search query to be searched for.
8057 ///
8058 /// If this field is empty, the request is considered a category browsing
8059 /// request.
8060 pub query: std::string::String,
8061
8062 /// Optional. The categories associated with a category page. Must be set for
8063 /// category navigation queries to achieve good search quality. The format
8064 /// should be the same as
8065 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8066 ///
8067 /// To represent full path of category, use '>' sign to separate different
8068 /// hierarchies. If '>' is part of the category name, replace it with
8069 /// other character(s).
8070 ///
8071 /// Category pages include special pages such as sales or promotions. For
8072 /// instance, a special sale page may have the category hierarchy:
8073 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8074 ///
8075 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8076 pub page_categories: std::vec::Vec<std::string::String>,
8077
8078 /// Optional. This field specifies the conversation id, which maintains the
8079 /// state of the conversation between client side and server side. Use the
8080 /// value from the previous
8081 /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8082 /// For the initial request, this should be empty.
8083 ///
8084 /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8085 pub conversation_id: std::string::String,
8086
8087 /// Optional. Search parameters.
8088 pub search_params:
8089 std::option::Option<crate::model::conversational_search_request::SearchParams>,
8090
8091 /// Required. A unique identifier for tracking visitors. For example, this
8092 /// could be implemented with an HTTP cookie, which should be able to uniquely
8093 /// identify a visitor on a single device. This unique identifier should not
8094 /// change if the visitor logs in or out of the website.
8095 ///
8096 /// This should be the same identifier as
8097 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8098 ///
8099 /// The field must be a UTF-8 encoded string with a length limit of 128
8100 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8101 ///
8102 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8103 pub visitor_id: std::string::String,
8104
8105 /// Optional. User information.
8106 pub user_info: std::option::Option<crate::model::UserInfo>,
8107
8108 /// Optional. This field specifies all conversational filtering related
8109 /// parameters.
8110 pub conversational_filtering_spec: std::option::Option<
8111 crate::model::conversational_search_request::ConversationalFilteringSpec,
8112 >,
8113
8114 /// Optional. The user labels applied to a resource must meet the following
8115 /// requirements:
8116 ///
8117 /// * Each resource can have multiple labels, up to a maximum of 64.
8118 /// * Each label must be a key-value pair.
8119 /// * Keys have a minimum length of 1 character and a maximum length of 63
8120 /// characters and cannot be empty. Values can be empty and have a maximum
8121 /// length of 63 characters.
8122 /// * Keys and values can contain only lowercase letters, numeric characters,
8123 /// underscores, and dashes. All characters must use UTF-8 encoding, and
8124 /// international characters are allowed.
8125 /// * The key portion of a label must be unique. However, you can use the same
8126 /// key with multiple resources.
8127 /// * Keys must start with a lowercase letter or international character.
8128 ///
8129 /// See [Google Cloud
8130 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8131 /// for more details.
8132 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8133
8134 /// Optional. The safety settings to be applied to the generated content.
8135 pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8136
8137 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8138}
8139
8140impl ConversationalSearchRequest {
8141 /// Creates a new default instance.
8142 pub fn new() -> Self {
8143 std::default::Default::default()
8144 }
8145
8146 /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8147 ///
8148 /// # Example
8149 /// ```ignore,no_run
8150 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8151 /// let x = ConversationalSearchRequest::new().set_placement("example");
8152 /// ```
8153 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8154 self.placement = v.into();
8155 self
8156 }
8157
8158 /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8159 ///
8160 /// # Example
8161 /// ```ignore,no_run
8162 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8163 /// let x = ConversationalSearchRequest::new().set_branch("example");
8164 /// ```
8165 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8166 self.branch = v.into();
8167 self
8168 }
8169
8170 /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8171 ///
8172 /// # Example
8173 /// ```ignore,no_run
8174 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8175 /// let x = ConversationalSearchRequest::new().set_query("example");
8176 /// ```
8177 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8178 self.query = v.into();
8179 self
8180 }
8181
8182 /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8183 ///
8184 /// # Example
8185 /// ```ignore,no_run
8186 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8187 /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8188 /// ```
8189 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8190 where
8191 T: std::iter::IntoIterator<Item = V>,
8192 V: std::convert::Into<std::string::String>,
8193 {
8194 use std::iter::Iterator;
8195 self.page_categories = v.into_iter().map(|i| i.into()).collect();
8196 self
8197 }
8198
8199 /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8200 ///
8201 /// # Example
8202 /// ```ignore,no_run
8203 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8204 /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8205 /// ```
8206 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8207 self.conversation_id = v.into();
8208 self
8209 }
8210
8211 /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8212 ///
8213 /// # Example
8214 /// ```ignore,no_run
8215 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8216 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8217 /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8218 /// ```
8219 pub fn set_search_params<T>(mut self, v: T) -> Self
8220 where
8221 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8222 {
8223 self.search_params = std::option::Option::Some(v.into());
8224 self
8225 }
8226
8227 /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8228 ///
8229 /// # Example
8230 /// ```ignore,no_run
8231 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8232 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8233 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8234 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8235 /// ```
8236 pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8237 where
8238 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8239 {
8240 self.search_params = v.map(|x| x.into());
8241 self
8242 }
8243
8244 /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8245 ///
8246 /// # Example
8247 /// ```ignore,no_run
8248 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8249 /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8250 /// ```
8251 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8252 self.visitor_id = v.into();
8253 self
8254 }
8255
8256 /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8257 ///
8258 /// # Example
8259 /// ```ignore,no_run
8260 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8261 /// use google_cloud_retail_v2::model::UserInfo;
8262 /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8263 /// ```
8264 pub fn set_user_info<T>(mut self, v: T) -> Self
8265 where
8266 T: std::convert::Into<crate::model::UserInfo>,
8267 {
8268 self.user_info = std::option::Option::Some(v.into());
8269 self
8270 }
8271
8272 /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8273 ///
8274 /// # Example
8275 /// ```ignore,no_run
8276 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8277 /// use google_cloud_retail_v2::model::UserInfo;
8278 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8279 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8280 /// ```
8281 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8282 where
8283 T: std::convert::Into<crate::model::UserInfo>,
8284 {
8285 self.user_info = v.map(|x| x.into());
8286 self
8287 }
8288
8289 /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8290 ///
8291 /// # Example
8292 /// ```ignore,no_run
8293 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8294 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8295 /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8296 /// ```
8297 pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8298 where
8299 T: std::convert::Into<
8300 crate::model::conversational_search_request::ConversationalFilteringSpec,
8301 >,
8302 {
8303 self.conversational_filtering_spec = std::option::Option::Some(v.into());
8304 self
8305 }
8306
8307 /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8308 ///
8309 /// # Example
8310 /// ```ignore,no_run
8311 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8312 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8313 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8314 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8315 /// ```
8316 pub fn set_or_clear_conversational_filtering_spec<T>(
8317 mut self,
8318 v: std::option::Option<T>,
8319 ) -> Self
8320 where
8321 T: std::convert::Into<
8322 crate::model::conversational_search_request::ConversationalFilteringSpec,
8323 >,
8324 {
8325 self.conversational_filtering_spec = v.map(|x| x.into());
8326 self
8327 }
8328
8329 /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8330 ///
8331 /// # Example
8332 /// ```ignore,no_run
8333 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8334 /// let x = ConversationalSearchRequest::new().set_user_labels([
8335 /// ("key0", "abc"),
8336 /// ("key1", "xyz"),
8337 /// ]);
8338 /// ```
8339 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8340 where
8341 T: std::iter::IntoIterator<Item = (K, V)>,
8342 K: std::convert::Into<std::string::String>,
8343 V: std::convert::Into<std::string::String>,
8344 {
8345 use std::iter::Iterator;
8346 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8347 self
8348 }
8349
8350 /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8351 ///
8352 /// # Example
8353 /// ```ignore,no_run
8354 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8355 /// use google_cloud_retail_v2::model::SafetySetting;
8356 /// let x = ConversationalSearchRequest::new()
8357 /// .set_safety_settings([
8358 /// SafetySetting::default()/* use setters */,
8359 /// SafetySetting::default()/* use (different) setters */,
8360 /// ]);
8361 /// ```
8362 pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8363 where
8364 T: std::iter::IntoIterator<Item = V>,
8365 V: std::convert::Into<crate::model::SafetySetting>,
8366 {
8367 use std::iter::Iterator;
8368 self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8369 self
8370 }
8371}
8372
8373impl wkt::message::Message for ConversationalSearchRequest {
8374 fn typename() -> &'static str {
8375 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8376 }
8377}
8378
8379/// Defines additional types related to [ConversationalSearchRequest].
8380pub mod conversational_search_request {
8381 #[allow(unused_imports)]
8382 use super::*;
8383
8384 /// Search parameters.
8385 #[derive(Clone, Default, PartialEq)]
8386 #[non_exhaustive]
8387 pub struct SearchParams {
8388 /// Optional. The filter string to restrict search results.
8389 ///
8390 /// The syntax of the filter string is the same as
8391 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8392 ///
8393 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8394 pub filter: std::string::String,
8395
8396 /// Optional. The canonical filter string to restrict search results.
8397 ///
8398 /// The syntax of the canonical filter string is the same as
8399 /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8400 ///
8401 /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8402 pub canonical_filter: std::string::String,
8403
8404 /// Optional. The sort string to specify the sorting of search results.
8405 ///
8406 /// The syntax of the sort string is the same as
8407 /// [SearchRequest.sort][].
8408 pub sort_by: std::string::String,
8409
8410 /// Optional. The boost spec to specify the boosting of search results.
8411 ///
8412 /// The syntax of the boost spec is the same as
8413 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8414 ///
8415 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8416 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8417
8418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8419 }
8420
8421 impl SearchParams {
8422 /// Creates a new default instance.
8423 pub fn new() -> Self {
8424 std::default::Default::default()
8425 }
8426
8427 /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8428 ///
8429 /// # Example
8430 /// ```ignore,no_run
8431 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8432 /// let x = SearchParams::new().set_filter("example");
8433 /// ```
8434 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8435 self.filter = v.into();
8436 self
8437 }
8438
8439 /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8440 ///
8441 /// # Example
8442 /// ```ignore,no_run
8443 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8444 /// let x = SearchParams::new().set_canonical_filter("example");
8445 /// ```
8446 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8447 mut self,
8448 v: T,
8449 ) -> Self {
8450 self.canonical_filter = v.into();
8451 self
8452 }
8453
8454 /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8455 ///
8456 /// # Example
8457 /// ```ignore,no_run
8458 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8459 /// let x = SearchParams::new().set_sort_by("example");
8460 /// ```
8461 pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8462 self.sort_by = v.into();
8463 self
8464 }
8465
8466 /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8467 ///
8468 /// # Example
8469 /// ```ignore,no_run
8470 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8471 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8472 /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8473 /// ```
8474 pub fn set_boost_spec<T>(mut self, v: T) -> Self
8475 where
8476 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8477 {
8478 self.boost_spec = std::option::Option::Some(v.into());
8479 self
8480 }
8481
8482 /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8483 ///
8484 /// # Example
8485 /// ```ignore,no_run
8486 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8487 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8488 /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8489 /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8490 /// ```
8491 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8492 where
8493 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8494 {
8495 self.boost_spec = v.map(|x| x.into());
8496 self
8497 }
8498 }
8499
8500 impl wkt::message::Message for SearchParams {
8501 fn typename() -> &'static str {
8502 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8503 }
8504 }
8505
8506 /// This field specifies the current user answer during the conversational
8507 /// filtering search. This can be either user selected from suggested answers
8508 /// or user input plain text.
8509 #[derive(Clone, Default, PartialEq)]
8510 #[non_exhaustive]
8511 pub struct UserAnswer {
8512 /// This field specifies the type of user answer.
8513 pub r#type:
8514 std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8515
8516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8517 }
8518
8519 impl UserAnswer {
8520 /// Creates a new default instance.
8521 pub fn new() -> Self {
8522 std::default::Default::default()
8523 }
8524
8525 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8526 ///
8527 /// Note that all the setters affecting `r#type` are mutually
8528 /// exclusive.
8529 ///
8530 /// # Example
8531 /// ```ignore,no_run
8532 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8533 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8534 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8535 /// ```
8536 pub fn set_type<
8537 T: std::convert::Into<
8538 std::option::Option<
8539 crate::model::conversational_search_request::user_answer::Type,
8540 >,
8541 >,
8542 >(
8543 mut self,
8544 v: T,
8545 ) -> Self {
8546 self.r#type = v.into();
8547 self
8548 }
8549
8550 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8551 /// if it holds a `TextAnswer`, `None` if the field is not set or
8552 /// holds a different branch.
8553 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8554 #[allow(unreachable_patterns)]
8555 self.r#type.as_ref().and_then(|v| match v {
8556 crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8557 std::option::Option::Some(v)
8558 }
8559 _ => std::option::Option::None,
8560 })
8561 }
8562
8563 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8564 /// to hold a `TextAnswer`.
8565 ///
8566 /// Note that all the setters affecting `r#type` are
8567 /// mutually exclusive.
8568 ///
8569 /// # Example
8570 /// ```ignore,no_run
8571 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8572 /// let x = UserAnswer::new().set_text_answer("example");
8573 /// assert!(x.text_answer().is_some());
8574 /// assert!(x.selected_answer().is_none());
8575 /// ```
8576 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8577 self.r#type = std::option::Option::Some(
8578 crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8579 v.into(),
8580 ),
8581 );
8582 self
8583 }
8584
8585 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8586 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8587 /// holds a different branch.
8588 pub fn selected_answer(
8589 &self,
8590 ) -> std::option::Option<
8591 &std::boxed::Box<
8592 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8593 >,
8594 > {
8595 #[allow(unreachable_patterns)]
8596 self.r#type.as_ref().and_then(|v| match v {
8597 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8598 v,
8599 ) => std::option::Option::Some(v),
8600 _ => std::option::Option::None,
8601 })
8602 }
8603
8604 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8605 /// to hold a `SelectedAnswer`.
8606 ///
8607 /// Note that all the setters affecting `r#type` are
8608 /// mutually exclusive.
8609 ///
8610 /// # Example
8611 /// ```ignore,no_run
8612 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8613 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8614 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8615 /// assert!(x.selected_answer().is_some());
8616 /// assert!(x.text_answer().is_none());
8617 /// ```
8618 pub fn set_selected_answer<
8619 T: std::convert::Into<
8620 std::boxed::Box<
8621 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8622 >,
8623 >,
8624 >(
8625 mut self,
8626 v: T,
8627 ) -> Self {
8628 self.r#type = std::option::Option::Some(
8629 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8630 v.into(),
8631 ),
8632 );
8633 self
8634 }
8635 }
8636
8637 impl wkt::message::Message for UserAnswer {
8638 fn typename() -> &'static str {
8639 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8640 }
8641 }
8642
8643 /// Defines additional types related to [UserAnswer].
8644 pub mod user_answer {
8645 #[allow(unused_imports)]
8646 use super::*;
8647
8648 /// This field specifies the selected answers during the conversational
8649 /// search.
8650 #[derive(Clone, Default, PartialEq)]
8651 #[non_exhaustive]
8652 pub struct SelectedAnswer {
8653 /// Optional. This field specifies the selected answer which is a attribute
8654 /// key-value.
8655 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8656
8657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8658 }
8659
8660 impl SelectedAnswer {
8661 /// Creates a new default instance.
8662 pub fn new() -> Self {
8663 std::default::Default::default()
8664 }
8665
8666 /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8667 ///
8668 /// # Example
8669 /// ```ignore,no_run
8670 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8671 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8672 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8673 /// ```
8674 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8675 where
8676 T: std::convert::Into<crate::model::ProductAttributeValue>,
8677 {
8678 self.product_attribute_value = std::option::Option::Some(v.into());
8679 self
8680 }
8681
8682 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8683 ///
8684 /// # Example
8685 /// ```ignore,no_run
8686 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8687 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8688 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8689 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8690 /// ```
8691 pub fn set_or_clear_product_attribute_value<T>(
8692 mut self,
8693 v: std::option::Option<T>,
8694 ) -> Self
8695 where
8696 T: std::convert::Into<crate::model::ProductAttributeValue>,
8697 {
8698 self.product_attribute_value = v.map(|x| x.into());
8699 self
8700 }
8701 }
8702
8703 impl wkt::message::Message for SelectedAnswer {
8704 fn typename() -> &'static str {
8705 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8706 }
8707 }
8708
8709 /// This field specifies the type of user answer.
8710 #[derive(Clone, Debug, PartialEq)]
8711 #[non_exhaustive]
8712 pub enum Type {
8713 /// This field specifies the incremental input text from the user during
8714 /// the conversational search.
8715 TextAnswer(std::string::String),
8716 /// Optional. This field specifies the selected answer during the
8717 /// conversational search. This should be a subset of
8718 /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8719 SelectedAnswer(
8720 std::boxed::Box<
8721 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8722 >,
8723 ),
8724 }
8725 }
8726
8727 /// This field specifies all conversational filtering related parameters
8728 /// addition to conversational retail search.
8729 #[derive(Clone, Default, PartialEq)]
8730 #[non_exhaustive]
8731 pub struct ConversationalFilteringSpec {
8732 /// Optional. This field is deprecated. Please use
8733 /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8734 /// instead.
8735 ///
8736 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8737 #[deprecated]
8738 pub enable_conversational_filtering: bool,
8739
8740 /// Optional. This field specifies the current user answer during the
8741 /// conversational filtering search. It can be either user selected from
8742 /// suggested answers or user input plain text.
8743 pub user_answer:
8744 std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8745
8746 /// Optional. Mode to control Conversational Filtering.
8747 /// Defaults to
8748 /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8749 /// if it's unset.
8750 ///
8751 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8752 pub conversational_filtering_mode:
8753 crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8754
8755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8756 }
8757
8758 impl ConversationalFilteringSpec {
8759 /// Creates a new default instance.
8760 pub fn new() -> Self {
8761 std::default::Default::default()
8762 }
8763
8764 /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8765 ///
8766 /// # Example
8767 /// ```ignore,no_run
8768 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8769 /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8770 /// ```
8771 #[deprecated]
8772 pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8773 mut self,
8774 v: T,
8775 ) -> Self {
8776 self.enable_conversational_filtering = v.into();
8777 self
8778 }
8779
8780 /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8781 ///
8782 /// # Example
8783 /// ```ignore,no_run
8784 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8785 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8786 /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8787 /// ```
8788 pub fn set_user_answer<T>(mut self, v: T) -> Self
8789 where
8790 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8791 {
8792 self.user_answer = std::option::Option::Some(v.into());
8793 self
8794 }
8795
8796 /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8797 ///
8798 /// # Example
8799 /// ```ignore,no_run
8800 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8801 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8802 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8803 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8804 /// ```
8805 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8806 where
8807 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8808 {
8809 self.user_answer = v.map(|x| x.into());
8810 self
8811 }
8812
8813 /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8814 ///
8815 /// # Example
8816 /// ```ignore,no_run
8817 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8818 /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8819 /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8820 /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8821 /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8822 /// ```
8823 pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8824 self.conversational_filtering_mode = v.into();
8825 self
8826 }
8827 }
8828
8829 impl wkt::message::Message for ConversationalFilteringSpec {
8830 fn typename() -> &'static str {
8831 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8832 }
8833 }
8834
8835 /// Defines additional types related to [ConversationalFilteringSpec].
8836 pub mod conversational_filtering_spec {
8837 #[allow(unused_imports)]
8838 use super::*;
8839
8840 /// Enum to control Conversational Filtering mode.
8841 /// A single conversation session including multiple turns supports modes for
8842 /// Conversational Search OR Conversational Filtering without
8843 /// Conversational Search, but not both.
8844 ///
8845 /// # Working with unknown values
8846 ///
8847 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8848 /// additional enum variants at any time. Adding new variants is not considered
8849 /// a breaking change. Applications should write their code in anticipation of:
8850 ///
8851 /// - New values appearing in future releases of the client library, **and**
8852 /// - New values received dynamically, without application changes.
8853 ///
8854 /// Please consult the [Working with enums] section in the user guide for some
8855 /// guidelines.
8856 ///
8857 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8858 #[derive(Clone, Debug, PartialEq)]
8859 #[non_exhaustive]
8860 pub enum Mode {
8861 /// Default value.
8862 Unspecified,
8863 /// Disables Conversational Filtering when using Conversational Search.
8864 Disabled,
8865 /// Enables Conversational Filtering when using Conversational Search.
8866 Enabled,
8867 /// Enables Conversational Filtering without Conversational Search.
8868 ConversationalFilterOnly,
8869 /// If set, the enum was initialized with an unknown value.
8870 ///
8871 /// Applications can examine the value using [Mode::value] or
8872 /// [Mode::name].
8873 UnknownValue(mode::UnknownValue),
8874 }
8875
8876 #[doc(hidden)]
8877 pub mod mode {
8878 #[allow(unused_imports)]
8879 use super::*;
8880 #[derive(Clone, Debug, PartialEq)]
8881 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8882 }
8883
8884 impl Mode {
8885 /// Gets the enum value.
8886 ///
8887 /// Returns `None` if the enum contains an unknown value deserialized from
8888 /// the string representation of enums.
8889 pub fn value(&self) -> std::option::Option<i32> {
8890 match self {
8891 Self::Unspecified => std::option::Option::Some(0),
8892 Self::Disabled => std::option::Option::Some(1),
8893 Self::Enabled => std::option::Option::Some(2),
8894 Self::ConversationalFilterOnly => std::option::Option::Some(3),
8895 Self::UnknownValue(u) => u.0.value(),
8896 }
8897 }
8898
8899 /// Gets the enum value as a string.
8900 ///
8901 /// Returns `None` if the enum contains an unknown value deserialized from
8902 /// the integer representation of enums.
8903 pub fn name(&self) -> std::option::Option<&str> {
8904 match self {
8905 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8906 Self::Disabled => std::option::Option::Some("DISABLED"),
8907 Self::Enabled => std::option::Option::Some("ENABLED"),
8908 Self::ConversationalFilterOnly => {
8909 std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8910 }
8911 Self::UnknownValue(u) => u.0.name(),
8912 }
8913 }
8914 }
8915
8916 impl std::default::Default for Mode {
8917 fn default() -> Self {
8918 use std::convert::From;
8919 Self::from(0)
8920 }
8921 }
8922
8923 impl std::fmt::Display for Mode {
8924 fn fmt(
8925 &self,
8926 f: &mut std::fmt::Formatter<'_>,
8927 ) -> std::result::Result<(), std::fmt::Error> {
8928 wkt::internal::display_enum(f, self.name(), self.value())
8929 }
8930 }
8931
8932 impl std::convert::From<i32> for Mode {
8933 fn from(value: i32) -> Self {
8934 match value {
8935 0 => Self::Unspecified,
8936 1 => Self::Disabled,
8937 2 => Self::Enabled,
8938 3 => Self::ConversationalFilterOnly,
8939 _ => Self::UnknownValue(mode::UnknownValue(
8940 wkt::internal::UnknownEnumValue::Integer(value),
8941 )),
8942 }
8943 }
8944 }
8945
8946 impl std::convert::From<&str> for Mode {
8947 fn from(value: &str) -> Self {
8948 use std::string::ToString;
8949 match value {
8950 "MODE_UNSPECIFIED" => Self::Unspecified,
8951 "DISABLED" => Self::Disabled,
8952 "ENABLED" => Self::Enabled,
8953 "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
8954 _ => Self::UnknownValue(mode::UnknownValue(
8955 wkt::internal::UnknownEnumValue::String(value.to_string()),
8956 )),
8957 }
8958 }
8959 }
8960
8961 impl serde::ser::Serialize for Mode {
8962 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8963 where
8964 S: serde::Serializer,
8965 {
8966 match self {
8967 Self::Unspecified => serializer.serialize_i32(0),
8968 Self::Disabled => serializer.serialize_i32(1),
8969 Self::Enabled => serializer.serialize_i32(2),
8970 Self::ConversationalFilterOnly => serializer.serialize_i32(3),
8971 Self::UnknownValue(u) => u.0.serialize(serializer),
8972 }
8973 }
8974 }
8975
8976 impl<'de> serde::de::Deserialize<'de> for Mode {
8977 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8978 where
8979 D: serde::Deserializer<'de>,
8980 {
8981 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
8982 ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
8983 }
8984 }
8985 }
8986}
8987
8988/// Response message for
8989/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8990/// method.
8991#[derive(Clone, Default, PartialEq)]
8992#[non_exhaustive]
8993pub struct ConversationalSearchResponse {
8994 /// The types Retail classifies the search query as.
8995 ///
8996 /// Supported values are:
8997 ///
8998 /// - "ORDER_SUPPORT"
8999 /// - "SIMPLE_PRODUCT_SEARCH"
9000 /// - "INTENT_REFINEMENT"
9001 /// - "PRODUCT_DETAILS"
9002 /// - "PRODUCT_COMPARISON"
9003 /// - "DEALS_AND_COUPONS"
9004 /// - "STORE_RELEVANT"
9005 /// - "BLOCKLISTED"
9006 /// - "BEST_PRODUCT"
9007 /// - "RETAIL_SUPPORT"
9008 /// - "DISABLED"
9009 pub user_query_types: std::vec::Vec<std::string::String>,
9010
9011 /// The conversational answer-based text response generated by the Server.
9012 pub conversational_text_response: std::string::String,
9013
9014 /// The conversational followup question generated for Intent refinement.
9015 pub followup_question:
9016 std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9017
9018 /// Conversation UUID. This field will be stored in client side storage to
9019 /// maintain the conversation session with server and will be used for next
9020 /// search request's
9021 /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
9022 /// to restore conversation state in server.
9023 ///
9024 /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
9025 pub conversation_id: std::string::String,
9026
9027 /// The proposed refined search queries. They can be used to fetch the relevant
9028 /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
9029 /// refined_query from search response will be populated here.
9030 pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
9031
9032 /// This field specifies all related information that is needed on client
9033 /// side for UI rendering of conversational filtering search.
9034 pub conversational_filtering_result: std::option::Option<
9035 crate::model::conversational_search_response::ConversationalFilteringResult,
9036 >,
9037
9038 /// Output only. The state of the response generation.
9039 pub state: crate::model::conversational_search_response::State,
9040
9041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9042}
9043
9044impl ConversationalSearchResponse {
9045 /// Creates a new default instance.
9046 pub fn new() -> Self {
9047 std::default::Default::default()
9048 }
9049
9050 /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
9051 ///
9052 /// # Example
9053 /// ```ignore,no_run
9054 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9055 /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
9056 /// ```
9057 pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
9058 where
9059 T: std::iter::IntoIterator<Item = V>,
9060 V: std::convert::Into<std::string::String>,
9061 {
9062 use std::iter::Iterator;
9063 self.user_query_types = v.into_iter().map(|i| i.into()).collect();
9064 self
9065 }
9066
9067 /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
9068 ///
9069 /// # Example
9070 /// ```ignore,no_run
9071 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9072 /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9073 /// ```
9074 pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9075 mut self,
9076 v: T,
9077 ) -> Self {
9078 self.conversational_text_response = v.into();
9079 self
9080 }
9081
9082 /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9083 ///
9084 /// # Example
9085 /// ```ignore,no_run
9086 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9087 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9088 /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9089 /// ```
9090 pub fn set_followup_question<T>(mut self, v: T) -> Self
9091 where
9092 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9093 {
9094 self.followup_question = std::option::Option::Some(v.into());
9095 self
9096 }
9097
9098 /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9099 ///
9100 /// # Example
9101 /// ```ignore,no_run
9102 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9103 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9104 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9105 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9106 /// ```
9107 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9108 where
9109 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9110 {
9111 self.followup_question = v.map(|x| x.into());
9112 self
9113 }
9114
9115 /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9116 ///
9117 /// # Example
9118 /// ```ignore,no_run
9119 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9120 /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9121 /// ```
9122 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9123 self.conversation_id = v.into();
9124 self
9125 }
9126
9127 /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9128 ///
9129 /// # Example
9130 /// ```ignore,no_run
9131 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9132 /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9133 /// let x = ConversationalSearchResponse::new()
9134 /// .set_refined_search([
9135 /// RefinedSearch::default()/* use setters */,
9136 /// RefinedSearch::default()/* use (different) setters */,
9137 /// ]);
9138 /// ```
9139 pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9140 where
9141 T: std::iter::IntoIterator<Item = V>,
9142 V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9143 {
9144 use std::iter::Iterator;
9145 self.refined_search = v.into_iter().map(|i| i.into()).collect();
9146 self
9147 }
9148
9149 /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9150 ///
9151 /// # Example
9152 /// ```ignore,no_run
9153 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9154 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9155 /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9156 /// ```
9157 pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9158 where
9159 T: std::convert::Into<
9160 crate::model::conversational_search_response::ConversationalFilteringResult,
9161 >,
9162 {
9163 self.conversational_filtering_result = std::option::Option::Some(v.into());
9164 self
9165 }
9166
9167 /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9168 ///
9169 /// # Example
9170 /// ```ignore,no_run
9171 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9172 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9173 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9174 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9175 /// ```
9176 pub fn set_or_clear_conversational_filtering_result<T>(
9177 mut self,
9178 v: std::option::Option<T>,
9179 ) -> Self
9180 where
9181 T: std::convert::Into<
9182 crate::model::conversational_search_response::ConversationalFilteringResult,
9183 >,
9184 {
9185 self.conversational_filtering_result = v.map(|x| x.into());
9186 self
9187 }
9188
9189 /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9190 ///
9191 /// # Example
9192 /// ```ignore,no_run
9193 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9194 /// use google_cloud_retail_v2::model::conversational_search_response::State;
9195 /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9196 /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9197 /// ```
9198 pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9199 mut self,
9200 v: T,
9201 ) -> Self {
9202 self.state = v.into();
9203 self
9204 }
9205}
9206
9207impl wkt::message::Message for ConversationalSearchResponse {
9208 fn typename() -> &'static str {
9209 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9210 }
9211}
9212
9213/// Defines additional types related to [ConversationalSearchResponse].
9214pub mod conversational_search_response {
9215 #[allow(unused_imports)]
9216 use super::*;
9217
9218 /// The conversational followup question generated for Intent refinement.
9219 #[derive(Clone, Default, PartialEq)]
9220 #[non_exhaustive]
9221 pub struct FollowupQuestion {
9222 /// The conversational followup question generated for Intent refinement.
9223 pub followup_question: std::string::String,
9224
9225 /// The answer options provided to client for the follow-up question.
9226 pub suggested_answers: std::vec::Vec<
9227 crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9228 >,
9229
9230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9231 }
9232
9233 impl FollowupQuestion {
9234 /// Creates a new default instance.
9235 pub fn new() -> Self {
9236 std::default::Default::default()
9237 }
9238
9239 /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9240 ///
9241 /// # Example
9242 /// ```ignore,no_run
9243 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9244 /// let x = FollowupQuestion::new().set_followup_question("example");
9245 /// ```
9246 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9247 mut self,
9248 v: T,
9249 ) -> Self {
9250 self.followup_question = v.into();
9251 self
9252 }
9253
9254 /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9255 ///
9256 /// # Example
9257 /// ```ignore,no_run
9258 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9259 /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9260 /// let x = FollowupQuestion::new()
9261 /// .set_suggested_answers([
9262 /// SuggestedAnswer::default()/* use setters */,
9263 /// SuggestedAnswer::default()/* use (different) setters */,
9264 /// ]);
9265 /// ```
9266 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9267 where
9268 T: std::iter::IntoIterator<Item = V>,
9269 V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9270 {
9271 use std::iter::Iterator;
9272 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9273 self
9274 }
9275 }
9276
9277 impl wkt::message::Message for FollowupQuestion {
9278 fn typename() -> &'static str {
9279 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9280 }
9281 }
9282
9283 /// Defines additional types related to [FollowupQuestion].
9284 pub mod followup_question {
9285 #[allow(unused_imports)]
9286 use super::*;
9287
9288 /// Suggested answers to the follow-up question.
9289 /// If it's numerical attribute, only ProductAttributeInterval will be set.
9290 /// If it's textual attribute, only productAttributeValue will be set.
9291 #[derive(Clone, Default, PartialEq)]
9292 #[non_exhaustive]
9293 pub struct SuggestedAnswer {
9294 /// Product attribute value, including an attribute key and an
9295 /// attribute value. Other types can be added here in the future.
9296 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9297
9298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9299 }
9300
9301 impl SuggestedAnswer {
9302 /// Creates a new default instance.
9303 pub fn new() -> Self {
9304 std::default::Default::default()
9305 }
9306
9307 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9308 ///
9309 /// # Example
9310 /// ```ignore,no_run
9311 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9312 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9313 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9314 /// ```
9315 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9316 where
9317 T: std::convert::Into<crate::model::ProductAttributeValue>,
9318 {
9319 self.product_attribute_value = std::option::Option::Some(v.into());
9320 self
9321 }
9322
9323 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9324 ///
9325 /// # Example
9326 /// ```ignore,no_run
9327 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9328 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9329 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9330 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9331 /// ```
9332 pub fn set_or_clear_product_attribute_value<T>(
9333 mut self,
9334 v: std::option::Option<T>,
9335 ) -> Self
9336 where
9337 T: std::convert::Into<crate::model::ProductAttributeValue>,
9338 {
9339 self.product_attribute_value = v.map(|x| x.into());
9340 self
9341 }
9342 }
9343
9344 impl wkt::message::Message for SuggestedAnswer {
9345 fn typename() -> &'static str {
9346 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9347 }
9348 }
9349 }
9350
9351 /// The proposed refined search for intent-refinement/bundled shopping
9352 /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9353 /// refined_query from search response will be populated here.
9354 #[derive(Clone, Default, PartialEq)]
9355 #[non_exhaustive]
9356 pub struct RefinedSearch {
9357 /// The query to be used for search.
9358 pub query: std::string::String,
9359
9360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9361 }
9362
9363 impl RefinedSearch {
9364 /// Creates a new default instance.
9365 pub fn new() -> Self {
9366 std::default::Default::default()
9367 }
9368
9369 /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9370 ///
9371 /// # Example
9372 /// ```ignore,no_run
9373 /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9374 /// let x = RefinedSearch::new().set_query("example");
9375 /// ```
9376 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9377 self.query = v.into();
9378 self
9379 }
9380 }
9381
9382 impl wkt::message::Message for RefinedSearch {
9383 fn typename() -> &'static str {
9384 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9385 }
9386 }
9387
9388 /// This field specifies all related information that is needed on client
9389 /// side for UI rendering of conversational filtering search.
9390 #[derive(Clone, Default, PartialEq)]
9391 #[non_exhaustive]
9392 pub struct ConversationalFilteringResult {
9393
9394 /// The conversational filtering question.
9395 pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9396
9397 /// This is the incremental additional filters implied from the current
9398 /// user answer. User should add the suggested addition filters to the
9399 /// previous [ConversationalSearchRequest.search_params.filter][] and
9400 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
9401 /// use the merged filter in the follow up requests.
9402 ///
9403 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
9404 pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9405
9406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9407 }
9408
9409 impl ConversationalFilteringResult {
9410 /// Creates a new default instance.
9411 pub fn new() -> Self {
9412 std::default::Default::default()
9413 }
9414
9415 /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9416 ///
9417 /// # Example
9418 /// ```ignore,no_run
9419 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9420 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9421 /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9422 /// ```
9423 pub fn set_followup_question<T>(mut self, v: T) -> Self
9424 where
9425 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9426 {
9427 self.followup_question = std::option::Option::Some(v.into());
9428 self
9429 }
9430
9431 /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9432 ///
9433 /// # Example
9434 /// ```ignore,no_run
9435 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9436 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9437 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9438 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9439 /// ```
9440 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9441 where
9442 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9443 {
9444 self.followup_question = v.map(|x| x.into());
9445 self
9446 }
9447
9448 /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9449 ///
9450 /// # Example
9451 /// ```ignore,no_run
9452 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9453 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9454 /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9455 /// ```
9456 pub fn set_additional_filter<T>(mut self, v: T) -> Self
9457 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9458 {
9459 self.additional_filter = std::option::Option::Some(v.into());
9460 self
9461 }
9462
9463 /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9464 ///
9465 /// # Example
9466 /// ```ignore,no_run
9467 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9468 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9469 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9470 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9471 /// ```
9472 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9473 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9474 {
9475 self.additional_filter = v.map(|x| x.into());
9476 self
9477 }
9478 }
9479
9480 impl wkt::message::Message for ConversationalFilteringResult {
9481 fn typename() -> &'static str {
9482 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9483 }
9484 }
9485
9486 /// Defines additional types related to [ConversationalFilteringResult].
9487 pub mod conversational_filtering_result {
9488 #[allow(unused_imports)]
9489 use super::*;
9490
9491 /// Additional filter that client side need to apply.
9492 #[derive(Clone, Default, PartialEq)]
9493 #[non_exhaustive]
9494 pub struct AdditionalFilter {
9495 /// Product attribute value, including an attribute key and an
9496 /// attribute value. Other types can be added here in the future.
9497 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9498
9499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9500 }
9501
9502 impl AdditionalFilter {
9503 /// Creates a new default instance.
9504 pub fn new() -> Self {
9505 std::default::Default::default()
9506 }
9507
9508 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9509 ///
9510 /// # Example
9511 /// ```ignore,no_run
9512 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9513 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9514 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9515 /// ```
9516 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9517 where
9518 T: std::convert::Into<crate::model::ProductAttributeValue>,
9519 {
9520 self.product_attribute_value = std::option::Option::Some(v.into());
9521 self
9522 }
9523
9524 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9525 ///
9526 /// # Example
9527 /// ```ignore,no_run
9528 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9529 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9530 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9531 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9532 /// ```
9533 pub fn set_or_clear_product_attribute_value<T>(
9534 mut self,
9535 v: std::option::Option<T>,
9536 ) -> Self
9537 where
9538 T: std::convert::Into<crate::model::ProductAttributeValue>,
9539 {
9540 self.product_attribute_value = v.map(|x| x.into());
9541 self
9542 }
9543 }
9544
9545 impl wkt::message::Message for AdditionalFilter {
9546 fn typename() -> &'static str {
9547 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9548 }
9549 }
9550 }
9551
9552 /// The state of the response generation.
9553 ///
9554 /// # Working with unknown values
9555 ///
9556 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9557 /// additional enum variants at any time. Adding new variants is not considered
9558 /// a breaking change. Applications should write their code in anticipation of:
9559 ///
9560 /// - New values appearing in future releases of the client library, **and**
9561 /// - New values received dynamically, without application changes.
9562 ///
9563 /// Please consult the [Working with enums] section in the user guide for some
9564 /// guidelines.
9565 ///
9566 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9567 #[derive(Clone, Debug, PartialEq)]
9568 #[non_exhaustive]
9569 pub enum State {
9570 /// Unknown.
9571 Unspecified,
9572 /// Response generation is being streamed.
9573 Streaming,
9574 /// Response generation has succeeded.
9575 Succeeded,
9576 /// If set, the enum was initialized with an unknown value.
9577 ///
9578 /// Applications can examine the value using [State::value] or
9579 /// [State::name].
9580 UnknownValue(state::UnknownValue),
9581 }
9582
9583 #[doc(hidden)]
9584 pub mod state {
9585 #[allow(unused_imports)]
9586 use super::*;
9587 #[derive(Clone, Debug, PartialEq)]
9588 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9589 }
9590
9591 impl State {
9592 /// Gets the enum value.
9593 ///
9594 /// Returns `None` if the enum contains an unknown value deserialized from
9595 /// the string representation of enums.
9596 pub fn value(&self) -> std::option::Option<i32> {
9597 match self {
9598 Self::Unspecified => std::option::Option::Some(0),
9599 Self::Streaming => std::option::Option::Some(1),
9600 Self::Succeeded => std::option::Option::Some(2),
9601 Self::UnknownValue(u) => u.0.value(),
9602 }
9603 }
9604
9605 /// Gets the enum value as a string.
9606 ///
9607 /// Returns `None` if the enum contains an unknown value deserialized from
9608 /// the integer representation of enums.
9609 pub fn name(&self) -> std::option::Option<&str> {
9610 match self {
9611 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9612 Self::Streaming => std::option::Option::Some("STREAMING"),
9613 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9614 Self::UnknownValue(u) => u.0.name(),
9615 }
9616 }
9617 }
9618
9619 impl std::default::Default for State {
9620 fn default() -> Self {
9621 use std::convert::From;
9622 Self::from(0)
9623 }
9624 }
9625
9626 impl std::fmt::Display for State {
9627 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9628 wkt::internal::display_enum(f, self.name(), self.value())
9629 }
9630 }
9631
9632 impl std::convert::From<i32> for State {
9633 fn from(value: i32) -> Self {
9634 match value {
9635 0 => Self::Unspecified,
9636 1 => Self::Streaming,
9637 2 => Self::Succeeded,
9638 _ => Self::UnknownValue(state::UnknownValue(
9639 wkt::internal::UnknownEnumValue::Integer(value),
9640 )),
9641 }
9642 }
9643 }
9644
9645 impl std::convert::From<&str> for State {
9646 fn from(value: &str) -> Self {
9647 use std::string::ToString;
9648 match value {
9649 "STATE_UNSPECIFIED" => Self::Unspecified,
9650 "STREAMING" => Self::Streaming,
9651 "SUCCEEDED" => Self::Succeeded,
9652 _ => Self::UnknownValue(state::UnknownValue(
9653 wkt::internal::UnknownEnumValue::String(value.to_string()),
9654 )),
9655 }
9656 }
9657 }
9658
9659 impl serde::ser::Serialize for State {
9660 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9661 where
9662 S: serde::Serializer,
9663 {
9664 match self {
9665 Self::Unspecified => serializer.serialize_i32(0),
9666 Self::Streaming => serializer.serialize_i32(1),
9667 Self::Succeeded => serializer.serialize_i32(2),
9668 Self::UnknownValue(u) => u.0.serialize(serializer),
9669 }
9670 }
9671 }
9672
9673 impl<'de> serde::de::Deserialize<'de> for State {
9674 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9675 where
9676 D: serde::Deserializer<'de>,
9677 {
9678 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9679 ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9680 ))
9681 }
9682 }
9683}
9684
9685/// The output configuration setting.
9686#[derive(Clone, Default, PartialEq)]
9687#[non_exhaustive]
9688pub struct OutputConfig {
9689 /// The configuration of destination for holding output data.
9690 pub destination: std::option::Option<crate::model::output_config::Destination>,
9691
9692 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9693}
9694
9695impl OutputConfig {
9696 /// Creates a new default instance.
9697 pub fn new() -> Self {
9698 std::default::Default::default()
9699 }
9700
9701 /// Sets the value of [destination][crate::model::OutputConfig::destination].
9702 ///
9703 /// Note that all the setters affecting `destination` are mutually
9704 /// exclusive.
9705 ///
9706 /// # Example
9707 /// ```ignore,no_run
9708 /// # use google_cloud_retail_v2::model::OutputConfig;
9709 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9710 /// let x = OutputConfig::new().set_destination(Some(
9711 /// google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9712 /// ```
9713 pub fn set_destination<
9714 T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9715 >(
9716 mut self,
9717 v: T,
9718 ) -> Self {
9719 self.destination = v.into();
9720 self
9721 }
9722
9723 /// The value of [destination][crate::model::OutputConfig::destination]
9724 /// if it holds a `GcsDestination`, `None` if the field is not set or
9725 /// holds a different branch.
9726 pub fn gcs_destination(
9727 &self,
9728 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9729 #[allow(unreachable_patterns)]
9730 self.destination.as_ref().and_then(|v| match v {
9731 crate::model::output_config::Destination::GcsDestination(v) => {
9732 std::option::Option::Some(v)
9733 }
9734 _ => std::option::Option::None,
9735 })
9736 }
9737
9738 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9739 /// to hold a `GcsDestination`.
9740 ///
9741 /// Note that all the setters affecting `destination` are
9742 /// mutually exclusive.
9743 ///
9744 /// # Example
9745 /// ```ignore,no_run
9746 /// # use google_cloud_retail_v2::model::OutputConfig;
9747 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9748 /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9749 /// assert!(x.gcs_destination().is_some());
9750 /// assert!(x.bigquery_destination().is_none());
9751 /// ```
9752 pub fn set_gcs_destination<
9753 T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9754 >(
9755 mut self,
9756 v: T,
9757 ) -> Self {
9758 self.destination = std::option::Option::Some(
9759 crate::model::output_config::Destination::GcsDestination(v.into()),
9760 );
9761 self
9762 }
9763
9764 /// The value of [destination][crate::model::OutputConfig::destination]
9765 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9766 /// holds a different branch.
9767 pub fn bigquery_destination(
9768 &self,
9769 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9770 {
9771 #[allow(unreachable_patterns)]
9772 self.destination.as_ref().and_then(|v| match v {
9773 crate::model::output_config::Destination::BigqueryDestination(v) => {
9774 std::option::Option::Some(v)
9775 }
9776 _ => std::option::Option::None,
9777 })
9778 }
9779
9780 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9781 /// to hold a `BigqueryDestination`.
9782 ///
9783 /// Note that all the setters affecting `destination` are
9784 /// mutually exclusive.
9785 ///
9786 /// # Example
9787 /// ```ignore,no_run
9788 /// # use google_cloud_retail_v2::model::OutputConfig;
9789 /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9790 /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9791 /// assert!(x.bigquery_destination().is_some());
9792 /// assert!(x.gcs_destination().is_none());
9793 /// ```
9794 pub fn set_bigquery_destination<
9795 T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9796 >(
9797 mut self,
9798 v: T,
9799 ) -> Self {
9800 self.destination = std::option::Option::Some(
9801 crate::model::output_config::Destination::BigqueryDestination(v.into()),
9802 );
9803 self
9804 }
9805}
9806
9807impl wkt::message::Message for OutputConfig {
9808 fn typename() -> &'static str {
9809 "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9810 }
9811}
9812
9813/// Defines additional types related to [OutputConfig].
9814pub mod output_config {
9815 #[allow(unused_imports)]
9816 use super::*;
9817
9818 /// The Google Cloud Storage output destination configuration.
9819 #[derive(Clone, Default, PartialEq)]
9820 #[non_exhaustive]
9821 pub struct GcsDestination {
9822 /// Required. The output uri prefix for saving output data to json files.
9823 /// Some mapping examples are as follows:
9824 /// output_uri_prefix sample output(assuming the object is foo.json)
9825 /// ======================== =============================================
9826 /// gs://bucket/ gs://bucket/foo.json
9827 /// gs://bucket/folder/ gs://bucket/folder/foo.json
9828 /// gs://bucket/folder/item_ gs://bucket/folder/item_foo.json
9829 pub output_uri_prefix: std::string::String,
9830
9831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9832 }
9833
9834 impl GcsDestination {
9835 /// Creates a new default instance.
9836 pub fn new() -> Self {
9837 std::default::Default::default()
9838 }
9839
9840 /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9841 ///
9842 /// # Example
9843 /// ```ignore,no_run
9844 /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9845 /// let x = GcsDestination::new().set_output_uri_prefix("example");
9846 /// ```
9847 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9848 mut self,
9849 v: T,
9850 ) -> Self {
9851 self.output_uri_prefix = v.into();
9852 self
9853 }
9854 }
9855
9856 impl wkt::message::Message for GcsDestination {
9857 fn typename() -> &'static str {
9858 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9859 }
9860 }
9861
9862 /// The BigQuery output destination configuration.
9863 #[derive(Clone, Default, PartialEq)]
9864 #[non_exhaustive]
9865 pub struct BigQueryDestination {
9866 /// Required. The ID of a BigQuery Dataset.
9867 pub dataset_id: std::string::String,
9868
9869 /// Required. The prefix of exported BigQuery tables.
9870 pub table_id_prefix: std::string::String,
9871
9872 /// Required. Describes the table type. The following values are supported:
9873 ///
9874 /// * `table`: A BigQuery native table.
9875 /// * `view`: A virtual table defined by a SQL query.
9876 pub table_type: std::string::String,
9877
9878 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9879 }
9880
9881 impl BigQueryDestination {
9882 /// Creates a new default instance.
9883 pub fn new() -> Self {
9884 std::default::Default::default()
9885 }
9886
9887 /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9888 ///
9889 /// # Example
9890 /// ```ignore,no_run
9891 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9892 /// let x = BigQueryDestination::new().set_dataset_id("example");
9893 /// ```
9894 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9895 self.dataset_id = v.into();
9896 self
9897 }
9898
9899 /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9900 ///
9901 /// # Example
9902 /// ```ignore,no_run
9903 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9904 /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9905 /// ```
9906 pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9907 mut self,
9908 v: T,
9909 ) -> Self {
9910 self.table_id_prefix = v.into();
9911 self
9912 }
9913
9914 /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9915 ///
9916 /// # Example
9917 /// ```ignore,no_run
9918 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9919 /// let x = BigQueryDestination::new().set_table_type("example");
9920 /// ```
9921 pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9922 self.table_type = v.into();
9923 self
9924 }
9925 }
9926
9927 impl wkt::message::Message for BigQueryDestination {
9928 fn typename() -> &'static str {
9929 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9930 }
9931 }
9932
9933 /// The configuration of destination for holding output data.
9934 #[derive(Clone, Debug, PartialEq)]
9935 #[non_exhaustive]
9936 pub enum Destination {
9937 /// The Google Cloud Storage location where the output is to be written to.
9938 GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9939 /// The BigQuery location where the output is to be written to.
9940 BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9941 }
9942}
9943
9944/// Configuration of destination for Export related errors.
9945#[derive(Clone, Default, PartialEq)]
9946#[non_exhaustive]
9947pub struct ExportErrorsConfig {
9948 /// Required. Errors destination.
9949 pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
9950
9951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9952}
9953
9954impl ExportErrorsConfig {
9955 /// Creates a new default instance.
9956 pub fn new() -> Self {
9957 std::default::Default::default()
9958 }
9959
9960 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
9961 ///
9962 /// Note that all the setters affecting `destination` are mutually
9963 /// exclusive.
9964 ///
9965 /// # Example
9966 /// ```ignore,no_run
9967 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9968 /// use google_cloud_retail_v2::model::export_errors_config::Destination;
9969 /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
9970 /// ```
9971 pub fn set_destination<
9972 T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
9973 >(
9974 mut self,
9975 v: T,
9976 ) -> Self {
9977 self.destination = v.into();
9978 self
9979 }
9980
9981 /// The value of [destination][crate::model::ExportErrorsConfig::destination]
9982 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9983 /// holds a different branch.
9984 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
9985 #[allow(unreachable_patterns)]
9986 self.destination.as_ref().and_then(|v| match v {
9987 crate::model::export_errors_config::Destination::GcsPrefix(v) => {
9988 std::option::Option::Some(v)
9989 }
9990 _ => std::option::Option::None,
9991 })
9992 }
9993
9994 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
9995 /// to hold a `GcsPrefix`.
9996 ///
9997 /// Note that all the setters affecting `destination` are
9998 /// mutually exclusive.
9999 ///
10000 /// # Example
10001 /// ```ignore,no_run
10002 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
10003 /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
10004 /// assert!(x.gcs_prefix().is_some());
10005 /// ```
10006 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10007 self.destination = std::option::Option::Some(
10008 crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
10009 );
10010 self
10011 }
10012}
10013
10014impl wkt::message::Message for ExportErrorsConfig {
10015 fn typename() -> &'static str {
10016 "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
10017 }
10018}
10019
10020/// Defines additional types related to [ExportErrorsConfig].
10021pub mod export_errors_config {
10022 #[allow(unused_imports)]
10023 use super::*;
10024
10025 /// Required. Errors destination.
10026 #[derive(Clone, Debug, PartialEq)]
10027 #[non_exhaustive]
10028 pub enum Destination {
10029 /// Google Cloud Storage path for import errors. This must be an empty,
10030 /// existing Cloud Storage bucket. Export errors will be written to a file in
10031 /// this bucket, one per line, as a JSON-encoded
10032 /// `google.rpc.Status` message.
10033 GcsPrefix(std::string::String),
10034 }
10035}
10036
10037/// Request message for the `ExportAnalyticsMetrics` method.
10038#[derive(Clone, Default, PartialEq)]
10039#[non_exhaustive]
10040pub struct ExportAnalyticsMetricsRequest {
10041 /// Required. Full resource name of the parent catalog.
10042 /// Expected format: `projects/*/locations/*/catalogs/*`
10043 pub catalog: std::string::String,
10044
10045 /// Required. The output location of the data.
10046 pub output_config: std::option::Option<crate::model::OutputConfig>,
10047
10048 /// A filtering expression to specify restrictions on returned metrics.
10049 /// The expression is a sequence of terms. Each term applies a restriction to
10050 /// the returned metrics. Use this expression to restrict results to a
10051 /// specific time range.
10052 ///
10053 /// Currently we expect only one types of fields:
10054 ///
10055 /// * `timestamp`: This can be specified twice, once with a
10056 /// less than operator and once with a greater than operator. The
10057 /// `timestamp` restriction should result in one, contiguous, valid,
10058 /// `timestamp` range.
10059 ///
10060 /// Some examples of valid filters expressions:
10061 ///
10062 /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
10063 /// timestamp < "2012-04-23T18:30:43.511Z"`
10064 /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
10065 pub filter: std::string::String,
10066
10067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10068}
10069
10070impl ExportAnalyticsMetricsRequest {
10071 /// Creates a new default instance.
10072 pub fn new() -> Self {
10073 std::default::Default::default()
10074 }
10075
10076 /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
10077 ///
10078 /// # Example
10079 /// ```ignore,no_run
10080 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10081 /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10082 /// ```
10083 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10084 self.catalog = v.into();
10085 self
10086 }
10087
10088 /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10089 ///
10090 /// # Example
10091 /// ```ignore,no_run
10092 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10093 /// use google_cloud_retail_v2::model::OutputConfig;
10094 /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10095 /// ```
10096 pub fn set_output_config<T>(mut self, v: T) -> Self
10097 where
10098 T: std::convert::Into<crate::model::OutputConfig>,
10099 {
10100 self.output_config = std::option::Option::Some(v.into());
10101 self
10102 }
10103
10104 /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10105 ///
10106 /// # Example
10107 /// ```ignore,no_run
10108 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10109 /// use google_cloud_retail_v2::model::OutputConfig;
10110 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10111 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10112 /// ```
10113 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10114 where
10115 T: std::convert::Into<crate::model::OutputConfig>,
10116 {
10117 self.output_config = v.map(|x| x.into());
10118 self
10119 }
10120
10121 /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10126 /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10127 /// ```
10128 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10129 self.filter = v.into();
10130 self
10131 }
10132}
10133
10134impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10135 fn typename() -> &'static str {
10136 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10137 }
10138}
10139
10140/// Metadata related to the progress of the Export operation. This is
10141/// returned by the google.longrunning.Operation.metadata field.
10142#[derive(Clone, Default, PartialEq)]
10143#[non_exhaustive]
10144pub struct ExportMetadata {
10145 /// Operation create time.
10146 pub create_time: std::option::Option<wkt::Timestamp>,
10147
10148 /// Operation last update time. If the operation is done, this is also the
10149 /// finish time.
10150 pub update_time: std::option::Option<wkt::Timestamp>,
10151
10152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10153}
10154
10155impl ExportMetadata {
10156 /// Creates a new default instance.
10157 pub fn new() -> Self {
10158 std::default::Default::default()
10159 }
10160
10161 /// Sets the value of [create_time][crate::model::ExportMetadata::create_time].
10162 ///
10163 /// # Example
10164 /// ```ignore,no_run
10165 /// # use google_cloud_retail_v2::model::ExportMetadata;
10166 /// use wkt::Timestamp;
10167 /// let x = ExportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10168 /// ```
10169 pub fn set_create_time<T>(mut self, v: T) -> Self
10170 where
10171 T: std::convert::Into<wkt::Timestamp>,
10172 {
10173 self.create_time = std::option::Option::Some(v.into());
10174 self
10175 }
10176
10177 /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10178 ///
10179 /// # Example
10180 /// ```ignore,no_run
10181 /// # use google_cloud_retail_v2::model::ExportMetadata;
10182 /// use wkt::Timestamp;
10183 /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10184 /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10185 /// ```
10186 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10187 where
10188 T: std::convert::Into<wkt::Timestamp>,
10189 {
10190 self.create_time = v.map(|x| x.into());
10191 self
10192 }
10193
10194 /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10195 ///
10196 /// # Example
10197 /// ```ignore,no_run
10198 /// # use google_cloud_retail_v2::model::ExportMetadata;
10199 /// use wkt::Timestamp;
10200 /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10201 /// ```
10202 pub fn set_update_time<T>(mut self, v: T) -> Self
10203 where
10204 T: std::convert::Into<wkt::Timestamp>,
10205 {
10206 self.update_time = std::option::Option::Some(v.into());
10207 self
10208 }
10209
10210 /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10211 ///
10212 /// # Example
10213 /// ```ignore,no_run
10214 /// # use google_cloud_retail_v2::model::ExportMetadata;
10215 /// use wkt::Timestamp;
10216 /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10217 /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10218 /// ```
10219 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10220 where
10221 T: std::convert::Into<wkt::Timestamp>,
10222 {
10223 self.update_time = v.map(|x| x.into());
10224 self
10225 }
10226}
10227
10228impl wkt::message::Message for ExportMetadata {
10229 fn typename() -> &'static str {
10230 "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10231 }
10232}
10233
10234/// Response of the ExportAnalyticsMetricsRequest. If the long running
10235/// operation was successful, then this message is returned by the
10236/// google.longrunning.Operations.response field if the operation was successful.
10237#[derive(Clone, Default, PartialEq)]
10238#[non_exhaustive]
10239pub struct ExportAnalyticsMetricsResponse {
10240 /// A sample of errors encountered while processing the request.
10241 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
10242
10243 /// This field is never set.
10244 pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10245
10246 /// Output result indicating where the data were exported to.
10247 pub output_result: std::option::Option<crate::model::OutputResult>,
10248
10249 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10250}
10251
10252impl ExportAnalyticsMetricsResponse {
10253 /// Creates a new default instance.
10254 pub fn new() -> Self {
10255 std::default::Default::default()
10256 }
10257
10258 /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10259 ///
10260 /// # Example
10261 /// ```ignore,no_run
10262 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10263 /// use google_cloud_rpc::model::Status;
10264 /// let x = ExportAnalyticsMetricsResponse::new()
10265 /// .set_error_samples([
10266 /// Status::default()/* use setters */,
10267 /// Status::default()/* use (different) setters */,
10268 /// ]);
10269 /// ```
10270 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10271 where
10272 T: std::iter::IntoIterator<Item = V>,
10273 V: std::convert::Into<google_cloud_rpc::model::Status>,
10274 {
10275 use std::iter::Iterator;
10276 self.error_samples = v.into_iter().map(|i| i.into()).collect();
10277 self
10278 }
10279
10280 /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10281 ///
10282 /// # Example
10283 /// ```ignore,no_run
10284 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10285 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10286 /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10287 /// ```
10288 pub fn set_errors_config<T>(mut self, v: T) -> Self
10289 where
10290 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10291 {
10292 self.errors_config = std::option::Option::Some(v.into());
10293 self
10294 }
10295
10296 /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10297 ///
10298 /// # Example
10299 /// ```ignore,no_run
10300 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10301 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10302 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10303 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10304 /// ```
10305 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10306 where
10307 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10308 {
10309 self.errors_config = v.map(|x| x.into());
10310 self
10311 }
10312
10313 /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10314 ///
10315 /// # Example
10316 /// ```ignore,no_run
10317 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10318 /// use google_cloud_retail_v2::model::OutputResult;
10319 /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10320 /// ```
10321 pub fn set_output_result<T>(mut self, v: T) -> Self
10322 where
10323 T: std::convert::Into<crate::model::OutputResult>,
10324 {
10325 self.output_result = std::option::Option::Some(v.into());
10326 self
10327 }
10328
10329 /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10334 /// use google_cloud_retail_v2::model::OutputResult;
10335 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10336 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10337 /// ```
10338 pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10339 where
10340 T: std::convert::Into<crate::model::OutputResult>,
10341 {
10342 self.output_result = v.map(|x| x.into());
10343 self
10344 }
10345}
10346
10347impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10348 fn typename() -> &'static str {
10349 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10350 }
10351}
10352
10353/// Output result that stores the information about where the exported data is
10354/// stored.
10355#[derive(Clone, Default, PartialEq)]
10356#[non_exhaustive]
10357pub struct OutputResult {
10358 /// The BigQuery location where the result is stored.
10359 pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10360
10361 /// The Google Cloud Storage location where the result is stored.
10362 pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10363
10364 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10365}
10366
10367impl OutputResult {
10368 /// Creates a new default instance.
10369 pub fn new() -> Self {
10370 std::default::Default::default()
10371 }
10372
10373 /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10374 ///
10375 /// # Example
10376 /// ```ignore,no_run
10377 /// # use google_cloud_retail_v2::model::OutputResult;
10378 /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10379 /// let x = OutputResult::new()
10380 /// .set_bigquery_result([
10381 /// BigQueryOutputResult::default()/* use setters */,
10382 /// BigQueryOutputResult::default()/* use (different) setters */,
10383 /// ]);
10384 /// ```
10385 pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10386 where
10387 T: std::iter::IntoIterator<Item = V>,
10388 V: std::convert::Into<crate::model::BigQueryOutputResult>,
10389 {
10390 use std::iter::Iterator;
10391 self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10392 self
10393 }
10394
10395 /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10396 ///
10397 /// # Example
10398 /// ```ignore,no_run
10399 /// # use google_cloud_retail_v2::model::OutputResult;
10400 /// use google_cloud_retail_v2::model::GcsOutputResult;
10401 /// let x = OutputResult::new()
10402 /// .set_gcs_result([
10403 /// GcsOutputResult::default()/* use setters */,
10404 /// GcsOutputResult::default()/* use (different) setters */,
10405 /// ]);
10406 /// ```
10407 pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10408 where
10409 T: std::iter::IntoIterator<Item = V>,
10410 V: std::convert::Into<crate::model::GcsOutputResult>,
10411 {
10412 use std::iter::Iterator;
10413 self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10414 self
10415 }
10416}
10417
10418impl wkt::message::Message for OutputResult {
10419 fn typename() -> &'static str {
10420 "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10421 }
10422}
10423
10424/// A BigQuery output result.
10425#[derive(Clone, Default, PartialEq)]
10426#[non_exhaustive]
10427pub struct BigQueryOutputResult {
10428 /// The ID of a BigQuery Dataset.
10429 pub dataset_id: std::string::String,
10430
10431 /// The ID of a BigQuery Table.
10432 pub table_id: std::string::String,
10433
10434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10435}
10436
10437impl BigQueryOutputResult {
10438 /// Creates a new default instance.
10439 pub fn new() -> Self {
10440 std::default::Default::default()
10441 }
10442
10443 /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10444 ///
10445 /// # Example
10446 /// ```ignore,no_run
10447 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10448 /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10449 /// ```
10450 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10451 self.dataset_id = v.into();
10452 self
10453 }
10454
10455 /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10456 ///
10457 /// # Example
10458 /// ```ignore,no_run
10459 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10460 /// let x = BigQueryOutputResult::new().set_table_id("example");
10461 /// ```
10462 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10463 self.table_id = v.into();
10464 self
10465 }
10466}
10467
10468impl wkt::message::Message for BigQueryOutputResult {
10469 fn typename() -> &'static str {
10470 "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10471 }
10472}
10473
10474/// A Gcs output result.
10475#[derive(Clone, Default, PartialEq)]
10476#[non_exhaustive]
10477pub struct GcsOutputResult {
10478 /// The uri of Gcs output
10479 pub output_uri: std::string::String,
10480
10481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10482}
10483
10484impl GcsOutputResult {
10485 /// Creates a new default instance.
10486 pub fn new() -> Self {
10487 std::default::Default::default()
10488 }
10489
10490 /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10491 ///
10492 /// # Example
10493 /// ```ignore,no_run
10494 /// # use google_cloud_retail_v2::model::GcsOutputResult;
10495 /// let x = GcsOutputResult::new().set_output_uri("example");
10496 /// ```
10497 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10498 self.output_uri = v.into();
10499 self
10500 }
10501}
10502
10503impl wkt::message::Message for GcsOutputResult {
10504 fn typename() -> &'static str {
10505 "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10506 }
10507}
10508
10509/// Configuration for overall generative question feature state.
10510#[derive(Clone, Default, PartialEq)]
10511#[non_exhaustive]
10512pub struct GenerativeQuestionsFeatureConfig {
10513 /// Required. Resource name of the affected catalog.
10514 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10515 pub catalog: std::string::String,
10516
10517 /// Optional. Determines whether questions will be used at serving time.
10518 /// Note: This feature cannot be enabled until initial data requirements are
10519 /// satisfied.
10520 pub feature_enabled: bool,
10521
10522 /// Optional. Minimum number of products in the response to trigger follow-up
10523 /// questions. Value must be 0 or positive.
10524 pub minimum_products: i32,
10525
10526 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10527}
10528
10529impl GenerativeQuestionsFeatureConfig {
10530 /// Creates a new default instance.
10531 pub fn new() -> Self {
10532 std::default::Default::default()
10533 }
10534
10535 /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10536 ///
10537 /// # Example
10538 /// ```ignore,no_run
10539 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10540 /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10541 /// ```
10542 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10543 self.catalog = v.into();
10544 self
10545 }
10546
10547 /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10548 ///
10549 /// # Example
10550 /// ```ignore,no_run
10551 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10552 /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10553 /// ```
10554 pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10555 self.feature_enabled = v.into();
10556 self
10557 }
10558
10559 /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10560 ///
10561 /// # Example
10562 /// ```ignore,no_run
10563 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10564 /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10565 /// ```
10566 pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10567 self.minimum_products = v.into();
10568 self
10569 }
10570}
10571
10572impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10573 fn typename() -> &'static str {
10574 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10575 }
10576}
10577
10578/// Configuration for a single generated question.
10579#[derive(Clone, Default, PartialEq)]
10580#[non_exhaustive]
10581pub struct GenerativeQuestionConfig {
10582 /// Required. Resource name of the catalog.
10583 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10584 pub catalog: std::string::String,
10585
10586 /// Required. The facet to which the question is associated.
10587 pub facet: std::string::String,
10588
10589 /// Output only. The LLM generated question.
10590 pub generated_question: std::string::String,
10591
10592 /// Optional. The question that will be used at serving time.
10593 /// Question can have a max length of 300 bytes.
10594 /// When not populated, generated_question should be used.
10595 pub final_question: std::string::String,
10596
10597 /// Output only. Values that can be used to answer the question.
10598 pub example_values: std::vec::Vec<std::string::String>,
10599
10600 /// Output only. The ratio of how often a question was asked.
10601 pub frequency: f32,
10602
10603 /// Optional. Whether the question is asked at serving time.
10604 pub allowed_in_conversation: bool,
10605
10606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10607}
10608
10609impl GenerativeQuestionConfig {
10610 /// Creates a new default instance.
10611 pub fn new() -> Self {
10612 std::default::Default::default()
10613 }
10614
10615 /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10620 /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10621 /// ```
10622 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10623 self.catalog = v.into();
10624 self
10625 }
10626
10627 /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10628 ///
10629 /// # Example
10630 /// ```ignore,no_run
10631 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10632 /// let x = GenerativeQuestionConfig::new().set_facet("example");
10633 /// ```
10634 pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10635 self.facet = v.into();
10636 self
10637 }
10638
10639 /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10640 ///
10641 /// # Example
10642 /// ```ignore,no_run
10643 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10644 /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10645 /// ```
10646 pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10647 mut self,
10648 v: T,
10649 ) -> Self {
10650 self.generated_question = v.into();
10651 self
10652 }
10653
10654 /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10655 ///
10656 /// # Example
10657 /// ```ignore,no_run
10658 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10659 /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10660 /// ```
10661 pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10662 self.final_question = v.into();
10663 self
10664 }
10665
10666 /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10667 ///
10668 /// # Example
10669 /// ```ignore,no_run
10670 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10671 /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10672 /// ```
10673 pub fn set_example_values<T, V>(mut self, v: T) -> Self
10674 where
10675 T: std::iter::IntoIterator<Item = V>,
10676 V: std::convert::Into<std::string::String>,
10677 {
10678 use std::iter::Iterator;
10679 self.example_values = v.into_iter().map(|i| i.into()).collect();
10680 self
10681 }
10682
10683 /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10684 ///
10685 /// # Example
10686 /// ```ignore,no_run
10687 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10688 /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10689 /// ```
10690 pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10691 self.frequency = v.into();
10692 self
10693 }
10694
10695 /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10696 ///
10697 /// # Example
10698 /// ```ignore,no_run
10699 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10700 /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10701 /// ```
10702 pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10703 self.allowed_in_conversation = v.into();
10704 self
10705 }
10706}
10707
10708impl wkt::message::Message for GenerativeQuestionConfig {
10709 fn typename() -> &'static str {
10710 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10711 }
10712}
10713
10714/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10715#[derive(Clone, Default, PartialEq)]
10716#[non_exhaustive]
10717pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10718 /// Required. The configuration managing the feature state.
10719 pub generative_questions_feature_config:
10720 std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10721
10722 /// Optional. Indicates which fields in the provided
10723 /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10724 /// to update. If not set or empty, all supported fields are updated.
10725 ///
10726 /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10727 pub update_mask: std::option::Option<wkt::FieldMask>,
10728
10729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10730}
10731
10732impl UpdateGenerativeQuestionsFeatureConfigRequest {
10733 /// Creates a new default instance.
10734 pub fn new() -> Self {
10735 std::default::Default::default()
10736 }
10737
10738 /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10739 ///
10740 /// # Example
10741 /// ```ignore,no_run
10742 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10743 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10744 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10745 /// ```
10746 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10747 where
10748 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10749 {
10750 self.generative_questions_feature_config = std::option::Option::Some(v.into());
10751 self
10752 }
10753
10754 /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10755 ///
10756 /// # Example
10757 /// ```ignore,no_run
10758 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10759 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10760 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10761 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10762 /// ```
10763 pub fn set_or_clear_generative_questions_feature_config<T>(
10764 mut self,
10765 v: std::option::Option<T>,
10766 ) -> Self
10767 where
10768 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10769 {
10770 self.generative_questions_feature_config = v.map(|x| x.into());
10771 self
10772 }
10773
10774 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10775 ///
10776 /// # Example
10777 /// ```ignore,no_run
10778 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10779 /// use wkt::FieldMask;
10780 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10781 /// ```
10782 pub fn set_update_mask<T>(mut self, v: T) -> Self
10783 where
10784 T: std::convert::Into<wkt::FieldMask>,
10785 {
10786 self.update_mask = std::option::Option::Some(v.into());
10787 self
10788 }
10789
10790 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10791 ///
10792 /// # Example
10793 /// ```ignore,no_run
10794 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10795 /// use wkt::FieldMask;
10796 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10797 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10798 /// ```
10799 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10800 where
10801 T: std::convert::Into<wkt::FieldMask>,
10802 {
10803 self.update_mask = v.map(|x| x.into());
10804 self
10805 }
10806}
10807
10808impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10809 fn typename() -> &'static str {
10810 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10811 }
10812}
10813
10814/// Request for GetGenerativeQuestionsFeatureConfig method.
10815#[derive(Clone, Default, PartialEq)]
10816#[non_exhaustive]
10817pub struct GetGenerativeQuestionsFeatureConfigRequest {
10818 /// Required. Resource name of the parent catalog.
10819 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10820 pub catalog: std::string::String,
10821
10822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10823}
10824
10825impl GetGenerativeQuestionsFeatureConfigRequest {
10826 /// Creates a new default instance.
10827 pub fn new() -> Self {
10828 std::default::Default::default()
10829 }
10830
10831 /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10832 ///
10833 /// # Example
10834 /// ```ignore,no_run
10835 /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10836 /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog("example");
10837 /// ```
10838 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10839 self.catalog = v.into();
10840 self
10841 }
10842}
10843
10844impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10845 fn typename() -> &'static str {
10846 "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10847 }
10848}
10849
10850/// Request for ListQuestions method.
10851#[derive(Clone, Default, PartialEq)]
10852#[non_exhaustive]
10853pub struct ListGenerativeQuestionConfigsRequest {
10854 /// Required. Resource name of the parent catalog.
10855 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10856 pub parent: std::string::String,
10857
10858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10859}
10860
10861impl ListGenerativeQuestionConfigsRequest {
10862 /// Creates a new default instance.
10863 pub fn new() -> Self {
10864 std::default::Default::default()
10865 }
10866
10867 /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10868 ///
10869 /// # Example
10870 /// ```ignore,no_run
10871 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10872 /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent("example");
10873 /// ```
10874 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10875 self.parent = v.into();
10876 self
10877 }
10878}
10879
10880impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10881 fn typename() -> &'static str {
10882 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10883 }
10884}
10885
10886/// Response for ListQuestions method.
10887#[derive(Clone, Default, PartialEq)]
10888#[non_exhaustive]
10889pub struct ListGenerativeQuestionConfigsResponse {
10890 /// All the questions for a given catalog.
10891 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10892
10893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10894}
10895
10896impl ListGenerativeQuestionConfigsResponse {
10897 /// Creates a new default instance.
10898 pub fn new() -> Self {
10899 std::default::Default::default()
10900 }
10901
10902 /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10903 ///
10904 /// # Example
10905 /// ```ignore,no_run
10906 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10907 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10908 /// let x = ListGenerativeQuestionConfigsResponse::new()
10909 /// .set_generative_question_configs([
10910 /// GenerativeQuestionConfig::default()/* use setters */,
10911 /// GenerativeQuestionConfig::default()/* use (different) setters */,
10912 /// ]);
10913 /// ```
10914 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10915 where
10916 T: std::iter::IntoIterator<Item = V>,
10917 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10918 {
10919 use std::iter::Iterator;
10920 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10921 self
10922 }
10923}
10924
10925impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10926 fn typename() -> &'static str {
10927 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10928 }
10929}
10930
10931/// Request for UpdateGenerativeQuestionConfig method.
10932#[derive(Clone, Default, PartialEq)]
10933#[non_exhaustive]
10934pub struct UpdateGenerativeQuestionConfigRequest {
10935 /// Required. The question to update.
10936 pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10937
10938 /// Optional. Indicates which fields in the provided
10939 /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10940 /// to update. The following are NOT supported:
10941 ///
10942 /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
10943 ///
10944 /// If not set or empty, all supported fields are updated.
10945 ///
10946 /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
10947 /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
10948 pub update_mask: std::option::Option<wkt::FieldMask>,
10949
10950 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10951}
10952
10953impl UpdateGenerativeQuestionConfigRequest {
10954 /// Creates a new default instance.
10955 pub fn new() -> Self {
10956 std::default::Default::default()
10957 }
10958
10959 /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10960 ///
10961 /// # Example
10962 /// ```ignore,no_run
10963 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10964 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10965 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
10966 /// ```
10967 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
10968 where
10969 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10970 {
10971 self.generative_question_config = std::option::Option::Some(v.into());
10972 self
10973 }
10974
10975 /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10976 ///
10977 /// # Example
10978 /// ```ignore,no_run
10979 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10980 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10981 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
10982 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
10983 /// ```
10984 pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
10985 where
10986 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10987 {
10988 self.generative_question_config = v.map(|x| x.into());
10989 self
10990 }
10991
10992 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10993 ///
10994 /// # Example
10995 /// ```ignore,no_run
10996 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10997 /// use wkt::FieldMask;
10998 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10999 /// ```
11000 pub fn set_update_mask<T>(mut self, v: T) -> Self
11001 where
11002 T: std::convert::Into<wkt::FieldMask>,
11003 {
11004 self.update_mask = std::option::Option::Some(v.into());
11005 self
11006 }
11007
11008 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
11009 ///
11010 /// # Example
11011 /// ```ignore,no_run
11012 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11013 /// use wkt::FieldMask;
11014 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11015 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11016 /// ```
11017 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11018 where
11019 T: std::convert::Into<wkt::FieldMask>,
11020 {
11021 self.update_mask = v.map(|x| x.into());
11022 self
11023 }
11024}
11025
11026impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
11027 fn typename() -> &'static str {
11028 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
11029 }
11030}
11031
11032/// Request for BatchUpdateGenerativeQuestionConfig method.
11033#[derive(Clone, Default, PartialEq)]
11034#[non_exhaustive]
11035pub struct BatchUpdateGenerativeQuestionConfigsRequest {
11036 /// Optional. Resource name of the parent catalog.
11037 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
11038 pub parent: std::string::String,
11039
11040 /// Required. The updates question configs.
11041 pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
11042
11043 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11044}
11045
11046impl BatchUpdateGenerativeQuestionConfigsRequest {
11047 /// Creates a new default instance.
11048 pub fn new() -> Self {
11049 std::default::Default::default()
11050 }
11051
11052 /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
11053 ///
11054 /// # Example
11055 /// ```ignore,no_run
11056 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11057 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent("example");
11058 /// ```
11059 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11060 self.parent = v.into();
11061 self
11062 }
11063
11064 /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
11065 ///
11066 /// # Example
11067 /// ```ignore,no_run
11068 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11069 /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11070 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
11071 /// .set_requests([
11072 /// UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
11073 /// UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
11074 /// ]);
11075 /// ```
11076 pub fn set_requests<T, V>(mut self, v: T) -> Self
11077 where
11078 T: std::iter::IntoIterator<Item = V>,
11079 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
11080 {
11081 use std::iter::Iterator;
11082 self.requests = v.into_iter().map(|i| i.into()).collect();
11083 self
11084 }
11085}
11086
11087impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
11088 fn typename() -> &'static str {
11089 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
11090 }
11091}
11092
11093/// Aggregated response for UpdateGenerativeQuestionConfig method.
11094#[derive(Clone, Default, PartialEq)]
11095#[non_exhaustive]
11096pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11097 /// Optional. The updates question configs.
11098 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11099
11100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11101}
11102
11103impl BatchUpdateGenerativeQuestionConfigsResponse {
11104 /// Creates a new default instance.
11105 pub fn new() -> Self {
11106 std::default::Default::default()
11107 }
11108
11109 /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11110 ///
11111 /// # Example
11112 /// ```ignore,no_run
11113 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11114 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11115 /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11116 /// .set_generative_question_configs([
11117 /// GenerativeQuestionConfig::default()/* use setters */,
11118 /// GenerativeQuestionConfig::default()/* use (different) setters */,
11119 /// ]);
11120 /// ```
11121 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11122 where
11123 T: std::iter::IntoIterator<Item = V>,
11124 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11125 {
11126 use std::iter::Iterator;
11127 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11128 self
11129 }
11130}
11131
11132impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11133 fn typename() -> &'static str {
11134 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11135 }
11136}
11137
11138/// Google Cloud Storage location for input content.
11139#[derive(Clone, Default, PartialEq)]
11140#[non_exhaustive]
11141pub struct GcsSource {
11142 /// Required. Google Cloud Storage URIs to input files. URI can be up to
11143 /// 2000 characters long. URIs can match the full object path (for example,
11144 /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11145 /// files, such as `gs://bucket/directory/*.json`. A request can
11146 /// contain at most 100 files, and each file can be up to 2 GB. See
11147 /// [Importing product
11148 /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11149 /// for the expected file format and setup instructions.
11150 pub input_uris: std::vec::Vec<std::string::String>,
11151
11152 /// The schema to use when parsing the data from the source.
11153 ///
11154 /// Supported values for product imports:
11155 ///
11156 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11157 /// per line. Each product must
11158 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11159 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11160 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11161 ///
11162 /// Supported values for user events imports:
11163 ///
11164 /// * `user_event` (default): One JSON
11165 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11166 /// * `user_event_ga360`: Using
11167 /// <https://support.google.com/analytics/answer/3437719>.
11168 ///
11169 /// Supported values for control imports:
11170 ///
11171 /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11172 /// per line.
11173 ///
11174 /// Supported values for catalog attribute imports:
11175 ///
11176 /// * `catalog_attribute` (default): One CSV
11177 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11178 ///
11179 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11180 /// [google.cloud.retail.v2.Control]: crate::model::Control
11181 /// [google.cloud.retail.v2.Product]: crate::model::Product
11182 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11183 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11184 pub data_schema: std::string::String,
11185
11186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11187}
11188
11189impl GcsSource {
11190 /// Creates a new default instance.
11191 pub fn new() -> Self {
11192 std::default::Default::default()
11193 }
11194
11195 /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11196 ///
11197 /// # Example
11198 /// ```ignore,no_run
11199 /// # use google_cloud_retail_v2::model::GcsSource;
11200 /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11201 /// ```
11202 pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11203 where
11204 T: std::iter::IntoIterator<Item = V>,
11205 V: std::convert::Into<std::string::String>,
11206 {
11207 use std::iter::Iterator;
11208 self.input_uris = v.into_iter().map(|i| i.into()).collect();
11209 self
11210 }
11211
11212 /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11213 ///
11214 /// # Example
11215 /// ```ignore,no_run
11216 /// # use google_cloud_retail_v2::model::GcsSource;
11217 /// let x = GcsSource::new().set_data_schema("example");
11218 /// ```
11219 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11220 self.data_schema = v.into();
11221 self
11222 }
11223}
11224
11225impl wkt::message::Message for GcsSource {
11226 fn typename() -> &'static str {
11227 "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11228 }
11229}
11230
11231/// BigQuery source import data from.
11232#[derive(Clone, Default, PartialEq)]
11233#[non_exhaustive]
11234pub struct BigQuerySource {
11235 /// The project ID (can be project # or ID) that the BigQuery source is in with
11236 /// a length limit of 128 characters. If not specified, inherits the project
11237 /// ID from the parent request.
11238 pub project_id: std::string::String,
11239
11240 /// Required. The BigQuery data set to copy the data from with a length limit
11241 /// of 1,024 characters.
11242 pub dataset_id: std::string::String,
11243
11244 /// Required. The BigQuery table to copy the data from with a length limit of
11245 /// 1,024 characters.
11246 pub table_id: std::string::String,
11247
11248 /// Intermediate Cloud Storage directory used for the import with a length
11249 /// limit of 2,000 characters. Can be specified if one wants to have the
11250 /// BigQuery export to a specific Cloud Storage directory.
11251 pub gcs_staging_dir: std::string::String,
11252
11253 /// The schema to use when parsing the data from the source.
11254 ///
11255 /// Supported values for product imports:
11256 ///
11257 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11258 /// per line. Each product must
11259 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11260 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11261 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11262 ///
11263 /// Supported values for user events imports:
11264 ///
11265 /// * `user_event` (default): One JSON
11266 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11267 /// * `user_event_ga360`:
11268 /// The schema is available here:
11269 /// <https://support.google.com/analytics/answer/3437719>.
11270 /// * `user_event_ga4`:
11271 /// The schema is available here:
11272 /// <https://support.google.com/analytics/answer/7029846>.
11273 ///
11274 /// Supported values for autocomplete imports:
11275 ///
11276 /// * `suggestions` (default): One JSON completion suggestion per line.
11277 /// * `denylist`: One JSON deny suggestion per line.
11278 /// * `allowlist`: One JSON allow suggestion per line.
11279 ///
11280 /// [google.cloud.retail.v2.Product]: crate::model::Product
11281 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11282 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11283 pub data_schema: std::string::String,
11284
11285 /// BigQuery table partition info. Leave this empty if the BigQuery table
11286 /// is not partitioned.
11287 pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11288
11289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11290}
11291
11292impl BigQuerySource {
11293 /// Creates a new default instance.
11294 pub fn new() -> Self {
11295 std::default::Default::default()
11296 }
11297
11298 /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11299 ///
11300 /// # Example
11301 /// ```ignore,no_run
11302 /// # use google_cloud_retail_v2::model::BigQuerySource;
11303 /// let x = BigQuerySource::new().set_project_id("example");
11304 /// ```
11305 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11306 self.project_id = v.into();
11307 self
11308 }
11309
11310 /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11311 ///
11312 /// # Example
11313 /// ```ignore,no_run
11314 /// # use google_cloud_retail_v2::model::BigQuerySource;
11315 /// let x = BigQuerySource::new().set_dataset_id("example");
11316 /// ```
11317 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11318 self.dataset_id = v.into();
11319 self
11320 }
11321
11322 /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11323 ///
11324 /// # Example
11325 /// ```ignore,no_run
11326 /// # use google_cloud_retail_v2::model::BigQuerySource;
11327 /// let x = BigQuerySource::new().set_table_id("example");
11328 /// ```
11329 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11330 self.table_id = v.into();
11331 self
11332 }
11333
11334 /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11335 ///
11336 /// # Example
11337 /// ```ignore,no_run
11338 /// # use google_cloud_retail_v2::model::BigQuerySource;
11339 /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11340 /// ```
11341 pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11342 self.gcs_staging_dir = v.into();
11343 self
11344 }
11345
11346 /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11347 ///
11348 /// # Example
11349 /// ```ignore,no_run
11350 /// # use google_cloud_retail_v2::model::BigQuerySource;
11351 /// let x = BigQuerySource::new().set_data_schema("example");
11352 /// ```
11353 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11354 self.data_schema = v.into();
11355 self
11356 }
11357
11358 /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11359 ///
11360 /// Note that all the setters affecting `partition` are mutually
11361 /// exclusive.
11362 ///
11363 /// # Example
11364 /// ```ignore,no_run
11365 /// # use google_cloud_retail_v2::model::BigQuerySource;
11366 /// use google_cloud_type::model::Date;
11367 /// let x = BigQuerySource::new().set_partition(Some(
11368 /// google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11369 /// ```
11370 pub fn set_partition<
11371 T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11372 >(
11373 mut self,
11374 v: T,
11375 ) -> Self {
11376 self.partition = v.into();
11377 self
11378 }
11379
11380 /// The value of [partition][crate::model::BigQuerySource::partition]
11381 /// if it holds a `PartitionDate`, `None` if the field is not set or
11382 /// holds a different branch.
11383 pub fn partition_date(
11384 &self,
11385 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
11386 #[allow(unreachable_patterns)]
11387 self.partition.as_ref().and_then(|v| match v {
11388 crate::model::big_query_source::Partition::PartitionDate(v) => {
11389 std::option::Option::Some(v)
11390 }
11391 _ => std::option::Option::None,
11392 })
11393 }
11394
11395 /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11396 /// to hold a `PartitionDate`.
11397 ///
11398 /// Note that all the setters affecting `partition` are
11399 /// mutually exclusive.
11400 ///
11401 /// # Example
11402 /// ```ignore,no_run
11403 /// # use google_cloud_retail_v2::model::BigQuerySource;
11404 /// use google_cloud_type::model::Date;
11405 /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11406 /// assert!(x.partition_date().is_some());
11407 /// ```
11408 pub fn set_partition_date<
11409 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
11410 >(
11411 mut self,
11412 v: T,
11413 ) -> Self {
11414 self.partition = std::option::Option::Some(
11415 crate::model::big_query_source::Partition::PartitionDate(v.into()),
11416 );
11417 self
11418 }
11419}
11420
11421impl wkt::message::Message for BigQuerySource {
11422 fn typename() -> &'static str {
11423 "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11424 }
11425}
11426
11427/// Defines additional types related to [BigQuerySource].
11428pub mod big_query_source {
11429 #[allow(unused_imports)]
11430 use super::*;
11431
11432 /// BigQuery table partition info. Leave this empty if the BigQuery table
11433 /// is not partitioned.
11434 #[derive(Clone, Debug, PartialEq)]
11435 #[non_exhaustive]
11436 pub enum Partition {
11437 /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11438 PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
11439 }
11440}
11441
11442/// The inline source for the input config for ImportProducts method.
11443#[derive(Clone, Default, PartialEq)]
11444#[non_exhaustive]
11445pub struct ProductInlineSource {
11446 /// Required. A list of products to update/create. Each product must have a
11447 /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11448 /// 100 items.
11449 ///
11450 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11451 pub products: std::vec::Vec<crate::model::Product>,
11452
11453 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11454}
11455
11456impl ProductInlineSource {
11457 /// Creates a new default instance.
11458 pub fn new() -> Self {
11459 std::default::Default::default()
11460 }
11461
11462 /// Sets the value of [products][crate::model::ProductInlineSource::products].
11463 ///
11464 /// # Example
11465 /// ```ignore,no_run
11466 /// # use google_cloud_retail_v2::model::ProductInlineSource;
11467 /// use google_cloud_retail_v2::model::Product;
11468 /// let x = ProductInlineSource::new()
11469 /// .set_products([
11470 /// Product::default()/* use setters */,
11471 /// Product::default()/* use (different) setters */,
11472 /// ]);
11473 /// ```
11474 pub fn set_products<T, V>(mut self, v: T) -> Self
11475 where
11476 T: std::iter::IntoIterator<Item = V>,
11477 V: std::convert::Into<crate::model::Product>,
11478 {
11479 use std::iter::Iterator;
11480 self.products = v.into_iter().map(|i| i.into()).collect();
11481 self
11482 }
11483}
11484
11485impl wkt::message::Message for ProductInlineSource {
11486 fn typename() -> &'static str {
11487 "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11488 }
11489}
11490
11491/// The inline source for the input config for ImportUserEvents method.
11492#[derive(Clone, Default, PartialEq)]
11493#[non_exhaustive]
11494pub struct UserEventInlineSource {
11495 /// Required. A list of user events to import. Recommended max of 10k items.
11496 pub user_events: std::vec::Vec<crate::model::UserEvent>,
11497
11498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11499}
11500
11501impl UserEventInlineSource {
11502 /// Creates a new default instance.
11503 pub fn new() -> Self {
11504 std::default::Default::default()
11505 }
11506
11507 /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11508 ///
11509 /// # Example
11510 /// ```ignore,no_run
11511 /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11512 /// use google_cloud_retail_v2::model::UserEvent;
11513 /// let x = UserEventInlineSource::new()
11514 /// .set_user_events([
11515 /// UserEvent::default()/* use setters */,
11516 /// UserEvent::default()/* use (different) setters */,
11517 /// ]);
11518 /// ```
11519 pub fn set_user_events<T, V>(mut self, v: T) -> Self
11520 where
11521 T: std::iter::IntoIterator<Item = V>,
11522 V: std::convert::Into<crate::model::UserEvent>,
11523 {
11524 use std::iter::Iterator;
11525 self.user_events = v.into_iter().map(|i| i.into()).collect();
11526 self
11527 }
11528}
11529
11530impl wkt::message::Message for UserEventInlineSource {
11531 fn typename() -> &'static str {
11532 "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11533 }
11534}
11535
11536/// Configuration of destination for Import related errors.
11537#[derive(Clone, Default, PartialEq)]
11538#[non_exhaustive]
11539pub struct ImportErrorsConfig {
11540 /// Required. Errors destination.
11541 pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11542
11543 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11544}
11545
11546impl ImportErrorsConfig {
11547 /// Creates a new default instance.
11548 pub fn new() -> Self {
11549 std::default::Default::default()
11550 }
11551
11552 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11553 ///
11554 /// Note that all the setters affecting `destination` are mutually
11555 /// exclusive.
11556 ///
11557 /// # Example
11558 /// ```ignore,no_run
11559 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11560 /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11561 /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11562 /// ```
11563 pub fn set_destination<
11564 T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11565 >(
11566 mut self,
11567 v: T,
11568 ) -> Self {
11569 self.destination = v.into();
11570 self
11571 }
11572
11573 /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11574 /// if it holds a `GcsPrefix`, `None` if the field is not set or
11575 /// holds a different branch.
11576 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11577 #[allow(unreachable_patterns)]
11578 self.destination.as_ref().and_then(|v| match v {
11579 crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11580 std::option::Option::Some(v)
11581 }
11582 _ => std::option::Option::None,
11583 })
11584 }
11585
11586 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11587 /// to hold a `GcsPrefix`.
11588 ///
11589 /// Note that all the setters affecting `destination` are
11590 /// mutually exclusive.
11591 ///
11592 /// # Example
11593 /// ```ignore,no_run
11594 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11595 /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11596 /// assert!(x.gcs_prefix().is_some());
11597 /// ```
11598 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11599 self.destination = std::option::Option::Some(
11600 crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11601 );
11602 self
11603 }
11604}
11605
11606impl wkt::message::Message for ImportErrorsConfig {
11607 fn typename() -> &'static str {
11608 "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11609 }
11610}
11611
11612/// Defines additional types related to [ImportErrorsConfig].
11613pub mod import_errors_config {
11614 #[allow(unused_imports)]
11615 use super::*;
11616
11617 /// Required. Errors destination.
11618 #[derive(Clone, Debug, PartialEq)]
11619 #[non_exhaustive]
11620 pub enum Destination {
11621 /// Google Cloud Storage prefix for import errors. This must be an empty,
11622 /// existing Cloud Storage directory. Import errors are written to
11623 /// sharded files in this directory, one per line, as a JSON-encoded
11624 /// `google.rpc.Status` message.
11625 GcsPrefix(std::string::String),
11626 }
11627}
11628
11629/// Request message for Import methods.
11630#[derive(Clone, Default, PartialEq)]
11631#[non_exhaustive]
11632pub struct ImportProductsRequest {
11633 /// Required.
11634 /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11635 ///
11636 /// If no updateMask is specified, requires products.create permission.
11637 /// If updateMask is specified, requires products.update permission.
11638 pub parent: std::string::String,
11639
11640 /// Deprecated. This field has no effect.
11641 #[deprecated]
11642 pub request_id: std::string::String,
11643
11644 /// Required. The desired input location of the data.
11645 pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11646
11647 /// The desired location of errors incurred during the Import.
11648 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11649
11650 /// Indicates which fields in the provided imported `products` to update. If
11651 /// not set, all fields are updated. If provided, only the existing product
11652 /// fields are updated. Missing products will not be created.
11653 pub update_mask: std::option::Option<wkt::FieldMask>,
11654
11655 /// The mode of reconciliation between existing products and the products to be
11656 /// imported. Defaults to
11657 /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11658 ///
11659 /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11660 pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11661
11662 /// Full Pub/Sub topic name for receiving notification. If this field is set,
11663 /// when the import is finished, a notification is sent to
11664 /// specified Pub/Sub topic. The message data is JSON string of a
11665 /// [Operation][google.longrunning.Operation].
11666 ///
11667 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11668 /// to be within the same project as
11669 /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11670 /// Make sure that both
11671 /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11672 /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11673 /// have the `pubsub.topics.publish` IAM permission on the topic.
11674 ///
11675 /// Only supported when
11676 /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11677 /// is set to `FULL`.
11678 ///
11679 /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11680 /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11681 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
11682 pub notification_pubsub_topic: std::string::String,
11683
11684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11685}
11686
11687impl ImportProductsRequest {
11688 /// Creates a new default instance.
11689 pub fn new() -> Self {
11690 std::default::Default::default()
11691 }
11692
11693 /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11694 ///
11695 /// # Example
11696 /// ```ignore,no_run
11697 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11698 /// let x = ImportProductsRequest::new().set_parent("example");
11699 /// ```
11700 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11701 self.parent = v.into();
11702 self
11703 }
11704
11705 /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11706 ///
11707 /// # Example
11708 /// ```ignore,no_run
11709 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11710 /// let x = ImportProductsRequest::new().set_request_id("example");
11711 /// ```
11712 #[deprecated]
11713 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11714 self.request_id = v.into();
11715 self
11716 }
11717
11718 /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11719 ///
11720 /// # Example
11721 /// ```ignore,no_run
11722 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11723 /// use google_cloud_retail_v2::model::ProductInputConfig;
11724 /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11725 /// ```
11726 pub fn set_input_config<T>(mut self, v: T) -> Self
11727 where
11728 T: std::convert::Into<crate::model::ProductInputConfig>,
11729 {
11730 self.input_config = std::option::Option::Some(v.into());
11731 self
11732 }
11733
11734 /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11735 ///
11736 /// # Example
11737 /// ```ignore,no_run
11738 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11739 /// use google_cloud_retail_v2::model::ProductInputConfig;
11740 /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11741 /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11742 /// ```
11743 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11744 where
11745 T: std::convert::Into<crate::model::ProductInputConfig>,
11746 {
11747 self.input_config = v.map(|x| x.into());
11748 self
11749 }
11750
11751 /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11752 ///
11753 /// # Example
11754 /// ```ignore,no_run
11755 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11756 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11757 /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11758 /// ```
11759 pub fn set_errors_config<T>(mut self, v: T) -> Self
11760 where
11761 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11762 {
11763 self.errors_config = std::option::Option::Some(v.into());
11764 self
11765 }
11766
11767 /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11768 ///
11769 /// # Example
11770 /// ```ignore,no_run
11771 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11772 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11773 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11774 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11775 /// ```
11776 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11777 where
11778 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11779 {
11780 self.errors_config = v.map(|x| x.into());
11781 self
11782 }
11783
11784 /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11785 ///
11786 /// # Example
11787 /// ```ignore,no_run
11788 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11789 /// use wkt::FieldMask;
11790 /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11791 /// ```
11792 pub fn set_update_mask<T>(mut self, v: T) -> Self
11793 where
11794 T: std::convert::Into<wkt::FieldMask>,
11795 {
11796 self.update_mask = std::option::Option::Some(v.into());
11797 self
11798 }
11799
11800 /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11801 ///
11802 /// # Example
11803 /// ```ignore,no_run
11804 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11805 /// use wkt::FieldMask;
11806 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11807 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11808 /// ```
11809 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11810 where
11811 T: std::convert::Into<wkt::FieldMask>,
11812 {
11813 self.update_mask = v.map(|x| x.into());
11814 self
11815 }
11816
11817 /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11818 ///
11819 /// # Example
11820 /// ```ignore,no_run
11821 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11822 /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11823 /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11824 /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11825 /// ```
11826 pub fn set_reconciliation_mode<
11827 T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11828 >(
11829 mut self,
11830 v: T,
11831 ) -> Self {
11832 self.reconciliation_mode = v.into();
11833 self
11834 }
11835
11836 /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11837 ///
11838 /// # Example
11839 /// ```ignore,no_run
11840 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11841 /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11842 /// ```
11843 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11844 mut self,
11845 v: T,
11846 ) -> Self {
11847 self.notification_pubsub_topic = v.into();
11848 self
11849 }
11850}
11851
11852impl wkt::message::Message for ImportProductsRequest {
11853 fn typename() -> &'static str {
11854 "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11855 }
11856}
11857
11858/// Defines additional types related to [ImportProductsRequest].
11859pub mod import_products_request {
11860 #[allow(unused_imports)]
11861 use super::*;
11862
11863 /// Indicates how imported products are reconciled with the existing products
11864 /// created or imported before.
11865 ///
11866 /// # Working with unknown values
11867 ///
11868 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11869 /// additional enum variants at any time. Adding new variants is not considered
11870 /// a breaking change. Applications should write their code in anticipation of:
11871 ///
11872 /// - New values appearing in future releases of the client library, **and**
11873 /// - New values received dynamically, without application changes.
11874 ///
11875 /// Please consult the [Working with enums] section in the user guide for some
11876 /// guidelines.
11877 ///
11878 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11879 #[derive(Clone, Debug, PartialEq)]
11880 #[non_exhaustive]
11881 pub enum ReconciliationMode {
11882 /// Defaults to INCREMENTAL.
11883 Unspecified,
11884 /// Inserts new products or updates existing products.
11885 Incremental,
11886 /// Calculates diff and replaces the entire product dataset. Existing
11887 /// products may be deleted if they are not present in the source location.
11888 Full,
11889 /// If set, the enum was initialized with an unknown value.
11890 ///
11891 /// Applications can examine the value using [ReconciliationMode::value] or
11892 /// [ReconciliationMode::name].
11893 UnknownValue(reconciliation_mode::UnknownValue),
11894 }
11895
11896 #[doc(hidden)]
11897 pub mod reconciliation_mode {
11898 #[allow(unused_imports)]
11899 use super::*;
11900 #[derive(Clone, Debug, PartialEq)]
11901 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11902 }
11903
11904 impl ReconciliationMode {
11905 /// Gets the enum value.
11906 ///
11907 /// Returns `None` if the enum contains an unknown value deserialized from
11908 /// the string representation of enums.
11909 pub fn value(&self) -> std::option::Option<i32> {
11910 match self {
11911 Self::Unspecified => std::option::Option::Some(0),
11912 Self::Incremental => std::option::Option::Some(1),
11913 Self::Full => std::option::Option::Some(2),
11914 Self::UnknownValue(u) => u.0.value(),
11915 }
11916 }
11917
11918 /// Gets the enum value as a string.
11919 ///
11920 /// Returns `None` if the enum contains an unknown value deserialized from
11921 /// the integer representation of enums.
11922 pub fn name(&self) -> std::option::Option<&str> {
11923 match self {
11924 Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11925 Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11926 Self::Full => std::option::Option::Some("FULL"),
11927 Self::UnknownValue(u) => u.0.name(),
11928 }
11929 }
11930 }
11931
11932 impl std::default::Default for ReconciliationMode {
11933 fn default() -> Self {
11934 use std::convert::From;
11935 Self::from(0)
11936 }
11937 }
11938
11939 impl std::fmt::Display for ReconciliationMode {
11940 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11941 wkt::internal::display_enum(f, self.name(), self.value())
11942 }
11943 }
11944
11945 impl std::convert::From<i32> for ReconciliationMode {
11946 fn from(value: i32) -> Self {
11947 match value {
11948 0 => Self::Unspecified,
11949 1 => Self::Incremental,
11950 2 => Self::Full,
11951 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11952 wkt::internal::UnknownEnumValue::Integer(value),
11953 )),
11954 }
11955 }
11956 }
11957
11958 impl std::convert::From<&str> for ReconciliationMode {
11959 fn from(value: &str) -> Self {
11960 use std::string::ToString;
11961 match value {
11962 "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
11963 "INCREMENTAL" => Self::Incremental,
11964 "FULL" => Self::Full,
11965 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11966 wkt::internal::UnknownEnumValue::String(value.to_string()),
11967 )),
11968 }
11969 }
11970 }
11971
11972 impl serde::ser::Serialize for ReconciliationMode {
11973 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11974 where
11975 S: serde::Serializer,
11976 {
11977 match self {
11978 Self::Unspecified => serializer.serialize_i32(0),
11979 Self::Incremental => serializer.serialize_i32(1),
11980 Self::Full => serializer.serialize_i32(2),
11981 Self::UnknownValue(u) => u.0.serialize(serializer),
11982 }
11983 }
11984 }
11985
11986 impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
11987 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11988 where
11989 D: serde::Deserializer<'de>,
11990 {
11991 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
11992 ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
11993 ))
11994 }
11995 }
11996}
11997
11998/// Request message for the ImportUserEvents request.
11999#[derive(Clone, Default, PartialEq)]
12000#[non_exhaustive]
12001pub struct ImportUserEventsRequest {
12002 /// Required. `projects/1234/locations/global/catalogs/default_catalog`
12003 pub parent: std::string::String,
12004
12005 /// Required. The desired input location of the data.
12006 pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
12007
12008 /// The desired location of errors incurred during the Import. Cannot be set
12009 /// for inline user event imports.
12010 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12011
12012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12013}
12014
12015impl ImportUserEventsRequest {
12016 /// Creates a new default instance.
12017 pub fn new() -> Self {
12018 std::default::Default::default()
12019 }
12020
12021 /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
12022 ///
12023 /// # Example
12024 /// ```ignore,no_run
12025 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12026 /// let x = ImportUserEventsRequest::new().set_parent("example");
12027 /// ```
12028 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12029 self.parent = v.into();
12030 self
12031 }
12032
12033 /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12034 ///
12035 /// # Example
12036 /// ```ignore,no_run
12037 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12038 /// use google_cloud_retail_v2::model::UserEventInputConfig;
12039 /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
12040 /// ```
12041 pub fn set_input_config<T>(mut self, v: T) -> Self
12042 where
12043 T: std::convert::Into<crate::model::UserEventInputConfig>,
12044 {
12045 self.input_config = std::option::Option::Some(v.into());
12046 self
12047 }
12048
12049 /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12050 ///
12051 /// # Example
12052 /// ```ignore,no_run
12053 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12054 /// use google_cloud_retail_v2::model::UserEventInputConfig;
12055 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
12056 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
12057 /// ```
12058 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12059 where
12060 T: std::convert::Into<crate::model::UserEventInputConfig>,
12061 {
12062 self.input_config = v.map(|x| x.into());
12063 self
12064 }
12065
12066 /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12067 ///
12068 /// # Example
12069 /// ```ignore,no_run
12070 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12071 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12072 /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12073 /// ```
12074 pub fn set_errors_config<T>(mut self, v: T) -> Self
12075 where
12076 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12077 {
12078 self.errors_config = std::option::Option::Some(v.into());
12079 self
12080 }
12081
12082 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12087 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12088 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12089 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12090 /// ```
12091 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12092 where
12093 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12094 {
12095 self.errors_config = v.map(|x| x.into());
12096 self
12097 }
12098}
12099
12100impl wkt::message::Message for ImportUserEventsRequest {
12101 fn typename() -> &'static str {
12102 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
12103 }
12104}
12105
12106/// Request message for ImportCompletionData methods.
12107#[derive(Clone, Default, PartialEq)]
12108#[non_exhaustive]
12109pub struct ImportCompletionDataRequest {
12110 /// Required. The catalog which the suggestions dataset belongs to.
12111 ///
12112 /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12113 pub parent: std::string::String,
12114
12115 /// Required. The desired input location of the data.
12116 pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12117
12118 /// Pub/Sub topic for receiving notification. If this field is set,
12119 /// when the import is finished, a notification is sent to
12120 /// specified Pub/Sub topic. The message data is JSON string of a
12121 /// [Operation][google.longrunning.Operation].
12122 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12123 ///
12124 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12125 pub notification_pubsub_topic: std::string::String,
12126
12127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12128}
12129
12130impl ImportCompletionDataRequest {
12131 /// Creates a new default instance.
12132 pub fn new() -> Self {
12133 std::default::Default::default()
12134 }
12135
12136 /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12137 ///
12138 /// # Example
12139 /// ```ignore,no_run
12140 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12141 /// let x = ImportCompletionDataRequest::new().set_parent("example");
12142 /// ```
12143 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12144 self.parent = v.into();
12145 self
12146 }
12147
12148 /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12149 ///
12150 /// # Example
12151 /// ```ignore,no_run
12152 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12153 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12154 /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12155 /// ```
12156 pub fn set_input_config<T>(mut self, v: T) -> Self
12157 where
12158 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12159 {
12160 self.input_config = std::option::Option::Some(v.into());
12161 self
12162 }
12163
12164 /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12165 ///
12166 /// # Example
12167 /// ```ignore,no_run
12168 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12169 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12170 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12171 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12172 /// ```
12173 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12174 where
12175 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12176 {
12177 self.input_config = v.map(|x| x.into());
12178 self
12179 }
12180
12181 /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12182 ///
12183 /// # Example
12184 /// ```ignore,no_run
12185 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12186 /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12187 /// ```
12188 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12189 mut self,
12190 v: T,
12191 ) -> Self {
12192 self.notification_pubsub_topic = v.into();
12193 self
12194 }
12195}
12196
12197impl wkt::message::Message for ImportCompletionDataRequest {
12198 fn typename() -> &'static str {
12199 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12200 }
12201}
12202
12203/// The input config source for products.
12204#[derive(Clone, Default, PartialEq)]
12205#[non_exhaustive]
12206pub struct ProductInputConfig {
12207 /// Required. The source of the input.
12208 pub source: std::option::Option<crate::model::product_input_config::Source>,
12209
12210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12211}
12212
12213impl ProductInputConfig {
12214 /// Creates a new default instance.
12215 pub fn new() -> Self {
12216 std::default::Default::default()
12217 }
12218
12219 /// Sets the value of [source][crate::model::ProductInputConfig::source].
12220 ///
12221 /// Note that all the setters affecting `source` are mutually
12222 /// exclusive.
12223 ///
12224 /// # Example
12225 /// ```ignore,no_run
12226 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12227 /// use google_cloud_retail_v2::model::ProductInlineSource;
12228 /// let x = ProductInputConfig::new().set_source(Some(
12229 /// google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12230 /// ```
12231 pub fn set_source<
12232 T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12233 >(
12234 mut self,
12235 v: T,
12236 ) -> Self {
12237 self.source = v.into();
12238 self
12239 }
12240
12241 /// The value of [source][crate::model::ProductInputConfig::source]
12242 /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12243 /// holds a different branch.
12244 pub fn product_inline_source(
12245 &self,
12246 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12247 #[allow(unreachable_patterns)]
12248 self.source.as_ref().and_then(|v| match v {
12249 crate::model::product_input_config::Source::ProductInlineSource(v) => {
12250 std::option::Option::Some(v)
12251 }
12252 _ => std::option::Option::None,
12253 })
12254 }
12255
12256 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12257 /// to hold a `ProductInlineSource`.
12258 ///
12259 /// Note that all the setters affecting `source` are
12260 /// mutually exclusive.
12261 ///
12262 /// # Example
12263 /// ```ignore,no_run
12264 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12265 /// use google_cloud_retail_v2::model::ProductInlineSource;
12266 /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12267 /// assert!(x.product_inline_source().is_some());
12268 /// assert!(x.gcs_source().is_none());
12269 /// assert!(x.big_query_source().is_none());
12270 /// ```
12271 pub fn set_product_inline_source<
12272 T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12273 >(
12274 mut self,
12275 v: T,
12276 ) -> Self {
12277 self.source = std::option::Option::Some(
12278 crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12279 );
12280 self
12281 }
12282
12283 /// The value of [source][crate::model::ProductInputConfig::source]
12284 /// if it holds a `GcsSource`, `None` if the field is not set or
12285 /// holds a different branch.
12286 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12287 #[allow(unreachable_patterns)]
12288 self.source.as_ref().and_then(|v| match v {
12289 crate::model::product_input_config::Source::GcsSource(v) => {
12290 std::option::Option::Some(v)
12291 }
12292 _ => std::option::Option::None,
12293 })
12294 }
12295
12296 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12297 /// to hold a `GcsSource`.
12298 ///
12299 /// Note that all the setters affecting `source` are
12300 /// mutually exclusive.
12301 ///
12302 /// # Example
12303 /// ```ignore,no_run
12304 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12305 /// use google_cloud_retail_v2::model::GcsSource;
12306 /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12307 /// assert!(x.gcs_source().is_some());
12308 /// assert!(x.product_inline_source().is_none());
12309 /// assert!(x.big_query_source().is_none());
12310 /// ```
12311 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12312 mut self,
12313 v: T,
12314 ) -> Self {
12315 self.source = std::option::Option::Some(
12316 crate::model::product_input_config::Source::GcsSource(v.into()),
12317 );
12318 self
12319 }
12320
12321 /// The value of [source][crate::model::ProductInputConfig::source]
12322 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12323 /// holds a different branch.
12324 pub fn big_query_source(
12325 &self,
12326 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12327 #[allow(unreachable_patterns)]
12328 self.source.as_ref().and_then(|v| match v {
12329 crate::model::product_input_config::Source::BigQuerySource(v) => {
12330 std::option::Option::Some(v)
12331 }
12332 _ => std::option::Option::None,
12333 })
12334 }
12335
12336 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12337 /// to hold a `BigQuerySource`.
12338 ///
12339 /// Note that all the setters affecting `source` are
12340 /// mutually exclusive.
12341 ///
12342 /// # Example
12343 /// ```ignore,no_run
12344 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12345 /// use google_cloud_retail_v2::model::BigQuerySource;
12346 /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12347 /// assert!(x.big_query_source().is_some());
12348 /// assert!(x.product_inline_source().is_none());
12349 /// assert!(x.gcs_source().is_none());
12350 /// ```
12351 pub fn set_big_query_source<
12352 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12353 >(
12354 mut self,
12355 v: T,
12356 ) -> Self {
12357 self.source = std::option::Option::Some(
12358 crate::model::product_input_config::Source::BigQuerySource(v.into()),
12359 );
12360 self
12361 }
12362}
12363
12364impl wkt::message::Message for ProductInputConfig {
12365 fn typename() -> &'static str {
12366 "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12367 }
12368}
12369
12370/// Defines additional types related to [ProductInputConfig].
12371pub mod product_input_config {
12372 #[allow(unused_imports)]
12373 use super::*;
12374
12375 /// Required. The source of the input.
12376 #[derive(Clone, Debug, PartialEq)]
12377 #[non_exhaustive]
12378 pub enum Source {
12379 /// The Inline source for the input content for products.
12380 ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12381 /// Google Cloud Storage location for the input content.
12382 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12383 /// BigQuery input source.
12384 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12385 }
12386}
12387
12388/// The input config source for user events.
12389#[derive(Clone, Default, PartialEq)]
12390#[non_exhaustive]
12391pub struct UserEventInputConfig {
12392 /// The source of the input.
12393 pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12394
12395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12396}
12397
12398impl UserEventInputConfig {
12399 /// Creates a new default instance.
12400 pub fn new() -> Self {
12401 std::default::Default::default()
12402 }
12403
12404 /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12405 ///
12406 /// Note that all the setters affecting `source` are mutually
12407 /// exclusive.
12408 ///
12409 /// # Example
12410 /// ```ignore,no_run
12411 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12412 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12413 /// let x = UserEventInputConfig::new().set_source(Some(
12414 /// google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12415 /// ```
12416 pub fn set_source<
12417 T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12418 >(
12419 mut self,
12420 v: T,
12421 ) -> Self {
12422 self.source = v.into();
12423 self
12424 }
12425
12426 /// The value of [source][crate::model::UserEventInputConfig::source]
12427 /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12428 /// holds a different branch.
12429 pub fn user_event_inline_source(
12430 &self,
12431 ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12432 #[allow(unreachable_patterns)]
12433 self.source.as_ref().and_then(|v| match v {
12434 crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12435 std::option::Option::Some(v)
12436 }
12437 _ => std::option::Option::None,
12438 })
12439 }
12440
12441 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12442 /// to hold a `UserEventInlineSource`.
12443 ///
12444 /// Note that all the setters affecting `source` are
12445 /// mutually exclusive.
12446 ///
12447 /// # Example
12448 /// ```ignore,no_run
12449 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12450 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12451 /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12452 /// assert!(x.user_event_inline_source().is_some());
12453 /// assert!(x.gcs_source().is_none());
12454 /// assert!(x.big_query_source().is_none());
12455 /// ```
12456 pub fn set_user_event_inline_source<
12457 T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12458 >(
12459 mut self,
12460 v: T,
12461 ) -> Self {
12462 self.source = std::option::Option::Some(
12463 crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12464 );
12465 self
12466 }
12467
12468 /// The value of [source][crate::model::UserEventInputConfig::source]
12469 /// if it holds a `GcsSource`, `None` if the field is not set or
12470 /// holds a different branch.
12471 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12472 #[allow(unreachable_patterns)]
12473 self.source.as_ref().and_then(|v| match v {
12474 crate::model::user_event_input_config::Source::GcsSource(v) => {
12475 std::option::Option::Some(v)
12476 }
12477 _ => std::option::Option::None,
12478 })
12479 }
12480
12481 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12482 /// to hold a `GcsSource`.
12483 ///
12484 /// Note that all the setters affecting `source` are
12485 /// mutually exclusive.
12486 ///
12487 /// # Example
12488 /// ```ignore,no_run
12489 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12490 /// use google_cloud_retail_v2::model::GcsSource;
12491 /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12492 /// assert!(x.gcs_source().is_some());
12493 /// assert!(x.user_event_inline_source().is_none());
12494 /// assert!(x.big_query_source().is_none());
12495 /// ```
12496 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12497 mut self,
12498 v: T,
12499 ) -> Self {
12500 self.source = std::option::Option::Some(
12501 crate::model::user_event_input_config::Source::GcsSource(v.into()),
12502 );
12503 self
12504 }
12505
12506 /// The value of [source][crate::model::UserEventInputConfig::source]
12507 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12508 /// holds a different branch.
12509 pub fn big_query_source(
12510 &self,
12511 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12512 #[allow(unreachable_patterns)]
12513 self.source.as_ref().and_then(|v| match v {
12514 crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12515 std::option::Option::Some(v)
12516 }
12517 _ => std::option::Option::None,
12518 })
12519 }
12520
12521 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12522 /// to hold a `BigQuerySource`.
12523 ///
12524 /// Note that all the setters affecting `source` are
12525 /// mutually exclusive.
12526 ///
12527 /// # Example
12528 /// ```ignore,no_run
12529 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12530 /// use google_cloud_retail_v2::model::BigQuerySource;
12531 /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12532 /// assert!(x.big_query_source().is_some());
12533 /// assert!(x.user_event_inline_source().is_none());
12534 /// assert!(x.gcs_source().is_none());
12535 /// ```
12536 pub fn set_big_query_source<
12537 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12538 >(
12539 mut self,
12540 v: T,
12541 ) -> Self {
12542 self.source = std::option::Option::Some(
12543 crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12544 );
12545 self
12546 }
12547}
12548
12549impl wkt::message::Message for UserEventInputConfig {
12550 fn typename() -> &'static str {
12551 "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12552 }
12553}
12554
12555/// Defines additional types related to [UserEventInputConfig].
12556pub mod user_event_input_config {
12557 #[allow(unused_imports)]
12558 use super::*;
12559
12560 /// The source of the input.
12561 #[derive(Clone, Debug, PartialEq)]
12562 #[non_exhaustive]
12563 pub enum Source {
12564 /// Required. The Inline source for the input content for UserEvents.
12565 UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12566 /// Required. Google Cloud Storage location for the input content.
12567 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12568 /// Required. BigQuery input source.
12569 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12570 }
12571}
12572
12573/// The input config source for completion data.
12574#[derive(Clone, Default, PartialEq)]
12575#[non_exhaustive]
12576pub struct CompletionDataInputConfig {
12577 /// The source of the input.
12578 ///
12579 /// Supported
12580 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12581 /// values for suggestions imports:
12582 ///
12583 /// * `suggestions` (default): One JSON completion suggestion per line.
12584 /// * `denylist`: One JSON deny suggestion per line.
12585 /// * `allowlist`: One JSON allow suggestion per line.
12586 ///
12587 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12588 pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12589
12590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12591}
12592
12593impl CompletionDataInputConfig {
12594 /// Creates a new default instance.
12595 pub fn new() -> Self {
12596 std::default::Default::default()
12597 }
12598
12599 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12600 ///
12601 /// Note that all the setters affecting `source` are mutually
12602 /// exclusive.
12603 ///
12604 /// # Example
12605 /// ```ignore,no_run
12606 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12607 /// use google_cloud_retail_v2::model::BigQuerySource;
12608 /// let x = CompletionDataInputConfig::new().set_source(Some(
12609 /// google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12610 /// ```
12611 pub fn set_source<
12612 T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12613 >(
12614 mut self,
12615 v: T,
12616 ) -> Self {
12617 self.source = v.into();
12618 self
12619 }
12620
12621 /// The value of [source][crate::model::CompletionDataInputConfig::source]
12622 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12623 /// holds a different branch.
12624 pub fn big_query_source(
12625 &self,
12626 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12627 #[allow(unreachable_patterns)]
12628 self.source.as_ref().and_then(|v| match v {
12629 crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12630 std::option::Option::Some(v)
12631 }
12632 _ => std::option::Option::None,
12633 })
12634 }
12635
12636 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12637 /// to hold a `BigQuerySource`.
12638 ///
12639 /// Note that all the setters affecting `source` are
12640 /// mutually exclusive.
12641 ///
12642 /// # Example
12643 /// ```ignore,no_run
12644 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12645 /// use google_cloud_retail_v2::model::BigQuerySource;
12646 /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12647 /// assert!(x.big_query_source().is_some());
12648 /// ```
12649 pub fn set_big_query_source<
12650 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12651 >(
12652 mut self,
12653 v: T,
12654 ) -> Self {
12655 self.source = std::option::Option::Some(
12656 crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12657 );
12658 self
12659 }
12660}
12661
12662impl wkt::message::Message for CompletionDataInputConfig {
12663 fn typename() -> &'static str {
12664 "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12665 }
12666}
12667
12668/// Defines additional types related to [CompletionDataInputConfig].
12669pub mod completion_data_input_config {
12670 #[allow(unused_imports)]
12671 use super::*;
12672
12673 /// The source of the input.
12674 ///
12675 /// Supported
12676 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12677 /// values for suggestions imports:
12678 ///
12679 /// * `suggestions` (default): One JSON completion suggestion per line.
12680 /// * `denylist`: One JSON deny suggestion per line.
12681 /// * `allowlist`: One JSON allow suggestion per line.
12682 ///
12683 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12684 #[derive(Clone, Debug, PartialEq)]
12685 #[non_exhaustive]
12686 pub enum Source {
12687 /// Required. BigQuery input source.
12688 ///
12689 /// Add the IAM permission "BigQuery Data Viewer" for
12690 /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12691 /// using this feature otherwise an error is thrown.
12692 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12693 }
12694}
12695
12696/// Metadata related to the progress of the Import operation. This is
12697/// returned by the google.longrunning.Operation.metadata field.
12698#[derive(Clone, Default, PartialEq)]
12699#[non_exhaustive]
12700pub struct ImportMetadata {
12701 /// Operation create time.
12702 pub create_time: std::option::Option<wkt::Timestamp>,
12703
12704 /// Operation last update time. If the operation is done, this is also the
12705 /// finish time.
12706 pub update_time: std::option::Option<wkt::Timestamp>,
12707
12708 /// Count of entries that were processed successfully.
12709 pub success_count: i64,
12710
12711 /// Count of entries that encountered errors while processing.
12712 pub failure_count: i64,
12713
12714 /// Deprecated. This field is never set.
12715 #[deprecated]
12716 pub request_id: std::string::String,
12717
12718 /// Pub/Sub topic for receiving notification. If this field is set,
12719 /// when the import is finished, a notification is sent to
12720 /// specified Pub/Sub topic. The message data is JSON string of a
12721 /// [Operation][google.longrunning.Operation].
12722 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12723 ///
12724 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12725 pub notification_pubsub_topic: std::string::String,
12726
12727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12728}
12729
12730impl ImportMetadata {
12731 /// Creates a new default instance.
12732 pub fn new() -> Self {
12733 std::default::Default::default()
12734 }
12735
12736 /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12737 ///
12738 /// # Example
12739 /// ```ignore,no_run
12740 /// # use google_cloud_retail_v2::model::ImportMetadata;
12741 /// use wkt::Timestamp;
12742 /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12743 /// ```
12744 pub fn set_create_time<T>(mut self, v: T) -> Self
12745 where
12746 T: std::convert::Into<wkt::Timestamp>,
12747 {
12748 self.create_time = std::option::Option::Some(v.into());
12749 self
12750 }
12751
12752 /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12753 ///
12754 /// # Example
12755 /// ```ignore,no_run
12756 /// # use google_cloud_retail_v2::model::ImportMetadata;
12757 /// use wkt::Timestamp;
12758 /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12759 /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12760 /// ```
12761 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12762 where
12763 T: std::convert::Into<wkt::Timestamp>,
12764 {
12765 self.create_time = v.map(|x| x.into());
12766 self
12767 }
12768
12769 /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12770 ///
12771 /// # Example
12772 /// ```ignore,no_run
12773 /// # use google_cloud_retail_v2::model::ImportMetadata;
12774 /// use wkt::Timestamp;
12775 /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12776 /// ```
12777 pub fn set_update_time<T>(mut self, v: T) -> Self
12778 where
12779 T: std::convert::Into<wkt::Timestamp>,
12780 {
12781 self.update_time = std::option::Option::Some(v.into());
12782 self
12783 }
12784
12785 /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12786 ///
12787 /// # Example
12788 /// ```ignore,no_run
12789 /// # use google_cloud_retail_v2::model::ImportMetadata;
12790 /// use wkt::Timestamp;
12791 /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12792 /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12793 /// ```
12794 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12795 where
12796 T: std::convert::Into<wkt::Timestamp>,
12797 {
12798 self.update_time = v.map(|x| x.into());
12799 self
12800 }
12801
12802 /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12803 ///
12804 /// # Example
12805 /// ```ignore,no_run
12806 /// # use google_cloud_retail_v2::model::ImportMetadata;
12807 /// let x = ImportMetadata::new().set_success_count(42);
12808 /// ```
12809 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12810 self.success_count = v.into();
12811 self
12812 }
12813
12814 /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12815 ///
12816 /// # Example
12817 /// ```ignore,no_run
12818 /// # use google_cloud_retail_v2::model::ImportMetadata;
12819 /// let x = ImportMetadata::new().set_failure_count(42);
12820 /// ```
12821 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12822 self.failure_count = v.into();
12823 self
12824 }
12825
12826 /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12827 ///
12828 /// # Example
12829 /// ```ignore,no_run
12830 /// # use google_cloud_retail_v2::model::ImportMetadata;
12831 /// let x = ImportMetadata::new().set_request_id("example");
12832 /// ```
12833 #[deprecated]
12834 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12835 self.request_id = v.into();
12836 self
12837 }
12838
12839 /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12840 ///
12841 /// # Example
12842 /// ```ignore,no_run
12843 /// # use google_cloud_retail_v2::model::ImportMetadata;
12844 /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12845 /// ```
12846 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12847 mut self,
12848 v: T,
12849 ) -> Self {
12850 self.notification_pubsub_topic = v.into();
12851 self
12852 }
12853}
12854
12855impl wkt::message::Message for ImportMetadata {
12856 fn typename() -> &'static str {
12857 "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12858 }
12859}
12860
12861/// Response of the
12862/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12863/// long running operation is done, then this message is returned by the
12864/// google.longrunning.Operations.response field if the operation was successful.
12865///
12866/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12867#[derive(Clone, Default, PartialEq)]
12868#[non_exhaustive]
12869pub struct ImportProductsResponse {
12870 /// A sample of errors encountered while processing the request.
12871 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12872
12873 /// Echoes the destination for the complete errors in the request if set.
12874 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12875
12876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12877}
12878
12879impl ImportProductsResponse {
12880 /// Creates a new default instance.
12881 pub fn new() -> Self {
12882 std::default::Default::default()
12883 }
12884
12885 /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12886 ///
12887 /// # Example
12888 /// ```ignore,no_run
12889 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12890 /// use google_cloud_rpc::model::Status;
12891 /// let x = ImportProductsResponse::new()
12892 /// .set_error_samples([
12893 /// Status::default()/* use setters */,
12894 /// Status::default()/* use (different) setters */,
12895 /// ]);
12896 /// ```
12897 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12898 where
12899 T: std::iter::IntoIterator<Item = V>,
12900 V: std::convert::Into<google_cloud_rpc::model::Status>,
12901 {
12902 use std::iter::Iterator;
12903 self.error_samples = v.into_iter().map(|i| i.into()).collect();
12904 self
12905 }
12906
12907 /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12908 ///
12909 /// # Example
12910 /// ```ignore,no_run
12911 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12912 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12913 /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12914 /// ```
12915 pub fn set_errors_config<T>(mut self, v: T) -> Self
12916 where
12917 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12918 {
12919 self.errors_config = std::option::Option::Some(v.into());
12920 self
12921 }
12922
12923 /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12924 ///
12925 /// # Example
12926 /// ```ignore,no_run
12927 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12928 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12929 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12930 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12931 /// ```
12932 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12933 where
12934 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12935 {
12936 self.errors_config = v.map(|x| x.into());
12937 self
12938 }
12939}
12940
12941impl wkt::message::Message for ImportProductsResponse {
12942 fn typename() -> &'static str {
12943 "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
12944 }
12945}
12946
12947/// Response of the ImportUserEventsRequest. If the long running
12948/// operation was successful, then this message is returned by the
12949/// google.longrunning.Operations.response field if the operation was successful.
12950#[derive(Clone, Default, PartialEq)]
12951#[non_exhaustive]
12952pub struct ImportUserEventsResponse {
12953 /// A sample of errors encountered while processing the request.
12954 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12955
12956 /// Echoes the destination for the complete errors if this field was set in
12957 /// the request.
12958 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12959
12960 /// Aggregated statistics of user event import status.
12961 pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
12962
12963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12964}
12965
12966impl ImportUserEventsResponse {
12967 /// Creates a new default instance.
12968 pub fn new() -> Self {
12969 std::default::Default::default()
12970 }
12971
12972 /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
12973 ///
12974 /// # Example
12975 /// ```ignore,no_run
12976 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12977 /// use google_cloud_rpc::model::Status;
12978 /// let x = ImportUserEventsResponse::new()
12979 /// .set_error_samples([
12980 /// Status::default()/* use setters */,
12981 /// Status::default()/* use (different) setters */,
12982 /// ]);
12983 /// ```
12984 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12985 where
12986 T: std::iter::IntoIterator<Item = V>,
12987 V: std::convert::Into<google_cloud_rpc::model::Status>,
12988 {
12989 use std::iter::Iterator;
12990 self.error_samples = v.into_iter().map(|i| i.into()).collect();
12991 self
12992 }
12993
12994 /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12995 ///
12996 /// # Example
12997 /// ```ignore,no_run
12998 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12999 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13000 /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
13001 /// ```
13002 pub fn set_errors_config<T>(mut self, v: T) -> Self
13003 where
13004 T: std::convert::Into<crate::model::ImportErrorsConfig>,
13005 {
13006 self.errors_config = std::option::Option::Some(v.into());
13007 self
13008 }
13009
13010 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
13011 ///
13012 /// # Example
13013 /// ```ignore,no_run
13014 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13015 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13016 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
13017 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
13018 /// ```
13019 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
13020 where
13021 T: std::convert::Into<crate::model::ImportErrorsConfig>,
13022 {
13023 self.errors_config = v.map(|x| x.into());
13024 self
13025 }
13026
13027 /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13028 ///
13029 /// # Example
13030 /// ```ignore,no_run
13031 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13032 /// use google_cloud_retail_v2::model::UserEventImportSummary;
13033 /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
13034 /// ```
13035 pub fn set_import_summary<T>(mut self, v: T) -> Self
13036 where
13037 T: std::convert::Into<crate::model::UserEventImportSummary>,
13038 {
13039 self.import_summary = std::option::Option::Some(v.into());
13040 self
13041 }
13042
13043 /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13044 ///
13045 /// # Example
13046 /// ```ignore,no_run
13047 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13048 /// use google_cloud_retail_v2::model::UserEventImportSummary;
13049 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
13050 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
13051 /// ```
13052 pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
13053 where
13054 T: std::convert::Into<crate::model::UserEventImportSummary>,
13055 {
13056 self.import_summary = v.map(|x| x.into());
13057 self
13058 }
13059}
13060
13061impl wkt::message::Message for ImportUserEventsResponse {
13062 fn typename() -> &'static str {
13063 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
13064 }
13065}
13066
13067/// A summary of import result. The UserEventImportSummary summarizes
13068/// the import status for user events.
13069#[derive(Clone, Default, PartialEq)]
13070#[non_exhaustive]
13071pub struct UserEventImportSummary {
13072 /// Count of user events imported with complete existing catalog information.
13073 pub joined_events_count: i64,
13074
13075 /// Count of user events imported, but with catalog information not found
13076 /// in the imported catalog.
13077 pub unjoined_events_count: i64,
13078
13079 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13080}
13081
13082impl UserEventImportSummary {
13083 /// Creates a new default instance.
13084 pub fn new() -> Self {
13085 std::default::Default::default()
13086 }
13087
13088 /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
13089 ///
13090 /// # Example
13091 /// ```ignore,no_run
13092 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13093 /// let x = UserEventImportSummary::new().set_joined_events_count(42);
13094 /// ```
13095 pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13096 self.joined_events_count = v.into();
13097 self
13098 }
13099
13100 /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
13101 ///
13102 /// # Example
13103 /// ```ignore,no_run
13104 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13105 /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
13106 /// ```
13107 pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13108 self.unjoined_events_count = v.into();
13109 self
13110 }
13111}
13112
13113impl wkt::message::Message for UserEventImportSummary {
13114 fn typename() -> &'static str {
13115 "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13116 }
13117}
13118
13119/// Response of the
13120/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13121/// If the long running operation is done, this message is returned by the
13122/// google.longrunning.Operations.response field if the operation is successful.
13123///
13124/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13125#[derive(Clone, Default, PartialEq)]
13126#[non_exhaustive]
13127pub struct ImportCompletionDataResponse {
13128 /// A sample of errors encountered while processing the request.
13129 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13130
13131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13132}
13133
13134impl ImportCompletionDataResponse {
13135 /// Creates a new default instance.
13136 pub fn new() -> Self {
13137 std::default::Default::default()
13138 }
13139
13140 /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13141 ///
13142 /// # Example
13143 /// ```ignore,no_run
13144 /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13145 /// use google_cloud_rpc::model::Status;
13146 /// let x = ImportCompletionDataResponse::new()
13147 /// .set_error_samples([
13148 /// Status::default()/* use setters */,
13149 /// Status::default()/* use (different) setters */,
13150 /// ]);
13151 /// ```
13152 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13153 where
13154 T: std::iter::IntoIterator<Item = V>,
13155 V: std::convert::Into<google_cloud_rpc::model::Status>,
13156 {
13157 use std::iter::Iterator;
13158 self.error_samples = v.into_iter().map(|i| i.into()).collect();
13159 self
13160 }
13161}
13162
13163impl wkt::message::Message for ImportCompletionDataResponse {
13164 fn typename() -> &'static str {
13165 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13166 }
13167}
13168
13169/// Metadata that describes the training and serving parameters of a
13170/// [Model][google.cloud.retail.v2.Model]. A
13171/// [Model][google.cloud.retail.v2.Model] can be associated with a
13172/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13173/// through the Predict API.
13174///
13175/// [google.cloud.retail.v2.Model]: crate::model::Model
13176/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13177#[derive(Clone, Default, PartialEq)]
13178#[non_exhaustive]
13179pub struct Model {
13180 /// Required. The fully qualified resource name of the model.
13181 ///
13182 /// Format:
13183 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13184 /// catalog_id has char limit of 50.
13185 /// recommendation_model_id has char limit of 40.
13186 pub name: std::string::String,
13187
13188 /// Required. The display name of the model.
13189 ///
13190 /// Should be human readable, used to display Recommendation Models in the
13191 /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13192 /// characters.
13193 pub display_name: std::string::String,
13194
13195 /// Optional. The training state that the model is in (e.g.
13196 /// `TRAINING` or `PAUSED`).
13197 ///
13198 /// Since part of the cost of running the service
13199 /// is frequency of training - this can be used to determine when to train
13200 /// model in order to control cost. If not specified: the default value for
13201 /// `CreateModel` method is `TRAINING`. The default value for
13202 /// `UpdateModel` method is to keep the state the same as before.
13203 pub training_state: crate::model::model::TrainingState,
13204
13205 /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13206 pub serving_state: crate::model::model::ServingState,
13207
13208 /// Output only. Timestamp the Recommendation Model was created at.
13209 pub create_time: std::option::Option<wkt::Timestamp>,
13210
13211 /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13212 /// if a Recommendation Model was paused - this would be the time the pause was
13213 /// initiated.
13214 pub update_time: std::option::Option<wkt::Timestamp>,
13215
13216 /// Required. The type of model e.g. `home-page`.
13217 ///
13218 /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13219 /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13220 /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13221 ///
13222 /// This field together with
13223 /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13224 /// describe model metadata to use to control model training and serving.
13225 /// See <https://cloud.google.com/retail/docs/models>
13226 /// for more details on what the model metadata control and which combination
13227 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13228 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13229 /// receive an error 400 if you try to create/update a recommendation with
13230 /// this set of knobs.
13231 ///
13232 /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13233 pub r#type: std::string::String,
13234
13235 /// Optional. The optimization objective e.g. `cvr`.
13236 ///
13237 /// Currently supported
13238 /// values: `ctr`, `cvr`, `revenue-per-order`.
13239 ///
13240 /// If not specified, we choose default based on model type.
13241 /// Default depends on type of recommendation:
13242 ///
13243 /// `recommended-for-you` => `ctr`
13244 ///
13245 /// `others-you-may-like` => `ctr`
13246 ///
13247 /// `frequently-bought-together` => `revenue_per_order`
13248 ///
13249 /// This field together with
13250 /// [optimization_objective][google.cloud.retail.v2.Model.type]
13251 /// describe model metadata to use to control model training and serving.
13252 /// See <https://cloud.google.com/retail/docs/models>
13253 /// for more details on what the model metadata control and which combination
13254 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13255 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13256 /// receive an error 400 if you try to create/update a recommendation with
13257 /// this set of knobs.
13258 ///
13259 /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13260 pub optimization_objective: std::string::String,
13261
13262 /// Optional. The state of periodic tuning.
13263 ///
13264 /// The period we use is 3 months - to do a
13265 /// one-off tune earlier use the `TuneModel` method. Default value
13266 /// is `PERIODIC_TUNING_ENABLED`.
13267 pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13268
13269 /// Output only. The timestamp when the latest successful tune finished.
13270 pub last_tune_time: std::option::Option<wkt::Timestamp>,
13271
13272 /// Output only. The tune operation associated with the model.
13273 ///
13274 /// Can be used to determine if there is an ongoing tune for this
13275 /// recommendation. Empty field implies no tune is goig on.
13276 pub tuning_operation: std::string::String,
13277
13278 /// Output only. The state of data requirements for this model: `DATA_OK` and
13279 /// `DATA_ERROR`.
13280 ///
13281 /// Recommendation model cannot be trained if the data is in
13282 /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13283 /// if serving state is `ACTIVE`: models were trained successfully before, but
13284 /// cannot be refreshed because model no longer has sufficient
13285 /// data for training.
13286 pub data_state: crate::model::model::DataState,
13287
13288 /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13289 /// by attributes is enabled for the model.
13290 pub filtering_option: crate::model::RecommendationsFilteringOption,
13291
13292 /// Output only. The list of valid serving configs associated with the
13293 /// PageOptimizationConfig.
13294 pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13295
13296 /// Optional. Additional model features config.
13297 pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13298
13299 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13300}
13301
13302impl Model {
13303 /// Creates a new default instance.
13304 pub fn new() -> Self {
13305 std::default::Default::default()
13306 }
13307
13308 /// Sets the value of [name][crate::model::Model::name].
13309 ///
13310 /// # Example
13311 /// ```ignore,no_run
13312 /// # use google_cloud_retail_v2::model::Model;
13313 /// let x = Model::new().set_name("example");
13314 /// ```
13315 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13316 self.name = v.into();
13317 self
13318 }
13319
13320 /// Sets the value of [display_name][crate::model::Model::display_name].
13321 ///
13322 /// # Example
13323 /// ```ignore,no_run
13324 /// # use google_cloud_retail_v2::model::Model;
13325 /// let x = Model::new().set_display_name("example");
13326 /// ```
13327 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13328 self.display_name = v.into();
13329 self
13330 }
13331
13332 /// Sets the value of [training_state][crate::model::Model::training_state].
13333 ///
13334 /// # Example
13335 /// ```ignore,no_run
13336 /// # use google_cloud_retail_v2::model::Model;
13337 /// use google_cloud_retail_v2::model::model::TrainingState;
13338 /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13339 /// let x1 = Model::new().set_training_state(TrainingState::Training);
13340 /// ```
13341 pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13342 mut self,
13343 v: T,
13344 ) -> Self {
13345 self.training_state = v.into();
13346 self
13347 }
13348
13349 /// Sets the value of [serving_state][crate::model::Model::serving_state].
13350 ///
13351 /// # Example
13352 /// ```ignore,no_run
13353 /// # use google_cloud_retail_v2::model::Model;
13354 /// use google_cloud_retail_v2::model::model::ServingState;
13355 /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13356 /// let x1 = Model::new().set_serving_state(ServingState::Active);
13357 /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13358 /// ```
13359 pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13360 mut self,
13361 v: T,
13362 ) -> Self {
13363 self.serving_state = v.into();
13364 self
13365 }
13366
13367 /// Sets the value of [create_time][crate::model::Model::create_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_create_time(Timestamp::default()/* use setters */);
13374 /// ```
13375 pub fn set_create_time<T>(mut self, v: T) -> Self
13376 where
13377 T: std::convert::Into<wkt::Timestamp>,
13378 {
13379 self.create_time = std::option::Option::Some(v.into());
13380 self
13381 }
13382
13383 /// Sets or clears the value of [create_time][crate::model::Model::create_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_create_time(Some(Timestamp::default()/* use setters */));
13390 /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13391 /// ```
13392 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13393 where
13394 T: std::convert::Into<wkt::Timestamp>,
13395 {
13396 self.create_time = v.map(|x| x.into());
13397 self
13398 }
13399
13400 /// Sets the value of [update_time][crate::model::Model::update_time].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_retail_v2::model::Model;
13405 /// use wkt::Timestamp;
13406 /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13407 /// ```
13408 pub fn set_update_time<T>(mut self, v: T) -> Self
13409 where
13410 T: std::convert::Into<wkt::Timestamp>,
13411 {
13412 self.update_time = std::option::Option::Some(v.into());
13413 self
13414 }
13415
13416 /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13417 ///
13418 /// # Example
13419 /// ```ignore,no_run
13420 /// # use google_cloud_retail_v2::model::Model;
13421 /// use wkt::Timestamp;
13422 /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13423 /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13424 /// ```
13425 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13426 where
13427 T: std::convert::Into<wkt::Timestamp>,
13428 {
13429 self.update_time = v.map(|x| x.into());
13430 self
13431 }
13432
13433 /// Sets the value of [r#type][crate::model::Model::type].
13434 ///
13435 /// # Example
13436 /// ```ignore,no_run
13437 /// # use google_cloud_retail_v2::model::Model;
13438 /// let x = Model::new().set_type("example");
13439 /// ```
13440 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13441 self.r#type = v.into();
13442 self
13443 }
13444
13445 /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13446 ///
13447 /// # Example
13448 /// ```ignore,no_run
13449 /// # use google_cloud_retail_v2::model::Model;
13450 /// let x = Model::new().set_optimization_objective("example");
13451 /// ```
13452 pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13453 mut self,
13454 v: T,
13455 ) -> Self {
13456 self.optimization_objective = v.into();
13457 self
13458 }
13459
13460 /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13461 ///
13462 /// # Example
13463 /// ```ignore,no_run
13464 /// # use google_cloud_retail_v2::model::Model;
13465 /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13466 /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13467 /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13468 /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13469 /// ```
13470 pub fn set_periodic_tuning_state<
13471 T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13472 >(
13473 mut self,
13474 v: T,
13475 ) -> Self {
13476 self.periodic_tuning_state = v.into();
13477 self
13478 }
13479
13480 /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13481 ///
13482 /// # Example
13483 /// ```ignore,no_run
13484 /// # use google_cloud_retail_v2::model::Model;
13485 /// use wkt::Timestamp;
13486 /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13487 /// ```
13488 pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13489 where
13490 T: std::convert::Into<wkt::Timestamp>,
13491 {
13492 self.last_tune_time = std::option::Option::Some(v.into());
13493 self
13494 }
13495
13496 /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_retail_v2::model::Model;
13501 /// use wkt::Timestamp;
13502 /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13503 /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13504 /// ```
13505 pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13506 where
13507 T: std::convert::Into<wkt::Timestamp>,
13508 {
13509 self.last_tune_time = v.map(|x| x.into());
13510 self
13511 }
13512
13513 /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13514 ///
13515 /// # Example
13516 /// ```ignore,no_run
13517 /// # use google_cloud_retail_v2::model::Model;
13518 /// let x = Model::new().set_tuning_operation("example");
13519 /// ```
13520 pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13521 mut self,
13522 v: T,
13523 ) -> Self {
13524 self.tuning_operation = v.into();
13525 self
13526 }
13527
13528 /// Sets the value of [data_state][crate::model::Model::data_state].
13529 ///
13530 /// # Example
13531 /// ```ignore,no_run
13532 /// # use google_cloud_retail_v2::model::Model;
13533 /// use google_cloud_retail_v2::model::model::DataState;
13534 /// let x0 = Model::new().set_data_state(DataState::DataOk);
13535 /// let x1 = Model::new().set_data_state(DataState::DataError);
13536 /// ```
13537 pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13538 mut self,
13539 v: T,
13540 ) -> Self {
13541 self.data_state = v.into();
13542 self
13543 }
13544
13545 /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13546 ///
13547 /// # Example
13548 /// ```ignore,no_run
13549 /// # use google_cloud_retail_v2::model::Model;
13550 /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13551 /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13552 /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13553 /// ```
13554 pub fn set_filtering_option<
13555 T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13556 >(
13557 mut self,
13558 v: T,
13559 ) -> Self {
13560 self.filtering_option = v.into();
13561 self
13562 }
13563
13564 /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13565 ///
13566 /// # Example
13567 /// ```ignore,no_run
13568 /// # use google_cloud_retail_v2::model::Model;
13569 /// use google_cloud_retail_v2::model::model::ServingConfigList;
13570 /// let x = Model::new()
13571 /// .set_serving_config_lists([
13572 /// ServingConfigList::default()/* use setters */,
13573 /// ServingConfigList::default()/* use (different) setters */,
13574 /// ]);
13575 /// ```
13576 pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13577 where
13578 T: std::iter::IntoIterator<Item = V>,
13579 V: std::convert::Into<crate::model::model::ServingConfigList>,
13580 {
13581 use std::iter::Iterator;
13582 self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13583 self
13584 }
13585
13586 /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13587 ///
13588 /// # Example
13589 /// ```ignore,no_run
13590 /// # use google_cloud_retail_v2::model::Model;
13591 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13592 /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13593 /// ```
13594 pub fn set_model_features_config<T>(mut self, v: T) -> Self
13595 where
13596 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13597 {
13598 self.model_features_config = std::option::Option::Some(v.into());
13599 self
13600 }
13601
13602 /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13603 ///
13604 /// # Example
13605 /// ```ignore,no_run
13606 /// # use google_cloud_retail_v2::model::Model;
13607 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13608 /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13609 /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13610 /// ```
13611 pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13612 where
13613 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13614 {
13615 self.model_features_config = v.map(|x| x.into());
13616 self
13617 }
13618}
13619
13620impl wkt::message::Message for Model {
13621 fn typename() -> &'static str {
13622 "type.googleapis.com/google.cloud.retail.v2.Model"
13623 }
13624}
13625
13626/// Defines additional types related to [Model].
13627pub mod model {
13628 #[allow(unused_imports)]
13629 use super::*;
13630
13631 /// Represents an ordered combination of valid serving configs, which
13632 /// can be used for `PAGE_OPTIMIZATION` recommendations.
13633 #[derive(Clone, Default, PartialEq)]
13634 #[non_exhaustive]
13635 pub struct ServingConfigList {
13636 /// Optional. A set of valid serving configs that may be used for
13637 /// `PAGE_OPTIMIZATION`.
13638 pub serving_config_ids: std::vec::Vec<std::string::String>,
13639
13640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13641 }
13642
13643 impl ServingConfigList {
13644 /// Creates a new default instance.
13645 pub fn new() -> Self {
13646 std::default::Default::default()
13647 }
13648
13649 /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13650 ///
13651 /// # Example
13652 /// ```ignore,no_run
13653 /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13654 /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13655 /// ```
13656 pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13657 where
13658 T: std::iter::IntoIterator<Item = V>,
13659 V: std::convert::Into<std::string::String>,
13660 {
13661 use std::iter::Iterator;
13662 self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13663 self
13664 }
13665 }
13666
13667 impl wkt::message::Message for ServingConfigList {
13668 fn typename() -> &'static str {
13669 "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13670 }
13671 }
13672
13673 /// Additional configs for the frequently-bought-together model type.
13674 #[derive(Clone, Default, PartialEq)]
13675 #[non_exhaustive]
13676 pub struct FrequentlyBoughtTogetherFeaturesConfig {
13677 /// Optional. Specifies the context of the model when it is used in predict
13678 /// requests. Can only be set for the `frequently-bought-together` type. If
13679 /// it isn't specified, it defaults to
13680 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13681 ///
13682 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13683 pub context_products_type: crate::model::model::ContextProductsType,
13684
13685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13686 }
13687
13688 impl FrequentlyBoughtTogetherFeaturesConfig {
13689 /// Creates a new default instance.
13690 pub fn new() -> Self {
13691 std::default::Default::default()
13692 }
13693
13694 /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13695 ///
13696 /// # Example
13697 /// ```ignore,no_run
13698 /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13699 /// use google_cloud_retail_v2::model::model::ContextProductsType;
13700 /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13701 /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13702 /// ```
13703 pub fn set_context_products_type<
13704 T: std::convert::Into<crate::model::model::ContextProductsType>,
13705 >(
13706 mut self,
13707 v: T,
13708 ) -> Self {
13709 self.context_products_type = v.into();
13710 self
13711 }
13712 }
13713
13714 impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13715 fn typename() -> &'static str {
13716 "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13717 }
13718 }
13719
13720 /// Additional model features config.
13721 #[derive(Clone, Default, PartialEq)]
13722 #[non_exhaustive]
13723 pub struct ModelFeaturesConfig {
13724 #[allow(missing_docs)]
13725 pub type_dedicated_config:
13726 std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13727
13728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13729 }
13730
13731 impl ModelFeaturesConfig {
13732 /// Creates a new default instance.
13733 pub fn new() -> Self {
13734 std::default::Default::default()
13735 }
13736
13737 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13738 ///
13739 /// Note that all the setters affecting `type_dedicated_config` are mutually
13740 /// exclusive.
13741 ///
13742 /// # Example
13743 /// ```ignore,no_run
13744 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13745 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13746 /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13747 /// google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13748 /// ```
13749 pub fn set_type_dedicated_config<
13750 T: std::convert::Into<
13751 std::option::Option<
13752 crate::model::model::model_features_config::TypeDedicatedConfig,
13753 >,
13754 >,
13755 >(
13756 mut self,
13757 v: T,
13758 ) -> Self {
13759 self.type_dedicated_config = v.into();
13760 self
13761 }
13762
13763 /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13764 /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13765 /// holds a different branch.
13766 pub fn frequently_bought_together_config(
13767 &self,
13768 ) -> std::option::Option<
13769 &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13770 > {
13771 #[allow(unreachable_patterns)]
13772 self.type_dedicated_config.as_ref().and_then(|v| match v {
13773 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13774 _ => std::option::Option::None,
13775 })
13776 }
13777
13778 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13779 /// to hold a `FrequentlyBoughtTogetherConfig`.
13780 ///
13781 /// Note that all the setters affecting `type_dedicated_config` are
13782 /// mutually exclusive.
13783 ///
13784 /// # Example
13785 /// ```ignore,no_run
13786 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13787 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13788 /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13789 /// assert!(x.frequently_bought_together_config().is_some());
13790 /// ```
13791 pub fn set_frequently_bought_together_config<
13792 T: std::convert::Into<
13793 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13794 >,
13795 >(
13796 mut self,
13797 v: T,
13798 ) -> Self {
13799 self.type_dedicated_config = std::option::Option::Some(
13800 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13801 v.into()
13802 )
13803 );
13804 self
13805 }
13806 }
13807
13808 impl wkt::message::Message for ModelFeaturesConfig {
13809 fn typename() -> &'static str {
13810 "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13811 }
13812 }
13813
13814 /// Defines additional types related to [ModelFeaturesConfig].
13815 pub mod model_features_config {
13816 #[allow(unused_imports)]
13817 use super::*;
13818
13819 #[allow(missing_docs)]
13820 #[derive(Clone, Debug, PartialEq)]
13821 #[non_exhaustive]
13822 pub enum TypeDedicatedConfig {
13823 /// Additional configs for frequently-bought-together models.
13824 FrequentlyBoughtTogetherConfig(
13825 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13826 ),
13827 }
13828 }
13829
13830 /// The serving state of the model.
13831 ///
13832 /// # Working with unknown values
13833 ///
13834 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13835 /// additional enum variants at any time. Adding new variants is not considered
13836 /// a breaking change. Applications should write their code in anticipation of:
13837 ///
13838 /// - New values appearing in future releases of the client library, **and**
13839 /// - New values received dynamically, without application changes.
13840 ///
13841 /// Please consult the [Working with enums] section in the user guide for some
13842 /// guidelines.
13843 ///
13844 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13845 #[derive(Clone, Debug, PartialEq)]
13846 #[non_exhaustive]
13847 pub enum ServingState {
13848 /// Unspecified serving state.
13849 Unspecified,
13850 /// The model is not serving.
13851 Inactive,
13852 /// The model is serving and can be queried.
13853 Active,
13854 /// The model is trained on tuned hyperparameters and can be
13855 /// queried.
13856 Tuned,
13857 /// If set, the enum was initialized with an unknown value.
13858 ///
13859 /// Applications can examine the value using [ServingState::value] or
13860 /// [ServingState::name].
13861 UnknownValue(serving_state::UnknownValue),
13862 }
13863
13864 #[doc(hidden)]
13865 pub mod serving_state {
13866 #[allow(unused_imports)]
13867 use super::*;
13868 #[derive(Clone, Debug, PartialEq)]
13869 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13870 }
13871
13872 impl ServingState {
13873 /// Gets the enum value.
13874 ///
13875 /// Returns `None` if the enum contains an unknown value deserialized from
13876 /// the string representation of enums.
13877 pub fn value(&self) -> std::option::Option<i32> {
13878 match self {
13879 Self::Unspecified => std::option::Option::Some(0),
13880 Self::Inactive => std::option::Option::Some(1),
13881 Self::Active => std::option::Option::Some(2),
13882 Self::Tuned => std::option::Option::Some(3),
13883 Self::UnknownValue(u) => u.0.value(),
13884 }
13885 }
13886
13887 /// Gets the enum value as a string.
13888 ///
13889 /// Returns `None` if the enum contains an unknown value deserialized from
13890 /// the integer representation of enums.
13891 pub fn name(&self) -> std::option::Option<&str> {
13892 match self {
13893 Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13894 Self::Inactive => std::option::Option::Some("INACTIVE"),
13895 Self::Active => std::option::Option::Some("ACTIVE"),
13896 Self::Tuned => std::option::Option::Some("TUNED"),
13897 Self::UnknownValue(u) => u.0.name(),
13898 }
13899 }
13900 }
13901
13902 impl std::default::Default for ServingState {
13903 fn default() -> Self {
13904 use std::convert::From;
13905 Self::from(0)
13906 }
13907 }
13908
13909 impl std::fmt::Display for ServingState {
13910 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13911 wkt::internal::display_enum(f, self.name(), self.value())
13912 }
13913 }
13914
13915 impl std::convert::From<i32> for ServingState {
13916 fn from(value: i32) -> Self {
13917 match value {
13918 0 => Self::Unspecified,
13919 1 => Self::Inactive,
13920 2 => Self::Active,
13921 3 => Self::Tuned,
13922 _ => Self::UnknownValue(serving_state::UnknownValue(
13923 wkt::internal::UnknownEnumValue::Integer(value),
13924 )),
13925 }
13926 }
13927 }
13928
13929 impl std::convert::From<&str> for ServingState {
13930 fn from(value: &str) -> Self {
13931 use std::string::ToString;
13932 match value {
13933 "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
13934 "INACTIVE" => Self::Inactive,
13935 "ACTIVE" => Self::Active,
13936 "TUNED" => Self::Tuned,
13937 _ => Self::UnknownValue(serving_state::UnknownValue(
13938 wkt::internal::UnknownEnumValue::String(value.to_string()),
13939 )),
13940 }
13941 }
13942 }
13943
13944 impl serde::ser::Serialize for ServingState {
13945 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13946 where
13947 S: serde::Serializer,
13948 {
13949 match self {
13950 Self::Unspecified => serializer.serialize_i32(0),
13951 Self::Inactive => serializer.serialize_i32(1),
13952 Self::Active => serializer.serialize_i32(2),
13953 Self::Tuned => serializer.serialize_i32(3),
13954 Self::UnknownValue(u) => u.0.serialize(serializer),
13955 }
13956 }
13957 }
13958
13959 impl<'de> serde::de::Deserialize<'de> for ServingState {
13960 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13961 where
13962 D: serde::Deserializer<'de>,
13963 {
13964 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
13965 ".google.cloud.retail.v2.Model.ServingState",
13966 ))
13967 }
13968 }
13969
13970 /// The training state of the model.
13971 ///
13972 /// # Working with unknown values
13973 ///
13974 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13975 /// additional enum variants at any time. Adding new variants is not considered
13976 /// a breaking change. Applications should write their code in anticipation of:
13977 ///
13978 /// - New values appearing in future releases of the client library, **and**
13979 /// - New values received dynamically, without application changes.
13980 ///
13981 /// Please consult the [Working with enums] section in the user guide for some
13982 /// guidelines.
13983 ///
13984 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13985 #[derive(Clone, Debug, PartialEq)]
13986 #[non_exhaustive]
13987 pub enum TrainingState {
13988 /// Unspecified training state.
13989 Unspecified,
13990 /// The model training is paused.
13991 Paused,
13992 /// The model is training.
13993 Training,
13994 /// If set, the enum was initialized with an unknown value.
13995 ///
13996 /// Applications can examine the value using [TrainingState::value] or
13997 /// [TrainingState::name].
13998 UnknownValue(training_state::UnknownValue),
13999 }
14000
14001 #[doc(hidden)]
14002 pub mod training_state {
14003 #[allow(unused_imports)]
14004 use super::*;
14005 #[derive(Clone, Debug, PartialEq)]
14006 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14007 }
14008
14009 impl TrainingState {
14010 /// Gets the enum value.
14011 ///
14012 /// Returns `None` if the enum contains an unknown value deserialized from
14013 /// the string representation of enums.
14014 pub fn value(&self) -> std::option::Option<i32> {
14015 match self {
14016 Self::Unspecified => std::option::Option::Some(0),
14017 Self::Paused => std::option::Option::Some(1),
14018 Self::Training => std::option::Option::Some(2),
14019 Self::UnknownValue(u) => u.0.value(),
14020 }
14021 }
14022
14023 /// Gets the enum value as a string.
14024 ///
14025 /// Returns `None` if the enum contains an unknown value deserialized from
14026 /// the integer representation of enums.
14027 pub fn name(&self) -> std::option::Option<&str> {
14028 match self {
14029 Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
14030 Self::Paused => std::option::Option::Some("PAUSED"),
14031 Self::Training => std::option::Option::Some("TRAINING"),
14032 Self::UnknownValue(u) => u.0.name(),
14033 }
14034 }
14035 }
14036
14037 impl std::default::Default for TrainingState {
14038 fn default() -> Self {
14039 use std::convert::From;
14040 Self::from(0)
14041 }
14042 }
14043
14044 impl std::fmt::Display for TrainingState {
14045 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14046 wkt::internal::display_enum(f, self.name(), self.value())
14047 }
14048 }
14049
14050 impl std::convert::From<i32> for TrainingState {
14051 fn from(value: i32) -> Self {
14052 match value {
14053 0 => Self::Unspecified,
14054 1 => Self::Paused,
14055 2 => Self::Training,
14056 _ => Self::UnknownValue(training_state::UnknownValue(
14057 wkt::internal::UnknownEnumValue::Integer(value),
14058 )),
14059 }
14060 }
14061 }
14062
14063 impl std::convert::From<&str> for TrainingState {
14064 fn from(value: &str) -> Self {
14065 use std::string::ToString;
14066 match value {
14067 "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
14068 "PAUSED" => Self::Paused,
14069 "TRAINING" => Self::Training,
14070 _ => Self::UnknownValue(training_state::UnknownValue(
14071 wkt::internal::UnknownEnumValue::String(value.to_string()),
14072 )),
14073 }
14074 }
14075 }
14076
14077 impl serde::ser::Serialize for TrainingState {
14078 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14079 where
14080 S: serde::Serializer,
14081 {
14082 match self {
14083 Self::Unspecified => serializer.serialize_i32(0),
14084 Self::Paused => serializer.serialize_i32(1),
14085 Self::Training => serializer.serialize_i32(2),
14086 Self::UnknownValue(u) => u.0.serialize(serializer),
14087 }
14088 }
14089 }
14090
14091 impl<'de> serde::de::Deserialize<'de> for TrainingState {
14092 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14093 where
14094 D: serde::Deserializer<'de>,
14095 {
14096 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
14097 ".google.cloud.retail.v2.Model.TrainingState",
14098 ))
14099 }
14100 }
14101
14102 /// Describes whether periodic tuning is enabled for this model
14103 /// or not. Periodic tuning is scheduled at most every three months. You can
14104 /// start a tuning process manually by using the `TuneModel`
14105 /// method, which starts a tuning process immediately and resets the quarterly
14106 /// schedule. Enabling or disabling periodic tuning does not affect any
14107 /// current tuning processes.
14108 ///
14109 /// # Working with unknown values
14110 ///
14111 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14112 /// additional enum variants at any time. Adding new variants is not considered
14113 /// a breaking change. Applications should write their code in anticipation of:
14114 ///
14115 /// - New values appearing in future releases of the client library, **and**
14116 /// - New values received dynamically, without application changes.
14117 ///
14118 /// Please consult the [Working with enums] section in the user guide for some
14119 /// guidelines.
14120 ///
14121 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14122 #[derive(Clone, Debug, PartialEq)]
14123 #[non_exhaustive]
14124 pub enum PeriodicTuningState {
14125 /// Unspecified default value, should never be explicitly set.
14126 Unspecified,
14127 /// The model has periodic tuning disabled. Tuning
14128 /// can be reenabled by calling the `EnableModelPeriodicTuning`
14129 /// method or by calling the `TuneModel` method.
14130 PeriodicTuningDisabled,
14131 /// The model cannot be tuned with periodic tuning OR the
14132 /// `TuneModel` method. Hide the options in customer UI and
14133 /// reject any requests through the backend self serve API.
14134 AllTuningDisabled,
14135 /// The model has periodic tuning enabled. Tuning
14136 /// can be disabled by calling the `DisableModelPeriodicTuning`
14137 /// method.
14138 PeriodicTuningEnabled,
14139 /// If set, the enum was initialized with an unknown value.
14140 ///
14141 /// Applications can examine the value using [PeriodicTuningState::value] or
14142 /// [PeriodicTuningState::name].
14143 UnknownValue(periodic_tuning_state::UnknownValue),
14144 }
14145
14146 #[doc(hidden)]
14147 pub mod periodic_tuning_state {
14148 #[allow(unused_imports)]
14149 use super::*;
14150 #[derive(Clone, Debug, PartialEq)]
14151 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14152 }
14153
14154 impl PeriodicTuningState {
14155 /// Gets the enum value.
14156 ///
14157 /// Returns `None` if the enum contains an unknown value deserialized from
14158 /// the string representation of enums.
14159 pub fn value(&self) -> std::option::Option<i32> {
14160 match self {
14161 Self::Unspecified => std::option::Option::Some(0),
14162 Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14163 Self::AllTuningDisabled => std::option::Option::Some(3),
14164 Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14165 Self::UnknownValue(u) => u.0.value(),
14166 }
14167 }
14168
14169 /// Gets the enum value as a string.
14170 ///
14171 /// Returns `None` if the enum contains an unknown value deserialized from
14172 /// the integer representation of enums.
14173 pub fn name(&self) -> std::option::Option<&str> {
14174 match self {
14175 Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14176 Self::PeriodicTuningDisabled => {
14177 std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14178 }
14179 Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14180 Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14181 Self::UnknownValue(u) => u.0.name(),
14182 }
14183 }
14184 }
14185
14186 impl std::default::Default for PeriodicTuningState {
14187 fn default() -> Self {
14188 use std::convert::From;
14189 Self::from(0)
14190 }
14191 }
14192
14193 impl std::fmt::Display for PeriodicTuningState {
14194 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14195 wkt::internal::display_enum(f, self.name(), self.value())
14196 }
14197 }
14198
14199 impl std::convert::From<i32> for PeriodicTuningState {
14200 fn from(value: i32) -> Self {
14201 match value {
14202 0 => Self::Unspecified,
14203 1 => Self::PeriodicTuningDisabled,
14204 2 => Self::PeriodicTuningEnabled,
14205 3 => Self::AllTuningDisabled,
14206 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14207 wkt::internal::UnknownEnumValue::Integer(value),
14208 )),
14209 }
14210 }
14211 }
14212
14213 impl std::convert::From<&str> for PeriodicTuningState {
14214 fn from(value: &str) -> Self {
14215 use std::string::ToString;
14216 match value {
14217 "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14218 "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14219 "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14220 "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14221 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14222 wkt::internal::UnknownEnumValue::String(value.to_string()),
14223 )),
14224 }
14225 }
14226 }
14227
14228 impl serde::ser::Serialize for PeriodicTuningState {
14229 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14230 where
14231 S: serde::Serializer,
14232 {
14233 match self {
14234 Self::Unspecified => serializer.serialize_i32(0),
14235 Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14236 Self::AllTuningDisabled => serializer.serialize_i32(3),
14237 Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14238 Self::UnknownValue(u) => u.0.serialize(serializer),
14239 }
14240 }
14241 }
14242
14243 impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14244 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14245 where
14246 D: serde::Deserializer<'de>,
14247 {
14248 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14249 ".google.cloud.retail.v2.Model.PeriodicTuningState",
14250 ))
14251 }
14252 }
14253
14254 /// Describes whether this model have sufficient training data
14255 /// to be continuously trained.
14256 ///
14257 /// # Working with unknown values
14258 ///
14259 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14260 /// additional enum variants at any time. Adding new variants is not considered
14261 /// a breaking change. Applications should write their code in anticipation of:
14262 ///
14263 /// - New values appearing in future releases of the client library, **and**
14264 /// - New values received dynamically, without application changes.
14265 ///
14266 /// Please consult the [Working with enums] section in the user guide for some
14267 /// guidelines.
14268 ///
14269 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14270 #[derive(Clone, Debug, PartialEq)]
14271 #[non_exhaustive]
14272 pub enum DataState {
14273 /// Unspecified default value, should never be explicitly set.
14274 Unspecified,
14275 /// The model has sufficient training data.
14276 DataOk,
14277 /// The model does not have sufficient training data. Error
14278 /// messages can be queried via Stackdriver.
14279 DataError,
14280 /// If set, the enum was initialized with an unknown value.
14281 ///
14282 /// Applications can examine the value using [DataState::value] or
14283 /// [DataState::name].
14284 UnknownValue(data_state::UnknownValue),
14285 }
14286
14287 #[doc(hidden)]
14288 pub mod data_state {
14289 #[allow(unused_imports)]
14290 use super::*;
14291 #[derive(Clone, Debug, PartialEq)]
14292 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14293 }
14294
14295 impl DataState {
14296 /// Gets the enum value.
14297 ///
14298 /// Returns `None` if the enum contains an unknown value deserialized from
14299 /// the string representation of enums.
14300 pub fn value(&self) -> std::option::Option<i32> {
14301 match self {
14302 Self::Unspecified => std::option::Option::Some(0),
14303 Self::DataOk => std::option::Option::Some(1),
14304 Self::DataError => std::option::Option::Some(2),
14305 Self::UnknownValue(u) => u.0.value(),
14306 }
14307 }
14308
14309 /// Gets the enum value as a string.
14310 ///
14311 /// Returns `None` if the enum contains an unknown value deserialized from
14312 /// the integer representation of enums.
14313 pub fn name(&self) -> std::option::Option<&str> {
14314 match self {
14315 Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14316 Self::DataOk => std::option::Option::Some("DATA_OK"),
14317 Self::DataError => std::option::Option::Some("DATA_ERROR"),
14318 Self::UnknownValue(u) => u.0.name(),
14319 }
14320 }
14321 }
14322
14323 impl std::default::Default for DataState {
14324 fn default() -> Self {
14325 use std::convert::From;
14326 Self::from(0)
14327 }
14328 }
14329
14330 impl std::fmt::Display for DataState {
14331 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14332 wkt::internal::display_enum(f, self.name(), self.value())
14333 }
14334 }
14335
14336 impl std::convert::From<i32> for DataState {
14337 fn from(value: i32) -> Self {
14338 match value {
14339 0 => Self::Unspecified,
14340 1 => Self::DataOk,
14341 2 => Self::DataError,
14342 _ => Self::UnknownValue(data_state::UnknownValue(
14343 wkt::internal::UnknownEnumValue::Integer(value),
14344 )),
14345 }
14346 }
14347 }
14348
14349 impl std::convert::From<&str> for DataState {
14350 fn from(value: &str) -> Self {
14351 use std::string::ToString;
14352 match value {
14353 "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14354 "DATA_OK" => Self::DataOk,
14355 "DATA_ERROR" => Self::DataError,
14356 _ => Self::UnknownValue(data_state::UnknownValue(
14357 wkt::internal::UnknownEnumValue::String(value.to_string()),
14358 )),
14359 }
14360 }
14361 }
14362
14363 impl serde::ser::Serialize for DataState {
14364 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14365 where
14366 S: serde::Serializer,
14367 {
14368 match self {
14369 Self::Unspecified => serializer.serialize_i32(0),
14370 Self::DataOk => serializer.serialize_i32(1),
14371 Self::DataError => serializer.serialize_i32(2),
14372 Self::UnknownValue(u) => u.0.serialize(serializer),
14373 }
14374 }
14375 }
14376
14377 impl<'de> serde::de::Deserialize<'de> for DataState {
14378 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14379 where
14380 D: serde::Deserializer<'de>,
14381 {
14382 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14383 ".google.cloud.retail.v2.Model.DataState",
14384 ))
14385 }
14386 }
14387
14388 /// Use single or multiple context products for recommendations.
14389 ///
14390 /// # Working with unknown values
14391 ///
14392 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14393 /// additional enum variants at any time. Adding new variants is not considered
14394 /// a breaking change. Applications should write their code in anticipation of:
14395 ///
14396 /// - New values appearing in future releases of the client library, **and**
14397 /// - New values received dynamically, without application changes.
14398 ///
14399 /// Please consult the [Working with enums] section in the user guide for some
14400 /// guidelines.
14401 ///
14402 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14403 #[derive(Clone, Debug, PartialEq)]
14404 #[non_exhaustive]
14405 pub enum ContextProductsType {
14406 /// Unspecified default value, should never be explicitly set.
14407 /// Defaults to
14408 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14409 ///
14410 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14411 Unspecified,
14412 /// Use only a single product as context for the recommendation. Typically
14413 /// used on pages like add-to-cart or product details.
14414 SingleContextProduct,
14415 /// Use one or multiple products as context for the recommendation. Typically
14416 /// used on shopping cart pages.
14417 MultipleContextProducts,
14418 /// If set, the enum was initialized with an unknown value.
14419 ///
14420 /// Applications can examine the value using [ContextProductsType::value] or
14421 /// [ContextProductsType::name].
14422 UnknownValue(context_products_type::UnknownValue),
14423 }
14424
14425 #[doc(hidden)]
14426 pub mod context_products_type {
14427 #[allow(unused_imports)]
14428 use super::*;
14429 #[derive(Clone, Debug, PartialEq)]
14430 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14431 }
14432
14433 impl ContextProductsType {
14434 /// Gets the enum value.
14435 ///
14436 /// Returns `None` if the enum contains an unknown value deserialized from
14437 /// the string representation of enums.
14438 pub fn value(&self) -> std::option::Option<i32> {
14439 match self {
14440 Self::Unspecified => std::option::Option::Some(0),
14441 Self::SingleContextProduct => std::option::Option::Some(1),
14442 Self::MultipleContextProducts => std::option::Option::Some(2),
14443 Self::UnknownValue(u) => u.0.value(),
14444 }
14445 }
14446
14447 /// Gets the enum value as a string.
14448 ///
14449 /// Returns `None` if the enum contains an unknown value deserialized from
14450 /// the integer representation of enums.
14451 pub fn name(&self) -> std::option::Option<&str> {
14452 match self {
14453 Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14454 Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14455 Self::MultipleContextProducts => {
14456 std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14457 }
14458 Self::UnknownValue(u) => u.0.name(),
14459 }
14460 }
14461 }
14462
14463 impl std::default::Default for ContextProductsType {
14464 fn default() -> Self {
14465 use std::convert::From;
14466 Self::from(0)
14467 }
14468 }
14469
14470 impl std::fmt::Display for ContextProductsType {
14471 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14472 wkt::internal::display_enum(f, self.name(), self.value())
14473 }
14474 }
14475
14476 impl std::convert::From<i32> for ContextProductsType {
14477 fn from(value: i32) -> Self {
14478 match value {
14479 0 => Self::Unspecified,
14480 1 => Self::SingleContextProduct,
14481 2 => Self::MultipleContextProducts,
14482 _ => Self::UnknownValue(context_products_type::UnknownValue(
14483 wkt::internal::UnknownEnumValue::Integer(value),
14484 )),
14485 }
14486 }
14487 }
14488
14489 impl std::convert::From<&str> for ContextProductsType {
14490 fn from(value: &str) -> Self {
14491 use std::string::ToString;
14492 match value {
14493 "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14494 "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14495 "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14496 _ => Self::UnknownValue(context_products_type::UnknownValue(
14497 wkt::internal::UnknownEnumValue::String(value.to_string()),
14498 )),
14499 }
14500 }
14501 }
14502
14503 impl serde::ser::Serialize for ContextProductsType {
14504 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14505 where
14506 S: serde::Serializer,
14507 {
14508 match self {
14509 Self::Unspecified => serializer.serialize_i32(0),
14510 Self::SingleContextProduct => serializer.serialize_i32(1),
14511 Self::MultipleContextProducts => serializer.serialize_i32(2),
14512 Self::UnknownValue(u) => u.0.serialize(serializer),
14513 }
14514 }
14515 }
14516
14517 impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14518 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14519 where
14520 D: serde::Deserializer<'de>,
14521 {
14522 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14523 ".google.cloud.retail.v2.Model.ContextProductsType",
14524 ))
14525 }
14526 }
14527}
14528
14529/// Request for creating a model.
14530#[derive(Clone, Default, PartialEq)]
14531#[non_exhaustive]
14532pub struct CreateModelRequest {
14533 /// Required. The parent resource under which to create the model. Format:
14534 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14535 pub parent: std::string::String,
14536
14537 /// Required. The payload of the [Model][google.cloud.retail.v2.Model] to
14538 /// create.
14539 ///
14540 /// [google.cloud.retail.v2.Model]: crate::model::Model
14541 pub model: std::option::Option<crate::model::Model>,
14542
14543 /// Optional. Whether to run a dry run to validate the request (without
14544 /// actually creating the model).
14545 pub dry_run: bool,
14546
14547 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14548}
14549
14550impl CreateModelRequest {
14551 /// Creates a new default instance.
14552 pub fn new() -> Self {
14553 std::default::Default::default()
14554 }
14555
14556 /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14557 ///
14558 /// # Example
14559 /// ```ignore,no_run
14560 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14561 /// let x = CreateModelRequest::new().set_parent("example");
14562 /// ```
14563 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14564 self.parent = v.into();
14565 self
14566 }
14567
14568 /// Sets the value of [model][crate::model::CreateModelRequest::model].
14569 ///
14570 /// # Example
14571 /// ```ignore,no_run
14572 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14573 /// use google_cloud_retail_v2::model::Model;
14574 /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14575 /// ```
14576 pub fn set_model<T>(mut self, v: T) -> Self
14577 where
14578 T: std::convert::Into<crate::model::Model>,
14579 {
14580 self.model = std::option::Option::Some(v.into());
14581 self
14582 }
14583
14584 /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14585 ///
14586 /// # Example
14587 /// ```ignore,no_run
14588 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14589 /// use google_cloud_retail_v2::model::Model;
14590 /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14591 /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14592 /// ```
14593 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14594 where
14595 T: std::convert::Into<crate::model::Model>,
14596 {
14597 self.model = v.map(|x| x.into());
14598 self
14599 }
14600
14601 /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14602 ///
14603 /// # Example
14604 /// ```ignore,no_run
14605 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14606 /// let x = CreateModelRequest::new().set_dry_run(true);
14607 /// ```
14608 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14609 self.dry_run = v.into();
14610 self
14611 }
14612}
14613
14614impl wkt::message::Message for CreateModelRequest {
14615 fn typename() -> &'static str {
14616 "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14617 }
14618}
14619
14620/// Request for updating an existing model.
14621#[derive(Clone, Default, PartialEq)]
14622#[non_exhaustive]
14623pub struct UpdateModelRequest {
14624 /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14625 ///
14626 /// [google.cloud.retail.v2.Model]: crate::model::Model
14627 pub model: std::option::Option<crate::model::Model>,
14628
14629 /// Optional. Indicates which fields in the provided 'model' to
14630 /// update. If not set, by default updates all fields.
14631 pub update_mask: std::option::Option<wkt::FieldMask>,
14632
14633 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14634}
14635
14636impl UpdateModelRequest {
14637 /// Creates a new default instance.
14638 pub fn new() -> Self {
14639 std::default::Default::default()
14640 }
14641
14642 /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14643 ///
14644 /// # Example
14645 /// ```ignore,no_run
14646 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14647 /// use google_cloud_retail_v2::model::Model;
14648 /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14649 /// ```
14650 pub fn set_model<T>(mut self, v: T) -> Self
14651 where
14652 T: std::convert::Into<crate::model::Model>,
14653 {
14654 self.model = std::option::Option::Some(v.into());
14655 self
14656 }
14657
14658 /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14659 ///
14660 /// # Example
14661 /// ```ignore,no_run
14662 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14663 /// use google_cloud_retail_v2::model::Model;
14664 /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14665 /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14666 /// ```
14667 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14668 where
14669 T: std::convert::Into<crate::model::Model>,
14670 {
14671 self.model = v.map(|x| x.into());
14672 self
14673 }
14674
14675 /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14676 ///
14677 /// # Example
14678 /// ```ignore,no_run
14679 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14680 /// use wkt::FieldMask;
14681 /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14682 /// ```
14683 pub fn set_update_mask<T>(mut self, v: T) -> Self
14684 where
14685 T: std::convert::Into<wkt::FieldMask>,
14686 {
14687 self.update_mask = std::option::Option::Some(v.into());
14688 self
14689 }
14690
14691 /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14692 ///
14693 /// # Example
14694 /// ```ignore,no_run
14695 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14696 /// use wkt::FieldMask;
14697 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14698 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14699 /// ```
14700 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14701 where
14702 T: std::convert::Into<wkt::FieldMask>,
14703 {
14704 self.update_mask = v.map(|x| x.into());
14705 self
14706 }
14707}
14708
14709impl wkt::message::Message for UpdateModelRequest {
14710 fn typename() -> &'static str {
14711 "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14712 }
14713}
14714
14715/// Request for getting a model.
14716#[derive(Clone, Default, PartialEq)]
14717#[non_exhaustive]
14718pub struct GetModelRequest {
14719 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14720 /// get. Format:
14721 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14722 ///
14723 /// [google.cloud.retail.v2.Model]: crate::model::Model
14724 pub name: std::string::String,
14725
14726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14727}
14728
14729impl GetModelRequest {
14730 /// Creates a new default instance.
14731 pub fn new() -> Self {
14732 std::default::Default::default()
14733 }
14734
14735 /// Sets the value of [name][crate::model::GetModelRequest::name].
14736 ///
14737 /// # Example
14738 /// ```ignore,no_run
14739 /// # use google_cloud_retail_v2::model::GetModelRequest;
14740 /// let x = GetModelRequest::new().set_name("example");
14741 /// ```
14742 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14743 self.name = v.into();
14744 self
14745 }
14746}
14747
14748impl wkt::message::Message for GetModelRequest {
14749 fn typename() -> &'static str {
14750 "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14751 }
14752}
14753
14754/// Request for pausing training of a model.
14755#[derive(Clone, Default, PartialEq)]
14756#[non_exhaustive]
14757pub struct PauseModelRequest {
14758 /// Required. The name of the model to pause.
14759 /// Format:
14760 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14761 pub name: std::string::String,
14762
14763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14764}
14765
14766impl PauseModelRequest {
14767 /// Creates a new default instance.
14768 pub fn new() -> Self {
14769 std::default::Default::default()
14770 }
14771
14772 /// Sets the value of [name][crate::model::PauseModelRequest::name].
14773 ///
14774 /// # Example
14775 /// ```ignore,no_run
14776 /// # use google_cloud_retail_v2::model::PauseModelRequest;
14777 /// let x = PauseModelRequest::new().set_name("example");
14778 /// ```
14779 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14780 self.name = v.into();
14781 self
14782 }
14783}
14784
14785impl wkt::message::Message for PauseModelRequest {
14786 fn typename() -> &'static str {
14787 "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14788 }
14789}
14790
14791/// Request for resuming training of a model.
14792#[derive(Clone, Default, PartialEq)]
14793#[non_exhaustive]
14794pub struct ResumeModelRequest {
14795 /// Required. The name of the model to resume.
14796 /// Format:
14797 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14798 pub name: std::string::String,
14799
14800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14801}
14802
14803impl ResumeModelRequest {
14804 /// Creates a new default instance.
14805 pub fn new() -> Self {
14806 std::default::Default::default()
14807 }
14808
14809 /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14810 ///
14811 /// # Example
14812 /// ```ignore,no_run
14813 /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14814 /// let x = ResumeModelRequest::new().set_name("example");
14815 /// ```
14816 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14817 self.name = v.into();
14818 self
14819 }
14820}
14821
14822impl wkt::message::Message for ResumeModelRequest {
14823 fn typename() -> &'static str {
14824 "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14825 }
14826}
14827
14828/// Request for listing models associated with a resource.
14829#[derive(Clone, Default, PartialEq)]
14830#[non_exhaustive]
14831pub struct ListModelsRequest {
14832 /// Required. The parent for which to list models.
14833 /// Format:
14834 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14835 pub parent: std::string::String,
14836
14837 /// Optional. Maximum number of results to return. If unspecified, defaults
14838 /// to 50. Max allowed value is 1000.
14839 pub page_size: i32,
14840
14841 /// Optional. A page token, received from a previous `ListModels`
14842 /// call. Provide this to retrieve the subsequent page.
14843 pub page_token: std::string::String,
14844
14845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14846}
14847
14848impl ListModelsRequest {
14849 /// Creates a new default instance.
14850 pub fn new() -> Self {
14851 std::default::Default::default()
14852 }
14853
14854 /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14855 ///
14856 /// # Example
14857 /// ```ignore,no_run
14858 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14859 /// let x = ListModelsRequest::new().set_parent("example");
14860 /// ```
14861 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14862 self.parent = v.into();
14863 self
14864 }
14865
14866 /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14867 ///
14868 /// # Example
14869 /// ```ignore,no_run
14870 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14871 /// let x = ListModelsRequest::new().set_page_size(42);
14872 /// ```
14873 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14874 self.page_size = v.into();
14875 self
14876 }
14877
14878 /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14879 ///
14880 /// # Example
14881 /// ```ignore,no_run
14882 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14883 /// let x = ListModelsRequest::new().set_page_token("example");
14884 /// ```
14885 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14886 self.page_token = v.into();
14887 self
14888 }
14889}
14890
14891impl wkt::message::Message for ListModelsRequest {
14892 fn typename() -> &'static str {
14893 "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14894 }
14895}
14896
14897/// Request for deleting a model.
14898#[derive(Clone, Default, PartialEq)]
14899#[non_exhaustive]
14900pub struct DeleteModelRequest {
14901 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14902 /// delete. Format:
14903 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14904 ///
14905 /// [google.cloud.retail.v2.Model]: crate::model::Model
14906 pub name: std::string::String,
14907
14908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14909}
14910
14911impl DeleteModelRequest {
14912 /// Creates a new default instance.
14913 pub fn new() -> Self {
14914 std::default::Default::default()
14915 }
14916
14917 /// Sets the value of [name][crate::model::DeleteModelRequest::name].
14918 ///
14919 /// # Example
14920 /// ```ignore,no_run
14921 /// # use google_cloud_retail_v2::model::DeleteModelRequest;
14922 /// let x = DeleteModelRequest::new().set_name("example");
14923 /// ```
14924 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14925 self.name = v.into();
14926 self
14927 }
14928}
14929
14930impl wkt::message::Message for DeleteModelRequest {
14931 fn typename() -> &'static str {
14932 "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
14933 }
14934}
14935
14936/// Response to a ListModelRequest.
14937#[derive(Clone, Default, PartialEq)]
14938#[non_exhaustive]
14939pub struct ListModelsResponse {
14940 /// List of Models.
14941 pub models: std::vec::Vec<crate::model::Model>,
14942
14943 /// Pagination token, if not returned indicates the last page.
14944 pub next_page_token: std::string::String,
14945
14946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14947}
14948
14949impl ListModelsResponse {
14950 /// Creates a new default instance.
14951 pub fn new() -> Self {
14952 std::default::Default::default()
14953 }
14954
14955 /// Sets the value of [models][crate::model::ListModelsResponse::models].
14956 ///
14957 /// # Example
14958 /// ```ignore,no_run
14959 /// # use google_cloud_retail_v2::model::ListModelsResponse;
14960 /// use google_cloud_retail_v2::model::Model;
14961 /// let x = ListModelsResponse::new()
14962 /// .set_models([
14963 /// Model::default()/* use setters */,
14964 /// Model::default()/* use (different) setters */,
14965 /// ]);
14966 /// ```
14967 pub fn set_models<T, V>(mut self, v: T) -> Self
14968 where
14969 T: std::iter::IntoIterator<Item = V>,
14970 V: std::convert::Into<crate::model::Model>,
14971 {
14972 use std::iter::Iterator;
14973 self.models = v.into_iter().map(|i| i.into()).collect();
14974 self
14975 }
14976
14977 /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
14978 ///
14979 /// # Example
14980 /// ```ignore,no_run
14981 /// # use google_cloud_retail_v2::model::ListModelsResponse;
14982 /// let x = ListModelsResponse::new().set_next_page_token("example");
14983 /// ```
14984 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14985 self.next_page_token = v.into();
14986 self
14987 }
14988}
14989
14990impl wkt::message::Message for ListModelsResponse {
14991 fn typename() -> &'static str {
14992 "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
14993 }
14994}
14995
14996#[doc(hidden)]
14997impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
14998 type PageItem = crate::model::Model;
14999
15000 fn items(self) -> std::vec::Vec<Self::PageItem> {
15001 self.models
15002 }
15003
15004 fn next_page_token(&self) -> std::string::String {
15005 use std::clone::Clone;
15006 self.next_page_token.clone()
15007 }
15008}
15009
15010/// Request to manually start a tuning process now (instead of waiting for
15011/// the periodically scheduled tuning to happen).
15012#[derive(Clone, Default, PartialEq)]
15013#[non_exhaustive]
15014pub struct TuneModelRequest {
15015 /// Required. The resource name of the model to tune.
15016 /// Format:
15017 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15018 pub name: std::string::String,
15019
15020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15021}
15022
15023impl TuneModelRequest {
15024 /// Creates a new default instance.
15025 pub fn new() -> Self {
15026 std::default::Default::default()
15027 }
15028
15029 /// Sets the value of [name][crate::model::TuneModelRequest::name].
15030 ///
15031 /// # Example
15032 /// ```ignore,no_run
15033 /// # use google_cloud_retail_v2::model::TuneModelRequest;
15034 /// let x = TuneModelRequest::new().set_name("example");
15035 /// ```
15036 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15037 self.name = v.into();
15038 self
15039 }
15040}
15041
15042impl wkt::message::Message for TuneModelRequest {
15043 fn typename() -> &'static str {
15044 "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
15045 }
15046}
15047
15048/// Metadata associated with a create operation.
15049#[derive(Clone, Default, PartialEq)]
15050#[non_exhaustive]
15051pub struct CreateModelMetadata {
15052 /// The resource name of the model that this create applies to.
15053 /// Format:
15054 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15055 pub model: std::string::String,
15056
15057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15058}
15059
15060impl CreateModelMetadata {
15061 /// Creates a new default instance.
15062 pub fn new() -> Self {
15063 std::default::Default::default()
15064 }
15065
15066 /// Sets the value of [model][crate::model::CreateModelMetadata::model].
15067 ///
15068 /// # Example
15069 /// ```ignore,no_run
15070 /// # use google_cloud_retail_v2::model::CreateModelMetadata;
15071 /// let x = CreateModelMetadata::new().set_model("example");
15072 /// ```
15073 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15074 self.model = v.into();
15075 self
15076 }
15077}
15078
15079impl wkt::message::Message for CreateModelMetadata {
15080 fn typename() -> &'static str {
15081 "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
15082 }
15083}
15084
15085/// Metadata associated with a tune operation.
15086#[derive(Clone, Default, PartialEq)]
15087#[non_exhaustive]
15088pub struct TuneModelMetadata {
15089 /// The resource name of the model that this tune applies to.
15090 /// Format:
15091 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15092 pub model: std::string::String,
15093
15094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15095}
15096
15097impl TuneModelMetadata {
15098 /// Creates a new default instance.
15099 pub fn new() -> Self {
15100 std::default::Default::default()
15101 }
15102
15103 /// Sets the value of [model][crate::model::TuneModelMetadata::model].
15104 ///
15105 /// # Example
15106 /// ```ignore,no_run
15107 /// # use google_cloud_retail_v2::model::TuneModelMetadata;
15108 /// let x = TuneModelMetadata::new().set_model("example");
15109 /// ```
15110 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15111 self.model = v.into();
15112 self
15113 }
15114}
15115
15116impl wkt::message::Message for TuneModelMetadata {
15117 fn typename() -> &'static str {
15118 "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
15119 }
15120}
15121
15122/// Response associated with a tune operation.
15123#[derive(Clone, Default, PartialEq)]
15124#[non_exhaustive]
15125pub struct TuneModelResponse {
15126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15127}
15128
15129impl TuneModelResponse {
15130 /// Creates a new default instance.
15131 pub fn new() -> Self {
15132 std::default::Default::default()
15133 }
15134}
15135
15136impl wkt::message::Message for TuneModelResponse {
15137 fn typename() -> &'static str {
15138 "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15139 }
15140}
15141
15142/// Request message for Predict method.
15143#[derive(Clone, Default, PartialEq)]
15144#[non_exhaustive]
15145pub struct PredictRequest {
15146 /// Required. Full resource name of the format:
15147 /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15148 /// or
15149 /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15150 /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15151 /// resource.
15152 /// The ID of the Recommendations AI serving config or placement.
15153 /// Before you can request predictions from your model, you must create at
15154 /// least one serving config or placement for it. For more information, see
15155 /// [Manage serving configs]
15156 /// (<https://cloud.google.com/retail/docs/manage-configs>).
15157 ///
15158 /// The full list of available serving configs can be seen at
15159 /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15160 pub placement: std::string::String,
15161
15162 /// Required. Context about the user, what they are looking at and what action
15163 /// they took to trigger the predict request. Note that this user event detail
15164 /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15165 /// request is required for event logging.
15166 ///
15167 /// Don't set
15168 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15169 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15170 /// fixed ID for different users. If you are trying to receive non-personalized
15171 /// recommendations (not recommended; this can negatively impact model
15172 /// performance), instead set
15173 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15174 /// random unique ID and leave
15175 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15176 ///
15177 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15178 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15179 pub user_event: std::option::Option<crate::model::UserEvent>,
15180
15181 /// Maximum number of results to return. Set this property to the number of
15182 /// prediction results needed. If zero, the service will choose a reasonable
15183 /// default. The maximum allowed value is 100. Values above 100 will be coerced
15184 /// to 100.
15185 pub page_size: i32,
15186
15187 /// This field is not used; leave it unset.
15188 #[deprecated]
15189 pub page_token: std::string::String,
15190
15191 /// Filter for restricting prediction results with a length limit of 5,000
15192 /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15193 ///
15194 /// * Tag expressions. Restricts predictions to products that match all of the
15195 /// specified tags. Boolean operators `OR` and `NOT` are supported if the
15196 /// expression is enclosed in parentheses, and must be separated from the
15197 /// tag values by a space. `-"tagA"` is also supported and is equivalent to
15198 /// `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15199 /// with a size limit of 1,000 characters.
15200 ///
15201 /// Note: "Recently viewed" models don't support tag filtering at the
15202 /// moment.
15203 ///
15204 /// * filterOutOfStockItems. Restricts predictions to products that do not
15205 /// have a
15206 /// stockState value of OUT_OF_STOCK.
15207 ///
15208 ///
15209 /// Examples:
15210 ///
15211 /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15212 /// * filterOutOfStockItems tag=(-"promotional")
15213 /// * filterOutOfStockItems
15214 ///
15215 /// If your filter blocks all prediction results, the API will return *no*
15216 /// results. If instead you want empty result sets to return generic
15217 /// (unfiltered) popular products, set `strictFiltering` to False in
15218 /// `PredictRequest.params`. Note that the API will never return items with
15219 /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15220 ///
15221 /// If `filterSyntaxV2` is set to true under the `params` field, then
15222 /// attribute-based expressions are expected instead of the above described
15223 /// tag-based syntax. Examples:
15224 ///
15225 /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15226 /// * (availability: ANY("IN_STOCK")) AND
15227 /// (colors: ANY("Red") OR categories: ANY("Phones"))
15228 ///
15229 /// For more information, see
15230 /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15231 pub filter: std::string::String,
15232
15233 /// Use validate only mode for this prediction query. If set to true, a
15234 /// dummy model will be used that returns arbitrary products.
15235 /// Note that the validate only mode should only be used for testing the API,
15236 /// or if the model is not ready.
15237 pub validate_only: bool,
15238
15239 /// Additional domain specific parameters for the predictions.
15240 ///
15241 /// Allowed values:
15242 ///
15243 /// * `returnProduct`: Boolean. If set to true, the associated product
15244 /// object will be returned in the `results.metadata` field in the
15245 /// prediction response.
15246 /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15247 /// corresponding to each returned product will be set in the
15248 /// `results.metadata` field in the prediction response. The given
15249 /// 'score' indicates the probability of a product being clicked/purchased
15250 /// given the user's context and history.
15251 /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15252 /// will return generic (unfiltered) popular products instead of empty if
15253 /// your filter blocks all prediction results.
15254 /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15255 /// it needs to be one of {'no-price-reranking', 'low-price-reranking',
15256 /// 'medium-price-reranking', 'high-price-reranking'}. This gives
15257 /// request-level control and adjusts prediction results based on product
15258 /// price.
15259 /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15260 /// it needs to be one of {'no-diversity', 'low-diversity',
15261 /// 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15262 /// request-level control and adjusts prediction results based on product
15263 /// category.
15264 /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15265 /// field is interpreteted according to the new, attribute-based syntax.
15266 pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15267
15268 /// The labels applied to a resource must meet the following requirements:
15269 ///
15270 /// * Each resource can have multiple labels, up to a maximum of 64.
15271 /// * Each label must be a key-value pair.
15272 /// * Keys have a minimum length of 1 character and a maximum length of 63
15273 /// characters and cannot be empty. Values can be empty and have a maximum
15274 /// length of 63 characters.
15275 /// * Keys and values can contain only lowercase letters, numeric characters,
15276 /// underscores, and dashes. All characters must use UTF-8 encoding, and
15277 /// international characters are allowed.
15278 /// * The key portion of a label must be unique. However, you can use the same
15279 /// key with multiple resources.
15280 /// * Keys must start with a lowercase letter or international character.
15281 ///
15282 /// See [Google Cloud
15283 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15284 /// for more details.
15285 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15286
15287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15288}
15289
15290impl PredictRequest {
15291 /// Creates a new default instance.
15292 pub fn new() -> Self {
15293 std::default::Default::default()
15294 }
15295
15296 /// Sets the value of [placement][crate::model::PredictRequest::placement].
15297 ///
15298 /// # Example
15299 /// ```ignore,no_run
15300 /// # use google_cloud_retail_v2::model::PredictRequest;
15301 /// let x = PredictRequest::new().set_placement("example");
15302 /// ```
15303 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15304 self.placement = v.into();
15305 self
15306 }
15307
15308 /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15309 ///
15310 /// # Example
15311 /// ```ignore,no_run
15312 /// # use google_cloud_retail_v2::model::PredictRequest;
15313 /// use google_cloud_retail_v2::model::UserEvent;
15314 /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15315 /// ```
15316 pub fn set_user_event<T>(mut self, v: T) -> Self
15317 where
15318 T: std::convert::Into<crate::model::UserEvent>,
15319 {
15320 self.user_event = std::option::Option::Some(v.into());
15321 self
15322 }
15323
15324 /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15325 ///
15326 /// # Example
15327 /// ```ignore,no_run
15328 /// # use google_cloud_retail_v2::model::PredictRequest;
15329 /// use google_cloud_retail_v2::model::UserEvent;
15330 /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15331 /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15332 /// ```
15333 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15334 where
15335 T: std::convert::Into<crate::model::UserEvent>,
15336 {
15337 self.user_event = v.map(|x| x.into());
15338 self
15339 }
15340
15341 /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15342 ///
15343 /// # Example
15344 /// ```ignore,no_run
15345 /// # use google_cloud_retail_v2::model::PredictRequest;
15346 /// let x = PredictRequest::new().set_page_size(42);
15347 /// ```
15348 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15349 self.page_size = v.into();
15350 self
15351 }
15352
15353 /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15354 ///
15355 /// # Example
15356 /// ```ignore,no_run
15357 /// # use google_cloud_retail_v2::model::PredictRequest;
15358 /// let x = PredictRequest::new().set_page_token("example");
15359 /// ```
15360 #[deprecated]
15361 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15362 self.page_token = v.into();
15363 self
15364 }
15365
15366 /// Sets the value of [filter][crate::model::PredictRequest::filter].
15367 ///
15368 /// # Example
15369 /// ```ignore,no_run
15370 /// # use google_cloud_retail_v2::model::PredictRequest;
15371 /// let x = PredictRequest::new().set_filter("example");
15372 /// ```
15373 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15374 self.filter = v.into();
15375 self
15376 }
15377
15378 /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15379 ///
15380 /// # Example
15381 /// ```ignore,no_run
15382 /// # use google_cloud_retail_v2::model::PredictRequest;
15383 /// let x = PredictRequest::new().set_validate_only(true);
15384 /// ```
15385 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15386 self.validate_only = v.into();
15387 self
15388 }
15389
15390 /// Sets the value of [params][crate::model::PredictRequest::params].
15391 ///
15392 /// # Example
15393 /// ```ignore,no_run
15394 /// # use google_cloud_retail_v2::model::PredictRequest;
15395 /// use wkt::Value;
15396 /// let x = PredictRequest::new().set_params([
15397 /// ("key0", Value::default()/* use setters */),
15398 /// ("key1", Value::default()/* use (different) setters */),
15399 /// ]);
15400 /// ```
15401 pub fn set_params<T, K, V>(mut self, v: T) -> Self
15402 where
15403 T: std::iter::IntoIterator<Item = (K, V)>,
15404 K: std::convert::Into<std::string::String>,
15405 V: std::convert::Into<wkt::Value>,
15406 {
15407 use std::iter::Iterator;
15408 self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15409 self
15410 }
15411
15412 /// Sets the value of [labels][crate::model::PredictRequest::labels].
15413 ///
15414 /// # Example
15415 /// ```ignore,no_run
15416 /// # use google_cloud_retail_v2::model::PredictRequest;
15417 /// let x = PredictRequest::new().set_labels([
15418 /// ("key0", "abc"),
15419 /// ("key1", "xyz"),
15420 /// ]);
15421 /// ```
15422 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15423 where
15424 T: std::iter::IntoIterator<Item = (K, V)>,
15425 K: std::convert::Into<std::string::String>,
15426 V: std::convert::Into<std::string::String>,
15427 {
15428 use std::iter::Iterator;
15429 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15430 self
15431 }
15432}
15433
15434impl wkt::message::Message for PredictRequest {
15435 fn typename() -> &'static str {
15436 "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15437 }
15438}
15439
15440/// Response message for predict method.
15441#[derive(Clone, Default, PartialEq)]
15442#[non_exhaustive]
15443pub struct PredictResponse {
15444 /// A list of recommended products. The order represents the ranking (from the
15445 /// most relevant product to the least).
15446 pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15447
15448 /// A unique attribution token. This should be included in the
15449 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15450 /// recommendation, which enables accurate attribution of recommendation model
15451 /// performance.
15452 ///
15453 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15454 pub attribution_token: std::string::String,
15455
15456 /// IDs of products in the request that were missing from the inventory.
15457 pub missing_ids: std::vec::Vec<std::string::String>,
15458
15459 /// True if the validateOnly property was set in the request.
15460 pub validate_only: bool,
15461
15462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15463}
15464
15465impl PredictResponse {
15466 /// Creates a new default instance.
15467 pub fn new() -> Self {
15468 std::default::Default::default()
15469 }
15470
15471 /// Sets the value of [results][crate::model::PredictResponse::results].
15472 ///
15473 /// # Example
15474 /// ```ignore,no_run
15475 /// # use google_cloud_retail_v2::model::PredictResponse;
15476 /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15477 /// let x = PredictResponse::new()
15478 /// .set_results([
15479 /// PredictionResult::default()/* use setters */,
15480 /// PredictionResult::default()/* use (different) setters */,
15481 /// ]);
15482 /// ```
15483 pub fn set_results<T, V>(mut self, v: T) -> Self
15484 where
15485 T: std::iter::IntoIterator<Item = V>,
15486 V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15487 {
15488 use std::iter::Iterator;
15489 self.results = v.into_iter().map(|i| i.into()).collect();
15490 self
15491 }
15492
15493 /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15494 ///
15495 /// # Example
15496 /// ```ignore,no_run
15497 /// # use google_cloud_retail_v2::model::PredictResponse;
15498 /// let x = PredictResponse::new().set_attribution_token("example");
15499 /// ```
15500 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15501 mut self,
15502 v: T,
15503 ) -> Self {
15504 self.attribution_token = v.into();
15505 self
15506 }
15507
15508 /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15509 ///
15510 /// # Example
15511 /// ```ignore,no_run
15512 /// # use google_cloud_retail_v2::model::PredictResponse;
15513 /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15514 /// ```
15515 pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15516 where
15517 T: std::iter::IntoIterator<Item = V>,
15518 V: std::convert::Into<std::string::String>,
15519 {
15520 use std::iter::Iterator;
15521 self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15522 self
15523 }
15524
15525 /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15526 ///
15527 /// # Example
15528 /// ```ignore,no_run
15529 /// # use google_cloud_retail_v2::model::PredictResponse;
15530 /// let x = PredictResponse::new().set_validate_only(true);
15531 /// ```
15532 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15533 self.validate_only = v.into();
15534 self
15535 }
15536}
15537
15538impl wkt::message::Message for PredictResponse {
15539 fn typename() -> &'static str {
15540 "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15541 }
15542}
15543
15544/// Defines additional types related to [PredictResponse].
15545pub mod predict_response {
15546 #[allow(unused_imports)]
15547 use super::*;
15548
15549 /// PredictionResult represents the recommendation prediction results.
15550 #[derive(Clone, Default, PartialEq)]
15551 #[non_exhaustive]
15552 pub struct PredictionResult {
15553 /// ID of the recommended product
15554 pub id: std::string::String,
15555
15556 /// Additional product metadata / annotations.
15557 ///
15558 /// Possible values:
15559 ///
15560 /// * `product`: JSON representation of the product. Is set if
15561 /// `returnProduct` is set to true in `PredictRequest.params`.
15562 /// * `score`: Prediction score in double value. Is set if
15563 /// `returnScore` is set to true in `PredictRequest.params`.
15564 pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15565
15566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15567 }
15568
15569 impl PredictionResult {
15570 /// Creates a new default instance.
15571 pub fn new() -> Self {
15572 std::default::Default::default()
15573 }
15574
15575 /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15576 ///
15577 /// # Example
15578 /// ```ignore,no_run
15579 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15580 /// let x = PredictionResult::new().set_id("example");
15581 /// ```
15582 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15583 self.id = v.into();
15584 self
15585 }
15586
15587 /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15588 ///
15589 /// # Example
15590 /// ```ignore,no_run
15591 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15592 /// use wkt::Value;
15593 /// let x = PredictionResult::new().set_metadata([
15594 /// ("key0", Value::default()/* use setters */),
15595 /// ("key1", Value::default()/* use (different) setters */),
15596 /// ]);
15597 /// ```
15598 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15599 where
15600 T: std::iter::IntoIterator<Item = (K, V)>,
15601 K: std::convert::Into<std::string::String>,
15602 V: std::convert::Into<wkt::Value>,
15603 {
15604 use std::iter::Iterator;
15605 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15606 self
15607 }
15608 }
15609
15610 impl wkt::message::Message for PredictionResult {
15611 fn typename() -> &'static str {
15612 "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15613 }
15614 }
15615}
15616
15617/// Product captures all metadata information of items to be recommended or
15618/// searched.
15619#[derive(Clone, Default, PartialEq)]
15620#[non_exhaustive]
15621pub struct Product {
15622 /// Immutable. Full resource name of the product, such as
15623 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15624 pub name: std::string::String,
15625
15626 /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15627 /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15628 /// example, this field is "id_1", if
15629 /// [name][google.cloud.retail.v2.Product.name] is
15630 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15631 ///
15632 /// This field must be a UTF-8 encoded string with a length limit of 128
15633 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15634 ///
15635 /// Corresponding properties: Google Merchant Center property
15636 /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15637 /// property [Product.sku](https://schema.org/sku).
15638 ///
15639 /// [google.cloud.retail.v2.Product]: crate::model::Product
15640 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15641 pub id: std::string::String,
15642
15643 /// Immutable. The type of the product. Default to
15644 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15645 /// if unset.
15646 ///
15647 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15648 pub r#type: crate::model::product::Type,
15649
15650 /// Variant group identifier. Must be an
15651 /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15652 /// this product. Otherwise, an error is thrown.
15653 ///
15654 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15655 /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15656 /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15657 ///
15658 /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15659 /// be empty. A maximum of 2,000 products are allowed to share the same
15660 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15661 /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15662 /// error is returned.
15663 ///
15664 /// Corresponding properties: Google Merchant Center property
15665 /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15666 /// Schema.org property
15667 /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15668 ///
15669 /// [google.cloud.retail.v2.Product]: crate::model::Product
15670 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15671 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15672 pub primary_product_id: std::string::String,
15673
15674 /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15675 /// [type][google.cloud.retail.v2.Product.type] is
15676 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15677 ///
15678 /// Non-existent product ids are allowed.
15679 /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15680 /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15681 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15682 /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15683 /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15684 /// return.
15685 ///
15686 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15687 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15688 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15689 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15690 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15691 pub collection_member_ids: std::vec::Vec<std::string::String>,
15692
15693 /// The Global Trade Item Number (GTIN) of the product.
15694 ///
15695 /// This field must be a UTF-8 encoded string with a length limit of 128
15696 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15697 ///
15698 /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15699 /// returned.
15700 ///
15701 /// Corresponding properties: Google Merchant Center property
15702 /// [gtin](https://support.google.com/merchants/answer/6324461).
15703 /// Schema.org property
15704 /// [Product.isbn](https://schema.org/isbn),
15705 /// [Product.gtin8](https://schema.org/gtin8),
15706 /// [Product.gtin12](https://schema.org/gtin12),
15707 /// [Product.gtin13](https://schema.org/gtin13), or
15708 /// [Product.gtin14](https://schema.org/gtin14).
15709 ///
15710 /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15711 pub gtin: std::string::String,
15712
15713 /// Product categories. This field is repeated for supporting one product
15714 /// belonging to several parallel categories. Strongly recommended using the
15715 /// full path for better search / recommendation quality.
15716 ///
15717 /// To represent full path of category, use '>' sign to separate different
15718 /// hierarchies. If '>' is part of the category name, replace it with
15719 /// other character(s).
15720 ///
15721 /// For example, if a shoes product belongs to both
15722 /// ["Shoes & Accessories" -> "Shoes"] and
15723 /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15724 /// represented as:
15725 ///
15726 /// ```norust
15727 /// "categories": [
15728 /// "Shoes & Accessories > Shoes",
15729 /// "Sports & Fitness > Athletic Clothing > Shoes"
15730 /// ]
15731 /// ```
15732 ///
15733 /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15734 /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15735 /// error is returned.
15736 ///
15737 /// At most 250 values are allowed per
15738 /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15739 /// Google Cloud console. Empty values are not allowed. Each value must be a
15740 /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15741 /// INVALID_ARGUMENT error is returned.
15742 ///
15743 /// Corresponding properties: Google Merchant Center property
15744 /// [google_product_category][mc_google_product_category]. Schema.org property
15745 /// [Product.category] (<https://schema.org/category>).
15746 ///
15747 /// [google.cloud.retail.v2.Product]: crate::model::Product
15748 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15749 pub categories: std::vec::Vec<std::string::String>,
15750
15751 /// Required. Product title.
15752 ///
15753 /// This field must be a UTF-8 encoded string with a length limit of 1,000
15754 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15755 ///
15756 /// Corresponding properties: Google Merchant Center property
15757 /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15758 /// property [Product.name](https://schema.org/name).
15759 pub title: std::string::String,
15760
15761 /// The brands of the product.
15762 ///
15763 /// A maximum of 30 brands are allowed unless overridden through the Google
15764 /// Cloud console. Each
15765 /// brand must be a UTF-8 encoded string with a length limit of 1,000
15766 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15767 ///
15768 /// Corresponding properties: Google Merchant Center property
15769 /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15770 /// property [Product.brand](https://schema.org/brand).
15771 pub brands: std::vec::Vec<std::string::String>,
15772
15773 /// Product description.
15774 ///
15775 /// This field must be a UTF-8 encoded string with a length limit of 5,000
15776 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15777 ///
15778 /// Corresponding properties: Google Merchant Center property
15779 /// [description](https://support.google.com/merchants/answer/6324468).
15780 /// Schema.org property [Product.description](https://schema.org/description).
15781 pub description: std::string::String,
15782
15783 /// Language of the title/description and other string attributes. Use language
15784 /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15785 ///
15786 /// For product prediction, this field is ignored and the model automatically
15787 /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15788 /// can include text in different languages, but duplicating
15789 /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15790 /// languages can result in degraded model performance.
15791 ///
15792 /// For product search this field is in use. It defaults to "en-US" if unset.
15793 ///
15794 /// [google.cloud.retail.v2.Product]: crate::model::Product
15795 pub language_code: std::string::String,
15796
15797 /// Highly encouraged. Extra product attributes to be included. For example,
15798 /// for products, this could include the store name, vendor, style, color, etc.
15799 /// These are very strong signals for recommendation model, thus we highly
15800 /// recommend providing the attributes here.
15801 ///
15802 /// Features that can take on one of a limited number of possible values. Two
15803 /// types of features can be set are:
15804 ///
15805 /// Textual features. some examples would be the brand/maker of a product, or
15806 /// country of a customer. Numerical features. Some examples would be the
15807 /// height/weight of a product, or age of a customer.
15808 ///
15809 /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15810 /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15811 /// }`.
15812 ///
15813 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15814 /// error is returned:
15815 ///
15816 /// * Max entries count: 200.
15817 /// * The key must be a UTF-8 encoded string with a length limit of 128
15818 /// characters.
15819 /// * For indexable attribute, the key must match the pattern:
15820 /// `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15821 /// `KEY_1_LIKE_THIS`.
15822 /// * For text attributes, at most 400 values are allowed. Empty values are not
15823 /// allowed. Each value must be a non-empty UTF-8 encoded string with a
15824 /// length limit of 256 characters.
15825 /// * For number attributes, at most 400 values are allowed.
15826 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15827
15828 /// Custom tags associated with the product.
15829 ///
15830 /// At most 250 values are allowed per
15831 /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15832 /// encoded string with a length limit of 1,000 characters. Otherwise, an
15833 /// INVALID_ARGUMENT error is returned.
15834 ///
15835 /// This tag can be used for filtering recommendation results by passing the
15836 /// tag as part of the
15837 /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15838 ///
15839 /// Corresponding properties: Google Merchant Center property
15840 /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15841 ///
15842 /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15843 /// [google.cloud.retail.v2.Product]: crate::model::Product
15844 pub tags: std::vec::Vec<std::string::String>,
15845
15846 /// Product price and cost information.
15847 ///
15848 /// Corresponding properties: Google Merchant Center property
15849 /// [price](https://support.google.com/merchants/answer/6324371).
15850 pub price_info: std::option::Option<crate::model::PriceInfo>,
15851
15852 /// The rating of this product.
15853 pub rating: std::option::Option<crate::model::Rating>,
15854
15855 /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15856 /// available for
15857 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15858 /// that this is only applicable to
15859 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15860 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15861 /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15862 ///
15863 /// [google.cloud.retail.v2.Product]: crate::model::Product
15864 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15865 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15866 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15867 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15868 pub available_time: std::option::Option<wkt::Timestamp>,
15869
15870 /// The online availability of the [Product][google.cloud.retail.v2.Product].
15871 /// Default to
15872 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15873 ///
15874 /// For primary products with variants set the availability of the primary as
15875 /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15876 /// and set the true availability at the variant level. This way the primary
15877 /// product will be considered "in stock" as long as it has at least one
15878 /// variant in stock.
15879 ///
15880 /// For primary products with no variants set the true availability at the
15881 /// primary level.
15882 ///
15883 /// Corresponding properties: Google Merchant Center property
15884 /// [availability](https://support.google.com/merchants/answer/6324448).
15885 /// Schema.org property [Offer.availability](https://schema.org/availability).
15886 ///
15887 /// [google.cloud.retail.v2.Product]: crate::model::Product
15888 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15889 /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15890 pub availability: crate::model::product::Availability,
15891
15892 /// The available quantity of the item.
15893 pub available_quantity: std::option::Option<wkt::Int32Value>,
15894
15895 /// Fulfillment information, such as the store IDs for in-store pickup or
15896 /// region IDs for different shipping methods.
15897 ///
15898 /// All the elements must have distinct
15899 /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15900 /// Otherwise, an INVALID_ARGUMENT error is returned.
15901 ///
15902 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15903 pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15904
15905 /// Canonical URL directly linking to the product detail page.
15906 ///
15907 /// It is strongly recommended to provide a valid uri for the product,
15908 /// otherwise the service performance could be significantly degraded.
15909 ///
15910 /// This field must be a UTF-8 encoded string with a length limit of 5,000
15911 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15912 ///
15913 /// Corresponding properties: Google Merchant Center property
15914 /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
15915 /// property [Offer.url](https://schema.org/url).
15916 pub uri: std::string::String,
15917
15918 /// Product images for the product. We highly recommend putting the main
15919 /// image first.
15920 ///
15921 /// A maximum of 300 images are allowed.
15922 ///
15923 /// Corresponding properties: Google Merchant Center property
15924 /// [image_link](https://support.google.com/merchants/answer/6324350).
15925 /// Schema.org property [Product.image](https://schema.org/image).
15926 pub images: std::vec::Vec<crate::model::Image>,
15927
15928 /// The target group associated with a given audience (e.g. male, veterans,
15929 /// car owners, musicians, etc.) of the product.
15930 pub audience: std::option::Option<crate::model::Audience>,
15931
15932 /// The color of the product.
15933 ///
15934 /// Corresponding properties: Google Merchant Center property
15935 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
15936 /// property [Product.color](https://schema.org/color).
15937 pub color_info: std::option::Option<crate::model::ColorInfo>,
15938
15939 /// The size of the product. To represent different size systems or size types,
15940 /// consider using this format: [[[size_system:]size_type:]size_value].
15941 ///
15942 /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
15943 /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
15944 /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
15945 /// both size system and size type are empty, while size value is "32 inches".
15946 ///
15947 /// A maximum of 20 values are allowed per
15948 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15949 /// encoded string with a length limit of 128 characters. Otherwise, an
15950 /// INVALID_ARGUMENT error is returned.
15951 ///
15952 /// Corresponding properties: Google Merchant Center property
15953 /// [size](https://support.google.com/merchants/answer/6324492),
15954 /// [size_type](https://support.google.com/merchants/answer/6324497), and
15955 /// [size_system](https://support.google.com/merchants/answer/6324502).
15956 /// Schema.org property [Product.size](https://schema.org/size).
15957 ///
15958 /// [google.cloud.retail.v2.Product]: crate::model::Product
15959 pub sizes: std::vec::Vec<std::string::String>,
15960
15961 /// The material of the product. For example, "leather", "wooden".
15962 ///
15963 /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
15964 /// string with a length limit of 200 characters. Otherwise, an
15965 /// INVALID_ARGUMENT error is returned.
15966 ///
15967 /// Corresponding properties: Google Merchant Center property
15968 /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
15969 /// property [Product.material](https://schema.org/material).
15970 pub materials: std::vec::Vec<std::string::String>,
15971
15972 /// The pattern or graphic print of the product. For example, "striped", "polka
15973 /// dot", "paisley".
15974 ///
15975 /// A maximum of 20 values are allowed per
15976 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15977 /// encoded string with a length limit of 128 characters. Otherwise, an
15978 /// INVALID_ARGUMENT error is returned.
15979 ///
15980 /// Corresponding properties: Google Merchant Center property
15981 /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
15982 /// property [Product.pattern](https://schema.org/pattern).
15983 ///
15984 /// [google.cloud.retail.v2.Product]: crate::model::Product
15985 pub patterns: std::vec::Vec<std::string::String>,
15986
15987 /// The condition of the product. Strongly encouraged to use the standard
15988 /// values: "new", "refurbished", "used".
15989 ///
15990 /// A maximum of 1 value is allowed per
15991 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15992 /// encoded string with a length limit of 128 characters. Otherwise, an
15993 /// INVALID_ARGUMENT error is returned.
15994 ///
15995 /// Corresponding properties: Google Merchant Center property
15996 /// [condition](https://support.google.com/merchants/answer/6324469).
15997 /// Schema.org property
15998 /// [Offer.itemCondition](https://schema.org/itemCondition).
15999 ///
16000 /// [google.cloud.retail.v2.Product]: crate::model::Product
16001 pub conditions: std::vec::Vec<std::string::String>,
16002
16003 /// The promotions applied to the product. A maximum of 10 values are allowed
16004 /// per [Product][google.cloud.retail.v2.Product]. Only
16005 /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
16006 /// will be used, other fields will be ignored if set.
16007 ///
16008 /// [google.cloud.retail.v2.Product]: crate::model::Product
16009 /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
16010 pub promotions: std::vec::Vec<crate::model::Promotion>,
16011
16012 /// The timestamp when the product is published by the retailer for the first
16013 /// time, which indicates the freshness of the products. Note that this field
16014 /// is different from
16015 /// [available_time][google.cloud.retail.v2.Product.available_time], given it
16016 /// purely describes product freshness regardless of when it is available on
16017 /// search and recommendation.
16018 ///
16019 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
16020 pub publish_time: std::option::Option<wkt::Timestamp>,
16021
16022 /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
16023 /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
16024 ///
16025 /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
16026 ///
16027 /// * [audience][google.cloud.retail.v2.Product.audience]
16028 /// * [availability][google.cloud.retail.v2.Product.availability]
16029 /// * [brands][google.cloud.retail.v2.Product.brands]
16030 /// * [color_info][google.cloud.retail.v2.Product.color_info]
16031 /// * [conditions][google.cloud.retail.v2.Product.conditions]
16032 /// * [gtin][google.cloud.retail.v2.Product.gtin]
16033 /// * [materials][google.cloud.retail.v2.Product.materials]
16034 /// * [name][google.cloud.retail.v2.Product.name]
16035 /// * [patterns][google.cloud.retail.v2.Product.patterns]
16036 /// * [price_info][google.cloud.retail.v2.Product.price_info]
16037 /// * [rating][google.cloud.retail.v2.Product.rating]
16038 /// * [sizes][google.cloud.retail.v2.Product.sizes]
16039 /// * [title][google.cloud.retail.v2.Product.title]
16040 /// * [uri][google.cloud.retail.v2.Product.uri]
16041 ///
16042 /// Supported fields only for
16043 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16044 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
16045 ///
16046 /// * [categories][google.cloud.retail.v2.Product.categories]
16047 /// * [description][google.cloud.retail.v2.Product.description]
16048 /// * [images][google.cloud.retail.v2.Product.images]
16049 ///
16050 /// Supported fields only for
16051 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
16052 ///
16053 /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
16054 ///
16055 /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
16056 /// retrievable, include paths of the form "attributes.key" where "key" is the
16057 /// key of a custom attribute, as specified in
16058 /// [attributes][google.cloud.retail.v2.Product.attributes].
16059 ///
16060 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16061 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
16062 /// following fields are always returned in
16063 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
16064 ///
16065 /// * [name][google.cloud.retail.v2.Product.name]
16066 ///
16067 /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
16068 /// following fields are always returned in by default:
16069 ///
16070 /// * [name][google.cloud.retail.v2.Product.name]
16071 /// * [color_info][google.cloud.retail.v2.Product.color_info]
16072 ///
16073 /// Note: Returning more fields in
16074 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
16075 /// response payload size and serving latency.
16076 ///
16077 /// This field is deprecated. Use the retrievable site-wide control instead.
16078 ///
16079 /// [google.cloud.retail.v2.Product]: crate::model::Product
16080 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
16081 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16082 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16083 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
16084 /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
16085 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
16086 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
16087 /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
16088 /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
16089 /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
16090 /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
16091 /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
16092 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
16093 /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
16094 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
16095 /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
16096 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
16097 /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
16098 /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
16099 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
16100 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
16101 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
16102 /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
16103 #[deprecated]
16104 pub retrievable_fields: std::option::Option<wkt::FieldMask>,
16105
16106 /// Output only. Product variants grouped together on primary product which
16107 /// share similar product attributes. It's automatically grouped by
16108 /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
16109 /// all the product variants. Only populated for
16110 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16111 /// [Product][google.cloud.retail.v2.Product]s.
16112 ///
16113 /// Note: This field is OUTPUT_ONLY for
16114 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
16115 /// Do not set this field in API requests.
16116 ///
16117 /// [google.cloud.retail.v2.Product]: crate::model::Product
16118 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16119 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
16120 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
16121 pub variants: std::vec::Vec<crate::model::Product>,
16122
16123 /// Output only. A list of local inventories specific to different places.
16124 ///
16125 /// This field can be managed by
16126 /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
16127 /// and
16128 /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
16129 /// APIs if fine-grained, high-volume updates are necessary.
16130 ///
16131 /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
16132 /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
16133 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
16134
16135 #[allow(missing_docs)]
16136 pub expiration: std::option::Option<crate::model::product::Expiration>,
16137
16138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16139}
16140
16141impl Product {
16142 /// Creates a new default instance.
16143 pub fn new() -> Self {
16144 std::default::Default::default()
16145 }
16146
16147 /// Sets the value of [name][crate::model::Product::name].
16148 ///
16149 /// # Example
16150 /// ```ignore,no_run
16151 /// # use google_cloud_retail_v2::model::Product;
16152 /// let x = Product::new().set_name("example");
16153 /// ```
16154 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16155 self.name = v.into();
16156 self
16157 }
16158
16159 /// Sets the value of [id][crate::model::Product::id].
16160 ///
16161 /// # Example
16162 /// ```ignore,no_run
16163 /// # use google_cloud_retail_v2::model::Product;
16164 /// let x = Product::new().set_id("example");
16165 /// ```
16166 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16167 self.id = v.into();
16168 self
16169 }
16170
16171 /// Sets the value of [r#type][crate::model::Product::type].
16172 ///
16173 /// # Example
16174 /// ```ignore,no_run
16175 /// # use google_cloud_retail_v2::model::Product;
16176 /// use google_cloud_retail_v2::model::product::Type;
16177 /// let x0 = Product::new().set_type(Type::Primary);
16178 /// let x1 = Product::new().set_type(Type::Variant);
16179 /// let x2 = Product::new().set_type(Type::Collection);
16180 /// ```
16181 pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16182 self.r#type = v.into();
16183 self
16184 }
16185
16186 /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16187 ///
16188 /// # Example
16189 /// ```ignore,no_run
16190 /// # use google_cloud_retail_v2::model::Product;
16191 /// let x = Product::new().set_primary_product_id("example");
16192 /// ```
16193 pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16194 mut self,
16195 v: T,
16196 ) -> Self {
16197 self.primary_product_id = v.into();
16198 self
16199 }
16200
16201 /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16202 ///
16203 /// # Example
16204 /// ```ignore,no_run
16205 /// # use google_cloud_retail_v2::model::Product;
16206 /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16207 /// ```
16208 pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16209 where
16210 T: std::iter::IntoIterator<Item = V>,
16211 V: std::convert::Into<std::string::String>,
16212 {
16213 use std::iter::Iterator;
16214 self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16215 self
16216 }
16217
16218 /// Sets the value of [gtin][crate::model::Product::gtin].
16219 ///
16220 /// # Example
16221 /// ```ignore,no_run
16222 /// # use google_cloud_retail_v2::model::Product;
16223 /// let x = Product::new().set_gtin("example");
16224 /// ```
16225 pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16226 self.gtin = v.into();
16227 self
16228 }
16229
16230 /// Sets the value of [categories][crate::model::Product::categories].
16231 ///
16232 /// # Example
16233 /// ```ignore,no_run
16234 /// # use google_cloud_retail_v2::model::Product;
16235 /// let x = Product::new().set_categories(["a", "b", "c"]);
16236 /// ```
16237 pub fn set_categories<T, V>(mut self, v: T) -> Self
16238 where
16239 T: std::iter::IntoIterator<Item = V>,
16240 V: std::convert::Into<std::string::String>,
16241 {
16242 use std::iter::Iterator;
16243 self.categories = v.into_iter().map(|i| i.into()).collect();
16244 self
16245 }
16246
16247 /// Sets the value of [title][crate::model::Product::title].
16248 ///
16249 /// # Example
16250 /// ```ignore,no_run
16251 /// # use google_cloud_retail_v2::model::Product;
16252 /// let x = Product::new().set_title("example");
16253 /// ```
16254 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16255 self.title = v.into();
16256 self
16257 }
16258
16259 /// Sets the value of [brands][crate::model::Product::brands].
16260 ///
16261 /// # Example
16262 /// ```ignore,no_run
16263 /// # use google_cloud_retail_v2::model::Product;
16264 /// let x = Product::new().set_brands(["a", "b", "c"]);
16265 /// ```
16266 pub fn set_brands<T, V>(mut self, v: T) -> Self
16267 where
16268 T: std::iter::IntoIterator<Item = V>,
16269 V: std::convert::Into<std::string::String>,
16270 {
16271 use std::iter::Iterator;
16272 self.brands = v.into_iter().map(|i| i.into()).collect();
16273 self
16274 }
16275
16276 /// Sets the value of [description][crate::model::Product::description].
16277 ///
16278 /// # Example
16279 /// ```ignore,no_run
16280 /// # use google_cloud_retail_v2::model::Product;
16281 /// let x = Product::new().set_description("example");
16282 /// ```
16283 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16284 self.description = v.into();
16285 self
16286 }
16287
16288 /// Sets the value of [language_code][crate::model::Product::language_code].
16289 ///
16290 /// # Example
16291 /// ```ignore,no_run
16292 /// # use google_cloud_retail_v2::model::Product;
16293 /// let x = Product::new().set_language_code("example");
16294 /// ```
16295 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16296 self.language_code = v.into();
16297 self
16298 }
16299
16300 /// Sets the value of [attributes][crate::model::Product::attributes].
16301 ///
16302 /// # Example
16303 /// ```ignore,no_run
16304 /// # use google_cloud_retail_v2::model::Product;
16305 /// use google_cloud_retail_v2::model::CustomAttribute;
16306 /// let x = Product::new().set_attributes([
16307 /// ("key0", CustomAttribute::default()/* use setters */),
16308 /// ("key1", CustomAttribute::default()/* use (different) setters */),
16309 /// ]);
16310 /// ```
16311 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16312 where
16313 T: std::iter::IntoIterator<Item = (K, V)>,
16314 K: std::convert::Into<std::string::String>,
16315 V: std::convert::Into<crate::model::CustomAttribute>,
16316 {
16317 use std::iter::Iterator;
16318 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16319 self
16320 }
16321
16322 /// Sets the value of [tags][crate::model::Product::tags].
16323 ///
16324 /// # Example
16325 /// ```ignore,no_run
16326 /// # use google_cloud_retail_v2::model::Product;
16327 /// let x = Product::new().set_tags(["a", "b", "c"]);
16328 /// ```
16329 pub fn set_tags<T, V>(mut self, v: T) -> Self
16330 where
16331 T: std::iter::IntoIterator<Item = V>,
16332 V: std::convert::Into<std::string::String>,
16333 {
16334 use std::iter::Iterator;
16335 self.tags = v.into_iter().map(|i| i.into()).collect();
16336 self
16337 }
16338
16339 /// Sets the value of [price_info][crate::model::Product::price_info].
16340 ///
16341 /// # Example
16342 /// ```ignore,no_run
16343 /// # use google_cloud_retail_v2::model::Product;
16344 /// use google_cloud_retail_v2::model::PriceInfo;
16345 /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16346 /// ```
16347 pub fn set_price_info<T>(mut self, v: T) -> Self
16348 where
16349 T: std::convert::Into<crate::model::PriceInfo>,
16350 {
16351 self.price_info = std::option::Option::Some(v.into());
16352 self
16353 }
16354
16355 /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16356 ///
16357 /// # Example
16358 /// ```ignore,no_run
16359 /// # use google_cloud_retail_v2::model::Product;
16360 /// use google_cloud_retail_v2::model::PriceInfo;
16361 /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16362 /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16363 /// ```
16364 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16365 where
16366 T: std::convert::Into<crate::model::PriceInfo>,
16367 {
16368 self.price_info = v.map(|x| x.into());
16369 self
16370 }
16371
16372 /// Sets the value of [rating][crate::model::Product::rating].
16373 ///
16374 /// # Example
16375 /// ```ignore,no_run
16376 /// # use google_cloud_retail_v2::model::Product;
16377 /// use google_cloud_retail_v2::model::Rating;
16378 /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16379 /// ```
16380 pub fn set_rating<T>(mut self, v: T) -> Self
16381 where
16382 T: std::convert::Into<crate::model::Rating>,
16383 {
16384 self.rating = std::option::Option::Some(v.into());
16385 self
16386 }
16387
16388 /// Sets or clears the value of [rating][crate::model::Product::rating].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_retail_v2::model::Product;
16393 /// use google_cloud_retail_v2::model::Rating;
16394 /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16395 /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16396 /// ```
16397 pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16398 where
16399 T: std::convert::Into<crate::model::Rating>,
16400 {
16401 self.rating = v.map(|x| x.into());
16402 self
16403 }
16404
16405 /// Sets the value of [available_time][crate::model::Product::available_time].
16406 ///
16407 /// # Example
16408 /// ```ignore,no_run
16409 /// # use google_cloud_retail_v2::model::Product;
16410 /// use wkt::Timestamp;
16411 /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16412 /// ```
16413 pub fn set_available_time<T>(mut self, v: T) -> Self
16414 where
16415 T: std::convert::Into<wkt::Timestamp>,
16416 {
16417 self.available_time = std::option::Option::Some(v.into());
16418 self
16419 }
16420
16421 /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16422 ///
16423 /// # Example
16424 /// ```ignore,no_run
16425 /// # use google_cloud_retail_v2::model::Product;
16426 /// use wkt::Timestamp;
16427 /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16428 /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16429 /// ```
16430 pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16431 where
16432 T: std::convert::Into<wkt::Timestamp>,
16433 {
16434 self.available_time = v.map(|x| x.into());
16435 self
16436 }
16437
16438 /// Sets the value of [availability][crate::model::Product::availability].
16439 ///
16440 /// # Example
16441 /// ```ignore,no_run
16442 /// # use google_cloud_retail_v2::model::Product;
16443 /// use google_cloud_retail_v2::model::product::Availability;
16444 /// let x0 = Product::new().set_availability(Availability::InStock);
16445 /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16446 /// let x2 = Product::new().set_availability(Availability::Preorder);
16447 /// ```
16448 pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16449 mut self,
16450 v: T,
16451 ) -> Self {
16452 self.availability = v.into();
16453 self
16454 }
16455
16456 /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16457 ///
16458 /// # Example
16459 /// ```ignore,no_run
16460 /// # use google_cloud_retail_v2::model::Product;
16461 /// use wkt::Int32Value;
16462 /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16463 /// ```
16464 pub fn set_available_quantity<T>(mut self, v: T) -> Self
16465 where
16466 T: std::convert::Into<wkt::Int32Value>,
16467 {
16468 self.available_quantity = std::option::Option::Some(v.into());
16469 self
16470 }
16471
16472 /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16473 ///
16474 /// # Example
16475 /// ```ignore,no_run
16476 /// # use google_cloud_retail_v2::model::Product;
16477 /// use wkt::Int32Value;
16478 /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16479 /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16480 /// ```
16481 pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16482 where
16483 T: std::convert::Into<wkt::Int32Value>,
16484 {
16485 self.available_quantity = v.map(|x| x.into());
16486 self
16487 }
16488
16489 /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16490 ///
16491 /// # Example
16492 /// ```ignore,no_run
16493 /// # use google_cloud_retail_v2::model::Product;
16494 /// use google_cloud_retail_v2::model::FulfillmentInfo;
16495 /// let x = Product::new()
16496 /// .set_fulfillment_info([
16497 /// FulfillmentInfo::default()/* use setters */,
16498 /// FulfillmentInfo::default()/* use (different) setters */,
16499 /// ]);
16500 /// ```
16501 pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16502 where
16503 T: std::iter::IntoIterator<Item = V>,
16504 V: std::convert::Into<crate::model::FulfillmentInfo>,
16505 {
16506 use std::iter::Iterator;
16507 self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16508 self
16509 }
16510
16511 /// Sets the value of [uri][crate::model::Product::uri].
16512 ///
16513 /// # Example
16514 /// ```ignore,no_run
16515 /// # use google_cloud_retail_v2::model::Product;
16516 /// let x = Product::new().set_uri("example");
16517 /// ```
16518 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16519 self.uri = v.into();
16520 self
16521 }
16522
16523 /// Sets the value of [images][crate::model::Product::images].
16524 ///
16525 /// # Example
16526 /// ```ignore,no_run
16527 /// # use google_cloud_retail_v2::model::Product;
16528 /// use google_cloud_retail_v2::model::Image;
16529 /// let x = Product::new()
16530 /// .set_images([
16531 /// Image::default()/* use setters */,
16532 /// Image::default()/* use (different) setters */,
16533 /// ]);
16534 /// ```
16535 pub fn set_images<T, V>(mut self, v: T) -> Self
16536 where
16537 T: std::iter::IntoIterator<Item = V>,
16538 V: std::convert::Into<crate::model::Image>,
16539 {
16540 use std::iter::Iterator;
16541 self.images = v.into_iter().map(|i| i.into()).collect();
16542 self
16543 }
16544
16545 /// Sets the value of [audience][crate::model::Product::audience].
16546 ///
16547 /// # Example
16548 /// ```ignore,no_run
16549 /// # use google_cloud_retail_v2::model::Product;
16550 /// use google_cloud_retail_v2::model::Audience;
16551 /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16552 /// ```
16553 pub fn set_audience<T>(mut self, v: T) -> Self
16554 where
16555 T: std::convert::Into<crate::model::Audience>,
16556 {
16557 self.audience = std::option::Option::Some(v.into());
16558 self
16559 }
16560
16561 /// Sets or clears the value of [audience][crate::model::Product::audience].
16562 ///
16563 /// # Example
16564 /// ```ignore,no_run
16565 /// # use google_cloud_retail_v2::model::Product;
16566 /// use google_cloud_retail_v2::model::Audience;
16567 /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16568 /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16569 /// ```
16570 pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16571 where
16572 T: std::convert::Into<crate::model::Audience>,
16573 {
16574 self.audience = v.map(|x| x.into());
16575 self
16576 }
16577
16578 /// Sets the value of [color_info][crate::model::Product::color_info].
16579 ///
16580 /// # Example
16581 /// ```ignore,no_run
16582 /// # use google_cloud_retail_v2::model::Product;
16583 /// use google_cloud_retail_v2::model::ColorInfo;
16584 /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16585 /// ```
16586 pub fn set_color_info<T>(mut self, v: T) -> Self
16587 where
16588 T: std::convert::Into<crate::model::ColorInfo>,
16589 {
16590 self.color_info = std::option::Option::Some(v.into());
16591 self
16592 }
16593
16594 /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16595 ///
16596 /// # Example
16597 /// ```ignore,no_run
16598 /// # use google_cloud_retail_v2::model::Product;
16599 /// use google_cloud_retail_v2::model::ColorInfo;
16600 /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16601 /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16602 /// ```
16603 pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16604 where
16605 T: std::convert::Into<crate::model::ColorInfo>,
16606 {
16607 self.color_info = v.map(|x| x.into());
16608 self
16609 }
16610
16611 /// Sets the value of [sizes][crate::model::Product::sizes].
16612 ///
16613 /// # Example
16614 /// ```ignore,no_run
16615 /// # use google_cloud_retail_v2::model::Product;
16616 /// let x = Product::new().set_sizes(["a", "b", "c"]);
16617 /// ```
16618 pub fn set_sizes<T, V>(mut self, v: T) -> Self
16619 where
16620 T: std::iter::IntoIterator<Item = V>,
16621 V: std::convert::Into<std::string::String>,
16622 {
16623 use std::iter::Iterator;
16624 self.sizes = v.into_iter().map(|i| i.into()).collect();
16625 self
16626 }
16627
16628 /// Sets the value of [materials][crate::model::Product::materials].
16629 ///
16630 /// # Example
16631 /// ```ignore,no_run
16632 /// # use google_cloud_retail_v2::model::Product;
16633 /// let x = Product::new().set_materials(["a", "b", "c"]);
16634 /// ```
16635 pub fn set_materials<T, V>(mut self, v: T) -> Self
16636 where
16637 T: std::iter::IntoIterator<Item = V>,
16638 V: std::convert::Into<std::string::String>,
16639 {
16640 use std::iter::Iterator;
16641 self.materials = v.into_iter().map(|i| i.into()).collect();
16642 self
16643 }
16644
16645 /// Sets the value of [patterns][crate::model::Product::patterns].
16646 ///
16647 /// # Example
16648 /// ```ignore,no_run
16649 /// # use google_cloud_retail_v2::model::Product;
16650 /// let x = Product::new().set_patterns(["a", "b", "c"]);
16651 /// ```
16652 pub fn set_patterns<T, V>(mut self, v: T) -> Self
16653 where
16654 T: std::iter::IntoIterator<Item = V>,
16655 V: std::convert::Into<std::string::String>,
16656 {
16657 use std::iter::Iterator;
16658 self.patterns = v.into_iter().map(|i| i.into()).collect();
16659 self
16660 }
16661
16662 /// Sets the value of [conditions][crate::model::Product::conditions].
16663 ///
16664 /// # Example
16665 /// ```ignore,no_run
16666 /// # use google_cloud_retail_v2::model::Product;
16667 /// let x = Product::new().set_conditions(["a", "b", "c"]);
16668 /// ```
16669 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16670 where
16671 T: std::iter::IntoIterator<Item = V>,
16672 V: std::convert::Into<std::string::String>,
16673 {
16674 use std::iter::Iterator;
16675 self.conditions = v.into_iter().map(|i| i.into()).collect();
16676 self
16677 }
16678
16679 /// Sets the value of [promotions][crate::model::Product::promotions].
16680 ///
16681 /// # Example
16682 /// ```ignore,no_run
16683 /// # use google_cloud_retail_v2::model::Product;
16684 /// use google_cloud_retail_v2::model::Promotion;
16685 /// let x = Product::new()
16686 /// .set_promotions([
16687 /// Promotion::default()/* use setters */,
16688 /// Promotion::default()/* use (different) setters */,
16689 /// ]);
16690 /// ```
16691 pub fn set_promotions<T, V>(mut self, v: T) -> Self
16692 where
16693 T: std::iter::IntoIterator<Item = V>,
16694 V: std::convert::Into<crate::model::Promotion>,
16695 {
16696 use std::iter::Iterator;
16697 self.promotions = v.into_iter().map(|i| i.into()).collect();
16698 self
16699 }
16700
16701 /// Sets the value of [publish_time][crate::model::Product::publish_time].
16702 ///
16703 /// # Example
16704 /// ```ignore,no_run
16705 /// # use google_cloud_retail_v2::model::Product;
16706 /// use wkt::Timestamp;
16707 /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16708 /// ```
16709 pub fn set_publish_time<T>(mut self, v: T) -> Self
16710 where
16711 T: std::convert::Into<wkt::Timestamp>,
16712 {
16713 self.publish_time = std::option::Option::Some(v.into());
16714 self
16715 }
16716
16717 /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16718 ///
16719 /// # Example
16720 /// ```ignore,no_run
16721 /// # use google_cloud_retail_v2::model::Product;
16722 /// use wkt::Timestamp;
16723 /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16724 /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16725 /// ```
16726 pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16727 where
16728 T: std::convert::Into<wkt::Timestamp>,
16729 {
16730 self.publish_time = v.map(|x| x.into());
16731 self
16732 }
16733
16734 /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16735 ///
16736 /// # Example
16737 /// ```ignore,no_run
16738 /// # use google_cloud_retail_v2::model::Product;
16739 /// use wkt::FieldMask;
16740 /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16741 /// ```
16742 #[deprecated]
16743 pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16744 where
16745 T: std::convert::Into<wkt::FieldMask>,
16746 {
16747 self.retrievable_fields = std::option::Option::Some(v.into());
16748 self
16749 }
16750
16751 /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16752 ///
16753 /// # Example
16754 /// ```ignore,no_run
16755 /// # use google_cloud_retail_v2::model::Product;
16756 /// use wkt::FieldMask;
16757 /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16758 /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16759 /// ```
16760 #[deprecated]
16761 pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16762 where
16763 T: std::convert::Into<wkt::FieldMask>,
16764 {
16765 self.retrievable_fields = v.map(|x| x.into());
16766 self
16767 }
16768
16769 /// Sets the value of [variants][crate::model::Product::variants].
16770 ///
16771 /// # Example
16772 /// ```ignore,no_run
16773 /// # use google_cloud_retail_v2::model::Product;
16774 /// let x = Product::new()
16775 /// .set_variants([
16776 /// Product::default()/* use setters */,
16777 /// Product::default()/* use (different) setters */,
16778 /// ]);
16779 /// ```
16780 pub fn set_variants<T, V>(mut self, v: T) -> Self
16781 where
16782 T: std::iter::IntoIterator<Item = V>,
16783 V: std::convert::Into<crate::model::Product>,
16784 {
16785 use std::iter::Iterator;
16786 self.variants = v.into_iter().map(|i| i.into()).collect();
16787 self
16788 }
16789
16790 /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16791 ///
16792 /// # Example
16793 /// ```ignore,no_run
16794 /// # use google_cloud_retail_v2::model::Product;
16795 /// use google_cloud_retail_v2::model::LocalInventory;
16796 /// let x = Product::new()
16797 /// .set_local_inventories([
16798 /// LocalInventory::default()/* use setters */,
16799 /// LocalInventory::default()/* use (different) setters */,
16800 /// ]);
16801 /// ```
16802 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16803 where
16804 T: std::iter::IntoIterator<Item = V>,
16805 V: std::convert::Into<crate::model::LocalInventory>,
16806 {
16807 use std::iter::Iterator;
16808 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16809 self
16810 }
16811
16812 /// Sets the value of [expiration][crate::model::Product::expiration].
16813 ///
16814 /// Note that all the setters affecting `expiration` are mutually
16815 /// exclusive.
16816 ///
16817 /// # Example
16818 /// ```ignore,no_run
16819 /// # use google_cloud_retail_v2::model::Product;
16820 /// use wkt::Timestamp;
16821 /// let x = Product::new().set_expiration(Some(
16822 /// google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16823 /// ```
16824 pub fn set_expiration<
16825 T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16826 >(
16827 mut self,
16828 v: T,
16829 ) -> Self {
16830 self.expiration = v.into();
16831 self
16832 }
16833
16834 /// The value of [expiration][crate::model::Product::expiration]
16835 /// if it holds a `ExpireTime`, `None` if the field is not set or
16836 /// holds a different branch.
16837 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16838 #[allow(unreachable_patterns)]
16839 self.expiration.as_ref().and_then(|v| match v {
16840 crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16841 _ => std::option::Option::None,
16842 })
16843 }
16844
16845 /// Sets the value of [expiration][crate::model::Product::expiration]
16846 /// to hold a `ExpireTime`.
16847 ///
16848 /// Note that all the setters affecting `expiration` are
16849 /// mutually exclusive.
16850 ///
16851 /// # Example
16852 /// ```ignore,no_run
16853 /// # use google_cloud_retail_v2::model::Product;
16854 /// use wkt::Timestamp;
16855 /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16856 /// assert!(x.expire_time().is_some());
16857 /// assert!(x.ttl().is_none());
16858 /// ```
16859 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16860 mut self,
16861 v: T,
16862 ) -> Self {
16863 self.expiration =
16864 std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16865 self
16866 }
16867
16868 /// The value of [expiration][crate::model::Product::expiration]
16869 /// if it holds a `Ttl`, `None` if the field is not set or
16870 /// holds a different branch.
16871 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16872 #[allow(unreachable_patterns)]
16873 self.expiration.as_ref().and_then(|v| match v {
16874 crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16875 _ => std::option::Option::None,
16876 })
16877 }
16878
16879 /// Sets the value of [expiration][crate::model::Product::expiration]
16880 /// to hold a `Ttl`.
16881 ///
16882 /// Note that all the setters affecting `expiration` are
16883 /// mutually exclusive.
16884 ///
16885 /// # Example
16886 /// ```ignore,no_run
16887 /// # use google_cloud_retail_v2::model::Product;
16888 /// use wkt::Duration;
16889 /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16890 /// assert!(x.ttl().is_some());
16891 /// assert!(x.expire_time().is_none());
16892 /// ```
16893 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16894 self.expiration =
16895 std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16896 self
16897 }
16898}
16899
16900impl wkt::message::Message for Product {
16901 fn typename() -> &'static str {
16902 "type.googleapis.com/google.cloud.retail.v2.Product"
16903 }
16904}
16905
16906/// Defines additional types related to [Product].
16907pub mod product {
16908 #[allow(unused_imports)]
16909 use super::*;
16910
16911 /// The type of this product.
16912 ///
16913 /// # Working with unknown values
16914 ///
16915 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16916 /// additional enum variants at any time. Adding new variants is not considered
16917 /// a breaking change. Applications should write their code in anticipation of:
16918 ///
16919 /// - New values appearing in future releases of the client library, **and**
16920 /// - New values received dynamically, without application changes.
16921 ///
16922 /// Please consult the [Working with enums] section in the user guide for some
16923 /// guidelines.
16924 ///
16925 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16926 #[derive(Clone, Debug, PartialEq)]
16927 #[non_exhaustive]
16928 pub enum Type {
16929 /// Default value. Default to
16930 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
16931 /// if unset.
16932 ///
16933 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
16934 Unspecified,
16935 /// The primary type.
16936 ///
16937 /// As the primary unit for predicting, indexing and search serving, a
16938 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16939 /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
16940 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16941 /// [Product][google.cloud.retail.v2.Product]s.
16942 ///
16943 /// [google.cloud.retail.v2.Product]: crate::model::Product
16944 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16945 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16946 Primary,
16947 /// The variant type.
16948 ///
16949 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16950 /// [Product][google.cloud.retail.v2.Product]s usually share some common
16951 /// attributes on the same
16952 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16953 /// [Product][google.cloud.retail.v2.Product]s, but they have variant
16954 /// attributes like different colors, sizes and prices, etc.
16955 ///
16956 /// [google.cloud.retail.v2.Product]: crate::model::Product
16957 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16958 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16959 Variant,
16960 /// The collection type. Collection products are bundled
16961 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16962 /// [Product][google.cloud.retail.v2.Product]s or
16963 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16964 /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
16965 /// as a jewelry set with necklaces, earrings and rings, etc.
16966 ///
16967 /// [google.cloud.retail.v2.Product]: crate::model::Product
16968 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16969 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16970 Collection,
16971 /// If set, the enum was initialized with an unknown value.
16972 ///
16973 /// Applications can examine the value using [Type::value] or
16974 /// [Type::name].
16975 UnknownValue(r#type::UnknownValue),
16976 }
16977
16978 #[doc(hidden)]
16979 pub mod r#type {
16980 #[allow(unused_imports)]
16981 use super::*;
16982 #[derive(Clone, Debug, PartialEq)]
16983 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16984 }
16985
16986 impl Type {
16987 /// Gets the enum value.
16988 ///
16989 /// Returns `None` if the enum contains an unknown value deserialized from
16990 /// the string representation of enums.
16991 pub fn value(&self) -> std::option::Option<i32> {
16992 match self {
16993 Self::Unspecified => std::option::Option::Some(0),
16994 Self::Primary => std::option::Option::Some(1),
16995 Self::Variant => std::option::Option::Some(2),
16996 Self::Collection => std::option::Option::Some(3),
16997 Self::UnknownValue(u) => u.0.value(),
16998 }
16999 }
17000
17001 /// Gets the enum value as a string.
17002 ///
17003 /// Returns `None` if the enum contains an unknown value deserialized from
17004 /// the integer representation of enums.
17005 pub fn name(&self) -> std::option::Option<&str> {
17006 match self {
17007 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
17008 Self::Primary => std::option::Option::Some("PRIMARY"),
17009 Self::Variant => std::option::Option::Some("VARIANT"),
17010 Self::Collection => std::option::Option::Some("COLLECTION"),
17011 Self::UnknownValue(u) => u.0.name(),
17012 }
17013 }
17014 }
17015
17016 impl std::default::Default for Type {
17017 fn default() -> Self {
17018 use std::convert::From;
17019 Self::from(0)
17020 }
17021 }
17022
17023 impl std::fmt::Display for Type {
17024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17025 wkt::internal::display_enum(f, self.name(), self.value())
17026 }
17027 }
17028
17029 impl std::convert::From<i32> for Type {
17030 fn from(value: i32) -> Self {
17031 match value {
17032 0 => Self::Unspecified,
17033 1 => Self::Primary,
17034 2 => Self::Variant,
17035 3 => Self::Collection,
17036 _ => Self::UnknownValue(r#type::UnknownValue(
17037 wkt::internal::UnknownEnumValue::Integer(value),
17038 )),
17039 }
17040 }
17041 }
17042
17043 impl std::convert::From<&str> for Type {
17044 fn from(value: &str) -> Self {
17045 use std::string::ToString;
17046 match value {
17047 "TYPE_UNSPECIFIED" => Self::Unspecified,
17048 "PRIMARY" => Self::Primary,
17049 "VARIANT" => Self::Variant,
17050 "COLLECTION" => Self::Collection,
17051 _ => Self::UnknownValue(r#type::UnknownValue(
17052 wkt::internal::UnknownEnumValue::String(value.to_string()),
17053 )),
17054 }
17055 }
17056 }
17057
17058 impl serde::ser::Serialize for Type {
17059 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17060 where
17061 S: serde::Serializer,
17062 {
17063 match self {
17064 Self::Unspecified => serializer.serialize_i32(0),
17065 Self::Primary => serializer.serialize_i32(1),
17066 Self::Variant => serializer.serialize_i32(2),
17067 Self::Collection => serializer.serialize_i32(3),
17068 Self::UnknownValue(u) => u.0.serialize(serializer),
17069 }
17070 }
17071 }
17072
17073 impl<'de> serde::de::Deserialize<'de> for Type {
17074 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17075 where
17076 D: serde::Deserializer<'de>,
17077 {
17078 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
17079 ".google.cloud.retail.v2.Product.Type",
17080 ))
17081 }
17082 }
17083
17084 /// Product availability. If this field is unspecified, the product is
17085 /// assumed to be in stock.
17086 ///
17087 /// # Working with unknown values
17088 ///
17089 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17090 /// additional enum variants at any time. Adding new variants is not considered
17091 /// a breaking change. Applications should write their code in anticipation of:
17092 ///
17093 /// - New values appearing in future releases of the client library, **and**
17094 /// - New values received dynamically, without application changes.
17095 ///
17096 /// Please consult the [Working with enums] section in the user guide for some
17097 /// guidelines.
17098 ///
17099 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17100 #[derive(Clone, Debug, PartialEq)]
17101 #[non_exhaustive]
17102 pub enum Availability {
17103 /// Default product availability. Default to
17104 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
17105 /// if unset.
17106 ///
17107 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
17108 Unspecified,
17109 /// Product in stock.
17110 InStock,
17111 /// Product out of stock.
17112 OutOfStock,
17113 /// Product that is in pre-order state.
17114 Preorder,
17115 /// Product that is back-ordered (i.e. temporarily out of stock).
17116 Backorder,
17117 /// If set, the enum was initialized with an unknown value.
17118 ///
17119 /// Applications can examine the value using [Availability::value] or
17120 /// [Availability::name].
17121 UnknownValue(availability::UnknownValue),
17122 }
17123
17124 #[doc(hidden)]
17125 pub mod availability {
17126 #[allow(unused_imports)]
17127 use super::*;
17128 #[derive(Clone, Debug, PartialEq)]
17129 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17130 }
17131
17132 impl Availability {
17133 /// Gets the enum value.
17134 ///
17135 /// Returns `None` if the enum contains an unknown value deserialized from
17136 /// the string representation of enums.
17137 pub fn value(&self) -> std::option::Option<i32> {
17138 match self {
17139 Self::Unspecified => std::option::Option::Some(0),
17140 Self::InStock => std::option::Option::Some(1),
17141 Self::OutOfStock => std::option::Option::Some(2),
17142 Self::Preorder => std::option::Option::Some(3),
17143 Self::Backorder => std::option::Option::Some(4),
17144 Self::UnknownValue(u) => u.0.value(),
17145 }
17146 }
17147
17148 /// Gets the enum value as a string.
17149 ///
17150 /// Returns `None` if the enum contains an unknown value deserialized from
17151 /// the integer representation of enums.
17152 pub fn name(&self) -> std::option::Option<&str> {
17153 match self {
17154 Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17155 Self::InStock => std::option::Option::Some("IN_STOCK"),
17156 Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17157 Self::Preorder => std::option::Option::Some("PREORDER"),
17158 Self::Backorder => std::option::Option::Some("BACKORDER"),
17159 Self::UnknownValue(u) => u.0.name(),
17160 }
17161 }
17162 }
17163
17164 impl std::default::Default for Availability {
17165 fn default() -> Self {
17166 use std::convert::From;
17167 Self::from(0)
17168 }
17169 }
17170
17171 impl std::fmt::Display for Availability {
17172 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17173 wkt::internal::display_enum(f, self.name(), self.value())
17174 }
17175 }
17176
17177 impl std::convert::From<i32> for Availability {
17178 fn from(value: i32) -> Self {
17179 match value {
17180 0 => Self::Unspecified,
17181 1 => Self::InStock,
17182 2 => Self::OutOfStock,
17183 3 => Self::Preorder,
17184 4 => Self::Backorder,
17185 _ => Self::UnknownValue(availability::UnknownValue(
17186 wkt::internal::UnknownEnumValue::Integer(value),
17187 )),
17188 }
17189 }
17190 }
17191
17192 impl std::convert::From<&str> for Availability {
17193 fn from(value: &str) -> Self {
17194 use std::string::ToString;
17195 match value {
17196 "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17197 "IN_STOCK" => Self::InStock,
17198 "OUT_OF_STOCK" => Self::OutOfStock,
17199 "PREORDER" => Self::Preorder,
17200 "BACKORDER" => Self::Backorder,
17201 _ => Self::UnknownValue(availability::UnknownValue(
17202 wkt::internal::UnknownEnumValue::String(value.to_string()),
17203 )),
17204 }
17205 }
17206 }
17207
17208 impl serde::ser::Serialize for Availability {
17209 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17210 where
17211 S: serde::Serializer,
17212 {
17213 match self {
17214 Self::Unspecified => serializer.serialize_i32(0),
17215 Self::InStock => serializer.serialize_i32(1),
17216 Self::OutOfStock => serializer.serialize_i32(2),
17217 Self::Preorder => serializer.serialize_i32(3),
17218 Self::Backorder => serializer.serialize_i32(4),
17219 Self::UnknownValue(u) => u.0.serialize(serializer),
17220 }
17221 }
17222 }
17223
17224 impl<'de> serde::de::Deserialize<'de> for Availability {
17225 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17226 where
17227 D: serde::Deserializer<'de>,
17228 {
17229 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17230 ".google.cloud.retail.v2.Product.Availability",
17231 ))
17232 }
17233 }
17234
17235 #[allow(missing_docs)]
17236 #[derive(Clone, Debug, PartialEq)]
17237 #[non_exhaustive]
17238 pub enum Expiration {
17239 /// Note that this field is applied in the following ways:
17240 ///
17241 /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17242 /// when it is uploaded, this product
17243 /// is not indexed for search.
17244 ///
17245 /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17246 /// is uploaded, only the
17247 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17248 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17249 /// expireTime is respected, and
17250 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17251 /// expireTime is not used.
17252 ///
17253 ///
17254 /// In general, we suggest the users to delete the stale
17255 /// products explicitly, instead of using this field to determine staleness.
17256 ///
17257 /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17258 /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17259 /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17260 /// INVALID_ARGUMENT error is thrown.
17261 ///
17262 /// Corresponding properties: Google Merchant Center property
17263 /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17264 ///
17265 /// [google.cloud.retail.v2.Product]: crate::model::Product
17266 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17267 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17268 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17269 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17270 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17271 /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17272 ExpireTime(std::boxed::Box<wkt::Timestamp>),
17273 /// Input only. The TTL (time to live) of the product. Note that this is only
17274 /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17275 /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17276 /// and ignored for
17277 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17278 /// we suggest the users to delete the stale products explicitly, instead of
17279 /// using this field to determine staleness.
17280 ///
17281 /// If it is set, it must be a non-negative value, and
17282 /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17283 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17284 /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17285 /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17286 /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17287 ///
17288 /// If it is set, the product is not available for
17289 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17290 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17291 /// However, the product can still be retrieved by
17292 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17293 /// and
17294 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17295 ///
17296 /// [google.cloud.retail.v2.Product]: crate::model::Product
17297 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17298 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17299 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17300 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17301 /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17302 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17303 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17304 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17305 Ttl(std::boxed::Box<wkt::Duration>),
17306 }
17307}
17308
17309/// Request message for
17310/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17311/// method.
17312///
17313/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17314#[derive(Clone, Default, PartialEq)]
17315#[non_exhaustive]
17316pub struct CreateProductRequest {
17317 /// Required. The parent catalog resource name, such as
17318 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17319 pub parent: std::string::String,
17320
17321 /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17322 ///
17323 /// [google.cloud.retail.v2.Product]: crate::model::Product
17324 pub product: std::option::Option<crate::model::Product>,
17325
17326 /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17327 /// which will become the final component of the
17328 /// [Product.name][google.cloud.retail.v2.Product.name].
17329 ///
17330 /// If the caller does not have permission to create the
17331 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17332 /// exists, a PERMISSION_DENIED error is returned.
17333 ///
17334 /// This field must be unique among all
17335 /// [Product][google.cloud.retail.v2.Product]s with the same
17336 /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17337 /// ALREADY_EXISTS error is returned.
17338 ///
17339 /// This field must be a UTF-8 encoded string with a length limit of 128
17340 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17341 ///
17342 /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17343 /// [google.cloud.retail.v2.Product]: crate::model::Product
17344 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17345 pub product_id: std::string::String,
17346
17347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17348}
17349
17350impl CreateProductRequest {
17351 /// Creates a new default instance.
17352 pub fn new() -> Self {
17353 std::default::Default::default()
17354 }
17355
17356 /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17357 ///
17358 /// # Example
17359 /// ```ignore,no_run
17360 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17361 /// let x = CreateProductRequest::new().set_parent("example");
17362 /// ```
17363 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17364 self.parent = v.into();
17365 self
17366 }
17367
17368 /// Sets the value of [product][crate::model::CreateProductRequest::product].
17369 ///
17370 /// # Example
17371 /// ```ignore,no_run
17372 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17373 /// use google_cloud_retail_v2::model::Product;
17374 /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17375 /// ```
17376 pub fn set_product<T>(mut self, v: T) -> Self
17377 where
17378 T: std::convert::Into<crate::model::Product>,
17379 {
17380 self.product = std::option::Option::Some(v.into());
17381 self
17382 }
17383
17384 /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17385 ///
17386 /// # Example
17387 /// ```ignore,no_run
17388 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17389 /// use google_cloud_retail_v2::model::Product;
17390 /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17391 /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17392 /// ```
17393 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17394 where
17395 T: std::convert::Into<crate::model::Product>,
17396 {
17397 self.product = v.map(|x| x.into());
17398 self
17399 }
17400
17401 /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17402 ///
17403 /// # Example
17404 /// ```ignore,no_run
17405 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17406 /// let x = CreateProductRequest::new().set_product_id("example");
17407 /// ```
17408 pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17409 self.product_id = v.into();
17410 self
17411 }
17412}
17413
17414impl wkt::message::Message for CreateProductRequest {
17415 fn typename() -> &'static str {
17416 "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17417 }
17418}
17419
17420/// Request message for
17421/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17422/// method.
17423///
17424/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17425#[derive(Clone, Default, PartialEq)]
17426#[non_exhaustive]
17427pub struct GetProductRequest {
17428 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17429 /// such as
17430 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17431 ///
17432 /// If the caller does not have permission to access the
17433 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17434 /// exists, a PERMISSION_DENIED error is returned.
17435 ///
17436 /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17437 /// a NOT_FOUND error is returned.
17438 ///
17439 /// [google.cloud.retail.v2.Product]: crate::model::Product
17440 pub name: std::string::String,
17441
17442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17443}
17444
17445impl GetProductRequest {
17446 /// Creates a new default instance.
17447 pub fn new() -> Self {
17448 std::default::Default::default()
17449 }
17450
17451 /// Sets the value of [name][crate::model::GetProductRequest::name].
17452 ///
17453 /// # Example
17454 /// ```ignore,no_run
17455 /// # use google_cloud_retail_v2::model::GetProductRequest;
17456 /// let x = GetProductRequest::new().set_name("example");
17457 /// ```
17458 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17459 self.name = v.into();
17460 self
17461 }
17462}
17463
17464impl wkt::message::Message for GetProductRequest {
17465 fn typename() -> &'static str {
17466 "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17467 }
17468}
17469
17470/// Request message for
17471/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17472/// method.
17473///
17474/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17475#[derive(Clone, Default, PartialEq)]
17476#[non_exhaustive]
17477pub struct UpdateProductRequest {
17478 /// Required. The product to update/create.
17479 ///
17480 /// If the caller does not have permission to update the
17481 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17482 /// exists, a PERMISSION_DENIED error is returned.
17483 ///
17484 /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17485 /// and
17486 /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17487 /// is not set, a NOT_FOUND error is returned.
17488 ///
17489 /// [google.cloud.retail.v2.Product]: crate::model::Product
17490 /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17491 pub product: std::option::Option<crate::model::Product>,
17492
17493 /// Indicates which fields in the provided
17494 /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17495 /// output only fields are NOT supported. If not set, all supported fields (the
17496 /// fields that are neither immutable nor output only) are updated.
17497 ///
17498 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17499 /// is returned.
17500 ///
17501 /// The attribute key can be updated by setting the mask path as
17502 /// "attributes.${key_name}". If a key name is present in the mask but not in
17503 /// the patching product from the request, this key will be deleted after the
17504 /// update.
17505 ///
17506 /// [google.cloud.retail.v2.Product]: crate::model::Product
17507 pub update_mask: std::option::Option<wkt::FieldMask>,
17508
17509 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17510 /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17511 /// this situation, `update_mask` is ignored.
17512 ///
17513 /// [google.cloud.retail.v2.Product]: crate::model::Product
17514 pub allow_missing: bool,
17515
17516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17517}
17518
17519impl UpdateProductRequest {
17520 /// Creates a new default instance.
17521 pub fn new() -> Self {
17522 std::default::Default::default()
17523 }
17524
17525 /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17526 ///
17527 /// # Example
17528 /// ```ignore,no_run
17529 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17530 /// use google_cloud_retail_v2::model::Product;
17531 /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17532 /// ```
17533 pub fn set_product<T>(mut self, v: T) -> Self
17534 where
17535 T: std::convert::Into<crate::model::Product>,
17536 {
17537 self.product = std::option::Option::Some(v.into());
17538 self
17539 }
17540
17541 /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17542 ///
17543 /// # Example
17544 /// ```ignore,no_run
17545 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17546 /// use google_cloud_retail_v2::model::Product;
17547 /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17548 /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17549 /// ```
17550 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17551 where
17552 T: std::convert::Into<crate::model::Product>,
17553 {
17554 self.product = v.map(|x| x.into());
17555 self
17556 }
17557
17558 /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17559 ///
17560 /// # Example
17561 /// ```ignore,no_run
17562 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17563 /// use wkt::FieldMask;
17564 /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17565 /// ```
17566 pub fn set_update_mask<T>(mut self, v: T) -> Self
17567 where
17568 T: std::convert::Into<wkt::FieldMask>,
17569 {
17570 self.update_mask = std::option::Option::Some(v.into());
17571 self
17572 }
17573
17574 /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17575 ///
17576 /// # Example
17577 /// ```ignore,no_run
17578 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17579 /// use wkt::FieldMask;
17580 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17581 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17582 /// ```
17583 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17584 where
17585 T: std::convert::Into<wkt::FieldMask>,
17586 {
17587 self.update_mask = v.map(|x| x.into());
17588 self
17589 }
17590
17591 /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17592 ///
17593 /// # Example
17594 /// ```ignore,no_run
17595 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17596 /// let x = UpdateProductRequest::new().set_allow_missing(true);
17597 /// ```
17598 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17599 self.allow_missing = v.into();
17600 self
17601 }
17602}
17603
17604impl wkt::message::Message for UpdateProductRequest {
17605 fn typename() -> &'static str {
17606 "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17607 }
17608}
17609
17610/// Request message for
17611/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17612/// method.
17613///
17614/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17615#[derive(Clone, Default, PartialEq)]
17616#[non_exhaustive]
17617pub struct DeleteProductRequest {
17618 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17619 /// such as
17620 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17621 ///
17622 /// If the caller does not have permission to delete the
17623 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17624 /// exists, a PERMISSION_DENIED error is returned.
17625 ///
17626 /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17627 /// a NOT_FOUND error is returned.
17628 ///
17629 /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17630 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17631 /// [Product][google.cloud.retail.v2.Product] member nor a
17632 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17633 /// [Product][google.cloud.retail.v2.Product] with more than one
17634 /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17635 /// INVALID_ARGUMENT error is returned.
17636 ///
17637 /// All inventory information for the named
17638 /// [Product][google.cloud.retail.v2.Product] will be deleted.
17639 ///
17640 /// [google.cloud.retail.v2.Product]: crate::model::Product
17641 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17642 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17643 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17644 pub name: std::string::String,
17645
17646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17647}
17648
17649impl DeleteProductRequest {
17650 /// Creates a new default instance.
17651 pub fn new() -> Self {
17652 std::default::Default::default()
17653 }
17654
17655 /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17656 ///
17657 /// # Example
17658 /// ```ignore,no_run
17659 /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17660 /// let x = DeleteProductRequest::new().set_name("example");
17661 /// ```
17662 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17663 self.name = v.into();
17664 self
17665 }
17666}
17667
17668impl wkt::message::Message for DeleteProductRequest {
17669 fn typename() -> &'static str {
17670 "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17671 }
17672}
17673
17674/// Request message for
17675/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17676/// method.
17677///
17678/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17679#[derive(Clone, Default, PartialEq)]
17680#[non_exhaustive]
17681pub struct ListProductsRequest {
17682 /// Required. The parent branch resource name, such as
17683 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17684 /// `default_branch` as the branch ID, to list products under the default
17685 /// branch.
17686 ///
17687 /// If the caller does not have permission to list
17688 /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17689 /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17690 ///
17691 /// [google.cloud.retail.v2.Product]: crate::model::Product
17692 pub parent: std::string::String,
17693
17694 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17695 /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17696 /// above 1000 will be coerced to 1000.
17697 ///
17698 /// If this field is negative, an INVALID_ARGUMENT error is returned.
17699 ///
17700 /// [google.cloud.retail.v2.Product]: crate::model::Product
17701 pub page_size: i32,
17702
17703 /// A page token
17704 /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17705 /// received from a previous
17706 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17707 /// call. Provide this to retrieve the subsequent page.
17708 ///
17709 /// When paginating, all other parameters provided to
17710 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17711 /// must match the call that provided the page token. Otherwise, an
17712 /// INVALID_ARGUMENT error is returned.
17713 ///
17714 /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17715 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17716 pub page_token: std::string::String,
17717
17718 /// A filter to apply on the list results. Supported features:
17719 ///
17720 /// * List all the products under the parent branch if
17721 /// [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17722 /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17723 /// [Product][google.cloud.retail.v2.Product]s sharing the same
17724 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17725 /// [Product][google.cloud.retail.v2.Product]. For example:
17726 /// `primary_product_id = "some_product_id"`
17727 /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17728 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17729 /// [Product][google.cloud.retail.v2.Product].
17730 /// For example:
17731 /// `collection_product_id = "some_product_id"`
17732 /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17733 /// For example:
17734 /// `type = "PRIMARY"`
17735 /// `type = "VARIANT"`
17736 /// `type = "COLLECTION"`
17737 ///
17738 /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17739 ///
17740 /// If the specified
17741 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17742 /// [Product][google.cloud.retail.v2.Product] or
17743 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17744 /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17745 /// is returned.
17746 ///
17747 /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17748 /// [google.cloud.retail.v2.Product]: crate::model::Product
17749 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17750 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17751 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17752 pub filter: std::string::String,
17753
17754 /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17755 /// responses. If not set or empty, the following fields are returned:
17756 ///
17757 /// * [Product.name][google.cloud.retail.v2.Product.name]
17758 /// * [Product.id][google.cloud.retail.v2.Product.id]
17759 /// * [Product.title][google.cloud.retail.v2.Product.title]
17760 /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17761 /// * [Product.images][google.cloud.retail.v2.Product.images]
17762 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17763 /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17764 ///
17765 /// If "*" is provided, all fields are returned.
17766 /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17767 /// matter what mask is set.
17768 ///
17769 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17770 /// is returned.
17771 ///
17772 /// [google.cloud.retail.v2.Product]: crate::model::Product
17773 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17774 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17775 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17776 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17777 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17778 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17779 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17780 pub read_mask: std::option::Option<wkt::FieldMask>,
17781
17782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17783}
17784
17785impl ListProductsRequest {
17786 /// Creates a new default instance.
17787 pub fn new() -> Self {
17788 std::default::Default::default()
17789 }
17790
17791 /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17792 ///
17793 /// # Example
17794 /// ```ignore,no_run
17795 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17796 /// let x = ListProductsRequest::new().set_parent("example");
17797 /// ```
17798 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17799 self.parent = v.into();
17800 self
17801 }
17802
17803 /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17804 ///
17805 /// # Example
17806 /// ```ignore,no_run
17807 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17808 /// let x = ListProductsRequest::new().set_page_size(42);
17809 /// ```
17810 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17811 self.page_size = v.into();
17812 self
17813 }
17814
17815 /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17816 ///
17817 /// # Example
17818 /// ```ignore,no_run
17819 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17820 /// let x = ListProductsRequest::new().set_page_token("example");
17821 /// ```
17822 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17823 self.page_token = v.into();
17824 self
17825 }
17826
17827 /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17828 ///
17829 /// # Example
17830 /// ```ignore,no_run
17831 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17832 /// let x = ListProductsRequest::new().set_filter("example");
17833 /// ```
17834 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17835 self.filter = v.into();
17836 self
17837 }
17838
17839 /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17840 ///
17841 /// # Example
17842 /// ```ignore,no_run
17843 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17844 /// use wkt::FieldMask;
17845 /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17846 /// ```
17847 pub fn set_read_mask<T>(mut self, v: T) -> Self
17848 where
17849 T: std::convert::Into<wkt::FieldMask>,
17850 {
17851 self.read_mask = std::option::Option::Some(v.into());
17852 self
17853 }
17854
17855 /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17856 ///
17857 /// # Example
17858 /// ```ignore,no_run
17859 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17860 /// use wkt::FieldMask;
17861 /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17862 /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17863 /// ```
17864 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17865 where
17866 T: std::convert::Into<wkt::FieldMask>,
17867 {
17868 self.read_mask = v.map(|x| x.into());
17869 self
17870 }
17871}
17872
17873impl wkt::message::Message for ListProductsRequest {
17874 fn typename() -> &'static str {
17875 "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17876 }
17877}
17878
17879/// Response message for
17880/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17881/// method.
17882///
17883/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17884#[derive(Clone, Default, PartialEq)]
17885#[non_exhaustive]
17886pub struct ListProductsResponse {
17887 /// The [Product][google.cloud.retail.v2.Product]s.
17888 ///
17889 /// [google.cloud.retail.v2.Product]: crate::model::Product
17890 pub products: std::vec::Vec<crate::model::Product>,
17891
17892 /// A token that can be sent as
17893 /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
17894 /// to retrieve the next page. If this field is omitted, there are no
17895 /// subsequent pages.
17896 ///
17897 /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
17898 pub next_page_token: std::string::String,
17899
17900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17901}
17902
17903impl ListProductsResponse {
17904 /// Creates a new default instance.
17905 pub fn new() -> Self {
17906 std::default::Default::default()
17907 }
17908
17909 /// Sets the value of [products][crate::model::ListProductsResponse::products].
17910 ///
17911 /// # Example
17912 /// ```ignore,no_run
17913 /// # use google_cloud_retail_v2::model::ListProductsResponse;
17914 /// use google_cloud_retail_v2::model::Product;
17915 /// let x = ListProductsResponse::new()
17916 /// .set_products([
17917 /// Product::default()/* use setters */,
17918 /// Product::default()/* use (different) setters */,
17919 /// ]);
17920 /// ```
17921 pub fn set_products<T, V>(mut self, v: T) -> Self
17922 where
17923 T: std::iter::IntoIterator<Item = V>,
17924 V: std::convert::Into<crate::model::Product>,
17925 {
17926 use std::iter::Iterator;
17927 self.products = v.into_iter().map(|i| i.into()).collect();
17928 self
17929 }
17930
17931 /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
17932 ///
17933 /// # Example
17934 /// ```ignore,no_run
17935 /// # use google_cloud_retail_v2::model::ListProductsResponse;
17936 /// let x = ListProductsResponse::new().set_next_page_token("example");
17937 /// ```
17938 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17939 self.next_page_token = v.into();
17940 self
17941 }
17942}
17943
17944impl wkt::message::Message for ListProductsResponse {
17945 fn typename() -> &'static str {
17946 "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
17947 }
17948}
17949
17950#[doc(hidden)]
17951impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
17952 type PageItem = crate::model::Product;
17953
17954 fn items(self) -> std::vec::Vec<Self::PageItem> {
17955 self.products
17956 }
17957
17958 fn next_page_token(&self) -> std::string::String {
17959 use std::clone::Clone;
17960 self.next_page_token.clone()
17961 }
17962}
17963
17964/// Request message for
17965/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
17966/// method.
17967///
17968/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
17969#[derive(Clone, Default, PartialEq)]
17970#[non_exhaustive]
17971pub struct SetInventoryRequest {
17972 /// Required. The inventory information to update. The allowable fields to
17973 /// update are:
17974 ///
17975 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17976 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17977 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17978 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17979 /// The updated inventory fields must be specified in
17980 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
17981 ///
17982 /// If
17983 /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
17984 /// is empty or invalid, an INVALID_ARGUMENT error is returned.
17985 ///
17986 /// If the caller does not have permission to update the
17987 /// [Product][google.cloud.retail.v2.Product] named in
17988 /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
17989 /// or not it exists, a PERMISSION_DENIED error is returned.
17990 ///
17991 /// If the [Product][google.cloud.retail.v2.Product] to update does not have
17992 /// existing inventory information, the provided inventory information will be
17993 /// inserted.
17994 ///
17995 /// If the [Product][google.cloud.retail.v2.Product] to update has existing
17996 /// inventory information, the provided inventory information will be merged
17997 /// while respecting the last update time for each inventory field, using the
17998 /// provided or default value for
17999 /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
18000 ///
18001 /// The caller can replace place IDs for a subset of fulfillment types in the
18002 /// following ways:
18003 ///
18004 /// * Adds "fulfillment_info" in
18005 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18006 /// * Specifies only the desired fulfillment types and corresponding place IDs
18007 /// to update in
18008 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18009 ///
18010 /// The caller can clear all place IDs from a subset of fulfillment types in
18011 /// the following ways:
18012 ///
18013 /// * Adds "fulfillment_info" in
18014 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18015 /// * Specifies only the desired fulfillment types to clear in
18016 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18017 /// * Checks that only the desired fulfillment info types have empty
18018 /// [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
18019 ///
18020 /// The last update time is recorded for the following inventory fields:
18021 ///
18022 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
18023 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
18024 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
18025 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18026 ///
18027 /// If a full overwrite of inventory information while ignoring timestamps is
18028 /// needed,
18029 /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
18030 /// should be invoked instead.
18031 ///
18032 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
18033 /// [google.cloud.retail.v2.Product]: crate::model::Product
18034 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
18035 /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
18036 /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
18037 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18038 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
18039 /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
18040 /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
18041 /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
18042 pub inventory: std::option::Option<crate::model::Product>,
18043
18044 /// Indicates which inventory fields in the provided
18045 /// [Product][google.cloud.retail.v2.Product] to update.
18046 ///
18047 /// At least one field must be provided.
18048 ///
18049 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18050 /// is returned and the entire update will be ignored.
18051 ///
18052 /// [google.cloud.retail.v2.Product]: crate::model::Product
18053 pub set_mask: std::option::Option<wkt::FieldMask>,
18054
18055 /// The time when the request is issued, used to prevent
18056 /// out-of-order updates on inventory fields with the last update time
18057 /// recorded. If not provided, the internal system time will be used.
18058 pub set_time: std::option::Option<wkt::Timestamp>,
18059
18060 /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
18061 /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
18062 /// inventory update will still be processed and retained for at most 1 day
18063 /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
18064 /// false, a NOT_FOUND error is returned if the
18065 /// [Product][google.cloud.retail.v2.Product] is not found.
18066 ///
18067 /// [google.cloud.retail.v2.Product]: crate::model::Product
18068 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18069 pub allow_missing: bool,
18070
18071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18072}
18073
18074impl SetInventoryRequest {
18075 /// Creates a new default instance.
18076 pub fn new() -> Self {
18077 std::default::Default::default()
18078 }
18079
18080 /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
18081 ///
18082 /// # Example
18083 /// ```ignore,no_run
18084 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18085 /// use google_cloud_retail_v2::model::Product;
18086 /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
18087 /// ```
18088 pub fn set_inventory<T>(mut self, v: T) -> Self
18089 where
18090 T: std::convert::Into<crate::model::Product>,
18091 {
18092 self.inventory = std::option::Option::Some(v.into());
18093 self
18094 }
18095
18096 /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
18097 ///
18098 /// # Example
18099 /// ```ignore,no_run
18100 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18101 /// use google_cloud_retail_v2::model::Product;
18102 /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
18103 /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
18104 /// ```
18105 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
18106 where
18107 T: std::convert::Into<crate::model::Product>,
18108 {
18109 self.inventory = v.map(|x| x.into());
18110 self
18111 }
18112
18113 /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18114 ///
18115 /// # Example
18116 /// ```ignore,no_run
18117 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18118 /// use wkt::FieldMask;
18119 /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
18120 /// ```
18121 pub fn set_set_mask<T>(mut self, v: T) -> Self
18122 where
18123 T: std::convert::Into<wkt::FieldMask>,
18124 {
18125 self.set_mask = std::option::Option::Some(v.into());
18126 self
18127 }
18128
18129 /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18130 ///
18131 /// # Example
18132 /// ```ignore,no_run
18133 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18134 /// use wkt::FieldMask;
18135 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
18136 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
18137 /// ```
18138 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
18139 where
18140 T: std::convert::Into<wkt::FieldMask>,
18141 {
18142 self.set_mask = v.map(|x| x.into());
18143 self
18144 }
18145
18146 /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18147 ///
18148 /// # Example
18149 /// ```ignore,no_run
18150 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18151 /// use wkt::Timestamp;
18152 /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18153 /// ```
18154 pub fn set_set_time<T>(mut self, v: T) -> Self
18155 where
18156 T: std::convert::Into<wkt::Timestamp>,
18157 {
18158 self.set_time = std::option::Option::Some(v.into());
18159 self
18160 }
18161
18162 /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18163 ///
18164 /// # Example
18165 /// ```ignore,no_run
18166 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18167 /// use wkt::Timestamp;
18168 /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18169 /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18170 /// ```
18171 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18172 where
18173 T: std::convert::Into<wkt::Timestamp>,
18174 {
18175 self.set_time = v.map(|x| x.into());
18176 self
18177 }
18178
18179 /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18180 ///
18181 /// # Example
18182 /// ```ignore,no_run
18183 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18184 /// let x = SetInventoryRequest::new().set_allow_missing(true);
18185 /// ```
18186 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18187 self.allow_missing = v.into();
18188 self
18189 }
18190}
18191
18192impl wkt::message::Message for SetInventoryRequest {
18193 fn typename() -> &'static str {
18194 "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18195 }
18196}
18197
18198/// Metadata related to the progress of the SetInventory operation.
18199/// Currently empty because there is no meaningful metadata populated from the
18200/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18201/// method.
18202///
18203/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18204#[derive(Clone, Default, PartialEq)]
18205#[non_exhaustive]
18206pub struct SetInventoryMetadata {
18207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18208}
18209
18210impl SetInventoryMetadata {
18211 /// Creates a new default instance.
18212 pub fn new() -> Self {
18213 std::default::Default::default()
18214 }
18215}
18216
18217impl wkt::message::Message for SetInventoryMetadata {
18218 fn typename() -> &'static str {
18219 "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18220 }
18221}
18222
18223/// Response of the SetInventoryRequest. Currently empty because
18224/// there is no meaningful response populated from the
18225/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18226/// method.
18227///
18228/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18229#[derive(Clone, Default, PartialEq)]
18230#[non_exhaustive]
18231pub struct SetInventoryResponse {
18232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18233}
18234
18235impl SetInventoryResponse {
18236 /// Creates a new default instance.
18237 pub fn new() -> Self {
18238 std::default::Default::default()
18239 }
18240}
18241
18242impl wkt::message::Message for SetInventoryResponse {
18243 fn typename() -> &'static str {
18244 "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18245 }
18246}
18247
18248/// Request message for
18249/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18250/// method.
18251///
18252/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18253#[derive(Clone, Default, PartialEq)]
18254#[non_exhaustive]
18255pub struct AddFulfillmentPlacesRequest {
18256 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18257 /// such as
18258 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18259 ///
18260 /// If the caller does not have permission to access the
18261 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18262 /// exists, a PERMISSION_DENIED error is returned.
18263 ///
18264 /// [google.cloud.retail.v2.Product]: crate::model::Product
18265 pub product: std::string::String,
18266
18267 /// Required. The fulfillment type, including commonly used types (such as
18268 /// pickup in store and same day delivery), and custom types.
18269 ///
18270 /// Supported values:
18271 ///
18272 /// * "pickup-in-store"
18273 /// * "ship-to-store"
18274 /// * "same-day-delivery"
18275 /// * "next-day-delivery"
18276 /// * "custom-type-1"
18277 /// * "custom-type-2"
18278 /// * "custom-type-3"
18279 /// * "custom-type-4"
18280 /// * "custom-type-5"
18281 ///
18282 /// If this field is set to an invalid value other than these, an
18283 /// INVALID_ARGUMENT error is returned.
18284 ///
18285 /// This field directly corresponds to
18286 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18287 ///
18288 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18289 pub r#type: std::string::String,
18290
18291 /// Required. The IDs for this
18292 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18293 /// the store IDs for "pickup-in-store" or the region IDs for
18294 /// "same-day-delivery" to be added for this
18295 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18296 /// IDs will be automatically ignored.
18297 ///
18298 /// At least 1 value is required, and a maximum of 2000 values are allowed.
18299 /// Each value must be a string with a length limit of 10 characters, matching
18300 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18301 /// INVALID_ARGUMENT error is returned.
18302 ///
18303 /// If the total number of place IDs exceeds 2000 for this
18304 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18305 /// adding, then the update will be rejected.
18306 ///
18307 /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18308 pub place_ids: std::vec::Vec<std::string::String>,
18309
18310 /// The time when the fulfillment updates are issued, used to prevent
18311 /// out-of-order updates on fulfillment information. If not provided, the
18312 /// internal system time will be used.
18313 pub add_time: std::option::Option<wkt::Timestamp>,
18314
18315 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18316 /// found, the fulfillment information will still be processed and retained for
18317 /// at most 1 day and processed once the
18318 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18319 /// NOT_FOUND error is returned if the
18320 /// [Product][google.cloud.retail.v2.Product] is not found.
18321 ///
18322 /// [google.cloud.retail.v2.Product]: crate::model::Product
18323 pub allow_missing: bool,
18324
18325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18326}
18327
18328impl AddFulfillmentPlacesRequest {
18329 /// Creates a new default instance.
18330 pub fn new() -> Self {
18331 std::default::Default::default()
18332 }
18333
18334 /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18335 ///
18336 /// # Example
18337 /// ```ignore,no_run
18338 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18339 /// let x = AddFulfillmentPlacesRequest::new().set_product("example");
18340 /// ```
18341 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18342 self.product = v.into();
18343 self
18344 }
18345
18346 /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18347 ///
18348 /// # Example
18349 /// ```ignore,no_run
18350 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18351 /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18352 /// ```
18353 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18354 self.r#type = v.into();
18355 self
18356 }
18357
18358 /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18359 ///
18360 /// # Example
18361 /// ```ignore,no_run
18362 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18363 /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18364 /// ```
18365 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18366 where
18367 T: std::iter::IntoIterator<Item = V>,
18368 V: std::convert::Into<std::string::String>,
18369 {
18370 use std::iter::Iterator;
18371 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18372 self
18373 }
18374
18375 /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18376 ///
18377 /// # Example
18378 /// ```ignore,no_run
18379 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18380 /// use wkt::Timestamp;
18381 /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18382 /// ```
18383 pub fn set_add_time<T>(mut self, v: T) -> Self
18384 where
18385 T: std::convert::Into<wkt::Timestamp>,
18386 {
18387 self.add_time = std::option::Option::Some(v.into());
18388 self
18389 }
18390
18391 /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18392 ///
18393 /// # Example
18394 /// ```ignore,no_run
18395 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18396 /// use wkt::Timestamp;
18397 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18398 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18399 /// ```
18400 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18401 where
18402 T: std::convert::Into<wkt::Timestamp>,
18403 {
18404 self.add_time = v.map(|x| x.into());
18405 self
18406 }
18407
18408 /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18409 ///
18410 /// # Example
18411 /// ```ignore,no_run
18412 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18413 /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18414 /// ```
18415 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18416 self.allow_missing = v.into();
18417 self
18418 }
18419}
18420
18421impl wkt::message::Message for AddFulfillmentPlacesRequest {
18422 fn typename() -> &'static str {
18423 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18424 }
18425}
18426
18427/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18428/// Currently empty because there is no meaningful metadata populated from the
18429/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18430/// method.
18431///
18432/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18433#[derive(Clone, Default, PartialEq)]
18434#[non_exhaustive]
18435pub struct AddFulfillmentPlacesMetadata {
18436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18437}
18438
18439impl AddFulfillmentPlacesMetadata {
18440 /// Creates a new default instance.
18441 pub fn new() -> Self {
18442 std::default::Default::default()
18443 }
18444}
18445
18446impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18447 fn typename() -> &'static str {
18448 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18449 }
18450}
18451
18452/// Response of the AddFulfillmentPlacesRequest. Currently empty because
18453/// there is no meaningful response populated from the
18454/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18455/// method.
18456///
18457/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18458#[derive(Clone, Default, PartialEq)]
18459#[non_exhaustive]
18460pub struct AddFulfillmentPlacesResponse {
18461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18462}
18463
18464impl AddFulfillmentPlacesResponse {
18465 /// Creates a new default instance.
18466 pub fn new() -> Self {
18467 std::default::Default::default()
18468 }
18469}
18470
18471impl wkt::message::Message for AddFulfillmentPlacesResponse {
18472 fn typename() -> &'static str {
18473 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18474 }
18475}
18476
18477/// Request message for
18478/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18479/// method.
18480///
18481/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18482#[derive(Clone, Default, PartialEq)]
18483#[non_exhaustive]
18484pub struct AddLocalInventoriesRequest {
18485 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18486 /// such as
18487 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18488 ///
18489 /// If the caller does not have permission to access the
18490 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18491 /// exists, a PERMISSION_DENIED error is returned.
18492 ///
18493 /// [google.cloud.retail.v2.Product]: crate::model::Product
18494 pub product: std::string::String,
18495
18496 /// Required. A list of inventory information at difference places. Each place
18497 /// is identified by its place ID. At most 3000 inventories are allowed per
18498 /// request.
18499 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18500
18501 /// Indicates which inventory fields in the provided list of
18502 /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18503 /// field is updated to the provided value.
18504 ///
18505 /// If a field is set while the place does not have a previous local inventory,
18506 /// the local inventory at that store is created.
18507 ///
18508 /// If a field is set while the value of that field is not provided, the
18509 /// original field value, if it exists, is deleted.
18510 ///
18511 /// If the mask is not set or set with empty paths, all inventory fields will
18512 /// be updated.
18513 ///
18514 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18515 /// is returned and the entire update will be ignored.
18516 ///
18517 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18518 pub add_mask: std::option::Option<wkt::FieldMask>,
18519
18520 /// The time when the inventory updates are issued. Used to prevent
18521 /// out-of-order updates on local inventory fields. If not provided, the
18522 /// internal system time will be used.
18523 pub add_time: std::option::Option<wkt::Timestamp>,
18524
18525 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18526 /// found, the local inventory will still be processed and retained for at most
18527 /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18528 /// created. If set to false, a NOT_FOUND error is returned if the
18529 /// [Product][google.cloud.retail.v2.Product] is not found.
18530 ///
18531 /// [google.cloud.retail.v2.Product]: crate::model::Product
18532 pub allow_missing: bool,
18533
18534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18535}
18536
18537impl AddLocalInventoriesRequest {
18538 /// Creates a new default instance.
18539 pub fn new() -> Self {
18540 std::default::Default::default()
18541 }
18542
18543 /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18544 ///
18545 /// # Example
18546 /// ```ignore,no_run
18547 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18548 /// let x = AddLocalInventoriesRequest::new().set_product("example");
18549 /// ```
18550 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18551 self.product = v.into();
18552 self
18553 }
18554
18555 /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18556 ///
18557 /// # Example
18558 /// ```ignore,no_run
18559 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18560 /// use google_cloud_retail_v2::model::LocalInventory;
18561 /// let x = AddLocalInventoriesRequest::new()
18562 /// .set_local_inventories([
18563 /// LocalInventory::default()/* use setters */,
18564 /// LocalInventory::default()/* use (different) setters */,
18565 /// ]);
18566 /// ```
18567 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18568 where
18569 T: std::iter::IntoIterator<Item = V>,
18570 V: std::convert::Into<crate::model::LocalInventory>,
18571 {
18572 use std::iter::Iterator;
18573 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18574 self
18575 }
18576
18577 /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18578 ///
18579 /// # Example
18580 /// ```ignore,no_run
18581 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18582 /// use wkt::FieldMask;
18583 /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18584 /// ```
18585 pub fn set_add_mask<T>(mut self, v: T) -> Self
18586 where
18587 T: std::convert::Into<wkt::FieldMask>,
18588 {
18589 self.add_mask = std::option::Option::Some(v.into());
18590 self
18591 }
18592
18593 /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18594 ///
18595 /// # Example
18596 /// ```ignore,no_run
18597 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18598 /// use wkt::FieldMask;
18599 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18600 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18601 /// ```
18602 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18603 where
18604 T: std::convert::Into<wkt::FieldMask>,
18605 {
18606 self.add_mask = v.map(|x| x.into());
18607 self
18608 }
18609
18610 /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18611 ///
18612 /// # Example
18613 /// ```ignore,no_run
18614 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18615 /// use wkt::Timestamp;
18616 /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18617 /// ```
18618 pub fn set_add_time<T>(mut self, v: T) -> Self
18619 where
18620 T: std::convert::Into<wkt::Timestamp>,
18621 {
18622 self.add_time = std::option::Option::Some(v.into());
18623 self
18624 }
18625
18626 /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18627 ///
18628 /// # Example
18629 /// ```ignore,no_run
18630 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18631 /// use wkt::Timestamp;
18632 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18633 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18634 /// ```
18635 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18636 where
18637 T: std::convert::Into<wkt::Timestamp>,
18638 {
18639 self.add_time = v.map(|x| x.into());
18640 self
18641 }
18642
18643 /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18644 ///
18645 /// # Example
18646 /// ```ignore,no_run
18647 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18648 /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18649 /// ```
18650 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18651 self.allow_missing = v.into();
18652 self
18653 }
18654}
18655
18656impl wkt::message::Message for AddLocalInventoriesRequest {
18657 fn typename() -> &'static str {
18658 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18659 }
18660}
18661
18662/// Metadata related to the progress of the AddLocalInventories operation.
18663/// Currently empty because there is no meaningful metadata populated from the
18664/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18665/// method.
18666///
18667/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18668#[derive(Clone, Default, PartialEq)]
18669#[non_exhaustive]
18670pub struct AddLocalInventoriesMetadata {
18671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18672}
18673
18674impl AddLocalInventoriesMetadata {
18675 /// Creates a new default instance.
18676 pub fn new() -> Self {
18677 std::default::Default::default()
18678 }
18679}
18680
18681impl wkt::message::Message for AddLocalInventoriesMetadata {
18682 fn typename() -> &'static str {
18683 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18684 }
18685}
18686
18687/// Response of the
18688/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18689/// API. Currently empty because there is no meaningful response populated from
18690/// the
18691/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18692/// method.
18693///
18694/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18695#[derive(Clone, Default, PartialEq)]
18696#[non_exhaustive]
18697pub struct AddLocalInventoriesResponse {
18698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18699}
18700
18701impl AddLocalInventoriesResponse {
18702 /// Creates a new default instance.
18703 pub fn new() -> Self {
18704 std::default::Default::default()
18705 }
18706}
18707
18708impl wkt::message::Message for AddLocalInventoriesResponse {
18709 fn typename() -> &'static str {
18710 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18711 }
18712}
18713
18714/// Request message for
18715/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18716/// method.
18717///
18718/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18719#[derive(Clone, Default, PartialEq)]
18720#[non_exhaustive]
18721pub struct RemoveLocalInventoriesRequest {
18722 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18723 /// such as
18724 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18725 ///
18726 /// If the caller does not have permission to access the
18727 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18728 /// exists, a PERMISSION_DENIED error is returned.
18729 ///
18730 /// [google.cloud.retail.v2.Product]: crate::model::Product
18731 pub product: std::string::String,
18732
18733 /// Required. A list of place IDs to have their inventory deleted.
18734 /// At most 3000 place IDs are allowed per request.
18735 pub place_ids: std::vec::Vec<std::string::String>,
18736
18737 /// The time when the inventory deletions are issued. Used to prevent
18738 /// out-of-order updates and deletions on local inventory fields. If not
18739 /// provided, the internal system time will be used.
18740 pub remove_time: std::option::Option<wkt::Timestamp>,
18741
18742 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18743 /// found, the local inventory removal request will still be processed and
18744 /// retained for at most 1 day and processed once the
18745 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18746 /// NOT_FOUND error is returned if the
18747 /// [Product][google.cloud.retail.v2.Product] is not found.
18748 ///
18749 /// [google.cloud.retail.v2.Product]: crate::model::Product
18750 pub allow_missing: bool,
18751
18752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18753}
18754
18755impl RemoveLocalInventoriesRequest {
18756 /// Creates a new default instance.
18757 pub fn new() -> Self {
18758 std::default::Default::default()
18759 }
18760
18761 /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18762 ///
18763 /// # Example
18764 /// ```ignore,no_run
18765 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18766 /// let x = RemoveLocalInventoriesRequest::new().set_product("example");
18767 /// ```
18768 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18769 self.product = v.into();
18770 self
18771 }
18772
18773 /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18774 ///
18775 /// # Example
18776 /// ```ignore,no_run
18777 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18778 /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18779 /// ```
18780 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18781 where
18782 T: std::iter::IntoIterator<Item = V>,
18783 V: std::convert::Into<std::string::String>,
18784 {
18785 use std::iter::Iterator;
18786 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18787 self
18788 }
18789
18790 /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18791 ///
18792 /// # Example
18793 /// ```ignore,no_run
18794 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18795 /// use wkt::Timestamp;
18796 /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18797 /// ```
18798 pub fn set_remove_time<T>(mut self, v: T) -> Self
18799 where
18800 T: std::convert::Into<wkt::Timestamp>,
18801 {
18802 self.remove_time = std::option::Option::Some(v.into());
18803 self
18804 }
18805
18806 /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18807 ///
18808 /// # Example
18809 /// ```ignore,no_run
18810 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18811 /// use wkt::Timestamp;
18812 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18813 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18814 /// ```
18815 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18816 where
18817 T: std::convert::Into<wkt::Timestamp>,
18818 {
18819 self.remove_time = v.map(|x| x.into());
18820 self
18821 }
18822
18823 /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18824 ///
18825 /// # Example
18826 /// ```ignore,no_run
18827 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18828 /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18829 /// ```
18830 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18831 self.allow_missing = v.into();
18832 self
18833 }
18834}
18835
18836impl wkt::message::Message for RemoveLocalInventoriesRequest {
18837 fn typename() -> &'static str {
18838 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18839 }
18840}
18841
18842/// Metadata related to the progress of the RemoveLocalInventories operation.
18843/// Currently empty because there is no meaningful metadata populated from the
18844/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18845/// method.
18846///
18847/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18848#[derive(Clone, Default, PartialEq)]
18849#[non_exhaustive]
18850pub struct RemoveLocalInventoriesMetadata {
18851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18852}
18853
18854impl RemoveLocalInventoriesMetadata {
18855 /// Creates a new default instance.
18856 pub fn new() -> Self {
18857 std::default::Default::default()
18858 }
18859}
18860
18861impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18862 fn typename() -> &'static str {
18863 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18864 }
18865}
18866
18867/// Response of the
18868/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18869/// API. Currently empty because there is no meaningful response populated from
18870/// the
18871/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18872/// method.
18873///
18874/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18875#[derive(Clone, Default, PartialEq)]
18876#[non_exhaustive]
18877pub struct RemoveLocalInventoriesResponse {
18878 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18879}
18880
18881impl RemoveLocalInventoriesResponse {
18882 /// Creates a new default instance.
18883 pub fn new() -> Self {
18884 std::default::Default::default()
18885 }
18886}
18887
18888impl wkt::message::Message for RemoveLocalInventoriesResponse {
18889 fn typename() -> &'static str {
18890 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
18891 }
18892}
18893
18894/// Request message for
18895/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18896/// method.
18897///
18898/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18899#[derive(Clone, Default, PartialEq)]
18900#[non_exhaustive]
18901pub struct RemoveFulfillmentPlacesRequest {
18902 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18903 /// such as
18904 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18905 ///
18906 /// If the caller does not have permission to access the
18907 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18908 /// exists, a PERMISSION_DENIED error is returned.
18909 ///
18910 /// [google.cloud.retail.v2.Product]: crate::model::Product
18911 pub product: std::string::String,
18912
18913 /// Required. The fulfillment type, including commonly used types (such as
18914 /// pickup in store and same day delivery), and custom types.
18915 ///
18916 /// Supported values:
18917 ///
18918 /// * "pickup-in-store"
18919 /// * "ship-to-store"
18920 /// * "same-day-delivery"
18921 /// * "next-day-delivery"
18922 /// * "custom-type-1"
18923 /// * "custom-type-2"
18924 /// * "custom-type-3"
18925 /// * "custom-type-4"
18926 /// * "custom-type-5"
18927 ///
18928 /// If this field is set to an invalid value other than these, an
18929 /// INVALID_ARGUMENT error is returned.
18930 ///
18931 /// This field directly corresponds to
18932 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18933 ///
18934 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18935 pub r#type: std::string::String,
18936
18937 /// Required. The IDs for this
18938 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
18939 /// the store IDs for "pickup-in-store" or the region IDs for
18940 /// "same-day-delivery", to be removed for this
18941 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
18942 ///
18943 /// At least 1 value is required, and a maximum of 2000 values are allowed.
18944 /// Each value must be a string with a length limit of 10 characters, matching
18945 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18946 /// INVALID_ARGUMENT error is returned.
18947 ///
18948 /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
18949 pub place_ids: std::vec::Vec<std::string::String>,
18950
18951 /// The time when the fulfillment updates are issued, used to prevent
18952 /// out-of-order updates on fulfillment information. If not provided, the
18953 /// internal system time will be used.
18954 pub remove_time: std::option::Option<wkt::Timestamp>,
18955
18956 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18957 /// found, the fulfillment information will still be processed and retained for
18958 /// at most 1 day and processed once the
18959 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18960 /// NOT_FOUND error is returned if the
18961 /// [Product][google.cloud.retail.v2.Product] is not found.
18962 ///
18963 /// [google.cloud.retail.v2.Product]: crate::model::Product
18964 pub allow_missing: bool,
18965
18966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18967}
18968
18969impl RemoveFulfillmentPlacesRequest {
18970 /// Creates a new default instance.
18971 pub fn new() -> Self {
18972 std::default::Default::default()
18973 }
18974
18975 /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
18976 ///
18977 /// # Example
18978 /// ```ignore,no_run
18979 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18980 /// let x = RemoveFulfillmentPlacesRequest::new().set_product("example");
18981 /// ```
18982 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18983 self.product = v.into();
18984 self
18985 }
18986
18987 /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
18988 ///
18989 /// # Example
18990 /// ```ignore,no_run
18991 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18992 /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
18993 /// ```
18994 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18995 self.r#type = v.into();
18996 self
18997 }
18998
18999 /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
19000 ///
19001 /// # Example
19002 /// ```ignore,no_run
19003 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19004 /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
19005 /// ```
19006 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
19007 where
19008 T: std::iter::IntoIterator<Item = V>,
19009 V: std::convert::Into<std::string::String>,
19010 {
19011 use std::iter::Iterator;
19012 self.place_ids = v.into_iter().map(|i| i.into()).collect();
19013 self
19014 }
19015
19016 /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19017 ///
19018 /// # Example
19019 /// ```ignore,no_run
19020 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19021 /// use wkt::Timestamp;
19022 /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
19023 /// ```
19024 pub fn set_remove_time<T>(mut self, v: T) -> Self
19025 where
19026 T: std::convert::Into<wkt::Timestamp>,
19027 {
19028 self.remove_time = std::option::Option::Some(v.into());
19029 self
19030 }
19031
19032 /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19033 ///
19034 /// # Example
19035 /// ```ignore,no_run
19036 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19037 /// use wkt::Timestamp;
19038 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
19039 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
19040 /// ```
19041 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
19042 where
19043 T: std::convert::Into<wkt::Timestamp>,
19044 {
19045 self.remove_time = v.map(|x| x.into());
19046 self
19047 }
19048
19049 /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
19050 ///
19051 /// # Example
19052 /// ```ignore,no_run
19053 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19054 /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
19055 /// ```
19056 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19057 self.allow_missing = v.into();
19058 self
19059 }
19060}
19061
19062impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
19063 fn typename() -> &'static str {
19064 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
19065 }
19066}
19067
19068/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
19069/// Currently empty because there is no meaningful metadata populated from the
19070/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19071/// method.
19072///
19073/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19074#[derive(Clone, Default, PartialEq)]
19075#[non_exhaustive]
19076pub struct RemoveFulfillmentPlacesMetadata {
19077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19078}
19079
19080impl RemoveFulfillmentPlacesMetadata {
19081 /// Creates a new default instance.
19082 pub fn new() -> Self {
19083 std::default::Default::default()
19084 }
19085}
19086
19087impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
19088 fn typename() -> &'static str {
19089 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
19090 }
19091}
19092
19093/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
19094/// is no meaningful response populated from the
19095/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19096/// method.
19097///
19098/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19099#[derive(Clone, Default, PartialEq)]
19100#[non_exhaustive]
19101pub struct RemoveFulfillmentPlacesResponse {
19102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19103}
19104
19105impl RemoveFulfillmentPlacesResponse {
19106 /// Creates a new default instance.
19107 pub fn new() -> Self {
19108 std::default::Default::default()
19109 }
19110}
19111
19112impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
19113 fn typename() -> &'static str {
19114 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
19115 }
19116}
19117
19118/// Promotion information.
19119#[derive(Clone, Default, PartialEq)]
19120#[non_exhaustive]
19121pub struct Promotion {
19122 /// ID of the promotion. For example, "free gift".
19123 ///
19124 /// The value must be a UTF-8 encoded string with a length limit of 128
19125 /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
19126 /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
19127 /// returned.
19128 ///
19129 /// Corresponds to Google Merchant Center property
19130 /// [promotion_id](https://support.google.com/merchants/answer/7050148).
19131 pub promotion_id: std::string::String,
19132
19133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19134}
19135
19136impl Promotion {
19137 /// Creates a new default instance.
19138 pub fn new() -> Self {
19139 std::default::Default::default()
19140 }
19141
19142 /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
19143 ///
19144 /// # Example
19145 /// ```ignore,no_run
19146 /// # use google_cloud_retail_v2::model::Promotion;
19147 /// let x = Promotion::new().set_promotion_id("example");
19148 /// ```
19149 pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19150 self.promotion_id = v.into();
19151 self
19152 }
19153}
19154
19155impl wkt::message::Message for Promotion {
19156 fn typename() -> &'static str {
19157 "type.googleapis.com/google.cloud.retail.v2.Promotion"
19158 }
19159}
19160
19161/// Metadata related to the progress of the Purge operation.
19162/// This will be returned by the google.longrunning.Operation.metadata field.
19163#[derive(Clone, Default, PartialEq)]
19164#[non_exhaustive]
19165pub struct PurgeMetadata {
19166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19167}
19168
19169impl PurgeMetadata {
19170 /// Creates a new default instance.
19171 pub fn new() -> Self {
19172 std::default::Default::default()
19173 }
19174}
19175
19176impl wkt::message::Message for PurgeMetadata {
19177 fn typename() -> &'static str {
19178 "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19179 }
19180}
19181
19182/// Metadata related to the progress of the PurgeProducts operation.
19183/// This will be returned by the google.longrunning.Operation.metadata field.
19184#[derive(Clone, Default, PartialEq)]
19185#[non_exhaustive]
19186pub struct PurgeProductsMetadata {
19187 /// Operation create time.
19188 pub create_time: std::option::Option<wkt::Timestamp>,
19189
19190 /// Operation last update time. If the operation is done, this is also the
19191 /// finish time.
19192 pub update_time: std::option::Option<wkt::Timestamp>,
19193
19194 /// Count of entries that were deleted successfully.
19195 pub success_count: i64,
19196
19197 /// Count of entries that encountered errors while processing.
19198 pub failure_count: i64,
19199
19200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19201}
19202
19203impl PurgeProductsMetadata {
19204 /// Creates a new default instance.
19205 pub fn new() -> Self {
19206 std::default::Default::default()
19207 }
19208
19209 /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19210 ///
19211 /// # Example
19212 /// ```ignore,no_run
19213 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19214 /// use wkt::Timestamp;
19215 /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19216 /// ```
19217 pub fn set_create_time<T>(mut self, v: T) -> Self
19218 where
19219 T: std::convert::Into<wkt::Timestamp>,
19220 {
19221 self.create_time = std::option::Option::Some(v.into());
19222 self
19223 }
19224
19225 /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19226 ///
19227 /// # Example
19228 /// ```ignore,no_run
19229 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19230 /// use wkt::Timestamp;
19231 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19232 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19233 /// ```
19234 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19235 where
19236 T: std::convert::Into<wkt::Timestamp>,
19237 {
19238 self.create_time = v.map(|x| x.into());
19239 self
19240 }
19241
19242 /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19243 ///
19244 /// # Example
19245 /// ```ignore,no_run
19246 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19247 /// use wkt::Timestamp;
19248 /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19249 /// ```
19250 pub fn set_update_time<T>(mut self, v: T) -> Self
19251 where
19252 T: std::convert::Into<wkt::Timestamp>,
19253 {
19254 self.update_time = std::option::Option::Some(v.into());
19255 self
19256 }
19257
19258 /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19259 ///
19260 /// # Example
19261 /// ```ignore,no_run
19262 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19263 /// use wkt::Timestamp;
19264 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19265 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19266 /// ```
19267 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19268 where
19269 T: std::convert::Into<wkt::Timestamp>,
19270 {
19271 self.update_time = v.map(|x| x.into());
19272 self
19273 }
19274
19275 /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19276 ///
19277 /// # Example
19278 /// ```ignore,no_run
19279 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19280 /// let x = PurgeProductsMetadata::new().set_success_count(42);
19281 /// ```
19282 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19283 self.success_count = v.into();
19284 self
19285 }
19286
19287 /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19288 ///
19289 /// # Example
19290 /// ```ignore,no_run
19291 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19292 /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19293 /// ```
19294 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19295 self.failure_count = v.into();
19296 self
19297 }
19298}
19299
19300impl wkt::message::Message for PurgeProductsMetadata {
19301 fn typename() -> &'static str {
19302 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19303 }
19304}
19305
19306/// Request message for PurgeProducts method.
19307#[derive(Clone, Default, PartialEq)]
19308#[non_exhaustive]
19309pub struct PurgeProductsRequest {
19310 /// Required. The resource name of the branch under which the products are
19311 /// created. The format is
19312 /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19313 pub parent: std::string::String,
19314
19315 /// Required. The filter string to specify the products to be deleted with a
19316 /// length limit of 5,000 characters.
19317 ///
19318 /// Empty string filter is not allowed. "*" implies delete all items in a
19319 /// branch.
19320 ///
19321 /// The eligible fields for filtering are:
19322 ///
19323 /// * `availability`: Double quoted
19324 /// [Product.availability][google.cloud.retail.v2.Product.availability] string.
19325 /// * `create_time` : in ISO 8601 "zulu" format.
19326 ///
19327 /// Supported syntax:
19328 ///
19329 /// * Comparators (">", "<", ">=", "<=", "=").
19330 /// Examples:
19331 ///
19332 /// * create_time <= "2015-02-13T17:05:46Z"
19333 /// * availability = "IN_STOCK"
19334 /// * Conjunctions ("AND")
19335 /// Examples:
19336 ///
19337 /// * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19338 /// * Disjunctions ("OR")
19339 /// Examples:
19340 ///
19341 /// * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19342 /// * Can support nested queries.
19343 /// Examples:
19344 ///
19345 /// * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19346 /// OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19347 /// * Filter Limits:
19348 ///
19349 /// * Filter should not contain more than 6 conditions.
19350 /// * Max nesting depth should not exceed 2 levels.
19351 ///
19352 /// Examples queries:
19353 ///
19354 /// * Delete back order products created before a timestamp.
19355 /// create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19356 ///
19357 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19358 pub filter: std::string::String,
19359
19360 /// Actually perform the purge.
19361 /// If `force` is set to false, the method will return the expected purge count
19362 /// without deleting any products.
19363 pub force: bool,
19364
19365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19366}
19367
19368impl PurgeProductsRequest {
19369 /// Creates a new default instance.
19370 pub fn new() -> Self {
19371 std::default::Default::default()
19372 }
19373
19374 /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19375 ///
19376 /// # Example
19377 /// ```ignore,no_run
19378 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19379 /// let x = PurgeProductsRequest::new().set_parent("example");
19380 /// ```
19381 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19382 self.parent = v.into();
19383 self
19384 }
19385
19386 /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19387 ///
19388 /// # Example
19389 /// ```ignore,no_run
19390 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19391 /// let x = PurgeProductsRequest::new().set_filter("example");
19392 /// ```
19393 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19394 self.filter = v.into();
19395 self
19396 }
19397
19398 /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19399 ///
19400 /// # Example
19401 /// ```ignore,no_run
19402 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19403 /// let x = PurgeProductsRequest::new().set_force(true);
19404 /// ```
19405 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19406 self.force = v.into();
19407 self
19408 }
19409}
19410
19411impl wkt::message::Message for PurgeProductsRequest {
19412 fn typename() -> &'static str {
19413 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19414 }
19415}
19416
19417/// Response of the PurgeProductsRequest. If the long running operation is
19418/// successfully done, then this message is returned by the
19419/// google.longrunning.Operations.response field.
19420#[derive(Clone, Default, PartialEq)]
19421#[non_exhaustive]
19422pub struct PurgeProductsResponse {
19423 /// The total count of products purged as a result of the operation.
19424 pub purge_count: i64,
19425
19426 /// A sample of the product names that will be deleted.
19427 /// Only populated if `force` is set to false. A max of 100 names will be
19428 /// returned and the names are chosen at random.
19429 pub purge_sample: std::vec::Vec<std::string::String>,
19430
19431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19432}
19433
19434impl PurgeProductsResponse {
19435 /// Creates a new default instance.
19436 pub fn new() -> Self {
19437 std::default::Default::default()
19438 }
19439
19440 /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19441 ///
19442 /// # Example
19443 /// ```ignore,no_run
19444 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19445 /// let x = PurgeProductsResponse::new().set_purge_count(42);
19446 /// ```
19447 pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19448 self.purge_count = v.into();
19449 self
19450 }
19451
19452 /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19453 ///
19454 /// # Example
19455 /// ```ignore,no_run
19456 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19457 /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19458 /// ```
19459 pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19460 where
19461 T: std::iter::IntoIterator<Item = V>,
19462 V: std::convert::Into<std::string::String>,
19463 {
19464 use std::iter::Iterator;
19465 self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19466 self
19467 }
19468}
19469
19470impl wkt::message::Message for PurgeProductsResponse {
19471 fn typename() -> &'static str {
19472 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19473 }
19474}
19475
19476/// Request message for PurgeUserEvents method.
19477#[derive(Clone, Default, PartialEq)]
19478#[non_exhaustive]
19479pub struct PurgeUserEventsRequest {
19480 /// Required. The resource name of the catalog under which the events are
19481 /// created. The format is
19482 /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19483 pub parent: std::string::String,
19484
19485 /// Required. The filter string to specify the events to be deleted with a
19486 /// length limit of 5,000 characters. Empty string filter is not allowed. The
19487 /// eligible fields for filtering are:
19488 ///
19489 /// * `eventType`: Double quoted
19490 /// [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19491 /// * `eventTime`: in ISO 8601 "zulu" format.
19492 /// * `visitorId`: Double quoted string. Specifying this will delete all
19493 /// events associated with a visitor.
19494 /// * `userId`: Double quoted string. Specifying this will delete all events
19495 /// associated with a user.
19496 ///
19497 /// Examples:
19498 ///
19499 /// * Deleting all events in a time range:
19500 /// `eventTime > "2012-04-23T18:25:43.511Z"
19501 /// eventTime < "2012-04-23T18:30:43.511Z"`
19502 /// * Deleting specific eventType in time range:
19503 /// `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19504 /// * Deleting all events for a specific visitor:
19505 /// `visitorId = "visitor1024"`
19506 ///
19507 /// The filtering fields are assumed to have an implicit AND.
19508 ///
19509 /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19510 pub filter: std::string::String,
19511
19512 /// Actually perform the purge.
19513 /// If `force` is set to false, the method will return the expected purge count
19514 /// without deleting any user events.
19515 pub force: bool,
19516
19517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19518}
19519
19520impl PurgeUserEventsRequest {
19521 /// Creates a new default instance.
19522 pub fn new() -> Self {
19523 std::default::Default::default()
19524 }
19525
19526 /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19527 ///
19528 /// # Example
19529 /// ```ignore,no_run
19530 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19531 /// let x = PurgeUserEventsRequest::new().set_parent("example");
19532 /// ```
19533 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19534 self.parent = v.into();
19535 self
19536 }
19537
19538 /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19539 ///
19540 /// # Example
19541 /// ```ignore,no_run
19542 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19543 /// let x = PurgeUserEventsRequest::new().set_filter("example");
19544 /// ```
19545 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19546 self.filter = v.into();
19547 self
19548 }
19549
19550 /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19551 ///
19552 /// # Example
19553 /// ```ignore,no_run
19554 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19555 /// let x = PurgeUserEventsRequest::new().set_force(true);
19556 /// ```
19557 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19558 self.force = v.into();
19559 self
19560 }
19561}
19562
19563impl wkt::message::Message for PurgeUserEventsRequest {
19564 fn typename() -> &'static str {
19565 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19566 }
19567}
19568
19569/// Response of the PurgeUserEventsRequest. If the long running operation is
19570/// successfully done, then this message is returned by the
19571/// google.longrunning.Operations.response field.
19572#[derive(Clone, Default, PartialEq)]
19573#[non_exhaustive]
19574pub struct PurgeUserEventsResponse {
19575 /// The total count of events purged as a result of the operation.
19576 pub purged_events_count: i64,
19577
19578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19579}
19580
19581impl PurgeUserEventsResponse {
19582 /// Creates a new default instance.
19583 pub fn new() -> Self {
19584 std::default::Default::default()
19585 }
19586
19587 /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19588 ///
19589 /// # Example
19590 /// ```ignore,no_run
19591 /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19592 /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19593 /// ```
19594 pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19595 self.purged_events_count = v.into();
19596 self
19597 }
19598}
19599
19600impl wkt::message::Message for PurgeUserEventsResponse {
19601 fn typename() -> &'static str {
19602 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19603 }
19604}
19605
19606/// Safety settings.
19607#[derive(Clone, Default, PartialEq)]
19608#[non_exhaustive]
19609pub struct SafetySetting {
19610 /// Harm category.
19611 pub category: crate::model::HarmCategory,
19612
19613 /// The harm block threshold.
19614 pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19615
19616 /// Optional. Specify if the threshold is used for probability or severity
19617 /// score. If not specified, the threshold is used for probability score.
19618 pub method: crate::model::safety_setting::HarmBlockMethod,
19619
19620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19621}
19622
19623impl SafetySetting {
19624 /// Creates a new default instance.
19625 pub fn new() -> Self {
19626 std::default::Default::default()
19627 }
19628
19629 /// Sets the value of [category][crate::model::SafetySetting::category].
19630 ///
19631 /// # Example
19632 /// ```ignore,no_run
19633 /// # use google_cloud_retail_v2::model::SafetySetting;
19634 /// use google_cloud_retail_v2::model::HarmCategory;
19635 /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19636 /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19637 /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19638 /// ```
19639 pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19640 self.category = v.into();
19641 self
19642 }
19643
19644 /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19645 ///
19646 /// # Example
19647 /// ```ignore,no_run
19648 /// # use google_cloud_retail_v2::model::SafetySetting;
19649 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19650 /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19651 /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19652 /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19653 /// ```
19654 pub fn set_threshold<
19655 T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19656 >(
19657 mut self,
19658 v: T,
19659 ) -> Self {
19660 self.threshold = v.into();
19661 self
19662 }
19663
19664 /// Sets the value of [method][crate::model::SafetySetting::method].
19665 ///
19666 /// # Example
19667 /// ```ignore,no_run
19668 /// # use google_cloud_retail_v2::model::SafetySetting;
19669 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19670 /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19671 /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19672 /// ```
19673 pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19674 mut self,
19675 v: T,
19676 ) -> Self {
19677 self.method = v.into();
19678 self
19679 }
19680}
19681
19682impl wkt::message::Message for SafetySetting {
19683 fn typename() -> &'static str {
19684 "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19685 }
19686}
19687
19688/// Defines additional types related to [SafetySetting].
19689pub mod safety_setting {
19690 #[allow(unused_imports)]
19691 use super::*;
19692
19693 /// Probability based thresholds levels for blocking.
19694 ///
19695 /// # Working with unknown values
19696 ///
19697 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19698 /// additional enum variants at any time. Adding new variants is not considered
19699 /// a breaking change. Applications should write their code in anticipation of:
19700 ///
19701 /// - New values appearing in future releases of the client library, **and**
19702 /// - New values received dynamically, without application changes.
19703 ///
19704 /// Please consult the [Working with enums] section in the user guide for some
19705 /// guidelines.
19706 ///
19707 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19708 #[derive(Clone, Debug, PartialEq)]
19709 #[non_exhaustive]
19710 pub enum HarmBlockThreshold {
19711 /// Unspecified harm block threshold.
19712 Unspecified,
19713 /// Block low threshold and above (i.e. block more).
19714 BlockLowAndAbove,
19715 /// Block medium threshold and above.
19716 BlockMediumAndAbove,
19717 /// Block only high threshold (i.e. block less).
19718 BlockOnlyHigh,
19719 /// Block none.
19720 BlockNone,
19721 /// Turn off the safety filter.
19722 Off,
19723 /// If set, the enum was initialized with an unknown value.
19724 ///
19725 /// Applications can examine the value using [HarmBlockThreshold::value] or
19726 /// [HarmBlockThreshold::name].
19727 UnknownValue(harm_block_threshold::UnknownValue),
19728 }
19729
19730 #[doc(hidden)]
19731 pub mod harm_block_threshold {
19732 #[allow(unused_imports)]
19733 use super::*;
19734 #[derive(Clone, Debug, PartialEq)]
19735 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19736 }
19737
19738 impl HarmBlockThreshold {
19739 /// Gets the enum value.
19740 ///
19741 /// Returns `None` if the enum contains an unknown value deserialized from
19742 /// the string representation of enums.
19743 pub fn value(&self) -> std::option::Option<i32> {
19744 match self {
19745 Self::Unspecified => std::option::Option::Some(0),
19746 Self::BlockLowAndAbove => std::option::Option::Some(1),
19747 Self::BlockMediumAndAbove => std::option::Option::Some(2),
19748 Self::BlockOnlyHigh => std::option::Option::Some(3),
19749 Self::BlockNone => std::option::Option::Some(4),
19750 Self::Off => std::option::Option::Some(5),
19751 Self::UnknownValue(u) => u.0.value(),
19752 }
19753 }
19754
19755 /// Gets the enum value as a string.
19756 ///
19757 /// Returns `None` if the enum contains an unknown value deserialized from
19758 /// the integer representation of enums.
19759 pub fn name(&self) -> std::option::Option<&str> {
19760 match self {
19761 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19762 Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19763 Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19764 Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19765 Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19766 Self::Off => std::option::Option::Some("OFF"),
19767 Self::UnknownValue(u) => u.0.name(),
19768 }
19769 }
19770 }
19771
19772 impl std::default::Default for HarmBlockThreshold {
19773 fn default() -> Self {
19774 use std::convert::From;
19775 Self::from(0)
19776 }
19777 }
19778
19779 impl std::fmt::Display for HarmBlockThreshold {
19780 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19781 wkt::internal::display_enum(f, self.name(), self.value())
19782 }
19783 }
19784
19785 impl std::convert::From<i32> for HarmBlockThreshold {
19786 fn from(value: i32) -> Self {
19787 match value {
19788 0 => Self::Unspecified,
19789 1 => Self::BlockLowAndAbove,
19790 2 => Self::BlockMediumAndAbove,
19791 3 => Self::BlockOnlyHigh,
19792 4 => Self::BlockNone,
19793 5 => Self::Off,
19794 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19795 wkt::internal::UnknownEnumValue::Integer(value),
19796 )),
19797 }
19798 }
19799 }
19800
19801 impl std::convert::From<&str> for HarmBlockThreshold {
19802 fn from(value: &str) -> Self {
19803 use std::string::ToString;
19804 match value {
19805 "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19806 "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19807 "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19808 "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19809 "BLOCK_NONE" => Self::BlockNone,
19810 "OFF" => Self::Off,
19811 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19812 wkt::internal::UnknownEnumValue::String(value.to_string()),
19813 )),
19814 }
19815 }
19816 }
19817
19818 impl serde::ser::Serialize for HarmBlockThreshold {
19819 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19820 where
19821 S: serde::Serializer,
19822 {
19823 match self {
19824 Self::Unspecified => serializer.serialize_i32(0),
19825 Self::BlockLowAndAbove => serializer.serialize_i32(1),
19826 Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19827 Self::BlockOnlyHigh => serializer.serialize_i32(3),
19828 Self::BlockNone => serializer.serialize_i32(4),
19829 Self::Off => serializer.serialize_i32(5),
19830 Self::UnknownValue(u) => u.0.serialize(serializer),
19831 }
19832 }
19833 }
19834
19835 impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19836 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19837 where
19838 D: serde::Deserializer<'de>,
19839 {
19840 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19841 ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19842 ))
19843 }
19844 }
19845
19846 /// Probability vs severity.
19847 ///
19848 /// # Working with unknown values
19849 ///
19850 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19851 /// additional enum variants at any time. Adding new variants is not considered
19852 /// a breaking change. Applications should write their code in anticipation of:
19853 ///
19854 /// - New values appearing in future releases of the client library, **and**
19855 /// - New values received dynamically, without application changes.
19856 ///
19857 /// Please consult the [Working with enums] section in the user guide for some
19858 /// guidelines.
19859 ///
19860 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19861 #[derive(Clone, Debug, PartialEq)]
19862 #[non_exhaustive]
19863 pub enum HarmBlockMethod {
19864 /// The harm block method is unspecified.
19865 Unspecified,
19866 /// The harm block method uses both probability and severity scores.
19867 Severity,
19868 /// The harm block method uses the probability score.
19869 Probability,
19870 /// If set, the enum was initialized with an unknown value.
19871 ///
19872 /// Applications can examine the value using [HarmBlockMethod::value] or
19873 /// [HarmBlockMethod::name].
19874 UnknownValue(harm_block_method::UnknownValue),
19875 }
19876
19877 #[doc(hidden)]
19878 pub mod harm_block_method {
19879 #[allow(unused_imports)]
19880 use super::*;
19881 #[derive(Clone, Debug, PartialEq)]
19882 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19883 }
19884
19885 impl HarmBlockMethod {
19886 /// Gets the enum value.
19887 ///
19888 /// Returns `None` if the enum contains an unknown value deserialized from
19889 /// the string representation of enums.
19890 pub fn value(&self) -> std::option::Option<i32> {
19891 match self {
19892 Self::Unspecified => std::option::Option::Some(0),
19893 Self::Severity => std::option::Option::Some(1),
19894 Self::Probability => std::option::Option::Some(2),
19895 Self::UnknownValue(u) => u.0.value(),
19896 }
19897 }
19898
19899 /// Gets the enum value as a string.
19900 ///
19901 /// Returns `None` if the enum contains an unknown value deserialized from
19902 /// the integer representation of enums.
19903 pub fn name(&self) -> std::option::Option<&str> {
19904 match self {
19905 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
19906 Self::Severity => std::option::Option::Some("SEVERITY"),
19907 Self::Probability => std::option::Option::Some("PROBABILITY"),
19908 Self::UnknownValue(u) => u.0.name(),
19909 }
19910 }
19911 }
19912
19913 impl std::default::Default for HarmBlockMethod {
19914 fn default() -> Self {
19915 use std::convert::From;
19916 Self::from(0)
19917 }
19918 }
19919
19920 impl std::fmt::Display for HarmBlockMethod {
19921 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19922 wkt::internal::display_enum(f, self.name(), self.value())
19923 }
19924 }
19925
19926 impl std::convert::From<i32> for HarmBlockMethod {
19927 fn from(value: i32) -> Self {
19928 match value {
19929 0 => Self::Unspecified,
19930 1 => Self::Severity,
19931 2 => Self::Probability,
19932 _ => Self::UnknownValue(harm_block_method::UnknownValue(
19933 wkt::internal::UnknownEnumValue::Integer(value),
19934 )),
19935 }
19936 }
19937 }
19938
19939 impl std::convert::From<&str> for HarmBlockMethod {
19940 fn from(value: &str) -> Self {
19941 use std::string::ToString;
19942 match value {
19943 "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
19944 "SEVERITY" => Self::Severity,
19945 "PROBABILITY" => Self::Probability,
19946 _ => Self::UnknownValue(harm_block_method::UnknownValue(
19947 wkt::internal::UnknownEnumValue::String(value.to_string()),
19948 )),
19949 }
19950 }
19951 }
19952
19953 impl serde::ser::Serialize for HarmBlockMethod {
19954 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19955 where
19956 S: serde::Serializer,
19957 {
19958 match self {
19959 Self::Unspecified => serializer.serialize_i32(0),
19960 Self::Severity => serializer.serialize_i32(1),
19961 Self::Probability => serializer.serialize_i32(2),
19962 Self::UnknownValue(u) => u.0.serialize(serializer),
19963 }
19964 }
19965 }
19966
19967 impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
19968 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19969 where
19970 D: serde::Deserializer<'de>,
19971 {
19972 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
19973 ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
19974 ))
19975 }
19976 }
19977}
19978
19979/// Product attribute which structured by an attribute name and value. This
19980/// structure is used in conversational search filters and answers. For example,
19981/// if we have `name=color` and `value=red`, this means that the color is `red`.
19982#[derive(Clone, Default, PartialEq)]
19983#[non_exhaustive]
19984pub struct ProductAttributeValue {
19985 /// The attribute name.
19986 pub name: std::string::String,
19987
19988 /// The attribute value.
19989 pub value: std::string::String,
19990
19991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19992}
19993
19994impl ProductAttributeValue {
19995 /// Creates a new default instance.
19996 pub fn new() -> Self {
19997 std::default::Default::default()
19998 }
19999
20000 /// Sets the value of [name][crate::model::ProductAttributeValue::name].
20001 ///
20002 /// # Example
20003 /// ```ignore,no_run
20004 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20005 /// let x = ProductAttributeValue::new().set_name("example");
20006 /// ```
20007 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20008 self.name = v.into();
20009 self
20010 }
20011
20012 /// Sets the value of [value][crate::model::ProductAttributeValue::value].
20013 ///
20014 /// # Example
20015 /// ```ignore,no_run
20016 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20017 /// let x = ProductAttributeValue::new().set_value("example");
20018 /// ```
20019 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20020 self.value = v.into();
20021 self
20022 }
20023}
20024
20025impl wkt::message::Message for ProductAttributeValue {
20026 fn typename() -> &'static str {
20027 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
20028 }
20029}
20030
20031/// Product attribute name and numeric interval.
20032#[derive(Clone, Default, PartialEq)]
20033#[non_exhaustive]
20034pub struct ProductAttributeInterval {
20035 /// The attribute name (e.g. "length")
20036 pub name: std::string::String,
20037
20038 /// The numeric interval (e.g. [10, 20))
20039 pub interval: std::option::Option<crate::model::Interval>,
20040
20041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20042}
20043
20044impl ProductAttributeInterval {
20045 /// Creates a new default instance.
20046 pub fn new() -> Self {
20047 std::default::Default::default()
20048 }
20049
20050 /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
20051 ///
20052 /// # Example
20053 /// ```ignore,no_run
20054 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20055 /// let x = ProductAttributeInterval::new().set_name("example");
20056 /// ```
20057 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20058 self.name = v.into();
20059 self
20060 }
20061
20062 /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
20063 ///
20064 /// # Example
20065 /// ```ignore,no_run
20066 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20067 /// use google_cloud_retail_v2::model::Interval;
20068 /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
20069 /// ```
20070 pub fn set_interval<T>(mut self, v: T) -> Self
20071 where
20072 T: std::convert::Into<crate::model::Interval>,
20073 {
20074 self.interval = std::option::Option::Some(v.into());
20075 self
20076 }
20077
20078 /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
20079 ///
20080 /// # Example
20081 /// ```ignore,no_run
20082 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20083 /// use google_cloud_retail_v2::model::Interval;
20084 /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
20085 /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
20086 /// ```
20087 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
20088 where
20089 T: std::convert::Into<crate::model::Interval>,
20090 {
20091 self.interval = v.map(|x| x.into());
20092 self
20093 }
20094}
20095
20096impl wkt::message::Message for ProductAttributeInterval {
20097 fn typename() -> &'static str {
20098 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
20099 }
20100}
20101
20102/// This field specifies the tile information including an attribute key,
20103/// attribute value. More fields will be added in the future, eg: product id
20104/// or product counts, etc.
20105#[derive(Clone, Default, PartialEq)]
20106#[non_exhaustive]
20107pub struct Tile {
20108 /// The representative product id for this tile.
20109 pub representative_product_id: std::string::String,
20110
20111 /// The attribute key and value for the tile.
20112 pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
20113
20114 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20115}
20116
20117impl Tile {
20118 /// Creates a new default instance.
20119 pub fn new() -> Self {
20120 std::default::Default::default()
20121 }
20122
20123 /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
20124 ///
20125 /// # Example
20126 /// ```ignore,no_run
20127 /// # use google_cloud_retail_v2::model::Tile;
20128 /// let x = Tile::new().set_representative_product_id("example");
20129 /// ```
20130 pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
20131 mut self,
20132 v: T,
20133 ) -> Self {
20134 self.representative_product_id = v.into();
20135 self
20136 }
20137
20138 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
20139 ///
20140 /// Note that all the setters affecting `product_attribute` are mutually
20141 /// exclusive.
20142 ///
20143 /// # Example
20144 /// ```ignore,no_run
20145 /// # use google_cloud_retail_v2::model::Tile;
20146 /// use google_cloud_retail_v2::model::ProductAttributeValue;
20147 /// let x = Tile::new().set_product_attribute(Some(
20148 /// google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
20149 /// ```
20150 pub fn set_product_attribute<
20151 T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
20152 >(
20153 mut self,
20154 v: T,
20155 ) -> Self {
20156 self.product_attribute = v.into();
20157 self
20158 }
20159
20160 /// The value of [product_attribute][crate::model::Tile::product_attribute]
20161 /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
20162 /// holds a different branch.
20163 pub fn product_attribute_value(
20164 &self,
20165 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
20166 #[allow(unreachable_patterns)]
20167 self.product_attribute.as_ref().and_then(|v| match v {
20168 crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
20169 std::option::Option::Some(v)
20170 }
20171 _ => std::option::Option::None,
20172 })
20173 }
20174
20175 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20176 /// to hold a `ProductAttributeValue`.
20177 ///
20178 /// Note that all the setters affecting `product_attribute` are
20179 /// mutually exclusive.
20180 ///
20181 /// # Example
20182 /// ```ignore,no_run
20183 /// # use google_cloud_retail_v2::model::Tile;
20184 /// use google_cloud_retail_v2::model::ProductAttributeValue;
20185 /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20186 /// assert!(x.product_attribute_value().is_some());
20187 /// assert!(x.product_attribute_interval().is_none());
20188 /// ```
20189 pub fn set_product_attribute_value<
20190 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20191 >(
20192 mut self,
20193 v: T,
20194 ) -> Self {
20195 self.product_attribute = std::option::Option::Some(
20196 crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20197 );
20198 self
20199 }
20200
20201 /// The value of [product_attribute][crate::model::Tile::product_attribute]
20202 /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20203 /// holds a different branch.
20204 pub fn product_attribute_interval(
20205 &self,
20206 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20207 #[allow(unreachable_patterns)]
20208 self.product_attribute.as_ref().and_then(|v| match v {
20209 crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20210 std::option::Option::Some(v)
20211 }
20212 _ => std::option::Option::None,
20213 })
20214 }
20215
20216 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20217 /// to hold a `ProductAttributeInterval`.
20218 ///
20219 /// Note that all the setters affecting `product_attribute` are
20220 /// mutually exclusive.
20221 ///
20222 /// # Example
20223 /// ```ignore,no_run
20224 /// # use google_cloud_retail_v2::model::Tile;
20225 /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20226 /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20227 /// assert!(x.product_attribute_interval().is_some());
20228 /// assert!(x.product_attribute_value().is_none());
20229 /// ```
20230 pub fn set_product_attribute_interval<
20231 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20232 >(
20233 mut self,
20234 v: T,
20235 ) -> Self {
20236 self.product_attribute = std::option::Option::Some(
20237 crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20238 );
20239 self
20240 }
20241}
20242
20243impl wkt::message::Message for Tile {
20244 fn typename() -> &'static str {
20245 "type.googleapis.com/google.cloud.retail.v2.Tile"
20246 }
20247}
20248
20249/// Defines additional types related to [Tile].
20250pub mod tile {
20251 #[allow(unused_imports)]
20252 use super::*;
20253
20254 /// The attribute key and value for the tile.
20255 #[derive(Clone, Debug, PartialEq)]
20256 #[non_exhaustive]
20257 pub enum ProductAttribute {
20258 /// The product attribute key-value.
20259 ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20260 /// The product attribute key-numeric interval.
20261 ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20262 }
20263}
20264
20265/// Request message for
20266/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20267///
20268/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20269#[derive(Clone, Default, PartialEq)]
20270#[non_exhaustive]
20271pub struct SearchRequest {
20272 /// Required. The resource name of the Retail Search serving config, such as
20273 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20274 /// or the name of the legacy placement resource, such as
20275 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20276 /// This field is used to identify the serving config name and the set
20277 /// of models that are used to make the search.
20278 pub placement: std::string::String,
20279
20280 /// The branch resource name, such as
20281 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20282 ///
20283 /// Use "default_branch" as the branch ID or leave this field empty, to search
20284 /// products under the default branch.
20285 pub branch: std::string::String,
20286
20287 /// Raw search query.
20288 ///
20289 /// If this field is empty, the request is considered a category browsing
20290 /// request and returned results are based on
20291 /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20292 /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20293 ///
20294 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20295 /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20296 pub query: std::string::String,
20297
20298 /// Required. A unique identifier for tracking visitors. For example, this
20299 /// could be implemented with an HTTP cookie, which should be able to uniquely
20300 /// identify a visitor on a single device. This unique identifier should not
20301 /// change if the visitor logs in or out of the website.
20302 ///
20303 /// This should be the same identifier as
20304 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20305 ///
20306 /// The field must be a UTF-8 encoded string with a length limit of 128
20307 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20308 ///
20309 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20310 pub visitor_id: std::string::String,
20311
20312 /// User information.
20313 pub user_info: std::option::Option<crate::model::UserInfo>,
20314
20315 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20316 /// unspecified, defaults to a reasonable value. The maximum allowed value is
20317 /// 120. Values above 120 will be coerced to 120.
20318 ///
20319 /// If this field is negative, an INVALID_ARGUMENT is returned.
20320 ///
20321 /// [google.cloud.retail.v2.Product]: crate::model::Product
20322 pub page_size: i32,
20323
20324 /// A page token
20325 /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20326 /// received from a previous
20327 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20328 /// Provide this to retrieve the subsequent page.
20329 ///
20330 /// When paginating, all other parameters provided to
20331 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20332 /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20333 /// error is returned.
20334 ///
20335 /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20336 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20337 pub page_token: std::string::String,
20338
20339 /// A 0-indexed integer that specifies the current offset (that is, starting
20340 /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20341 /// deemed by the API as relevant) in search results. This field is only
20342 /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20343 /// is unset.
20344 ///
20345 /// If this field is negative, an INVALID_ARGUMENT is returned.
20346 ///
20347 /// [google.cloud.retail.v2.Product]: crate::model::Product
20348 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20349 pub offset: i32,
20350
20351 /// The filter syntax consists of an expression language for constructing a
20352 /// predicate from one or more fields of the products being filtered. Filter
20353 /// expression is case-sensitive. For more information, see
20354 /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20355 ///
20356 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20357 pub filter: std::string::String,
20358
20359 /// The default filter that is applied when a user performs a search without
20360 /// checking any filters on the search page.
20361 ///
20362 /// The filter applied to every search request when quality improvement such as
20363 /// query expansion is needed. In the case a query does not have a sufficient
20364 /// amount of results this filter will be used to determine whether or not to
20365 /// enable the query expansion flow. The original filter will still be used for
20366 /// the query expanded search.
20367 /// This field is strongly recommended to achieve high search quality.
20368 ///
20369 /// For more information about filter syntax, see
20370 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20371 ///
20372 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20373 pub canonical_filter: std::string::String,
20374
20375 /// The order in which products are returned. Products can be ordered by
20376 /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20377 /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20378 /// more information, see
20379 /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20380 ///
20381 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20382 ///
20383 /// [google.cloud.retail.v2.Product]: crate::model::Product
20384 pub order_by: std::string::String,
20385
20386 /// Facet specifications for faceted search. If empty, no facets are returned.
20387 ///
20388 /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20389 /// is returned.
20390 pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20391
20392 /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20393 /// to enable dynamic facets. Do not set this field.
20394 ///
20395 /// The specification for dynamically generated facets. Notice that only
20396 /// textual facets can be dynamically generated.
20397 #[deprecated]
20398 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20399
20400 /// Boost specification to boost certain products. For more information, see
20401 /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20402 ///
20403 /// Notice that if both
20404 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20405 /// and
20406 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20407 /// are set, the boost conditions from both places are evaluated. If a search
20408 /// request matches multiple boost conditions, the final boost score is equal
20409 /// to the sum of the boost scores from all matched boost conditions.
20410 ///
20411 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20412 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20413 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20414
20415 /// The query expansion specification that specifies the conditions under which
20416 /// query expansion occurs. For more information, see [Query
20417 /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20418 pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20419
20420 /// The keys to fetch and rollup the matching
20421 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20422 /// [Product][google.cloud.retail.v2.Product]s attributes,
20423 /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20424 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20425 /// attributes from all the matching
20426 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20427 /// [Product][google.cloud.retail.v2.Product]s or
20428 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20429 /// de-duplicated. Notice that rollup attributes will lead to extra query
20430 /// latency. Maximum number of keys is 30.
20431 ///
20432 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20433 /// fulfillment type and a fulfillment ID must be provided in the format of
20434 /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20435 /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20436 ///
20437 /// Supported keys are:
20438 ///
20439 /// * colorFamilies
20440 /// * price
20441 /// * originalPrice
20442 /// * discount
20443 /// * variantId
20444 /// * inventory(place_id,price)
20445 /// * inventory(place_id,original_price)
20446 /// * inventory(place_id,attributes.key), where key is any key in the
20447 /// [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20448 /// map.
20449 /// * attributes.key, where key is any key in the
20450 /// [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20451 /// * pickupInStore.id, where id is any
20452 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20453 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20454 /// "pickup-in-store".
20455 /// * shipToStore.id, where id is any
20456 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20457 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20458 /// "ship-to-store".
20459 /// * sameDayDelivery.id, where id is any
20460 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20461 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20462 /// "same-day-delivery".
20463 /// * nextDayDelivery.id, where id is any
20464 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20465 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20466 /// "next-day-delivery".
20467 /// * customFulfillment1.id, where id is any
20468 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20469 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20470 /// "custom-type-1".
20471 /// * customFulfillment2.id, where id is any
20472 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20473 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20474 /// "custom-type-2".
20475 /// * customFulfillment3.id, where id is any
20476 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20477 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20478 /// "custom-type-3".
20479 /// * customFulfillment4.id, where id is any
20480 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20481 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20482 /// "custom-type-4".
20483 /// * customFulfillment5.id, where id is any
20484 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20485 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20486 /// "custom-type-5".
20487 ///
20488 /// If this field is set to an invalid value other than these, an
20489 /// INVALID_ARGUMENT error is returned.
20490 ///
20491 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20492 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20493 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20494 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20495 /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20496 /// [google.cloud.retail.v2.Product]: crate::model::Product
20497 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20498 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20499 pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20500
20501 /// The categories associated with a category page. Must be set for category
20502 /// navigation queries to achieve good search quality. The format should be
20503 /// the same as
20504 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20505 ///
20506 /// To represent full path of category, use '>' sign to separate different
20507 /// hierarchies. If '>' is part of the category name, replace it with
20508 /// other character(s).
20509 ///
20510 /// Category pages include special pages such as sales or promotions. For
20511 /// instance, a special sale page may have the category hierarchy:
20512 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20513 ///
20514 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20515 pub page_categories: std::vec::Vec<std::string::String>,
20516
20517 /// The search mode of the search request. If not specified, a single search
20518 /// request triggers both product search and faceted search.
20519 pub search_mode: crate::model::search_request::SearchMode,
20520
20521 /// The specification for personalization.
20522 ///
20523 /// Notice that if both
20524 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20525 /// and
20526 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20527 /// are set.
20528 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20529 /// will override
20530 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20531 ///
20532 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20533 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20534 pub personalization_spec:
20535 std::option::Option<crate::model::search_request::PersonalizationSpec>,
20536
20537 /// The labels applied to a resource must meet the following requirements:
20538 ///
20539 /// * Each resource can have multiple labels, up to a maximum of 64.
20540 /// * Each label must be a key-value pair.
20541 /// * Keys have a minimum length of 1 character and a maximum length of 63
20542 /// characters and cannot be empty. Values can be empty and have a maximum
20543 /// length of 63 characters.
20544 /// * Keys and values can contain only lowercase letters, numeric characters,
20545 /// underscores, and dashes. All characters must use UTF-8 encoding, and
20546 /// international characters are allowed.
20547 /// * The key portion of a label must be unique. However, you can use the same
20548 /// key with multiple resources.
20549 /// * Keys must start with a lowercase letter or international character.
20550 ///
20551 /// For more information, see [Requirements for
20552 /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20553 /// in the Resource Manager documentation.
20554 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20555
20556 /// The spell correction specification that specifies the mode under
20557 /// which spell correction will take effect.
20558 pub spell_correction_spec:
20559 std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20560
20561 /// The entity for customers that may run multiple different entities, domains,
20562 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20563 /// `google.com`, `youtube.com`, etc.
20564 /// If this is set, it should be exactly matched with
20565 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20566 /// results boosted by entity.
20567 ///
20568 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20569 pub entity: std::string::String,
20570
20571 /// Optional. This field specifies all conversational related parameters
20572 /// addition to traditional retail search.
20573 pub conversational_search_spec:
20574 std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20575
20576 /// Optional. This field specifies tile navigation related parameters.
20577 pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20578
20579 /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20580 /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20581 /// information, see [Standardized codes](https://google.aip.dev/143). This
20582 /// field helps to better interpret the query. If a value isn't specified, the
20583 /// query language code is automatically detected, which may not be accurate.
20584 pub language_code: std::string::String,
20585
20586 /// Optional. The Unicode country/region code (CLDR) of a location, such as
20587 /// "US" and "419"
20588 /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20589 /// For more information, see [Standardized codes](https://google.aip.dev/143).
20590 /// If set, then results will be boosted based on the region_code provided.
20591 pub region_code: std::string::String,
20592
20593 /// Optional. An id corresponding to a place, such as a store id or region id.
20594 /// When specified, we use the price from the local inventory with the matching
20595 /// product's
20596 /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20597 /// for revenue optimization.
20598 ///
20599 /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20600 pub place_id: std::string::String,
20601
20602 /// Optional. The user attributes that could be used for personalization of
20603 /// search results.
20604 ///
20605 /// * Populate at most 100 key-value pairs per query.
20606 /// * Only supports string keys and repeated string values.
20607 /// * Duplicate keys are not allowed within a single query.
20608 ///
20609 /// Example:
20610 /// user_attributes: [
20611 /// { key: "pets"
20612 /// value {
20613 /// values: "dog"
20614 /// values: "cat"
20615 /// }
20616 /// },
20617 /// { key: "state"
20618 /// value {
20619 /// values: "CA"
20620 /// }
20621 /// }
20622 /// ]
20623 pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20624
20625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20626}
20627
20628impl SearchRequest {
20629 /// Creates a new default instance.
20630 pub fn new() -> Self {
20631 std::default::Default::default()
20632 }
20633
20634 /// Sets the value of [placement][crate::model::SearchRequest::placement].
20635 ///
20636 /// # Example
20637 /// ```ignore,no_run
20638 /// # use google_cloud_retail_v2::model::SearchRequest;
20639 /// let x = SearchRequest::new().set_placement("example");
20640 /// ```
20641 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20642 self.placement = v.into();
20643 self
20644 }
20645
20646 /// Sets the value of [branch][crate::model::SearchRequest::branch].
20647 ///
20648 /// # Example
20649 /// ```ignore,no_run
20650 /// # use google_cloud_retail_v2::model::SearchRequest;
20651 /// let x = SearchRequest::new().set_branch("example");
20652 /// ```
20653 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20654 self.branch = v.into();
20655 self
20656 }
20657
20658 /// Sets the value of [query][crate::model::SearchRequest::query].
20659 ///
20660 /// # Example
20661 /// ```ignore,no_run
20662 /// # use google_cloud_retail_v2::model::SearchRequest;
20663 /// let x = SearchRequest::new().set_query("example");
20664 /// ```
20665 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20666 self.query = v.into();
20667 self
20668 }
20669
20670 /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20671 ///
20672 /// # Example
20673 /// ```ignore,no_run
20674 /// # use google_cloud_retail_v2::model::SearchRequest;
20675 /// let x = SearchRequest::new().set_visitor_id("example");
20676 /// ```
20677 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20678 self.visitor_id = v.into();
20679 self
20680 }
20681
20682 /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20683 ///
20684 /// # Example
20685 /// ```ignore,no_run
20686 /// # use google_cloud_retail_v2::model::SearchRequest;
20687 /// use google_cloud_retail_v2::model::UserInfo;
20688 /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20689 /// ```
20690 pub fn set_user_info<T>(mut self, v: T) -> Self
20691 where
20692 T: std::convert::Into<crate::model::UserInfo>,
20693 {
20694 self.user_info = std::option::Option::Some(v.into());
20695 self
20696 }
20697
20698 /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20699 ///
20700 /// # Example
20701 /// ```ignore,no_run
20702 /// # use google_cloud_retail_v2::model::SearchRequest;
20703 /// use google_cloud_retail_v2::model::UserInfo;
20704 /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20705 /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20706 /// ```
20707 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20708 where
20709 T: std::convert::Into<crate::model::UserInfo>,
20710 {
20711 self.user_info = v.map(|x| x.into());
20712 self
20713 }
20714
20715 /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20716 ///
20717 /// # Example
20718 /// ```ignore,no_run
20719 /// # use google_cloud_retail_v2::model::SearchRequest;
20720 /// let x = SearchRequest::new().set_page_size(42);
20721 /// ```
20722 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20723 self.page_size = v.into();
20724 self
20725 }
20726
20727 /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20728 ///
20729 /// # Example
20730 /// ```ignore,no_run
20731 /// # use google_cloud_retail_v2::model::SearchRequest;
20732 /// let x = SearchRequest::new().set_page_token("example");
20733 /// ```
20734 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20735 self.page_token = v.into();
20736 self
20737 }
20738
20739 /// Sets the value of [offset][crate::model::SearchRequest::offset].
20740 ///
20741 /// # Example
20742 /// ```ignore,no_run
20743 /// # use google_cloud_retail_v2::model::SearchRequest;
20744 /// let x = SearchRequest::new().set_offset(42);
20745 /// ```
20746 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20747 self.offset = v.into();
20748 self
20749 }
20750
20751 /// Sets the value of [filter][crate::model::SearchRequest::filter].
20752 ///
20753 /// # Example
20754 /// ```ignore,no_run
20755 /// # use google_cloud_retail_v2::model::SearchRequest;
20756 /// let x = SearchRequest::new().set_filter("example");
20757 /// ```
20758 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20759 self.filter = v.into();
20760 self
20761 }
20762
20763 /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20764 ///
20765 /// # Example
20766 /// ```ignore,no_run
20767 /// # use google_cloud_retail_v2::model::SearchRequest;
20768 /// let x = SearchRequest::new().set_canonical_filter("example");
20769 /// ```
20770 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20771 mut self,
20772 v: T,
20773 ) -> Self {
20774 self.canonical_filter = v.into();
20775 self
20776 }
20777
20778 /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20779 ///
20780 /// # Example
20781 /// ```ignore,no_run
20782 /// # use google_cloud_retail_v2::model::SearchRequest;
20783 /// let x = SearchRequest::new().set_order_by("example");
20784 /// ```
20785 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20786 self.order_by = v.into();
20787 self
20788 }
20789
20790 /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20791 ///
20792 /// # Example
20793 /// ```ignore,no_run
20794 /// # use google_cloud_retail_v2::model::SearchRequest;
20795 /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20796 /// let x = SearchRequest::new()
20797 /// .set_facet_specs([
20798 /// FacetSpec::default()/* use setters */,
20799 /// FacetSpec::default()/* use (different) setters */,
20800 /// ]);
20801 /// ```
20802 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20803 where
20804 T: std::iter::IntoIterator<Item = V>,
20805 V: std::convert::Into<crate::model::search_request::FacetSpec>,
20806 {
20807 use std::iter::Iterator;
20808 self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20809 self
20810 }
20811
20812 /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20813 ///
20814 /// # Example
20815 /// ```ignore,no_run
20816 /// # use google_cloud_retail_v2::model::SearchRequest;
20817 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20818 /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20819 /// ```
20820 #[deprecated]
20821 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20822 where
20823 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20824 {
20825 self.dynamic_facet_spec = std::option::Option::Some(v.into());
20826 self
20827 }
20828
20829 /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20830 ///
20831 /// # Example
20832 /// ```ignore,no_run
20833 /// # use google_cloud_retail_v2::model::SearchRequest;
20834 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20835 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20836 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20837 /// ```
20838 #[deprecated]
20839 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20840 where
20841 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20842 {
20843 self.dynamic_facet_spec = v.map(|x| x.into());
20844 self
20845 }
20846
20847 /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20848 ///
20849 /// # Example
20850 /// ```ignore,no_run
20851 /// # use google_cloud_retail_v2::model::SearchRequest;
20852 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20853 /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20854 /// ```
20855 pub fn set_boost_spec<T>(mut self, v: T) -> Self
20856 where
20857 T: std::convert::Into<crate::model::search_request::BoostSpec>,
20858 {
20859 self.boost_spec = std::option::Option::Some(v.into());
20860 self
20861 }
20862
20863 /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20864 ///
20865 /// # Example
20866 /// ```ignore,no_run
20867 /// # use google_cloud_retail_v2::model::SearchRequest;
20868 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20869 /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
20870 /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
20871 /// ```
20872 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
20873 where
20874 T: std::convert::Into<crate::model::search_request::BoostSpec>,
20875 {
20876 self.boost_spec = v.map(|x| x.into());
20877 self
20878 }
20879
20880 /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20881 ///
20882 /// # Example
20883 /// ```ignore,no_run
20884 /// # use google_cloud_retail_v2::model::SearchRequest;
20885 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20886 /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
20887 /// ```
20888 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
20889 where
20890 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20891 {
20892 self.query_expansion_spec = std::option::Option::Some(v.into());
20893 self
20894 }
20895
20896 /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20897 ///
20898 /// # Example
20899 /// ```ignore,no_run
20900 /// # use google_cloud_retail_v2::model::SearchRequest;
20901 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20902 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
20903 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
20904 /// ```
20905 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
20906 where
20907 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20908 {
20909 self.query_expansion_spec = v.map(|x| x.into());
20910 self
20911 }
20912
20913 /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
20914 ///
20915 /// # Example
20916 /// ```ignore,no_run
20917 /// # use google_cloud_retail_v2::model::SearchRequest;
20918 /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
20919 /// ```
20920 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
20921 where
20922 T: std::iter::IntoIterator<Item = V>,
20923 V: std::convert::Into<std::string::String>,
20924 {
20925 use std::iter::Iterator;
20926 self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
20927 self
20928 }
20929
20930 /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
20931 ///
20932 /// # Example
20933 /// ```ignore,no_run
20934 /// # use google_cloud_retail_v2::model::SearchRequest;
20935 /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
20936 /// ```
20937 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
20938 where
20939 T: std::iter::IntoIterator<Item = V>,
20940 V: std::convert::Into<std::string::String>,
20941 {
20942 use std::iter::Iterator;
20943 self.page_categories = v.into_iter().map(|i| i.into()).collect();
20944 self
20945 }
20946
20947 /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
20948 ///
20949 /// # Example
20950 /// ```ignore,no_run
20951 /// # use google_cloud_retail_v2::model::SearchRequest;
20952 /// use google_cloud_retail_v2::model::search_request::SearchMode;
20953 /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
20954 /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
20955 /// ```
20956 pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
20957 mut self,
20958 v: T,
20959 ) -> Self {
20960 self.search_mode = v.into();
20961 self
20962 }
20963
20964 /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20965 ///
20966 /// # Example
20967 /// ```ignore,no_run
20968 /// # use google_cloud_retail_v2::model::SearchRequest;
20969 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20970 /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
20971 /// ```
20972 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
20973 where
20974 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20975 {
20976 self.personalization_spec = std::option::Option::Some(v.into());
20977 self
20978 }
20979
20980 /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20981 ///
20982 /// # Example
20983 /// ```ignore,no_run
20984 /// # use google_cloud_retail_v2::model::SearchRequest;
20985 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20986 /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
20987 /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
20988 /// ```
20989 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
20990 where
20991 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20992 {
20993 self.personalization_spec = v.map(|x| x.into());
20994 self
20995 }
20996
20997 /// Sets the value of [labels][crate::model::SearchRequest::labels].
20998 ///
20999 /// # Example
21000 /// ```ignore,no_run
21001 /// # use google_cloud_retail_v2::model::SearchRequest;
21002 /// let x = SearchRequest::new().set_labels([
21003 /// ("key0", "abc"),
21004 /// ("key1", "xyz"),
21005 /// ]);
21006 /// ```
21007 pub fn set_labels<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<std::string::String>,
21012 {
21013 use std::iter::Iterator;
21014 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21015 self
21016 }
21017
21018 /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21019 ///
21020 /// # Example
21021 /// ```ignore,no_run
21022 /// # use google_cloud_retail_v2::model::SearchRequest;
21023 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21024 /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
21025 /// ```
21026 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
21027 where
21028 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21029 {
21030 self.spell_correction_spec = std::option::Option::Some(v.into());
21031 self
21032 }
21033
21034 /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21035 ///
21036 /// # Example
21037 /// ```ignore,no_run
21038 /// # use google_cloud_retail_v2::model::SearchRequest;
21039 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21040 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
21041 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
21042 /// ```
21043 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
21044 where
21045 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21046 {
21047 self.spell_correction_spec = v.map(|x| x.into());
21048 self
21049 }
21050
21051 /// Sets the value of [entity][crate::model::SearchRequest::entity].
21052 ///
21053 /// # Example
21054 /// ```ignore,no_run
21055 /// # use google_cloud_retail_v2::model::SearchRequest;
21056 /// let x = SearchRequest::new().set_entity("example");
21057 /// ```
21058 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21059 self.entity = v.into();
21060 self
21061 }
21062
21063 /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21064 ///
21065 /// # Example
21066 /// ```ignore,no_run
21067 /// # use google_cloud_retail_v2::model::SearchRequest;
21068 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21069 /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
21070 /// ```
21071 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
21072 where
21073 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21074 {
21075 self.conversational_search_spec = std::option::Option::Some(v.into());
21076 self
21077 }
21078
21079 /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21080 ///
21081 /// # Example
21082 /// ```ignore,no_run
21083 /// # use google_cloud_retail_v2::model::SearchRequest;
21084 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21085 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
21086 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
21087 /// ```
21088 pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
21089 where
21090 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21091 {
21092 self.conversational_search_spec = v.map(|x| x.into());
21093 self
21094 }
21095
21096 /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21097 ///
21098 /// # Example
21099 /// ```ignore,no_run
21100 /// # use google_cloud_retail_v2::model::SearchRequest;
21101 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21102 /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
21103 /// ```
21104 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
21105 where
21106 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21107 {
21108 self.tile_navigation_spec = std::option::Option::Some(v.into());
21109 self
21110 }
21111
21112 /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21113 ///
21114 /// # Example
21115 /// ```ignore,no_run
21116 /// # use google_cloud_retail_v2::model::SearchRequest;
21117 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21118 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
21119 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
21120 /// ```
21121 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
21122 where
21123 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21124 {
21125 self.tile_navigation_spec = v.map(|x| x.into());
21126 self
21127 }
21128
21129 /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
21130 ///
21131 /// # Example
21132 /// ```ignore,no_run
21133 /// # use google_cloud_retail_v2::model::SearchRequest;
21134 /// let x = SearchRequest::new().set_language_code("example");
21135 /// ```
21136 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21137 self.language_code = v.into();
21138 self
21139 }
21140
21141 /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
21142 ///
21143 /// # Example
21144 /// ```ignore,no_run
21145 /// # use google_cloud_retail_v2::model::SearchRequest;
21146 /// let x = SearchRequest::new().set_region_code("example");
21147 /// ```
21148 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21149 self.region_code = v.into();
21150 self
21151 }
21152
21153 /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
21154 ///
21155 /// # Example
21156 /// ```ignore,no_run
21157 /// # use google_cloud_retail_v2::model::SearchRequest;
21158 /// let x = SearchRequest::new().set_place_id("example");
21159 /// ```
21160 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21161 self.place_id = v.into();
21162 self
21163 }
21164
21165 /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
21166 ///
21167 /// # Example
21168 /// ```ignore,no_run
21169 /// # use google_cloud_retail_v2::model::SearchRequest;
21170 /// use google_cloud_retail_v2::model::StringList;
21171 /// let x = SearchRequest::new().set_user_attributes([
21172 /// ("key0", StringList::default()/* use setters */),
21173 /// ("key1", StringList::default()/* use (different) setters */),
21174 /// ]);
21175 /// ```
21176 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21177 where
21178 T: std::iter::IntoIterator<Item = (K, V)>,
21179 K: std::convert::Into<std::string::String>,
21180 V: std::convert::Into<crate::model::StringList>,
21181 {
21182 use std::iter::Iterator;
21183 self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21184 self
21185 }
21186}
21187
21188impl wkt::message::Message for SearchRequest {
21189 fn typename() -> &'static str {
21190 "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21191 }
21192}
21193
21194/// Defines additional types related to [SearchRequest].
21195pub mod search_request {
21196 #[allow(unused_imports)]
21197 use super::*;
21198
21199 /// A facet specification to perform faceted search.
21200 #[derive(Clone, Default, PartialEq)]
21201 #[non_exhaustive]
21202 pub struct FacetSpec {
21203 /// Required. The facet key specification.
21204 pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21205
21206 /// Maximum of facet values that should be returned for this facet. If
21207 /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21208 /// above 300 will be coerced to 300.
21209 ///
21210 /// If this field is negative, an INVALID_ARGUMENT is returned.
21211 pub limit: i32,
21212
21213 /// List of keys to exclude when faceting.
21214 ///
21215 /// By default,
21216 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21217 /// is not excluded from the filter unless it is listed in this field.
21218 ///
21219 /// Listing a facet key in this field allows its values to appear as facet
21220 /// results, even when they are filtered out of search results. Using this
21221 /// field does not affect what search results are returned.
21222 ///
21223 /// For example, suppose there are 100 products with the color facet "Red"
21224 /// and 200 products with the color facet "Blue". A query containing the
21225 /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21226 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21227 /// would by default return only "Red" products in the search results, and
21228 /// also return "Red" with count 100 as the only color facet. Although there
21229 /// are also blue products available, "Blue" would not be shown as an
21230 /// available facet value.
21231 ///
21232 /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21233 /// returns the facet values "Red" with count 100 and "Blue" with count
21234 /// 200, because the "colorFamilies" key is now excluded from the filter.
21235 /// Because this field doesn't affect search results, the search results
21236 /// are still correctly filtered to return only "Red" products.
21237 ///
21238 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21239 /// is returned.
21240 ///
21241 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21242 pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21243
21244 /// Enables dynamic position for this facet. If set to true, the position of
21245 /// this facet among all facets in the response is determined by Google
21246 /// Retail Search. It is ordered together with dynamic facets if dynamic
21247 /// facets is enabled. If set to false, the position of this facet in the
21248 /// response is the same as in the request, and it is ranked before
21249 /// the facets with dynamic position enable and all dynamic facets.
21250 ///
21251 /// For example, you may always want to have rating facet returned in
21252 /// the response, but it's not necessarily to always display the rating facet
21253 /// at the top. In that case, you can set enable_dynamic_position to true so
21254 /// that the position of rating facet in response is determined by
21255 /// Google Retail Search.
21256 ///
21257 /// Another example, assuming you have the following facets in the request:
21258 ///
21259 /// * "rating", enable_dynamic_position = true
21260 ///
21261 /// * "price", enable_dynamic_position = false
21262 ///
21263 /// * "brands", enable_dynamic_position = false
21264 ///
21265 ///
21266 /// And also you have a dynamic facets enable, which generates a facet
21267 /// "gender". Then, the final order of the facets in the response can be
21268 /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21269 /// "rating") depends on how Google Retail Search orders "gender" and
21270 /// "rating" facets. However, notice that "price" and "brands" are always
21271 /// ranked at first and second position because their enable_dynamic_position
21272 /// values are false.
21273 pub enable_dynamic_position: bool,
21274
21275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21276 }
21277
21278 impl FacetSpec {
21279 /// Creates a new default instance.
21280 pub fn new() -> Self {
21281 std::default::Default::default()
21282 }
21283
21284 /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21285 ///
21286 /// # Example
21287 /// ```ignore,no_run
21288 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21289 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21290 /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21291 /// ```
21292 pub fn set_facet_key<T>(mut self, v: T) -> Self
21293 where
21294 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21295 {
21296 self.facet_key = std::option::Option::Some(v.into());
21297 self
21298 }
21299
21300 /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21301 ///
21302 /// # Example
21303 /// ```ignore,no_run
21304 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21305 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21306 /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21307 /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21308 /// ```
21309 pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21310 where
21311 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21312 {
21313 self.facet_key = v.map(|x| x.into());
21314 self
21315 }
21316
21317 /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21318 ///
21319 /// # Example
21320 /// ```ignore,no_run
21321 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21322 /// let x = FacetSpec::new().set_limit(42);
21323 /// ```
21324 pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21325 self.limit = v.into();
21326 self
21327 }
21328
21329 /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21330 ///
21331 /// # Example
21332 /// ```ignore,no_run
21333 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21334 /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21335 /// ```
21336 pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21337 where
21338 T: std::iter::IntoIterator<Item = V>,
21339 V: std::convert::Into<std::string::String>,
21340 {
21341 use std::iter::Iterator;
21342 self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21343 self
21344 }
21345
21346 /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21347 ///
21348 /// # Example
21349 /// ```ignore,no_run
21350 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21351 /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21352 /// ```
21353 pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21354 self.enable_dynamic_position = v.into();
21355 self
21356 }
21357 }
21358
21359 impl wkt::message::Message for FacetSpec {
21360 fn typename() -> &'static str {
21361 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21362 }
21363 }
21364
21365 /// Defines additional types related to [FacetSpec].
21366 pub mod facet_spec {
21367 #[allow(unused_imports)]
21368 use super::*;
21369
21370 /// Specifies how a facet is computed.
21371 #[derive(Clone, Default, PartialEq)]
21372 #[non_exhaustive]
21373 pub struct FacetKey {
21374 /// Required. Supported textual and numerical facet keys in
21375 /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21376 /// values are computed. Facet key is case-sensitive.
21377 ///
21378 /// Allowed facet keys when
21379 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21380 /// is not specified:
21381 ///
21382 /// * textual_field =
21383 ///
21384 /// * "brands"
21385 /// * "categories"
21386 /// * "genders"
21387 /// * "ageGroups"
21388 /// * "availability"
21389 /// * "colorFamilies"
21390 /// * "colors"
21391 /// * "sizes"
21392 /// * "materials"
21393 /// * "patterns"
21394 /// * "conditions"
21395 /// * "attributes.key"
21396 /// * "pickupInStore"
21397 /// * "shipToStore"
21398 /// * "sameDayDelivery"
21399 /// * "nextDayDelivery"
21400 /// * "customFulfillment1"
21401 /// * "customFulfillment2"
21402 /// * "customFulfillment3"
21403 /// * "customFulfillment4"
21404 /// * "customFulfillment5"
21405 /// * "inventory(place_id,attributes.key)"
21406 /// * numerical_field =
21407 ///
21408 /// * "price"
21409 /// * "discount"
21410 /// * "rating"
21411 /// * "ratingCount"
21412 /// * "attributes.key"
21413 /// * "inventory(place_id,price)"
21414 /// * "inventory(place_id,original_price)"
21415 /// * "inventory(place_id,attributes.key)"
21416 ///
21417 /// [google.cloud.retail.v2.Product]: crate::model::Product
21418 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21419 pub key: std::string::String,
21420
21421 /// Set only if values should be bucketized into intervals. Must be set
21422 /// for facets with numerical values. Must not be set for facet with text
21423 /// values. Maximum number of intervals is 40.
21424 ///
21425 /// For all numerical facet keys that appear in the list of products from
21426 /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21427 /// computed from their distribution weekly. If the model assigns a high
21428 /// score to a numerical facet key and its intervals are not specified in
21429 /// the search request, these percentiles become the bounds
21430 /// for its intervals and are returned in the response. If the
21431 /// facet key intervals are specified in the request, then the specified
21432 /// intervals are returned instead.
21433 pub intervals: std::vec::Vec<crate::model::Interval>,
21434
21435 /// Only get facet for the given restricted values. For example, when using
21436 /// "pickupInStore" as key and set restricted values to
21437 /// ["store123", "store456"], only facets for "store123" and "store456" are
21438 /// returned. Only supported on predefined textual fields, custom textual
21439 /// attributes and fulfillments. Maximum is 20.
21440 ///
21441 /// Must be set for the fulfillment facet keys:
21442 ///
21443 /// * pickupInStore
21444 ///
21445 /// * shipToStore
21446 ///
21447 /// * sameDayDelivery
21448 ///
21449 /// * nextDayDelivery
21450 ///
21451 /// * customFulfillment1
21452 ///
21453 /// * customFulfillment2
21454 ///
21455 /// * customFulfillment3
21456 ///
21457 /// * customFulfillment4
21458 ///
21459 /// * customFulfillment5
21460 ///
21461 pub restricted_values: std::vec::Vec<std::string::String>,
21462
21463 /// Only get facet values that start with the given string prefix. For
21464 /// example, suppose "categories" has three values "Women > Shoe",
21465 /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21466 /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21467 /// Only supported on textual fields. Maximum is 10.
21468 pub prefixes: std::vec::Vec<std::string::String>,
21469
21470 /// Only get facet values that contains the given strings. For example,
21471 /// suppose "categories" has three values "Women > Shoe",
21472 /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21473 /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21474 /// Only supported on textual fields. Maximum is 10.
21475 pub contains: std::vec::Vec<std::string::String>,
21476
21477 /// True to make facet keys case insensitive when getting faceting
21478 /// values with prefixes or contains; false otherwise.
21479 pub case_insensitive: bool,
21480
21481 /// The order in which
21482 /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21483 /// are returned.
21484 ///
21485 /// Allowed values are:
21486 ///
21487 /// * "count desc", which means order by
21488 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21489 /// descending.
21490 ///
21491 /// * "value desc", which means order by
21492 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21493 /// descending.
21494 /// Only applies to textual facets.
21495 ///
21496 ///
21497 /// If not set, textual values are sorted in [natural
21498 /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21499 /// intervals are sorted in the order given by
21500 /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21501 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21502 /// are sorted in the order given by
21503 /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21504 ///
21505 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21506 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21507 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21508 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21509 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21510 /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21511 pub order_by: std::string::String,
21512
21513 /// The query that is used to compute facet for the given facet key.
21514 /// When provided, it overrides the default behavior of facet
21515 /// computation. The query syntax is the same as a filter expression. See
21516 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21517 /// detail syntax and limitations. Notice that there is no limitation on
21518 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21519 /// when query is specified.
21520 ///
21521 /// In the response,
21522 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21523 /// is always "1" and
21524 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21525 /// is the number of results that match the query.
21526 ///
21527 /// For example, you can set a customized facet for "shipToStore",
21528 /// where
21529 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21530 /// is "customizedShipToStore", and
21531 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21532 /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21533 /// Then the facet counts the products that are both in stock and ship
21534 /// to store "123".
21535 ///
21536 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21537 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21538 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21539 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21540 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21541 pub query: std::string::String,
21542
21543 /// Returns the min and max value for each numerical facet intervals.
21544 /// Ignored for textual facets.
21545 pub return_min_max: bool,
21546
21547 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21548 }
21549
21550 impl FacetKey {
21551 /// Creates a new default instance.
21552 pub fn new() -> Self {
21553 std::default::Default::default()
21554 }
21555
21556 /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21557 ///
21558 /// # Example
21559 /// ```ignore,no_run
21560 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21561 /// let x = FacetKey::new().set_key("example");
21562 /// ```
21563 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21564 self.key = v.into();
21565 self
21566 }
21567
21568 /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21569 ///
21570 /// # Example
21571 /// ```ignore,no_run
21572 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21573 /// use google_cloud_retail_v2::model::Interval;
21574 /// let x = FacetKey::new()
21575 /// .set_intervals([
21576 /// Interval::default()/* use setters */,
21577 /// Interval::default()/* use (different) setters */,
21578 /// ]);
21579 /// ```
21580 pub fn set_intervals<T, V>(mut self, v: T) -> Self
21581 where
21582 T: std::iter::IntoIterator<Item = V>,
21583 V: std::convert::Into<crate::model::Interval>,
21584 {
21585 use std::iter::Iterator;
21586 self.intervals = v.into_iter().map(|i| i.into()).collect();
21587 self
21588 }
21589
21590 /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21591 ///
21592 /// # Example
21593 /// ```ignore,no_run
21594 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21595 /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21596 /// ```
21597 pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21598 where
21599 T: std::iter::IntoIterator<Item = V>,
21600 V: std::convert::Into<std::string::String>,
21601 {
21602 use std::iter::Iterator;
21603 self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21604 self
21605 }
21606
21607 /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21608 ///
21609 /// # Example
21610 /// ```ignore,no_run
21611 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21612 /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21613 /// ```
21614 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21615 where
21616 T: std::iter::IntoIterator<Item = V>,
21617 V: std::convert::Into<std::string::String>,
21618 {
21619 use std::iter::Iterator;
21620 self.prefixes = v.into_iter().map(|i| i.into()).collect();
21621 self
21622 }
21623
21624 /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21625 ///
21626 /// # Example
21627 /// ```ignore,no_run
21628 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21629 /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21630 /// ```
21631 pub fn set_contains<T, V>(mut self, v: T) -> Self
21632 where
21633 T: std::iter::IntoIterator<Item = V>,
21634 V: std::convert::Into<std::string::String>,
21635 {
21636 use std::iter::Iterator;
21637 self.contains = v.into_iter().map(|i| i.into()).collect();
21638 self
21639 }
21640
21641 /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21642 ///
21643 /// # Example
21644 /// ```ignore,no_run
21645 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21646 /// let x = FacetKey::new().set_case_insensitive(true);
21647 /// ```
21648 pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21649 self.case_insensitive = v.into();
21650 self
21651 }
21652
21653 /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21654 ///
21655 /// # Example
21656 /// ```ignore,no_run
21657 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21658 /// let x = FacetKey::new().set_order_by("example");
21659 /// ```
21660 pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21661 mut self,
21662 v: T,
21663 ) -> Self {
21664 self.order_by = v.into();
21665 self
21666 }
21667
21668 /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21669 ///
21670 /// # Example
21671 /// ```ignore,no_run
21672 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21673 /// let x = FacetKey::new().set_query("example");
21674 /// ```
21675 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21676 self.query = v.into();
21677 self
21678 }
21679
21680 /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21681 ///
21682 /// # Example
21683 /// ```ignore,no_run
21684 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21685 /// let x = FacetKey::new().set_return_min_max(true);
21686 /// ```
21687 pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21688 self.return_min_max = v.into();
21689 self
21690 }
21691 }
21692
21693 impl wkt::message::Message for FacetKey {
21694 fn typename() -> &'static str {
21695 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21696 }
21697 }
21698 }
21699
21700 /// The specifications of dynamically generated facets.
21701 #[derive(Clone, Default, PartialEq)]
21702 #[non_exhaustive]
21703 pub struct DynamicFacetSpec {
21704 /// Mode of the DynamicFacet feature.
21705 /// Defaults to
21706 /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21707 /// if it's unset.
21708 ///
21709 /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21710 pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21711
21712 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21713 }
21714
21715 impl DynamicFacetSpec {
21716 /// Creates a new default instance.
21717 pub fn new() -> Self {
21718 std::default::Default::default()
21719 }
21720
21721 /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21722 ///
21723 /// # Example
21724 /// ```ignore,no_run
21725 /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21726 /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21727 /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21728 /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21729 /// ```
21730 pub fn set_mode<
21731 T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21732 >(
21733 mut self,
21734 v: T,
21735 ) -> Self {
21736 self.mode = v.into();
21737 self
21738 }
21739 }
21740
21741 impl wkt::message::Message for DynamicFacetSpec {
21742 fn typename() -> &'static str {
21743 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21744 }
21745 }
21746
21747 /// Defines additional types related to [DynamicFacetSpec].
21748 pub mod dynamic_facet_spec {
21749 #[allow(unused_imports)]
21750 use super::*;
21751
21752 /// Enum to control DynamicFacet mode
21753 ///
21754 /// # Working with unknown values
21755 ///
21756 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21757 /// additional enum variants at any time. Adding new variants is not considered
21758 /// a breaking change. Applications should write their code in anticipation of:
21759 ///
21760 /// - New values appearing in future releases of the client library, **and**
21761 /// - New values received dynamically, without application changes.
21762 ///
21763 /// Please consult the [Working with enums] section in the user guide for some
21764 /// guidelines.
21765 ///
21766 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21767 #[derive(Clone, Debug, PartialEq)]
21768 #[non_exhaustive]
21769 pub enum Mode {
21770 /// Default value.
21771 Unspecified,
21772 /// Disable Dynamic Facet.
21773 Disabled,
21774 /// Automatic mode built by Google Retail Search.
21775 Enabled,
21776 /// If set, the enum was initialized with an unknown value.
21777 ///
21778 /// Applications can examine the value using [Mode::value] or
21779 /// [Mode::name].
21780 UnknownValue(mode::UnknownValue),
21781 }
21782
21783 #[doc(hidden)]
21784 pub mod mode {
21785 #[allow(unused_imports)]
21786 use super::*;
21787 #[derive(Clone, Debug, PartialEq)]
21788 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21789 }
21790
21791 impl Mode {
21792 /// Gets the enum value.
21793 ///
21794 /// Returns `None` if the enum contains an unknown value deserialized from
21795 /// the string representation of enums.
21796 pub fn value(&self) -> std::option::Option<i32> {
21797 match self {
21798 Self::Unspecified => std::option::Option::Some(0),
21799 Self::Disabled => std::option::Option::Some(1),
21800 Self::Enabled => std::option::Option::Some(2),
21801 Self::UnknownValue(u) => u.0.value(),
21802 }
21803 }
21804
21805 /// Gets the enum value as a string.
21806 ///
21807 /// Returns `None` if the enum contains an unknown value deserialized from
21808 /// the integer representation of enums.
21809 pub fn name(&self) -> std::option::Option<&str> {
21810 match self {
21811 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21812 Self::Disabled => std::option::Option::Some("DISABLED"),
21813 Self::Enabled => std::option::Option::Some("ENABLED"),
21814 Self::UnknownValue(u) => u.0.name(),
21815 }
21816 }
21817 }
21818
21819 impl std::default::Default for Mode {
21820 fn default() -> Self {
21821 use std::convert::From;
21822 Self::from(0)
21823 }
21824 }
21825
21826 impl std::fmt::Display for Mode {
21827 fn fmt(
21828 &self,
21829 f: &mut std::fmt::Formatter<'_>,
21830 ) -> std::result::Result<(), std::fmt::Error> {
21831 wkt::internal::display_enum(f, self.name(), self.value())
21832 }
21833 }
21834
21835 impl std::convert::From<i32> for Mode {
21836 fn from(value: i32) -> Self {
21837 match value {
21838 0 => Self::Unspecified,
21839 1 => Self::Disabled,
21840 2 => Self::Enabled,
21841 _ => Self::UnknownValue(mode::UnknownValue(
21842 wkt::internal::UnknownEnumValue::Integer(value),
21843 )),
21844 }
21845 }
21846 }
21847
21848 impl std::convert::From<&str> for Mode {
21849 fn from(value: &str) -> Self {
21850 use std::string::ToString;
21851 match value {
21852 "MODE_UNSPECIFIED" => Self::Unspecified,
21853 "DISABLED" => Self::Disabled,
21854 "ENABLED" => Self::Enabled,
21855 _ => Self::UnknownValue(mode::UnknownValue(
21856 wkt::internal::UnknownEnumValue::String(value.to_string()),
21857 )),
21858 }
21859 }
21860 }
21861
21862 impl serde::ser::Serialize for Mode {
21863 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21864 where
21865 S: serde::Serializer,
21866 {
21867 match self {
21868 Self::Unspecified => serializer.serialize_i32(0),
21869 Self::Disabled => serializer.serialize_i32(1),
21870 Self::Enabled => serializer.serialize_i32(2),
21871 Self::UnknownValue(u) => u.0.serialize(serializer),
21872 }
21873 }
21874 }
21875
21876 impl<'de> serde::de::Deserialize<'de> for Mode {
21877 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21878 where
21879 D: serde::Deserializer<'de>,
21880 {
21881 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
21882 ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
21883 ))
21884 }
21885 }
21886 }
21887
21888 /// Boost specification to boost certain items.
21889 #[derive(Clone, Default, PartialEq)]
21890 #[non_exhaustive]
21891 pub struct BoostSpec {
21892 /// Condition boost specifications. If a product matches multiple conditions
21893 /// in the specifications, boost scores from these specifications are all
21894 /// applied and combined in a non-linear way. Maximum number of
21895 /// specifications is 20.
21896 pub condition_boost_specs:
21897 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21898
21899 /// Whether to skip boostspec validation. If this field is set to true,
21900 /// invalid
21901 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21902 /// will be ignored and valid
21903 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21904 /// will still be applied.
21905 ///
21906 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
21907 pub skip_boost_spec_validation: std::option::Option<bool>,
21908
21909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21910 }
21911
21912 impl BoostSpec {
21913 /// Creates a new default instance.
21914 pub fn new() -> Self {
21915 std::default::Default::default()
21916 }
21917
21918 /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
21919 ///
21920 /// # Example
21921 /// ```ignore,no_run
21922 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21923 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21924 /// let x = BoostSpec::new()
21925 /// .set_condition_boost_specs([
21926 /// ConditionBoostSpec::default()/* use setters */,
21927 /// ConditionBoostSpec::default()/* use (different) setters */,
21928 /// ]);
21929 /// ```
21930 pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
21931 where
21932 T: std::iter::IntoIterator<Item = V>,
21933 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21934 {
21935 use std::iter::Iterator;
21936 self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
21937 self
21938 }
21939
21940 /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21941 ///
21942 /// # Example
21943 /// ```ignore,no_run
21944 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21945 /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
21946 /// ```
21947 pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
21948 where
21949 T: std::convert::Into<bool>,
21950 {
21951 self.skip_boost_spec_validation = std::option::Option::Some(v.into());
21952 self
21953 }
21954
21955 /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21956 ///
21957 /// # Example
21958 /// ```ignore,no_run
21959 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21960 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
21961 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
21962 /// ```
21963 pub fn set_or_clear_skip_boost_spec_validation<T>(
21964 mut self,
21965 v: std::option::Option<T>,
21966 ) -> Self
21967 where
21968 T: std::convert::Into<bool>,
21969 {
21970 self.skip_boost_spec_validation = v.map(|x| x.into());
21971 self
21972 }
21973 }
21974
21975 impl wkt::message::Message for BoostSpec {
21976 fn typename() -> &'static str {
21977 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
21978 }
21979 }
21980
21981 /// Defines additional types related to [BoostSpec].
21982 pub mod boost_spec {
21983 #[allow(unused_imports)]
21984 use super::*;
21985
21986 /// Boost applies to products which match a condition.
21987 #[derive(Clone, Default, PartialEq)]
21988 #[non_exhaustive]
21989 pub struct ConditionBoostSpec {
21990 /// An expression which specifies a boost condition. The syntax and
21991 /// supported fields are the same as a filter expression. See
21992 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21993 /// detail syntax and limitations.
21994 ///
21995 /// Examples:
21996 ///
21997 /// * To boost products with product ID "product_1" or "product_2", and
21998 /// color
21999 /// "Red" or "Blue":
22000 /// * (id: ANY("product_1", "product_2")) AND (colorFamilies:
22001 /// ANY("Red","Blue"))
22002 ///
22003 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22004 pub condition: std::string::String,
22005
22006 /// Strength of the condition boost, which should be in [-1, 1]. Negative
22007 /// boost means demotion. Default is 0.0.
22008 ///
22009 /// Setting to 1.0 gives the item a big promotion. However, it does not
22010 /// necessarily mean that the boosted item will be the top result at all
22011 /// times, nor that other items will be excluded. Results could still be
22012 /// shown even when none of them matches the condition. And results that
22013 /// are significantly more relevant to the search query can still trump
22014 /// your heavily favored but irrelevant items.
22015 ///
22016 /// Setting to -1.0 gives the item a big demotion. However, results that
22017 /// are deeply relevant might still be shown. The item will have an
22018 /// upstream battle to get a fairly high ranking, but it is not blocked out
22019 /// completely.
22020 ///
22021 /// Setting to 0.0 means no boost applied. The boosting condition is
22022 /// ignored.
22023 pub boost: f32,
22024
22025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22026 }
22027
22028 impl ConditionBoostSpec {
22029 /// Creates a new default instance.
22030 pub fn new() -> Self {
22031 std::default::Default::default()
22032 }
22033
22034 /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
22035 ///
22036 /// # Example
22037 /// ```ignore,no_run
22038 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22039 /// let x = ConditionBoostSpec::new().set_condition("example");
22040 /// ```
22041 pub fn set_condition<T: std::convert::Into<std::string::String>>(
22042 mut self,
22043 v: T,
22044 ) -> Self {
22045 self.condition = v.into();
22046 self
22047 }
22048
22049 /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
22050 ///
22051 /// # Example
22052 /// ```ignore,no_run
22053 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22054 /// let x = ConditionBoostSpec::new().set_boost(42.0);
22055 /// ```
22056 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
22057 self.boost = v.into();
22058 self
22059 }
22060 }
22061
22062 impl wkt::message::Message for ConditionBoostSpec {
22063 fn typename() -> &'static str {
22064 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
22065 }
22066 }
22067 }
22068
22069 /// Specification to determine under which conditions query expansion should
22070 /// occur.
22071 #[derive(Clone, Default, PartialEq)]
22072 #[non_exhaustive]
22073 pub struct QueryExpansionSpec {
22074 /// The condition under which query expansion should occur. Default to
22075 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22076 ///
22077 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22078 pub condition: crate::model::search_request::query_expansion_spec::Condition,
22079
22080 /// Whether to pin unexpanded results. The default value is false. If this
22081 /// field is set to true,
22082 /// unexpanded products are always at the top of the search results, followed
22083 /// by the expanded results.
22084 pub pin_unexpanded_results: bool,
22085
22086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22087 }
22088
22089 impl QueryExpansionSpec {
22090 /// Creates a new default instance.
22091 pub fn new() -> Self {
22092 std::default::Default::default()
22093 }
22094
22095 /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
22096 ///
22097 /// # Example
22098 /// ```ignore,no_run
22099 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22100 /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
22101 /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
22102 /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
22103 /// ```
22104 pub fn set_condition<
22105 T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
22106 >(
22107 mut self,
22108 v: T,
22109 ) -> Self {
22110 self.condition = v.into();
22111 self
22112 }
22113
22114 /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
22115 ///
22116 /// # Example
22117 /// ```ignore,no_run
22118 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22119 /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
22120 /// ```
22121 pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22122 self.pin_unexpanded_results = v.into();
22123 self
22124 }
22125 }
22126
22127 impl wkt::message::Message for QueryExpansionSpec {
22128 fn typename() -> &'static str {
22129 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
22130 }
22131 }
22132
22133 /// Defines additional types related to [QueryExpansionSpec].
22134 pub mod query_expansion_spec {
22135 #[allow(unused_imports)]
22136 use super::*;
22137
22138 /// Enum describing under which condition query expansion should occur.
22139 ///
22140 /// # Working with unknown values
22141 ///
22142 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22143 /// additional enum variants at any time. Adding new variants is not considered
22144 /// a breaking change. Applications should write their code in anticipation of:
22145 ///
22146 /// - New values appearing in future releases of the client library, **and**
22147 /// - New values received dynamically, without application changes.
22148 ///
22149 /// Please consult the [Working with enums] section in the user guide for some
22150 /// guidelines.
22151 ///
22152 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22153 #[derive(Clone, Debug, PartialEq)]
22154 #[non_exhaustive]
22155 pub enum Condition {
22156 /// Unspecified query expansion condition. In this case, server behavior
22157 /// defaults to
22158 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22159 ///
22160 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22161 Unspecified,
22162 /// Disabled query expansion. Only the exact search query is used, even if
22163 /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
22164 /// is zero.
22165 ///
22166 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
22167 Disabled,
22168 /// Automatic query expansion built by Google Retail Search.
22169 Auto,
22170 /// If set, the enum was initialized with an unknown value.
22171 ///
22172 /// Applications can examine the value using [Condition::value] or
22173 /// [Condition::name].
22174 UnknownValue(condition::UnknownValue),
22175 }
22176
22177 #[doc(hidden)]
22178 pub mod condition {
22179 #[allow(unused_imports)]
22180 use super::*;
22181 #[derive(Clone, Debug, PartialEq)]
22182 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22183 }
22184
22185 impl Condition {
22186 /// Gets the enum value.
22187 ///
22188 /// Returns `None` if the enum contains an unknown value deserialized from
22189 /// the string representation of enums.
22190 pub fn value(&self) -> std::option::Option<i32> {
22191 match self {
22192 Self::Unspecified => std::option::Option::Some(0),
22193 Self::Disabled => std::option::Option::Some(1),
22194 Self::Auto => std::option::Option::Some(3),
22195 Self::UnknownValue(u) => u.0.value(),
22196 }
22197 }
22198
22199 /// Gets the enum value as a string.
22200 ///
22201 /// Returns `None` if the enum contains an unknown value deserialized from
22202 /// the integer representation of enums.
22203 pub fn name(&self) -> std::option::Option<&str> {
22204 match self {
22205 Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22206 Self::Disabled => std::option::Option::Some("DISABLED"),
22207 Self::Auto => std::option::Option::Some("AUTO"),
22208 Self::UnknownValue(u) => u.0.name(),
22209 }
22210 }
22211 }
22212
22213 impl std::default::Default for Condition {
22214 fn default() -> Self {
22215 use std::convert::From;
22216 Self::from(0)
22217 }
22218 }
22219
22220 impl std::fmt::Display for Condition {
22221 fn fmt(
22222 &self,
22223 f: &mut std::fmt::Formatter<'_>,
22224 ) -> std::result::Result<(), std::fmt::Error> {
22225 wkt::internal::display_enum(f, self.name(), self.value())
22226 }
22227 }
22228
22229 impl std::convert::From<i32> for Condition {
22230 fn from(value: i32) -> Self {
22231 match value {
22232 0 => Self::Unspecified,
22233 1 => Self::Disabled,
22234 3 => Self::Auto,
22235 _ => Self::UnknownValue(condition::UnknownValue(
22236 wkt::internal::UnknownEnumValue::Integer(value),
22237 )),
22238 }
22239 }
22240 }
22241
22242 impl std::convert::From<&str> for Condition {
22243 fn from(value: &str) -> Self {
22244 use std::string::ToString;
22245 match value {
22246 "CONDITION_UNSPECIFIED" => Self::Unspecified,
22247 "DISABLED" => Self::Disabled,
22248 "AUTO" => Self::Auto,
22249 _ => Self::UnknownValue(condition::UnknownValue(
22250 wkt::internal::UnknownEnumValue::String(value.to_string()),
22251 )),
22252 }
22253 }
22254 }
22255
22256 impl serde::ser::Serialize for Condition {
22257 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22258 where
22259 S: serde::Serializer,
22260 {
22261 match self {
22262 Self::Unspecified => serializer.serialize_i32(0),
22263 Self::Disabled => serializer.serialize_i32(1),
22264 Self::Auto => serializer.serialize_i32(3),
22265 Self::UnknownValue(u) => u.0.serialize(serializer),
22266 }
22267 }
22268 }
22269
22270 impl<'de> serde::de::Deserialize<'de> for Condition {
22271 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22272 where
22273 D: serde::Deserializer<'de>,
22274 {
22275 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22276 ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22277 ))
22278 }
22279 }
22280 }
22281
22282 /// The specification for personalization.
22283 #[derive(Clone, Default, PartialEq)]
22284 #[non_exhaustive]
22285 pub struct PersonalizationSpec {
22286 /// Defaults to
22287 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22288 ///
22289 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22290 pub mode: crate::model::search_request::personalization_spec::Mode,
22291
22292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22293 }
22294
22295 impl PersonalizationSpec {
22296 /// Creates a new default instance.
22297 pub fn new() -> Self {
22298 std::default::Default::default()
22299 }
22300
22301 /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22302 ///
22303 /// # Example
22304 /// ```ignore,no_run
22305 /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22306 /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22307 /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22308 /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22309 /// ```
22310 pub fn set_mode<
22311 T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22312 >(
22313 mut self,
22314 v: T,
22315 ) -> Self {
22316 self.mode = v.into();
22317 self
22318 }
22319 }
22320
22321 impl wkt::message::Message for PersonalizationSpec {
22322 fn typename() -> &'static str {
22323 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22324 }
22325 }
22326
22327 /// Defines additional types related to [PersonalizationSpec].
22328 pub mod personalization_spec {
22329 #[allow(unused_imports)]
22330 use super::*;
22331
22332 /// The personalization mode of each search request.
22333 ///
22334 /// # Working with unknown values
22335 ///
22336 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22337 /// additional enum variants at any time. Adding new variants is not considered
22338 /// a breaking change. Applications should write their code in anticipation of:
22339 ///
22340 /// - New values appearing in future releases of the client library, **and**
22341 /// - New values received dynamically, without application changes.
22342 ///
22343 /// Please consult the [Working with enums] section in the user guide for some
22344 /// guidelines.
22345 ///
22346 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22347 #[derive(Clone, Debug, PartialEq)]
22348 #[non_exhaustive]
22349 pub enum Mode {
22350 /// Default value. In this case, server behavior defaults to
22351 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22352 ///
22353 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22354 Unspecified,
22355 /// Let CRS decide whether to use personalization based on quality of user
22356 /// event data.
22357 Auto,
22358 /// Disable personalization.
22359 Disabled,
22360 /// If set, the enum was initialized with an unknown value.
22361 ///
22362 /// Applications can examine the value using [Mode::value] or
22363 /// [Mode::name].
22364 UnknownValue(mode::UnknownValue),
22365 }
22366
22367 #[doc(hidden)]
22368 pub mod mode {
22369 #[allow(unused_imports)]
22370 use super::*;
22371 #[derive(Clone, Debug, PartialEq)]
22372 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22373 }
22374
22375 impl Mode {
22376 /// Gets the enum value.
22377 ///
22378 /// Returns `None` if the enum contains an unknown value deserialized from
22379 /// the string representation of enums.
22380 pub fn value(&self) -> std::option::Option<i32> {
22381 match self {
22382 Self::Unspecified => std::option::Option::Some(0),
22383 Self::Auto => std::option::Option::Some(1),
22384 Self::Disabled => std::option::Option::Some(2),
22385 Self::UnknownValue(u) => u.0.value(),
22386 }
22387 }
22388
22389 /// Gets the enum value as a string.
22390 ///
22391 /// Returns `None` if the enum contains an unknown value deserialized from
22392 /// the integer representation of enums.
22393 pub fn name(&self) -> std::option::Option<&str> {
22394 match self {
22395 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22396 Self::Auto => std::option::Option::Some("AUTO"),
22397 Self::Disabled => std::option::Option::Some("DISABLED"),
22398 Self::UnknownValue(u) => u.0.name(),
22399 }
22400 }
22401 }
22402
22403 impl std::default::Default for Mode {
22404 fn default() -> Self {
22405 use std::convert::From;
22406 Self::from(0)
22407 }
22408 }
22409
22410 impl std::fmt::Display for Mode {
22411 fn fmt(
22412 &self,
22413 f: &mut std::fmt::Formatter<'_>,
22414 ) -> std::result::Result<(), std::fmt::Error> {
22415 wkt::internal::display_enum(f, self.name(), self.value())
22416 }
22417 }
22418
22419 impl std::convert::From<i32> for Mode {
22420 fn from(value: i32) -> Self {
22421 match value {
22422 0 => Self::Unspecified,
22423 1 => Self::Auto,
22424 2 => Self::Disabled,
22425 _ => Self::UnknownValue(mode::UnknownValue(
22426 wkt::internal::UnknownEnumValue::Integer(value),
22427 )),
22428 }
22429 }
22430 }
22431
22432 impl std::convert::From<&str> for Mode {
22433 fn from(value: &str) -> Self {
22434 use std::string::ToString;
22435 match value {
22436 "MODE_UNSPECIFIED" => Self::Unspecified,
22437 "AUTO" => Self::Auto,
22438 "DISABLED" => Self::Disabled,
22439 _ => Self::UnknownValue(mode::UnknownValue(
22440 wkt::internal::UnknownEnumValue::String(value.to_string()),
22441 )),
22442 }
22443 }
22444 }
22445
22446 impl serde::ser::Serialize for Mode {
22447 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22448 where
22449 S: serde::Serializer,
22450 {
22451 match self {
22452 Self::Unspecified => serializer.serialize_i32(0),
22453 Self::Auto => serializer.serialize_i32(1),
22454 Self::Disabled => serializer.serialize_i32(2),
22455 Self::UnknownValue(u) => u.0.serialize(serializer),
22456 }
22457 }
22458 }
22459
22460 impl<'de> serde::de::Deserialize<'de> for Mode {
22461 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22462 where
22463 D: serde::Deserializer<'de>,
22464 {
22465 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22466 ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22467 ))
22468 }
22469 }
22470 }
22471
22472 /// The specification for query spell correction.
22473 #[derive(Clone, Default, PartialEq)]
22474 #[non_exhaustive]
22475 pub struct SpellCorrectionSpec {
22476 /// The mode under which spell correction should take effect to
22477 /// replace the original search query. Default to
22478 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22479 ///
22480 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22481 pub mode: crate::model::search_request::spell_correction_spec::Mode,
22482
22483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22484 }
22485
22486 impl SpellCorrectionSpec {
22487 /// Creates a new default instance.
22488 pub fn new() -> Self {
22489 std::default::Default::default()
22490 }
22491
22492 /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22493 ///
22494 /// # Example
22495 /// ```ignore,no_run
22496 /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22497 /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22498 /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22499 /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22500 /// ```
22501 pub fn set_mode<
22502 T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22503 >(
22504 mut self,
22505 v: T,
22506 ) -> Self {
22507 self.mode = v.into();
22508 self
22509 }
22510 }
22511
22512 impl wkt::message::Message for SpellCorrectionSpec {
22513 fn typename() -> &'static str {
22514 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22515 }
22516 }
22517
22518 /// Defines additional types related to [SpellCorrectionSpec].
22519 pub mod spell_correction_spec {
22520 #[allow(unused_imports)]
22521 use super::*;
22522
22523 /// Enum describing under which mode spell correction should occur.
22524 ///
22525 /// # Working with unknown values
22526 ///
22527 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22528 /// additional enum variants at any time. Adding new variants is not considered
22529 /// a breaking change. Applications should write their code in anticipation of:
22530 ///
22531 /// - New values appearing in future releases of the client library, **and**
22532 /// - New values received dynamically, without application changes.
22533 ///
22534 /// Please consult the [Working with enums] section in the user guide for some
22535 /// guidelines.
22536 ///
22537 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22538 #[derive(Clone, Debug, PartialEq)]
22539 #[non_exhaustive]
22540 pub enum Mode {
22541 /// Unspecified spell correction mode. In this case, server behavior
22542 /// defaults to
22543 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22544 ///
22545 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22546 Unspecified,
22547 /// Google Retail Search will try to find a spell suggestion if there
22548 /// is any and put in the
22549 /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22550 /// The spell suggestion will not be used as the search query.
22551 ///
22552 /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22553 SuggestionOnly,
22554 /// Automatic spell correction built by Google Retail Search. Search will
22555 /// be based on the corrected query if found.
22556 Auto,
22557 /// If set, the enum was initialized with an unknown value.
22558 ///
22559 /// Applications can examine the value using [Mode::value] or
22560 /// [Mode::name].
22561 UnknownValue(mode::UnknownValue),
22562 }
22563
22564 #[doc(hidden)]
22565 pub mod mode {
22566 #[allow(unused_imports)]
22567 use super::*;
22568 #[derive(Clone, Debug, PartialEq)]
22569 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22570 }
22571
22572 impl Mode {
22573 /// Gets the enum value.
22574 ///
22575 /// Returns `None` if the enum contains an unknown value deserialized from
22576 /// the string representation of enums.
22577 pub fn value(&self) -> std::option::Option<i32> {
22578 match self {
22579 Self::Unspecified => std::option::Option::Some(0),
22580 Self::SuggestionOnly => std::option::Option::Some(1),
22581 Self::Auto => std::option::Option::Some(2),
22582 Self::UnknownValue(u) => u.0.value(),
22583 }
22584 }
22585
22586 /// Gets the enum value as a string.
22587 ///
22588 /// Returns `None` if the enum contains an unknown value deserialized from
22589 /// the integer representation of enums.
22590 pub fn name(&self) -> std::option::Option<&str> {
22591 match self {
22592 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22593 Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22594 Self::Auto => std::option::Option::Some("AUTO"),
22595 Self::UnknownValue(u) => u.0.name(),
22596 }
22597 }
22598 }
22599
22600 impl std::default::Default for Mode {
22601 fn default() -> Self {
22602 use std::convert::From;
22603 Self::from(0)
22604 }
22605 }
22606
22607 impl std::fmt::Display for Mode {
22608 fn fmt(
22609 &self,
22610 f: &mut std::fmt::Formatter<'_>,
22611 ) -> std::result::Result<(), std::fmt::Error> {
22612 wkt::internal::display_enum(f, self.name(), self.value())
22613 }
22614 }
22615
22616 impl std::convert::From<i32> for Mode {
22617 fn from(value: i32) -> Self {
22618 match value {
22619 0 => Self::Unspecified,
22620 1 => Self::SuggestionOnly,
22621 2 => Self::Auto,
22622 _ => Self::UnknownValue(mode::UnknownValue(
22623 wkt::internal::UnknownEnumValue::Integer(value),
22624 )),
22625 }
22626 }
22627 }
22628
22629 impl std::convert::From<&str> for Mode {
22630 fn from(value: &str) -> Self {
22631 use std::string::ToString;
22632 match value {
22633 "MODE_UNSPECIFIED" => Self::Unspecified,
22634 "SUGGESTION_ONLY" => Self::SuggestionOnly,
22635 "AUTO" => Self::Auto,
22636 _ => Self::UnknownValue(mode::UnknownValue(
22637 wkt::internal::UnknownEnumValue::String(value.to_string()),
22638 )),
22639 }
22640 }
22641 }
22642
22643 impl serde::ser::Serialize for Mode {
22644 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22645 where
22646 S: serde::Serializer,
22647 {
22648 match self {
22649 Self::Unspecified => serializer.serialize_i32(0),
22650 Self::SuggestionOnly => serializer.serialize_i32(1),
22651 Self::Auto => serializer.serialize_i32(2),
22652 Self::UnknownValue(u) => u.0.serialize(serializer),
22653 }
22654 }
22655 }
22656
22657 impl<'de> serde::de::Deserialize<'de> for Mode {
22658 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22659 where
22660 D: serde::Deserializer<'de>,
22661 {
22662 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22663 ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22664 ))
22665 }
22666 }
22667 }
22668
22669 /// This field specifies all conversational related parameters addition to
22670 /// traditional retail search.
22671 #[derive(Clone, Default, PartialEq)]
22672 #[non_exhaustive]
22673 pub struct ConversationalSearchSpec {
22674 /// This field specifies whether the customer would like to do conversational
22675 /// search. If this field is set to true, conversational related extra
22676 /// information will be returned from server side, including follow-up
22677 /// question, answer options, etc.
22678 pub followup_conversation_requested: bool,
22679
22680 /// This field specifies the conversation id, which maintains the state of
22681 /// the conversation between client side and server side. Use the value from
22682 /// the previous [ConversationalSearchResult.conversation_id][]. For the
22683 /// initial request, this should be empty.
22684 pub conversation_id: std::string::String,
22685
22686 /// This field specifies the current user answer during the conversational
22687 /// search. This can be either user selected from suggested answers or user
22688 /// input plain text.
22689 pub user_answer: std::option::Option<
22690 crate::model::search_request::conversational_search_spec::UserAnswer,
22691 >,
22692
22693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22694 }
22695
22696 impl ConversationalSearchSpec {
22697 /// Creates a new default instance.
22698 pub fn new() -> Self {
22699 std::default::Default::default()
22700 }
22701
22702 /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22703 ///
22704 /// # Example
22705 /// ```ignore,no_run
22706 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22707 /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22708 /// ```
22709 pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22710 mut self,
22711 v: T,
22712 ) -> Self {
22713 self.followup_conversation_requested = v.into();
22714 self
22715 }
22716
22717 /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22718 ///
22719 /// # Example
22720 /// ```ignore,no_run
22721 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22722 /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22723 /// ```
22724 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22725 mut self,
22726 v: T,
22727 ) -> Self {
22728 self.conversation_id = v.into();
22729 self
22730 }
22731
22732 /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22733 ///
22734 /// # Example
22735 /// ```ignore,no_run
22736 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22737 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22738 /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22739 /// ```
22740 pub fn set_user_answer<T>(mut self, v: T) -> Self
22741 where
22742 T: std::convert::Into<
22743 crate::model::search_request::conversational_search_spec::UserAnswer,
22744 >,
22745 {
22746 self.user_answer = std::option::Option::Some(v.into());
22747 self
22748 }
22749
22750 /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22751 ///
22752 /// # Example
22753 /// ```ignore,no_run
22754 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22755 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22756 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22757 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22758 /// ```
22759 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22760 where
22761 T: std::convert::Into<
22762 crate::model::search_request::conversational_search_spec::UserAnswer,
22763 >,
22764 {
22765 self.user_answer = v.map(|x| x.into());
22766 self
22767 }
22768 }
22769
22770 impl wkt::message::Message for ConversationalSearchSpec {
22771 fn typename() -> &'static str {
22772 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22773 }
22774 }
22775
22776 /// Defines additional types related to [ConversationalSearchSpec].
22777 pub mod conversational_search_spec {
22778 #[allow(unused_imports)]
22779 use super::*;
22780
22781 /// This field specifies the current user answer during the conversational
22782 /// search. This can be either user selected from suggested answers or user
22783 /// input plain text.
22784 #[derive(Clone, Default, PartialEq)]
22785 #[non_exhaustive]
22786 pub struct UserAnswer {
22787 /// This field specifies the type of user answer.
22788 pub r#type: std::option::Option<
22789 crate::model::search_request::conversational_search_spec::user_answer::Type,
22790 >,
22791
22792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22793 }
22794
22795 impl UserAnswer {
22796 /// Creates a new default instance.
22797 pub fn new() -> Self {
22798 std::default::Default::default()
22799 }
22800
22801 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22802 ///
22803 /// Note that all the setters affecting `r#type` are mutually
22804 /// exclusive.
22805 ///
22806 /// # Example
22807 /// ```ignore,no_run
22808 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22809 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22810 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22811 /// ```
22812 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
22813 {
22814 self.r#type = v.into();
22815 self
22816 }
22817
22818 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22819 /// if it holds a `TextAnswer`, `None` if the field is not set or
22820 /// holds a different branch.
22821 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22822 #[allow(unreachable_patterns)]
22823 self.r#type.as_ref().and_then(|v| match v {
22824 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22825 _ => std::option::Option::None,
22826 })
22827 }
22828
22829 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22830 /// to hold a `TextAnswer`.
22831 ///
22832 /// Note that all the setters affecting `r#type` are
22833 /// mutually exclusive.
22834 ///
22835 /// # Example
22836 /// ```ignore,no_run
22837 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22838 /// let x = UserAnswer::new().set_text_answer("example");
22839 /// assert!(x.text_answer().is_some());
22840 /// assert!(x.selected_answer().is_none());
22841 /// ```
22842 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22843 mut self,
22844 v: T,
22845 ) -> Self {
22846 self.r#type = std::option::Option::Some(
22847 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22848 v.into()
22849 )
22850 );
22851 self
22852 }
22853
22854 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22855 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22856 /// holds a different branch.
22857 pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22858 #[allow(unreachable_patterns)]
22859 self.r#type.as_ref().and_then(|v| match v {
22860 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22861 _ => std::option::Option::None,
22862 })
22863 }
22864
22865 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22866 /// to hold a `SelectedAnswer`.
22867 ///
22868 /// Note that all the setters affecting `r#type` are
22869 /// mutually exclusive.
22870 ///
22871 /// # Example
22872 /// ```ignore,no_run
22873 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22874 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22875 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
22876 /// assert!(x.selected_answer().is_some());
22877 /// assert!(x.text_answer().is_none());
22878 /// ```
22879 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{
22880 self.r#type = std::option::Option::Some(
22881 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
22882 v.into()
22883 )
22884 );
22885 self
22886 }
22887 }
22888
22889 impl wkt::message::Message for UserAnswer {
22890 fn typename() -> &'static str {
22891 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
22892 }
22893 }
22894
22895 /// Defines additional types related to [UserAnswer].
22896 pub mod user_answer {
22897 #[allow(unused_imports)]
22898 use super::*;
22899
22900 /// This field specifies the selected answers during the conversational
22901 /// search.
22902 #[derive(Clone, Default, PartialEq)]
22903 #[non_exhaustive]
22904 pub struct SelectedAnswer {
22905 /// This field is deprecated and should not be set.
22906 #[deprecated]
22907 pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
22908
22909 /// This field specifies the selected answer which is a attribute
22910 /// key-value.
22911 pub product_attribute_value:
22912 std::option::Option<crate::model::ProductAttributeValue>,
22913
22914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22915 }
22916
22917 impl SelectedAnswer {
22918 /// Creates a new default instance.
22919 pub fn new() -> Self {
22920 std::default::Default::default()
22921 }
22922
22923 /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
22924 ///
22925 /// # Example
22926 /// ```ignore,no_run
22927 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22928 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22929 /// let x = SelectedAnswer::new()
22930 /// .set_product_attribute_values([
22931 /// ProductAttributeValue::default()/* use setters */,
22932 /// ProductAttributeValue::default()/* use (different) setters */,
22933 /// ]);
22934 /// ```
22935 #[deprecated]
22936 pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
22937 where
22938 T: std::iter::IntoIterator<Item = V>,
22939 V: std::convert::Into<crate::model::ProductAttributeValue>,
22940 {
22941 use std::iter::Iterator;
22942 self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
22943 self
22944 }
22945
22946 /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22947 ///
22948 /// # Example
22949 /// ```ignore,no_run
22950 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22951 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22952 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
22953 /// ```
22954 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
22955 where
22956 T: std::convert::Into<crate::model::ProductAttributeValue>,
22957 {
22958 self.product_attribute_value = std::option::Option::Some(v.into());
22959 self
22960 }
22961
22962 /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22963 ///
22964 /// # Example
22965 /// ```ignore,no_run
22966 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22967 /// use google_cloud_retail_v2::model::ProductAttributeValue;
22968 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
22969 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
22970 /// ```
22971 pub fn set_or_clear_product_attribute_value<T>(
22972 mut self,
22973 v: std::option::Option<T>,
22974 ) -> Self
22975 where
22976 T: std::convert::Into<crate::model::ProductAttributeValue>,
22977 {
22978 self.product_attribute_value = v.map(|x| x.into());
22979 self
22980 }
22981 }
22982
22983 impl wkt::message::Message for SelectedAnswer {
22984 fn typename() -> &'static str {
22985 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
22986 }
22987 }
22988
22989 /// This field specifies the type of user answer.
22990 #[derive(Clone, Debug, PartialEq)]
22991 #[non_exhaustive]
22992 pub enum Type {
22993 /// This field specifies the incremental input text from the user during
22994 /// the conversational search.
22995 TextAnswer(std::string::String),
22996 /// This field specifies the selected attributes during the
22997 /// conversational search. This should be a subset of
22998 /// [ConversationalSearchResult.suggested_answers][].
22999 SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
23000 }
23001 }
23002 }
23003
23004 /// This field specifies tile navigation related parameters.
23005 #[derive(Clone, Default, PartialEq)]
23006 #[non_exhaustive]
23007 pub struct TileNavigationSpec {
23008 /// This field specifies whether the customer would like to request tile
23009 /// navigation.
23010 pub tile_navigation_requested: bool,
23011
23012 /// This optional field specifies the tiles which are already clicked in
23013 /// client side. While the feature works without this field set, particularly
23014 /// for an initial query, it is highly recommended to set this field because
23015 /// it can improve the quality of the search response and removes possible
23016 /// duplicate tiles.
23017 ///
23018 /// NOTE: This field is not being used for filtering search
23019 /// products. Client side should also put all the applied tiles in
23020 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
23021 ///
23022 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
23023 pub applied_tiles: std::vec::Vec<crate::model::Tile>,
23024
23025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23026 }
23027
23028 impl TileNavigationSpec {
23029 /// Creates a new default instance.
23030 pub fn new() -> Self {
23031 std::default::Default::default()
23032 }
23033
23034 /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
23035 ///
23036 /// # Example
23037 /// ```ignore,no_run
23038 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23039 /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
23040 /// ```
23041 pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23042 self.tile_navigation_requested = v.into();
23043 self
23044 }
23045
23046 /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
23047 ///
23048 /// # Example
23049 /// ```ignore,no_run
23050 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23051 /// use google_cloud_retail_v2::model::Tile;
23052 /// let x = TileNavigationSpec::new()
23053 /// .set_applied_tiles([
23054 /// Tile::default()/* use setters */,
23055 /// Tile::default()/* use (different) setters */,
23056 /// ]);
23057 /// ```
23058 pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
23059 where
23060 T: std::iter::IntoIterator<Item = V>,
23061 V: std::convert::Into<crate::model::Tile>,
23062 {
23063 use std::iter::Iterator;
23064 self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
23065 self
23066 }
23067 }
23068
23069 impl wkt::message::Message for TileNavigationSpec {
23070 fn typename() -> &'static str {
23071 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
23072 }
23073 }
23074
23075 /// The search mode of each search request.
23076 ///
23077 /// # Working with unknown values
23078 ///
23079 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23080 /// additional enum variants at any time. Adding new variants is not considered
23081 /// a breaking change. Applications should write their code in anticipation of:
23082 ///
23083 /// - New values appearing in future releases of the client library, **and**
23084 /// - New values received dynamically, without application changes.
23085 ///
23086 /// Please consult the [Working with enums] section in the user guide for some
23087 /// guidelines.
23088 ///
23089 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
23090 #[derive(Clone, Debug, PartialEq)]
23091 #[non_exhaustive]
23092 pub enum SearchMode {
23093 /// Default value. In this case both product search and faceted search will
23094 /// be performed. Both
23095 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23096 /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
23097 /// will be returned.
23098 ///
23099 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23100 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23101 Unspecified,
23102 /// Only product search will be performed. The faceted search will be
23103 /// disabled.
23104 ///
23105 /// Only
23106 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23107 /// will be returned.
23108 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23109 /// not be returned, even if
23110 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23111 /// or
23112 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23113 /// is set.
23114 ///
23115 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23116 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23117 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23118 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23119 ProductSearchOnly,
23120 /// Only faceted search will be performed. The product search will be
23121 /// disabled.
23122 ///
23123 /// When in this mode, one or both of
23124 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23125 /// and
23126 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23127 /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
23128 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23129 /// be returned.
23130 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23131 /// will not be returned.
23132 ///
23133 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23134 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23135 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23136 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23137 FacetedSearchOnly,
23138 /// If set, the enum was initialized with an unknown value.
23139 ///
23140 /// Applications can examine the value using [SearchMode::value] or
23141 /// [SearchMode::name].
23142 UnknownValue(search_mode::UnknownValue),
23143 }
23144
23145 #[doc(hidden)]
23146 pub mod search_mode {
23147 #[allow(unused_imports)]
23148 use super::*;
23149 #[derive(Clone, Debug, PartialEq)]
23150 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23151 }
23152
23153 impl SearchMode {
23154 /// Gets the enum value.
23155 ///
23156 /// Returns `None` if the enum contains an unknown value deserialized from
23157 /// the string representation of enums.
23158 pub fn value(&self) -> std::option::Option<i32> {
23159 match self {
23160 Self::Unspecified => std::option::Option::Some(0),
23161 Self::ProductSearchOnly => std::option::Option::Some(1),
23162 Self::FacetedSearchOnly => std::option::Option::Some(2),
23163 Self::UnknownValue(u) => u.0.value(),
23164 }
23165 }
23166
23167 /// Gets the enum value as a string.
23168 ///
23169 /// Returns `None` if the enum contains an unknown value deserialized from
23170 /// the integer representation of enums.
23171 pub fn name(&self) -> std::option::Option<&str> {
23172 match self {
23173 Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
23174 Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
23175 Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
23176 Self::UnknownValue(u) => u.0.name(),
23177 }
23178 }
23179 }
23180
23181 impl std::default::Default for SearchMode {
23182 fn default() -> Self {
23183 use std::convert::From;
23184 Self::from(0)
23185 }
23186 }
23187
23188 impl std::fmt::Display for SearchMode {
23189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23190 wkt::internal::display_enum(f, self.name(), self.value())
23191 }
23192 }
23193
23194 impl std::convert::From<i32> for SearchMode {
23195 fn from(value: i32) -> Self {
23196 match value {
23197 0 => Self::Unspecified,
23198 1 => Self::ProductSearchOnly,
23199 2 => Self::FacetedSearchOnly,
23200 _ => Self::UnknownValue(search_mode::UnknownValue(
23201 wkt::internal::UnknownEnumValue::Integer(value),
23202 )),
23203 }
23204 }
23205 }
23206
23207 impl std::convert::From<&str> for SearchMode {
23208 fn from(value: &str) -> Self {
23209 use std::string::ToString;
23210 match value {
23211 "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23212 "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23213 "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23214 _ => Self::UnknownValue(search_mode::UnknownValue(
23215 wkt::internal::UnknownEnumValue::String(value.to_string()),
23216 )),
23217 }
23218 }
23219 }
23220
23221 impl serde::ser::Serialize for SearchMode {
23222 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23223 where
23224 S: serde::Serializer,
23225 {
23226 match self {
23227 Self::Unspecified => serializer.serialize_i32(0),
23228 Self::ProductSearchOnly => serializer.serialize_i32(1),
23229 Self::FacetedSearchOnly => serializer.serialize_i32(2),
23230 Self::UnknownValue(u) => u.0.serialize(serializer),
23231 }
23232 }
23233 }
23234
23235 impl<'de> serde::de::Deserialize<'de> for SearchMode {
23236 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23237 where
23238 D: serde::Deserializer<'de>,
23239 {
23240 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23241 ".google.cloud.retail.v2.SearchRequest.SearchMode",
23242 ))
23243 }
23244 }
23245}
23246
23247/// Response message for
23248/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23249///
23250/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23251#[derive(Clone, Default, PartialEq)]
23252#[non_exhaustive]
23253pub struct SearchResponse {
23254 /// A list of matched items. The order represents the ranking.
23255 pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23256
23257 /// Results of facets requested by user.
23258 pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23259
23260 /// The estimated total count of matched items irrespective of pagination. The
23261 /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23262 /// by pagination may be less than the
23263 /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23264 /// matches.
23265 ///
23266 /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23267 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23268 pub total_size: i32,
23269
23270 /// Contains the spell corrected query, if found. If the spell correction type
23271 /// is AUTOMATIC, then the search results are based on corrected_query.
23272 /// Otherwise the original query is used for search.
23273 pub corrected_query: std::string::String,
23274
23275 /// A unique search token. This should be included in the
23276 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23277 /// search, which enables accurate attribution of search model performance.
23278 ///
23279 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23280 pub attribution_token: std::string::String,
23281
23282 /// A token that can be sent as
23283 /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23284 /// to retrieve the next page. If this field is omitted, there are no
23285 /// subsequent pages.
23286 ///
23287 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23288 pub next_page_token: std::string::String,
23289
23290 /// Query expansion information for the returned results.
23291 pub query_expansion_info:
23292 std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23293
23294 /// The URI of a customer-defined redirect page. If redirect action is
23295 /// triggered, no search is performed, and only
23296 /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23297 /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23298 /// are set in the response.
23299 ///
23300 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23301 /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23302 pub redirect_uri: std::string::String,
23303
23304 /// The fully qualified resource name of applied
23305 /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23306 pub applied_controls: std::vec::Vec<std::string::String>,
23307
23308 /// Metadata for pin controls which were applicable to the request.
23309 /// This contains two map fields, one for all matched pins and one for pins
23310 /// which were matched but not applied.
23311 ///
23312 /// The two maps are keyed by pin position, and the values are the product ids
23313 /// which were matched to that pin.
23314 pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23315
23316 /// The invalid
23317 /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23318 /// that are not applied during serving.
23319 ///
23320 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23321 pub invalid_condition_boost_specs:
23322 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23323
23324 /// Metadata related to A/B testing experiment associated with this
23325 /// response. Only exists when an experiment is triggered.
23326 pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23327
23328 /// This field specifies all related information that is needed on client
23329 /// side for UI rendering of conversational retail search.
23330 pub conversational_search_result:
23331 std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23332
23333 /// This field specifies all related information for tile navigation that will
23334 /// be used in client side.
23335 pub tile_navigation_result:
23336 std::option::Option<crate::model::search_response::TileNavigationResult>,
23337
23338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23339}
23340
23341impl SearchResponse {
23342 /// Creates a new default instance.
23343 pub fn new() -> Self {
23344 std::default::Default::default()
23345 }
23346
23347 /// Sets the value of [results][crate::model::SearchResponse::results].
23348 ///
23349 /// # Example
23350 /// ```ignore,no_run
23351 /// # use google_cloud_retail_v2::model::SearchResponse;
23352 /// use google_cloud_retail_v2::model::search_response::SearchResult;
23353 /// let x = SearchResponse::new()
23354 /// .set_results([
23355 /// SearchResult::default()/* use setters */,
23356 /// SearchResult::default()/* use (different) setters */,
23357 /// ]);
23358 /// ```
23359 pub fn set_results<T, V>(mut self, v: T) -> Self
23360 where
23361 T: std::iter::IntoIterator<Item = V>,
23362 V: std::convert::Into<crate::model::search_response::SearchResult>,
23363 {
23364 use std::iter::Iterator;
23365 self.results = v.into_iter().map(|i| i.into()).collect();
23366 self
23367 }
23368
23369 /// Sets the value of [facets][crate::model::SearchResponse::facets].
23370 ///
23371 /// # Example
23372 /// ```ignore,no_run
23373 /// # use google_cloud_retail_v2::model::SearchResponse;
23374 /// use google_cloud_retail_v2::model::search_response::Facet;
23375 /// let x = SearchResponse::new()
23376 /// .set_facets([
23377 /// Facet::default()/* use setters */,
23378 /// Facet::default()/* use (different) setters */,
23379 /// ]);
23380 /// ```
23381 pub fn set_facets<T, V>(mut self, v: T) -> Self
23382 where
23383 T: std::iter::IntoIterator<Item = V>,
23384 V: std::convert::Into<crate::model::search_response::Facet>,
23385 {
23386 use std::iter::Iterator;
23387 self.facets = v.into_iter().map(|i| i.into()).collect();
23388 self
23389 }
23390
23391 /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23392 ///
23393 /// # Example
23394 /// ```ignore,no_run
23395 /// # use google_cloud_retail_v2::model::SearchResponse;
23396 /// let x = SearchResponse::new().set_total_size(42);
23397 /// ```
23398 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23399 self.total_size = v.into();
23400 self
23401 }
23402
23403 /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23404 ///
23405 /// # Example
23406 /// ```ignore,no_run
23407 /// # use google_cloud_retail_v2::model::SearchResponse;
23408 /// let x = SearchResponse::new().set_corrected_query("example");
23409 /// ```
23410 pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23411 self.corrected_query = v.into();
23412 self
23413 }
23414
23415 /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23416 ///
23417 /// # Example
23418 /// ```ignore,no_run
23419 /// # use google_cloud_retail_v2::model::SearchResponse;
23420 /// let x = SearchResponse::new().set_attribution_token("example");
23421 /// ```
23422 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23423 mut self,
23424 v: T,
23425 ) -> Self {
23426 self.attribution_token = v.into();
23427 self
23428 }
23429
23430 /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23431 ///
23432 /// # Example
23433 /// ```ignore,no_run
23434 /// # use google_cloud_retail_v2::model::SearchResponse;
23435 /// let x = SearchResponse::new().set_next_page_token("example");
23436 /// ```
23437 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23438 self.next_page_token = v.into();
23439 self
23440 }
23441
23442 /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23443 ///
23444 /// # Example
23445 /// ```ignore,no_run
23446 /// # use google_cloud_retail_v2::model::SearchResponse;
23447 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23448 /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23449 /// ```
23450 pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23451 where
23452 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23453 {
23454 self.query_expansion_info = std::option::Option::Some(v.into());
23455 self
23456 }
23457
23458 /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23459 ///
23460 /// # Example
23461 /// ```ignore,no_run
23462 /// # use google_cloud_retail_v2::model::SearchResponse;
23463 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23464 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23465 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23466 /// ```
23467 pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23468 where
23469 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23470 {
23471 self.query_expansion_info = v.map(|x| x.into());
23472 self
23473 }
23474
23475 /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23476 ///
23477 /// # Example
23478 /// ```ignore,no_run
23479 /// # use google_cloud_retail_v2::model::SearchResponse;
23480 /// let x = SearchResponse::new().set_redirect_uri("example");
23481 /// ```
23482 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23483 self.redirect_uri = v.into();
23484 self
23485 }
23486
23487 /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23488 ///
23489 /// # Example
23490 /// ```ignore,no_run
23491 /// # use google_cloud_retail_v2::model::SearchResponse;
23492 /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23493 /// ```
23494 pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23495 where
23496 T: std::iter::IntoIterator<Item = V>,
23497 V: std::convert::Into<std::string::String>,
23498 {
23499 use std::iter::Iterator;
23500 self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23501 self
23502 }
23503
23504 /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23505 ///
23506 /// # Example
23507 /// ```ignore,no_run
23508 /// # use google_cloud_retail_v2::model::SearchResponse;
23509 /// use google_cloud_retail_v2::model::PinControlMetadata;
23510 /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23511 /// ```
23512 pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23513 where
23514 T: std::convert::Into<crate::model::PinControlMetadata>,
23515 {
23516 self.pin_control_metadata = std::option::Option::Some(v.into());
23517 self
23518 }
23519
23520 /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23521 ///
23522 /// # Example
23523 /// ```ignore,no_run
23524 /// # use google_cloud_retail_v2::model::SearchResponse;
23525 /// use google_cloud_retail_v2::model::PinControlMetadata;
23526 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23527 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23528 /// ```
23529 pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23530 where
23531 T: std::convert::Into<crate::model::PinControlMetadata>,
23532 {
23533 self.pin_control_metadata = v.map(|x| x.into());
23534 self
23535 }
23536
23537 /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23538 ///
23539 /// # Example
23540 /// ```ignore,no_run
23541 /// # use google_cloud_retail_v2::model::SearchResponse;
23542 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23543 /// let x = SearchResponse::new()
23544 /// .set_invalid_condition_boost_specs([
23545 /// ConditionBoostSpec::default()/* use setters */,
23546 /// ConditionBoostSpec::default()/* use (different) setters */,
23547 /// ]);
23548 /// ```
23549 pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23550 where
23551 T: std::iter::IntoIterator<Item = V>,
23552 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23553 {
23554 use std::iter::Iterator;
23555 self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23556 self
23557 }
23558
23559 /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23560 ///
23561 /// # Example
23562 /// ```ignore,no_run
23563 /// # use google_cloud_retail_v2::model::SearchResponse;
23564 /// use google_cloud_retail_v2::model::ExperimentInfo;
23565 /// let x = SearchResponse::new()
23566 /// .set_experiment_info([
23567 /// ExperimentInfo::default()/* use setters */,
23568 /// ExperimentInfo::default()/* use (different) setters */,
23569 /// ]);
23570 /// ```
23571 pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23572 where
23573 T: std::iter::IntoIterator<Item = V>,
23574 V: std::convert::Into<crate::model::ExperimentInfo>,
23575 {
23576 use std::iter::Iterator;
23577 self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23578 self
23579 }
23580
23581 /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23582 ///
23583 /// # Example
23584 /// ```ignore,no_run
23585 /// # use google_cloud_retail_v2::model::SearchResponse;
23586 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23587 /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23588 /// ```
23589 pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23590 where
23591 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23592 {
23593 self.conversational_search_result = std::option::Option::Some(v.into());
23594 self
23595 }
23596
23597 /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23598 ///
23599 /// # Example
23600 /// ```ignore,no_run
23601 /// # use google_cloud_retail_v2::model::SearchResponse;
23602 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23603 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23604 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23605 /// ```
23606 pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23607 where
23608 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23609 {
23610 self.conversational_search_result = v.map(|x| x.into());
23611 self
23612 }
23613
23614 /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23615 ///
23616 /// # Example
23617 /// ```ignore,no_run
23618 /// # use google_cloud_retail_v2::model::SearchResponse;
23619 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23620 /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23621 /// ```
23622 pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23623 where
23624 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23625 {
23626 self.tile_navigation_result = std::option::Option::Some(v.into());
23627 self
23628 }
23629
23630 /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23631 ///
23632 /// # Example
23633 /// ```ignore,no_run
23634 /// # use google_cloud_retail_v2::model::SearchResponse;
23635 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23636 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23637 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23638 /// ```
23639 pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23640 where
23641 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23642 {
23643 self.tile_navigation_result = v.map(|x| x.into());
23644 self
23645 }
23646}
23647
23648impl wkt::message::Message for SearchResponse {
23649 fn typename() -> &'static str {
23650 "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23651 }
23652}
23653
23654#[doc(hidden)]
23655impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
23656 type PageItem = crate::model::search_response::SearchResult;
23657
23658 fn items(self) -> std::vec::Vec<Self::PageItem> {
23659 self.results
23660 }
23661
23662 fn next_page_token(&self) -> std::string::String {
23663 use std::clone::Clone;
23664 self.next_page_token.clone()
23665 }
23666}
23667
23668/// Defines additional types related to [SearchResponse].
23669pub mod search_response {
23670 #[allow(unused_imports)]
23671 use super::*;
23672
23673 /// Represents the search results.
23674 #[derive(Clone, Default, PartialEq)]
23675 #[non_exhaustive]
23676 pub struct SearchResult {
23677 /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23678 /// [Product][google.cloud.retail.v2.Product].
23679 ///
23680 /// [google.cloud.retail.v2.Product]: crate::model::Product
23681 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23682 pub id: std::string::String,
23683
23684 /// The product data snippet in the search response. Only
23685 /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23686 /// populated.
23687 ///
23688 /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23689 /// product variants that match the search query. If there are multiple
23690 /// product variants matching the query, top 5 most relevant product variants
23691 /// are returned and ordered by relevancy.
23692 ///
23693 /// If relevancy can be deternmined, use
23694 /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23695 /// to look up matched product variants fields. If relevancy cannot be
23696 /// determined, e.g. when searching "shoe" all products in a shoe product can
23697 /// be a match, 5 product variants are returned but order is meaningless.
23698 ///
23699 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23700 /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23701 /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23702 pub product: std::option::Option<crate::model::Product>,
23703
23704 /// The count of matched
23705 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23706 /// [Product][google.cloud.retail.v2.Product]s.
23707 ///
23708 /// [google.cloud.retail.v2.Product]: crate::model::Product
23709 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23710 pub matching_variant_count: i32,
23711
23712 /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23713 /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23714 /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23715 /// matched. The key is the
23716 /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23717 /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23718 /// matched attributes cannot be determined, this map will be empty.
23719 ///
23720 /// For example, a key "sku1" with field mask
23721 /// "products.color_info" indicates there is a match between
23722 /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23723 ///
23724 /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23725 /// [google.cloud.retail.v2.Product]: crate::model::Product
23726 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23727 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23728 pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23729
23730 /// The rollup matching
23731 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23732 /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23733 /// the
23734 /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23735 /// The values are the merged and de-duplicated
23736 /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23737 /// rollup values are respect filter. For example, when filtering by
23738 /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23739 /// returned.
23740 ///
23741 /// For textual and numerical attributes, the rollup values is a list of
23742 /// string or double values with type
23743 /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23744 /// there are two variants with colors "red" and "blue", the rollup values
23745 /// are
23746 ///
23747 /// ```norust
23748 /// { key: "colorFamilies"
23749 /// value {
23750 /// list_value {
23751 /// values { string_value: "red" }
23752 /// values { string_value: "blue" }
23753 /// }
23754 /// }
23755 /// }
23756 /// ```
23757 ///
23758 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23759 /// values is a double value with type
23760 /// [google.protobuf.Value][google.protobuf.Value]. For example,
23761 /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23762 /// are 10 variants in this product are available in the store "store1".
23763 ///
23764 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23765 /// [google.cloud.retail.v2.Product]: crate::model::Product
23766 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23767 /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23768 /// [google.protobuf.ListValue]: wkt::ListValue
23769 /// [google.protobuf.Value]: wkt::Value
23770 pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23771
23772 /// Specifies previous events related to this product for this user based on
23773 /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23774 /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23775 /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23776 ///
23777 /// This is set only when
23778 /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23779 /// is
23780 /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23781 ///
23782 /// Possible values:
23783 ///
23784 /// * `purchased`: Indicates that this product has been purchased before.
23785 ///
23786 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23787 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23788 /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23789 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23790 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23791 pub personal_labels: std::vec::Vec<std::string::String>,
23792
23793 /// Google provided available scores.
23794 pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23795
23796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23797 }
23798
23799 impl SearchResult {
23800 /// Creates a new default instance.
23801 pub fn new() -> Self {
23802 std::default::Default::default()
23803 }
23804
23805 /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23806 ///
23807 /// # Example
23808 /// ```ignore,no_run
23809 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23810 /// let x = SearchResult::new().set_id("example");
23811 /// ```
23812 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23813 self.id = v.into();
23814 self
23815 }
23816
23817 /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23818 ///
23819 /// # Example
23820 /// ```ignore,no_run
23821 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23822 /// use google_cloud_retail_v2::model::Product;
23823 /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23824 /// ```
23825 pub fn set_product<T>(mut self, v: T) -> Self
23826 where
23827 T: std::convert::Into<crate::model::Product>,
23828 {
23829 self.product = std::option::Option::Some(v.into());
23830 self
23831 }
23832
23833 /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23834 ///
23835 /// # Example
23836 /// ```ignore,no_run
23837 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23838 /// use google_cloud_retail_v2::model::Product;
23839 /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23840 /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23841 /// ```
23842 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23843 where
23844 T: std::convert::Into<crate::model::Product>,
23845 {
23846 self.product = v.map(|x| x.into());
23847 self
23848 }
23849
23850 /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23851 ///
23852 /// # Example
23853 /// ```ignore,no_run
23854 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23855 /// let x = SearchResult::new().set_matching_variant_count(42);
23856 /// ```
23857 pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23858 self.matching_variant_count = v.into();
23859 self
23860 }
23861
23862 /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23863 ///
23864 /// # Example
23865 /// ```ignore,no_run
23866 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23867 /// use wkt::FieldMask;
23868 /// let x = SearchResult::new().set_matching_variant_fields([
23869 /// ("key0", FieldMask::default()/* use setters */),
23870 /// ("key1", FieldMask::default()/* use (different) setters */),
23871 /// ]);
23872 /// ```
23873 pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
23874 where
23875 T: std::iter::IntoIterator<Item = (K, V)>,
23876 K: std::convert::Into<std::string::String>,
23877 V: std::convert::Into<wkt::FieldMask>,
23878 {
23879 use std::iter::Iterator;
23880 self.matching_variant_fields =
23881 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23882 self
23883 }
23884
23885 /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
23886 ///
23887 /// # Example
23888 /// ```ignore,no_run
23889 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23890 /// use wkt::Value;
23891 /// let x = SearchResult::new().set_variant_rollup_values([
23892 /// ("key0", Value::default()/* use setters */),
23893 /// ("key1", Value::default()/* use (different) setters */),
23894 /// ]);
23895 /// ```
23896 pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
23897 where
23898 T: std::iter::IntoIterator<Item = (K, V)>,
23899 K: std::convert::Into<std::string::String>,
23900 V: std::convert::Into<wkt::Value>,
23901 {
23902 use std::iter::Iterator;
23903 self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23904 self
23905 }
23906
23907 /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
23908 ///
23909 /// # Example
23910 /// ```ignore,no_run
23911 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23912 /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
23913 /// ```
23914 pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
23915 where
23916 T: std::iter::IntoIterator<Item = V>,
23917 V: std::convert::Into<std::string::String>,
23918 {
23919 use std::iter::Iterator;
23920 self.personal_labels = v.into_iter().map(|i| i.into()).collect();
23921 self
23922 }
23923
23924 /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
23925 ///
23926 /// # Example
23927 /// ```ignore,no_run
23928 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23929 /// use google_cloud_retail_v2::model::DoubleList;
23930 /// let x = SearchResult::new().set_model_scores([
23931 /// ("key0", DoubleList::default()/* use setters */),
23932 /// ("key1", DoubleList::default()/* use (different) setters */),
23933 /// ]);
23934 /// ```
23935 pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
23936 where
23937 T: std::iter::IntoIterator<Item = (K, V)>,
23938 K: std::convert::Into<std::string::String>,
23939 V: std::convert::Into<crate::model::DoubleList>,
23940 {
23941 use std::iter::Iterator;
23942 self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23943 self
23944 }
23945 }
23946
23947 impl wkt::message::Message for SearchResult {
23948 fn typename() -> &'static str {
23949 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
23950 }
23951 }
23952
23953 /// A facet result.
23954 #[derive(Clone, Default, PartialEq)]
23955 #[non_exhaustive]
23956 pub struct Facet {
23957 /// The key for this facet. E.g., "colorFamilies" or "price" or
23958 /// "attributes.attr1".
23959 pub key: std::string::String,
23960
23961 /// The facet values for this field.
23962 pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
23963
23964 /// Whether the facet is dynamically generated.
23965 pub dynamic_facet: bool,
23966
23967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23968 }
23969
23970 impl Facet {
23971 /// Creates a new default instance.
23972 pub fn new() -> Self {
23973 std::default::Default::default()
23974 }
23975
23976 /// Sets the value of [key][crate::model::search_response::Facet::key].
23977 ///
23978 /// # Example
23979 /// ```ignore,no_run
23980 /// # use google_cloud_retail_v2::model::search_response::Facet;
23981 /// let x = Facet::new().set_key("example");
23982 /// ```
23983 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23984 self.key = v.into();
23985 self
23986 }
23987
23988 /// Sets the value of [values][crate::model::search_response::Facet::values].
23989 ///
23990 /// # Example
23991 /// ```ignore,no_run
23992 /// # use google_cloud_retail_v2::model::search_response::Facet;
23993 /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23994 /// let x = Facet::new()
23995 /// .set_values([
23996 /// FacetValue::default()/* use setters */,
23997 /// FacetValue::default()/* use (different) setters */,
23998 /// ]);
23999 /// ```
24000 pub fn set_values<T, V>(mut self, v: T) -> Self
24001 where
24002 T: std::iter::IntoIterator<Item = V>,
24003 V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
24004 {
24005 use std::iter::Iterator;
24006 self.values = v.into_iter().map(|i| i.into()).collect();
24007 self
24008 }
24009
24010 /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
24011 ///
24012 /// # Example
24013 /// ```ignore,no_run
24014 /// # use google_cloud_retail_v2::model::search_response::Facet;
24015 /// let x = Facet::new().set_dynamic_facet(true);
24016 /// ```
24017 pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24018 self.dynamic_facet = v.into();
24019 self
24020 }
24021 }
24022
24023 impl wkt::message::Message for Facet {
24024 fn typename() -> &'static str {
24025 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
24026 }
24027 }
24028
24029 /// Defines additional types related to [Facet].
24030 pub mod facet {
24031 #[allow(unused_imports)]
24032 use super::*;
24033
24034 /// A facet value which contains value names and their count.
24035 #[derive(Clone, Default, PartialEq)]
24036 #[non_exhaustive]
24037 pub struct FacetValue {
24038 /// Number of items that have this facet value.
24039 pub count: i64,
24040
24041 /// The minimum value in the
24042 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24043 /// Only supported on numerical facets and returned if
24044 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24045 /// is true.
24046 ///
24047 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24048 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24049 pub min_value: f64,
24050
24051 /// The maximum value in the
24052 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24053 /// Only supported on numerical facets and returned if
24054 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24055 /// is true.
24056 ///
24057 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24058 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24059 pub max_value: f64,
24060
24061 /// A facet value which contains values.
24062 pub facet_value:
24063 std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
24064
24065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24066 }
24067
24068 impl FacetValue {
24069 /// Creates a new default instance.
24070 pub fn new() -> Self {
24071 std::default::Default::default()
24072 }
24073
24074 /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
24075 ///
24076 /// # Example
24077 /// ```ignore,no_run
24078 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24079 /// let x = FacetValue::new().set_count(42);
24080 /// ```
24081 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24082 self.count = v.into();
24083 self
24084 }
24085
24086 /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
24087 ///
24088 /// # Example
24089 /// ```ignore,no_run
24090 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24091 /// let x = FacetValue::new().set_min_value(42.0);
24092 /// ```
24093 pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24094 self.min_value = v.into();
24095 self
24096 }
24097
24098 /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
24099 ///
24100 /// # Example
24101 /// ```ignore,no_run
24102 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24103 /// let x = FacetValue::new().set_max_value(42.0);
24104 /// ```
24105 pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24106 self.max_value = v.into();
24107 self
24108 }
24109
24110 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
24111 ///
24112 /// Note that all the setters affecting `facet_value` are mutually
24113 /// exclusive.
24114 ///
24115 /// # Example
24116 /// ```ignore,no_run
24117 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24118 /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
24119 /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
24120 /// ```
24121 pub fn set_facet_value<
24122 T: std::convert::Into<
24123 std::option::Option<
24124 crate::model::search_response::facet::facet_value::FacetValue,
24125 >,
24126 >,
24127 >(
24128 mut self,
24129 v: T,
24130 ) -> Self {
24131 self.facet_value = v.into();
24132 self
24133 }
24134
24135 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24136 /// if it holds a `Value`, `None` if the field is not set or
24137 /// holds a different branch.
24138 pub fn value(&self) -> std::option::Option<&std::string::String> {
24139 #[allow(unreachable_patterns)]
24140 self.facet_value.as_ref().and_then(|v| match v {
24141 crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
24142 std::option::Option::Some(v)
24143 }
24144 _ => std::option::Option::None,
24145 })
24146 }
24147
24148 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24149 /// to hold a `Value`.
24150 ///
24151 /// Note that all the setters affecting `facet_value` are
24152 /// mutually exclusive.
24153 ///
24154 /// # Example
24155 /// ```ignore,no_run
24156 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24157 /// let x = FacetValue::new().set_value("example");
24158 /// assert!(x.value().is_some());
24159 /// assert!(x.interval().is_none());
24160 /// ```
24161 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24162 self.facet_value = std::option::Option::Some(
24163 crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
24164 );
24165 self
24166 }
24167
24168 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24169 /// if it holds a `Interval`, `None` if the field is not set or
24170 /// holds a different branch.
24171 pub fn interval(
24172 &self,
24173 ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
24174 #[allow(unreachable_patterns)]
24175 self.facet_value.as_ref().and_then(|v| match v {
24176 crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
24177 std::option::Option::Some(v)
24178 }
24179 _ => std::option::Option::None,
24180 })
24181 }
24182
24183 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24184 /// to hold a `Interval`.
24185 ///
24186 /// Note that all the setters affecting `facet_value` are
24187 /// mutually exclusive.
24188 ///
24189 /// # Example
24190 /// ```ignore,no_run
24191 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24192 /// use google_cloud_retail_v2::model::Interval;
24193 /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24194 /// assert!(x.interval().is_some());
24195 /// assert!(x.value().is_none());
24196 /// ```
24197 pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24198 mut self,
24199 v: T,
24200 ) -> Self {
24201 self.facet_value = std::option::Option::Some(
24202 crate::model::search_response::facet::facet_value::FacetValue::Interval(
24203 v.into(),
24204 ),
24205 );
24206 self
24207 }
24208 }
24209
24210 impl wkt::message::Message for FacetValue {
24211 fn typename() -> &'static str {
24212 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24213 }
24214 }
24215
24216 /// Defines additional types related to [FacetValue].
24217 pub mod facet_value {
24218 #[allow(unused_imports)]
24219 use super::*;
24220
24221 /// A facet value which contains values.
24222 #[derive(Clone, Debug, PartialEq)]
24223 #[non_exhaustive]
24224 pub enum FacetValue {
24225 /// Text value of a facet, such as "Black" for facet "colorFamilies".
24226 Value(std::string::String),
24227 /// Interval value for a facet, such as [10, 20) for facet "price".
24228 Interval(std::boxed::Box<crate::model::Interval>),
24229 }
24230 }
24231 }
24232
24233 /// Information describing query expansion including whether expansion has
24234 /// occurred.
24235 #[derive(Clone, Default, PartialEq)]
24236 #[non_exhaustive]
24237 pub struct QueryExpansionInfo {
24238 /// Bool describing whether query expansion has occurred.
24239 pub expanded_query: bool,
24240
24241 /// Number of pinned results. This field will only be set when expansion
24242 /// happens and
24243 /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24244 /// is set to true.
24245 ///
24246 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24247 pub pinned_result_count: i64,
24248
24249 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24250 }
24251
24252 impl QueryExpansionInfo {
24253 /// Creates a new default instance.
24254 pub fn new() -> Self {
24255 std::default::Default::default()
24256 }
24257
24258 /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24259 ///
24260 /// # Example
24261 /// ```ignore,no_run
24262 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24263 /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24264 /// ```
24265 pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24266 self.expanded_query = v.into();
24267 self
24268 }
24269
24270 /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24271 ///
24272 /// # Example
24273 /// ```ignore,no_run
24274 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24275 /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24276 /// ```
24277 pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24278 self.pinned_result_count = v.into();
24279 self
24280 }
24281 }
24282
24283 impl wkt::message::Message for QueryExpansionInfo {
24284 fn typename() -> &'static str {
24285 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24286 }
24287 }
24288
24289 /// This field specifies all related information that is needed on client
24290 /// side for UI rendering of conversational retail search.
24291 #[derive(Clone, Default, PartialEq)]
24292 #[non_exhaustive]
24293 pub struct ConversationalSearchResult {
24294 /// Conversation UUID. This field will be stored in client side storage to
24295 /// maintain the conversation session with server and will be used for next
24296 /// search request's
24297 /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24298 /// to restore conversation state in server.
24299 ///
24300 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24301 pub conversation_id: std::string::String,
24302
24303 /// The current refined query for the conversational search. This field
24304 /// will be used in customer UI that the query in the search bar should be
24305 /// replaced with the refined query. For example, if
24306 /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24307 /// `dress` and next
24308 /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24309 /// is `red color`, which does not match any product attribute value filters,
24310 /// the refined query will be `dress, red color`.
24311 ///
24312 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24313 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24314 pub refined_query: std::string::String,
24315
24316 /// This field is deprecated but will be kept for backward compatibility.
24317 /// There is expected to have only one additional filter and the value will
24318 /// be the same to the same as field `additional_filter`.
24319 #[deprecated]
24320 pub additional_filters: std::vec::Vec<
24321 crate::model::search_response::conversational_search_result::AdditionalFilter,
24322 >,
24323
24324 /// The follow-up question. e.g., `What is the color?`
24325 pub followup_question: std::string::String,
24326
24327 /// The answer options provided to client for the follow-up question.
24328 pub suggested_answers: std::vec::Vec<
24329 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24330 >,
24331
24332 /// This is the incremental additional filters implied from the current
24333 /// user answer. User should add the suggested addition filters to the
24334 /// previous
24335 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
24336 /// use the merged filter in the follow up search request.
24337 ///
24338 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24339 pub additional_filter: std::option::Option<
24340 crate::model::search_response::conversational_search_result::AdditionalFilter,
24341 >,
24342
24343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24344 }
24345
24346 impl ConversationalSearchResult {
24347 /// Creates a new default instance.
24348 pub fn new() -> Self {
24349 std::default::Default::default()
24350 }
24351
24352 /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24353 ///
24354 /// # Example
24355 /// ```ignore,no_run
24356 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24357 /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24358 /// ```
24359 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24360 mut self,
24361 v: T,
24362 ) -> Self {
24363 self.conversation_id = v.into();
24364 self
24365 }
24366
24367 /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24368 ///
24369 /// # Example
24370 /// ```ignore,no_run
24371 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24372 /// let x = ConversationalSearchResult::new().set_refined_query("example");
24373 /// ```
24374 pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24375 mut self,
24376 v: T,
24377 ) -> Self {
24378 self.refined_query = v.into();
24379 self
24380 }
24381
24382 /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24383 ///
24384 /// # Example
24385 /// ```ignore,no_run
24386 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24387 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24388 /// let x = ConversationalSearchResult::new()
24389 /// .set_additional_filters([
24390 /// AdditionalFilter::default()/* use setters */,
24391 /// AdditionalFilter::default()/* use (different) setters */,
24392 /// ]);
24393 /// ```
24394 #[deprecated]
24395 pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24396 where
24397 T: std::iter::IntoIterator<Item = V>,
24398 V: std::convert::Into<
24399 crate::model::search_response::conversational_search_result::AdditionalFilter,
24400 >,
24401 {
24402 use std::iter::Iterator;
24403 self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24404 self
24405 }
24406
24407 /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24408 ///
24409 /// # Example
24410 /// ```ignore,no_run
24411 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24412 /// let x = ConversationalSearchResult::new().set_followup_question("example");
24413 /// ```
24414 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24415 mut self,
24416 v: T,
24417 ) -> Self {
24418 self.followup_question = v.into();
24419 self
24420 }
24421
24422 /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24423 ///
24424 /// # Example
24425 /// ```ignore,no_run
24426 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24427 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24428 /// let x = ConversationalSearchResult::new()
24429 /// .set_suggested_answers([
24430 /// SuggestedAnswer::default()/* use setters */,
24431 /// SuggestedAnswer::default()/* use (different) setters */,
24432 /// ]);
24433 /// ```
24434 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24435 where
24436 T: std::iter::IntoIterator<Item = V>,
24437 V: std::convert::Into<
24438 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24439 >,
24440 {
24441 use std::iter::Iterator;
24442 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24443 self
24444 }
24445
24446 /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24447 ///
24448 /// # Example
24449 /// ```ignore,no_run
24450 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24451 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24452 /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24453 /// ```
24454 pub fn set_additional_filter<T>(mut self, v: T) -> Self
24455 where
24456 T: std::convert::Into<
24457 crate::model::search_response::conversational_search_result::AdditionalFilter,
24458 >,
24459 {
24460 self.additional_filter = std::option::Option::Some(v.into());
24461 self
24462 }
24463
24464 /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24465 ///
24466 /// # Example
24467 /// ```ignore,no_run
24468 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24469 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24470 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24471 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24472 /// ```
24473 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24474 where
24475 T: std::convert::Into<
24476 crate::model::search_response::conversational_search_result::AdditionalFilter,
24477 >,
24478 {
24479 self.additional_filter = v.map(|x| x.into());
24480 self
24481 }
24482 }
24483
24484 impl wkt::message::Message for ConversationalSearchResult {
24485 fn typename() -> &'static str {
24486 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24487 }
24488 }
24489
24490 /// Defines additional types related to [ConversationalSearchResult].
24491 pub mod conversational_search_result {
24492 #[allow(unused_imports)]
24493 use super::*;
24494
24495 /// Suggested answers to the follow-up question.
24496 #[derive(Clone, Default, PartialEq)]
24497 #[non_exhaustive]
24498 pub struct SuggestedAnswer {
24499 /// Product attribute value, including an attribute key and an
24500 /// attribute value. Other types can be added here in the future.
24501 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24502
24503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24504 }
24505
24506 impl SuggestedAnswer {
24507 /// Creates a new default instance.
24508 pub fn new() -> Self {
24509 std::default::Default::default()
24510 }
24511
24512 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24513 ///
24514 /// # Example
24515 /// ```ignore,no_run
24516 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24517 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24518 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24519 /// ```
24520 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24521 where
24522 T: std::convert::Into<crate::model::ProductAttributeValue>,
24523 {
24524 self.product_attribute_value = std::option::Option::Some(v.into());
24525 self
24526 }
24527
24528 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24529 ///
24530 /// # Example
24531 /// ```ignore,no_run
24532 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24533 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24534 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24535 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24536 /// ```
24537 pub fn set_or_clear_product_attribute_value<T>(
24538 mut self,
24539 v: std::option::Option<T>,
24540 ) -> Self
24541 where
24542 T: std::convert::Into<crate::model::ProductAttributeValue>,
24543 {
24544 self.product_attribute_value = v.map(|x| x.into());
24545 self
24546 }
24547 }
24548
24549 impl wkt::message::Message for SuggestedAnswer {
24550 fn typename() -> &'static str {
24551 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24552 }
24553 }
24554
24555 /// Additional filter that client side need to apply.
24556 #[derive(Clone, Default, PartialEq)]
24557 #[non_exhaustive]
24558 pub struct AdditionalFilter {
24559 /// Product attribute value, including an attribute key and an
24560 /// attribute value. Other types can be added here in the future.
24561 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24562
24563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24564 }
24565
24566 impl AdditionalFilter {
24567 /// Creates a new default instance.
24568 pub fn new() -> Self {
24569 std::default::Default::default()
24570 }
24571
24572 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24573 ///
24574 /// # Example
24575 /// ```ignore,no_run
24576 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24577 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24578 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24579 /// ```
24580 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24581 where
24582 T: std::convert::Into<crate::model::ProductAttributeValue>,
24583 {
24584 self.product_attribute_value = std::option::Option::Some(v.into());
24585 self
24586 }
24587
24588 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24589 ///
24590 /// # Example
24591 /// ```ignore,no_run
24592 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24593 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24594 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24595 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24596 /// ```
24597 pub fn set_or_clear_product_attribute_value<T>(
24598 mut self,
24599 v: std::option::Option<T>,
24600 ) -> Self
24601 where
24602 T: std::convert::Into<crate::model::ProductAttributeValue>,
24603 {
24604 self.product_attribute_value = v.map(|x| x.into());
24605 self
24606 }
24607 }
24608
24609 impl wkt::message::Message for AdditionalFilter {
24610 fn typename() -> &'static str {
24611 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24612 }
24613 }
24614 }
24615
24616 /// This field specifies all related information for tile navigation that will
24617 /// be used in client side.
24618 #[derive(Clone, Default, PartialEq)]
24619 #[non_exhaustive]
24620 pub struct TileNavigationResult {
24621 /// The current tiles that are used for tile navigation, sorted by
24622 /// engagement.
24623 pub tiles: std::vec::Vec<crate::model::Tile>,
24624
24625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24626 }
24627
24628 impl TileNavigationResult {
24629 /// Creates a new default instance.
24630 pub fn new() -> Self {
24631 std::default::Default::default()
24632 }
24633
24634 /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24635 ///
24636 /// # Example
24637 /// ```ignore,no_run
24638 /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24639 /// use google_cloud_retail_v2::model::Tile;
24640 /// let x = TileNavigationResult::new()
24641 /// .set_tiles([
24642 /// Tile::default()/* use setters */,
24643 /// Tile::default()/* use (different) setters */,
24644 /// ]);
24645 /// ```
24646 pub fn set_tiles<T, V>(mut self, v: T) -> Self
24647 where
24648 T: std::iter::IntoIterator<Item = V>,
24649 V: std::convert::Into<crate::model::Tile>,
24650 {
24651 use std::iter::Iterator;
24652 self.tiles = v.into_iter().map(|i| i.into()).collect();
24653 self
24654 }
24655 }
24656
24657 impl wkt::message::Message for TileNavigationResult {
24658 fn typename() -> &'static str {
24659 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24660 }
24661 }
24662}
24663
24664/// Metadata for active A/B testing experiment.
24665#[derive(Clone, Default, PartialEq)]
24666#[non_exhaustive]
24667pub struct ExperimentInfo {
24668 /// The fully qualified resource name of the experiment that provides the
24669 /// serving config under test, should an active experiment exist. For example:
24670 /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24671 pub experiment: std::string::String,
24672
24673 /// Information associated with the specific experiment entity being recorded.
24674 pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24675
24676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24677}
24678
24679impl ExperimentInfo {
24680 /// Creates a new default instance.
24681 pub fn new() -> Self {
24682 std::default::Default::default()
24683 }
24684
24685 /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24686 ///
24687 /// # Example
24688 /// ```ignore,no_run
24689 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24690 /// let x = ExperimentInfo::new().set_experiment("example");
24691 /// ```
24692 pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24693 self.experiment = v.into();
24694 self
24695 }
24696
24697 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24698 ///
24699 /// Note that all the setters affecting `experiment_metadata` are mutually
24700 /// exclusive.
24701 ///
24702 /// # Example
24703 /// ```ignore,no_run
24704 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24705 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24706 /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24707 /// google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24708 /// ```
24709 pub fn set_experiment_metadata<
24710 T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24711 >(
24712 mut self,
24713 v: T,
24714 ) -> Self {
24715 self.experiment_metadata = v.into();
24716 self
24717 }
24718
24719 /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24720 /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24721 /// holds a different branch.
24722 pub fn serving_config_experiment(
24723 &self,
24724 ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24725 {
24726 #[allow(unreachable_patterns)]
24727 self.experiment_metadata.as_ref().and_then(|v| match v {
24728 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24729 std::option::Option::Some(v)
24730 }
24731 _ => std::option::Option::None,
24732 })
24733 }
24734
24735 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24736 /// to hold a `ServingConfigExperiment`.
24737 ///
24738 /// Note that all the setters affecting `experiment_metadata` are
24739 /// mutually exclusive.
24740 ///
24741 /// # Example
24742 /// ```ignore,no_run
24743 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24744 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24745 /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24746 /// assert!(x.serving_config_experiment().is_some());
24747 /// ```
24748 pub fn set_serving_config_experiment<
24749 T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24750 >(
24751 mut self,
24752 v: T,
24753 ) -> Self {
24754 self.experiment_metadata = std::option::Option::Some(
24755 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24756 );
24757 self
24758 }
24759}
24760
24761impl wkt::message::Message for ExperimentInfo {
24762 fn typename() -> &'static str {
24763 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24764 }
24765}
24766
24767/// Defines additional types related to [ExperimentInfo].
24768pub mod experiment_info {
24769 #[allow(unused_imports)]
24770 use super::*;
24771
24772 /// Metadata for active serving config A/B tests.
24773 #[derive(Clone, Default, PartialEq)]
24774 #[non_exhaustive]
24775 pub struct ServingConfigExperiment {
24776 /// The fully qualified resource name of the original
24777 /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24778 /// in the search request prior to reassignment by experiment API. For
24779 /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24780 ///
24781 /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24782 pub original_serving_config: std::string::String,
24783
24784 /// The fully qualified resource name of the serving config
24785 /// `Experiment.VariantArm.serving_config_id` responsible for generating
24786 /// the search response. For example:
24787 /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24788 pub experiment_serving_config: std::string::String,
24789
24790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24791 }
24792
24793 impl ServingConfigExperiment {
24794 /// Creates a new default instance.
24795 pub fn new() -> Self {
24796 std::default::Default::default()
24797 }
24798
24799 /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24800 ///
24801 /// # Example
24802 /// ```ignore,no_run
24803 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24804 /// let x = ServingConfigExperiment::new().set_original_serving_config("example");
24805 /// ```
24806 pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24807 mut self,
24808 v: T,
24809 ) -> Self {
24810 self.original_serving_config = v.into();
24811 self
24812 }
24813
24814 /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24815 ///
24816 /// # Example
24817 /// ```ignore,no_run
24818 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24819 /// let x = ServingConfigExperiment::new().set_experiment_serving_config("example");
24820 /// ```
24821 pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24822 mut self,
24823 v: T,
24824 ) -> Self {
24825 self.experiment_serving_config = v.into();
24826 self
24827 }
24828 }
24829
24830 impl wkt::message::Message for ServingConfigExperiment {
24831 fn typename() -> &'static str {
24832 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24833 }
24834 }
24835
24836 /// Information associated with the specific experiment entity being recorded.
24837 #[derive(Clone, Debug, PartialEq)]
24838 #[non_exhaustive]
24839 pub enum ExperimentMetadata {
24840 /// A/B test between existing Cloud Retail Search
24841 /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24842 ///
24843 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24844 ServingConfigExperiment(
24845 std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24846 ),
24847 }
24848}
24849
24850/// Configures metadata that is used to generate serving time results (e.g.
24851/// search results or recommendation predictions).
24852#[derive(Clone, Default, PartialEq)]
24853#[non_exhaustive]
24854pub struct ServingConfig {
24855 /// Immutable. Fully qualified name
24856 /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24857 pub name: std::string::String,
24858
24859 /// Required. The human readable serving config display name. Used in Retail
24860 /// UI.
24861 ///
24862 /// This field must be a UTF-8 encoded string with a length limit of 128
24863 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
24864 pub display_name: std::string::String,
24865
24866 /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
24867 /// to use at serving time. Currently only RecommendationModels are supported:
24868 /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
24869 /// Can be changed but only to a compatible model (e.g.
24870 /// others-you-may-like CTR to others-you-may-like CVR).
24871 ///
24872 /// Required when
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.Catalog]: crate::model::Catalog
24877 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24878 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24879 pub model_id: std::string::String,
24880
24881 /// How much price ranking we want in serving results.
24882 /// Price reranking causes product items with a similar
24883 /// recommendation probability to be ordered by price, with the
24884 /// highest-priced items first. This setting could result in a decrease in
24885 /// click-through and conversion rates.
24886 /// Allowed values are:
24887 ///
24888 /// * `no-price-reranking`
24889 /// * `low-price-reranking`
24890 /// * `medium-price-reranking`
24891 /// * `high-price-reranking`
24892 ///
24893 /// If not specified, we choose default based on model type. Default value:
24894 /// `no-price-reranking`.
24895 ///
24896 /// Can only be set if
24897 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24898 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24899 ///
24900 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24901 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24902 pub price_reranking_level: std::string::String,
24903
24904 /// Facet specifications for faceted search. If empty, no facets are returned.
24905 /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
24906 /// resources with only the Facet control set. These controls are assumed to be
24907 /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
24908 /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
24909 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
24910 /// is returned.
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 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24917 /// [google.cloud.retail.v2.Control]: crate::model::Control
24918 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24919 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24920 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24921 pub facet_control_ids: std::vec::Vec<std::string::String>,
24922
24923 /// The specification for dynamically generated facets. Notice that only
24924 /// textual facets can be dynamically generated.
24925 ///
24926 /// Can only be set if
24927 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24928 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24929 ///
24930 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24931 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24932 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
24933
24934 /// Condition boost specifications. If a product matches multiple conditions
24935 /// in the specifications, boost scores from these specifications are all
24936 /// applied and combined in a non-linear way. Maximum number of
24937 /// specifications is 100.
24938 ///
24939 /// Notice that if both
24940 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
24941 /// and
24942 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
24943 /// are set, the boost conditions from both places are evaluated. If a search
24944 /// request matches multiple boost conditions, the final boost score is equal
24945 /// to the sum of the boost scores from all matched boost conditions.
24946 ///
24947 /// Can only be set if
24948 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24949 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24950 ///
24951 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
24952 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
24953 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24954 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24955 pub boost_control_ids: std::vec::Vec<std::string::String>,
24956
24957 /// Condition filter specifications. If a product matches multiple conditions
24958 /// in the specifications, filters from these specifications are all
24959 /// applied and combined via the AND operator. Maximum number of
24960 /// specifications is 100.
24961 ///
24962 /// Can only be set if
24963 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24964 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24965 ///
24966 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24967 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24968 pub filter_control_ids: std::vec::Vec<std::string::String>,
24969
24970 /// Condition redirect specifications. Only the first triggered redirect action
24971 /// is applied, even if multiple apply. Maximum number of specifications is
24972 /// 1000.
24973 ///
24974 /// Can only be set if
24975 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24976 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24977 ///
24978 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24979 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24980 pub redirect_control_ids: std::vec::Vec<std::string::String>,
24981
24982 /// Condition synonyms specifications. If multiple syonyms conditions match,
24983 /// all matching synonyms control in the list will execute. Order of controls
24984 /// in the list will not matter. Maximum number of specifications is
24985 /// 100.
24986 ///
24987 /// Can only be set if
24988 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24989 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24990 ///
24991 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24992 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24993 pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24994
24995 /// Condition oneway synonyms specifications. If multiple oneway synonyms
24996 /// conditions match, all matching oneway synonyms controls in the list will
24997 /// execute. Order of controls in the list will not matter. Maximum number of
24998 /// specifications is 100.
24999 ///
25000 /// Can only be set if
25001 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25002 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25003 ///
25004 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25005 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25006 pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
25007
25008 /// Condition do not associate specifications. If multiple do not associate
25009 /// conditions match, all matching do not associate controls in the list will
25010 /// execute.
25011 ///
25012 /// - Order does not matter.
25013 /// - Maximum number of specifications is 100.
25014 ///
25015 /// Can only be set if
25016 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25017 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25018 ///
25019 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25020 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25021 pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
25022
25023 /// Condition replacement specifications.
25024 ///
25025 /// - Applied according to the order in the list.
25026 /// - A previously replaced term can not be re-replaced.
25027 /// - Maximum number of specifications is 100.
25028 ///
25029 /// Can only be set if
25030 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25031 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25032 ///
25033 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25034 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25035 pub replacement_control_ids: std::vec::Vec<std::string::String>,
25036
25037 /// Condition ignore specifications. If multiple ignore
25038 /// conditions match, all matching ignore controls in the list will
25039 /// execute.
25040 ///
25041 /// - Order does not matter.
25042 /// - Maximum number of specifications is 100.
25043 ///
25044 /// Can only be set if
25045 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25046 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25047 ///
25048 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25049 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25050 pub ignore_control_ids: std::vec::Vec<std::string::String>,
25051
25052 /// How much diversity to use in recommendation model results e.g.
25053 /// `medium-diversity` or `high-diversity`. Currently supported values:
25054 ///
25055 /// * `no-diversity`
25056 /// * `low-diversity`
25057 /// * `medium-diversity`
25058 /// * `high-diversity`
25059 /// * `auto-diversity`
25060 ///
25061 /// If not specified, we choose default based on recommendation model
25062 /// type. Default value: `no-diversity`.
25063 ///
25064 /// Can only be set if
25065 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25066 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25067 ///
25068 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25069 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25070 pub diversity_level: std::string::String,
25071
25072 /// What kind of diversity to use - data driven or rule based. If unset, the
25073 /// server behavior defaults to
25074 /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
25075 ///
25076 /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
25077 pub diversity_type: crate::model::serving_config::DiversityType,
25078
25079 /// Whether to add additional category filters on the `similar-items` model.
25080 /// If not specified, we enable it by default.
25081 /// Allowed values are:
25082 ///
25083 /// * `no-category-match`: No additional filtering of original results from
25084 /// the model and the customer's filters.
25085 /// * `relaxed-category-match`: Only keep results with categories that match
25086 /// at least one item categories in the PredictRequests's context item.
25087 /// * If customer also sends filters in the PredictRequest, then the results
25088 /// will satisfy both conditions (user given and category match).
25089 ///
25090 /// Can only be set if
25091 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25092 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25093 ///
25094 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25095 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25096 pub enable_category_filter_level: std::string::String,
25097
25098 /// When the flag is enabled, the products in the denylist will not be filtered
25099 /// out in the recommendation filtering results.
25100 pub ignore_recs_denylist: bool,
25101
25102 /// The specification for personalization spec.
25103 ///
25104 /// Can only be set if
25105 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25106 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25107 ///
25108 /// Notice that if both
25109 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
25110 /// and
25111 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25112 /// are set.
25113 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25114 /// will override
25115 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
25116 ///
25117 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
25118 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
25119 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25120 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25121 pub personalization_spec:
25122 std::option::Option<crate::model::search_request::PersonalizationSpec>,
25123
25124 /// Required. Immutable. Specifies the solution types that a serving config can
25125 /// be associated with. Currently we support setting only one type of solution.
25126 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
25127
25128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25129}
25130
25131impl ServingConfig {
25132 /// Creates a new default instance.
25133 pub fn new() -> Self {
25134 std::default::Default::default()
25135 }
25136
25137 /// Sets the value of [name][crate::model::ServingConfig::name].
25138 ///
25139 /// # Example
25140 /// ```ignore,no_run
25141 /// # use google_cloud_retail_v2::model::ServingConfig;
25142 /// let x = ServingConfig::new().set_name("example");
25143 /// ```
25144 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25145 self.name = v.into();
25146 self
25147 }
25148
25149 /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
25150 ///
25151 /// # Example
25152 /// ```ignore,no_run
25153 /// # use google_cloud_retail_v2::model::ServingConfig;
25154 /// let x = ServingConfig::new().set_display_name("example");
25155 /// ```
25156 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25157 self.display_name = v.into();
25158 self
25159 }
25160
25161 /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
25162 ///
25163 /// # Example
25164 /// ```ignore,no_run
25165 /// # use google_cloud_retail_v2::model::ServingConfig;
25166 /// let x = ServingConfig::new().set_model_id("example");
25167 /// ```
25168 pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25169 self.model_id = v.into();
25170 self
25171 }
25172
25173 /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
25174 ///
25175 /// # Example
25176 /// ```ignore,no_run
25177 /// # use google_cloud_retail_v2::model::ServingConfig;
25178 /// let x = ServingConfig::new().set_price_reranking_level("example");
25179 /// ```
25180 pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
25181 mut self,
25182 v: T,
25183 ) -> Self {
25184 self.price_reranking_level = v.into();
25185 self
25186 }
25187
25188 /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
25189 ///
25190 /// # Example
25191 /// ```ignore,no_run
25192 /// # use google_cloud_retail_v2::model::ServingConfig;
25193 /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
25194 /// ```
25195 pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25196 where
25197 T: std::iter::IntoIterator<Item = V>,
25198 V: std::convert::Into<std::string::String>,
25199 {
25200 use std::iter::Iterator;
25201 self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25202 self
25203 }
25204
25205 /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25206 ///
25207 /// # Example
25208 /// ```ignore,no_run
25209 /// # use google_cloud_retail_v2::model::ServingConfig;
25210 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25211 /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25212 /// ```
25213 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25214 where
25215 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25216 {
25217 self.dynamic_facet_spec = std::option::Option::Some(v.into());
25218 self
25219 }
25220
25221 /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25222 ///
25223 /// # Example
25224 /// ```ignore,no_run
25225 /// # use google_cloud_retail_v2::model::ServingConfig;
25226 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25227 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25228 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25229 /// ```
25230 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25231 where
25232 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25233 {
25234 self.dynamic_facet_spec = v.map(|x| x.into());
25235 self
25236 }
25237
25238 /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25239 ///
25240 /// # Example
25241 /// ```ignore,no_run
25242 /// # use google_cloud_retail_v2::model::ServingConfig;
25243 /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25244 /// ```
25245 pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25246 where
25247 T: std::iter::IntoIterator<Item = V>,
25248 V: std::convert::Into<std::string::String>,
25249 {
25250 use std::iter::Iterator;
25251 self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25252 self
25253 }
25254
25255 /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25256 ///
25257 /// # Example
25258 /// ```ignore,no_run
25259 /// # use google_cloud_retail_v2::model::ServingConfig;
25260 /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25261 /// ```
25262 pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25263 where
25264 T: std::iter::IntoIterator<Item = V>,
25265 V: std::convert::Into<std::string::String>,
25266 {
25267 use std::iter::Iterator;
25268 self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25269 self
25270 }
25271
25272 /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25273 ///
25274 /// # Example
25275 /// ```ignore,no_run
25276 /// # use google_cloud_retail_v2::model::ServingConfig;
25277 /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25278 /// ```
25279 pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25280 where
25281 T: std::iter::IntoIterator<Item = V>,
25282 V: std::convert::Into<std::string::String>,
25283 {
25284 use std::iter::Iterator;
25285 self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25286 self
25287 }
25288
25289 /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25290 ///
25291 /// # Example
25292 /// ```ignore,no_run
25293 /// # use google_cloud_retail_v2::model::ServingConfig;
25294 /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25295 /// ```
25296 pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25297 where
25298 T: std::iter::IntoIterator<Item = V>,
25299 V: std::convert::Into<std::string::String>,
25300 {
25301 use std::iter::Iterator;
25302 self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25303 self
25304 }
25305
25306 /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25307 ///
25308 /// # Example
25309 /// ```ignore,no_run
25310 /// # use google_cloud_retail_v2::model::ServingConfig;
25311 /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25312 /// ```
25313 pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25314 where
25315 T: std::iter::IntoIterator<Item = V>,
25316 V: std::convert::Into<std::string::String>,
25317 {
25318 use std::iter::Iterator;
25319 self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25320 self
25321 }
25322
25323 /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25324 ///
25325 /// # Example
25326 /// ```ignore,no_run
25327 /// # use google_cloud_retail_v2::model::ServingConfig;
25328 /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25329 /// ```
25330 pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25331 where
25332 T: std::iter::IntoIterator<Item = V>,
25333 V: std::convert::Into<std::string::String>,
25334 {
25335 use std::iter::Iterator;
25336 self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25337 self
25338 }
25339
25340 /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25341 ///
25342 /// # Example
25343 /// ```ignore,no_run
25344 /// # use google_cloud_retail_v2::model::ServingConfig;
25345 /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25346 /// ```
25347 pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25348 where
25349 T: std::iter::IntoIterator<Item = V>,
25350 V: std::convert::Into<std::string::String>,
25351 {
25352 use std::iter::Iterator;
25353 self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25354 self
25355 }
25356
25357 /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25358 ///
25359 /// # Example
25360 /// ```ignore,no_run
25361 /// # use google_cloud_retail_v2::model::ServingConfig;
25362 /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25363 /// ```
25364 pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25365 where
25366 T: std::iter::IntoIterator<Item = V>,
25367 V: std::convert::Into<std::string::String>,
25368 {
25369 use std::iter::Iterator;
25370 self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25371 self
25372 }
25373
25374 /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25375 ///
25376 /// # Example
25377 /// ```ignore,no_run
25378 /// # use google_cloud_retail_v2::model::ServingConfig;
25379 /// let x = ServingConfig::new().set_diversity_level("example");
25380 /// ```
25381 pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25382 self.diversity_level = v.into();
25383 self
25384 }
25385
25386 /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25387 ///
25388 /// # Example
25389 /// ```ignore,no_run
25390 /// # use google_cloud_retail_v2::model::ServingConfig;
25391 /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25392 /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25393 /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25394 /// ```
25395 pub fn set_diversity_type<
25396 T: std::convert::Into<crate::model::serving_config::DiversityType>,
25397 >(
25398 mut self,
25399 v: T,
25400 ) -> Self {
25401 self.diversity_type = v.into();
25402 self
25403 }
25404
25405 /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25406 ///
25407 /// # Example
25408 /// ```ignore,no_run
25409 /// # use google_cloud_retail_v2::model::ServingConfig;
25410 /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25411 /// ```
25412 pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25413 mut self,
25414 v: T,
25415 ) -> Self {
25416 self.enable_category_filter_level = v.into();
25417 self
25418 }
25419
25420 /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25421 ///
25422 /// # Example
25423 /// ```ignore,no_run
25424 /// # use google_cloud_retail_v2::model::ServingConfig;
25425 /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25426 /// ```
25427 pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25428 self.ignore_recs_denylist = v.into();
25429 self
25430 }
25431
25432 /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25433 ///
25434 /// # Example
25435 /// ```ignore,no_run
25436 /// # use google_cloud_retail_v2::model::ServingConfig;
25437 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25438 /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25439 /// ```
25440 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25441 where
25442 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25443 {
25444 self.personalization_spec = std::option::Option::Some(v.into());
25445 self
25446 }
25447
25448 /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25449 ///
25450 /// # Example
25451 /// ```ignore,no_run
25452 /// # use google_cloud_retail_v2::model::ServingConfig;
25453 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25454 /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25455 /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25456 /// ```
25457 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25458 where
25459 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25460 {
25461 self.personalization_spec = v.map(|x| x.into());
25462 self
25463 }
25464
25465 /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25466 ///
25467 /// # Example
25468 /// ```ignore,no_run
25469 /// # use google_cloud_retail_v2::model::ServingConfig;
25470 /// use google_cloud_retail_v2::model::SolutionType;
25471 /// let x = ServingConfig::new().set_solution_types([
25472 /// SolutionType::Recommendation,
25473 /// SolutionType::Search,
25474 /// ]);
25475 /// ```
25476 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25477 where
25478 T: std::iter::IntoIterator<Item = V>,
25479 V: std::convert::Into<crate::model::SolutionType>,
25480 {
25481 use std::iter::Iterator;
25482 self.solution_types = v.into_iter().map(|i| i.into()).collect();
25483 self
25484 }
25485}
25486
25487impl wkt::message::Message for ServingConfig {
25488 fn typename() -> &'static str {
25489 "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25490 }
25491}
25492
25493/// Defines additional types related to [ServingConfig].
25494pub mod serving_config {
25495 #[allow(unused_imports)]
25496 use super::*;
25497
25498 /// What type of diversity - data or rule based.
25499 ///
25500 /// # Working with unknown values
25501 ///
25502 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25503 /// additional enum variants at any time. Adding new variants is not considered
25504 /// a breaking change. Applications should write their code in anticipation of:
25505 ///
25506 /// - New values appearing in future releases of the client library, **and**
25507 /// - New values received dynamically, without application changes.
25508 ///
25509 /// Please consult the [Working with enums] section in the user guide for some
25510 /// guidelines.
25511 ///
25512 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25513 #[derive(Clone, Debug, PartialEq)]
25514 #[non_exhaustive]
25515 pub enum DiversityType {
25516 /// Default value.
25517 Unspecified,
25518 /// Rule based diversity.
25519 RuleBasedDiversity,
25520 /// Data driven diversity.
25521 DataDrivenDiversity,
25522 /// If set, the enum was initialized with an unknown value.
25523 ///
25524 /// Applications can examine the value using [DiversityType::value] or
25525 /// [DiversityType::name].
25526 UnknownValue(diversity_type::UnknownValue),
25527 }
25528
25529 #[doc(hidden)]
25530 pub mod diversity_type {
25531 #[allow(unused_imports)]
25532 use super::*;
25533 #[derive(Clone, Debug, PartialEq)]
25534 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25535 }
25536
25537 impl DiversityType {
25538 /// Gets the enum value.
25539 ///
25540 /// Returns `None` if the enum contains an unknown value deserialized from
25541 /// the string representation of enums.
25542 pub fn value(&self) -> std::option::Option<i32> {
25543 match self {
25544 Self::Unspecified => std::option::Option::Some(0),
25545 Self::RuleBasedDiversity => std::option::Option::Some(2),
25546 Self::DataDrivenDiversity => std::option::Option::Some(3),
25547 Self::UnknownValue(u) => u.0.value(),
25548 }
25549 }
25550
25551 /// Gets the enum value as a string.
25552 ///
25553 /// Returns `None` if the enum contains an unknown value deserialized from
25554 /// the integer representation of enums.
25555 pub fn name(&self) -> std::option::Option<&str> {
25556 match self {
25557 Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25558 Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25559 Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25560 Self::UnknownValue(u) => u.0.name(),
25561 }
25562 }
25563 }
25564
25565 impl std::default::Default for DiversityType {
25566 fn default() -> Self {
25567 use std::convert::From;
25568 Self::from(0)
25569 }
25570 }
25571
25572 impl std::fmt::Display for DiversityType {
25573 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25574 wkt::internal::display_enum(f, self.name(), self.value())
25575 }
25576 }
25577
25578 impl std::convert::From<i32> for DiversityType {
25579 fn from(value: i32) -> Self {
25580 match value {
25581 0 => Self::Unspecified,
25582 2 => Self::RuleBasedDiversity,
25583 3 => Self::DataDrivenDiversity,
25584 _ => Self::UnknownValue(diversity_type::UnknownValue(
25585 wkt::internal::UnknownEnumValue::Integer(value),
25586 )),
25587 }
25588 }
25589 }
25590
25591 impl std::convert::From<&str> for DiversityType {
25592 fn from(value: &str) -> Self {
25593 use std::string::ToString;
25594 match value {
25595 "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25596 "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25597 "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25598 _ => Self::UnknownValue(diversity_type::UnknownValue(
25599 wkt::internal::UnknownEnumValue::String(value.to_string()),
25600 )),
25601 }
25602 }
25603 }
25604
25605 impl serde::ser::Serialize for DiversityType {
25606 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25607 where
25608 S: serde::Serializer,
25609 {
25610 match self {
25611 Self::Unspecified => serializer.serialize_i32(0),
25612 Self::RuleBasedDiversity => serializer.serialize_i32(2),
25613 Self::DataDrivenDiversity => serializer.serialize_i32(3),
25614 Self::UnknownValue(u) => u.0.serialize(serializer),
25615 }
25616 }
25617 }
25618
25619 impl<'de> serde::de::Deserialize<'de> for DiversityType {
25620 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25621 where
25622 D: serde::Deserializer<'de>,
25623 {
25624 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25625 ".google.cloud.retail.v2.ServingConfig.DiversityType",
25626 ))
25627 }
25628 }
25629}
25630
25631/// Request for CreateServingConfig method.
25632#[derive(Clone, Default, PartialEq)]
25633#[non_exhaustive]
25634pub struct CreateServingConfigRequest {
25635 /// Required. Full resource name of parent. Format:
25636 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25637 pub parent: std::string::String,
25638
25639 /// Required. The ServingConfig to create.
25640 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25641
25642 /// Required. The ID to use for the ServingConfig, which will become the final
25643 /// component of the ServingConfig's resource name.
25644 ///
25645 /// This value should be 4-63 characters, and valid characters
25646 /// are /[a-z][0-9]-_/.
25647 pub serving_config_id: std::string::String,
25648
25649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25650}
25651
25652impl CreateServingConfigRequest {
25653 /// Creates a new default instance.
25654 pub fn new() -> Self {
25655 std::default::Default::default()
25656 }
25657
25658 /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25659 ///
25660 /// # Example
25661 /// ```ignore,no_run
25662 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25663 /// let x = CreateServingConfigRequest::new().set_parent("example");
25664 /// ```
25665 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25666 self.parent = v.into();
25667 self
25668 }
25669
25670 /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25671 ///
25672 /// # Example
25673 /// ```ignore,no_run
25674 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25675 /// use google_cloud_retail_v2::model::ServingConfig;
25676 /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25677 /// ```
25678 pub fn set_serving_config<T>(mut self, v: T) -> Self
25679 where
25680 T: std::convert::Into<crate::model::ServingConfig>,
25681 {
25682 self.serving_config = std::option::Option::Some(v.into());
25683 self
25684 }
25685
25686 /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25687 ///
25688 /// # Example
25689 /// ```ignore,no_run
25690 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25691 /// use google_cloud_retail_v2::model::ServingConfig;
25692 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25693 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25694 /// ```
25695 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25696 where
25697 T: std::convert::Into<crate::model::ServingConfig>,
25698 {
25699 self.serving_config = v.map(|x| x.into());
25700 self
25701 }
25702
25703 /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25704 ///
25705 /// # Example
25706 /// ```ignore,no_run
25707 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25708 /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25709 /// ```
25710 pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25711 mut self,
25712 v: T,
25713 ) -> Self {
25714 self.serving_config_id = v.into();
25715 self
25716 }
25717}
25718
25719impl wkt::message::Message for CreateServingConfigRequest {
25720 fn typename() -> &'static str {
25721 "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25722 }
25723}
25724
25725/// Request for UpdateServingConfig method.
25726#[derive(Clone, Default, PartialEq)]
25727#[non_exhaustive]
25728pub struct UpdateServingConfigRequest {
25729 /// Required. The ServingConfig to update.
25730 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25731
25732 /// Indicates which fields in the provided
25733 /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25734 /// following are NOT supported:
25735 ///
25736 /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25737 ///
25738 /// If not set, all supported fields are updated.
25739 ///
25740 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25741 /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25742 pub update_mask: std::option::Option<wkt::FieldMask>,
25743
25744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25745}
25746
25747impl UpdateServingConfigRequest {
25748 /// Creates a new default instance.
25749 pub fn new() -> Self {
25750 std::default::Default::default()
25751 }
25752
25753 /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25754 ///
25755 /// # Example
25756 /// ```ignore,no_run
25757 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25758 /// use google_cloud_retail_v2::model::ServingConfig;
25759 /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25760 /// ```
25761 pub fn set_serving_config<T>(mut self, v: T) -> Self
25762 where
25763 T: std::convert::Into<crate::model::ServingConfig>,
25764 {
25765 self.serving_config = std::option::Option::Some(v.into());
25766 self
25767 }
25768
25769 /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25770 ///
25771 /// # Example
25772 /// ```ignore,no_run
25773 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25774 /// use google_cloud_retail_v2::model::ServingConfig;
25775 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25776 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25777 /// ```
25778 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25779 where
25780 T: std::convert::Into<crate::model::ServingConfig>,
25781 {
25782 self.serving_config = v.map(|x| x.into());
25783 self
25784 }
25785
25786 /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25787 ///
25788 /// # Example
25789 /// ```ignore,no_run
25790 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25791 /// use wkt::FieldMask;
25792 /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25793 /// ```
25794 pub fn set_update_mask<T>(mut self, v: T) -> Self
25795 where
25796 T: std::convert::Into<wkt::FieldMask>,
25797 {
25798 self.update_mask = std::option::Option::Some(v.into());
25799 self
25800 }
25801
25802 /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25803 ///
25804 /// # Example
25805 /// ```ignore,no_run
25806 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25807 /// use wkt::FieldMask;
25808 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25809 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25810 /// ```
25811 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25812 where
25813 T: std::convert::Into<wkt::FieldMask>,
25814 {
25815 self.update_mask = v.map(|x| x.into());
25816 self
25817 }
25818}
25819
25820impl wkt::message::Message for UpdateServingConfigRequest {
25821 fn typename() -> &'static str {
25822 "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25823 }
25824}
25825
25826/// Request for DeleteServingConfig method.
25827#[derive(Clone, Default, PartialEq)]
25828#[non_exhaustive]
25829pub struct DeleteServingConfigRequest {
25830 /// Required. The resource name of the ServingConfig to delete. Format:
25831 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25832 pub name: std::string::String,
25833
25834 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25835}
25836
25837impl DeleteServingConfigRequest {
25838 /// Creates a new default instance.
25839 pub fn new() -> Self {
25840 std::default::Default::default()
25841 }
25842
25843 /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25844 ///
25845 /// # Example
25846 /// ```ignore,no_run
25847 /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25848 /// let x = DeleteServingConfigRequest::new().set_name("example");
25849 /// ```
25850 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25851 self.name = v.into();
25852 self
25853 }
25854}
25855
25856impl wkt::message::Message for DeleteServingConfigRequest {
25857 fn typename() -> &'static str {
25858 "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
25859 }
25860}
25861
25862/// Request for GetServingConfig method.
25863#[derive(Clone, Default, PartialEq)]
25864#[non_exhaustive]
25865pub struct GetServingConfigRequest {
25866 /// Required. The resource name of the ServingConfig to get. Format:
25867 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25868 pub name: std::string::String,
25869
25870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25871}
25872
25873impl GetServingConfigRequest {
25874 /// Creates a new default instance.
25875 pub fn new() -> Self {
25876 std::default::Default::default()
25877 }
25878
25879 /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
25880 ///
25881 /// # Example
25882 /// ```ignore,no_run
25883 /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
25884 /// let x = GetServingConfigRequest::new().set_name("example");
25885 /// ```
25886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25887 self.name = v.into();
25888 self
25889 }
25890}
25891
25892impl wkt::message::Message for GetServingConfigRequest {
25893 fn typename() -> &'static str {
25894 "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
25895 }
25896}
25897
25898/// Request for ListServingConfigs method.
25899#[derive(Clone, Default, PartialEq)]
25900#[non_exhaustive]
25901pub struct ListServingConfigsRequest {
25902 /// Required. The catalog resource name. Format:
25903 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25904 pub parent: std::string::String,
25905
25906 /// Optional. Maximum number of results to return. If unspecified, defaults
25907 /// to 100. If a value greater than 100 is provided, at most 100 results are
25908 /// returned.
25909 pub page_size: i32,
25910
25911 /// Optional. A page token, received from a previous `ListServingConfigs` call.
25912 /// Provide this to retrieve the subsequent page.
25913 pub page_token: std::string::String,
25914
25915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25916}
25917
25918impl ListServingConfigsRequest {
25919 /// Creates a new default instance.
25920 pub fn new() -> Self {
25921 std::default::Default::default()
25922 }
25923
25924 /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
25925 ///
25926 /// # Example
25927 /// ```ignore,no_run
25928 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25929 /// let x = ListServingConfigsRequest::new().set_parent("example");
25930 /// ```
25931 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25932 self.parent = v.into();
25933 self
25934 }
25935
25936 /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
25937 ///
25938 /// # Example
25939 /// ```ignore,no_run
25940 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25941 /// let x = ListServingConfigsRequest::new().set_page_size(42);
25942 /// ```
25943 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25944 self.page_size = v.into();
25945 self
25946 }
25947
25948 /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
25949 ///
25950 /// # Example
25951 /// ```ignore,no_run
25952 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25953 /// let x = ListServingConfigsRequest::new().set_page_token("example");
25954 /// ```
25955 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25956 self.page_token = v.into();
25957 self
25958 }
25959}
25960
25961impl wkt::message::Message for ListServingConfigsRequest {
25962 fn typename() -> &'static str {
25963 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
25964 }
25965}
25966
25967/// Response for ListServingConfigs method.
25968#[derive(Clone, Default, PartialEq)]
25969#[non_exhaustive]
25970pub struct ListServingConfigsResponse {
25971 /// All the ServingConfigs for a given catalog.
25972 pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
25973
25974 /// Pagination token, if not returned indicates the last page.
25975 pub next_page_token: std::string::String,
25976
25977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25978}
25979
25980impl ListServingConfigsResponse {
25981 /// Creates a new default instance.
25982 pub fn new() -> Self {
25983 std::default::Default::default()
25984 }
25985
25986 /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
25987 ///
25988 /// # Example
25989 /// ```ignore,no_run
25990 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25991 /// use google_cloud_retail_v2::model::ServingConfig;
25992 /// let x = ListServingConfigsResponse::new()
25993 /// .set_serving_configs([
25994 /// ServingConfig::default()/* use setters */,
25995 /// ServingConfig::default()/* use (different) setters */,
25996 /// ]);
25997 /// ```
25998 pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
25999 where
26000 T: std::iter::IntoIterator<Item = V>,
26001 V: std::convert::Into<crate::model::ServingConfig>,
26002 {
26003 use std::iter::Iterator;
26004 self.serving_configs = v.into_iter().map(|i| i.into()).collect();
26005 self
26006 }
26007
26008 /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
26009 ///
26010 /// # Example
26011 /// ```ignore,no_run
26012 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
26013 /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
26014 /// ```
26015 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26016 self.next_page_token = v.into();
26017 self
26018 }
26019}
26020
26021impl wkt::message::Message for ListServingConfigsResponse {
26022 fn typename() -> &'static str {
26023 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
26024 }
26025}
26026
26027#[doc(hidden)]
26028impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
26029 type PageItem = crate::model::ServingConfig;
26030
26031 fn items(self) -> std::vec::Vec<Self::PageItem> {
26032 self.serving_configs
26033 }
26034
26035 fn next_page_token(&self) -> std::string::String {
26036 use std::clone::Clone;
26037 self.next_page_token.clone()
26038 }
26039}
26040
26041/// Request for AddControl method.
26042#[derive(Clone, Default, PartialEq)]
26043#[non_exhaustive]
26044pub struct AddControlRequest {
26045 /// Required. The source ServingConfig resource name . Format:
26046 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26047 pub serving_config: std::string::String,
26048
26049 /// Required. The id of the control to apply. Assumed to be in the same catalog
26050 /// as the serving config - if id is not found a NOT_FOUND error is returned.
26051 pub control_id: std::string::String,
26052
26053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26054}
26055
26056impl AddControlRequest {
26057 /// Creates a new default instance.
26058 pub fn new() -> Self {
26059 std::default::Default::default()
26060 }
26061
26062 /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
26063 ///
26064 /// # Example
26065 /// ```ignore,no_run
26066 /// # use google_cloud_retail_v2::model::AddControlRequest;
26067 /// let x = AddControlRequest::new().set_serving_config("example");
26068 /// ```
26069 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26070 self.serving_config = v.into();
26071 self
26072 }
26073
26074 /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
26075 ///
26076 /// # Example
26077 /// ```ignore,no_run
26078 /// # use google_cloud_retail_v2::model::AddControlRequest;
26079 /// let x = AddControlRequest::new().set_control_id("example");
26080 /// ```
26081 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26082 self.control_id = v.into();
26083 self
26084 }
26085}
26086
26087impl wkt::message::Message for AddControlRequest {
26088 fn typename() -> &'static str {
26089 "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
26090 }
26091}
26092
26093/// Request for RemoveControl method.
26094#[derive(Clone, Default, PartialEq)]
26095#[non_exhaustive]
26096pub struct RemoveControlRequest {
26097 /// Required. The source ServingConfig resource name . Format:
26098 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26099 pub serving_config: std::string::String,
26100
26101 /// Required. The id of the control to apply. Assumed to be in the same catalog
26102 /// as the serving config.
26103 pub control_id: std::string::String,
26104
26105 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26106}
26107
26108impl RemoveControlRequest {
26109 /// Creates a new default instance.
26110 pub fn new() -> Self {
26111 std::default::Default::default()
26112 }
26113
26114 /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
26115 ///
26116 /// # Example
26117 /// ```ignore,no_run
26118 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26119 /// let x = RemoveControlRequest::new().set_serving_config("example");
26120 /// ```
26121 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26122 self.serving_config = v.into();
26123 self
26124 }
26125
26126 /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
26127 ///
26128 /// # Example
26129 /// ```ignore,no_run
26130 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26131 /// let x = RemoveControlRequest::new().set_control_id("example");
26132 /// ```
26133 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26134 self.control_id = v.into();
26135 self
26136 }
26137}
26138
26139impl wkt::message::Message for RemoveControlRequest {
26140 fn typename() -> &'static str {
26141 "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
26142 }
26143}
26144
26145/// UserEvent captures all metadata information Retail API needs to know about
26146/// how end users interact with customers' website.
26147#[derive(Clone, Default, PartialEq)]
26148#[non_exhaustive]
26149pub struct UserEvent {
26150 /// Required. User event type. Allowed values are:
26151 ///
26152 /// * `add-to-cart`: Products being added to cart.
26153 /// * `remove-from-cart`: Products being removed from cart.
26154 /// * `category-page-view`: Special pages such as sale or promotion pages
26155 /// viewed.
26156 /// * `detail-page-view`: Products detail page viewed.
26157 /// * `home-page-view`: Homepage viewed.
26158 /// * `purchase-complete`: User finishing a purchase.
26159 /// * `search`: Product search.
26160 /// * `shopping-cart-page-view`: User viewing a shopping cart.
26161 pub event_type: std::string::String,
26162
26163 /// Required. A unique identifier for tracking visitors.
26164 ///
26165 /// For example, this could be implemented with an HTTP cookie, which should be
26166 /// able to uniquely identify a visitor on a single device. This unique
26167 /// identifier should not change if the visitor log in/out of the website.
26168 ///
26169 /// Don't set the field to the same fixed ID for different users. This mixes
26170 /// the event history of those users together, which results in degraded model
26171 /// quality.
26172 ///
26173 /// The field must be a UTF-8 encoded string with a length limit of 128
26174 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26175 ///
26176 /// The field should not contain PII or user-data. We recommend to use Google
26177 /// Analytics [Client
26178 /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
26179 /// for this field.
26180 pub visitor_id: std::string::String,
26181
26182 /// A unique identifier for tracking a visitor session with a length limit of
26183 /// 128 bytes. A session is an aggregation of an end user behavior in a time
26184 /// span.
26185 ///
26186 /// A general guideline to populate the session_id:
26187 ///
26188 /// 1. If user has no activity for 30 min, a new session_id should be assigned.
26189 /// 1. The session_id should be unique across users, suggest use uuid or add
26190 /// visitor_id as prefix.
26191 pub session_id: std::string::String,
26192
26193 /// Only required for
26194 /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
26195 /// method. Timestamp of when the user event happened.
26196 ///
26197 /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
26198 pub event_time: std::option::Option<wkt::Timestamp>,
26199
26200 /// A list of identifiers for the independent experiment groups this user event
26201 /// belongs to. This is used to distinguish between user events associated with
26202 /// different experiment setups (e.g. using Retail API, using different
26203 /// recommendation models).
26204 pub experiment_ids: std::vec::Vec<std::string::String>,
26205
26206 /// Highly recommended for user events that are the result of
26207 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26208 /// This field enables accurate attribution of recommendation model
26209 /// performance.
26210 ///
26211 /// The value must be a valid
26212 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26213 /// for user events that are the result of
26214 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26215 /// The value must be a valid
26216 /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26217 /// for user events that are the result of
26218 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26219 ///
26220 /// This token enables us to accurately attribute page view or purchase back to
26221 /// the event and the particular predict response containing this
26222 /// clicked/purchased product. If user clicks on product K in the
26223 /// recommendation results, pass
26224 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26225 /// as a URL parameter to product K's page. When recording events on product
26226 /// K's page, log the
26227 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26228 /// to this field.
26229 ///
26230 /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26231 /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26232 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26233 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26234 pub attribution_token: std::string::String,
26235
26236 /// The main product details related to the event.
26237 ///
26238 /// This field is optional except for the following event types:
26239 ///
26240 /// * `add-to-cart`
26241 /// * `detail-page-view`
26242 /// * `purchase-complete`
26243 ///
26244 /// In a `search` event, this field represents the products returned to the end
26245 /// user on the current page (the end user may have not finished browsing the
26246 /// whole page yet). When a new page is returned to the end user, after
26247 /// pagination/filtering/ordering even for the same query, a new `search` event
26248 /// with different
26249 /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26250 /// desired. The end user may have not finished browsing the whole page yet.
26251 ///
26252 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26253 pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26254
26255 /// The main auto-completion details related to the event.
26256 ///
26257 /// This field should be set for `search` event when autocomplete function is
26258 /// enabled and the user clicks a suggestion for search.
26259 pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26260
26261 /// Extra user event features to include in the recommendation model.
26262 ///
26263 /// If you provide custom attributes for ingested user events, also include
26264 /// them in the user events that you associate with prediction requests. Custom
26265 /// attribute formatting must be consistent between imported events and events
26266 /// provided with prediction requests. This lets the Retail API use
26267 /// those custom attributes when training models and serving predictions, which
26268 /// helps improve recommendation quality.
26269 ///
26270 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26271 /// error is returned:
26272 ///
26273 /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26274 /// characters.
26275 /// * For text attributes, at most 400 values are allowed. Empty values are not
26276 /// allowed. Each value must be a UTF-8 encoded string with a length limit of
26277 /// 256 characters.
26278 /// * For number attributes, at most 400 values are allowed.
26279 ///
26280 /// For product recommendations, an example of extra user information is
26281 /// traffic_channel, which is how a user arrives at the site. Users can arrive
26282 /// at the site by coming to the site directly, coming through Google
26283 /// search, or in other ways.
26284 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26285
26286 /// The ID or name of the associated shopping cart. This ID is used
26287 /// to associate multiple items added or present in the cart before purchase.
26288 ///
26289 /// This can only be set for `add-to-cart`, `purchase-complete`, or
26290 /// `shopping-cart-page-view` events.
26291 pub cart_id: std::string::String,
26292
26293 /// A transaction represents the entire purchase transaction.
26294 ///
26295 /// Required for `purchase-complete` events. Other event types should not set
26296 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26297 pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26298
26299 /// The user's search query.
26300 ///
26301 /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26302 /// definition.
26303 ///
26304 /// The value must be a UTF-8 encoded string with a length limit of 5,000
26305 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26306 ///
26307 /// At least one of
26308 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26309 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26310 /// required for `search` events. Other event types should not set this field.
26311 /// Otherwise, an INVALID_ARGUMENT error is returned.
26312 ///
26313 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26314 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26315 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26316 pub search_query: std::string::String,
26317
26318 /// The filter syntax consists of an expression language for constructing a
26319 /// predicate from one or more fields of the products being filtered.
26320 ///
26321 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26322 /// definition and syntax.
26323 ///
26324 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26325 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26326 ///
26327 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26328 pub filter: std::string::String,
26329
26330 /// The order in which products are returned.
26331 ///
26332 /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26333 /// for definition and syntax.
26334 ///
26335 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26336 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26337 ///
26338 /// This can only be set for `search` events. Other event types should not set
26339 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26340 ///
26341 /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26342 pub order_by: std::string::String,
26343
26344 /// An integer that specifies the current offset for pagination (the 0-indexed
26345 /// starting location, amongst the products deemed by the API as relevant).
26346 ///
26347 /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26348 /// definition.
26349 ///
26350 /// If this field is negative, an INVALID_ARGUMENT is returned.
26351 ///
26352 /// This can only be set for `search` events. Other event types should not set
26353 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26354 ///
26355 /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26356 pub offset: i32,
26357
26358 /// The categories associated with a category page.
26359 ///
26360 /// To represent full path of category, use '>' sign to separate different
26361 /// hierarchies. If '>' is part of the category name, replace it with
26362 /// other character(s).
26363 ///
26364 /// Category pages include special pages such as sales or promotions. For
26365 /// instance, a special sale page may have the category hierarchy:
26366 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26367 ///
26368 /// Required for `category-page-view` events. At least one of
26369 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26370 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26371 /// required for `search` events. Other event types should not set this field.
26372 /// Otherwise, an INVALID_ARGUMENT error is returned.
26373 ///
26374 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26375 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26376 pub page_categories: std::vec::Vec<std::string::String>,
26377
26378 /// User information.
26379 pub user_info: std::option::Option<crate::model::UserInfo>,
26380
26381 /// Complete URL (window.location.href) of the user's current page.
26382 ///
26383 /// When using the client side event reporting with JavaScript pixel and Google
26384 /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26385 /// characters.
26386 pub uri: std::string::String,
26387
26388 /// The referrer URL of the current page.
26389 ///
26390 /// When using the client side event reporting with JavaScript pixel and Google
26391 /// Tag Manager, this value is filled in automatically.
26392 pub referrer_uri: std::string::String,
26393
26394 /// A unique ID of a web page view.
26395 ///
26396 /// This should be kept the same for all user events triggered from the same
26397 /// pageview. For example, an item detail page view could trigger multiple
26398 /// events as the user is browsing the page. The `pageViewId` property should
26399 /// be kept the same for all these events so that they can be grouped together
26400 /// properly.
26401 ///
26402 /// When using the client side event reporting with JavaScript pixel and Google
26403 /// Tag Manager, this value is filled in automatically.
26404 pub page_view_id: std::string::String,
26405
26406 /// The entity for customers that may run multiple different entities, domains,
26407 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26408 /// `google.com`, `youtube.com`, etc.
26409 /// We recommend that you set this field to get better per-entity search,
26410 /// completion, and prediction results.
26411 pub entity: std::string::String,
26412
26413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26414}
26415
26416impl UserEvent {
26417 /// Creates a new default instance.
26418 pub fn new() -> Self {
26419 std::default::Default::default()
26420 }
26421
26422 /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26423 ///
26424 /// # Example
26425 /// ```ignore,no_run
26426 /// # use google_cloud_retail_v2::model::UserEvent;
26427 /// let x = UserEvent::new().set_event_type("example");
26428 /// ```
26429 pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26430 self.event_type = v.into();
26431 self
26432 }
26433
26434 /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26435 ///
26436 /// # Example
26437 /// ```ignore,no_run
26438 /// # use google_cloud_retail_v2::model::UserEvent;
26439 /// let x = UserEvent::new().set_visitor_id("example");
26440 /// ```
26441 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26442 self.visitor_id = v.into();
26443 self
26444 }
26445
26446 /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26447 ///
26448 /// # Example
26449 /// ```ignore,no_run
26450 /// # use google_cloud_retail_v2::model::UserEvent;
26451 /// let x = UserEvent::new().set_session_id("example");
26452 /// ```
26453 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26454 self.session_id = v.into();
26455 self
26456 }
26457
26458 /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26459 ///
26460 /// # Example
26461 /// ```ignore,no_run
26462 /// # use google_cloud_retail_v2::model::UserEvent;
26463 /// use wkt::Timestamp;
26464 /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26465 /// ```
26466 pub fn set_event_time<T>(mut self, v: T) -> Self
26467 where
26468 T: std::convert::Into<wkt::Timestamp>,
26469 {
26470 self.event_time = std::option::Option::Some(v.into());
26471 self
26472 }
26473
26474 /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26475 ///
26476 /// # Example
26477 /// ```ignore,no_run
26478 /// # use google_cloud_retail_v2::model::UserEvent;
26479 /// use wkt::Timestamp;
26480 /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26481 /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26482 /// ```
26483 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26484 where
26485 T: std::convert::Into<wkt::Timestamp>,
26486 {
26487 self.event_time = v.map(|x| x.into());
26488 self
26489 }
26490
26491 /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26492 ///
26493 /// # Example
26494 /// ```ignore,no_run
26495 /// # use google_cloud_retail_v2::model::UserEvent;
26496 /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26497 /// ```
26498 pub fn set_experiment_ids<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.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26505 self
26506 }
26507
26508 /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26509 ///
26510 /// # Example
26511 /// ```ignore,no_run
26512 /// # use google_cloud_retail_v2::model::UserEvent;
26513 /// let x = UserEvent::new().set_attribution_token("example");
26514 /// ```
26515 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26516 mut self,
26517 v: T,
26518 ) -> Self {
26519 self.attribution_token = v.into();
26520 self
26521 }
26522
26523 /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26524 ///
26525 /// # Example
26526 /// ```ignore,no_run
26527 /// # use google_cloud_retail_v2::model::UserEvent;
26528 /// use google_cloud_retail_v2::model::ProductDetail;
26529 /// let x = UserEvent::new()
26530 /// .set_product_details([
26531 /// ProductDetail::default()/* use setters */,
26532 /// ProductDetail::default()/* use (different) setters */,
26533 /// ]);
26534 /// ```
26535 pub fn set_product_details<T, V>(mut self, v: T) -> Self
26536 where
26537 T: std::iter::IntoIterator<Item = V>,
26538 V: std::convert::Into<crate::model::ProductDetail>,
26539 {
26540 use std::iter::Iterator;
26541 self.product_details = v.into_iter().map(|i| i.into()).collect();
26542 self
26543 }
26544
26545 /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26546 ///
26547 /// # Example
26548 /// ```ignore,no_run
26549 /// # use google_cloud_retail_v2::model::UserEvent;
26550 /// use google_cloud_retail_v2::model::CompletionDetail;
26551 /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26552 /// ```
26553 pub fn set_completion_detail<T>(mut self, v: T) -> Self
26554 where
26555 T: std::convert::Into<crate::model::CompletionDetail>,
26556 {
26557 self.completion_detail = std::option::Option::Some(v.into());
26558 self
26559 }
26560
26561 /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26562 ///
26563 /// # Example
26564 /// ```ignore,no_run
26565 /// # use google_cloud_retail_v2::model::UserEvent;
26566 /// use google_cloud_retail_v2::model::CompletionDetail;
26567 /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26568 /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26569 /// ```
26570 pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26571 where
26572 T: std::convert::Into<crate::model::CompletionDetail>,
26573 {
26574 self.completion_detail = v.map(|x| x.into());
26575 self
26576 }
26577
26578 /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26579 ///
26580 /// # Example
26581 /// ```ignore,no_run
26582 /// # use google_cloud_retail_v2::model::UserEvent;
26583 /// use google_cloud_retail_v2::model::CustomAttribute;
26584 /// let x = UserEvent::new().set_attributes([
26585 /// ("key0", CustomAttribute::default()/* use setters */),
26586 /// ("key1", CustomAttribute::default()/* use (different) setters */),
26587 /// ]);
26588 /// ```
26589 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26590 where
26591 T: std::iter::IntoIterator<Item = (K, V)>,
26592 K: std::convert::Into<std::string::String>,
26593 V: std::convert::Into<crate::model::CustomAttribute>,
26594 {
26595 use std::iter::Iterator;
26596 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26597 self
26598 }
26599
26600 /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26601 ///
26602 /// # Example
26603 /// ```ignore,no_run
26604 /// # use google_cloud_retail_v2::model::UserEvent;
26605 /// let x = UserEvent::new().set_cart_id("example");
26606 /// ```
26607 pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26608 self.cart_id = v.into();
26609 self
26610 }
26611
26612 /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26613 ///
26614 /// # Example
26615 /// ```ignore,no_run
26616 /// # use google_cloud_retail_v2::model::UserEvent;
26617 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26618 /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26619 /// ```
26620 pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26621 where
26622 T: std::convert::Into<crate::model::PurchaseTransaction>,
26623 {
26624 self.purchase_transaction = std::option::Option::Some(v.into());
26625 self
26626 }
26627
26628 /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26629 ///
26630 /// # Example
26631 /// ```ignore,no_run
26632 /// # use google_cloud_retail_v2::model::UserEvent;
26633 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26634 /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26635 /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26636 /// ```
26637 pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26638 where
26639 T: std::convert::Into<crate::model::PurchaseTransaction>,
26640 {
26641 self.purchase_transaction = v.map(|x| x.into());
26642 self
26643 }
26644
26645 /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26646 ///
26647 /// # Example
26648 /// ```ignore,no_run
26649 /// # use google_cloud_retail_v2::model::UserEvent;
26650 /// let x = UserEvent::new().set_search_query("example");
26651 /// ```
26652 pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26653 self.search_query = v.into();
26654 self
26655 }
26656
26657 /// Sets the value of [filter][crate::model::UserEvent::filter].
26658 ///
26659 /// # Example
26660 /// ```ignore,no_run
26661 /// # use google_cloud_retail_v2::model::UserEvent;
26662 /// let x = UserEvent::new().set_filter("example");
26663 /// ```
26664 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26665 self.filter = v.into();
26666 self
26667 }
26668
26669 /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26670 ///
26671 /// # Example
26672 /// ```ignore,no_run
26673 /// # use google_cloud_retail_v2::model::UserEvent;
26674 /// let x = UserEvent::new().set_order_by("example");
26675 /// ```
26676 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26677 self.order_by = v.into();
26678 self
26679 }
26680
26681 /// Sets the value of [offset][crate::model::UserEvent::offset].
26682 ///
26683 /// # Example
26684 /// ```ignore,no_run
26685 /// # use google_cloud_retail_v2::model::UserEvent;
26686 /// let x = UserEvent::new().set_offset(42);
26687 /// ```
26688 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26689 self.offset = v.into();
26690 self
26691 }
26692
26693 /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26694 ///
26695 /// # Example
26696 /// ```ignore,no_run
26697 /// # use google_cloud_retail_v2::model::UserEvent;
26698 /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26699 /// ```
26700 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26701 where
26702 T: std::iter::IntoIterator<Item = V>,
26703 V: std::convert::Into<std::string::String>,
26704 {
26705 use std::iter::Iterator;
26706 self.page_categories = v.into_iter().map(|i| i.into()).collect();
26707 self
26708 }
26709
26710 /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26711 ///
26712 /// # Example
26713 /// ```ignore,no_run
26714 /// # use google_cloud_retail_v2::model::UserEvent;
26715 /// use google_cloud_retail_v2::model::UserInfo;
26716 /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26717 /// ```
26718 pub fn set_user_info<T>(mut self, v: T) -> Self
26719 where
26720 T: std::convert::Into<crate::model::UserInfo>,
26721 {
26722 self.user_info = std::option::Option::Some(v.into());
26723 self
26724 }
26725
26726 /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26727 ///
26728 /// # Example
26729 /// ```ignore,no_run
26730 /// # use google_cloud_retail_v2::model::UserEvent;
26731 /// use google_cloud_retail_v2::model::UserInfo;
26732 /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26733 /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26734 /// ```
26735 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26736 where
26737 T: std::convert::Into<crate::model::UserInfo>,
26738 {
26739 self.user_info = v.map(|x| x.into());
26740 self
26741 }
26742
26743 /// Sets the value of [uri][crate::model::UserEvent::uri].
26744 ///
26745 /// # Example
26746 /// ```ignore,no_run
26747 /// # use google_cloud_retail_v2::model::UserEvent;
26748 /// let x = UserEvent::new().set_uri("example");
26749 /// ```
26750 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26751 self.uri = v.into();
26752 self
26753 }
26754
26755 /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26756 ///
26757 /// # Example
26758 /// ```ignore,no_run
26759 /// # use google_cloud_retail_v2::model::UserEvent;
26760 /// let x = UserEvent::new().set_referrer_uri("example");
26761 /// ```
26762 pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26763 self.referrer_uri = v.into();
26764 self
26765 }
26766
26767 /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26768 ///
26769 /// # Example
26770 /// ```ignore,no_run
26771 /// # use google_cloud_retail_v2::model::UserEvent;
26772 /// let x = UserEvent::new().set_page_view_id("example");
26773 /// ```
26774 pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26775 self.page_view_id = v.into();
26776 self
26777 }
26778
26779 /// Sets the value of [entity][crate::model::UserEvent::entity].
26780 ///
26781 /// # Example
26782 /// ```ignore,no_run
26783 /// # use google_cloud_retail_v2::model::UserEvent;
26784 /// let x = UserEvent::new().set_entity("example");
26785 /// ```
26786 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26787 self.entity = v.into();
26788 self
26789 }
26790}
26791
26792impl wkt::message::Message for UserEvent {
26793 fn typename() -> &'static str {
26794 "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26795 }
26796}
26797
26798/// Detailed product information associated with a user event.
26799#[derive(Clone, Default, PartialEq)]
26800#[non_exhaustive]
26801pub struct ProductDetail {
26802 /// Required. [Product][google.cloud.retail.v2.Product] information.
26803 ///
26804 /// Required field(s):
26805 ///
26806 /// * [Product.id][google.cloud.retail.v2.Product.id]
26807 ///
26808 /// Optional override field(s):
26809 ///
26810 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26811 ///
26812 /// If any supported optional fields are provided, we will treat them as a full
26813 /// override when looking up product information from the catalog. Thus, it is
26814 /// important to ensure that the overriding fields are accurate and
26815 /// complete.
26816 ///
26817 /// All other product fields are ignored and instead populated via catalog
26818 /// lookup after event ingestion.
26819 ///
26820 /// [google.cloud.retail.v2.Product]: crate::model::Product
26821 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26822 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26823 pub product: std::option::Option<crate::model::Product>,
26824
26825 /// Quantity of the product associated with the user event.
26826 ///
26827 /// For example, this field will be 2 if two products are added to the shopping
26828 /// cart for `purchase-complete` event. Required for `add-to-cart` and
26829 /// `purchase-complete` event types.
26830 pub quantity: std::option::Option<wkt::Int32Value>,
26831
26832 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26833}
26834
26835impl ProductDetail {
26836 /// Creates a new default instance.
26837 pub fn new() -> Self {
26838 std::default::Default::default()
26839 }
26840
26841 /// Sets the value of [product][crate::model::ProductDetail::product].
26842 ///
26843 /// # Example
26844 /// ```ignore,no_run
26845 /// # use google_cloud_retail_v2::model::ProductDetail;
26846 /// use google_cloud_retail_v2::model::Product;
26847 /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
26848 /// ```
26849 pub fn set_product<T>(mut self, v: T) -> Self
26850 where
26851 T: std::convert::Into<crate::model::Product>,
26852 {
26853 self.product = std::option::Option::Some(v.into());
26854 self
26855 }
26856
26857 /// Sets or clears the value of [product][crate::model::ProductDetail::product].
26858 ///
26859 /// # Example
26860 /// ```ignore,no_run
26861 /// # use google_cloud_retail_v2::model::ProductDetail;
26862 /// use google_cloud_retail_v2::model::Product;
26863 /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
26864 /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
26865 /// ```
26866 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
26867 where
26868 T: std::convert::Into<crate::model::Product>,
26869 {
26870 self.product = v.map(|x| x.into());
26871 self
26872 }
26873
26874 /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
26875 ///
26876 /// # Example
26877 /// ```ignore,no_run
26878 /// # use google_cloud_retail_v2::model::ProductDetail;
26879 /// use wkt::Int32Value;
26880 /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
26881 /// ```
26882 pub fn set_quantity<T>(mut self, v: T) -> Self
26883 where
26884 T: std::convert::Into<wkt::Int32Value>,
26885 {
26886 self.quantity = std::option::Option::Some(v.into());
26887 self
26888 }
26889
26890 /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
26891 ///
26892 /// # Example
26893 /// ```ignore,no_run
26894 /// # use google_cloud_retail_v2::model::ProductDetail;
26895 /// use wkt::Int32Value;
26896 /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
26897 /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
26898 /// ```
26899 pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
26900 where
26901 T: std::convert::Into<wkt::Int32Value>,
26902 {
26903 self.quantity = v.map(|x| x.into());
26904 self
26905 }
26906}
26907
26908impl wkt::message::Message for ProductDetail {
26909 fn typename() -> &'static str {
26910 "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
26911 }
26912}
26913
26914/// Detailed completion information including completion attribution token and
26915/// clicked completion info.
26916#[derive(Clone, Default, PartialEq)]
26917#[non_exhaustive]
26918pub struct CompletionDetail {
26919 /// Completion attribution token in
26920 /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
26921 ///
26922 /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
26923 pub completion_attribution_token: std::string::String,
26924
26925 /// End user selected
26926 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
26927 ///
26928 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26929 pub selected_suggestion: std::string::String,
26930
26931 /// End user selected
26932 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
26933 /// position, starting from 0.
26934 ///
26935 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26936 pub selected_position: i32,
26937
26938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26939}
26940
26941impl CompletionDetail {
26942 /// Creates a new default instance.
26943 pub fn new() -> Self {
26944 std::default::Default::default()
26945 }
26946
26947 /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
26948 ///
26949 /// # Example
26950 /// ```ignore,no_run
26951 /// # use google_cloud_retail_v2::model::CompletionDetail;
26952 /// let x = CompletionDetail::new().set_completion_attribution_token("example");
26953 /// ```
26954 pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
26955 mut self,
26956 v: T,
26957 ) -> Self {
26958 self.completion_attribution_token = v.into();
26959 self
26960 }
26961
26962 /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
26963 ///
26964 /// # Example
26965 /// ```ignore,no_run
26966 /// # use google_cloud_retail_v2::model::CompletionDetail;
26967 /// let x = CompletionDetail::new().set_selected_suggestion("example");
26968 /// ```
26969 pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
26970 mut self,
26971 v: T,
26972 ) -> Self {
26973 self.selected_suggestion = v.into();
26974 self
26975 }
26976
26977 /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
26978 ///
26979 /// # Example
26980 /// ```ignore,no_run
26981 /// # use google_cloud_retail_v2::model::CompletionDetail;
26982 /// let x = CompletionDetail::new().set_selected_position(42);
26983 /// ```
26984 pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26985 self.selected_position = v.into();
26986 self
26987 }
26988}
26989
26990impl wkt::message::Message for CompletionDetail {
26991 fn typename() -> &'static str {
26992 "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
26993 }
26994}
26995
26996/// A transaction represents the entire purchase transaction.
26997#[derive(Clone, Default, PartialEq)]
26998#[non_exhaustive]
26999pub struct PurchaseTransaction {
27000 /// The transaction ID with a length limit of 128 characters.
27001 pub id: std::string::String,
27002
27003 /// Required. Total non-zero revenue or grand total associated with the
27004 /// transaction. This value include shipping, tax, or other adjustments to
27005 /// total revenue that you want to include as part of your revenue
27006 /// calculations.
27007 pub revenue: f32,
27008
27009 /// All the taxes associated with the transaction.
27010 pub tax: f32,
27011
27012 /// All the costs associated with the products. These can be manufacturing
27013 /// costs, shipping expenses not borne by the end user, or any other costs,
27014 /// such that:
27015 ///
27016 /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
27017 /// [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
27018 /// [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
27019 ///
27020 /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
27021 /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
27022 /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
27023 pub cost: f32,
27024
27025 /// Required. Currency code. Use three-character ISO-4217 code.
27026 pub currency_code: std::string::String,
27027
27028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27029}
27030
27031impl PurchaseTransaction {
27032 /// Creates a new default instance.
27033 pub fn new() -> Self {
27034 std::default::Default::default()
27035 }
27036
27037 /// Sets the value of [id][crate::model::PurchaseTransaction::id].
27038 ///
27039 /// # Example
27040 /// ```ignore,no_run
27041 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27042 /// let x = PurchaseTransaction::new().set_id("example");
27043 /// ```
27044 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27045 self.id = v.into();
27046 self
27047 }
27048
27049 /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
27050 ///
27051 /// # Example
27052 /// ```ignore,no_run
27053 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27054 /// let x = PurchaseTransaction::new().set_revenue(42.0);
27055 /// ```
27056 pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27057 self.revenue = v.into();
27058 self
27059 }
27060
27061 /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
27062 ///
27063 /// # Example
27064 /// ```ignore,no_run
27065 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27066 /// let x = PurchaseTransaction::new().set_tax(42.0);
27067 /// ```
27068 pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27069 self.tax = v.into();
27070 self
27071 }
27072
27073 /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
27074 ///
27075 /// # Example
27076 /// ```ignore,no_run
27077 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27078 /// let x = PurchaseTransaction::new().set_cost(42.0);
27079 /// ```
27080 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27081 self.cost = v.into();
27082 self
27083 }
27084
27085 /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
27086 ///
27087 /// # Example
27088 /// ```ignore,no_run
27089 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27090 /// let x = PurchaseTransaction::new().set_currency_code("example");
27091 /// ```
27092 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27093 self.currency_code = v.into();
27094 self
27095 }
27096}
27097
27098impl wkt::message::Message for PurchaseTransaction {
27099 fn typename() -> &'static str {
27100 "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
27101 }
27102}
27103
27104/// Request message for WriteUserEvent method.
27105#[derive(Clone, Default, PartialEq)]
27106#[non_exhaustive]
27107pub struct WriteUserEventRequest {
27108 /// Required. The parent catalog resource name, such as
27109 /// `projects/1234/locations/global/catalogs/default_catalog`.
27110 pub parent: std::string::String,
27111
27112 /// Required. User event to write.
27113 pub user_event: std::option::Option<crate::model::UserEvent>,
27114
27115 /// If set to true, the user event will be written asynchronously after
27116 /// validation, and the API will respond without waiting for the write.
27117 /// Therefore, silent failures can occur even if the API returns success. In
27118 /// case of silent failures, error messages can be found in Stackdriver logs.
27119 pub write_async: bool,
27120
27121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27122}
27123
27124impl WriteUserEventRequest {
27125 /// Creates a new default instance.
27126 pub fn new() -> Self {
27127 std::default::Default::default()
27128 }
27129
27130 /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
27131 ///
27132 /// # Example
27133 /// ```ignore,no_run
27134 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27135 /// let x = WriteUserEventRequest::new().set_parent("example");
27136 /// ```
27137 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27138 self.parent = v.into();
27139 self
27140 }
27141
27142 /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27143 ///
27144 /// # Example
27145 /// ```ignore,no_run
27146 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27147 /// use google_cloud_retail_v2::model::UserEvent;
27148 /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
27149 /// ```
27150 pub fn set_user_event<T>(mut self, v: T) -> Self
27151 where
27152 T: std::convert::Into<crate::model::UserEvent>,
27153 {
27154 self.user_event = std::option::Option::Some(v.into());
27155 self
27156 }
27157
27158 /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27159 ///
27160 /// # Example
27161 /// ```ignore,no_run
27162 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27163 /// use google_cloud_retail_v2::model::UserEvent;
27164 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
27165 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
27166 /// ```
27167 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
27168 where
27169 T: std::convert::Into<crate::model::UserEvent>,
27170 {
27171 self.user_event = v.map(|x| x.into());
27172 self
27173 }
27174
27175 /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
27176 ///
27177 /// # Example
27178 /// ```ignore,no_run
27179 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27180 /// let x = WriteUserEventRequest::new().set_write_async(true);
27181 /// ```
27182 pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
27183 self.write_async = v.into();
27184 self
27185 }
27186}
27187
27188impl wkt::message::Message for WriteUserEventRequest {
27189 fn typename() -> &'static str {
27190 "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
27191 }
27192}
27193
27194/// Request message for CollectUserEvent method.
27195#[derive(Clone, Default, PartialEq)]
27196#[non_exhaustive]
27197pub struct CollectUserEventRequest {
27198 /// Required. The parent catalog name, such as
27199 /// `projects/1234/locations/global/catalogs/default_catalog`.
27200 pub parent: std::string::String,
27201
27202 /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
27203 /// characters.
27204 pub user_event: std::string::String,
27205
27206 /// The URL including cgi-parameters but excluding the hash fragment with a
27207 /// length limit of 5,000 characters. This is often more useful than the
27208 /// referer URL, because many browsers only send the domain for 3rd party
27209 /// requests.
27210 pub uri: std::string::String,
27211
27212 /// The event timestamp in milliseconds. This prevents browser caching of
27213 /// otherwise identical get requests. The name is abbreviated to reduce the
27214 /// payload bytes.
27215 pub ets: i64,
27216
27217 /// An arbitrary serialized JSON string that contains necessary information
27218 /// that can comprise a user event. When this field is specified, the
27219 /// user_event field will be ignored. Note: line-delimited JSON is not
27220 /// supported, a single JSON only.
27221 pub raw_json: std::string::String,
27222
27223 /// The rule that can convert the raw_json to a user event. It is needed
27224 /// only when the raw_json is set.
27225 pub conversion_rule:
27226 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27227
27228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27229}
27230
27231impl CollectUserEventRequest {
27232 /// Creates a new default instance.
27233 pub fn new() -> Self {
27234 std::default::Default::default()
27235 }
27236
27237 /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27238 ///
27239 /// # Example
27240 /// ```ignore,no_run
27241 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27242 /// let x = CollectUserEventRequest::new().set_parent("example");
27243 /// ```
27244 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27245 self.parent = v.into();
27246 self
27247 }
27248
27249 /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27250 ///
27251 /// # Example
27252 /// ```ignore,no_run
27253 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27254 /// let x = CollectUserEventRequest::new().set_user_event("example");
27255 /// ```
27256 pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27257 self.user_event = v.into();
27258 self
27259 }
27260
27261 /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27262 ///
27263 /// # Example
27264 /// ```ignore,no_run
27265 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27266 /// let x = CollectUserEventRequest::new().set_uri("example");
27267 /// ```
27268 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27269 self.uri = v.into();
27270 self
27271 }
27272
27273 /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27274 ///
27275 /// # Example
27276 /// ```ignore,no_run
27277 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27278 /// let x = CollectUserEventRequest::new().set_ets(42);
27279 /// ```
27280 pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27281 self.ets = v.into();
27282 self
27283 }
27284
27285 /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27286 ///
27287 /// # Example
27288 /// ```ignore,no_run
27289 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27290 /// let x = CollectUserEventRequest::new().set_raw_json("example");
27291 /// ```
27292 pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27293 self.raw_json = v.into();
27294 self
27295 }
27296
27297 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27298 ///
27299 /// Note that all the setters affecting `conversion_rule` are mutually
27300 /// exclusive.
27301 ///
27302 /// # Example
27303 /// ```ignore,no_run
27304 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27305 /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27306 /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27307 /// ```
27308 pub fn set_conversion_rule<
27309 T: std::convert::Into<
27310 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27311 >,
27312 >(
27313 mut self,
27314 v: T,
27315 ) -> Self {
27316 self.conversion_rule = v.into();
27317 self
27318 }
27319
27320 /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27321 /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27322 /// holds a different branch.
27323 pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27324 #[allow(unreachable_patterns)]
27325 self.conversion_rule.as_ref().and_then(|v| match v {
27326 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27327 std::option::Option::Some(v)
27328 }
27329 _ => std::option::Option::None,
27330 })
27331 }
27332
27333 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27334 /// to hold a `PrebuiltRule`.
27335 ///
27336 /// Note that all the setters affecting `conversion_rule` are
27337 /// mutually exclusive.
27338 ///
27339 /// # Example
27340 /// ```ignore,no_run
27341 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27342 /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27343 /// assert!(x.prebuilt_rule().is_some());
27344 /// ```
27345 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27346 self.conversion_rule = std::option::Option::Some(
27347 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27348 );
27349 self
27350 }
27351}
27352
27353impl wkt::message::Message for CollectUserEventRequest {
27354 fn typename() -> &'static str {
27355 "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27356 }
27357}
27358
27359/// Defines additional types related to [CollectUserEventRequest].
27360pub mod collect_user_event_request {
27361 #[allow(unused_imports)]
27362 use super::*;
27363
27364 /// The rule that can convert the raw_json to a user event. It is needed
27365 /// only when the raw_json is set.
27366 #[derive(Clone, Debug, PartialEq)]
27367 #[non_exhaustive]
27368 pub enum ConversionRule {
27369 /// The prebuilt rule name that can convert a specific type of raw_json.
27370 /// For example: "ga4_bq" rule for the GA4 user event schema.
27371 PrebuiltRule(std::string::String),
27372 }
27373}
27374
27375/// Request message for RejoinUserEvents method.
27376#[derive(Clone, Default, PartialEq)]
27377#[non_exhaustive]
27378pub struct RejoinUserEventsRequest {
27379 /// Required. The parent catalog resource name, such as
27380 /// `projects/1234/locations/global/catalogs/default_catalog`.
27381 pub parent: std::string::String,
27382
27383 /// The type of the user event rejoin to define the scope and range of the user
27384 /// events to be rejoined with the latest product catalog. Defaults to
27385 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27386 /// an invalid integer value.
27387 pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27388
27389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27390}
27391
27392impl RejoinUserEventsRequest {
27393 /// Creates a new default instance.
27394 pub fn new() -> Self {
27395 std::default::Default::default()
27396 }
27397
27398 /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27399 ///
27400 /// # Example
27401 /// ```ignore,no_run
27402 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27403 /// let x = RejoinUserEventsRequest::new().set_parent("example");
27404 /// ```
27405 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27406 self.parent = v.into();
27407 self
27408 }
27409
27410 /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27411 ///
27412 /// # Example
27413 /// ```ignore,no_run
27414 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27415 /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27416 /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27417 /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27418 /// ```
27419 pub fn set_user_event_rejoin_scope<
27420 T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27421 >(
27422 mut self,
27423 v: T,
27424 ) -> Self {
27425 self.user_event_rejoin_scope = v.into();
27426 self
27427 }
27428}
27429
27430impl wkt::message::Message for RejoinUserEventsRequest {
27431 fn typename() -> &'static str {
27432 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27433 }
27434}
27435
27436/// Defines additional types related to [RejoinUserEventsRequest].
27437pub mod rejoin_user_events_request {
27438 #[allow(unused_imports)]
27439 use super::*;
27440
27441 /// The scope of user events to be rejoined with the latest product catalog.
27442 /// If the rejoining aims at reducing number of unjoined events, set
27443 /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27444 /// If the rejoining aims at correcting product catalog information in joined
27445 /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27446 /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27447 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27448 ///
27449 /// # Working with unknown values
27450 ///
27451 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27452 /// additional enum variants at any time. Adding new variants is not considered
27453 /// a breaking change. Applications should write their code in anticipation of:
27454 ///
27455 /// - New values appearing in future releases of the client library, **and**
27456 /// - New values received dynamically, without application changes.
27457 ///
27458 /// Please consult the [Working with enums] section in the user guide for some
27459 /// guidelines.
27460 ///
27461 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27462 #[derive(Clone, Debug, PartialEq)]
27463 #[non_exhaustive]
27464 pub enum UserEventRejoinScope {
27465 /// Rejoin all events with the latest product catalog, including both joined
27466 /// events and unjoined events.
27467 Unspecified,
27468 /// Only rejoin joined events with the latest product catalog.
27469 JoinedEvents,
27470 /// Only rejoin unjoined events with the latest product catalog.
27471 UnjoinedEvents,
27472 /// If set, the enum was initialized with an unknown value.
27473 ///
27474 /// Applications can examine the value using [UserEventRejoinScope::value] or
27475 /// [UserEventRejoinScope::name].
27476 UnknownValue(user_event_rejoin_scope::UnknownValue),
27477 }
27478
27479 #[doc(hidden)]
27480 pub mod user_event_rejoin_scope {
27481 #[allow(unused_imports)]
27482 use super::*;
27483 #[derive(Clone, Debug, PartialEq)]
27484 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27485 }
27486
27487 impl UserEventRejoinScope {
27488 /// Gets the enum value.
27489 ///
27490 /// Returns `None` if the enum contains an unknown value deserialized from
27491 /// the string representation of enums.
27492 pub fn value(&self) -> std::option::Option<i32> {
27493 match self {
27494 Self::Unspecified => std::option::Option::Some(0),
27495 Self::JoinedEvents => std::option::Option::Some(1),
27496 Self::UnjoinedEvents => std::option::Option::Some(2),
27497 Self::UnknownValue(u) => u.0.value(),
27498 }
27499 }
27500
27501 /// Gets the enum value as a string.
27502 ///
27503 /// Returns `None` if the enum contains an unknown value deserialized from
27504 /// the integer representation of enums.
27505 pub fn name(&self) -> std::option::Option<&str> {
27506 match self {
27507 Self::Unspecified => {
27508 std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27509 }
27510 Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27511 Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27512 Self::UnknownValue(u) => u.0.name(),
27513 }
27514 }
27515 }
27516
27517 impl std::default::Default for UserEventRejoinScope {
27518 fn default() -> Self {
27519 use std::convert::From;
27520 Self::from(0)
27521 }
27522 }
27523
27524 impl std::fmt::Display for UserEventRejoinScope {
27525 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27526 wkt::internal::display_enum(f, self.name(), self.value())
27527 }
27528 }
27529
27530 impl std::convert::From<i32> for UserEventRejoinScope {
27531 fn from(value: i32) -> Self {
27532 match value {
27533 0 => Self::Unspecified,
27534 1 => Self::JoinedEvents,
27535 2 => Self::UnjoinedEvents,
27536 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27537 wkt::internal::UnknownEnumValue::Integer(value),
27538 )),
27539 }
27540 }
27541 }
27542
27543 impl std::convert::From<&str> for UserEventRejoinScope {
27544 fn from(value: &str) -> Self {
27545 use std::string::ToString;
27546 match value {
27547 "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27548 "JOINED_EVENTS" => Self::JoinedEvents,
27549 "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27550 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27551 wkt::internal::UnknownEnumValue::String(value.to_string()),
27552 )),
27553 }
27554 }
27555 }
27556
27557 impl serde::ser::Serialize for UserEventRejoinScope {
27558 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27559 where
27560 S: serde::Serializer,
27561 {
27562 match self {
27563 Self::Unspecified => serializer.serialize_i32(0),
27564 Self::JoinedEvents => serializer.serialize_i32(1),
27565 Self::UnjoinedEvents => serializer.serialize_i32(2),
27566 Self::UnknownValue(u) => u.0.serialize(serializer),
27567 }
27568 }
27569 }
27570
27571 impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27572 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27573 where
27574 D: serde::Deserializer<'de>,
27575 {
27576 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27577 ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27578 ))
27579 }
27580 }
27581}
27582
27583/// Response message for `RejoinUserEvents` method.
27584#[derive(Clone, Default, PartialEq)]
27585#[non_exhaustive]
27586pub struct RejoinUserEventsResponse {
27587 /// Number of user events that were joined with latest product catalog.
27588 pub rejoined_user_events_count: i64,
27589
27590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27591}
27592
27593impl RejoinUserEventsResponse {
27594 /// Creates a new default instance.
27595 pub fn new() -> Self {
27596 std::default::Default::default()
27597 }
27598
27599 /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27600 ///
27601 /// # Example
27602 /// ```ignore,no_run
27603 /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27604 /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27605 /// ```
27606 pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27607 self.rejoined_user_events_count = v.into();
27608 self
27609 }
27610}
27611
27612impl wkt::message::Message for RejoinUserEventsResponse {
27613 fn typename() -> &'static str {
27614 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27615 }
27616}
27617
27618/// Metadata for `RejoinUserEvents` method.
27619#[derive(Clone, Default, PartialEq)]
27620#[non_exhaustive]
27621pub struct RejoinUserEventsMetadata {
27622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27623}
27624
27625impl RejoinUserEventsMetadata {
27626 /// Creates a new default instance.
27627 pub fn new() -> Self {
27628 std::default::Default::default()
27629 }
27630}
27631
27632impl wkt::message::Message for RejoinUserEventsMetadata {
27633 fn typename() -> &'static str {
27634 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27635 }
27636}
27637
27638/// At which level we offer configuration for attributes.
27639///
27640/// # Working with unknown values
27641///
27642/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27643/// additional enum variants at any time. Adding new variants is not considered
27644/// a breaking change. Applications should write their code in anticipation of:
27645///
27646/// - New values appearing in future releases of the client library, **and**
27647/// - New values received dynamically, without application changes.
27648///
27649/// Please consult the [Working with enums] section in the user guide for some
27650/// guidelines.
27651///
27652/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27653#[derive(Clone, Debug, PartialEq)]
27654#[non_exhaustive]
27655pub enum AttributeConfigLevel {
27656 /// Value used when unset. In this case, server behavior defaults to
27657 /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27658 ///
27659 /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27660 Unspecified,
27661 /// At this level, we honor the attribute configurations set in
27662 /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27663 ///
27664 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27665 ProductLevelAttributeConfig,
27666 /// At this level, we honor the attribute configurations set in
27667 /// `CatalogConfig.attribute_configs`.
27668 CatalogLevelAttributeConfig,
27669 /// If set, the enum was initialized with an unknown value.
27670 ///
27671 /// Applications can examine the value using [AttributeConfigLevel::value] or
27672 /// [AttributeConfigLevel::name].
27673 UnknownValue(attribute_config_level::UnknownValue),
27674}
27675
27676#[doc(hidden)]
27677pub mod attribute_config_level {
27678 #[allow(unused_imports)]
27679 use super::*;
27680 #[derive(Clone, Debug, PartialEq)]
27681 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27682}
27683
27684impl AttributeConfigLevel {
27685 /// Gets the enum value.
27686 ///
27687 /// Returns `None` if the enum contains an unknown value deserialized from
27688 /// the string representation of enums.
27689 pub fn value(&self) -> std::option::Option<i32> {
27690 match self {
27691 Self::Unspecified => std::option::Option::Some(0),
27692 Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27693 Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27694 Self::UnknownValue(u) => u.0.value(),
27695 }
27696 }
27697
27698 /// Gets the enum value as a string.
27699 ///
27700 /// Returns `None` if the enum contains an unknown value deserialized from
27701 /// the integer representation of enums.
27702 pub fn name(&self) -> std::option::Option<&str> {
27703 match self {
27704 Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27705 Self::ProductLevelAttributeConfig => {
27706 std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27707 }
27708 Self::CatalogLevelAttributeConfig => {
27709 std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27710 }
27711 Self::UnknownValue(u) => u.0.name(),
27712 }
27713 }
27714}
27715
27716impl std::default::Default for AttributeConfigLevel {
27717 fn default() -> Self {
27718 use std::convert::From;
27719 Self::from(0)
27720 }
27721}
27722
27723impl std::fmt::Display for AttributeConfigLevel {
27724 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27725 wkt::internal::display_enum(f, self.name(), self.value())
27726 }
27727}
27728
27729impl std::convert::From<i32> for AttributeConfigLevel {
27730 fn from(value: i32) -> Self {
27731 match value {
27732 0 => Self::Unspecified,
27733 1 => Self::ProductLevelAttributeConfig,
27734 2 => Self::CatalogLevelAttributeConfig,
27735 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27736 wkt::internal::UnknownEnumValue::Integer(value),
27737 )),
27738 }
27739 }
27740}
27741
27742impl std::convert::From<&str> for AttributeConfigLevel {
27743 fn from(value: &str) -> Self {
27744 use std::string::ToString;
27745 match value {
27746 "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27747 "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27748 "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27749 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27750 wkt::internal::UnknownEnumValue::String(value.to_string()),
27751 )),
27752 }
27753 }
27754}
27755
27756impl serde::ser::Serialize for AttributeConfigLevel {
27757 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27758 where
27759 S: serde::Serializer,
27760 {
27761 match self {
27762 Self::Unspecified => serializer.serialize_i32(0),
27763 Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27764 Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27765 Self::UnknownValue(u) => u.0.serialize(serializer),
27766 }
27767 }
27768}
27769
27770impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27771 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27772 where
27773 D: serde::Deserializer<'de>,
27774 {
27775 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27776 ".google.cloud.retail.v2.AttributeConfigLevel",
27777 ))
27778 }
27779}
27780
27781/// The type of solution.
27782///
27783/// # Working with unknown values
27784///
27785/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27786/// additional enum variants at any time. Adding new variants is not considered
27787/// a breaking change. Applications should write their code in anticipation of:
27788///
27789/// - New values appearing in future releases of the client library, **and**
27790/// - New values received dynamically, without application changes.
27791///
27792/// Please consult the [Working with enums] section in the user guide for some
27793/// guidelines.
27794///
27795/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27796#[derive(Clone, Debug, PartialEq)]
27797#[non_exhaustive]
27798pub enum SolutionType {
27799 /// Default value.
27800 Unspecified,
27801 /// Used for Recommendations AI.
27802 Recommendation,
27803 /// Used for Retail Search.
27804 Search,
27805 /// If set, the enum was initialized with an unknown value.
27806 ///
27807 /// Applications can examine the value using [SolutionType::value] or
27808 /// [SolutionType::name].
27809 UnknownValue(solution_type::UnknownValue),
27810}
27811
27812#[doc(hidden)]
27813pub mod solution_type {
27814 #[allow(unused_imports)]
27815 use super::*;
27816 #[derive(Clone, Debug, PartialEq)]
27817 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27818}
27819
27820impl SolutionType {
27821 /// Gets the enum value.
27822 ///
27823 /// Returns `None` if the enum contains an unknown value deserialized from
27824 /// the string representation of enums.
27825 pub fn value(&self) -> std::option::Option<i32> {
27826 match self {
27827 Self::Unspecified => std::option::Option::Some(0),
27828 Self::Recommendation => std::option::Option::Some(1),
27829 Self::Search => std::option::Option::Some(2),
27830 Self::UnknownValue(u) => u.0.value(),
27831 }
27832 }
27833
27834 /// Gets the enum value as a string.
27835 ///
27836 /// Returns `None` if the enum contains an unknown value deserialized from
27837 /// the integer representation of enums.
27838 pub fn name(&self) -> std::option::Option<&str> {
27839 match self {
27840 Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
27841 Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
27842 Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
27843 Self::UnknownValue(u) => u.0.name(),
27844 }
27845 }
27846}
27847
27848impl std::default::Default for SolutionType {
27849 fn default() -> Self {
27850 use std::convert::From;
27851 Self::from(0)
27852 }
27853}
27854
27855impl std::fmt::Display for SolutionType {
27856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27857 wkt::internal::display_enum(f, self.name(), self.value())
27858 }
27859}
27860
27861impl std::convert::From<i32> for SolutionType {
27862 fn from(value: i32) -> Self {
27863 match value {
27864 0 => Self::Unspecified,
27865 1 => Self::Recommendation,
27866 2 => Self::Search,
27867 _ => Self::UnknownValue(solution_type::UnknownValue(
27868 wkt::internal::UnknownEnumValue::Integer(value),
27869 )),
27870 }
27871 }
27872}
27873
27874impl std::convert::From<&str> for SolutionType {
27875 fn from(value: &str) -> Self {
27876 use std::string::ToString;
27877 match value {
27878 "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
27879 "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
27880 "SOLUTION_TYPE_SEARCH" => Self::Search,
27881 _ => Self::UnknownValue(solution_type::UnknownValue(
27882 wkt::internal::UnknownEnumValue::String(value.to_string()),
27883 )),
27884 }
27885 }
27886}
27887
27888impl serde::ser::Serialize for SolutionType {
27889 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27890 where
27891 S: serde::Serializer,
27892 {
27893 match self {
27894 Self::Unspecified => serializer.serialize_i32(0),
27895 Self::Recommendation => serializer.serialize_i32(1),
27896 Self::Search => serializer.serialize_i32(2),
27897 Self::UnknownValue(u) => u.0.serialize(serializer),
27898 }
27899 }
27900}
27901
27902impl<'de> serde::de::Deserialize<'de> for SolutionType {
27903 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27904 where
27905 D: serde::Deserializer<'de>,
27906 {
27907 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
27908 ".google.cloud.retail.v2.SolutionType",
27909 ))
27910 }
27911}
27912
27913/// If filtering for recommendations is enabled.
27914///
27915/// # Working with unknown values
27916///
27917/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27918/// additional enum variants at any time. Adding new variants is not considered
27919/// a breaking change. Applications should write their code in anticipation of:
27920///
27921/// - New values appearing in future releases of the client library, **and**
27922/// - New values received dynamically, without application changes.
27923///
27924/// Please consult the [Working with enums] section in the user guide for some
27925/// guidelines.
27926///
27927/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27928#[derive(Clone, Debug, PartialEq)]
27929#[non_exhaustive]
27930pub enum RecommendationsFilteringOption {
27931 /// Value used when unset.
27932 /// In this case, server behavior defaults to
27933 /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
27934 ///
27935 /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
27936 Unspecified,
27937 /// Recommendation filtering is disabled.
27938 RecommendationsFilteringDisabled,
27939 /// Recommendation filtering is enabled.
27940 RecommendationsFilteringEnabled,
27941 /// If set, the enum was initialized with an unknown value.
27942 ///
27943 /// Applications can examine the value using [RecommendationsFilteringOption::value] or
27944 /// [RecommendationsFilteringOption::name].
27945 UnknownValue(recommendations_filtering_option::UnknownValue),
27946}
27947
27948#[doc(hidden)]
27949pub mod recommendations_filtering_option {
27950 #[allow(unused_imports)]
27951 use super::*;
27952 #[derive(Clone, Debug, PartialEq)]
27953 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27954}
27955
27956impl RecommendationsFilteringOption {
27957 /// Gets the enum value.
27958 ///
27959 /// Returns `None` if the enum contains an unknown value deserialized from
27960 /// the string representation of enums.
27961 pub fn value(&self) -> std::option::Option<i32> {
27962 match self {
27963 Self::Unspecified => std::option::Option::Some(0),
27964 Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
27965 Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
27966 Self::UnknownValue(u) => u.0.value(),
27967 }
27968 }
27969
27970 /// Gets the enum value as a string.
27971 ///
27972 /// Returns `None` if the enum contains an unknown value deserialized from
27973 /// the integer representation of enums.
27974 pub fn name(&self) -> std::option::Option<&str> {
27975 match self {
27976 Self::Unspecified => {
27977 std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
27978 }
27979 Self::RecommendationsFilteringDisabled => {
27980 std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
27981 }
27982 Self::RecommendationsFilteringEnabled => {
27983 std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
27984 }
27985 Self::UnknownValue(u) => u.0.name(),
27986 }
27987 }
27988}
27989
27990impl std::default::Default for RecommendationsFilteringOption {
27991 fn default() -> Self {
27992 use std::convert::From;
27993 Self::from(0)
27994 }
27995}
27996
27997impl std::fmt::Display for RecommendationsFilteringOption {
27998 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27999 wkt::internal::display_enum(f, self.name(), self.value())
28000 }
28001}
28002
28003impl std::convert::From<i32> for RecommendationsFilteringOption {
28004 fn from(value: i32) -> Self {
28005 match value {
28006 0 => Self::Unspecified,
28007 1 => Self::RecommendationsFilteringDisabled,
28008 3 => Self::RecommendationsFilteringEnabled,
28009 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28010 wkt::internal::UnknownEnumValue::Integer(value),
28011 )),
28012 }
28013 }
28014}
28015
28016impl std::convert::From<&str> for RecommendationsFilteringOption {
28017 fn from(value: &str) -> Self {
28018 use std::string::ToString;
28019 match value {
28020 "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
28021 "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
28022 "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
28023 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28024 wkt::internal::UnknownEnumValue::String(value.to_string()),
28025 )),
28026 }
28027 }
28028}
28029
28030impl serde::ser::Serialize for RecommendationsFilteringOption {
28031 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28032 where
28033 S: serde::Serializer,
28034 {
28035 match self {
28036 Self::Unspecified => serializer.serialize_i32(0),
28037 Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
28038 Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
28039 Self::UnknownValue(u) => u.0.serialize(serializer),
28040 }
28041 }
28042}
28043
28044impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
28045 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28046 where
28047 D: serde::Deserializer<'de>,
28048 {
28049 deserializer.deserialize_any(
28050 wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
28051 ".google.cloud.retail.v2.RecommendationsFilteringOption",
28052 ),
28053 )
28054 }
28055}
28056
28057/// The use case of Cloud Retail Search.
28058///
28059/// # Working with unknown values
28060///
28061/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28062/// additional enum variants at any time. Adding new variants is not considered
28063/// a breaking change. Applications should write their code in anticipation of:
28064///
28065/// - New values appearing in future releases of the client library, **and**
28066/// - New values received dynamically, without application changes.
28067///
28068/// Please consult the [Working with enums] section in the user guide for some
28069/// guidelines.
28070///
28071/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28072#[derive(Clone, Debug, PartialEq)]
28073#[non_exhaustive]
28074pub enum SearchSolutionUseCase {
28075 /// The value when it's unspecified. In this case, server behavior defaults to
28076 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
28077 ///
28078 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
28079 Unspecified,
28080 /// Search use case. Expects the traffic has a non-empty
28081 /// [query][google.cloud.retail.v2.SearchRequest.query].
28082 ///
28083 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28084 Search,
28085 /// Browse use case. Expects the traffic has an empty
28086 /// [query][google.cloud.retail.v2.SearchRequest.query].
28087 ///
28088 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28089 Browse,
28090 /// If set, the enum was initialized with an unknown value.
28091 ///
28092 /// Applications can examine the value using [SearchSolutionUseCase::value] or
28093 /// [SearchSolutionUseCase::name].
28094 UnknownValue(search_solution_use_case::UnknownValue),
28095}
28096
28097#[doc(hidden)]
28098pub mod search_solution_use_case {
28099 #[allow(unused_imports)]
28100 use super::*;
28101 #[derive(Clone, Debug, PartialEq)]
28102 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28103}
28104
28105impl SearchSolutionUseCase {
28106 /// Gets the enum value.
28107 ///
28108 /// Returns `None` if the enum contains an unknown value deserialized from
28109 /// the string representation of enums.
28110 pub fn value(&self) -> std::option::Option<i32> {
28111 match self {
28112 Self::Unspecified => std::option::Option::Some(0),
28113 Self::Search => std::option::Option::Some(1),
28114 Self::Browse => std::option::Option::Some(2),
28115 Self::UnknownValue(u) => u.0.value(),
28116 }
28117 }
28118
28119 /// Gets the enum value as a string.
28120 ///
28121 /// Returns `None` if the enum contains an unknown value deserialized from
28122 /// the integer representation of enums.
28123 pub fn name(&self) -> std::option::Option<&str> {
28124 match self {
28125 Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
28126 Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
28127 Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
28128 Self::UnknownValue(u) => u.0.name(),
28129 }
28130 }
28131}
28132
28133impl std::default::Default for SearchSolutionUseCase {
28134 fn default() -> Self {
28135 use std::convert::From;
28136 Self::from(0)
28137 }
28138}
28139
28140impl std::fmt::Display for SearchSolutionUseCase {
28141 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28142 wkt::internal::display_enum(f, self.name(), self.value())
28143 }
28144}
28145
28146impl std::convert::From<i32> for SearchSolutionUseCase {
28147 fn from(value: i32) -> Self {
28148 match value {
28149 0 => Self::Unspecified,
28150 1 => Self::Search,
28151 2 => Self::Browse,
28152 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28153 wkt::internal::UnknownEnumValue::Integer(value),
28154 )),
28155 }
28156 }
28157}
28158
28159impl std::convert::From<&str> for SearchSolutionUseCase {
28160 fn from(value: &str) -> Self {
28161 use std::string::ToString;
28162 match value {
28163 "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
28164 "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
28165 "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
28166 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28167 wkt::internal::UnknownEnumValue::String(value.to_string()),
28168 )),
28169 }
28170 }
28171}
28172
28173impl serde::ser::Serialize for SearchSolutionUseCase {
28174 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28175 where
28176 S: serde::Serializer,
28177 {
28178 match self {
28179 Self::Unspecified => serializer.serialize_i32(0),
28180 Self::Search => serializer.serialize_i32(1),
28181 Self::Browse => serializer.serialize_i32(2),
28182 Self::UnknownValue(u) => u.0.serialize(serializer),
28183 }
28184 }
28185}
28186
28187impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
28188 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28189 where
28190 D: serde::Deserializer<'de>,
28191 {
28192 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
28193 ".google.cloud.retail.v2.SearchSolutionUseCase",
28194 ))
28195 }
28196}
28197
28198/// Harm categories that will block the content.
28199///
28200/// # Working with unknown values
28201///
28202/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28203/// additional enum variants at any time. Adding new variants is not considered
28204/// a breaking change. Applications should write their code in anticipation of:
28205///
28206/// - New values appearing in future releases of the client library, **and**
28207/// - New values received dynamically, without application changes.
28208///
28209/// Please consult the [Working with enums] section in the user guide for some
28210/// guidelines.
28211///
28212/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28213#[derive(Clone, Debug, PartialEq)]
28214#[non_exhaustive]
28215pub enum HarmCategory {
28216 /// The harm category is unspecified.
28217 Unspecified,
28218 /// The harm category is hate speech.
28219 HateSpeech,
28220 /// The harm category is dangerous content.
28221 DangerousContent,
28222 /// The harm category is harassment.
28223 Harassment,
28224 /// The harm category is sexually explicit content.
28225 SexuallyExplicit,
28226 /// The harm category is civic integrity.
28227 CivicIntegrity,
28228 /// If set, the enum was initialized with an unknown value.
28229 ///
28230 /// Applications can examine the value using [HarmCategory::value] or
28231 /// [HarmCategory::name].
28232 UnknownValue(harm_category::UnknownValue),
28233}
28234
28235#[doc(hidden)]
28236pub mod harm_category {
28237 #[allow(unused_imports)]
28238 use super::*;
28239 #[derive(Clone, Debug, PartialEq)]
28240 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28241}
28242
28243impl HarmCategory {
28244 /// Gets the enum value.
28245 ///
28246 /// Returns `None` if the enum contains an unknown value deserialized from
28247 /// the string representation of enums.
28248 pub fn value(&self) -> std::option::Option<i32> {
28249 match self {
28250 Self::Unspecified => std::option::Option::Some(0),
28251 Self::HateSpeech => std::option::Option::Some(1),
28252 Self::DangerousContent => std::option::Option::Some(2),
28253 Self::Harassment => std::option::Option::Some(3),
28254 Self::SexuallyExplicit => std::option::Option::Some(4),
28255 Self::CivicIntegrity => std::option::Option::Some(5),
28256 Self::UnknownValue(u) => u.0.value(),
28257 }
28258 }
28259
28260 /// Gets the enum value as a string.
28261 ///
28262 /// Returns `None` if the enum contains an unknown value deserialized from
28263 /// the integer representation of enums.
28264 pub fn name(&self) -> std::option::Option<&str> {
28265 match self {
28266 Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28267 Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28268 Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28269 Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28270 Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28271 Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28272 Self::UnknownValue(u) => u.0.name(),
28273 }
28274 }
28275}
28276
28277impl std::default::Default for HarmCategory {
28278 fn default() -> Self {
28279 use std::convert::From;
28280 Self::from(0)
28281 }
28282}
28283
28284impl std::fmt::Display for HarmCategory {
28285 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28286 wkt::internal::display_enum(f, self.name(), self.value())
28287 }
28288}
28289
28290impl std::convert::From<i32> for HarmCategory {
28291 fn from(value: i32) -> Self {
28292 match value {
28293 0 => Self::Unspecified,
28294 1 => Self::HateSpeech,
28295 2 => Self::DangerousContent,
28296 3 => Self::Harassment,
28297 4 => Self::SexuallyExplicit,
28298 5 => Self::CivicIntegrity,
28299 _ => Self::UnknownValue(harm_category::UnknownValue(
28300 wkt::internal::UnknownEnumValue::Integer(value),
28301 )),
28302 }
28303 }
28304}
28305
28306impl std::convert::From<&str> for HarmCategory {
28307 fn from(value: &str) -> Self {
28308 use std::string::ToString;
28309 match value {
28310 "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28311 "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28312 "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28313 "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28314 "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28315 "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28316 _ => Self::UnknownValue(harm_category::UnknownValue(
28317 wkt::internal::UnknownEnumValue::String(value.to_string()),
28318 )),
28319 }
28320 }
28321}
28322
28323impl serde::ser::Serialize for HarmCategory {
28324 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28325 where
28326 S: serde::Serializer,
28327 {
28328 match self {
28329 Self::Unspecified => serializer.serialize_i32(0),
28330 Self::HateSpeech => serializer.serialize_i32(1),
28331 Self::DangerousContent => serializer.serialize_i32(2),
28332 Self::Harassment => serializer.serialize_i32(3),
28333 Self::SexuallyExplicit => serializer.serialize_i32(4),
28334 Self::CivicIntegrity => serializer.serialize_i32(5),
28335 Self::UnknownValue(u) => u.0.serialize(serializer),
28336 }
28337 }
28338}
28339
28340impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28341 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28342 where
28343 D: serde::Deserializer<'de>,
28344 {
28345 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28346 ".google.cloud.retail.v2.HarmCategory",
28347 ))
28348 }
28349}