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 project_id = "project_id";
1831 /// # let location_id = "location_id";
1832 /// # let catalog_id = "catalog_id";
1833 /// let x = AttributesConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
1834 /// ```
1835 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1836 self.name = v.into();
1837 self
1838 }
1839
1840 /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1841 ///
1842 /// # Example
1843 /// ```ignore,no_run
1844 /// # use google_cloud_retail_v2::model::AttributesConfig;
1845 /// use google_cloud_retail_v2::model::CatalogAttribute;
1846 /// let x = AttributesConfig::new().set_catalog_attributes([
1847 /// ("key0", CatalogAttribute::default()/* use setters */),
1848 /// ("key1", CatalogAttribute::default()/* use (different) setters */),
1849 /// ]);
1850 /// ```
1851 pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1852 where
1853 T: std::iter::IntoIterator<Item = (K, V)>,
1854 K: std::convert::Into<std::string::String>,
1855 V: std::convert::Into<crate::model::CatalogAttribute>,
1856 {
1857 use std::iter::Iterator;
1858 self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1859 self
1860 }
1861
1862 /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1863 ///
1864 /// # Example
1865 /// ```ignore,no_run
1866 /// # use google_cloud_retail_v2::model::AttributesConfig;
1867 /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1868 /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1869 /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1870 /// ```
1871 pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1872 mut self,
1873 v: T,
1874 ) -> Self {
1875 self.attribute_config_level = v.into();
1876 self
1877 }
1878}
1879
1880impl wkt::message::Message for AttributesConfig {
1881 fn typename() -> &'static str {
1882 "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1883 }
1884}
1885
1886/// Catalog level autocomplete config for customers to customize autocomplete
1887/// feature's settings.
1888#[derive(Clone, Default, PartialEq)]
1889#[non_exhaustive]
1890pub struct CompletionConfig {
1891 /// Required. Immutable. Fully qualified name
1892 /// `projects/*/locations/*/catalogs/*/completionConfig`
1893 pub name: std::string::String,
1894
1895 /// Specifies the matching order for autocomplete suggestions, e.g., a query
1896 /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1897 /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1898 /// suggest "red shoes". Currently supported values:
1899 ///
1900 /// * 'out-of-order'
1901 /// * 'exact-prefix'
1902 ///
1903 /// Default value: 'exact-prefix'.
1904 pub matching_order: std::string::String,
1905
1906 /// The maximum number of autocomplete suggestions returned per term. Default
1907 /// value is 20. If left unset or set to 0, then will fallback to default
1908 /// value.
1909 ///
1910 /// Value range is 1 to 20.
1911 pub max_suggestions: i32,
1912
1913 /// The minimum number of characters needed to be typed in order to get
1914 /// suggestions. Default value is 2. If left unset or set to 0, then will
1915 /// fallback to default value.
1916 ///
1917 /// Value range is 1 to 20.
1918 pub min_prefix_length: i32,
1919
1920 /// If set to true, the auto learning function is enabled. Auto learning uses
1921 /// user data to generate suggestions using ML techniques. Default value is
1922 /// false. Only after enabling auto learning can users use `cloud-retail`
1923 /// data in
1924 /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1925 ///
1926 /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1927 pub auto_learning: bool,
1928
1929 /// Output only. The source data for the latest import of the autocomplete
1930 /// suggestion phrases.
1931 pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1932
1933 /// Output only. Name of the LRO corresponding to the latest suggestion terms
1934 /// list import.
1935 ///
1936 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1937 /// method to retrieve the latest state of the Long Running Operation.
1938 pub last_suggestions_import_operation: std::string::String,
1939
1940 /// Output only. The source data for the latest import of the autocomplete
1941 /// denylist phrases.
1942 pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1943
1944 /// Output only. Name of the LRO corresponding to the latest denylist import.
1945 ///
1946 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1947 /// retrieve the latest state of the Long Running Operation.
1948 pub last_denylist_import_operation: std::string::String,
1949
1950 /// Output only. The source data for the latest import of the autocomplete
1951 /// allowlist phrases.
1952 pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1953
1954 /// Output only. Name of the LRO corresponding to the latest allowlist import.
1955 ///
1956 /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1957 /// retrieve the latest state of the Long Running Operation.
1958 pub last_allowlist_import_operation: std::string::String,
1959
1960 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1961}
1962
1963impl CompletionConfig {
1964 /// Creates a new default instance.
1965 pub fn new() -> Self {
1966 std::default::Default::default()
1967 }
1968
1969 /// Sets the value of [name][crate::model::CompletionConfig::name].
1970 ///
1971 /// # Example
1972 /// ```ignore,no_run
1973 /// # use google_cloud_retail_v2::model::CompletionConfig;
1974 /// # let project_id = "project_id";
1975 /// # let location_id = "location_id";
1976 /// # let catalog_id = "catalog_id";
1977 /// let x = CompletionConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/completionConfig"));
1978 /// ```
1979 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1980 self.name = v.into();
1981 self
1982 }
1983
1984 /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1985 ///
1986 /// # Example
1987 /// ```ignore,no_run
1988 /// # use google_cloud_retail_v2::model::CompletionConfig;
1989 /// let x = CompletionConfig::new().set_matching_order("example");
1990 /// ```
1991 pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1992 self.matching_order = v.into();
1993 self
1994 }
1995
1996 /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1997 ///
1998 /// # Example
1999 /// ```ignore,no_run
2000 /// # use google_cloud_retail_v2::model::CompletionConfig;
2001 /// let x = CompletionConfig::new().set_max_suggestions(42);
2002 /// ```
2003 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2004 self.max_suggestions = v.into();
2005 self
2006 }
2007
2008 /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
2009 ///
2010 /// # Example
2011 /// ```ignore,no_run
2012 /// # use google_cloud_retail_v2::model::CompletionConfig;
2013 /// let x = CompletionConfig::new().set_min_prefix_length(42);
2014 /// ```
2015 pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2016 self.min_prefix_length = v.into();
2017 self
2018 }
2019
2020 /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2021 ///
2022 /// # Example
2023 /// ```ignore,no_run
2024 /// # use google_cloud_retail_v2::model::CompletionConfig;
2025 /// let x = CompletionConfig::new().set_auto_learning(true);
2026 /// ```
2027 pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2028 self.auto_learning = v.into();
2029 self
2030 }
2031
2032 /// Sets the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2033 ///
2034 /// # Example
2035 /// ```ignore,no_run
2036 /// # use google_cloud_retail_v2::model::CompletionConfig;
2037 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2038 /// let x = CompletionConfig::new().set_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2039 /// ```
2040 pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2041 where
2042 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2043 {
2044 self.suggestions_input_config = std::option::Option::Some(v.into());
2045 self
2046 }
2047
2048 /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2049 ///
2050 /// # Example
2051 /// ```ignore,no_run
2052 /// # use google_cloud_retail_v2::model::CompletionConfig;
2053 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2054 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2055 /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2056 /// ```
2057 pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2058 where
2059 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2060 {
2061 self.suggestions_input_config = v.map(|x| x.into());
2062 self
2063 }
2064
2065 /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2066 ///
2067 /// # Example
2068 /// ```ignore,no_run
2069 /// # use google_cloud_retail_v2::model::CompletionConfig;
2070 /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2071 /// ```
2072 pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2073 mut self,
2074 v: T,
2075 ) -> Self {
2076 self.last_suggestions_import_operation = v.into();
2077 self
2078 }
2079
2080 /// Sets the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2081 ///
2082 /// # Example
2083 /// ```ignore,no_run
2084 /// # use google_cloud_retail_v2::model::CompletionConfig;
2085 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2086 /// let x = CompletionConfig::new().set_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2087 /// ```
2088 pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2089 where
2090 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2091 {
2092 self.denylist_input_config = std::option::Option::Some(v.into());
2093 self
2094 }
2095
2096 /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2097 ///
2098 /// # Example
2099 /// ```ignore,no_run
2100 /// # use google_cloud_retail_v2::model::CompletionConfig;
2101 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2102 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2103 /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2104 /// ```
2105 pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2106 where
2107 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2108 {
2109 self.denylist_input_config = v.map(|x| x.into());
2110 self
2111 }
2112
2113 /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_retail_v2::model::CompletionConfig;
2118 /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2119 /// ```
2120 pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2121 mut self,
2122 v: T,
2123 ) -> Self {
2124 self.last_denylist_import_operation = v.into();
2125 self
2126 }
2127
2128 /// Sets the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2129 ///
2130 /// # Example
2131 /// ```ignore,no_run
2132 /// # use google_cloud_retail_v2::model::CompletionConfig;
2133 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2134 /// let x = CompletionConfig::new().set_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2135 /// ```
2136 pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2137 where
2138 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2139 {
2140 self.allowlist_input_config = std::option::Option::Some(v.into());
2141 self
2142 }
2143
2144 /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2145 ///
2146 /// # Example
2147 /// ```ignore,no_run
2148 /// # use google_cloud_retail_v2::model::CompletionConfig;
2149 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2150 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2151 /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2152 /// ```
2153 pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2154 where
2155 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2156 {
2157 self.allowlist_input_config = v.map(|x| x.into());
2158 self
2159 }
2160
2161 /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2162 ///
2163 /// # Example
2164 /// ```ignore,no_run
2165 /// # use google_cloud_retail_v2::model::CompletionConfig;
2166 /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2167 /// ```
2168 pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2169 mut self,
2170 v: T,
2171 ) -> Self {
2172 self.last_allowlist_import_operation = v.into();
2173 self
2174 }
2175}
2176
2177impl wkt::message::Message for CompletionConfig {
2178 fn typename() -> &'static str {
2179 "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2180 }
2181}
2182
2183/// The catalog configuration.
2184#[derive(Clone, Default, PartialEq)]
2185#[non_exhaustive]
2186pub struct Catalog {
2187 /// Required. Immutable. The fully qualified resource name of the catalog.
2188 pub name: std::string::String,
2189
2190 /// Required. Immutable. The catalog display name.
2191 ///
2192 /// This field must be a UTF-8 encoded string with a length limit of 128
2193 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2194 pub display_name: std::string::String,
2195
2196 /// Required. The product level configuration.
2197 pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2198
2199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2200}
2201
2202impl Catalog {
2203 /// Creates a new default instance.
2204 pub fn new() -> Self {
2205 std::default::Default::default()
2206 }
2207
2208 /// Sets the value of [name][crate::model::Catalog::name].
2209 ///
2210 /// # Example
2211 /// ```ignore,no_run
2212 /// # use google_cloud_retail_v2::model::Catalog;
2213 /// # let project_id = "project_id";
2214 /// # let location_id = "location_id";
2215 /// # let catalog_id = "catalog_id";
2216 /// let x = Catalog::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2217 /// ```
2218 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2219 self.name = v.into();
2220 self
2221 }
2222
2223 /// Sets the value of [display_name][crate::model::Catalog::display_name].
2224 ///
2225 /// # Example
2226 /// ```ignore,no_run
2227 /// # use google_cloud_retail_v2::model::Catalog;
2228 /// let x = Catalog::new().set_display_name("example");
2229 /// ```
2230 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2231 self.display_name = v.into();
2232 self
2233 }
2234
2235 /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2236 ///
2237 /// # Example
2238 /// ```ignore,no_run
2239 /// # use google_cloud_retail_v2::model::Catalog;
2240 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2241 /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2242 /// ```
2243 pub fn set_product_level_config<T>(mut self, v: T) -> Self
2244 where
2245 T: std::convert::Into<crate::model::ProductLevelConfig>,
2246 {
2247 self.product_level_config = std::option::Option::Some(v.into());
2248 self
2249 }
2250
2251 /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2252 ///
2253 /// # Example
2254 /// ```ignore,no_run
2255 /// # use google_cloud_retail_v2::model::Catalog;
2256 /// use google_cloud_retail_v2::model::ProductLevelConfig;
2257 /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2258 /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2259 /// ```
2260 pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2261 where
2262 T: std::convert::Into<crate::model::ProductLevelConfig>,
2263 {
2264 self.product_level_config = v.map(|x| x.into());
2265 self
2266 }
2267}
2268
2269impl wkt::message::Message for Catalog {
2270 fn typename() -> &'static str {
2271 "type.googleapis.com/google.cloud.retail.v2.Catalog"
2272 }
2273}
2274
2275/// Request for
2276/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2277/// method.
2278///
2279/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2280#[derive(Clone, Default, PartialEq)]
2281#[non_exhaustive]
2282pub struct ListCatalogsRequest {
2283 /// Required. The account resource name with an associated location.
2284 ///
2285 /// If the caller does not have permission to list
2286 /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2287 /// of whether or not this location exists, a PERMISSION_DENIED error is
2288 /// returned.
2289 ///
2290 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2291 pub parent: std::string::String,
2292
2293 /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2294 /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2295 /// above 1000 will be coerced to 1000.
2296 ///
2297 /// If this field is negative, an INVALID_ARGUMENT is returned.
2298 ///
2299 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2300 pub page_size: i32,
2301
2302 /// A page token
2303 /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2304 /// received from a previous
2305 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2306 /// call. Provide this to retrieve the subsequent page.
2307 ///
2308 /// When paginating, all other parameters provided to
2309 /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2310 /// must match the call that provided the page token. Otherwise, an
2311 /// INVALID_ARGUMENT error is returned.
2312 ///
2313 /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2314 /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2315 pub page_token: std::string::String,
2316
2317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2318}
2319
2320impl ListCatalogsRequest {
2321 /// Creates a new default instance.
2322 pub fn new() -> Self {
2323 std::default::Default::default()
2324 }
2325
2326 /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2327 ///
2328 /// # Example
2329 /// ```ignore,no_run
2330 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2331 /// let x = ListCatalogsRequest::new().set_parent("example");
2332 /// ```
2333 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2334 self.parent = v.into();
2335 self
2336 }
2337
2338 /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2339 ///
2340 /// # Example
2341 /// ```ignore,no_run
2342 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2343 /// let x = ListCatalogsRequest::new().set_page_size(42);
2344 /// ```
2345 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2346 self.page_size = v.into();
2347 self
2348 }
2349
2350 /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2351 ///
2352 /// # Example
2353 /// ```ignore,no_run
2354 /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2355 /// let x = ListCatalogsRequest::new().set_page_token("example");
2356 /// ```
2357 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2358 self.page_token = v.into();
2359 self
2360 }
2361}
2362
2363impl wkt::message::Message for ListCatalogsRequest {
2364 fn typename() -> &'static str {
2365 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2366 }
2367}
2368
2369/// Response for
2370/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2371/// method.
2372///
2373/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2374#[derive(Clone, Default, PartialEq)]
2375#[non_exhaustive]
2376pub struct ListCatalogsResponse {
2377 /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2378 ///
2379 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2380 pub catalogs: std::vec::Vec<crate::model::Catalog>,
2381
2382 /// A token that can be sent as
2383 /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2384 /// to retrieve the next page. If this field is omitted, there are no
2385 /// subsequent pages.
2386 ///
2387 /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2388 pub next_page_token: std::string::String,
2389
2390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2391}
2392
2393impl ListCatalogsResponse {
2394 /// Creates a new default instance.
2395 pub fn new() -> Self {
2396 std::default::Default::default()
2397 }
2398
2399 /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2400 ///
2401 /// # Example
2402 /// ```ignore,no_run
2403 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2404 /// use google_cloud_retail_v2::model::Catalog;
2405 /// let x = ListCatalogsResponse::new()
2406 /// .set_catalogs([
2407 /// Catalog::default()/* use setters */,
2408 /// Catalog::default()/* use (different) setters */,
2409 /// ]);
2410 /// ```
2411 pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2412 where
2413 T: std::iter::IntoIterator<Item = V>,
2414 V: std::convert::Into<crate::model::Catalog>,
2415 {
2416 use std::iter::Iterator;
2417 self.catalogs = v.into_iter().map(|i| i.into()).collect();
2418 self
2419 }
2420
2421 /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2422 ///
2423 /// # Example
2424 /// ```ignore,no_run
2425 /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2426 /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2427 /// ```
2428 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2429 self.next_page_token = v.into();
2430 self
2431 }
2432}
2433
2434impl wkt::message::Message for ListCatalogsResponse {
2435 fn typename() -> &'static str {
2436 "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2437 }
2438}
2439
2440#[doc(hidden)]
2441impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2442 type PageItem = crate::model::Catalog;
2443
2444 fn items(self) -> std::vec::Vec<Self::PageItem> {
2445 self.catalogs
2446 }
2447
2448 fn next_page_token(&self) -> std::string::String {
2449 use std::clone::Clone;
2450 self.next_page_token.clone()
2451 }
2452}
2453
2454/// Request for
2455/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2456/// method.
2457///
2458/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2459#[derive(Clone, Default, PartialEq)]
2460#[non_exhaustive]
2461pub struct UpdateCatalogRequest {
2462 /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2463 ///
2464 /// If the caller does not have permission to update the
2465 /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2466 /// exists, a PERMISSION_DENIED error is returned.
2467 ///
2468 /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2469 /// a NOT_FOUND error is returned.
2470 ///
2471 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2472 pub catalog: std::option::Option<crate::model::Catalog>,
2473
2474 /// Indicates which fields in the provided
2475 /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2476 ///
2477 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2478 /// is returned.
2479 ///
2480 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2481 pub update_mask: std::option::Option<wkt::FieldMask>,
2482
2483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2484}
2485
2486impl UpdateCatalogRequest {
2487 /// Creates a new default instance.
2488 pub fn new() -> Self {
2489 std::default::Default::default()
2490 }
2491
2492 /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2493 ///
2494 /// # Example
2495 /// ```ignore,no_run
2496 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2497 /// use google_cloud_retail_v2::model::Catalog;
2498 /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2499 /// ```
2500 pub fn set_catalog<T>(mut self, v: T) -> Self
2501 where
2502 T: std::convert::Into<crate::model::Catalog>,
2503 {
2504 self.catalog = std::option::Option::Some(v.into());
2505 self
2506 }
2507
2508 /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2509 ///
2510 /// # Example
2511 /// ```ignore,no_run
2512 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2513 /// use google_cloud_retail_v2::model::Catalog;
2514 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2515 /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2516 /// ```
2517 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2518 where
2519 T: std::convert::Into<crate::model::Catalog>,
2520 {
2521 self.catalog = v.map(|x| x.into());
2522 self
2523 }
2524
2525 /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2526 ///
2527 /// # Example
2528 /// ```ignore,no_run
2529 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2530 /// use wkt::FieldMask;
2531 /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2532 /// ```
2533 pub fn set_update_mask<T>(mut self, v: T) -> Self
2534 where
2535 T: std::convert::Into<wkt::FieldMask>,
2536 {
2537 self.update_mask = std::option::Option::Some(v.into());
2538 self
2539 }
2540
2541 /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2546 /// use wkt::FieldMask;
2547 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2548 /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2549 /// ```
2550 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2551 where
2552 T: std::convert::Into<wkt::FieldMask>,
2553 {
2554 self.update_mask = v.map(|x| x.into());
2555 self
2556 }
2557}
2558
2559impl wkt::message::Message for UpdateCatalogRequest {
2560 fn typename() -> &'static str {
2561 "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2562 }
2563}
2564
2565/// Request message to set a specified branch as new default_branch.
2566#[derive(Clone, Default, PartialEq)]
2567#[non_exhaustive]
2568pub struct SetDefaultBranchRequest {
2569 /// Full resource name of the catalog, such as
2570 /// `projects/*/locations/global/catalogs/default_catalog`.
2571 pub catalog: std::string::String,
2572
2573 /// The final component of the resource name of a branch.
2574 ///
2575 /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2576 /// error is returned.
2577 ///
2578 /// If there are no sufficient active products in the targeted branch and
2579 /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2580 /// FAILED_PRECONDITION error is returned.
2581 ///
2582 /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2583 pub branch_id: std::string::String,
2584
2585 /// Some note on this request, this can be retrieved by
2586 /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2587 /// before next valid default branch set occurs.
2588 ///
2589 /// This field must be a UTF-8 encoded string with a length limit of 1,000
2590 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2591 ///
2592 /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2593 pub note: std::string::String,
2594
2595 /// If set to true, it permits switching to a branch with
2596 /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2597 /// if it has no sufficient active products.
2598 ///
2599 /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2600 pub force: bool,
2601
2602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2603}
2604
2605impl SetDefaultBranchRequest {
2606 /// Creates a new default instance.
2607 pub fn new() -> Self {
2608 std::default::Default::default()
2609 }
2610
2611 /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2612 ///
2613 /// # Example
2614 /// ```ignore,no_run
2615 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2616 /// # let project_id = "project_id";
2617 /// # let location_id = "location_id";
2618 /// # let catalog_id = "catalog_id";
2619 /// let x = SetDefaultBranchRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2620 /// ```
2621 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2622 self.catalog = v.into();
2623 self
2624 }
2625
2626 /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2631 /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2632 /// ```
2633 pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2634 self.branch_id = v.into();
2635 self
2636 }
2637
2638 /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2643 /// let x = SetDefaultBranchRequest::new().set_note("example");
2644 /// ```
2645 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2646 self.note = v.into();
2647 self
2648 }
2649
2650 /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2651 ///
2652 /// # Example
2653 /// ```ignore,no_run
2654 /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2655 /// let x = SetDefaultBranchRequest::new().set_force(true);
2656 /// ```
2657 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2658 self.force = v.into();
2659 self
2660 }
2661}
2662
2663impl wkt::message::Message for SetDefaultBranchRequest {
2664 fn typename() -> &'static str {
2665 "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2666 }
2667}
2668
2669/// Request message to show which branch is currently the default branch.
2670#[derive(Clone, Default, PartialEq)]
2671#[non_exhaustive]
2672pub struct GetDefaultBranchRequest {
2673 /// The parent catalog resource name, such as
2674 /// `projects/*/locations/global/catalogs/default_catalog`.
2675 pub catalog: std::string::String,
2676
2677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2678}
2679
2680impl GetDefaultBranchRequest {
2681 /// Creates a new default instance.
2682 pub fn new() -> Self {
2683 std::default::Default::default()
2684 }
2685
2686 /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2687 ///
2688 /// # Example
2689 /// ```ignore,no_run
2690 /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2691 /// # let project_id = "project_id";
2692 /// # let location_id = "location_id";
2693 /// # let catalog_id = "catalog_id";
2694 /// let x = GetDefaultBranchRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2695 /// ```
2696 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2697 self.catalog = v.into();
2698 self
2699 }
2700}
2701
2702impl wkt::message::Message for GetDefaultBranchRequest {
2703 fn typename() -> &'static str {
2704 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2705 }
2706}
2707
2708/// Response message of
2709/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2710///
2711/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2712#[derive(Clone, Default, PartialEq)]
2713#[non_exhaustive]
2714pub struct GetDefaultBranchResponse {
2715 /// Full resource name of the branch id currently set as default branch.
2716 pub branch: std::string::String,
2717
2718 /// The time when this branch is set to default.
2719 pub set_time: std::option::Option<wkt::Timestamp>,
2720
2721 /// This corresponds to
2722 /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2723 /// field, when this branch was set as default.
2724 ///
2725 /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2726 pub note: std::string::String,
2727
2728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2729}
2730
2731impl GetDefaultBranchResponse {
2732 /// Creates a new default instance.
2733 pub fn new() -> Self {
2734 std::default::Default::default()
2735 }
2736
2737 /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2738 ///
2739 /// # Example
2740 /// ```ignore,no_run
2741 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2742 /// let x = GetDefaultBranchResponse::new().set_branch("example");
2743 /// ```
2744 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2745 self.branch = v.into();
2746 self
2747 }
2748
2749 /// Sets the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2750 ///
2751 /// # Example
2752 /// ```ignore,no_run
2753 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2754 /// use wkt::Timestamp;
2755 /// let x = GetDefaultBranchResponse::new().set_set_time(Timestamp::default()/* use setters */);
2756 /// ```
2757 pub fn set_set_time<T>(mut self, v: T) -> Self
2758 where
2759 T: std::convert::Into<wkt::Timestamp>,
2760 {
2761 self.set_time = std::option::Option::Some(v.into());
2762 self
2763 }
2764
2765 /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2766 ///
2767 /// # Example
2768 /// ```ignore,no_run
2769 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2770 /// use wkt::Timestamp;
2771 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2772 /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2773 /// ```
2774 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2775 where
2776 T: std::convert::Into<wkt::Timestamp>,
2777 {
2778 self.set_time = v.map(|x| x.into());
2779 self
2780 }
2781
2782 /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2783 ///
2784 /// # Example
2785 /// ```ignore,no_run
2786 /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2787 /// let x = GetDefaultBranchResponse::new().set_note("example");
2788 /// ```
2789 pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2790 self.note = v.into();
2791 self
2792 }
2793}
2794
2795impl wkt::message::Message for GetDefaultBranchResponse {
2796 fn typename() -> &'static str {
2797 "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2798 }
2799}
2800
2801/// Request for
2802/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2803/// method.
2804///
2805/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2806#[derive(Clone, Default, PartialEq)]
2807#[non_exhaustive]
2808pub struct GetCompletionConfigRequest {
2809 /// Required. Full CompletionConfig resource name. Format:
2810 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2811 pub name: std::string::String,
2812
2813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2814}
2815
2816impl GetCompletionConfigRequest {
2817 /// Creates a new default instance.
2818 pub fn new() -> Self {
2819 std::default::Default::default()
2820 }
2821
2822 /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2823 ///
2824 /// # Example
2825 /// ```ignore,no_run
2826 /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2827 /// # let project_id = "project_id";
2828 /// # let location_id = "location_id";
2829 /// # let catalog_id = "catalog_id";
2830 /// let x = GetCompletionConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/completionConfig"));
2831 /// ```
2832 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2833 self.name = v.into();
2834 self
2835 }
2836}
2837
2838impl wkt::message::Message for GetCompletionConfigRequest {
2839 fn typename() -> &'static str {
2840 "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2841 }
2842}
2843
2844/// Request for
2845/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2846/// method.
2847///
2848/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2849#[derive(Clone, Default, PartialEq)]
2850#[non_exhaustive]
2851pub struct UpdateCompletionConfigRequest {
2852 /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2853 /// to update.
2854 ///
2855 /// If the caller does not have permission to update the
2856 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2857 /// PERMISSION_DENIED error is returned.
2858 ///
2859 /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2860 /// update does not exist, a NOT_FOUND error is returned.
2861 ///
2862 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2863 pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2864
2865 /// Indicates which fields in the provided
2866 /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2867 /// following are the only supported fields:
2868 ///
2869 /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2870 /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2871 /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2872 /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2873 ///
2874 /// If not set, all supported fields are updated.
2875 ///
2876 /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2877 /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2878 /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2879 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2880 /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2881 pub update_mask: std::option::Option<wkt::FieldMask>,
2882
2883 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2884}
2885
2886impl UpdateCompletionConfigRequest {
2887 /// Creates a new default instance.
2888 pub fn new() -> Self {
2889 std::default::Default::default()
2890 }
2891
2892 /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2893 ///
2894 /// # Example
2895 /// ```ignore,no_run
2896 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2897 /// use google_cloud_retail_v2::model::CompletionConfig;
2898 /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2899 /// ```
2900 pub fn set_completion_config<T>(mut self, v: T) -> Self
2901 where
2902 T: std::convert::Into<crate::model::CompletionConfig>,
2903 {
2904 self.completion_config = std::option::Option::Some(v.into());
2905 self
2906 }
2907
2908 /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2913 /// use google_cloud_retail_v2::model::CompletionConfig;
2914 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2915 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2916 /// ```
2917 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2918 where
2919 T: std::convert::Into<crate::model::CompletionConfig>,
2920 {
2921 self.completion_config = v.map(|x| x.into());
2922 self
2923 }
2924
2925 /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2926 ///
2927 /// # Example
2928 /// ```ignore,no_run
2929 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2930 /// use wkt::FieldMask;
2931 /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2932 /// ```
2933 pub fn set_update_mask<T>(mut self, v: T) -> Self
2934 where
2935 T: std::convert::Into<wkt::FieldMask>,
2936 {
2937 self.update_mask = std::option::Option::Some(v.into());
2938 self
2939 }
2940
2941 /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2942 ///
2943 /// # Example
2944 /// ```ignore,no_run
2945 /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2946 /// use wkt::FieldMask;
2947 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2948 /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2949 /// ```
2950 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2951 where
2952 T: std::convert::Into<wkt::FieldMask>,
2953 {
2954 self.update_mask = v.map(|x| x.into());
2955 self
2956 }
2957}
2958
2959impl wkt::message::Message for UpdateCompletionConfigRequest {
2960 fn typename() -> &'static str {
2961 "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2962 }
2963}
2964
2965/// Request for
2966/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2967/// method.
2968///
2969/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2970#[derive(Clone, Default, PartialEq)]
2971#[non_exhaustive]
2972pub struct GetAttributesConfigRequest {
2973 /// Required. Full AttributesConfig resource name. Format:
2974 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2975 pub name: std::string::String,
2976
2977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2978}
2979
2980impl GetAttributesConfigRequest {
2981 /// Creates a new default instance.
2982 pub fn new() -> Self {
2983 std::default::Default::default()
2984 }
2985
2986 /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2987 ///
2988 /// # Example
2989 /// ```ignore,no_run
2990 /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2991 /// # let project_id = "project_id";
2992 /// # let location_id = "location_id";
2993 /// # let catalog_id = "catalog_id";
2994 /// let x = GetAttributesConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
2995 /// ```
2996 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2997 self.name = v.into();
2998 self
2999 }
3000}
3001
3002impl wkt::message::Message for GetAttributesConfigRequest {
3003 fn typename() -> &'static str {
3004 "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
3005 }
3006}
3007
3008/// Request for
3009/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
3010/// method.
3011///
3012/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
3013#[derive(Clone, Default, PartialEq)]
3014#[non_exhaustive]
3015pub struct UpdateAttributesConfigRequest {
3016 /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
3017 /// to update.
3018 ///
3019 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
3020 pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
3021
3022 /// Indicates which fields in the provided
3023 /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
3024 /// following is the only supported field:
3025 ///
3026 /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
3027 ///
3028 /// If not set, all supported fields are updated.
3029 ///
3030 /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
3031 /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
3032 pub update_mask: std::option::Option<wkt::FieldMask>,
3033
3034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3035}
3036
3037impl UpdateAttributesConfigRequest {
3038 /// Creates a new default instance.
3039 pub fn new() -> Self {
3040 std::default::Default::default()
3041 }
3042
3043 /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3044 ///
3045 /// # Example
3046 /// ```ignore,no_run
3047 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3048 /// use google_cloud_retail_v2::model::AttributesConfig;
3049 /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3050 /// ```
3051 pub fn set_attributes_config<T>(mut self, v: T) -> Self
3052 where
3053 T: std::convert::Into<crate::model::AttributesConfig>,
3054 {
3055 self.attributes_config = std::option::Option::Some(v.into());
3056 self
3057 }
3058
3059 /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3060 ///
3061 /// # Example
3062 /// ```ignore,no_run
3063 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3064 /// use google_cloud_retail_v2::model::AttributesConfig;
3065 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3066 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3067 /// ```
3068 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3069 where
3070 T: std::convert::Into<crate::model::AttributesConfig>,
3071 {
3072 self.attributes_config = v.map(|x| x.into());
3073 self
3074 }
3075
3076 /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3081 /// use wkt::FieldMask;
3082 /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3083 /// ```
3084 pub fn set_update_mask<T>(mut self, v: T) -> Self
3085 where
3086 T: std::convert::Into<wkt::FieldMask>,
3087 {
3088 self.update_mask = std::option::Option::Some(v.into());
3089 self
3090 }
3091
3092 /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3093 ///
3094 /// # Example
3095 /// ```ignore,no_run
3096 /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3097 /// use wkt::FieldMask;
3098 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3099 /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3100 /// ```
3101 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3102 where
3103 T: std::convert::Into<wkt::FieldMask>,
3104 {
3105 self.update_mask = v.map(|x| x.into());
3106 self
3107 }
3108}
3109
3110impl wkt::message::Message for UpdateAttributesConfigRequest {
3111 fn typename() -> &'static str {
3112 "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3113 }
3114}
3115
3116/// Request for
3117/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3118/// method.
3119///
3120/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3121#[derive(Clone, Default, PartialEq)]
3122#[non_exhaustive]
3123pub struct AddCatalogAttributeRequest {
3124 /// Required. Full AttributesConfig resource name. Format:
3125 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3126 pub attributes_config: std::string::String,
3127
3128 /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3129 /// to add.
3130 ///
3131 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3132 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3133
3134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3135}
3136
3137impl AddCatalogAttributeRequest {
3138 /// Creates a new default instance.
3139 pub fn new() -> Self {
3140 std::default::Default::default()
3141 }
3142
3143 /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3144 ///
3145 /// # Example
3146 /// ```ignore,no_run
3147 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3148 /// # let project_id = "project_id";
3149 /// # let location_id = "location_id";
3150 /// # let catalog_id = "catalog_id";
3151 /// let x = AddCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3152 /// ```
3153 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3154 mut self,
3155 v: T,
3156 ) -> Self {
3157 self.attributes_config = v.into();
3158 self
3159 }
3160
3161 /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3166 /// use google_cloud_retail_v2::model::CatalogAttribute;
3167 /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3168 /// ```
3169 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3170 where
3171 T: std::convert::Into<crate::model::CatalogAttribute>,
3172 {
3173 self.catalog_attribute = std::option::Option::Some(v.into());
3174 self
3175 }
3176
3177 /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3182 /// use google_cloud_retail_v2::model::CatalogAttribute;
3183 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3184 /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3185 /// ```
3186 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3187 where
3188 T: std::convert::Into<crate::model::CatalogAttribute>,
3189 {
3190 self.catalog_attribute = v.map(|x| x.into());
3191 self
3192 }
3193}
3194
3195impl wkt::message::Message for AddCatalogAttributeRequest {
3196 fn typename() -> &'static str {
3197 "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3198 }
3199}
3200
3201/// Request for
3202/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3203/// method.
3204///
3205/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3206#[derive(Clone, Default, PartialEq)]
3207#[non_exhaustive]
3208pub struct RemoveCatalogAttributeRequest {
3209 /// Required. Full AttributesConfig resource name. Format:
3210 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3211 pub attributes_config: std::string::String,
3212
3213 /// Required. The attribute name key of the
3214 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3215 ///
3216 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3217 pub key: std::string::String,
3218
3219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3220}
3221
3222impl RemoveCatalogAttributeRequest {
3223 /// Creates a new default instance.
3224 pub fn new() -> Self {
3225 std::default::Default::default()
3226 }
3227
3228 /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3229 ///
3230 /// # Example
3231 /// ```ignore,no_run
3232 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3233 /// # let project_id = "project_id";
3234 /// # let location_id = "location_id";
3235 /// # let catalog_id = "catalog_id";
3236 /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3237 /// ```
3238 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3239 mut self,
3240 v: T,
3241 ) -> Self {
3242 self.attributes_config = v.into();
3243 self
3244 }
3245
3246 /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3247 ///
3248 /// # Example
3249 /// ```ignore,no_run
3250 /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3251 /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3252 /// ```
3253 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3254 self.key = v.into();
3255 self
3256 }
3257}
3258
3259impl wkt::message::Message for RemoveCatalogAttributeRequest {
3260 fn typename() -> &'static str {
3261 "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3262 }
3263}
3264
3265/// Request for
3266/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3267/// method.
3268///
3269/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3270#[derive(Clone, Default, PartialEq)]
3271#[non_exhaustive]
3272pub struct ReplaceCatalogAttributeRequest {
3273 /// Required. Full AttributesConfig resource name. Format:
3274 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3275 pub attributes_config: std::string::String,
3276
3277 /// Required. The updated
3278 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3279 ///
3280 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3281 pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3282
3283 /// Indicates which fields in the provided
3284 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3285 /// following are NOT supported:
3286 ///
3287 /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3288 ///
3289 /// If not set, all supported fields are updated.
3290 ///
3291 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3292 /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3293 pub update_mask: std::option::Option<wkt::FieldMask>,
3294
3295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3296}
3297
3298impl ReplaceCatalogAttributeRequest {
3299 /// Creates a new default instance.
3300 pub fn new() -> Self {
3301 std::default::Default::default()
3302 }
3303
3304 /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3305 ///
3306 /// # Example
3307 /// ```ignore,no_run
3308 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3309 /// # let project_id = "project_id";
3310 /// # let location_id = "location_id";
3311 /// # let catalog_id = "catalog_id";
3312 /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3313 /// ```
3314 pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3315 mut self,
3316 v: T,
3317 ) -> Self {
3318 self.attributes_config = v.into();
3319 self
3320 }
3321
3322 /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3327 /// use google_cloud_retail_v2::model::CatalogAttribute;
3328 /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3329 /// ```
3330 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3331 where
3332 T: std::convert::Into<crate::model::CatalogAttribute>,
3333 {
3334 self.catalog_attribute = std::option::Option::Some(v.into());
3335 self
3336 }
3337
3338 /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3343 /// use google_cloud_retail_v2::model::CatalogAttribute;
3344 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3345 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3346 /// ```
3347 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3348 where
3349 T: std::convert::Into<crate::model::CatalogAttribute>,
3350 {
3351 self.catalog_attribute = v.map(|x| x.into());
3352 self
3353 }
3354
3355 /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3356 ///
3357 /// # Example
3358 /// ```ignore,no_run
3359 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3360 /// use wkt::FieldMask;
3361 /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3362 /// ```
3363 pub fn set_update_mask<T>(mut self, v: T) -> Self
3364 where
3365 T: std::convert::Into<wkt::FieldMask>,
3366 {
3367 self.update_mask = std::option::Option::Some(v.into());
3368 self
3369 }
3370
3371 /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3372 ///
3373 /// # Example
3374 /// ```ignore,no_run
3375 /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3376 /// use wkt::FieldMask;
3377 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3378 /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3379 /// ```
3380 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3381 where
3382 T: std::convert::Into<wkt::FieldMask>,
3383 {
3384 self.update_mask = v.map(|x| x.into());
3385 self
3386 }
3387}
3388
3389impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3390 fn typename() -> &'static str {
3391 "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3392 }
3393}
3394
3395/// Metadata that is used to define a condition that triggers an action.
3396/// A valid condition must specify at least one of 'query_terms' or
3397/// 'products_filter'. If multiple fields are specified, the condition is met if
3398/// all the fields are satisfied e.g. if a set of query terms and product_filter
3399/// are set, then only items matching the product_filter for requests with a
3400/// query matching the query terms wil get boosted.
3401#[derive(Clone, Default, PartialEq)]
3402#[non_exhaustive]
3403pub struct Condition {
3404 /// A list (up to 10 entries) of terms to match the query on. If not
3405 /// specified, match all queries.
3406 /// If many query terms are specified, the condition
3407 /// is matched if any of the terms is a match (i.e. using the OR operator).
3408 pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3409
3410 /// Range of time(s) specifying when Condition is active.
3411 /// Condition true if any time range matches.
3412 pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3413
3414 /// Used to support browse uses cases.
3415 /// A list (up to 10 entries) of categories or departments.
3416 /// The format should be the same as
3417 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3418 ///
3419 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3420 pub page_categories: std::vec::Vec<std::string::String>,
3421
3422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3423}
3424
3425impl Condition {
3426 /// Creates a new default instance.
3427 pub fn new() -> Self {
3428 std::default::Default::default()
3429 }
3430
3431 /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3432 ///
3433 /// # Example
3434 /// ```ignore,no_run
3435 /// # use google_cloud_retail_v2::model::Condition;
3436 /// use google_cloud_retail_v2::model::condition::QueryTerm;
3437 /// let x = Condition::new()
3438 /// .set_query_terms([
3439 /// QueryTerm::default()/* use setters */,
3440 /// QueryTerm::default()/* use (different) setters */,
3441 /// ]);
3442 /// ```
3443 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3444 where
3445 T: std::iter::IntoIterator<Item = V>,
3446 V: std::convert::Into<crate::model::condition::QueryTerm>,
3447 {
3448 use std::iter::Iterator;
3449 self.query_terms = v.into_iter().map(|i| i.into()).collect();
3450 self
3451 }
3452
3453 /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3454 ///
3455 /// # Example
3456 /// ```ignore,no_run
3457 /// # use google_cloud_retail_v2::model::Condition;
3458 /// use google_cloud_retail_v2::model::condition::TimeRange;
3459 /// let x = Condition::new()
3460 /// .set_active_time_range([
3461 /// TimeRange::default()/* use setters */,
3462 /// TimeRange::default()/* use (different) setters */,
3463 /// ]);
3464 /// ```
3465 pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3466 where
3467 T: std::iter::IntoIterator<Item = V>,
3468 V: std::convert::Into<crate::model::condition::TimeRange>,
3469 {
3470 use std::iter::Iterator;
3471 self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3472 self
3473 }
3474
3475 /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3476 ///
3477 /// # Example
3478 /// ```ignore,no_run
3479 /// # use google_cloud_retail_v2::model::Condition;
3480 /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3481 /// ```
3482 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3483 where
3484 T: std::iter::IntoIterator<Item = V>,
3485 V: std::convert::Into<std::string::String>,
3486 {
3487 use std::iter::Iterator;
3488 self.page_categories = v.into_iter().map(|i| i.into()).collect();
3489 self
3490 }
3491}
3492
3493impl wkt::message::Message for Condition {
3494 fn typename() -> &'static str {
3495 "type.googleapis.com/google.cloud.retail.v2.Condition"
3496 }
3497}
3498
3499/// Defines additional types related to [Condition].
3500pub mod condition {
3501 #[allow(unused_imports)]
3502 use super::*;
3503
3504 /// Query terms that we want to match on.
3505 #[derive(Clone, Default, PartialEq)]
3506 #[non_exhaustive]
3507 pub struct QueryTerm {
3508 /// The value of the term to match on.
3509 /// Value cannot be empty.
3510 /// Value can have at most 3 terms if specified as a partial match. Each
3511 /// space separated string is considered as one term.
3512 /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3513 /// and not allowed for a partial match.
3514 pub value: std::string::String,
3515
3516 /// Whether this is supposed to be a full or partial match.
3517 pub full_match: bool,
3518
3519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3520 }
3521
3522 impl QueryTerm {
3523 /// Creates a new default instance.
3524 pub fn new() -> Self {
3525 std::default::Default::default()
3526 }
3527
3528 /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3529 ///
3530 /// # Example
3531 /// ```ignore,no_run
3532 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3533 /// let x = QueryTerm::new().set_value("example");
3534 /// ```
3535 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3536 self.value = v.into();
3537 self
3538 }
3539
3540 /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3541 ///
3542 /// # Example
3543 /// ```ignore,no_run
3544 /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3545 /// let x = QueryTerm::new().set_full_match(true);
3546 /// ```
3547 pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3548 self.full_match = v.into();
3549 self
3550 }
3551 }
3552
3553 impl wkt::message::Message for QueryTerm {
3554 fn typename() -> &'static str {
3555 "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3556 }
3557 }
3558
3559 /// Used for time-dependent conditions.
3560 /// Example: Want to have rule applied for week long sale.
3561 #[derive(Clone, Default, PartialEq)]
3562 #[non_exhaustive]
3563 pub struct TimeRange {
3564 /// Start of time range. Range is inclusive.
3565 pub start_time: std::option::Option<wkt::Timestamp>,
3566
3567 /// End of time range. Range is inclusive.
3568 pub end_time: std::option::Option<wkt::Timestamp>,
3569
3570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3571 }
3572
3573 impl TimeRange {
3574 /// Creates a new default instance.
3575 pub fn new() -> Self {
3576 std::default::Default::default()
3577 }
3578
3579 /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3584 /// use wkt::Timestamp;
3585 /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3586 /// ```
3587 pub fn set_start_time<T>(mut self, v: T) -> Self
3588 where
3589 T: std::convert::Into<wkt::Timestamp>,
3590 {
3591 self.start_time = std::option::Option::Some(v.into());
3592 self
3593 }
3594
3595 /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3596 ///
3597 /// # Example
3598 /// ```ignore,no_run
3599 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3600 /// use wkt::Timestamp;
3601 /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3602 /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3603 /// ```
3604 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3605 where
3606 T: std::convert::Into<wkt::Timestamp>,
3607 {
3608 self.start_time = v.map(|x| x.into());
3609 self
3610 }
3611
3612 /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3613 ///
3614 /// # Example
3615 /// ```ignore,no_run
3616 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3617 /// use wkt::Timestamp;
3618 /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3619 /// ```
3620 pub fn set_end_time<T>(mut self, v: T) -> Self
3621 where
3622 T: std::convert::Into<wkt::Timestamp>,
3623 {
3624 self.end_time = std::option::Option::Some(v.into());
3625 self
3626 }
3627
3628 /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3629 ///
3630 /// # Example
3631 /// ```ignore,no_run
3632 /// # use google_cloud_retail_v2::model::condition::TimeRange;
3633 /// use wkt::Timestamp;
3634 /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3635 /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3636 /// ```
3637 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3638 where
3639 T: std::convert::Into<wkt::Timestamp>,
3640 {
3641 self.end_time = v.map(|x| x.into());
3642 self
3643 }
3644 }
3645
3646 impl wkt::message::Message for TimeRange {
3647 fn typename() -> &'static str {
3648 "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3649 }
3650 }
3651}
3652
3653/// A rule is a condition-action pair
3654///
3655/// * A condition defines when a rule is to be triggered.
3656/// * An action specifies what occurs on that trigger.
3657/// Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3658/// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3659///
3660/// [google.cloud.retail.v2.Control]: crate::model::Control
3661/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3662#[derive(Clone, Default, PartialEq)]
3663#[non_exhaustive]
3664pub struct Rule {
3665 /// Required. The condition that triggers the rule.
3666 /// If the condition is empty, the rule will always apply.
3667 pub condition: std::option::Option<crate::model::Condition>,
3668
3669 /// An action must be provided.
3670 pub action: std::option::Option<crate::model::rule::Action>,
3671
3672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3673}
3674
3675impl Rule {
3676 /// Creates a new default instance.
3677 pub fn new() -> Self {
3678 std::default::Default::default()
3679 }
3680
3681 /// Sets the value of [condition][crate::model::Rule::condition].
3682 ///
3683 /// # Example
3684 /// ```ignore,no_run
3685 /// # use google_cloud_retail_v2::model::Rule;
3686 /// use google_cloud_retail_v2::model::Condition;
3687 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3688 /// ```
3689 pub fn set_condition<T>(mut self, v: T) -> Self
3690 where
3691 T: std::convert::Into<crate::model::Condition>,
3692 {
3693 self.condition = std::option::Option::Some(v.into());
3694 self
3695 }
3696
3697 /// Sets or clears the value of [condition][crate::model::Rule::condition].
3698 ///
3699 /// # Example
3700 /// ```ignore,no_run
3701 /// # use google_cloud_retail_v2::model::Rule;
3702 /// use google_cloud_retail_v2::model::Condition;
3703 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3704 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3705 /// ```
3706 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3707 where
3708 T: std::convert::Into<crate::model::Condition>,
3709 {
3710 self.condition = v.map(|x| x.into());
3711 self
3712 }
3713
3714 /// Sets the value of [action][crate::model::Rule::action].
3715 ///
3716 /// Note that all the setters affecting `action` are mutually
3717 /// exclusive.
3718 ///
3719 /// # Example
3720 /// ```ignore,no_run
3721 /// # use google_cloud_retail_v2::model::Rule;
3722 /// use google_cloud_retail_v2::model::rule::BoostAction;
3723 /// let x = Rule::new().set_action(Some(
3724 /// google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3725 /// ```
3726 pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3727 mut self,
3728 v: T,
3729 ) -> Self {
3730 self.action = v.into();
3731 self
3732 }
3733
3734 /// The value of [action][crate::model::Rule::action]
3735 /// if it holds a `BoostAction`, `None` if the field is not set or
3736 /// holds a different branch.
3737 pub fn boost_action(
3738 &self,
3739 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3740 #[allow(unreachable_patterns)]
3741 self.action.as_ref().and_then(|v| match v {
3742 crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3743 _ => std::option::Option::None,
3744 })
3745 }
3746
3747 /// Sets the value of [action][crate::model::Rule::action]
3748 /// to hold a `BoostAction`.
3749 ///
3750 /// Note that all the setters affecting `action` are
3751 /// mutually exclusive.
3752 ///
3753 /// # Example
3754 /// ```ignore,no_run
3755 /// # use google_cloud_retail_v2::model::Rule;
3756 /// use google_cloud_retail_v2::model::rule::BoostAction;
3757 /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3758 /// assert!(x.boost_action().is_some());
3759 /// assert!(x.redirect_action().is_none());
3760 /// assert!(x.oneway_synonyms_action().is_none());
3761 /// assert!(x.do_not_associate_action().is_none());
3762 /// assert!(x.replacement_action().is_none());
3763 /// assert!(x.ignore_action().is_none());
3764 /// assert!(x.filter_action().is_none());
3765 /// assert!(x.twoway_synonyms_action().is_none());
3766 /// assert!(x.force_return_facet_action().is_none());
3767 /// assert!(x.remove_facet_action().is_none());
3768 /// assert!(x.pin_action().is_none());
3769 /// ```
3770 pub fn set_boost_action<
3771 T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3772 >(
3773 mut self,
3774 v: T,
3775 ) -> Self {
3776 self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3777 self
3778 }
3779
3780 /// The value of [action][crate::model::Rule::action]
3781 /// if it holds a `RedirectAction`, `None` if the field is not set or
3782 /// holds a different branch.
3783 pub fn redirect_action(
3784 &self,
3785 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3786 #[allow(unreachable_patterns)]
3787 self.action.as_ref().and_then(|v| match v {
3788 crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3789 _ => std::option::Option::None,
3790 })
3791 }
3792
3793 /// Sets the value of [action][crate::model::Rule::action]
3794 /// to hold a `RedirectAction`.
3795 ///
3796 /// Note that all the setters affecting `action` are
3797 /// mutually exclusive.
3798 ///
3799 /// # Example
3800 /// ```ignore,no_run
3801 /// # use google_cloud_retail_v2::model::Rule;
3802 /// use google_cloud_retail_v2::model::rule::RedirectAction;
3803 /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3804 /// assert!(x.redirect_action().is_some());
3805 /// assert!(x.boost_action().is_none());
3806 /// assert!(x.oneway_synonyms_action().is_none());
3807 /// assert!(x.do_not_associate_action().is_none());
3808 /// assert!(x.replacement_action().is_none());
3809 /// assert!(x.ignore_action().is_none());
3810 /// assert!(x.filter_action().is_none());
3811 /// assert!(x.twoway_synonyms_action().is_none());
3812 /// assert!(x.force_return_facet_action().is_none());
3813 /// assert!(x.remove_facet_action().is_none());
3814 /// assert!(x.pin_action().is_none());
3815 /// ```
3816 pub fn set_redirect_action<
3817 T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3818 >(
3819 mut self,
3820 v: T,
3821 ) -> Self {
3822 self.action =
3823 std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3824 self
3825 }
3826
3827 /// The value of [action][crate::model::Rule::action]
3828 /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3829 /// holds a different branch.
3830 pub fn oneway_synonyms_action(
3831 &self,
3832 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3833 #[allow(unreachable_patterns)]
3834 self.action.as_ref().and_then(|v| match v {
3835 crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3836 _ => std::option::Option::None,
3837 })
3838 }
3839
3840 /// Sets the value of [action][crate::model::Rule::action]
3841 /// to hold a `OnewaySynonymsAction`.
3842 ///
3843 /// Note that all the setters affecting `action` are
3844 /// mutually exclusive.
3845 ///
3846 /// # Example
3847 /// ```ignore,no_run
3848 /// # use google_cloud_retail_v2::model::Rule;
3849 /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3850 /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3851 /// assert!(x.oneway_synonyms_action().is_some());
3852 /// assert!(x.boost_action().is_none());
3853 /// assert!(x.redirect_action().is_none());
3854 /// assert!(x.do_not_associate_action().is_none());
3855 /// assert!(x.replacement_action().is_none());
3856 /// assert!(x.ignore_action().is_none());
3857 /// assert!(x.filter_action().is_none());
3858 /// assert!(x.twoway_synonyms_action().is_none());
3859 /// assert!(x.force_return_facet_action().is_none());
3860 /// assert!(x.remove_facet_action().is_none());
3861 /// assert!(x.pin_action().is_none());
3862 /// ```
3863 pub fn set_oneway_synonyms_action<
3864 T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3865 >(
3866 mut self,
3867 v: T,
3868 ) -> Self {
3869 self.action =
3870 std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3871 self
3872 }
3873
3874 /// The value of [action][crate::model::Rule::action]
3875 /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3876 /// holds a different branch.
3877 pub fn do_not_associate_action(
3878 &self,
3879 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3880 #[allow(unreachable_patterns)]
3881 self.action.as_ref().and_then(|v| match v {
3882 crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3883 _ => std::option::Option::None,
3884 })
3885 }
3886
3887 /// Sets the value of [action][crate::model::Rule::action]
3888 /// to hold a `DoNotAssociateAction`.
3889 ///
3890 /// Note that all the setters affecting `action` are
3891 /// mutually exclusive.
3892 ///
3893 /// # Example
3894 /// ```ignore,no_run
3895 /// # use google_cloud_retail_v2::model::Rule;
3896 /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3897 /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3898 /// assert!(x.do_not_associate_action().is_some());
3899 /// assert!(x.boost_action().is_none());
3900 /// assert!(x.redirect_action().is_none());
3901 /// assert!(x.oneway_synonyms_action().is_none());
3902 /// assert!(x.replacement_action().is_none());
3903 /// assert!(x.ignore_action().is_none());
3904 /// assert!(x.filter_action().is_none());
3905 /// assert!(x.twoway_synonyms_action().is_none());
3906 /// assert!(x.force_return_facet_action().is_none());
3907 /// assert!(x.remove_facet_action().is_none());
3908 /// assert!(x.pin_action().is_none());
3909 /// ```
3910 pub fn set_do_not_associate_action<
3911 T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3912 >(
3913 mut self,
3914 v: T,
3915 ) -> Self {
3916 self.action =
3917 std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3918 self
3919 }
3920
3921 /// The value of [action][crate::model::Rule::action]
3922 /// if it holds a `ReplacementAction`, `None` if the field is not set or
3923 /// holds a different branch.
3924 pub fn replacement_action(
3925 &self,
3926 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3927 #[allow(unreachable_patterns)]
3928 self.action.as_ref().and_then(|v| match v {
3929 crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3930 _ => std::option::Option::None,
3931 })
3932 }
3933
3934 /// Sets the value of [action][crate::model::Rule::action]
3935 /// to hold a `ReplacementAction`.
3936 ///
3937 /// Note that all the setters affecting `action` are
3938 /// mutually exclusive.
3939 ///
3940 /// # Example
3941 /// ```ignore,no_run
3942 /// # use google_cloud_retail_v2::model::Rule;
3943 /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3944 /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3945 /// assert!(x.replacement_action().is_some());
3946 /// assert!(x.boost_action().is_none());
3947 /// assert!(x.redirect_action().is_none());
3948 /// assert!(x.oneway_synonyms_action().is_none());
3949 /// assert!(x.do_not_associate_action().is_none());
3950 /// assert!(x.ignore_action().is_none());
3951 /// assert!(x.filter_action().is_none());
3952 /// assert!(x.twoway_synonyms_action().is_none());
3953 /// assert!(x.force_return_facet_action().is_none());
3954 /// assert!(x.remove_facet_action().is_none());
3955 /// assert!(x.pin_action().is_none());
3956 /// ```
3957 pub fn set_replacement_action<
3958 T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3959 >(
3960 mut self,
3961 v: T,
3962 ) -> Self {
3963 self.action =
3964 std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3965 self
3966 }
3967
3968 /// The value of [action][crate::model::Rule::action]
3969 /// if it holds a `IgnoreAction`, `None` if the field is not set or
3970 /// holds a different branch.
3971 pub fn ignore_action(
3972 &self,
3973 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3974 #[allow(unreachable_patterns)]
3975 self.action.as_ref().and_then(|v| match v {
3976 crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3977 _ => std::option::Option::None,
3978 })
3979 }
3980
3981 /// Sets the value of [action][crate::model::Rule::action]
3982 /// to hold a `IgnoreAction`.
3983 ///
3984 /// Note that all the setters affecting `action` are
3985 /// mutually exclusive.
3986 ///
3987 /// # Example
3988 /// ```ignore,no_run
3989 /// # use google_cloud_retail_v2::model::Rule;
3990 /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3991 /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3992 /// assert!(x.ignore_action().is_some());
3993 /// assert!(x.boost_action().is_none());
3994 /// assert!(x.redirect_action().is_none());
3995 /// assert!(x.oneway_synonyms_action().is_none());
3996 /// assert!(x.do_not_associate_action().is_none());
3997 /// assert!(x.replacement_action().is_none());
3998 /// assert!(x.filter_action().is_none());
3999 /// assert!(x.twoway_synonyms_action().is_none());
4000 /// assert!(x.force_return_facet_action().is_none());
4001 /// assert!(x.remove_facet_action().is_none());
4002 /// assert!(x.pin_action().is_none());
4003 /// ```
4004 pub fn set_ignore_action<
4005 T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
4006 >(
4007 mut self,
4008 v: T,
4009 ) -> Self {
4010 self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
4011 self
4012 }
4013
4014 /// The value of [action][crate::model::Rule::action]
4015 /// if it holds a `FilterAction`, `None` if the field is not set or
4016 /// holds a different branch.
4017 pub fn filter_action(
4018 &self,
4019 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
4020 #[allow(unreachable_patterns)]
4021 self.action.as_ref().and_then(|v| match v {
4022 crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
4023 _ => std::option::Option::None,
4024 })
4025 }
4026
4027 /// Sets the value of [action][crate::model::Rule::action]
4028 /// to hold a `FilterAction`.
4029 ///
4030 /// Note that all the setters affecting `action` are
4031 /// mutually exclusive.
4032 ///
4033 /// # Example
4034 /// ```ignore,no_run
4035 /// # use google_cloud_retail_v2::model::Rule;
4036 /// use google_cloud_retail_v2::model::rule::FilterAction;
4037 /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
4038 /// assert!(x.filter_action().is_some());
4039 /// assert!(x.boost_action().is_none());
4040 /// assert!(x.redirect_action().is_none());
4041 /// assert!(x.oneway_synonyms_action().is_none());
4042 /// assert!(x.do_not_associate_action().is_none());
4043 /// assert!(x.replacement_action().is_none());
4044 /// assert!(x.ignore_action().is_none());
4045 /// assert!(x.twoway_synonyms_action().is_none());
4046 /// assert!(x.force_return_facet_action().is_none());
4047 /// assert!(x.remove_facet_action().is_none());
4048 /// assert!(x.pin_action().is_none());
4049 /// ```
4050 pub fn set_filter_action<
4051 T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
4052 >(
4053 mut self,
4054 v: T,
4055 ) -> Self {
4056 self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4057 self
4058 }
4059
4060 /// The value of [action][crate::model::Rule::action]
4061 /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4062 /// holds a different branch.
4063 pub fn twoway_synonyms_action(
4064 &self,
4065 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4066 #[allow(unreachable_patterns)]
4067 self.action.as_ref().and_then(|v| match v {
4068 crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4069 _ => std::option::Option::None,
4070 })
4071 }
4072
4073 /// Sets the value of [action][crate::model::Rule::action]
4074 /// to hold a `TwowaySynonymsAction`.
4075 ///
4076 /// Note that all the setters affecting `action` are
4077 /// mutually exclusive.
4078 ///
4079 /// # Example
4080 /// ```ignore,no_run
4081 /// # use google_cloud_retail_v2::model::Rule;
4082 /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4083 /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4084 /// assert!(x.twoway_synonyms_action().is_some());
4085 /// assert!(x.boost_action().is_none());
4086 /// assert!(x.redirect_action().is_none());
4087 /// assert!(x.oneway_synonyms_action().is_none());
4088 /// assert!(x.do_not_associate_action().is_none());
4089 /// assert!(x.replacement_action().is_none());
4090 /// assert!(x.ignore_action().is_none());
4091 /// assert!(x.filter_action().is_none());
4092 /// assert!(x.force_return_facet_action().is_none());
4093 /// assert!(x.remove_facet_action().is_none());
4094 /// assert!(x.pin_action().is_none());
4095 /// ```
4096 pub fn set_twoway_synonyms_action<
4097 T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4098 >(
4099 mut self,
4100 v: T,
4101 ) -> Self {
4102 self.action =
4103 std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4104 self
4105 }
4106
4107 /// The value of [action][crate::model::Rule::action]
4108 /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4109 /// holds a different branch.
4110 pub fn force_return_facet_action(
4111 &self,
4112 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4113 #[allow(unreachable_patterns)]
4114 self.action.as_ref().and_then(|v| match v {
4115 crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4116 _ => std::option::Option::None,
4117 })
4118 }
4119
4120 /// Sets the value of [action][crate::model::Rule::action]
4121 /// to hold a `ForceReturnFacetAction`.
4122 ///
4123 /// Note that all the setters affecting `action` are
4124 /// mutually exclusive.
4125 ///
4126 /// # Example
4127 /// ```ignore,no_run
4128 /// # use google_cloud_retail_v2::model::Rule;
4129 /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4130 /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4131 /// assert!(x.force_return_facet_action().is_some());
4132 /// assert!(x.boost_action().is_none());
4133 /// assert!(x.redirect_action().is_none());
4134 /// assert!(x.oneway_synonyms_action().is_none());
4135 /// assert!(x.do_not_associate_action().is_none());
4136 /// assert!(x.replacement_action().is_none());
4137 /// assert!(x.ignore_action().is_none());
4138 /// assert!(x.filter_action().is_none());
4139 /// assert!(x.twoway_synonyms_action().is_none());
4140 /// assert!(x.remove_facet_action().is_none());
4141 /// assert!(x.pin_action().is_none());
4142 /// ```
4143 pub fn set_force_return_facet_action<
4144 T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4145 >(
4146 mut self,
4147 v: T,
4148 ) -> Self {
4149 self.action =
4150 std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4151 self
4152 }
4153
4154 /// The value of [action][crate::model::Rule::action]
4155 /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4156 /// holds a different branch.
4157 pub fn remove_facet_action(
4158 &self,
4159 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4160 #[allow(unreachable_patterns)]
4161 self.action.as_ref().and_then(|v| match v {
4162 crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4163 _ => std::option::Option::None,
4164 })
4165 }
4166
4167 /// Sets the value of [action][crate::model::Rule::action]
4168 /// to hold a `RemoveFacetAction`.
4169 ///
4170 /// Note that all the setters affecting `action` are
4171 /// mutually exclusive.
4172 ///
4173 /// # Example
4174 /// ```ignore,no_run
4175 /// # use google_cloud_retail_v2::model::Rule;
4176 /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4177 /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4178 /// assert!(x.remove_facet_action().is_some());
4179 /// assert!(x.boost_action().is_none());
4180 /// assert!(x.redirect_action().is_none());
4181 /// assert!(x.oneway_synonyms_action().is_none());
4182 /// assert!(x.do_not_associate_action().is_none());
4183 /// assert!(x.replacement_action().is_none());
4184 /// assert!(x.ignore_action().is_none());
4185 /// assert!(x.filter_action().is_none());
4186 /// assert!(x.twoway_synonyms_action().is_none());
4187 /// assert!(x.force_return_facet_action().is_none());
4188 /// assert!(x.pin_action().is_none());
4189 /// ```
4190 pub fn set_remove_facet_action<
4191 T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4192 >(
4193 mut self,
4194 v: T,
4195 ) -> Self {
4196 self.action =
4197 std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4198 self
4199 }
4200
4201 /// The value of [action][crate::model::Rule::action]
4202 /// if it holds a `PinAction`, `None` if the field is not set or
4203 /// holds a different branch.
4204 pub fn pin_action(
4205 &self,
4206 ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4207 #[allow(unreachable_patterns)]
4208 self.action.as_ref().and_then(|v| match v {
4209 crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4210 _ => std::option::Option::None,
4211 })
4212 }
4213
4214 /// Sets the value of [action][crate::model::Rule::action]
4215 /// to hold a `PinAction`.
4216 ///
4217 /// Note that all the setters affecting `action` are
4218 /// mutually exclusive.
4219 ///
4220 /// # Example
4221 /// ```ignore,no_run
4222 /// # use google_cloud_retail_v2::model::Rule;
4223 /// use google_cloud_retail_v2::model::rule::PinAction;
4224 /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4225 /// assert!(x.pin_action().is_some());
4226 /// assert!(x.boost_action().is_none());
4227 /// assert!(x.redirect_action().is_none());
4228 /// assert!(x.oneway_synonyms_action().is_none());
4229 /// assert!(x.do_not_associate_action().is_none());
4230 /// assert!(x.replacement_action().is_none());
4231 /// assert!(x.ignore_action().is_none());
4232 /// assert!(x.filter_action().is_none());
4233 /// assert!(x.twoway_synonyms_action().is_none());
4234 /// assert!(x.force_return_facet_action().is_none());
4235 /// assert!(x.remove_facet_action().is_none());
4236 /// ```
4237 pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4238 mut self,
4239 v: T,
4240 ) -> Self {
4241 self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4242 self
4243 }
4244}
4245
4246impl wkt::message::Message for Rule {
4247 fn typename() -> &'static str {
4248 "type.googleapis.com/google.cloud.retail.v2.Rule"
4249 }
4250}
4251
4252/// Defines additional types related to [Rule].
4253pub mod rule {
4254 #[allow(unused_imports)]
4255 use super::*;
4256
4257 /// A boost action to apply to results matching condition specified above.
4258 #[derive(Clone, Default, PartialEq)]
4259 #[non_exhaustive]
4260 pub struct BoostAction {
4261 /// Strength of the condition boost, which must be in [-1, 1]. Negative
4262 /// boost means demotion. Default is 0.0.
4263 ///
4264 /// Setting to 1.0 gives the item a big promotion. However, it does not
4265 /// necessarily mean that the boosted item will be the top result at all
4266 /// times, nor that other items will be excluded. Results could still be
4267 /// shown even when none of them matches the condition. And results that
4268 /// are significantly more relevant to the search query can still trump
4269 /// your heavily favored but irrelevant items.
4270 ///
4271 /// Setting to -1.0 gives the item a big demotion. However, results that
4272 /// are deeply relevant might still be shown. The item will have an
4273 /// upstream battle to get a fairly high ranking, but it is not blocked out
4274 /// completely.
4275 ///
4276 /// Setting to 0.0 means no boost applied. The boosting condition is
4277 /// ignored.
4278 pub boost: f32,
4279
4280 /// The filter can have a max size of 5000 characters.
4281 /// An expression which specifies which products to apply an action to.
4282 /// The syntax and supported fields are the same as a filter expression. See
4283 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4284 /// detail syntax and limitations.
4285 ///
4286 /// Examples:
4287 ///
4288 /// * To boost products with product ID "product_1" or "product_2", and
4289 /// color
4290 /// "Red" or "Blue":\<br\>
4291 /// *(id: ANY("product_1", "product_2"))<br>*
4292 /// *AND<br>*
4293 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4294 ///
4295 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4296 pub products_filter: std::string::String,
4297
4298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4299 }
4300
4301 impl BoostAction {
4302 /// Creates a new default instance.
4303 pub fn new() -> Self {
4304 std::default::Default::default()
4305 }
4306
4307 /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4308 ///
4309 /// # Example
4310 /// ```ignore,no_run
4311 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4312 /// let x = BoostAction::new().set_boost(42.0);
4313 /// ```
4314 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4315 self.boost = v.into();
4316 self
4317 }
4318
4319 /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4320 ///
4321 /// # Example
4322 /// ```ignore,no_run
4323 /// # use google_cloud_retail_v2::model::rule::BoostAction;
4324 /// let x = BoostAction::new().set_products_filter("example");
4325 /// ```
4326 pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4327 mut self,
4328 v: T,
4329 ) -> Self {
4330 self.products_filter = v.into();
4331 self
4332 }
4333 }
4334
4335 impl wkt::message::Message for BoostAction {
4336 fn typename() -> &'static str {
4337 "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4338 }
4339 }
4340
4341 /// * Rule Condition:
4342 ///
4343 /// - No
4344 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4345 /// provided is a global match.
4346 /// - 1 or more
4347 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4348 /// provided are combined with OR operator.
4349 /// * Action Input: The request query and filter that are applied to the
4350 /// retrieved products, in addition to any filters already provided with the
4351 /// SearchRequest. The AND operator is used to combine the query's existing
4352 /// filters with the filter rule(s). NOTE: May result in 0 results when
4353 /// filters conflict.
4354 ///
4355 /// * Action Result: Filters the returned objects to be ONLY those that passed
4356 /// the filter.
4357 ///
4358 ///
4359 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4360 #[derive(Clone, Default, PartialEq)]
4361 #[non_exhaustive]
4362 pub struct FilterAction {
4363 /// A filter to apply on the matching condition results. Supported features:
4364 ///
4365 /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4366 /// * Filter syntax is identical to
4367 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4368 /// more
4369 /// information, see [Filter](/retail/docs/filter-and-order#filter).
4370 /// * To filter products with product ID "product_1" or "product_2", and
4371 /// color
4372 /// "Red" or "Blue":\<br\>
4373 /// *(id: ANY("product_1", "product_2"))<br>*
4374 /// *AND<br>*
4375 /// *(colorFamilies: ANY("Red", "Blue"))<br>*
4376 ///
4377 /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4378 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4379 pub filter: std::string::String,
4380
4381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4382 }
4383
4384 impl FilterAction {
4385 /// Creates a new default instance.
4386 pub fn new() -> Self {
4387 std::default::Default::default()
4388 }
4389
4390 /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4391 ///
4392 /// # Example
4393 /// ```ignore,no_run
4394 /// # use google_cloud_retail_v2::model::rule::FilterAction;
4395 /// let x = FilterAction::new().set_filter("example");
4396 /// ```
4397 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4398 self.filter = v.into();
4399 self
4400 }
4401 }
4402
4403 impl wkt::message::Message for FilterAction {
4404 fn typename() -> &'static str {
4405 "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4406 }
4407 }
4408
4409 /// Redirects a shopper to a specific page.
4410 ///
4411 /// * Rule Condition:
4412 /// Must specify
4413 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4414 /// * Action Input: Request Query
4415 /// * Action Result: Redirects shopper to provided uri.
4416 ///
4417 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4418 #[derive(Clone, Default, PartialEq)]
4419 #[non_exhaustive]
4420 pub struct RedirectAction {
4421 /// URL must have length equal or less than 2000 characters.
4422 pub redirect_uri: std::string::String,
4423
4424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4425 }
4426
4427 impl RedirectAction {
4428 /// Creates a new default instance.
4429 pub fn new() -> Self {
4430 std::default::Default::default()
4431 }
4432
4433 /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4434 ///
4435 /// # Example
4436 /// ```ignore,no_run
4437 /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4438 /// let x = RedirectAction::new().set_redirect_uri("example");
4439 /// ```
4440 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4441 mut self,
4442 v: T,
4443 ) -> Self {
4444 self.redirect_uri = v.into();
4445 self
4446 }
4447 }
4448
4449 impl wkt::message::Message for RedirectAction {
4450 fn typename() -> &'static str {
4451 "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4452 }
4453 }
4454
4455 /// Creates a set of terms that will be treated as synonyms of each other.
4456 /// Example: synonyms of "sneakers" and "shoes":
4457 ///
4458 /// * "sneakers" will use a synonym of "shoes".
4459 /// * "shoes" will use a synonym of "sneakers".
4460 #[derive(Clone, Default, PartialEq)]
4461 #[non_exhaustive]
4462 pub struct TwowaySynonymsAction {
4463 /// Defines a set of synonyms.
4464 /// Can specify up to 100 synonyms.
4465 /// Must specify at least 2 synonyms.
4466 pub synonyms: std::vec::Vec<std::string::String>,
4467
4468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4469 }
4470
4471 impl TwowaySynonymsAction {
4472 /// Creates a new default instance.
4473 pub fn new() -> Self {
4474 std::default::Default::default()
4475 }
4476
4477 /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4478 ///
4479 /// # Example
4480 /// ```ignore,no_run
4481 /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4482 /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4483 /// ```
4484 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4485 where
4486 T: std::iter::IntoIterator<Item = V>,
4487 V: std::convert::Into<std::string::String>,
4488 {
4489 use std::iter::Iterator;
4490 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4491 self
4492 }
4493 }
4494
4495 impl wkt::message::Message for TwowaySynonymsAction {
4496 fn typename() -> &'static str {
4497 "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4498 }
4499 }
4500
4501 /// Maps a set of terms to a set of synonyms.
4502 /// Set of synonyms will be treated as synonyms of each query term only.
4503 /// `query_terms` will not be treated as synonyms of each other.
4504 /// Example: "sneakers" will use a synonym of "shoes".
4505 /// "shoes" will not use a synonym of "sneakers".
4506 #[derive(Clone, Default, PartialEq)]
4507 #[non_exhaustive]
4508 pub struct OnewaySynonymsAction {
4509 /// Terms from the search query.
4510 /// Will treat synonyms as their synonyms.
4511 /// Not themselves synonyms of the synonyms.
4512 /// Can specify up to 100 terms.
4513 pub query_terms: std::vec::Vec<std::string::String>,
4514
4515 /// Defines a set of synonyms.
4516 /// Cannot contain duplicates.
4517 /// Can specify up to 100 synonyms.
4518 pub synonyms: std::vec::Vec<std::string::String>,
4519
4520 /// Will be [deprecated = true] post migration;
4521 pub oneway_terms: std::vec::Vec<std::string::String>,
4522
4523 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4524 }
4525
4526 impl OnewaySynonymsAction {
4527 /// Creates a new default instance.
4528 pub fn new() -> Self {
4529 std::default::Default::default()
4530 }
4531
4532 /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4533 ///
4534 /// # Example
4535 /// ```ignore,no_run
4536 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4537 /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4538 /// ```
4539 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4540 where
4541 T: std::iter::IntoIterator<Item = V>,
4542 V: std::convert::Into<std::string::String>,
4543 {
4544 use std::iter::Iterator;
4545 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4546 self
4547 }
4548
4549 /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4554 /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4555 /// ```
4556 pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4557 where
4558 T: std::iter::IntoIterator<Item = V>,
4559 V: std::convert::Into<std::string::String>,
4560 {
4561 use std::iter::Iterator;
4562 self.synonyms = v.into_iter().map(|i| i.into()).collect();
4563 self
4564 }
4565
4566 /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4567 ///
4568 /// # Example
4569 /// ```ignore,no_run
4570 /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4571 /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4572 /// ```
4573 pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4574 where
4575 T: std::iter::IntoIterator<Item = V>,
4576 V: std::convert::Into<std::string::String>,
4577 {
4578 use std::iter::Iterator;
4579 self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4580 self
4581 }
4582 }
4583
4584 impl wkt::message::Message for OnewaySynonymsAction {
4585 fn typename() -> &'static str {
4586 "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4587 }
4588 }
4589
4590 /// Prevents `query_term` from being associated with specified terms during
4591 /// search.
4592 /// Example: Don't associate "gShoe" and "cheap".
4593 #[derive(Clone, Default, PartialEq)]
4594 #[non_exhaustive]
4595 pub struct DoNotAssociateAction {
4596 /// Terms from the search query.
4597 /// Will not consider do_not_associate_terms for search if in search query.
4598 /// Can specify up to 100 terms.
4599 pub query_terms: std::vec::Vec<std::string::String>,
4600
4601 /// Cannot contain duplicates or the query term.
4602 /// Can specify up to 100 terms.
4603 pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4604
4605 /// Will be [deprecated = true] post migration;
4606 pub terms: std::vec::Vec<std::string::String>,
4607
4608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4609 }
4610
4611 impl DoNotAssociateAction {
4612 /// Creates a new default instance.
4613 pub fn new() -> Self {
4614 std::default::Default::default()
4615 }
4616
4617 /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4618 ///
4619 /// # Example
4620 /// ```ignore,no_run
4621 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4622 /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4623 /// ```
4624 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4625 where
4626 T: std::iter::IntoIterator<Item = V>,
4627 V: std::convert::Into<std::string::String>,
4628 {
4629 use std::iter::Iterator;
4630 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4631 self
4632 }
4633
4634 /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4635 ///
4636 /// # Example
4637 /// ```ignore,no_run
4638 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4639 /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4640 /// ```
4641 pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4642 where
4643 T: std::iter::IntoIterator<Item = V>,
4644 V: std::convert::Into<std::string::String>,
4645 {
4646 use std::iter::Iterator;
4647 self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4648 self
4649 }
4650
4651 /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4652 ///
4653 /// # Example
4654 /// ```ignore,no_run
4655 /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4656 /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4657 /// ```
4658 pub fn set_terms<T, V>(mut self, v: T) -> Self
4659 where
4660 T: std::iter::IntoIterator<Item = V>,
4661 V: std::convert::Into<std::string::String>,
4662 {
4663 use std::iter::Iterator;
4664 self.terms = v.into_iter().map(|i| i.into()).collect();
4665 self
4666 }
4667 }
4668
4669 impl wkt::message::Message for DoNotAssociateAction {
4670 fn typename() -> &'static str {
4671 "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4672 }
4673 }
4674
4675 /// Replaces a term in the query. Multiple replacement candidates can be
4676 /// specified. All `query_terms` will be replaced with the replacement term.
4677 /// Example: Replace "gShoe" with "google shoe".
4678 #[derive(Clone, Default, PartialEq)]
4679 #[non_exhaustive]
4680 pub struct ReplacementAction {
4681 /// Terms from the search query.
4682 /// Will be replaced by replacement term.
4683 /// Can specify up to 100 terms.
4684 pub query_terms: std::vec::Vec<std::string::String>,
4685
4686 /// Term that will be used for replacement.
4687 pub replacement_term: std::string::String,
4688
4689 /// Will be [deprecated = true] post migration;
4690 pub term: std::string::String,
4691
4692 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4693 }
4694
4695 impl ReplacementAction {
4696 /// Creates a new default instance.
4697 pub fn new() -> Self {
4698 std::default::Default::default()
4699 }
4700
4701 /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4702 ///
4703 /// # Example
4704 /// ```ignore,no_run
4705 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4706 /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4707 /// ```
4708 pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4709 where
4710 T: std::iter::IntoIterator<Item = V>,
4711 V: std::convert::Into<std::string::String>,
4712 {
4713 use std::iter::Iterator;
4714 self.query_terms = v.into_iter().map(|i| i.into()).collect();
4715 self
4716 }
4717
4718 /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4719 ///
4720 /// # Example
4721 /// ```ignore,no_run
4722 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4723 /// let x = ReplacementAction::new().set_replacement_term("example");
4724 /// ```
4725 pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4726 mut self,
4727 v: T,
4728 ) -> Self {
4729 self.replacement_term = v.into();
4730 self
4731 }
4732
4733 /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4734 ///
4735 /// # Example
4736 /// ```ignore,no_run
4737 /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4738 /// let x = ReplacementAction::new().set_term("example");
4739 /// ```
4740 pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4741 self.term = v.into();
4742 self
4743 }
4744 }
4745
4746 impl wkt::message::Message for ReplacementAction {
4747 fn typename() -> &'static str {
4748 "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4749 }
4750 }
4751
4752 /// Prevents a term in the query from being used in search.
4753 /// Example: Don't search for "shoddy".
4754 #[derive(Clone, Default, PartialEq)]
4755 #[non_exhaustive]
4756 pub struct IgnoreAction {
4757 /// Terms to ignore in the search query.
4758 pub ignore_terms: std::vec::Vec<std::string::String>,
4759
4760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4761 }
4762
4763 impl IgnoreAction {
4764 /// Creates a new default instance.
4765 pub fn new() -> Self {
4766 std::default::Default::default()
4767 }
4768
4769 /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4770 ///
4771 /// # Example
4772 /// ```ignore,no_run
4773 /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4774 /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4775 /// ```
4776 pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4777 where
4778 T: std::iter::IntoIterator<Item = V>,
4779 V: std::convert::Into<std::string::String>,
4780 {
4781 use std::iter::Iterator;
4782 self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4783 self
4784 }
4785 }
4786
4787 impl wkt::message::Message for IgnoreAction {
4788 fn typename() -> &'static str {
4789 "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4790 }
4791 }
4792
4793 /// Force returns an attribute/facet in the request around a certain position
4794 /// or above.
4795 ///
4796 /// * Rule Condition:
4797 /// Must specify non-empty
4798 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4799 /// (for search only) or
4800 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4801 /// (for browse only), but can't specify both.
4802 ///
4803 /// * Action Inputs: attribute name, position
4804 ///
4805 /// * Action Result: Will force return a facet key around a certain position
4806 /// or above if the condition is satisfied.
4807 ///
4808 ///
4809 /// Example: Suppose the query is "shoes", the
4810 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4811 /// "shoes", the
4812 /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4813 /// is "size" and the
4814 /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4815 /// is 8.
4816 ///
4817 /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4818 /// the facet "size" will appear at a position close to 8. b) The facet key
4819 /// "size" in among the top 8 positions in the request, then it will stay at
4820 /// its current rank.
4821 ///
4822 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4823 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4824 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4825 /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4826 #[derive(Clone, Default, PartialEq)]
4827 #[non_exhaustive]
4828 pub struct ForceReturnFacetAction {
4829 /// Each instance corresponds to a force return attribute for the given
4830 /// condition. There can't be more 15 instances here.
4831 pub facet_position_adjustments:
4832 std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4833
4834 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4835 }
4836
4837 impl ForceReturnFacetAction {
4838 /// Creates a new default instance.
4839 pub fn new() -> Self {
4840 std::default::Default::default()
4841 }
4842
4843 /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4844 ///
4845 /// # Example
4846 /// ```ignore,no_run
4847 /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4848 /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4849 /// let x = ForceReturnFacetAction::new()
4850 /// .set_facet_position_adjustments([
4851 /// FacetPositionAdjustment::default()/* use setters */,
4852 /// FacetPositionAdjustment::default()/* use (different) setters */,
4853 /// ]);
4854 /// ```
4855 pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4856 where
4857 T: std::iter::IntoIterator<Item = V>,
4858 V: std::convert::Into<
4859 crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4860 >,
4861 {
4862 use std::iter::Iterator;
4863 self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4864 self
4865 }
4866 }
4867
4868 impl wkt::message::Message for ForceReturnFacetAction {
4869 fn typename() -> &'static str {
4870 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4871 }
4872 }
4873
4874 /// Defines additional types related to [ForceReturnFacetAction].
4875 pub mod force_return_facet_action {
4876 #[allow(unused_imports)]
4877 use super::*;
4878
4879 /// Each facet position adjustment consists of a single attribute name (i.e.
4880 /// facet key) along with a specified position.
4881 #[derive(Clone, Default, PartialEq)]
4882 #[non_exhaustive]
4883 pub struct FacetPositionAdjustment {
4884 /// The attribute name to force return as a facet. Each attribute name
4885 /// should be a valid attribute name, be non-empty and contain at most 80
4886 /// characters long.
4887 pub attribute_name: std::string::String,
4888
4889 /// This is the position in the request as explained above. It should be
4890 /// strictly positive be at most 100.
4891 pub position: i32,
4892
4893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4894 }
4895
4896 impl FacetPositionAdjustment {
4897 /// Creates a new default instance.
4898 pub fn new() -> Self {
4899 std::default::Default::default()
4900 }
4901
4902 /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4903 ///
4904 /// # Example
4905 /// ```ignore,no_run
4906 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4907 /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4908 /// ```
4909 pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4910 mut self,
4911 v: T,
4912 ) -> Self {
4913 self.attribute_name = v.into();
4914 self
4915 }
4916
4917 /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4918 ///
4919 /// # Example
4920 /// ```ignore,no_run
4921 /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4922 /// let x = FacetPositionAdjustment::new().set_position(42);
4923 /// ```
4924 pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4925 self.position = v.into();
4926 self
4927 }
4928 }
4929
4930 impl wkt::message::Message for FacetPositionAdjustment {
4931 fn typename() -> &'static str {
4932 "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4933 }
4934 }
4935 }
4936
4937 /// Removes an attribute/facet in the request if is present.
4938 ///
4939 /// * Rule Condition:
4940 /// Must specify non-empty
4941 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4942 /// (for search only) or
4943 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4944 /// (for browse only), but can't specify both.
4945 ///
4946 /// * Action Input: attribute name
4947 ///
4948 /// * Action Result: Will remove the attribute (as a facet) from the request
4949 /// if it is present.
4950 ///
4951 ///
4952 /// Example: Suppose the query is "shoes", the
4953 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4954 /// "shoes" and the attribute name "size", then facet key "size" will be
4955 /// removed from the request (if it is present).
4956 ///
4957 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4958 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4959 #[derive(Clone, Default, PartialEq)]
4960 #[non_exhaustive]
4961 pub struct RemoveFacetAction {
4962 /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4963 /// (if present in the request). There can't be more 3 attribute names.
4964 /// Each attribute name should be a valid attribute name, be non-empty and
4965 /// contain at most 80 characters.
4966 pub attribute_names: std::vec::Vec<std::string::String>,
4967
4968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4969 }
4970
4971 impl RemoveFacetAction {
4972 /// Creates a new default instance.
4973 pub fn new() -> Self {
4974 std::default::Default::default()
4975 }
4976
4977 /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4978 ///
4979 /// # Example
4980 /// ```ignore,no_run
4981 /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4982 /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4983 /// ```
4984 pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4985 where
4986 T: std::iter::IntoIterator<Item = V>,
4987 V: std::convert::Into<std::string::String>,
4988 {
4989 use std::iter::Iterator;
4990 self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4991 self
4992 }
4993 }
4994
4995 impl wkt::message::Message for RemoveFacetAction {
4996 fn typename() -> &'static str {
4997 "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
4998 }
4999 }
5000
5001 /// Pins one or more specified products to a specific position in the
5002 /// results.
5003 ///
5004 /// * Rule Condition:
5005 /// Must specify non-empty
5006 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
5007 /// (for search only) or
5008 /// [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
5009 /// (for browse only), but can't specify both.
5010 ///
5011 /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
5012 /// uses 1-based indexing).
5013 ///
5014 /// * Action Result: Will pin products with matching ids to the position
5015 /// specified in the final result order.
5016 ///
5017 ///
5018 /// Example: Suppose the query is `shoes`, the
5019 /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
5020 /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
5021 /// pinned to the top position in the final results.
5022 ///
5023 /// If multiple PinActions are matched to a single request the actions will
5024 /// be processed from most to least recently updated.
5025 ///
5026 /// Pins to positions larger than the max allowed page size of 120 are not
5027 /// allowed.
5028 ///
5029 /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
5030 /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
5031 #[derive(Clone, Default, PartialEq)]
5032 #[non_exhaustive]
5033 pub struct PinAction {
5034 /// Required. A map of positions to product_ids.
5035 ///
5036 /// Partial matches per action are allowed, if a certain position in the map
5037 /// is already filled that `[position, product_id]` pair will be ignored
5038 /// but the rest may still be applied. This case will only occur if multiple
5039 /// pin actions are matched to a single request, as the map guarantees that
5040 /// pin positions are unique within the same action.
5041 ///
5042 /// Duplicate product_ids are not permitted within a single pin map.
5043 ///
5044 /// The max size of this map is 120, equivalent to the max [request page
5045 /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
5046 pub pin_map: std::collections::HashMap<i64, std::string::String>,
5047
5048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5049 }
5050
5051 impl PinAction {
5052 /// Creates a new default instance.
5053 pub fn new() -> Self {
5054 std::default::Default::default()
5055 }
5056
5057 /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
5058 ///
5059 /// # Example
5060 /// ```ignore,no_run
5061 /// # use google_cloud_retail_v2::model::rule::PinAction;
5062 /// let x = PinAction::new().set_pin_map([
5063 /// (0, "abc"),
5064 /// (1, "xyz"),
5065 /// ]);
5066 /// ```
5067 pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
5068 where
5069 T: std::iter::IntoIterator<Item = (K, V)>,
5070 K: std::convert::Into<i64>,
5071 V: std::convert::Into<std::string::String>,
5072 {
5073 use std::iter::Iterator;
5074 self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5075 self
5076 }
5077 }
5078
5079 impl wkt::message::Message for PinAction {
5080 fn typename() -> &'static str {
5081 "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5082 }
5083 }
5084
5085 /// An action must be provided.
5086 #[derive(Clone, Debug, PartialEq)]
5087 #[non_exhaustive]
5088 pub enum Action {
5089 /// A boost action.
5090 BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5091 /// Redirects a shopper to a specific page.
5092 RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5093 /// Treats specific term as a synonym with a group of terms.
5094 /// Group of terms will not be treated as synonyms with the specific term.
5095 OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5096 /// Prevents term from being associated with other terms.
5097 DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5098 /// Replaces specific terms in the query.
5099 ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5100 /// Ignores specific terms from query during search.
5101 IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5102 /// Filters results.
5103 FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5104 /// Treats a set of terms as synonyms of one another.
5105 TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5106 /// Force returns an attribute as a facet in the request.
5107 ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5108 /// Remove an attribute as a facet in the request (if present).
5109 RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5110 /// Pins one or more specified products to a specific position in the
5111 /// results.
5112 PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5113 }
5114}
5115
5116/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5117/// whom it's sold.
5118///
5119/// [google.cloud.retail.v2.Product]: crate::model::Product
5120#[derive(Clone, Default, PartialEq)]
5121#[non_exhaustive]
5122pub struct Audience {
5123 /// The genders of the audience. Strongly encouraged to use the standard
5124 /// values: "male", "female", "unisex".
5125 ///
5126 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5127 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5128 /// is returned.
5129 ///
5130 /// Google Merchant Center property
5131 /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5132 /// property
5133 /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5134 pub genders: std::vec::Vec<std::string::String>,
5135
5136 /// The age groups of the audience. Strongly encouraged to use the standard
5137 /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5138 /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5139 /// teens or older).
5140 ///
5141 /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5142 /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5143 /// is returned.
5144 ///
5145 /// Google Merchant Center property
5146 /// [age_group](https://support.google.com/merchants/answer/6324463).
5147 /// Schema.org property
5148 /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5149 /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5150 pub age_groups: std::vec::Vec<std::string::String>,
5151
5152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5153}
5154
5155impl Audience {
5156 /// Creates a new default instance.
5157 pub fn new() -> Self {
5158 std::default::Default::default()
5159 }
5160
5161 /// Sets the value of [genders][crate::model::Audience::genders].
5162 ///
5163 /// # Example
5164 /// ```ignore,no_run
5165 /// # use google_cloud_retail_v2::model::Audience;
5166 /// let x = Audience::new().set_genders(["a", "b", "c"]);
5167 /// ```
5168 pub fn set_genders<T, V>(mut self, v: T) -> Self
5169 where
5170 T: std::iter::IntoIterator<Item = V>,
5171 V: std::convert::Into<std::string::String>,
5172 {
5173 use std::iter::Iterator;
5174 self.genders = v.into_iter().map(|i| i.into()).collect();
5175 self
5176 }
5177
5178 /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5179 ///
5180 /// # Example
5181 /// ```ignore,no_run
5182 /// # use google_cloud_retail_v2::model::Audience;
5183 /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5184 /// ```
5185 pub fn set_age_groups<T, V>(mut self, v: T) -> Self
5186 where
5187 T: std::iter::IntoIterator<Item = V>,
5188 V: std::convert::Into<std::string::String>,
5189 {
5190 use std::iter::Iterator;
5191 self.age_groups = v.into_iter().map(|i| i.into()).collect();
5192 self
5193 }
5194}
5195
5196impl wkt::message::Message for Audience {
5197 fn typename() -> &'static str {
5198 "type.googleapis.com/google.cloud.retail.v2.Audience"
5199 }
5200}
5201
5202/// The color information of a [Product][google.cloud.retail.v2.Product].
5203///
5204/// [google.cloud.retail.v2.Product]: crate::model::Product
5205#[derive(Clone, Default, PartialEq)]
5206#[non_exhaustive]
5207pub struct ColorInfo {
5208 /// The standard color families. Strongly recommended to use the following
5209 /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5210 /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5211 /// Normally it is expected to have only 1 color family. May consider using
5212 /// single "Mixed" instead of multiple values.
5213 ///
5214 /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5215 /// string with a length limit of 128 characters. Otherwise, an
5216 /// INVALID_ARGUMENT error is returned.
5217 ///
5218 /// Google Merchant Center property
5219 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5220 /// property [Product.color](https://schema.org/color).
5221 ///
5222 /// The colorFamilies field as a system attribute is not a required field but
5223 /// strongly recommended to be specified. Google Search models treat this field
5224 /// as more important than a custom product attribute when specified.
5225 pub color_families: std::vec::Vec<std::string::String>,
5226
5227 /// The color display names, which may be different from standard color family
5228 /// names, such as the color aliases used in the website frontend. Normally
5229 /// it is expected to have only 1 color. May consider using single "Mixed"
5230 /// instead of multiple values.
5231 ///
5232 /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5233 /// string with a length limit of 128 characters. Otherwise, an
5234 /// INVALID_ARGUMENT error is returned.
5235 ///
5236 /// Google Merchant Center property
5237 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5238 /// property [Product.color](https://schema.org/color).
5239 pub colors: std::vec::Vec<std::string::String>,
5240
5241 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5242}
5243
5244impl ColorInfo {
5245 /// Creates a new default instance.
5246 pub fn new() -> Self {
5247 std::default::Default::default()
5248 }
5249
5250 /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5251 ///
5252 /// # Example
5253 /// ```ignore,no_run
5254 /// # use google_cloud_retail_v2::model::ColorInfo;
5255 /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5256 /// ```
5257 pub fn set_color_families<T, V>(mut self, v: T) -> Self
5258 where
5259 T: std::iter::IntoIterator<Item = V>,
5260 V: std::convert::Into<std::string::String>,
5261 {
5262 use std::iter::Iterator;
5263 self.color_families = v.into_iter().map(|i| i.into()).collect();
5264 self
5265 }
5266
5267 /// Sets the value of [colors][crate::model::ColorInfo::colors].
5268 ///
5269 /// # Example
5270 /// ```ignore,no_run
5271 /// # use google_cloud_retail_v2::model::ColorInfo;
5272 /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5273 /// ```
5274 pub fn set_colors<T, V>(mut self, v: T) -> Self
5275 where
5276 T: std::iter::IntoIterator<Item = V>,
5277 V: std::convert::Into<std::string::String>,
5278 {
5279 use std::iter::Iterator;
5280 self.colors = v.into_iter().map(|i| i.into()).collect();
5281 self
5282 }
5283}
5284
5285impl wkt::message::Message for ColorInfo {
5286 fn typename() -> &'static str {
5287 "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5288 }
5289}
5290
5291/// A custom attribute that is not explicitly modeled in
5292/// [Product][google.cloud.retail.v2.Product].
5293///
5294/// [google.cloud.retail.v2.Product]: crate::model::Product
5295#[derive(Clone, Default, PartialEq)]
5296#[non_exhaustive]
5297pub struct CustomAttribute {
5298 /// The textual values of this custom attribute. For example, `["yellow",
5299 /// "green"]` when the key is "color".
5300 ///
5301 /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5302 /// returned.
5303 ///
5304 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5305 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5306 /// Otherwise, an INVALID_ARGUMENT error is returned.
5307 ///
5308 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5309 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5310 pub text: std::vec::Vec<std::string::String>,
5311
5312 /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5313 /// when the key is "lengths_cm".
5314 ///
5315 /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5316 /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5317 /// Otherwise, an INVALID_ARGUMENT error is returned.
5318 ///
5319 /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5320 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5321 pub numbers: std::vec::Vec<f64>,
5322
5323 /// This field is normally ignored unless
5324 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5325 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5326 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5327 /// attribute configuration, see [Configuration
5328 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5329 /// If true, custom attribute values are searchable by text queries in
5330 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5331 ///
5332 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5333 ///
5334 /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5335 /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5336 ///
5337 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5338 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5339 /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5340 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5341 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5342 #[deprecated]
5343 pub searchable: std::option::Option<bool>,
5344
5345 /// This field is normally ignored unless
5346 /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5347 /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5348 /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5349 /// attribute configuration, see [Configuration
5350 /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5351 /// If true, custom attribute values are indexed, so that they can be filtered,
5352 /// faceted or boosted in
5353 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5354 ///
5355 /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5356 ///
5357 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5358 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5359 /// and
5360 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5361 /// for more details.
5362 ///
5363 /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5364 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5365 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5366 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5367 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5368 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5369 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5370 #[deprecated]
5371 pub indexable: std::option::Option<bool>,
5372
5373 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5374}
5375
5376impl CustomAttribute {
5377 /// Creates a new default instance.
5378 pub fn new() -> Self {
5379 std::default::Default::default()
5380 }
5381
5382 /// Sets the value of [text][crate::model::CustomAttribute::text].
5383 ///
5384 /// # Example
5385 /// ```ignore,no_run
5386 /// # use google_cloud_retail_v2::model::CustomAttribute;
5387 /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5388 /// ```
5389 pub fn set_text<T, V>(mut self, v: T) -> Self
5390 where
5391 T: std::iter::IntoIterator<Item = V>,
5392 V: std::convert::Into<std::string::String>,
5393 {
5394 use std::iter::Iterator;
5395 self.text = v.into_iter().map(|i| i.into()).collect();
5396 self
5397 }
5398
5399 /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5400 ///
5401 /// # Example
5402 /// ```ignore,no_run
5403 /// # use google_cloud_retail_v2::model::CustomAttribute;
5404 /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5405 /// ```
5406 pub fn set_numbers<T, V>(mut self, v: T) -> Self
5407 where
5408 T: std::iter::IntoIterator<Item = V>,
5409 V: std::convert::Into<f64>,
5410 {
5411 use std::iter::Iterator;
5412 self.numbers = v.into_iter().map(|i| i.into()).collect();
5413 self
5414 }
5415
5416 /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5417 ///
5418 /// # Example
5419 /// ```ignore,no_run
5420 /// # use google_cloud_retail_v2::model::CustomAttribute;
5421 /// let x = CustomAttribute::new().set_searchable(true);
5422 /// ```
5423 #[deprecated]
5424 pub fn set_searchable<T>(mut self, v: T) -> Self
5425 where
5426 T: std::convert::Into<bool>,
5427 {
5428 self.searchable = std::option::Option::Some(v.into());
5429 self
5430 }
5431
5432 /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5433 ///
5434 /// # Example
5435 /// ```ignore,no_run
5436 /// # use google_cloud_retail_v2::model::CustomAttribute;
5437 /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5438 /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5439 /// ```
5440 #[deprecated]
5441 pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5442 where
5443 T: std::convert::Into<bool>,
5444 {
5445 self.searchable = v.map(|x| x.into());
5446 self
5447 }
5448
5449 /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5450 ///
5451 /// # Example
5452 /// ```ignore,no_run
5453 /// # use google_cloud_retail_v2::model::CustomAttribute;
5454 /// let x = CustomAttribute::new().set_indexable(true);
5455 /// ```
5456 #[deprecated]
5457 pub fn set_indexable<T>(mut self, v: T) -> Self
5458 where
5459 T: std::convert::Into<bool>,
5460 {
5461 self.indexable = std::option::Option::Some(v.into());
5462 self
5463 }
5464
5465 /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_cloud_retail_v2::model::CustomAttribute;
5470 /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5471 /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5472 /// ```
5473 #[deprecated]
5474 pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5475 where
5476 T: std::convert::Into<bool>,
5477 {
5478 self.indexable = v.map(|x| x.into());
5479 self
5480 }
5481}
5482
5483impl wkt::message::Message for CustomAttribute {
5484 fn typename() -> &'static str {
5485 "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5486 }
5487}
5488
5489/// Fulfillment information, such as the store IDs for in-store pickup or region
5490/// IDs for different shipping methods.
5491#[derive(Clone, Default, PartialEq)]
5492#[non_exhaustive]
5493pub struct FulfillmentInfo {
5494 /// The fulfillment type, including commonly used types (such as pickup in
5495 /// store and same day delivery), and custom types. Customers have to map
5496 /// custom types to their display names before rendering UI.
5497 ///
5498 /// Supported values:
5499 ///
5500 /// * "pickup-in-store"
5501 /// * "ship-to-store"
5502 /// * "same-day-delivery"
5503 /// * "next-day-delivery"
5504 /// * "custom-type-1"
5505 /// * "custom-type-2"
5506 /// * "custom-type-3"
5507 /// * "custom-type-4"
5508 /// * "custom-type-5"
5509 ///
5510 /// If this field is set to an invalid value other than these, an
5511 /// INVALID_ARGUMENT error is returned.
5512 pub r#type: std::string::String,
5513
5514 /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5515 /// as the store IDs for
5516 /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5517 /// or the region IDs for
5518 /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5519 ///
5520 /// A maximum of 3000 values are allowed. Each value must be a string with a
5521 /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5522 /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5523 /// returned.
5524 ///
5525 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5526 pub place_ids: std::vec::Vec<std::string::String>,
5527
5528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5529}
5530
5531impl FulfillmentInfo {
5532 /// Creates a new default instance.
5533 pub fn new() -> Self {
5534 std::default::Default::default()
5535 }
5536
5537 /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5538 ///
5539 /// # Example
5540 /// ```ignore,no_run
5541 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5542 /// let x = FulfillmentInfo::new().set_type("example");
5543 /// ```
5544 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5545 self.r#type = v.into();
5546 self
5547 }
5548
5549 /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5550 ///
5551 /// # Example
5552 /// ```ignore,no_run
5553 /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5554 /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5555 /// ```
5556 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5557 where
5558 T: std::iter::IntoIterator<Item = V>,
5559 V: std::convert::Into<std::string::String>,
5560 {
5561 use std::iter::Iterator;
5562 self.place_ids = v.into_iter().map(|i| i.into()).collect();
5563 self
5564 }
5565}
5566
5567impl wkt::message::Message for FulfillmentInfo {
5568 fn typename() -> &'static str {
5569 "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5570 }
5571}
5572
5573/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5574/// Retail Search use product images to improve prediction and search results.
5575/// Product images can be returned in results, and are shown in prediction or
5576/// search previews in the console. Please try to provide correct product images
5577/// and avoid using images with size too small.
5578///
5579/// [google.cloud.retail.v2.Product]: crate::model::Product
5580#[derive(Clone, Default, PartialEq)]
5581#[non_exhaustive]
5582pub struct Image {
5583 /// Required. URI of the image.
5584 ///
5585 /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5586 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5587 ///
5588 /// Google Merchant Center property
5589 /// [image_link](https://support.google.com/merchants/answer/6324350).
5590 /// Schema.org property [Product.image](https://schema.org/image).
5591 pub uri: std::string::String,
5592
5593 /// Height of the image in number of pixels.
5594 ///
5595 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5596 /// returned.
5597 pub height: i32,
5598
5599 /// Width of the image in number of pixels.
5600 ///
5601 /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5602 /// returned.
5603 pub width: i32,
5604
5605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5606}
5607
5608impl Image {
5609 /// Creates a new default instance.
5610 pub fn new() -> Self {
5611 std::default::Default::default()
5612 }
5613
5614 /// Sets the value of [uri][crate::model::Image::uri].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_cloud_retail_v2::model::Image;
5619 /// let x = Image::new().set_uri("example");
5620 /// ```
5621 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5622 self.uri = v.into();
5623 self
5624 }
5625
5626 /// Sets the value of [height][crate::model::Image::height].
5627 ///
5628 /// # Example
5629 /// ```ignore,no_run
5630 /// # use google_cloud_retail_v2::model::Image;
5631 /// let x = Image::new().set_height(42);
5632 /// ```
5633 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5634 self.height = v.into();
5635 self
5636 }
5637
5638 /// Sets the value of [width][crate::model::Image::width].
5639 ///
5640 /// # Example
5641 /// ```ignore,no_run
5642 /// # use google_cloud_retail_v2::model::Image;
5643 /// let x = Image::new().set_width(42);
5644 /// ```
5645 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5646 self.width = v.into();
5647 self
5648 }
5649}
5650
5651impl wkt::message::Message for Image {
5652 fn typename() -> &'static str {
5653 "type.googleapis.com/google.cloud.retail.v2.Image"
5654 }
5655}
5656
5657/// A floating point interval.
5658#[derive(Clone, Default, PartialEq)]
5659#[non_exhaustive]
5660pub struct Interval {
5661 /// The lower bound of the interval. If neither of the min fields are set, then
5662 /// the lower bound is negative infinity.
5663 ///
5664 /// This field must not be larger than max.
5665 /// Otherwise, an INVALID_ARGUMENT error is returned.
5666 pub min: std::option::Option<crate::model::interval::Min>,
5667
5668 /// The upper bound of the interval. If neither of the max fields are set, then
5669 /// the upper bound is positive infinity.
5670 ///
5671 /// This field must be not smaller than min.
5672 /// Otherwise, an INVALID_ARGUMENT error is returned.
5673 pub max: std::option::Option<crate::model::interval::Max>,
5674
5675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5676}
5677
5678impl Interval {
5679 /// Creates a new default instance.
5680 pub fn new() -> Self {
5681 std::default::Default::default()
5682 }
5683
5684 /// Sets the value of [min][crate::model::Interval::min].
5685 ///
5686 /// Note that all the setters affecting `min` are mutually
5687 /// exclusive.
5688 ///
5689 /// # Example
5690 /// ```ignore,no_run
5691 /// # use google_cloud_retail_v2::model::Interval;
5692 /// use google_cloud_retail_v2::model::interval::Min;
5693 /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5694 /// ```
5695 pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5696 mut self,
5697 v: T,
5698 ) -> Self {
5699 self.min = v.into();
5700 self
5701 }
5702
5703 /// The value of [min][crate::model::Interval::min]
5704 /// if it holds a `Minimum`, `None` if the field is not set or
5705 /// holds a different branch.
5706 pub fn minimum(&self) -> std::option::Option<&f64> {
5707 #[allow(unreachable_patterns)]
5708 self.min.as_ref().and_then(|v| match v {
5709 crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5710 _ => std::option::Option::None,
5711 })
5712 }
5713
5714 /// Sets the value of [min][crate::model::Interval::min]
5715 /// to hold a `Minimum`.
5716 ///
5717 /// Note that all the setters affecting `min` are
5718 /// mutually exclusive.
5719 ///
5720 /// # Example
5721 /// ```ignore,no_run
5722 /// # use google_cloud_retail_v2::model::Interval;
5723 /// let x = Interval::new().set_minimum(42.0);
5724 /// assert!(x.minimum().is_some());
5725 /// assert!(x.exclusive_minimum().is_none());
5726 /// ```
5727 pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5728 self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5729 self
5730 }
5731
5732 /// The value of [min][crate::model::Interval::min]
5733 /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5734 /// holds a different branch.
5735 pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5736 #[allow(unreachable_patterns)]
5737 self.min.as_ref().and_then(|v| match v {
5738 crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5739 _ => std::option::Option::None,
5740 })
5741 }
5742
5743 /// Sets the value of [min][crate::model::Interval::min]
5744 /// to hold a `ExclusiveMinimum`.
5745 ///
5746 /// Note that all the setters affecting `min` are
5747 /// mutually exclusive.
5748 ///
5749 /// # Example
5750 /// ```ignore,no_run
5751 /// # use google_cloud_retail_v2::model::Interval;
5752 /// let x = Interval::new().set_exclusive_minimum(42.0);
5753 /// assert!(x.exclusive_minimum().is_some());
5754 /// assert!(x.minimum().is_none());
5755 /// ```
5756 pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5757 self.min =
5758 std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5759 self
5760 }
5761
5762 /// Sets the value of [max][crate::model::Interval::max].
5763 ///
5764 /// Note that all the setters affecting `max` are mutually
5765 /// exclusive.
5766 ///
5767 /// # Example
5768 /// ```ignore,no_run
5769 /// # use google_cloud_retail_v2::model::Interval;
5770 /// use google_cloud_retail_v2::model::interval::Max;
5771 /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5772 /// ```
5773 pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5774 mut self,
5775 v: T,
5776 ) -> Self {
5777 self.max = v.into();
5778 self
5779 }
5780
5781 /// The value of [max][crate::model::Interval::max]
5782 /// if it holds a `Maximum`, `None` if the field is not set or
5783 /// holds a different branch.
5784 pub fn maximum(&self) -> std::option::Option<&f64> {
5785 #[allow(unreachable_patterns)]
5786 self.max.as_ref().and_then(|v| match v {
5787 crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5788 _ => std::option::Option::None,
5789 })
5790 }
5791
5792 /// Sets the value of [max][crate::model::Interval::max]
5793 /// to hold a `Maximum`.
5794 ///
5795 /// Note that all the setters affecting `max` are
5796 /// mutually exclusive.
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_retail_v2::model::Interval;
5801 /// let x = Interval::new().set_maximum(42.0);
5802 /// assert!(x.maximum().is_some());
5803 /// assert!(x.exclusive_maximum().is_none());
5804 /// ```
5805 pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5806 self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5807 self
5808 }
5809
5810 /// The value of [max][crate::model::Interval::max]
5811 /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5812 /// holds a different branch.
5813 pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5814 #[allow(unreachable_patterns)]
5815 self.max.as_ref().and_then(|v| match v {
5816 crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5817 _ => std::option::Option::None,
5818 })
5819 }
5820
5821 /// Sets the value of [max][crate::model::Interval::max]
5822 /// to hold a `ExclusiveMaximum`.
5823 ///
5824 /// Note that all the setters affecting `max` are
5825 /// mutually exclusive.
5826 ///
5827 /// # Example
5828 /// ```ignore,no_run
5829 /// # use google_cloud_retail_v2::model::Interval;
5830 /// let x = Interval::new().set_exclusive_maximum(42.0);
5831 /// assert!(x.exclusive_maximum().is_some());
5832 /// assert!(x.maximum().is_none());
5833 /// ```
5834 pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5835 self.max =
5836 std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5837 self
5838 }
5839}
5840
5841impl wkt::message::Message for Interval {
5842 fn typename() -> &'static str {
5843 "type.googleapis.com/google.cloud.retail.v2.Interval"
5844 }
5845}
5846
5847/// Defines additional types related to [Interval].
5848pub mod interval {
5849 #[allow(unused_imports)]
5850 use super::*;
5851
5852 /// The lower bound of the interval. If neither of the min fields are set, then
5853 /// the lower bound is negative infinity.
5854 ///
5855 /// This field must not be larger than max.
5856 /// Otherwise, an INVALID_ARGUMENT error is returned.
5857 #[derive(Clone, Debug, PartialEq)]
5858 #[non_exhaustive]
5859 pub enum Min {
5860 /// Inclusive lower bound.
5861 Minimum(f64),
5862 /// Exclusive lower bound.
5863 ExclusiveMinimum(f64),
5864 }
5865
5866 /// The upper bound of the interval. If neither of the max fields are set, then
5867 /// the upper bound is positive infinity.
5868 ///
5869 /// This field must be not smaller than min.
5870 /// Otherwise, an INVALID_ARGUMENT error is returned.
5871 #[derive(Clone, Debug, PartialEq)]
5872 #[non_exhaustive]
5873 pub enum Max {
5874 /// Inclusive upper bound.
5875 Maximum(f64),
5876 /// Exclusive upper bound.
5877 ExclusiveMaximum(f64),
5878 }
5879}
5880
5881/// The price information of a [Product][google.cloud.retail.v2.Product].
5882///
5883/// [google.cloud.retail.v2.Product]: crate::model::Product
5884#[derive(Clone, Default, PartialEq)]
5885#[non_exhaustive]
5886pub struct PriceInfo {
5887 /// The 3-letter currency code defined in [ISO
5888 /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5889 ///
5890 /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5891 /// error is returned.
5892 ///
5893 /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5894 /// [Product][google.cloud.retail.v2.Product]s with the same
5895 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5896 /// must share the same
5897 /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5898 /// a FAILED_PRECONDITION error is returned.
5899 ///
5900 /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5901 /// [google.cloud.retail.v2.Product]: crate::model::Product
5902 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5903 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5904 pub currency_code: std::string::String,
5905
5906 /// Price of the product.
5907 ///
5908 /// Google Merchant Center property
5909 /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5910 /// property [Offer.price](https://schema.org/price).
5911 pub price: f32,
5912
5913 /// Price of the product without any discount. If zero, by default set to be
5914 /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5915 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5916 /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5917 /// otherwise an INVALID_ARGUMENT error is thrown.
5918 ///
5919 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5920 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5921 pub original_price: f32,
5922
5923 /// The costs associated with the sale of a particular product. Used for gross
5924 /// profit reporting.
5925 ///
5926 /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5927 /// [cost][google.cloud.retail.v2.PriceInfo.cost]
5928 ///
5929 /// Google Merchant Center property
5930 /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5931 ///
5932 /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5933 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5934 pub cost: f32,
5935
5936 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5937 /// starts to be effective. This can be set as a future timestamp, and the
5938 /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5939 /// after
5940 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5941 /// If so, the
5942 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5943 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5944 /// is used before
5945 /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5946 ///
5947 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5948 /// effective because it will cause additional latency during search.
5949 ///
5950 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5951 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5952 /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5953 pub price_effective_time: std::option::Option<wkt::Timestamp>,
5954
5955 /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5956 /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5957 /// is used for search before
5958 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5959 /// this field is set, the
5960 /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5961 /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5962 /// is used after
5963 /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5964 ///
5965 /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5966 /// effective because it will cause additional latency during search.
5967 ///
5968 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5969 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5970 /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5971 pub price_expire_time: std::option::Option<wkt::Timestamp>,
5972
5973 /// Output only. The price range of all the child
5974 /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5975 /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5976 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5977 /// [Product][google.cloud.retail.v2.Product]. Only populated for
5978 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5979 /// [Product][google.cloud.retail.v2.Product]s.
5980 ///
5981 /// Note: This field is OUTPUT_ONLY for
5982 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5983 /// Do not set this field in API requests.
5984 ///
5985 /// [google.cloud.retail.v2.Product]: crate::model::Product
5986 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5987 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5988 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5989 pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5990
5991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5992}
5993
5994impl PriceInfo {
5995 /// Creates a new default instance.
5996 pub fn new() -> Self {
5997 std::default::Default::default()
5998 }
5999
6000 /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
6001 ///
6002 /// # Example
6003 /// ```ignore,no_run
6004 /// # use google_cloud_retail_v2::model::PriceInfo;
6005 /// let x = PriceInfo::new().set_currency_code("example");
6006 /// ```
6007 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6008 self.currency_code = v.into();
6009 self
6010 }
6011
6012 /// Sets the value of [price][crate::model::PriceInfo::price].
6013 ///
6014 /// # Example
6015 /// ```ignore,no_run
6016 /// # use google_cloud_retail_v2::model::PriceInfo;
6017 /// let x = PriceInfo::new().set_price(42.0);
6018 /// ```
6019 pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6020 self.price = v.into();
6021 self
6022 }
6023
6024 /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
6025 ///
6026 /// # Example
6027 /// ```ignore,no_run
6028 /// # use google_cloud_retail_v2::model::PriceInfo;
6029 /// let x = PriceInfo::new().set_original_price(42.0);
6030 /// ```
6031 pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6032 self.original_price = v.into();
6033 self
6034 }
6035
6036 /// Sets the value of [cost][crate::model::PriceInfo::cost].
6037 ///
6038 /// # Example
6039 /// ```ignore,no_run
6040 /// # use google_cloud_retail_v2::model::PriceInfo;
6041 /// let x = PriceInfo::new().set_cost(42.0);
6042 /// ```
6043 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6044 self.cost = v.into();
6045 self
6046 }
6047
6048 /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6049 ///
6050 /// # Example
6051 /// ```ignore,no_run
6052 /// # use google_cloud_retail_v2::model::PriceInfo;
6053 /// use wkt::Timestamp;
6054 /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
6055 /// ```
6056 pub fn set_price_effective_time<T>(mut self, v: T) -> Self
6057 where
6058 T: std::convert::Into<wkt::Timestamp>,
6059 {
6060 self.price_effective_time = std::option::Option::Some(v.into());
6061 self
6062 }
6063
6064 /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6065 ///
6066 /// # Example
6067 /// ```ignore,no_run
6068 /// # use google_cloud_retail_v2::model::PriceInfo;
6069 /// use wkt::Timestamp;
6070 /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
6071 /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
6072 /// ```
6073 pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6074 where
6075 T: std::convert::Into<wkt::Timestamp>,
6076 {
6077 self.price_effective_time = v.map(|x| x.into());
6078 self
6079 }
6080
6081 /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6082 ///
6083 /// # Example
6084 /// ```ignore,no_run
6085 /// # use google_cloud_retail_v2::model::PriceInfo;
6086 /// use wkt::Timestamp;
6087 /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6088 /// ```
6089 pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6090 where
6091 T: std::convert::Into<wkt::Timestamp>,
6092 {
6093 self.price_expire_time = std::option::Option::Some(v.into());
6094 self
6095 }
6096
6097 /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6098 ///
6099 /// # Example
6100 /// ```ignore,no_run
6101 /// # use google_cloud_retail_v2::model::PriceInfo;
6102 /// use wkt::Timestamp;
6103 /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6104 /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6105 /// ```
6106 pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6107 where
6108 T: std::convert::Into<wkt::Timestamp>,
6109 {
6110 self.price_expire_time = v.map(|x| x.into());
6111 self
6112 }
6113
6114 /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6115 ///
6116 /// # Example
6117 /// ```ignore,no_run
6118 /// # use google_cloud_retail_v2::model::PriceInfo;
6119 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6120 /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6121 /// ```
6122 pub fn set_price_range<T>(mut self, v: T) -> Self
6123 where
6124 T: std::convert::Into<crate::model::price_info::PriceRange>,
6125 {
6126 self.price_range = std::option::Option::Some(v.into());
6127 self
6128 }
6129
6130 /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6131 ///
6132 /// # Example
6133 /// ```ignore,no_run
6134 /// # use google_cloud_retail_v2::model::PriceInfo;
6135 /// use google_cloud_retail_v2::model::price_info::PriceRange;
6136 /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6137 /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6138 /// ```
6139 pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6140 where
6141 T: std::convert::Into<crate::model::price_info::PriceRange>,
6142 {
6143 self.price_range = v.map(|x| x.into());
6144 self
6145 }
6146}
6147
6148impl wkt::message::Message for PriceInfo {
6149 fn typename() -> &'static str {
6150 "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6151 }
6152}
6153
6154/// Defines additional types related to [PriceInfo].
6155pub mod price_info {
6156 #[allow(unused_imports)]
6157 use super::*;
6158
6159 /// The price range of all
6160 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6161 /// [Product][google.cloud.retail.v2.Product] having the same
6162 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6163 ///
6164 /// [google.cloud.retail.v2.Product]: crate::model::Product
6165 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6166 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6167 #[derive(Clone, Default, PartialEq)]
6168 #[non_exhaustive]
6169 pub struct PriceRange {
6170 /// The inclusive
6171 /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6172 /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6173 /// [Product][google.cloud.retail.v2.Product] having the same
6174 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6175 ///
6176 /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6177 /// [google.cloud.retail.v2.Product]: crate::model::Product
6178 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6179 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6180 pub price: std::option::Option<crate::model::Interval>,
6181
6182 /// The inclusive
6183 /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6184 /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6185 /// [Product][google.cloud.retail.v2.Product] having the same
6186 /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6187 ///
6188 /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6189 /// [google.cloud.retail.v2.Product]: crate::model::Product
6190 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6191 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6192 pub original_price: std::option::Option<crate::model::Interval>,
6193
6194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6195 }
6196
6197 impl PriceRange {
6198 /// Creates a new default instance.
6199 pub fn new() -> Self {
6200 std::default::Default::default()
6201 }
6202
6203 /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6204 ///
6205 /// # Example
6206 /// ```ignore,no_run
6207 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6208 /// use google_cloud_retail_v2::model::Interval;
6209 /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6210 /// ```
6211 pub fn set_price<T>(mut self, v: T) -> Self
6212 where
6213 T: std::convert::Into<crate::model::Interval>,
6214 {
6215 self.price = std::option::Option::Some(v.into());
6216 self
6217 }
6218
6219 /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6220 ///
6221 /// # Example
6222 /// ```ignore,no_run
6223 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6224 /// use google_cloud_retail_v2::model::Interval;
6225 /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6226 /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6227 /// ```
6228 pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6229 where
6230 T: std::convert::Into<crate::model::Interval>,
6231 {
6232 self.price = v.map(|x| x.into());
6233 self
6234 }
6235
6236 /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6237 ///
6238 /// # Example
6239 /// ```ignore,no_run
6240 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6241 /// use google_cloud_retail_v2::model::Interval;
6242 /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6243 /// ```
6244 pub fn set_original_price<T>(mut self, v: T) -> Self
6245 where
6246 T: std::convert::Into<crate::model::Interval>,
6247 {
6248 self.original_price = std::option::Option::Some(v.into());
6249 self
6250 }
6251
6252 /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6253 ///
6254 /// # Example
6255 /// ```ignore,no_run
6256 /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6257 /// use google_cloud_retail_v2::model::Interval;
6258 /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6259 /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6260 /// ```
6261 pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6262 where
6263 T: std::convert::Into<crate::model::Interval>,
6264 {
6265 self.original_price = v.map(|x| x.into());
6266 self
6267 }
6268 }
6269
6270 impl wkt::message::Message for PriceRange {
6271 fn typename() -> &'static str {
6272 "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6273 }
6274 }
6275}
6276
6277/// The rating of a [Product][google.cloud.retail.v2.Product].
6278///
6279/// [google.cloud.retail.v2.Product]: crate::model::Product
6280#[derive(Clone, Default, PartialEq)]
6281#[non_exhaustive]
6282pub struct Rating {
6283 /// The total number of ratings. This value is independent of the value of
6284 /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6285 ///
6286 /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6287 /// returned.
6288 ///
6289 /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6290 pub rating_count: i32,
6291
6292 /// The average rating of the [Product][google.cloud.retail.v2.Product].
6293 ///
6294 /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6295 /// returned.
6296 ///
6297 /// [google.cloud.retail.v2.Product]: crate::model::Product
6298 pub average_rating: f32,
6299
6300 /// List of rating counts per rating value (index = rating - 1). The list is
6301 /// empty if there is no rating. If the list is non-empty, its size is
6302 /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6303 ///
6304 /// For example, [41, 14, 13, 47, 303]. It means that the
6305 /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6306 /// ratings with 2 star, and so on.
6307 ///
6308 /// [google.cloud.retail.v2.Product]: crate::model::Product
6309 pub rating_histogram: std::vec::Vec<i32>,
6310
6311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6312}
6313
6314impl Rating {
6315 /// Creates a new default instance.
6316 pub fn new() -> Self {
6317 std::default::Default::default()
6318 }
6319
6320 /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6321 ///
6322 /// # Example
6323 /// ```ignore,no_run
6324 /// # use google_cloud_retail_v2::model::Rating;
6325 /// let x = Rating::new().set_rating_count(42);
6326 /// ```
6327 pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6328 self.rating_count = v.into();
6329 self
6330 }
6331
6332 /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6333 ///
6334 /// # Example
6335 /// ```ignore,no_run
6336 /// # use google_cloud_retail_v2::model::Rating;
6337 /// let x = Rating::new().set_average_rating(42.0);
6338 /// ```
6339 pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6340 self.average_rating = v.into();
6341 self
6342 }
6343
6344 /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6345 ///
6346 /// # Example
6347 /// ```ignore,no_run
6348 /// # use google_cloud_retail_v2::model::Rating;
6349 /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6350 /// ```
6351 pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6352 where
6353 T: std::iter::IntoIterator<Item = V>,
6354 V: std::convert::Into<i32>,
6355 {
6356 use std::iter::Iterator;
6357 self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6358 self
6359 }
6360}
6361
6362impl wkt::message::Message for Rating {
6363 fn typename() -> &'static str {
6364 "type.googleapis.com/google.cloud.retail.v2.Rating"
6365 }
6366}
6367
6368/// Information of an end user.
6369#[derive(Clone, Default, PartialEq)]
6370#[non_exhaustive]
6371pub struct UserInfo {
6372 /// Highly recommended for logged-in users. Unique identifier for logged-in
6373 /// user, such as a user name. Don't set for anonymous users.
6374 ///
6375 /// Always use a hashed value for this ID.
6376 ///
6377 /// Don't set the field to the same fixed ID for different users. This mixes
6378 /// the event history of those users together, which results in degraded
6379 /// model quality.
6380 ///
6381 /// The field must be a UTF-8 encoded string with a length limit of 128
6382 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6383 pub user_id: std::string::String,
6384
6385 /// The end user's IP address. This field is used to extract location
6386 /// information for personalization.
6387 ///
6388 /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6389 /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6390 /// INVALID_ARGUMENT error is returned.
6391 ///
6392 /// This should not be set when:
6393 ///
6394 /// * setting
6395 /// [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6396 /// * using the JavaScript tag in
6397 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6398 /// or if
6399 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6400 /// is set.
6401 ///
6402 /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6403 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6404 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6405 pub ip_address: std::string::String,
6406
6407 /// User agent as included in the HTTP header.
6408 /// The field must be a UTF-8 encoded string with a length limit of 1,000
6409 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6410 ///
6411 /// This should not be set when using the client side event reporting with
6412 /// GTM or JavaScript tag in
6413 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6414 /// or if
6415 /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6416 /// is set.
6417 ///
6418 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6419 /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6420 pub user_agent: std::string::String,
6421
6422 /// True if the request is made directly from the end user, in which case the
6423 /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6424 /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6425 /// from the HTTP request. This flag should be set only if the API request is
6426 /// made directly from the end user such as a mobile app (and not if a gateway
6427 /// or a server is processing and pushing the user events).
6428 ///
6429 /// This should not be set when using the JavaScript tag in
6430 /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6431 ///
6432 /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6433 /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6434 /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6435 pub direct_user_request: bool,
6436
6437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6438}
6439
6440impl UserInfo {
6441 /// Creates a new default instance.
6442 pub fn new() -> Self {
6443 std::default::Default::default()
6444 }
6445
6446 /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6447 ///
6448 /// # Example
6449 /// ```ignore,no_run
6450 /// # use google_cloud_retail_v2::model::UserInfo;
6451 /// let x = UserInfo::new().set_user_id("example");
6452 /// ```
6453 pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6454 self.user_id = v.into();
6455 self
6456 }
6457
6458 /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6459 ///
6460 /// # Example
6461 /// ```ignore,no_run
6462 /// # use google_cloud_retail_v2::model::UserInfo;
6463 /// let x = UserInfo::new().set_ip_address("example");
6464 /// ```
6465 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6466 self.ip_address = v.into();
6467 self
6468 }
6469
6470 /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6471 ///
6472 /// # Example
6473 /// ```ignore,no_run
6474 /// # use google_cloud_retail_v2::model::UserInfo;
6475 /// let x = UserInfo::new().set_user_agent("example");
6476 /// ```
6477 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6478 self.user_agent = v.into();
6479 self
6480 }
6481
6482 /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6483 ///
6484 /// # Example
6485 /// ```ignore,no_run
6486 /// # use google_cloud_retail_v2::model::UserInfo;
6487 /// let x = UserInfo::new().set_direct_user_request(true);
6488 /// ```
6489 pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6490 self.direct_user_request = v.into();
6491 self
6492 }
6493}
6494
6495impl wkt::message::Message for UserInfo {
6496 fn typename() -> &'static str {
6497 "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6498 }
6499}
6500
6501/// The inventory information at a place (e.g. a store) identified
6502/// by a place ID.
6503#[derive(Clone, Default, PartialEq)]
6504#[non_exhaustive]
6505pub struct LocalInventory {
6506 /// Optional. The place ID for the current set of inventory information.
6507 pub place_id: std::string::String,
6508
6509 /// Optional. Product price and cost information.
6510 ///
6511 /// Google Merchant Center property
6512 /// [price](https://support.google.com/merchants/answer/6324371).
6513 pub price_info: std::option::Option<crate::model::PriceInfo>,
6514
6515 /// Optional. Additional local inventory attributes, for example, store name,
6516 /// promotion tags, etc.
6517 ///
6518 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6519 /// error is returned:
6520 ///
6521 /// * At most 30 attributes are allowed.
6522 /// * The key must be a UTF-8 encoded string with a length limit of 32
6523 /// characters.
6524 /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6525 /// key0LikeThis or KEY_1_LIKE_THIS.
6526 /// * The attribute values must be of the same type (text or number).
6527 /// * Only 1 value is allowed for each attribute.
6528 /// * For text values, the length limit is 256 UTF-8 characters.
6529 /// * The attribute does not support search. The `searchable` field should be
6530 /// unset or set to false.
6531 /// * The max summed total bytes of custom attribute keys and values per
6532 /// product is 5MiB.
6533 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6534
6535 /// Optional. Supported fulfillment types. Valid fulfillment type values
6536 /// include commonly used types (such as pickup in store and same day
6537 /// delivery), and custom types. Customers have to map custom types to their
6538 /// display names before rendering UI.
6539 ///
6540 /// Supported values:
6541 ///
6542 /// * "pickup-in-store"
6543 /// * "ship-to-store"
6544 /// * "same-day-delivery"
6545 /// * "next-day-delivery"
6546 /// * "custom-type-1"
6547 /// * "custom-type-2"
6548 /// * "custom-type-3"
6549 /// * "custom-type-4"
6550 /// * "custom-type-5"
6551 ///
6552 /// If this field is set to an invalid value other than these, an
6553 /// INVALID_ARGUMENT error is returned.
6554 ///
6555 /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6556 /// returned.
6557 pub fulfillment_types: std::vec::Vec<std::string::String>,
6558
6559 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6560}
6561
6562impl LocalInventory {
6563 /// Creates a new default instance.
6564 pub fn new() -> Self {
6565 std::default::Default::default()
6566 }
6567
6568 /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6569 ///
6570 /// # Example
6571 /// ```ignore,no_run
6572 /// # use google_cloud_retail_v2::model::LocalInventory;
6573 /// let x = LocalInventory::new().set_place_id("example");
6574 /// ```
6575 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6576 self.place_id = v.into();
6577 self
6578 }
6579
6580 /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6581 ///
6582 /// # Example
6583 /// ```ignore,no_run
6584 /// # use google_cloud_retail_v2::model::LocalInventory;
6585 /// use google_cloud_retail_v2::model::PriceInfo;
6586 /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6587 /// ```
6588 pub fn set_price_info<T>(mut self, v: T) -> Self
6589 where
6590 T: std::convert::Into<crate::model::PriceInfo>,
6591 {
6592 self.price_info = std::option::Option::Some(v.into());
6593 self
6594 }
6595
6596 /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6597 ///
6598 /// # Example
6599 /// ```ignore,no_run
6600 /// # use google_cloud_retail_v2::model::LocalInventory;
6601 /// use google_cloud_retail_v2::model::PriceInfo;
6602 /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6603 /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6604 /// ```
6605 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6606 where
6607 T: std::convert::Into<crate::model::PriceInfo>,
6608 {
6609 self.price_info = v.map(|x| x.into());
6610 self
6611 }
6612
6613 /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6614 ///
6615 /// # Example
6616 /// ```ignore,no_run
6617 /// # use google_cloud_retail_v2::model::LocalInventory;
6618 /// use google_cloud_retail_v2::model::CustomAttribute;
6619 /// let x = LocalInventory::new().set_attributes([
6620 /// ("key0", CustomAttribute::default()/* use setters */),
6621 /// ("key1", CustomAttribute::default()/* use (different) setters */),
6622 /// ]);
6623 /// ```
6624 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6625 where
6626 T: std::iter::IntoIterator<Item = (K, V)>,
6627 K: std::convert::Into<std::string::String>,
6628 V: std::convert::Into<crate::model::CustomAttribute>,
6629 {
6630 use std::iter::Iterator;
6631 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6632 self
6633 }
6634
6635 /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6636 ///
6637 /// # Example
6638 /// ```ignore,no_run
6639 /// # use google_cloud_retail_v2::model::LocalInventory;
6640 /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6641 /// ```
6642 pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6643 where
6644 T: std::iter::IntoIterator<Item = V>,
6645 V: std::convert::Into<std::string::String>,
6646 {
6647 use std::iter::Iterator;
6648 self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6649 self
6650 }
6651}
6652
6653impl wkt::message::Message for LocalInventory {
6654 fn typename() -> &'static str {
6655 "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6656 }
6657}
6658
6659/// Metadata for pinning to be returned in the response.
6660/// This is used for distinguishing between applied vs dropped pins.
6661#[derive(Clone, Default, PartialEq)]
6662#[non_exhaustive]
6663pub struct PinControlMetadata {
6664 /// Map of all matched pins, keyed by pin position.
6665 pub all_matched_pins:
6666 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6667
6668 /// Map of pins that were dropped due to overlap with other matching pins,
6669 /// keyed by pin position.
6670 pub dropped_pins:
6671 std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6672
6673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6674}
6675
6676impl PinControlMetadata {
6677 /// Creates a new default instance.
6678 pub fn new() -> Self {
6679 std::default::Default::default()
6680 }
6681
6682 /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6683 ///
6684 /// # Example
6685 /// ```ignore,no_run
6686 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6687 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6688 /// let x = PinControlMetadata::new().set_all_matched_pins([
6689 /// (0, ProductPins::default()/* use setters */),
6690 /// (1, ProductPins::default()/* use (different) setters */),
6691 /// ]);
6692 /// ```
6693 pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6694 where
6695 T: std::iter::IntoIterator<Item = (K, V)>,
6696 K: std::convert::Into<i64>,
6697 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6698 {
6699 use std::iter::Iterator;
6700 self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6701 self
6702 }
6703
6704 /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6705 ///
6706 /// # Example
6707 /// ```ignore,no_run
6708 /// # use google_cloud_retail_v2::model::PinControlMetadata;
6709 /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6710 /// let x = PinControlMetadata::new().set_dropped_pins([
6711 /// (0, ProductPins::default()/* use setters */),
6712 /// (1, ProductPins::default()/* use (different) setters */),
6713 /// ]);
6714 /// ```
6715 pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6716 where
6717 T: std::iter::IntoIterator<Item = (K, V)>,
6718 K: std::convert::Into<i64>,
6719 V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6720 {
6721 use std::iter::Iterator;
6722 self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6723 self
6724 }
6725}
6726
6727impl wkt::message::Message for PinControlMetadata {
6728 fn typename() -> &'static str {
6729 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6730 }
6731}
6732
6733/// Defines additional types related to [PinControlMetadata].
6734pub mod pin_control_metadata {
6735 #[allow(unused_imports)]
6736 use super::*;
6737
6738 /// List of product ids which have associated pins.
6739 #[derive(Clone, Default, PartialEq)]
6740 #[non_exhaustive]
6741 pub struct ProductPins {
6742 /// List of product ids which have associated pins.
6743 pub product_id: std::vec::Vec<std::string::String>,
6744
6745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6746 }
6747
6748 impl ProductPins {
6749 /// Creates a new default instance.
6750 pub fn new() -> Self {
6751 std::default::Default::default()
6752 }
6753
6754 /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6755 ///
6756 /// # Example
6757 /// ```ignore,no_run
6758 /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6759 /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6760 /// ```
6761 pub fn set_product_id<T, V>(mut self, v: T) -> Self
6762 where
6763 T: std::iter::IntoIterator<Item = V>,
6764 V: std::convert::Into<std::string::String>,
6765 {
6766 use std::iter::Iterator;
6767 self.product_id = v.into_iter().map(|i| i.into()).collect();
6768 self
6769 }
6770 }
6771
6772 impl wkt::message::Message for ProductPins {
6773 fn typename() -> &'static str {
6774 "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6775 }
6776 }
6777}
6778
6779/// A list of string values.
6780#[derive(Clone, Default, PartialEq)]
6781#[non_exhaustive]
6782pub struct StringList {
6783 /// String values.
6784 pub values: std::vec::Vec<std::string::String>,
6785
6786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6787}
6788
6789impl StringList {
6790 /// Creates a new default instance.
6791 pub fn new() -> Self {
6792 std::default::Default::default()
6793 }
6794
6795 /// Sets the value of [values][crate::model::StringList::values].
6796 ///
6797 /// # Example
6798 /// ```ignore,no_run
6799 /// # use google_cloud_retail_v2::model::StringList;
6800 /// let x = StringList::new().set_values(["a", "b", "c"]);
6801 /// ```
6802 pub fn set_values<T, V>(mut self, v: T) -> Self
6803 where
6804 T: std::iter::IntoIterator<Item = V>,
6805 V: std::convert::Into<std::string::String>,
6806 {
6807 use std::iter::Iterator;
6808 self.values = v.into_iter().map(|i| i.into()).collect();
6809 self
6810 }
6811}
6812
6813impl wkt::message::Message for StringList {
6814 fn typename() -> &'static str {
6815 "type.googleapis.com/google.cloud.retail.v2.StringList"
6816 }
6817}
6818
6819/// A message with a list of double values.
6820#[derive(Clone, Default, PartialEq)]
6821#[non_exhaustive]
6822pub struct DoubleList {
6823 /// The list of double values.
6824 pub values: std::vec::Vec<f64>,
6825
6826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6827}
6828
6829impl DoubleList {
6830 /// Creates a new default instance.
6831 pub fn new() -> Self {
6832 std::default::Default::default()
6833 }
6834
6835 /// Sets the value of [values][crate::model::DoubleList::values].
6836 ///
6837 /// # Example
6838 /// ```ignore,no_run
6839 /// # use google_cloud_retail_v2::model::DoubleList;
6840 /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6841 /// ```
6842 pub fn set_values<T, V>(mut self, v: T) -> Self
6843 where
6844 T: std::iter::IntoIterator<Item = V>,
6845 V: std::convert::Into<f64>,
6846 {
6847 use std::iter::Iterator;
6848 self.values = v.into_iter().map(|i| i.into()).collect();
6849 self
6850 }
6851}
6852
6853impl wkt::message::Message for DoubleList {
6854 fn typename() -> &'static str {
6855 "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6856 }
6857}
6858
6859/// Autocomplete parameters.
6860#[derive(Clone, Default, PartialEq)]
6861#[non_exhaustive]
6862pub struct CompleteQueryRequest {
6863 /// Required. Catalog for which the completion is performed.
6864 ///
6865 /// Full resource name of catalog, such as
6866 /// `projects/*/locations/global/catalogs/default_catalog`.
6867 pub catalog: std::string::String,
6868
6869 /// Required. The query used to generate suggestions.
6870 ///
6871 /// The maximum number of allowed characters is 255.
6872 pub query: std::string::String,
6873
6874 /// Recommended field. A unique identifier for tracking visitors. For example,
6875 /// this could be implemented with an HTTP cookie, which should be able to
6876 /// uniquely identify a visitor on a single device. This unique identifier
6877 /// should not change if the visitor logs in or out of the website.
6878 ///
6879 /// The field must be a UTF-8 encoded string with a length limit of 128
6880 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6881 pub visitor_id: std::string::String,
6882
6883 /// Note that this field applies for `user-data` dataset only. For requests
6884 /// with `cloud-retail` dataset, setting this field has no effect.
6885 ///
6886 /// The language filters applied to the output suggestions. If set, it should
6887 /// contain the language of the query. If not set, suggestions are returned
6888 /// without considering language restrictions. This is the BCP-47 language
6889 /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6890 /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6891 /// number of language codes is 3.
6892 pub language_codes: std::vec::Vec<std::string::String>,
6893
6894 /// The device type context for completion suggestions. We recommend that you
6895 /// leave this field empty.
6896 ///
6897 /// It can apply different suggestions on different device types, e.g.
6898 /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6899 /// types.
6900 ///
6901 /// Supported formats:
6902 ///
6903 /// * `UNKNOWN_DEVICE_TYPE`
6904 ///
6905 /// * `DESKTOP`
6906 ///
6907 /// * `MOBILE`
6908 ///
6909 /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6910 ///
6911 pub device_type: std::string::String,
6912
6913 /// Determines which dataset to use for fetching completion. "user-data" will
6914 /// use the dataset imported through
6915 /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6916 /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6917 /// events. If left empty, completions will be fetched from the `user-data`
6918 /// dataset.
6919 ///
6920 /// Current supported values:
6921 ///
6922 /// * user-data
6923 ///
6924 /// * cloud-retail:
6925 /// This option requires enabling auto-learning function first. See
6926 /// [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6927 ///
6928 ///
6929 /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6930 pub dataset: std::string::String,
6931
6932 /// Completion max suggestions. If left unset or set to 0, then will fallback
6933 /// to the configured value
6934 /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6935 ///
6936 /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6937 /// capped by 20.
6938 ///
6939 /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6940 pub max_suggestions: i32,
6941
6942 /// If true, attribute suggestions are enabled and provided in the response.
6943 ///
6944 /// This field is only available for the `cloud-retail` dataset.
6945 pub enable_attribute_suggestions: bool,
6946
6947 /// The entity for customers who run multiple entities, domains, sites, or
6948 /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6949 /// `google.com`, `youtube.com`, etc.
6950 /// If this is set, it must be an exact match with
6951 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6952 /// per-entity autocomplete results. This field will be applied to
6953 /// `completion_results` only. It has no effect on the `attribute_results`.
6954 /// Also, this entity should be limited to 256 characters, if too long, it will
6955 /// be truncated to 256 characters in both generation and serving time, and may
6956 /// lead to mis-match. To ensure it works, please set the entity with string
6957 /// within 256 characters.
6958 ///
6959 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6960 pub entity: std::string::String,
6961
6962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6963}
6964
6965impl CompleteQueryRequest {
6966 /// Creates a new default instance.
6967 pub fn new() -> Self {
6968 std::default::Default::default()
6969 }
6970
6971 /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6972 ///
6973 /// # Example
6974 /// ```ignore,no_run
6975 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6976 /// # let project_id = "project_id";
6977 /// # let location_id = "location_id";
6978 /// # let catalog_id = "catalog_id";
6979 /// let x = CompleteQueryRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
6980 /// ```
6981 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6982 self.catalog = v.into();
6983 self
6984 }
6985
6986 /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6987 ///
6988 /// # Example
6989 /// ```ignore,no_run
6990 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6991 /// let x = CompleteQueryRequest::new().set_query("example");
6992 /// ```
6993 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6994 self.query = v.into();
6995 self
6996 }
6997
6998 /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
6999 ///
7000 /// # Example
7001 /// ```ignore,no_run
7002 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7003 /// let x = CompleteQueryRequest::new().set_visitor_id("example");
7004 /// ```
7005 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7006 self.visitor_id = v.into();
7007 self
7008 }
7009
7010 /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
7011 ///
7012 /// # Example
7013 /// ```ignore,no_run
7014 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7015 /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
7016 /// ```
7017 pub fn set_language_codes<T, V>(mut self, v: T) -> Self
7018 where
7019 T: std::iter::IntoIterator<Item = V>,
7020 V: std::convert::Into<std::string::String>,
7021 {
7022 use std::iter::Iterator;
7023 self.language_codes = v.into_iter().map(|i| i.into()).collect();
7024 self
7025 }
7026
7027 /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
7028 ///
7029 /// # Example
7030 /// ```ignore,no_run
7031 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7032 /// let x = CompleteQueryRequest::new().set_device_type("example");
7033 /// ```
7034 pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7035 self.device_type = v.into();
7036 self
7037 }
7038
7039 /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
7040 ///
7041 /// # Example
7042 /// ```ignore,no_run
7043 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7044 /// let x = CompleteQueryRequest::new().set_dataset("example");
7045 /// ```
7046 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7047 self.dataset = v.into();
7048 self
7049 }
7050
7051 /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
7052 ///
7053 /// # Example
7054 /// ```ignore,no_run
7055 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7056 /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
7057 /// ```
7058 pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7059 self.max_suggestions = v.into();
7060 self
7061 }
7062
7063 /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
7064 ///
7065 /// # Example
7066 /// ```ignore,no_run
7067 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7068 /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
7069 /// ```
7070 pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7071 self.enable_attribute_suggestions = v.into();
7072 self
7073 }
7074
7075 /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
7076 ///
7077 /// # Example
7078 /// ```ignore,no_run
7079 /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7080 /// let x = CompleteQueryRequest::new().set_entity("example");
7081 /// ```
7082 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7083 self.entity = v.into();
7084 self
7085 }
7086}
7087
7088impl wkt::message::Message for CompleteQueryRequest {
7089 fn typename() -> &'static str {
7090 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7091 }
7092}
7093
7094/// Response of the autocomplete query.
7095#[derive(Clone, Default, PartialEq)]
7096#[non_exhaustive]
7097pub struct CompleteQueryResponse {
7098 /// Results of the matching suggestions. The result list is ordered and the
7099 /// first result is top suggestion.
7100 pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7101
7102 /// A unique complete token. This should be included in the
7103 /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7104 /// for search events resulting from this completion, which enables accurate
7105 /// attribution of complete model performance.
7106 ///
7107 /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7108 pub attribution_token: std::string::String,
7109
7110 /// Deprecated. Matched recent searches of this user. The maximum number of
7111 /// recent searches is 10. This field is a restricted feature. If you want to
7112 /// enable it, contact Retail Search support.
7113 ///
7114 /// This feature is only available when
7115 /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7116 /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7117 /// The recent searches satisfy the follow rules:
7118 ///
7119 /// * They are ordered from latest to oldest.
7120 ///
7121 /// * They are matched with
7122 /// [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7123 /// case insensitively.
7124 ///
7125 /// * They are transformed to lower case.
7126 ///
7127 /// * They are UTF-8 safe.
7128 ///
7129 ///
7130 /// Recent searches are deduplicated. More recent searches will be reserved
7131 /// when duplication happens.
7132 ///
7133 /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7134 /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7135 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7136 #[deprecated]
7137 pub recent_search_results:
7138 std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7139
7140 /// A map of matched attribute suggestions. This field is only available for
7141 /// `cloud-retail` dataset.
7142 ///
7143 /// Current supported keys:
7144 ///
7145 /// * `brands`
7146 ///
7147 /// * `categories`
7148 ///
7149 pub attribute_results: std::collections::HashMap<
7150 std::string::String,
7151 crate::model::complete_query_response::AttributeResult,
7152 >,
7153
7154 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7155}
7156
7157impl CompleteQueryResponse {
7158 /// Creates a new default instance.
7159 pub fn new() -> Self {
7160 std::default::Default::default()
7161 }
7162
7163 /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7164 ///
7165 /// # Example
7166 /// ```ignore,no_run
7167 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7168 /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7169 /// let x = CompleteQueryResponse::new()
7170 /// .set_completion_results([
7171 /// CompletionResult::default()/* use setters */,
7172 /// CompletionResult::default()/* use (different) setters */,
7173 /// ]);
7174 /// ```
7175 pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7176 where
7177 T: std::iter::IntoIterator<Item = V>,
7178 V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7179 {
7180 use std::iter::Iterator;
7181 self.completion_results = v.into_iter().map(|i| i.into()).collect();
7182 self
7183 }
7184
7185 /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7186 ///
7187 /// # Example
7188 /// ```ignore,no_run
7189 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7190 /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7191 /// ```
7192 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7193 mut self,
7194 v: T,
7195 ) -> Self {
7196 self.attribution_token = v.into();
7197 self
7198 }
7199
7200 /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7201 ///
7202 /// # Example
7203 /// ```ignore,no_run
7204 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7205 /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7206 /// let x = CompleteQueryResponse::new()
7207 /// .set_recent_search_results([
7208 /// RecentSearchResult::default()/* use setters */,
7209 /// RecentSearchResult::default()/* use (different) setters */,
7210 /// ]);
7211 /// ```
7212 #[deprecated]
7213 pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7214 where
7215 T: std::iter::IntoIterator<Item = V>,
7216 V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7217 {
7218 use std::iter::Iterator;
7219 self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7220 self
7221 }
7222
7223 /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7224 ///
7225 /// # Example
7226 /// ```ignore,no_run
7227 /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7228 /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7229 /// let x = CompleteQueryResponse::new().set_attribute_results([
7230 /// ("key0", AttributeResult::default()/* use setters */),
7231 /// ("key1", AttributeResult::default()/* use (different) setters */),
7232 /// ]);
7233 /// ```
7234 pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7235 where
7236 T: std::iter::IntoIterator<Item = (K, V)>,
7237 K: std::convert::Into<std::string::String>,
7238 V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7239 {
7240 use std::iter::Iterator;
7241 self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7242 self
7243 }
7244}
7245
7246impl wkt::message::Message for CompleteQueryResponse {
7247 fn typename() -> &'static str {
7248 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7249 }
7250}
7251
7252/// Defines additional types related to [CompleteQueryResponse].
7253pub mod complete_query_response {
7254 #[allow(unused_imports)]
7255 use super::*;
7256
7257 /// Resource that represents completion results.
7258 #[derive(Clone, Default, PartialEq)]
7259 #[non_exhaustive]
7260 pub struct CompletionResult {
7261 /// The suggestion for the query.
7262 pub suggestion: std::string::String,
7263
7264 /// Custom attributes for the suggestion term.
7265 ///
7266 /// * For `user-data`, the attributes are additional custom attributes
7267 /// ingested through BigQuery.
7268 ///
7269 /// * For `cloud-retail`, the attributes are product attributes generated
7270 /// by Cloud Retail. It requires
7271 /// [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7272 /// is imported properly.
7273 ///
7274 ///
7275 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7276 pub attributes:
7277 std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7278
7279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7280 }
7281
7282 impl CompletionResult {
7283 /// Creates a new default instance.
7284 pub fn new() -> Self {
7285 std::default::Default::default()
7286 }
7287
7288 /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7289 ///
7290 /// # Example
7291 /// ```ignore,no_run
7292 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7293 /// let x = CompletionResult::new().set_suggestion("example");
7294 /// ```
7295 pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7296 self.suggestion = v.into();
7297 self
7298 }
7299
7300 /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7301 ///
7302 /// # Example
7303 /// ```ignore,no_run
7304 /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7305 /// use google_cloud_retail_v2::model::CustomAttribute;
7306 /// let x = CompletionResult::new().set_attributes([
7307 /// ("key0", CustomAttribute::default()/* use setters */),
7308 /// ("key1", CustomAttribute::default()/* use (different) setters */),
7309 /// ]);
7310 /// ```
7311 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7312 where
7313 T: std::iter::IntoIterator<Item = (K, V)>,
7314 K: std::convert::Into<std::string::String>,
7315 V: std::convert::Into<crate::model::CustomAttribute>,
7316 {
7317 use std::iter::Iterator;
7318 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7319 self
7320 }
7321 }
7322
7323 impl wkt::message::Message for CompletionResult {
7324 fn typename() -> &'static str {
7325 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7326 }
7327 }
7328
7329 /// Deprecated: Recent search of this user.
7330 #[derive(Clone, Default, PartialEq)]
7331 #[non_exhaustive]
7332 #[deprecated]
7333 pub struct RecentSearchResult {
7334 /// The recent search query.
7335 pub recent_search: std::string::String,
7336
7337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7338 }
7339
7340 impl RecentSearchResult {
7341 /// Creates a new default instance.
7342 pub fn new() -> Self {
7343 std::default::Default::default()
7344 }
7345
7346 /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7347 ///
7348 /// # Example
7349 /// ```ignore,no_run
7350 /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7351 /// let x = RecentSearchResult::new().set_recent_search("example");
7352 /// ```
7353 pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7354 mut self,
7355 v: T,
7356 ) -> Self {
7357 self.recent_search = v.into();
7358 self
7359 }
7360 }
7361
7362 impl wkt::message::Message for RecentSearchResult {
7363 fn typename() -> &'static str {
7364 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7365 }
7366 }
7367
7368 /// Resource that represents attribute results.
7369 #[derive(Clone, Default, PartialEq)]
7370 #[non_exhaustive]
7371 pub struct AttributeResult {
7372 /// The list of suggestions for the attribute.
7373 pub suggestions: std::vec::Vec<std::string::String>,
7374
7375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7376 }
7377
7378 impl AttributeResult {
7379 /// Creates a new default instance.
7380 pub fn new() -> Self {
7381 std::default::Default::default()
7382 }
7383
7384 /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7385 ///
7386 /// # Example
7387 /// ```ignore,no_run
7388 /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7389 /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7390 /// ```
7391 pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7392 where
7393 T: std::iter::IntoIterator<Item = V>,
7394 V: std::convert::Into<std::string::String>,
7395 {
7396 use std::iter::Iterator;
7397 self.suggestions = v.into_iter().map(|i| i.into()).collect();
7398 self
7399 }
7400 }
7401
7402 impl wkt::message::Message for AttributeResult {
7403 fn typename() -> &'static str {
7404 "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7405 }
7406 }
7407}
7408
7409/// Configures dynamic metadata that can be linked to a
7410/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7411/// recommendation results at serving time.
7412///
7413/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7414#[derive(Clone, Default, PartialEq)]
7415#[non_exhaustive]
7416pub struct Control {
7417 /// Immutable. Fully qualified name
7418 /// `projects/*/locations/global/catalogs/*/controls/*`
7419 pub name: std::string::String,
7420
7421 /// Required. The human readable control display name. Used in Retail UI.
7422 ///
7423 /// This field must be a UTF-8 encoded string with a length limit of 128
7424 /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7425 pub display_name: std::string::String,
7426
7427 /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7428 /// ids that are associated with this control in the same
7429 /// [Catalog][google.cloud.retail.v2.Catalog].
7430 ///
7431 /// Note the association is managed via the
7432 /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7433 /// only denormalized view.
7434 ///
7435 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7436 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7437 pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7438
7439 /// Required. Immutable. The solution types that the control is used for.
7440 /// Currently we support setting only one type of solution at creation time.
7441 ///
7442 /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7443 /// If no solution type is provided at creation time, will default to
7444 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7445 ///
7446 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7447 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7448
7449 /// Specifies the use case for the control.
7450 /// Affects what condition fields can be set.
7451 /// Only settable by search controls.
7452 /// Will default to
7453 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7454 /// if not specified. Currently only allow one search_solution_use_case per
7455 /// control.
7456 ///
7457 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7458 pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7459
7460 /// The behavior/type of the control
7461 ///
7462 /// A behavior/type must be specified on creation. Type cannot be changed once
7463 /// specified (e.g. A Rule control will always be a Rule control.). An
7464 /// INVALID_ARGUMENT will be returned if either condition is violated.
7465 pub control: std::option::Option<crate::model::control::Control>,
7466
7467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7468}
7469
7470impl Control {
7471 /// Creates a new default instance.
7472 pub fn new() -> Self {
7473 std::default::Default::default()
7474 }
7475
7476 /// Sets the value of [name][crate::model::Control::name].
7477 ///
7478 /// # Example
7479 /// ```ignore,no_run
7480 /// # use google_cloud_retail_v2::model::Control;
7481 /// # let project_id = "project_id";
7482 /// # let location_id = "location_id";
7483 /// # let catalog_id = "catalog_id";
7484 /// # let control_id = "control_id";
7485 /// let x = Control::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7486 /// ```
7487 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7488 self.name = v.into();
7489 self
7490 }
7491
7492 /// Sets the value of [display_name][crate::model::Control::display_name].
7493 ///
7494 /// # Example
7495 /// ```ignore,no_run
7496 /// # use google_cloud_retail_v2::model::Control;
7497 /// let x = Control::new().set_display_name("example");
7498 /// ```
7499 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7500 self.display_name = v.into();
7501 self
7502 }
7503
7504 /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7505 ///
7506 /// # Example
7507 /// ```ignore,no_run
7508 /// # use google_cloud_retail_v2::model::Control;
7509 /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7510 /// ```
7511 pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7512 where
7513 T: std::iter::IntoIterator<Item = V>,
7514 V: std::convert::Into<std::string::String>,
7515 {
7516 use std::iter::Iterator;
7517 self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7518 self
7519 }
7520
7521 /// Sets the value of [solution_types][crate::model::Control::solution_types].
7522 ///
7523 /// # Example
7524 /// ```ignore,no_run
7525 /// # use google_cloud_retail_v2::model::Control;
7526 /// use google_cloud_retail_v2::model::SolutionType;
7527 /// let x = Control::new().set_solution_types([
7528 /// SolutionType::Recommendation,
7529 /// SolutionType::Search,
7530 /// ]);
7531 /// ```
7532 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7533 where
7534 T: std::iter::IntoIterator<Item = V>,
7535 V: std::convert::Into<crate::model::SolutionType>,
7536 {
7537 use std::iter::Iterator;
7538 self.solution_types = v.into_iter().map(|i| i.into()).collect();
7539 self
7540 }
7541
7542 /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7543 ///
7544 /// # Example
7545 /// ```ignore,no_run
7546 /// # use google_cloud_retail_v2::model::Control;
7547 /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7548 /// let x = Control::new().set_search_solution_use_case([
7549 /// SearchSolutionUseCase::Search,
7550 /// SearchSolutionUseCase::Browse,
7551 /// ]);
7552 /// ```
7553 pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7554 where
7555 T: std::iter::IntoIterator<Item = V>,
7556 V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7557 {
7558 use std::iter::Iterator;
7559 self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7560 self
7561 }
7562
7563 /// Sets the value of [control][crate::model::Control::control].
7564 ///
7565 /// Note that all the setters affecting `control` are mutually
7566 /// exclusive.
7567 ///
7568 /// # Example
7569 /// ```ignore,no_run
7570 /// # use google_cloud_retail_v2::model::Control;
7571 /// use google_cloud_retail_v2::model::Rule;
7572 /// let x = Control::new().set_control(Some(
7573 /// google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7574 /// ```
7575 pub fn set_control<
7576 T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7577 >(
7578 mut self,
7579 v: T,
7580 ) -> Self {
7581 self.control = v.into();
7582 self
7583 }
7584
7585 /// The value of [control][crate::model::Control::control]
7586 /// if it holds a `Rule`, `None` if the field is not set or
7587 /// holds a different branch.
7588 pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7589 #[allow(unreachable_patterns)]
7590 self.control.as_ref().and_then(|v| match v {
7591 crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7592 _ => std::option::Option::None,
7593 })
7594 }
7595
7596 /// Sets the value of [control][crate::model::Control::control]
7597 /// to hold a `Rule`.
7598 ///
7599 /// Note that all the setters affecting `control` are
7600 /// mutually exclusive.
7601 ///
7602 /// # Example
7603 /// ```ignore,no_run
7604 /// # use google_cloud_retail_v2::model::Control;
7605 /// use google_cloud_retail_v2::model::Rule;
7606 /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7607 /// assert!(x.rule().is_some());
7608 /// ```
7609 pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7610 mut self,
7611 v: T,
7612 ) -> Self {
7613 self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7614 self
7615 }
7616}
7617
7618impl wkt::message::Message for Control {
7619 fn typename() -> &'static str {
7620 "type.googleapis.com/google.cloud.retail.v2.Control"
7621 }
7622}
7623
7624/// Defines additional types related to [Control].
7625pub mod control {
7626 #[allow(unused_imports)]
7627 use super::*;
7628
7629 /// The behavior/type of the control
7630 ///
7631 /// A behavior/type must be specified on creation. Type cannot be changed once
7632 /// specified (e.g. A Rule control will always be a Rule control.). An
7633 /// INVALID_ARGUMENT will be returned if either condition is violated.
7634 #[derive(Clone, Debug, PartialEq)]
7635 #[non_exhaustive]
7636 pub enum Control {
7637 /// A rule control - a condition-action pair.
7638 /// Enacts a set action when the condition is triggered.
7639 /// For example: Boost "gShoe" when query full matches "Running Shoes".
7640 Rule(std::boxed::Box<crate::model::Rule>),
7641 }
7642}
7643
7644/// Request for CreateControl method.
7645#[derive(Clone, Default, PartialEq)]
7646#[non_exhaustive]
7647pub struct CreateControlRequest {
7648 /// Required. Full resource name of parent catalog. Format:
7649 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7650 pub parent: std::string::String,
7651
7652 /// Required. The Control to create.
7653 pub control: std::option::Option<crate::model::Control>,
7654
7655 /// Required. The ID to use for the Control, which will become the final
7656 /// component of the Control's resource name.
7657 ///
7658 /// This value should be 4-63 characters, and valid characters
7659 /// are /[a-z][0-9]-_/.
7660 pub control_id: std::string::String,
7661
7662 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7663}
7664
7665impl CreateControlRequest {
7666 /// Creates a new default instance.
7667 pub fn new() -> Self {
7668 std::default::Default::default()
7669 }
7670
7671 /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7672 ///
7673 /// # Example
7674 /// ```ignore,no_run
7675 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7676 /// # let project_id = "project_id";
7677 /// # let location_id = "location_id";
7678 /// # let catalog_id = "catalog_id";
7679 /// let x = CreateControlRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
7680 /// ```
7681 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7682 self.parent = v.into();
7683 self
7684 }
7685
7686 /// Sets the value of [control][crate::model::CreateControlRequest::control].
7687 ///
7688 /// # Example
7689 /// ```ignore,no_run
7690 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7691 /// use google_cloud_retail_v2::model::Control;
7692 /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7693 /// ```
7694 pub fn set_control<T>(mut self, v: T) -> Self
7695 where
7696 T: std::convert::Into<crate::model::Control>,
7697 {
7698 self.control = std::option::Option::Some(v.into());
7699 self
7700 }
7701
7702 /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7703 ///
7704 /// # Example
7705 /// ```ignore,no_run
7706 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7707 /// use google_cloud_retail_v2::model::Control;
7708 /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7709 /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7710 /// ```
7711 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7712 where
7713 T: std::convert::Into<crate::model::Control>,
7714 {
7715 self.control = v.map(|x| x.into());
7716 self
7717 }
7718
7719 /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7720 ///
7721 /// # Example
7722 /// ```ignore,no_run
7723 /// # use google_cloud_retail_v2::model::CreateControlRequest;
7724 /// let x = CreateControlRequest::new().set_control_id("example");
7725 /// ```
7726 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7727 self.control_id = v.into();
7728 self
7729 }
7730}
7731
7732impl wkt::message::Message for CreateControlRequest {
7733 fn typename() -> &'static str {
7734 "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7735 }
7736}
7737
7738/// Request for UpdateControl method.
7739#[derive(Clone, Default, PartialEq)]
7740#[non_exhaustive]
7741pub struct UpdateControlRequest {
7742 /// Required. The Control to update.
7743 pub control: std::option::Option<crate::model::Control>,
7744
7745 /// Indicates which fields in the provided
7746 /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7747 /// supported:
7748 ///
7749 /// * [Control.name][google.cloud.retail.v2.Control.name]
7750 ///
7751 /// If not set or empty, all supported fields are updated.
7752 ///
7753 /// [google.cloud.retail.v2.Control]: crate::model::Control
7754 /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7755 pub update_mask: std::option::Option<wkt::FieldMask>,
7756
7757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7758}
7759
7760impl UpdateControlRequest {
7761 /// Creates a new default instance.
7762 pub fn new() -> Self {
7763 std::default::Default::default()
7764 }
7765
7766 /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7767 ///
7768 /// # Example
7769 /// ```ignore,no_run
7770 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7771 /// use google_cloud_retail_v2::model::Control;
7772 /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7773 /// ```
7774 pub fn set_control<T>(mut self, v: T) -> Self
7775 where
7776 T: std::convert::Into<crate::model::Control>,
7777 {
7778 self.control = std::option::Option::Some(v.into());
7779 self
7780 }
7781
7782 /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7783 ///
7784 /// # Example
7785 /// ```ignore,no_run
7786 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7787 /// use google_cloud_retail_v2::model::Control;
7788 /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7789 /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7790 /// ```
7791 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7792 where
7793 T: std::convert::Into<crate::model::Control>,
7794 {
7795 self.control = v.map(|x| x.into());
7796 self
7797 }
7798
7799 /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7800 ///
7801 /// # Example
7802 /// ```ignore,no_run
7803 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7804 /// use wkt::FieldMask;
7805 /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7806 /// ```
7807 pub fn set_update_mask<T>(mut self, v: T) -> Self
7808 where
7809 T: std::convert::Into<wkt::FieldMask>,
7810 {
7811 self.update_mask = std::option::Option::Some(v.into());
7812 self
7813 }
7814
7815 /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7816 ///
7817 /// # Example
7818 /// ```ignore,no_run
7819 /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7820 /// use wkt::FieldMask;
7821 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7822 /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7823 /// ```
7824 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7825 where
7826 T: std::convert::Into<wkt::FieldMask>,
7827 {
7828 self.update_mask = v.map(|x| x.into());
7829 self
7830 }
7831}
7832
7833impl wkt::message::Message for UpdateControlRequest {
7834 fn typename() -> &'static str {
7835 "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7836 }
7837}
7838
7839/// Request for DeleteControl method.
7840#[derive(Clone, Default, PartialEq)]
7841#[non_exhaustive]
7842pub struct DeleteControlRequest {
7843 /// Required. The resource name of the Control to delete. Format:
7844 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7845 pub name: std::string::String,
7846
7847 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7848}
7849
7850impl DeleteControlRequest {
7851 /// Creates a new default instance.
7852 pub fn new() -> Self {
7853 std::default::Default::default()
7854 }
7855
7856 /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7857 ///
7858 /// # Example
7859 /// ```ignore,no_run
7860 /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7861 /// # let project_id = "project_id";
7862 /// # let location_id = "location_id";
7863 /// # let catalog_id = "catalog_id";
7864 /// # let control_id = "control_id";
7865 /// let x = DeleteControlRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7866 /// ```
7867 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7868 self.name = v.into();
7869 self
7870 }
7871}
7872
7873impl wkt::message::Message for DeleteControlRequest {
7874 fn typename() -> &'static str {
7875 "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7876 }
7877}
7878
7879/// Request for GetControl method.
7880#[derive(Clone, Default, PartialEq)]
7881#[non_exhaustive]
7882pub struct GetControlRequest {
7883 /// Required. The resource name of the Control to get. Format:
7884 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7885 pub name: std::string::String,
7886
7887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7888}
7889
7890impl GetControlRequest {
7891 /// Creates a new default instance.
7892 pub fn new() -> Self {
7893 std::default::Default::default()
7894 }
7895
7896 /// Sets the value of [name][crate::model::GetControlRequest::name].
7897 ///
7898 /// # Example
7899 /// ```ignore,no_run
7900 /// # use google_cloud_retail_v2::model::GetControlRequest;
7901 /// # let project_id = "project_id";
7902 /// # let location_id = "location_id";
7903 /// # let catalog_id = "catalog_id";
7904 /// # let control_id = "control_id";
7905 /// let x = GetControlRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7906 /// ```
7907 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7908 self.name = v.into();
7909 self
7910 }
7911}
7912
7913impl wkt::message::Message for GetControlRequest {
7914 fn typename() -> &'static str {
7915 "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7916 }
7917}
7918
7919/// Request for ListControls method.
7920#[derive(Clone, Default, PartialEq)]
7921#[non_exhaustive]
7922pub struct ListControlsRequest {
7923 /// Required. The catalog resource name. Format:
7924 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7925 pub parent: std::string::String,
7926
7927 /// Optional. Maximum number of results to return. If unspecified, defaults
7928 /// to 50. Max allowed value is 1000.
7929 pub page_size: i32,
7930
7931 /// Optional. A page token, received from a previous `ListControls` call.
7932 /// Provide this to retrieve the subsequent page.
7933 pub page_token: std::string::String,
7934
7935 /// Optional. A filter to apply on the list results. Supported features:
7936 ///
7937 /// * List all the products under the parent branch if
7938 /// [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7939 /// * List controls that are used in a single ServingConfig:
7940 /// 'serving_config = "boosted_home_page_cvr"'
7941 ///
7942 /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7943 pub filter: std::string::String,
7944
7945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7946}
7947
7948impl ListControlsRequest {
7949 /// Creates a new default instance.
7950 pub fn new() -> Self {
7951 std::default::Default::default()
7952 }
7953
7954 /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7955 ///
7956 /// # Example
7957 /// ```ignore,no_run
7958 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7959 /// # let project_id = "project_id";
7960 /// # let location_id = "location_id";
7961 /// # let catalog_id = "catalog_id";
7962 /// let x = ListControlsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
7963 /// ```
7964 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7965 self.parent = v.into();
7966 self
7967 }
7968
7969 /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7970 ///
7971 /// # Example
7972 /// ```ignore,no_run
7973 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7974 /// let x = ListControlsRequest::new().set_page_size(42);
7975 /// ```
7976 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7977 self.page_size = v.into();
7978 self
7979 }
7980
7981 /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7982 ///
7983 /// # Example
7984 /// ```ignore,no_run
7985 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7986 /// let x = ListControlsRequest::new().set_page_token("example");
7987 /// ```
7988 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7989 self.page_token = v.into();
7990 self
7991 }
7992
7993 /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7994 ///
7995 /// # Example
7996 /// ```ignore,no_run
7997 /// # use google_cloud_retail_v2::model::ListControlsRequest;
7998 /// let x = ListControlsRequest::new().set_filter("example");
7999 /// ```
8000 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8001 self.filter = v.into();
8002 self
8003 }
8004}
8005
8006impl wkt::message::Message for ListControlsRequest {
8007 fn typename() -> &'static str {
8008 "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
8009 }
8010}
8011
8012/// Response for ListControls method.
8013#[derive(Clone, Default, PartialEq)]
8014#[non_exhaustive]
8015pub struct ListControlsResponse {
8016 /// All the Controls for a given catalog.
8017 pub controls: std::vec::Vec<crate::model::Control>,
8018
8019 /// Pagination token, if not returned indicates the last page.
8020 pub next_page_token: std::string::String,
8021
8022 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8023}
8024
8025impl ListControlsResponse {
8026 /// Creates a new default instance.
8027 pub fn new() -> Self {
8028 std::default::Default::default()
8029 }
8030
8031 /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
8032 ///
8033 /// # Example
8034 /// ```ignore,no_run
8035 /// # use google_cloud_retail_v2::model::ListControlsResponse;
8036 /// use google_cloud_retail_v2::model::Control;
8037 /// let x = ListControlsResponse::new()
8038 /// .set_controls([
8039 /// Control::default()/* use setters */,
8040 /// Control::default()/* use (different) setters */,
8041 /// ]);
8042 /// ```
8043 pub fn set_controls<T, V>(mut self, v: T) -> Self
8044 where
8045 T: std::iter::IntoIterator<Item = V>,
8046 V: std::convert::Into<crate::model::Control>,
8047 {
8048 use std::iter::Iterator;
8049 self.controls = v.into_iter().map(|i| i.into()).collect();
8050 self
8051 }
8052
8053 /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
8054 ///
8055 /// # Example
8056 /// ```ignore,no_run
8057 /// # use google_cloud_retail_v2::model::ListControlsResponse;
8058 /// let x = ListControlsResponse::new().set_next_page_token("example");
8059 /// ```
8060 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8061 self.next_page_token = v.into();
8062 self
8063 }
8064}
8065
8066impl wkt::message::Message for ListControlsResponse {
8067 fn typename() -> &'static str {
8068 "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
8069 }
8070}
8071
8072#[doc(hidden)]
8073impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
8074 type PageItem = crate::model::Control;
8075
8076 fn items(self) -> std::vec::Vec<Self::PageItem> {
8077 self.controls
8078 }
8079
8080 fn next_page_token(&self) -> std::string::String {
8081 use std::clone::Clone;
8082 self.next_page_token.clone()
8083 }
8084}
8085
8086/// Request message for
8087/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8088/// method.
8089#[derive(Clone, Default, PartialEq)]
8090#[non_exhaustive]
8091pub struct ConversationalSearchRequest {
8092 /// Required. The resource name of the search engine placement, such as
8093 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
8094 /// or
8095 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
8096 /// This field is used to identify the serving config name and the set
8097 /// of models that will be used to make the search.
8098 pub placement: std::string::String,
8099
8100 /// Required. The branch resource name, such as
8101 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
8102 ///
8103 /// Use "default_branch" as the branch ID or leave this field empty, to search
8104 /// products under the default branch.
8105 pub branch: std::string::String,
8106
8107 /// Optional. Raw search query to be searched for.
8108 ///
8109 /// If this field is empty, the request is considered a category browsing
8110 /// request.
8111 pub query: std::string::String,
8112
8113 /// Optional. The categories associated with a category page. Must be set for
8114 /// category navigation queries to achieve good search quality. The format
8115 /// should be the same as
8116 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8117 ///
8118 /// To represent full path of category, use '>' sign to separate different
8119 /// hierarchies. If '>' is part of the category name, replace it with
8120 /// other character(s).
8121 ///
8122 /// Category pages include special pages such as sales or promotions. For
8123 /// instance, a special sale page may have the category hierarchy:
8124 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8125 ///
8126 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8127 pub page_categories: std::vec::Vec<std::string::String>,
8128
8129 /// Optional. This field specifies the conversation id, which maintains the
8130 /// state of the conversation between client side and server side. Use the
8131 /// value from the previous
8132 /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8133 /// For the initial request, this should be empty.
8134 ///
8135 /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8136 pub conversation_id: std::string::String,
8137
8138 /// Optional. Search parameters.
8139 pub search_params:
8140 std::option::Option<crate::model::conversational_search_request::SearchParams>,
8141
8142 /// Required. A unique identifier for tracking visitors. For example, this
8143 /// could be implemented with an HTTP cookie, which should be able to uniquely
8144 /// identify a visitor on a single device. This unique identifier should not
8145 /// change if the visitor logs in or out of the website.
8146 ///
8147 /// This should be the same identifier as
8148 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8149 ///
8150 /// The field must be a UTF-8 encoded string with a length limit of 128
8151 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8152 ///
8153 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8154 pub visitor_id: std::string::String,
8155
8156 /// Optional. User information.
8157 pub user_info: std::option::Option<crate::model::UserInfo>,
8158
8159 /// Optional. This field specifies all conversational filtering related
8160 /// parameters.
8161 pub conversational_filtering_spec: std::option::Option<
8162 crate::model::conversational_search_request::ConversationalFilteringSpec,
8163 >,
8164
8165 /// Optional. The user labels applied to a resource must meet the following
8166 /// requirements:
8167 ///
8168 /// * Each resource can have multiple labels, up to a maximum of 64.
8169 /// * Each label must be a key-value pair.
8170 /// * Keys have a minimum length of 1 character and a maximum length of 63
8171 /// characters and cannot be empty. Values can be empty and have a maximum
8172 /// length of 63 characters.
8173 /// * Keys and values can contain only lowercase letters, numeric characters,
8174 /// underscores, and dashes. All characters must use UTF-8 encoding, and
8175 /// international characters are allowed.
8176 /// * The key portion of a label must be unique. However, you can use the same
8177 /// key with multiple resources.
8178 /// * Keys must start with a lowercase letter or international character.
8179 ///
8180 /// See [Google Cloud
8181 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8182 /// for more details.
8183 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8184
8185 /// Optional. The safety settings to be applied to the generated content.
8186 pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8187
8188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8189}
8190
8191impl ConversationalSearchRequest {
8192 /// Creates a new default instance.
8193 pub fn new() -> Self {
8194 std::default::Default::default()
8195 }
8196
8197 /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8198 ///
8199 /// # Example
8200 /// ```ignore,no_run
8201 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8202 /// let x = ConversationalSearchRequest::new().set_placement("example");
8203 /// ```
8204 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8205 self.placement = v.into();
8206 self
8207 }
8208
8209 /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8210 ///
8211 /// # Example
8212 /// ```ignore,no_run
8213 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8214 /// let x = ConversationalSearchRequest::new().set_branch("example");
8215 /// ```
8216 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8217 self.branch = v.into();
8218 self
8219 }
8220
8221 /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8222 ///
8223 /// # Example
8224 /// ```ignore,no_run
8225 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8226 /// let x = ConversationalSearchRequest::new().set_query("example");
8227 /// ```
8228 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8229 self.query = v.into();
8230 self
8231 }
8232
8233 /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8234 ///
8235 /// # Example
8236 /// ```ignore,no_run
8237 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8238 /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8239 /// ```
8240 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8241 where
8242 T: std::iter::IntoIterator<Item = V>,
8243 V: std::convert::Into<std::string::String>,
8244 {
8245 use std::iter::Iterator;
8246 self.page_categories = v.into_iter().map(|i| i.into()).collect();
8247 self
8248 }
8249
8250 /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8251 ///
8252 /// # Example
8253 /// ```ignore,no_run
8254 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8255 /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8256 /// ```
8257 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8258 self.conversation_id = v.into();
8259 self
8260 }
8261
8262 /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8263 ///
8264 /// # Example
8265 /// ```ignore,no_run
8266 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8267 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8268 /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8269 /// ```
8270 pub fn set_search_params<T>(mut self, v: T) -> Self
8271 where
8272 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8273 {
8274 self.search_params = std::option::Option::Some(v.into());
8275 self
8276 }
8277
8278 /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8279 ///
8280 /// # Example
8281 /// ```ignore,no_run
8282 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8283 /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8284 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8285 /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8286 /// ```
8287 pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8288 where
8289 T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8290 {
8291 self.search_params = v.map(|x| x.into());
8292 self
8293 }
8294
8295 /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8296 ///
8297 /// # Example
8298 /// ```ignore,no_run
8299 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8300 /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8301 /// ```
8302 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8303 self.visitor_id = v.into();
8304 self
8305 }
8306
8307 /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8308 ///
8309 /// # Example
8310 /// ```ignore,no_run
8311 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8312 /// use google_cloud_retail_v2::model::UserInfo;
8313 /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8314 /// ```
8315 pub fn set_user_info<T>(mut self, v: T) -> Self
8316 where
8317 T: std::convert::Into<crate::model::UserInfo>,
8318 {
8319 self.user_info = std::option::Option::Some(v.into());
8320 self
8321 }
8322
8323 /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8324 ///
8325 /// # Example
8326 /// ```ignore,no_run
8327 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8328 /// use google_cloud_retail_v2::model::UserInfo;
8329 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8330 /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8331 /// ```
8332 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8333 where
8334 T: std::convert::Into<crate::model::UserInfo>,
8335 {
8336 self.user_info = v.map(|x| x.into());
8337 self
8338 }
8339
8340 /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8341 ///
8342 /// # Example
8343 /// ```ignore,no_run
8344 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8345 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8346 /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8347 /// ```
8348 pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8349 where
8350 T: std::convert::Into<
8351 crate::model::conversational_search_request::ConversationalFilteringSpec,
8352 >,
8353 {
8354 self.conversational_filtering_spec = std::option::Option::Some(v.into());
8355 self
8356 }
8357
8358 /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8359 ///
8360 /// # Example
8361 /// ```ignore,no_run
8362 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8363 /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8364 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8365 /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8366 /// ```
8367 pub fn set_or_clear_conversational_filtering_spec<T>(
8368 mut self,
8369 v: std::option::Option<T>,
8370 ) -> Self
8371 where
8372 T: std::convert::Into<
8373 crate::model::conversational_search_request::ConversationalFilteringSpec,
8374 >,
8375 {
8376 self.conversational_filtering_spec = v.map(|x| x.into());
8377 self
8378 }
8379
8380 /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8381 ///
8382 /// # Example
8383 /// ```ignore,no_run
8384 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8385 /// let x = ConversationalSearchRequest::new().set_user_labels([
8386 /// ("key0", "abc"),
8387 /// ("key1", "xyz"),
8388 /// ]);
8389 /// ```
8390 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8391 where
8392 T: std::iter::IntoIterator<Item = (K, V)>,
8393 K: std::convert::Into<std::string::String>,
8394 V: std::convert::Into<std::string::String>,
8395 {
8396 use std::iter::Iterator;
8397 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8398 self
8399 }
8400
8401 /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8402 ///
8403 /// # Example
8404 /// ```ignore,no_run
8405 /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8406 /// use google_cloud_retail_v2::model::SafetySetting;
8407 /// let x = ConversationalSearchRequest::new()
8408 /// .set_safety_settings([
8409 /// SafetySetting::default()/* use setters */,
8410 /// SafetySetting::default()/* use (different) setters */,
8411 /// ]);
8412 /// ```
8413 pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8414 where
8415 T: std::iter::IntoIterator<Item = V>,
8416 V: std::convert::Into<crate::model::SafetySetting>,
8417 {
8418 use std::iter::Iterator;
8419 self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8420 self
8421 }
8422}
8423
8424impl wkt::message::Message for ConversationalSearchRequest {
8425 fn typename() -> &'static str {
8426 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8427 }
8428}
8429
8430/// Defines additional types related to [ConversationalSearchRequest].
8431pub mod conversational_search_request {
8432 #[allow(unused_imports)]
8433 use super::*;
8434
8435 /// Search parameters.
8436 #[derive(Clone, Default, PartialEq)]
8437 #[non_exhaustive]
8438 pub struct SearchParams {
8439 /// Optional. The filter string to restrict search results.
8440 ///
8441 /// The syntax of the filter string is the same as
8442 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8443 ///
8444 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8445 pub filter: std::string::String,
8446
8447 /// Optional. The canonical filter string to restrict search results.
8448 ///
8449 /// The syntax of the canonical filter string is the same as
8450 /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8451 ///
8452 /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8453 pub canonical_filter: std::string::String,
8454
8455 /// Optional. The sort string to specify the sorting of search results.
8456 ///
8457 /// The syntax of the sort string is the same as
8458 /// [SearchRequest.sort][].
8459 pub sort_by: std::string::String,
8460
8461 /// Optional. The boost spec to specify the boosting of search results.
8462 ///
8463 /// The syntax of the boost spec is the same as
8464 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8465 ///
8466 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8467 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8468
8469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8470 }
8471
8472 impl SearchParams {
8473 /// Creates a new default instance.
8474 pub fn new() -> Self {
8475 std::default::Default::default()
8476 }
8477
8478 /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8479 ///
8480 /// # Example
8481 /// ```ignore,no_run
8482 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8483 /// let x = SearchParams::new().set_filter("example");
8484 /// ```
8485 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8486 self.filter = v.into();
8487 self
8488 }
8489
8490 /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8491 ///
8492 /// # Example
8493 /// ```ignore,no_run
8494 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8495 /// let x = SearchParams::new().set_canonical_filter("example");
8496 /// ```
8497 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8498 mut self,
8499 v: T,
8500 ) -> Self {
8501 self.canonical_filter = v.into();
8502 self
8503 }
8504
8505 /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8506 ///
8507 /// # Example
8508 /// ```ignore,no_run
8509 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8510 /// let x = SearchParams::new().set_sort_by("example");
8511 /// ```
8512 pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8513 self.sort_by = v.into();
8514 self
8515 }
8516
8517 /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8518 ///
8519 /// # Example
8520 /// ```ignore,no_run
8521 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8522 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8523 /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8524 /// ```
8525 pub fn set_boost_spec<T>(mut self, v: T) -> Self
8526 where
8527 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8528 {
8529 self.boost_spec = std::option::Option::Some(v.into());
8530 self
8531 }
8532
8533 /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8534 ///
8535 /// # Example
8536 /// ```ignore,no_run
8537 /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8538 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8539 /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8540 /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8541 /// ```
8542 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8543 where
8544 T: std::convert::Into<crate::model::search_request::BoostSpec>,
8545 {
8546 self.boost_spec = v.map(|x| x.into());
8547 self
8548 }
8549 }
8550
8551 impl wkt::message::Message for SearchParams {
8552 fn typename() -> &'static str {
8553 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8554 }
8555 }
8556
8557 /// This field specifies the current user answer during the conversational
8558 /// filtering search. This can be either user selected from suggested answers
8559 /// or user input plain text.
8560 #[derive(Clone, Default, PartialEq)]
8561 #[non_exhaustive]
8562 pub struct UserAnswer {
8563 /// This field specifies the type of user answer.
8564 pub r#type:
8565 std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8566
8567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8568 }
8569
8570 impl UserAnswer {
8571 /// Creates a new default instance.
8572 pub fn new() -> Self {
8573 std::default::Default::default()
8574 }
8575
8576 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8577 ///
8578 /// Note that all the setters affecting `r#type` are mutually
8579 /// exclusive.
8580 ///
8581 /// # Example
8582 /// ```ignore,no_run
8583 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8584 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8585 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8586 /// ```
8587 pub fn set_type<
8588 T: std::convert::Into<
8589 std::option::Option<
8590 crate::model::conversational_search_request::user_answer::Type,
8591 >,
8592 >,
8593 >(
8594 mut self,
8595 v: T,
8596 ) -> Self {
8597 self.r#type = v.into();
8598 self
8599 }
8600
8601 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8602 /// if it holds a `TextAnswer`, `None` if the field is not set or
8603 /// holds a different branch.
8604 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8605 #[allow(unreachable_patterns)]
8606 self.r#type.as_ref().and_then(|v| match v {
8607 crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8608 std::option::Option::Some(v)
8609 }
8610 _ => std::option::Option::None,
8611 })
8612 }
8613
8614 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8615 /// to hold a `TextAnswer`.
8616 ///
8617 /// Note that all the setters affecting `r#type` are
8618 /// mutually exclusive.
8619 ///
8620 /// # Example
8621 /// ```ignore,no_run
8622 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8623 /// let x = UserAnswer::new().set_text_answer("example");
8624 /// assert!(x.text_answer().is_some());
8625 /// assert!(x.selected_answer().is_none());
8626 /// ```
8627 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8628 self.r#type = std::option::Option::Some(
8629 crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8630 v.into(),
8631 ),
8632 );
8633 self
8634 }
8635
8636 /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8637 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8638 /// holds a different branch.
8639 pub fn selected_answer(
8640 &self,
8641 ) -> std::option::Option<
8642 &std::boxed::Box<
8643 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8644 >,
8645 > {
8646 #[allow(unreachable_patterns)]
8647 self.r#type.as_ref().and_then(|v| match v {
8648 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8649 v,
8650 ) => std::option::Option::Some(v),
8651 _ => std::option::Option::None,
8652 })
8653 }
8654
8655 /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8656 /// to hold a `SelectedAnswer`.
8657 ///
8658 /// Note that all the setters affecting `r#type` are
8659 /// mutually exclusive.
8660 ///
8661 /// # Example
8662 /// ```ignore,no_run
8663 /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8664 /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8665 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8666 /// assert!(x.selected_answer().is_some());
8667 /// assert!(x.text_answer().is_none());
8668 /// ```
8669 pub fn set_selected_answer<
8670 T: std::convert::Into<
8671 std::boxed::Box<
8672 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8673 >,
8674 >,
8675 >(
8676 mut self,
8677 v: T,
8678 ) -> Self {
8679 self.r#type = std::option::Option::Some(
8680 crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8681 v.into(),
8682 ),
8683 );
8684 self
8685 }
8686 }
8687
8688 impl wkt::message::Message for UserAnswer {
8689 fn typename() -> &'static str {
8690 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8691 }
8692 }
8693
8694 /// Defines additional types related to [UserAnswer].
8695 pub mod user_answer {
8696 #[allow(unused_imports)]
8697 use super::*;
8698
8699 /// This field specifies the selected answers during the conversational
8700 /// search.
8701 #[derive(Clone, Default, PartialEq)]
8702 #[non_exhaustive]
8703 pub struct SelectedAnswer {
8704 /// Optional. This field specifies the selected answer which is a attribute
8705 /// key-value.
8706 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8707
8708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8709 }
8710
8711 impl SelectedAnswer {
8712 /// Creates a new default instance.
8713 pub fn new() -> Self {
8714 std::default::Default::default()
8715 }
8716
8717 /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8718 ///
8719 /// # Example
8720 /// ```ignore,no_run
8721 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8722 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8723 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8724 /// ```
8725 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8726 where
8727 T: std::convert::Into<crate::model::ProductAttributeValue>,
8728 {
8729 self.product_attribute_value = std::option::Option::Some(v.into());
8730 self
8731 }
8732
8733 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8734 ///
8735 /// # Example
8736 /// ```ignore,no_run
8737 /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8738 /// use google_cloud_retail_v2::model::ProductAttributeValue;
8739 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8740 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8741 /// ```
8742 pub fn set_or_clear_product_attribute_value<T>(
8743 mut self,
8744 v: std::option::Option<T>,
8745 ) -> Self
8746 where
8747 T: std::convert::Into<crate::model::ProductAttributeValue>,
8748 {
8749 self.product_attribute_value = v.map(|x| x.into());
8750 self
8751 }
8752 }
8753
8754 impl wkt::message::Message for SelectedAnswer {
8755 fn typename() -> &'static str {
8756 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8757 }
8758 }
8759
8760 /// This field specifies the type of user answer.
8761 #[derive(Clone, Debug, PartialEq)]
8762 #[non_exhaustive]
8763 pub enum Type {
8764 /// This field specifies the incremental input text from the user during
8765 /// the conversational search.
8766 TextAnswer(std::string::String),
8767 /// Optional. This field specifies the selected answer during the
8768 /// conversational search. This should be a subset of
8769 /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8770 SelectedAnswer(
8771 std::boxed::Box<
8772 crate::model::conversational_search_request::user_answer::SelectedAnswer,
8773 >,
8774 ),
8775 }
8776 }
8777
8778 /// This field specifies all conversational filtering related parameters
8779 /// addition to conversational retail search.
8780 #[derive(Clone, Default, PartialEq)]
8781 #[non_exhaustive]
8782 pub struct ConversationalFilteringSpec {
8783 /// Optional. This field is deprecated. Please use
8784 /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8785 /// instead.
8786 ///
8787 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8788 #[deprecated]
8789 pub enable_conversational_filtering: bool,
8790
8791 /// Optional. This field specifies the current user answer during the
8792 /// conversational filtering search. It can be either user selected from
8793 /// suggested answers or user input plain text.
8794 pub user_answer:
8795 std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8796
8797 /// Optional. Mode to control Conversational Filtering.
8798 /// Defaults to
8799 /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8800 /// if it's unset.
8801 ///
8802 /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8803 pub conversational_filtering_mode:
8804 crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8805
8806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8807 }
8808
8809 impl ConversationalFilteringSpec {
8810 /// Creates a new default instance.
8811 pub fn new() -> Self {
8812 std::default::Default::default()
8813 }
8814
8815 /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8816 ///
8817 /// # Example
8818 /// ```ignore,no_run
8819 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8820 /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8821 /// ```
8822 #[deprecated]
8823 pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8824 mut self,
8825 v: T,
8826 ) -> Self {
8827 self.enable_conversational_filtering = v.into();
8828 self
8829 }
8830
8831 /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8832 ///
8833 /// # Example
8834 /// ```ignore,no_run
8835 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8836 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8837 /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8838 /// ```
8839 pub fn set_user_answer<T>(mut self, v: T) -> Self
8840 where
8841 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8842 {
8843 self.user_answer = std::option::Option::Some(v.into());
8844 self
8845 }
8846
8847 /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8848 ///
8849 /// # Example
8850 /// ```ignore,no_run
8851 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8852 /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8853 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8854 /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8855 /// ```
8856 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8857 where
8858 T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8859 {
8860 self.user_answer = v.map(|x| x.into());
8861 self
8862 }
8863
8864 /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8869 /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8870 /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8871 /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8872 /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8873 /// ```
8874 pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8875 self.conversational_filtering_mode = v.into();
8876 self
8877 }
8878 }
8879
8880 impl wkt::message::Message for ConversationalFilteringSpec {
8881 fn typename() -> &'static str {
8882 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8883 }
8884 }
8885
8886 /// Defines additional types related to [ConversationalFilteringSpec].
8887 pub mod conversational_filtering_spec {
8888 #[allow(unused_imports)]
8889 use super::*;
8890
8891 /// Enum to control Conversational Filtering mode.
8892 /// A single conversation session including multiple turns supports modes for
8893 /// Conversational Search OR Conversational Filtering without
8894 /// Conversational Search, but not both.
8895 ///
8896 /// # Working with unknown values
8897 ///
8898 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8899 /// additional enum variants at any time. Adding new variants is not considered
8900 /// a breaking change. Applications should write their code in anticipation of:
8901 ///
8902 /// - New values appearing in future releases of the client library, **and**
8903 /// - New values received dynamically, without application changes.
8904 ///
8905 /// Please consult the [Working with enums] section in the user guide for some
8906 /// guidelines.
8907 ///
8908 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8909 #[derive(Clone, Debug, PartialEq)]
8910 #[non_exhaustive]
8911 pub enum Mode {
8912 /// Default value.
8913 Unspecified,
8914 /// Disables Conversational Filtering when using Conversational Search.
8915 Disabled,
8916 /// Enables Conversational Filtering when using Conversational Search.
8917 Enabled,
8918 /// Enables Conversational Filtering without Conversational Search.
8919 ConversationalFilterOnly,
8920 /// If set, the enum was initialized with an unknown value.
8921 ///
8922 /// Applications can examine the value using [Mode::value] or
8923 /// [Mode::name].
8924 UnknownValue(mode::UnknownValue),
8925 }
8926
8927 #[doc(hidden)]
8928 pub mod mode {
8929 #[allow(unused_imports)]
8930 use super::*;
8931 #[derive(Clone, Debug, PartialEq)]
8932 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8933 }
8934
8935 impl Mode {
8936 /// Gets the enum value.
8937 ///
8938 /// Returns `None` if the enum contains an unknown value deserialized from
8939 /// the string representation of enums.
8940 pub fn value(&self) -> std::option::Option<i32> {
8941 match self {
8942 Self::Unspecified => std::option::Option::Some(0),
8943 Self::Disabled => std::option::Option::Some(1),
8944 Self::Enabled => std::option::Option::Some(2),
8945 Self::ConversationalFilterOnly => std::option::Option::Some(3),
8946 Self::UnknownValue(u) => u.0.value(),
8947 }
8948 }
8949
8950 /// Gets the enum value as a string.
8951 ///
8952 /// Returns `None` if the enum contains an unknown value deserialized from
8953 /// the integer representation of enums.
8954 pub fn name(&self) -> std::option::Option<&str> {
8955 match self {
8956 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8957 Self::Disabled => std::option::Option::Some("DISABLED"),
8958 Self::Enabled => std::option::Option::Some("ENABLED"),
8959 Self::ConversationalFilterOnly => {
8960 std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8961 }
8962 Self::UnknownValue(u) => u.0.name(),
8963 }
8964 }
8965 }
8966
8967 impl std::default::Default for Mode {
8968 fn default() -> Self {
8969 use std::convert::From;
8970 Self::from(0)
8971 }
8972 }
8973
8974 impl std::fmt::Display for Mode {
8975 fn fmt(
8976 &self,
8977 f: &mut std::fmt::Formatter<'_>,
8978 ) -> std::result::Result<(), std::fmt::Error> {
8979 wkt::internal::display_enum(f, self.name(), self.value())
8980 }
8981 }
8982
8983 impl std::convert::From<i32> for Mode {
8984 fn from(value: i32) -> Self {
8985 match value {
8986 0 => Self::Unspecified,
8987 1 => Self::Disabled,
8988 2 => Self::Enabled,
8989 3 => Self::ConversationalFilterOnly,
8990 _ => Self::UnknownValue(mode::UnknownValue(
8991 wkt::internal::UnknownEnumValue::Integer(value),
8992 )),
8993 }
8994 }
8995 }
8996
8997 impl std::convert::From<&str> for Mode {
8998 fn from(value: &str) -> Self {
8999 use std::string::ToString;
9000 match value {
9001 "MODE_UNSPECIFIED" => Self::Unspecified,
9002 "DISABLED" => Self::Disabled,
9003 "ENABLED" => Self::Enabled,
9004 "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
9005 _ => Self::UnknownValue(mode::UnknownValue(
9006 wkt::internal::UnknownEnumValue::String(value.to_string()),
9007 )),
9008 }
9009 }
9010 }
9011
9012 impl serde::ser::Serialize for Mode {
9013 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9014 where
9015 S: serde::Serializer,
9016 {
9017 match self {
9018 Self::Unspecified => serializer.serialize_i32(0),
9019 Self::Disabled => serializer.serialize_i32(1),
9020 Self::Enabled => serializer.serialize_i32(2),
9021 Self::ConversationalFilterOnly => serializer.serialize_i32(3),
9022 Self::UnknownValue(u) => u.0.serialize(serializer),
9023 }
9024 }
9025 }
9026
9027 impl<'de> serde::de::Deserialize<'de> for Mode {
9028 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9029 where
9030 D: serde::Deserializer<'de>,
9031 {
9032 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9033 ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
9034 }
9035 }
9036 }
9037}
9038
9039/// Response message for
9040/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
9041/// method.
9042#[derive(Clone, Default, PartialEq)]
9043#[non_exhaustive]
9044pub struct ConversationalSearchResponse {
9045 /// The types Retail classifies the search query as.
9046 ///
9047 /// Supported values are:
9048 ///
9049 /// - "ORDER_SUPPORT"
9050 /// - "SIMPLE_PRODUCT_SEARCH"
9051 /// - "INTENT_REFINEMENT"
9052 /// - "PRODUCT_DETAILS"
9053 /// - "PRODUCT_COMPARISON"
9054 /// - "DEALS_AND_COUPONS"
9055 /// - "STORE_RELEVANT"
9056 /// - "BLOCKLISTED"
9057 /// - "BEST_PRODUCT"
9058 /// - "RETAIL_SUPPORT"
9059 /// - "DISABLED"
9060 pub user_query_types: std::vec::Vec<std::string::String>,
9061
9062 /// The conversational answer-based text response generated by the Server.
9063 pub conversational_text_response: std::string::String,
9064
9065 /// The conversational followup question generated for Intent refinement.
9066 pub followup_question:
9067 std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9068
9069 /// Conversation UUID. This field will be stored in client side storage to
9070 /// maintain the conversation session with server and will be used for next
9071 /// search request's
9072 /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
9073 /// to restore conversation state in server.
9074 ///
9075 /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
9076 pub conversation_id: std::string::String,
9077
9078 /// The proposed refined search queries. They can be used to fetch the relevant
9079 /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
9080 /// refined_query from search response will be populated here.
9081 pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
9082
9083 /// This field specifies all related information that is needed on client
9084 /// side for UI rendering of conversational filtering search.
9085 pub conversational_filtering_result: std::option::Option<
9086 crate::model::conversational_search_response::ConversationalFilteringResult,
9087 >,
9088
9089 /// Output only. The state of the response generation.
9090 pub state: crate::model::conversational_search_response::State,
9091
9092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9093}
9094
9095impl ConversationalSearchResponse {
9096 /// Creates a new default instance.
9097 pub fn new() -> Self {
9098 std::default::Default::default()
9099 }
9100
9101 /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
9102 ///
9103 /// # Example
9104 /// ```ignore,no_run
9105 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9106 /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
9107 /// ```
9108 pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
9109 where
9110 T: std::iter::IntoIterator<Item = V>,
9111 V: std::convert::Into<std::string::String>,
9112 {
9113 use std::iter::Iterator;
9114 self.user_query_types = v.into_iter().map(|i| i.into()).collect();
9115 self
9116 }
9117
9118 /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
9119 ///
9120 /// # Example
9121 /// ```ignore,no_run
9122 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9123 /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9124 /// ```
9125 pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9126 mut self,
9127 v: T,
9128 ) -> Self {
9129 self.conversational_text_response = v.into();
9130 self
9131 }
9132
9133 /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9134 ///
9135 /// # Example
9136 /// ```ignore,no_run
9137 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9138 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9139 /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9140 /// ```
9141 pub fn set_followup_question<T>(mut self, v: T) -> Self
9142 where
9143 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9144 {
9145 self.followup_question = std::option::Option::Some(v.into());
9146 self
9147 }
9148
9149 /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
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::FollowupQuestion;
9155 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9156 /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9157 /// ```
9158 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9159 where
9160 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9161 {
9162 self.followup_question = v.map(|x| x.into());
9163 self
9164 }
9165
9166 /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9171 /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9172 /// ```
9173 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9174 self.conversation_id = v.into();
9175 self
9176 }
9177
9178 /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9179 ///
9180 /// # Example
9181 /// ```ignore,no_run
9182 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9183 /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9184 /// let x = ConversationalSearchResponse::new()
9185 /// .set_refined_search([
9186 /// RefinedSearch::default()/* use setters */,
9187 /// RefinedSearch::default()/* use (different) setters */,
9188 /// ]);
9189 /// ```
9190 pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9191 where
9192 T: std::iter::IntoIterator<Item = V>,
9193 V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9194 {
9195 use std::iter::Iterator;
9196 self.refined_search = v.into_iter().map(|i| i.into()).collect();
9197 self
9198 }
9199
9200 /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9201 ///
9202 /// # Example
9203 /// ```ignore,no_run
9204 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9205 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9206 /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9207 /// ```
9208 pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9209 where
9210 T: std::convert::Into<
9211 crate::model::conversational_search_response::ConversationalFilteringResult,
9212 >,
9213 {
9214 self.conversational_filtering_result = std::option::Option::Some(v.into());
9215 self
9216 }
9217
9218 /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9219 ///
9220 /// # Example
9221 /// ```ignore,no_run
9222 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9223 /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9224 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9225 /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9226 /// ```
9227 pub fn set_or_clear_conversational_filtering_result<T>(
9228 mut self,
9229 v: std::option::Option<T>,
9230 ) -> Self
9231 where
9232 T: std::convert::Into<
9233 crate::model::conversational_search_response::ConversationalFilteringResult,
9234 >,
9235 {
9236 self.conversational_filtering_result = v.map(|x| x.into());
9237 self
9238 }
9239
9240 /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9241 ///
9242 /// # Example
9243 /// ```ignore,no_run
9244 /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9245 /// use google_cloud_retail_v2::model::conversational_search_response::State;
9246 /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9247 /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9248 /// ```
9249 pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9250 mut self,
9251 v: T,
9252 ) -> Self {
9253 self.state = v.into();
9254 self
9255 }
9256}
9257
9258impl wkt::message::Message for ConversationalSearchResponse {
9259 fn typename() -> &'static str {
9260 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9261 }
9262}
9263
9264/// Defines additional types related to [ConversationalSearchResponse].
9265pub mod conversational_search_response {
9266 #[allow(unused_imports)]
9267 use super::*;
9268
9269 /// The conversational followup question generated for Intent refinement.
9270 #[derive(Clone, Default, PartialEq)]
9271 #[non_exhaustive]
9272 pub struct FollowupQuestion {
9273 /// The conversational followup question generated for Intent refinement.
9274 pub followup_question: std::string::String,
9275
9276 /// The answer options provided to client for the follow-up question.
9277 pub suggested_answers: std::vec::Vec<
9278 crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9279 >,
9280
9281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9282 }
9283
9284 impl FollowupQuestion {
9285 /// Creates a new default instance.
9286 pub fn new() -> Self {
9287 std::default::Default::default()
9288 }
9289
9290 /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9291 ///
9292 /// # Example
9293 /// ```ignore,no_run
9294 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9295 /// let x = FollowupQuestion::new().set_followup_question("example");
9296 /// ```
9297 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9298 mut self,
9299 v: T,
9300 ) -> Self {
9301 self.followup_question = v.into();
9302 self
9303 }
9304
9305 /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9306 ///
9307 /// # Example
9308 /// ```ignore,no_run
9309 /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9310 /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9311 /// let x = FollowupQuestion::new()
9312 /// .set_suggested_answers([
9313 /// SuggestedAnswer::default()/* use setters */,
9314 /// SuggestedAnswer::default()/* use (different) setters */,
9315 /// ]);
9316 /// ```
9317 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9318 where
9319 T: std::iter::IntoIterator<Item = V>,
9320 V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9321 {
9322 use std::iter::Iterator;
9323 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9324 self
9325 }
9326 }
9327
9328 impl wkt::message::Message for FollowupQuestion {
9329 fn typename() -> &'static str {
9330 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9331 }
9332 }
9333
9334 /// Defines additional types related to [FollowupQuestion].
9335 pub mod followup_question {
9336 #[allow(unused_imports)]
9337 use super::*;
9338
9339 /// Suggested answers to the follow-up question.
9340 /// If it's numerical attribute, only ProductAttributeInterval will be set.
9341 /// If it's textual attribute, only productAttributeValue will be set.
9342 #[derive(Clone, Default, PartialEq)]
9343 #[non_exhaustive]
9344 pub struct SuggestedAnswer {
9345 /// Product attribute value, including an attribute key and an
9346 /// attribute value. Other types can be added here in the future.
9347 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9348
9349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9350 }
9351
9352 impl SuggestedAnswer {
9353 /// Creates a new default instance.
9354 pub fn new() -> Self {
9355 std::default::Default::default()
9356 }
9357
9358 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9359 ///
9360 /// # Example
9361 /// ```ignore,no_run
9362 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9363 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9364 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9365 /// ```
9366 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9367 where
9368 T: std::convert::Into<crate::model::ProductAttributeValue>,
9369 {
9370 self.product_attribute_value = std::option::Option::Some(v.into());
9371 self
9372 }
9373
9374 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9375 ///
9376 /// # Example
9377 /// ```ignore,no_run
9378 /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9379 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9380 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9381 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9382 /// ```
9383 pub fn set_or_clear_product_attribute_value<T>(
9384 mut self,
9385 v: std::option::Option<T>,
9386 ) -> Self
9387 where
9388 T: std::convert::Into<crate::model::ProductAttributeValue>,
9389 {
9390 self.product_attribute_value = v.map(|x| x.into());
9391 self
9392 }
9393 }
9394
9395 impl wkt::message::Message for SuggestedAnswer {
9396 fn typename() -> &'static str {
9397 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9398 }
9399 }
9400 }
9401
9402 /// The proposed refined search for intent-refinement/bundled shopping
9403 /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9404 /// refined_query from search response will be populated here.
9405 #[derive(Clone, Default, PartialEq)]
9406 #[non_exhaustive]
9407 pub struct RefinedSearch {
9408 /// The query to be used for search.
9409 pub query: std::string::String,
9410
9411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9412 }
9413
9414 impl RefinedSearch {
9415 /// Creates a new default instance.
9416 pub fn new() -> Self {
9417 std::default::Default::default()
9418 }
9419
9420 /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9421 ///
9422 /// # Example
9423 /// ```ignore,no_run
9424 /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9425 /// let x = RefinedSearch::new().set_query("example");
9426 /// ```
9427 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9428 self.query = v.into();
9429 self
9430 }
9431 }
9432
9433 impl wkt::message::Message for RefinedSearch {
9434 fn typename() -> &'static str {
9435 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9436 }
9437 }
9438
9439 /// This field specifies all related information that is needed on client
9440 /// side for UI rendering of conversational filtering search.
9441 #[derive(Clone, Default, PartialEq)]
9442 #[non_exhaustive]
9443 pub struct ConversationalFilteringResult {
9444
9445 /// The conversational filtering question.
9446 pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9447
9448 /// This is the incremental additional filters implied from the current
9449 /// user answer. User should add the suggested addition filters to the
9450 /// previous [ConversationalSearchRequest.search_params.filter][] and
9451 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
9452 /// use the merged filter in the follow up requests.
9453 pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9454
9455 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9456 }
9457
9458 impl ConversationalFilteringResult {
9459 /// Creates a new default instance.
9460 pub fn new() -> Self {
9461 std::default::Default::default()
9462 }
9463
9464 /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9465 ///
9466 /// # Example
9467 /// ```ignore,no_run
9468 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9469 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9470 /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9471 /// ```
9472 pub fn set_followup_question<T>(mut self, v: T) -> Self
9473 where
9474 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9475 {
9476 self.followup_question = std::option::Option::Some(v.into());
9477 self
9478 }
9479
9480 /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9481 ///
9482 /// # Example
9483 /// ```ignore,no_run
9484 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9485 /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9486 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9487 /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9488 /// ```
9489 pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9490 where
9491 T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9492 {
9493 self.followup_question = v.map(|x| x.into());
9494 self
9495 }
9496
9497 /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9498 ///
9499 /// # Example
9500 /// ```ignore,no_run
9501 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9502 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9503 /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9504 /// ```
9505 pub fn set_additional_filter<T>(mut self, v: T) -> Self
9506 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9507 {
9508 self.additional_filter = std::option::Option::Some(v.into());
9509 self
9510 }
9511
9512 /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9513 ///
9514 /// # Example
9515 /// ```ignore,no_run
9516 /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9517 /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9518 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9519 /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9520 /// ```
9521 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9522 where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9523 {
9524 self.additional_filter = v.map(|x| x.into());
9525 self
9526 }
9527 }
9528
9529 impl wkt::message::Message for ConversationalFilteringResult {
9530 fn typename() -> &'static str {
9531 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9532 }
9533 }
9534
9535 /// Defines additional types related to [ConversationalFilteringResult].
9536 pub mod conversational_filtering_result {
9537 #[allow(unused_imports)]
9538 use super::*;
9539
9540 /// Additional filter that client side need to apply.
9541 #[derive(Clone, Default, PartialEq)]
9542 #[non_exhaustive]
9543 pub struct AdditionalFilter {
9544 /// Product attribute value, including an attribute key and an
9545 /// attribute value. Other types can be added here in the future.
9546 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9547
9548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9549 }
9550
9551 impl AdditionalFilter {
9552 /// Creates a new default instance.
9553 pub fn new() -> Self {
9554 std::default::Default::default()
9555 }
9556
9557 /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9558 ///
9559 /// # Example
9560 /// ```ignore,no_run
9561 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9562 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9563 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9564 /// ```
9565 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9566 where
9567 T: std::convert::Into<crate::model::ProductAttributeValue>,
9568 {
9569 self.product_attribute_value = std::option::Option::Some(v.into());
9570 self
9571 }
9572
9573 /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9574 ///
9575 /// # Example
9576 /// ```ignore,no_run
9577 /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9578 /// use google_cloud_retail_v2::model::ProductAttributeValue;
9579 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9580 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9581 /// ```
9582 pub fn set_or_clear_product_attribute_value<T>(
9583 mut self,
9584 v: std::option::Option<T>,
9585 ) -> Self
9586 where
9587 T: std::convert::Into<crate::model::ProductAttributeValue>,
9588 {
9589 self.product_attribute_value = v.map(|x| x.into());
9590 self
9591 }
9592 }
9593
9594 impl wkt::message::Message for AdditionalFilter {
9595 fn typename() -> &'static str {
9596 "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9597 }
9598 }
9599 }
9600
9601 /// The state of the response generation.
9602 ///
9603 /// # Working with unknown values
9604 ///
9605 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9606 /// additional enum variants at any time. Adding new variants is not considered
9607 /// a breaking change. Applications should write their code in anticipation of:
9608 ///
9609 /// - New values appearing in future releases of the client library, **and**
9610 /// - New values received dynamically, without application changes.
9611 ///
9612 /// Please consult the [Working with enums] section in the user guide for some
9613 /// guidelines.
9614 ///
9615 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9616 #[derive(Clone, Debug, PartialEq)]
9617 #[non_exhaustive]
9618 pub enum State {
9619 /// Unknown.
9620 Unspecified,
9621 /// Response generation is being streamed.
9622 Streaming,
9623 /// Response generation has succeeded.
9624 Succeeded,
9625 /// If set, the enum was initialized with an unknown value.
9626 ///
9627 /// Applications can examine the value using [State::value] or
9628 /// [State::name].
9629 UnknownValue(state::UnknownValue),
9630 }
9631
9632 #[doc(hidden)]
9633 pub mod state {
9634 #[allow(unused_imports)]
9635 use super::*;
9636 #[derive(Clone, Debug, PartialEq)]
9637 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9638 }
9639
9640 impl State {
9641 /// Gets the enum value.
9642 ///
9643 /// Returns `None` if the enum contains an unknown value deserialized from
9644 /// the string representation of enums.
9645 pub fn value(&self) -> std::option::Option<i32> {
9646 match self {
9647 Self::Unspecified => std::option::Option::Some(0),
9648 Self::Streaming => std::option::Option::Some(1),
9649 Self::Succeeded => std::option::Option::Some(2),
9650 Self::UnknownValue(u) => u.0.value(),
9651 }
9652 }
9653
9654 /// Gets the enum value as a string.
9655 ///
9656 /// Returns `None` if the enum contains an unknown value deserialized from
9657 /// the integer representation of enums.
9658 pub fn name(&self) -> std::option::Option<&str> {
9659 match self {
9660 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9661 Self::Streaming => std::option::Option::Some("STREAMING"),
9662 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9663 Self::UnknownValue(u) => u.0.name(),
9664 }
9665 }
9666 }
9667
9668 impl std::default::Default for State {
9669 fn default() -> Self {
9670 use std::convert::From;
9671 Self::from(0)
9672 }
9673 }
9674
9675 impl std::fmt::Display for State {
9676 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9677 wkt::internal::display_enum(f, self.name(), self.value())
9678 }
9679 }
9680
9681 impl std::convert::From<i32> for State {
9682 fn from(value: i32) -> Self {
9683 match value {
9684 0 => Self::Unspecified,
9685 1 => Self::Streaming,
9686 2 => Self::Succeeded,
9687 _ => Self::UnknownValue(state::UnknownValue(
9688 wkt::internal::UnknownEnumValue::Integer(value),
9689 )),
9690 }
9691 }
9692 }
9693
9694 impl std::convert::From<&str> for State {
9695 fn from(value: &str) -> Self {
9696 use std::string::ToString;
9697 match value {
9698 "STATE_UNSPECIFIED" => Self::Unspecified,
9699 "STREAMING" => Self::Streaming,
9700 "SUCCEEDED" => Self::Succeeded,
9701 _ => Self::UnknownValue(state::UnknownValue(
9702 wkt::internal::UnknownEnumValue::String(value.to_string()),
9703 )),
9704 }
9705 }
9706 }
9707
9708 impl serde::ser::Serialize for State {
9709 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9710 where
9711 S: serde::Serializer,
9712 {
9713 match self {
9714 Self::Unspecified => serializer.serialize_i32(0),
9715 Self::Streaming => serializer.serialize_i32(1),
9716 Self::Succeeded => serializer.serialize_i32(2),
9717 Self::UnknownValue(u) => u.0.serialize(serializer),
9718 }
9719 }
9720 }
9721
9722 impl<'de> serde::de::Deserialize<'de> for State {
9723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9724 where
9725 D: serde::Deserializer<'de>,
9726 {
9727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9728 ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9729 ))
9730 }
9731 }
9732}
9733
9734/// The output configuration setting.
9735#[derive(Clone, Default, PartialEq)]
9736#[non_exhaustive]
9737pub struct OutputConfig {
9738 /// The configuration of destination for holding output data.
9739 pub destination: std::option::Option<crate::model::output_config::Destination>,
9740
9741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9742}
9743
9744impl OutputConfig {
9745 /// Creates a new default instance.
9746 pub fn new() -> Self {
9747 std::default::Default::default()
9748 }
9749
9750 /// Sets the value of [destination][crate::model::OutputConfig::destination].
9751 ///
9752 /// Note that all the setters affecting `destination` are mutually
9753 /// exclusive.
9754 ///
9755 /// # Example
9756 /// ```ignore,no_run
9757 /// # use google_cloud_retail_v2::model::OutputConfig;
9758 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9759 /// let x = OutputConfig::new().set_destination(Some(
9760 /// google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9761 /// ```
9762 pub fn set_destination<
9763 T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9764 >(
9765 mut self,
9766 v: T,
9767 ) -> Self {
9768 self.destination = v.into();
9769 self
9770 }
9771
9772 /// The value of [destination][crate::model::OutputConfig::destination]
9773 /// if it holds a `GcsDestination`, `None` if the field is not set or
9774 /// holds a different branch.
9775 pub fn gcs_destination(
9776 &self,
9777 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9778 #[allow(unreachable_patterns)]
9779 self.destination.as_ref().and_then(|v| match v {
9780 crate::model::output_config::Destination::GcsDestination(v) => {
9781 std::option::Option::Some(v)
9782 }
9783 _ => std::option::Option::None,
9784 })
9785 }
9786
9787 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9788 /// to hold a `GcsDestination`.
9789 ///
9790 /// Note that all the setters affecting `destination` are
9791 /// mutually exclusive.
9792 ///
9793 /// # Example
9794 /// ```ignore,no_run
9795 /// # use google_cloud_retail_v2::model::OutputConfig;
9796 /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9797 /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9798 /// assert!(x.gcs_destination().is_some());
9799 /// assert!(x.bigquery_destination().is_none());
9800 /// ```
9801 pub fn set_gcs_destination<
9802 T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9803 >(
9804 mut self,
9805 v: T,
9806 ) -> Self {
9807 self.destination = std::option::Option::Some(
9808 crate::model::output_config::Destination::GcsDestination(v.into()),
9809 );
9810 self
9811 }
9812
9813 /// The value of [destination][crate::model::OutputConfig::destination]
9814 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9815 /// holds a different branch.
9816 pub fn bigquery_destination(
9817 &self,
9818 ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9819 {
9820 #[allow(unreachable_patterns)]
9821 self.destination.as_ref().and_then(|v| match v {
9822 crate::model::output_config::Destination::BigqueryDestination(v) => {
9823 std::option::Option::Some(v)
9824 }
9825 _ => std::option::Option::None,
9826 })
9827 }
9828
9829 /// Sets the value of [destination][crate::model::OutputConfig::destination]
9830 /// to hold a `BigqueryDestination`.
9831 ///
9832 /// Note that all the setters affecting `destination` are
9833 /// mutually exclusive.
9834 ///
9835 /// # Example
9836 /// ```ignore,no_run
9837 /// # use google_cloud_retail_v2::model::OutputConfig;
9838 /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9839 /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9840 /// assert!(x.bigquery_destination().is_some());
9841 /// assert!(x.gcs_destination().is_none());
9842 /// ```
9843 pub fn set_bigquery_destination<
9844 T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9845 >(
9846 mut self,
9847 v: T,
9848 ) -> Self {
9849 self.destination = std::option::Option::Some(
9850 crate::model::output_config::Destination::BigqueryDestination(v.into()),
9851 );
9852 self
9853 }
9854}
9855
9856impl wkt::message::Message for OutputConfig {
9857 fn typename() -> &'static str {
9858 "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9859 }
9860}
9861
9862/// Defines additional types related to [OutputConfig].
9863pub mod output_config {
9864 #[allow(unused_imports)]
9865 use super::*;
9866
9867 /// The Google Cloud Storage output destination configuration.
9868 #[derive(Clone, Default, PartialEq)]
9869 #[non_exhaustive]
9870 pub struct GcsDestination {
9871 /// Required. The output uri prefix for saving output data to json files.
9872 /// Some mapping examples are as follows:
9873 /// output_uri_prefix sample output(assuming the object is foo.json)
9874 /// ======================== =============================================
9875 /// gs://bucket/ gs://bucket/foo.json
9876 /// gs://bucket/folder/ gs://bucket/folder/foo.json
9877 /// gs://bucket/folder/item_ gs://bucket/folder/item_foo.json
9878 pub output_uri_prefix: std::string::String,
9879
9880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9881 }
9882
9883 impl GcsDestination {
9884 /// Creates a new default instance.
9885 pub fn new() -> Self {
9886 std::default::Default::default()
9887 }
9888
9889 /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9890 ///
9891 /// # Example
9892 /// ```ignore,no_run
9893 /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9894 /// let x = GcsDestination::new().set_output_uri_prefix("example");
9895 /// ```
9896 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9897 mut self,
9898 v: T,
9899 ) -> Self {
9900 self.output_uri_prefix = v.into();
9901 self
9902 }
9903 }
9904
9905 impl wkt::message::Message for GcsDestination {
9906 fn typename() -> &'static str {
9907 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9908 }
9909 }
9910
9911 /// The BigQuery output destination configuration.
9912 #[derive(Clone, Default, PartialEq)]
9913 #[non_exhaustive]
9914 pub struct BigQueryDestination {
9915 /// Required. The ID of a BigQuery Dataset.
9916 pub dataset_id: std::string::String,
9917
9918 /// Required. The prefix of exported BigQuery tables.
9919 pub table_id_prefix: std::string::String,
9920
9921 /// Required. Describes the table type. The following values are supported:
9922 ///
9923 /// * `table`: A BigQuery native table.
9924 /// * `view`: A virtual table defined by a SQL query.
9925 pub table_type: std::string::String,
9926
9927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9928 }
9929
9930 impl BigQueryDestination {
9931 /// Creates a new default instance.
9932 pub fn new() -> Self {
9933 std::default::Default::default()
9934 }
9935
9936 /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9937 ///
9938 /// # Example
9939 /// ```ignore,no_run
9940 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9941 /// let x = BigQueryDestination::new().set_dataset_id("example");
9942 /// ```
9943 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9944 self.dataset_id = v.into();
9945 self
9946 }
9947
9948 /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9949 ///
9950 /// # Example
9951 /// ```ignore,no_run
9952 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9953 /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9954 /// ```
9955 pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9956 mut self,
9957 v: T,
9958 ) -> Self {
9959 self.table_id_prefix = v.into();
9960 self
9961 }
9962
9963 /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9964 ///
9965 /// # Example
9966 /// ```ignore,no_run
9967 /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9968 /// let x = BigQueryDestination::new().set_table_type("example");
9969 /// ```
9970 pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9971 self.table_type = v.into();
9972 self
9973 }
9974 }
9975
9976 impl wkt::message::Message for BigQueryDestination {
9977 fn typename() -> &'static str {
9978 "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9979 }
9980 }
9981
9982 /// The configuration of destination for holding output data.
9983 #[derive(Clone, Debug, PartialEq)]
9984 #[non_exhaustive]
9985 pub enum Destination {
9986 /// The Google Cloud Storage location where the output is to be written to.
9987 GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9988 /// The BigQuery location where the output is to be written to.
9989 BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9990 }
9991}
9992
9993/// Configuration of destination for Export related errors.
9994#[derive(Clone, Default, PartialEq)]
9995#[non_exhaustive]
9996pub struct ExportErrorsConfig {
9997 /// Required. Errors destination.
9998 pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
9999
10000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10001}
10002
10003impl ExportErrorsConfig {
10004 /// Creates a new default instance.
10005 pub fn new() -> Self {
10006 std::default::Default::default()
10007 }
10008
10009 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
10010 ///
10011 /// Note that all the setters affecting `destination` are mutually
10012 /// exclusive.
10013 ///
10014 /// # Example
10015 /// ```ignore,no_run
10016 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
10017 /// use google_cloud_retail_v2::model::export_errors_config::Destination;
10018 /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
10019 /// ```
10020 pub fn set_destination<
10021 T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
10022 >(
10023 mut self,
10024 v: T,
10025 ) -> Self {
10026 self.destination = v.into();
10027 self
10028 }
10029
10030 /// The value of [destination][crate::model::ExportErrorsConfig::destination]
10031 /// if it holds a `GcsPrefix`, `None` if the field is not set or
10032 /// holds a different branch.
10033 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
10034 #[allow(unreachable_patterns)]
10035 self.destination.as_ref().and_then(|v| match v {
10036 crate::model::export_errors_config::Destination::GcsPrefix(v) => {
10037 std::option::Option::Some(v)
10038 }
10039 _ => std::option::Option::None,
10040 })
10041 }
10042
10043 /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
10044 /// to hold a `GcsPrefix`.
10045 ///
10046 /// Note that all the setters affecting `destination` are
10047 /// mutually exclusive.
10048 ///
10049 /// # Example
10050 /// ```ignore,no_run
10051 /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
10052 /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
10053 /// assert!(x.gcs_prefix().is_some());
10054 /// ```
10055 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10056 self.destination = std::option::Option::Some(
10057 crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
10058 );
10059 self
10060 }
10061}
10062
10063impl wkt::message::Message for ExportErrorsConfig {
10064 fn typename() -> &'static str {
10065 "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
10066 }
10067}
10068
10069/// Defines additional types related to [ExportErrorsConfig].
10070pub mod export_errors_config {
10071 #[allow(unused_imports)]
10072 use super::*;
10073
10074 /// Required. Errors destination.
10075 #[derive(Clone, Debug, PartialEq)]
10076 #[non_exhaustive]
10077 pub enum Destination {
10078 /// Google Cloud Storage path for import errors. This must be an empty,
10079 /// existing Cloud Storage bucket. Export errors will be written to a file in
10080 /// this bucket, one per line, as a JSON-encoded
10081 /// `google.rpc.Status` message.
10082 GcsPrefix(std::string::String),
10083 }
10084}
10085
10086/// Request message for the `ExportAnalyticsMetrics` method.
10087#[derive(Clone, Default, PartialEq)]
10088#[non_exhaustive]
10089pub struct ExportAnalyticsMetricsRequest {
10090 /// Required. Full resource name of the parent catalog.
10091 /// Expected format: `projects/*/locations/*/catalogs/*`
10092 pub catalog: std::string::String,
10093
10094 /// Required. The output location of the data.
10095 pub output_config: std::option::Option<crate::model::OutputConfig>,
10096
10097 /// A filtering expression to specify restrictions on returned metrics.
10098 /// The expression is a sequence of terms. Each term applies a restriction to
10099 /// the returned metrics. Use this expression to restrict results to a
10100 /// specific time range.
10101 ///
10102 /// Currently we expect only one types of fields:
10103 ///
10104 /// * `timestamp`: This can be specified twice, once with a
10105 /// less than operator and once with a greater than operator. The
10106 /// `timestamp` restriction should result in one, contiguous, valid,
10107 /// `timestamp` range.
10108 ///
10109 /// Some examples of valid filters expressions:
10110 ///
10111 /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
10112 /// timestamp < "2012-04-23T18:30:43.511Z"`
10113 /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
10114 pub filter: std::string::String,
10115
10116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10117}
10118
10119impl ExportAnalyticsMetricsRequest {
10120 /// Creates a new default instance.
10121 pub fn new() -> Self {
10122 std::default::Default::default()
10123 }
10124
10125 /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
10126 ///
10127 /// # Example
10128 /// ```ignore,no_run
10129 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10130 /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10131 /// ```
10132 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10133 self.catalog = v.into();
10134 self
10135 }
10136
10137 /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10138 ///
10139 /// # Example
10140 /// ```ignore,no_run
10141 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10142 /// use google_cloud_retail_v2::model::OutputConfig;
10143 /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10144 /// ```
10145 pub fn set_output_config<T>(mut self, v: T) -> Self
10146 where
10147 T: std::convert::Into<crate::model::OutputConfig>,
10148 {
10149 self.output_config = std::option::Option::Some(v.into());
10150 self
10151 }
10152
10153 /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10154 ///
10155 /// # Example
10156 /// ```ignore,no_run
10157 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10158 /// use google_cloud_retail_v2::model::OutputConfig;
10159 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10160 /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10161 /// ```
10162 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10163 where
10164 T: std::convert::Into<crate::model::OutputConfig>,
10165 {
10166 self.output_config = v.map(|x| x.into());
10167 self
10168 }
10169
10170 /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10171 ///
10172 /// # Example
10173 /// ```ignore,no_run
10174 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10175 /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10176 /// ```
10177 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10178 self.filter = v.into();
10179 self
10180 }
10181}
10182
10183impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10184 fn typename() -> &'static str {
10185 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10186 }
10187}
10188
10189/// Metadata related to the progress of the Export operation. This is
10190/// returned by the google.longrunning.Operation.metadata field.
10191#[derive(Clone, Default, PartialEq)]
10192#[non_exhaustive]
10193pub struct ExportMetadata {
10194 /// Operation create time.
10195 pub create_time: std::option::Option<wkt::Timestamp>,
10196
10197 /// Operation last update time. If the operation is done, this is also the
10198 /// finish time.
10199 pub update_time: std::option::Option<wkt::Timestamp>,
10200
10201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10202}
10203
10204impl ExportMetadata {
10205 /// Creates a new default instance.
10206 pub fn new() -> Self {
10207 std::default::Default::default()
10208 }
10209
10210 /// Sets the value of [create_time][crate::model::ExportMetadata::create_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_create_time(Timestamp::default()/* use setters */);
10217 /// ```
10218 pub fn set_create_time<T>(mut self, v: T) -> Self
10219 where
10220 T: std::convert::Into<wkt::Timestamp>,
10221 {
10222 self.create_time = std::option::Option::Some(v.into());
10223 self
10224 }
10225
10226 /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10227 ///
10228 /// # Example
10229 /// ```ignore,no_run
10230 /// # use google_cloud_retail_v2::model::ExportMetadata;
10231 /// use wkt::Timestamp;
10232 /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10233 /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10234 /// ```
10235 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10236 where
10237 T: std::convert::Into<wkt::Timestamp>,
10238 {
10239 self.create_time = v.map(|x| x.into());
10240 self
10241 }
10242
10243 /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10244 ///
10245 /// # Example
10246 /// ```ignore,no_run
10247 /// # use google_cloud_retail_v2::model::ExportMetadata;
10248 /// use wkt::Timestamp;
10249 /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10250 /// ```
10251 pub fn set_update_time<T>(mut self, v: T) -> Self
10252 where
10253 T: std::convert::Into<wkt::Timestamp>,
10254 {
10255 self.update_time = std::option::Option::Some(v.into());
10256 self
10257 }
10258
10259 /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10260 ///
10261 /// # Example
10262 /// ```ignore,no_run
10263 /// # use google_cloud_retail_v2::model::ExportMetadata;
10264 /// use wkt::Timestamp;
10265 /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10266 /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10267 /// ```
10268 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10269 where
10270 T: std::convert::Into<wkt::Timestamp>,
10271 {
10272 self.update_time = v.map(|x| x.into());
10273 self
10274 }
10275}
10276
10277impl wkt::message::Message for ExportMetadata {
10278 fn typename() -> &'static str {
10279 "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10280 }
10281}
10282
10283/// Response of the ExportAnalyticsMetricsRequest. If the long running
10284/// operation was successful, then this message is returned by the
10285/// google.longrunning.Operations.response field if the operation was successful.
10286#[derive(Clone, Default, PartialEq)]
10287#[non_exhaustive]
10288pub struct ExportAnalyticsMetricsResponse {
10289 /// A sample of errors encountered while processing the request.
10290 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
10291
10292 /// This field is never set.
10293 pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10294
10295 /// Output result indicating where the data were exported to.
10296 pub output_result: std::option::Option<crate::model::OutputResult>,
10297
10298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10299}
10300
10301impl ExportAnalyticsMetricsResponse {
10302 /// Creates a new default instance.
10303 pub fn new() -> Self {
10304 std::default::Default::default()
10305 }
10306
10307 /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10308 ///
10309 /// # Example
10310 /// ```ignore,no_run
10311 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10312 /// use google_cloud_rpc::model::Status;
10313 /// let x = ExportAnalyticsMetricsResponse::new()
10314 /// .set_error_samples([
10315 /// Status::default()/* use setters */,
10316 /// Status::default()/* use (different) setters */,
10317 /// ]);
10318 /// ```
10319 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10320 where
10321 T: std::iter::IntoIterator<Item = V>,
10322 V: std::convert::Into<google_cloud_rpc::model::Status>,
10323 {
10324 use std::iter::Iterator;
10325 self.error_samples = v.into_iter().map(|i| i.into()).collect();
10326 self
10327 }
10328
10329 /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10334 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10335 /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10336 /// ```
10337 pub fn set_errors_config<T>(mut self, v: T) -> Self
10338 where
10339 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10340 {
10341 self.errors_config = std::option::Option::Some(v.into());
10342 self
10343 }
10344
10345 /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10346 ///
10347 /// # Example
10348 /// ```ignore,no_run
10349 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10350 /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10351 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10352 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10353 /// ```
10354 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10355 where
10356 T: std::convert::Into<crate::model::ExportErrorsConfig>,
10357 {
10358 self.errors_config = v.map(|x| x.into());
10359 self
10360 }
10361
10362 /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10363 ///
10364 /// # Example
10365 /// ```ignore,no_run
10366 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10367 /// use google_cloud_retail_v2::model::OutputResult;
10368 /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10369 /// ```
10370 pub fn set_output_result<T>(mut self, v: T) -> Self
10371 where
10372 T: std::convert::Into<crate::model::OutputResult>,
10373 {
10374 self.output_result = std::option::Option::Some(v.into());
10375 self
10376 }
10377
10378 /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10379 ///
10380 /// # Example
10381 /// ```ignore,no_run
10382 /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10383 /// use google_cloud_retail_v2::model::OutputResult;
10384 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10385 /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10386 /// ```
10387 pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10388 where
10389 T: std::convert::Into<crate::model::OutputResult>,
10390 {
10391 self.output_result = v.map(|x| x.into());
10392 self
10393 }
10394}
10395
10396impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10397 fn typename() -> &'static str {
10398 "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10399 }
10400}
10401
10402/// Output result that stores the information about where the exported data is
10403/// stored.
10404#[derive(Clone, Default, PartialEq)]
10405#[non_exhaustive]
10406pub struct OutputResult {
10407 /// The BigQuery location where the result is stored.
10408 pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10409
10410 /// The Google Cloud Storage location where the result is stored.
10411 pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10412
10413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10414}
10415
10416impl OutputResult {
10417 /// Creates a new default instance.
10418 pub fn new() -> Self {
10419 std::default::Default::default()
10420 }
10421
10422 /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10423 ///
10424 /// # Example
10425 /// ```ignore,no_run
10426 /// # use google_cloud_retail_v2::model::OutputResult;
10427 /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10428 /// let x = OutputResult::new()
10429 /// .set_bigquery_result([
10430 /// BigQueryOutputResult::default()/* use setters */,
10431 /// BigQueryOutputResult::default()/* use (different) setters */,
10432 /// ]);
10433 /// ```
10434 pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10435 where
10436 T: std::iter::IntoIterator<Item = V>,
10437 V: std::convert::Into<crate::model::BigQueryOutputResult>,
10438 {
10439 use std::iter::Iterator;
10440 self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10441 self
10442 }
10443
10444 /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10445 ///
10446 /// # Example
10447 /// ```ignore,no_run
10448 /// # use google_cloud_retail_v2::model::OutputResult;
10449 /// use google_cloud_retail_v2::model::GcsOutputResult;
10450 /// let x = OutputResult::new()
10451 /// .set_gcs_result([
10452 /// GcsOutputResult::default()/* use setters */,
10453 /// GcsOutputResult::default()/* use (different) setters */,
10454 /// ]);
10455 /// ```
10456 pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10457 where
10458 T: std::iter::IntoIterator<Item = V>,
10459 V: std::convert::Into<crate::model::GcsOutputResult>,
10460 {
10461 use std::iter::Iterator;
10462 self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10463 self
10464 }
10465}
10466
10467impl wkt::message::Message for OutputResult {
10468 fn typename() -> &'static str {
10469 "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10470 }
10471}
10472
10473/// A BigQuery output result.
10474#[derive(Clone, Default, PartialEq)]
10475#[non_exhaustive]
10476pub struct BigQueryOutputResult {
10477 /// The ID of a BigQuery Dataset.
10478 pub dataset_id: std::string::String,
10479
10480 /// The ID of a BigQuery Table.
10481 pub table_id: std::string::String,
10482
10483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10484}
10485
10486impl BigQueryOutputResult {
10487 /// Creates a new default instance.
10488 pub fn new() -> Self {
10489 std::default::Default::default()
10490 }
10491
10492 /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10493 ///
10494 /// # Example
10495 /// ```ignore,no_run
10496 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10497 /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10498 /// ```
10499 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10500 self.dataset_id = v.into();
10501 self
10502 }
10503
10504 /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10505 ///
10506 /// # Example
10507 /// ```ignore,no_run
10508 /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10509 /// let x = BigQueryOutputResult::new().set_table_id("example");
10510 /// ```
10511 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10512 self.table_id = v.into();
10513 self
10514 }
10515}
10516
10517impl wkt::message::Message for BigQueryOutputResult {
10518 fn typename() -> &'static str {
10519 "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10520 }
10521}
10522
10523/// A Gcs output result.
10524#[derive(Clone, Default, PartialEq)]
10525#[non_exhaustive]
10526pub struct GcsOutputResult {
10527 /// The uri of Gcs output
10528 pub output_uri: std::string::String,
10529
10530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10531}
10532
10533impl GcsOutputResult {
10534 /// Creates a new default instance.
10535 pub fn new() -> Self {
10536 std::default::Default::default()
10537 }
10538
10539 /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10540 ///
10541 /// # Example
10542 /// ```ignore,no_run
10543 /// # use google_cloud_retail_v2::model::GcsOutputResult;
10544 /// let x = GcsOutputResult::new().set_output_uri("example");
10545 /// ```
10546 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10547 self.output_uri = v.into();
10548 self
10549 }
10550}
10551
10552impl wkt::message::Message for GcsOutputResult {
10553 fn typename() -> &'static str {
10554 "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10555 }
10556}
10557
10558/// Configuration for overall generative question feature state.
10559#[derive(Clone, Default, PartialEq)]
10560#[non_exhaustive]
10561pub struct GenerativeQuestionsFeatureConfig {
10562 /// Required. Resource name of the affected catalog.
10563 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10564 pub catalog: std::string::String,
10565
10566 /// Optional. Determines whether questions will be used at serving time.
10567 /// Note: This feature cannot be enabled until initial data requirements are
10568 /// satisfied.
10569 pub feature_enabled: bool,
10570
10571 /// Optional. Minimum number of products in the response to trigger follow-up
10572 /// questions. Value must be 0 or positive.
10573 pub minimum_products: i32,
10574
10575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10576}
10577
10578impl GenerativeQuestionsFeatureConfig {
10579 /// Creates a new default instance.
10580 pub fn new() -> Self {
10581 std::default::Default::default()
10582 }
10583
10584 /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10585 ///
10586 /// # Example
10587 /// ```ignore,no_run
10588 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10589 /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10590 /// ```
10591 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10592 self.catalog = v.into();
10593 self
10594 }
10595
10596 /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10597 ///
10598 /// # Example
10599 /// ```ignore,no_run
10600 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10601 /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10602 /// ```
10603 pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10604 self.feature_enabled = v.into();
10605 self
10606 }
10607
10608 /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10609 ///
10610 /// # Example
10611 /// ```ignore,no_run
10612 /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10613 /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10614 /// ```
10615 pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10616 self.minimum_products = v.into();
10617 self
10618 }
10619}
10620
10621impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10622 fn typename() -> &'static str {
10623 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10624 }
10625}
10626
10627/// Configuration for a single generated question.
10628#[derive(Clone, Default, PartialEq)]
10629#[non_exhaustive]
10630pub struct GenerativeQuestionConfig {
10631 /// Required. Resource name of the catalog.
10632 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10633 pub catalog: std::string::String,
10634
10635 /// Required. The facet to which the question is associated.
10636 pub facet: std::string::String,
10637
10638 /// Output only. The LLM generated question.
10639 pub generated_question: std::string::String,
10640
10641 /// Optional. The question that will be used at serving time.
10642 /// Question can have a max length of 300 bytes.
10643 /// When not populated, generated_question should be used.
10644 pub final_question: std::string::String,
10645
10646 /// Output only. Values that can be used to answer the question.
10647 pub example_values: std::vec::Vec<std::string::String>,
10648
10649 /// Output only. The ratio of how often a question was asked.
10650 pub frequency: f32,
10651
10652 /// Optional. Whether the question is asked at serving time.
10653 pub allowed_in_conversation: bool,
10654
10655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10656}
10657
10658impl GenerativeQuestionConfig {
10659 /// Creates a new default instance.
10660 pub fn new() -> Self {
10661 std::default::Default::default()
10662 }
10663
10664 /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10665 ///
10666 /// # Example
10667 /// ```ignore,no_run
10668 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10669 /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10670 /// ```
10671 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10672 self.catalog = v.into();
10673 self
10674 }
10675
10676 /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10677 ///
10678 /// # Example
10679 /// ```ignore,no_run
10680 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10681 /// let x = GenerativeQuestionConfig::new().set_facet("example");
10682 /// ```
10683 pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10684 self.facet = v.into();
10685 self
10686 }
10687
10688 /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10689 ///
10690 /// # Example
10691 /// ```ignore,no_run
10692 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10693 /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10694 /// ```
10695 pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10696 mut self,
10697 v: T,
10698 ) -> Self {
10699 self.generated_question = v.into();
10700 self
10701 }
10702
10703 /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10704 ///
10705 /// # Example
10706 /// ```ignore,no_run
10707 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10708 /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10709 /// ```
10710 pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10711 self.final_question = v.into();
10712 self
10713 }
10714
10715 /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10716 ///
10717 /// # Example
10718 /// ```ignore,no_run
10719 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10720 /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10721 /// ```
10722 pub fn set_example_values<T, V>(mut self, v: T) -> Self
10723 where
10724 T: std::iter::IntoIterator<Item = V>,
10725 V: std::convert::Into<std::string::String>,
10726 {
10727 use std::iter::Iterator;
10728 self.example_values = v.into_iter().map(|i| i.into()).collect();
10729 self
10730 }
10731
10732 /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10733 ///
10734 /// # Example
10735 /// ```ignore,no_run
10736 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10737 /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10738 /// ```
10739 pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10740 self.frequency = v.into();
10741 self
10742 }
10743
10744 /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10745 ///
10746 /// # Example
10747 /// ```ignore,no_run
10748 /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10749 /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10750 /// ```
10751 pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10752 self.allowed_in_conversation = v.into();
10753 self
10754 }
10755}
10756
10757impl wkt::message::Message for GenerativeQuestionConfig {
10758 fn typename() -> &'static str {
10759 "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10760 }
10761}
10762
10763/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10764#[derive(Clone, Default, PartialEq)]
10765#[non_exhaustive]
10766pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10767 /// Required. The configuration managing the feature state.
10768 pub generative_questions_feature_config:
10769 std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10770
10771 /// Optional. Indicates which fields in the provided
10772 /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10773 /// to update. If not set or empty, all supported fields are updated.
10774 ///
10775 /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10776 pub update_mask: std::option::Option<wkt::FieldMask>,
10777
10778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10779}
10780
10781impl UpdateGenerativeQuestionsFeatureConfigRequest {
10782 /// Creates a new default instance.
10783 pub fn new() -> Self {
10784 std::default::Default::default()
10785 }
10786
10787 /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10788 ///
10789 /// # Example
10790 /// ```ignore,no_run
10791 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10792 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10793 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10794 /// ```
10795 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10796 where
10797 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10798 {
10799 self.generative_questions_feature_config = std::option::Option::Some(v.into());
10800 self
10801 }
10802
10803 /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10808 /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10809 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10810 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10811 /// ```
10812 pub fn set_or_clear_generative_questions_feature_config<T>(
10813 mut self,
10814 v: std::option::Option<T>,
10815 ) -> Self
10816 where
10817 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10818 {
10819 self.generative_questions_feature_config = v.map(|x| x.into());
10820 self
10821 }
10822
10823 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10824 ///
10825 /// # Example
10826 /// ```ignore,no_run
10827 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10828 /// use wkt::FieldMask;
10829 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10830 /// ```
10831 pub fn set_update_mask<T>(mut self, v: T) -> Self
10832 where
10833 T: std::convert::Into<wkt::FieldMask>,
10834 {
10835 self.update_mask = std::option::Option::Some(v.into());
10836 self
10837 }
10838
10839 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10840 ///
10841 /// # Example
10842 /// ```ignore,no_run
10843 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10844 /// use wkt::FieldMask;
10845 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10846 /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10847 /// ```
10848 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10849 where
10850 T: std::convert::Into<wkt::FieldMask>,
10851 {
10852 self.update_mask = v.map(|x| x.into());
10853 self
10854 }
10855}
10856
10857impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10858 fn typename() -> &'static str {
10859 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10860 }
10861}
10862
10863/// Request for GetGenerativeQuestionsFeatureConfig method.
10864#[derive(Clone, Default, PartialEq)]
10865#[non_exhaustive]
10866pub struct GetGenerativeQuestionsFeatureConfigRequest {
10867 /// Required. Resource name of the parent catalog.
10868 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10869 pub catalog: std::string::String,
10870
10871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10872}
10873
10874impl GetGenerativeQuestionsFeatureConfigRequest {
10875 /// Creates a new default instance.
10876 pub fn new() -> Self {
10877 std::default::Default::default()
10878 }
10879
10880 /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10881 ///
10882 /// # Example
10883 /// ```ignore,no_run
10884 /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10885 /// # let project_id = "project_id";
10886 /// # let location_id = "location_id";
10887 /// # let catalog_id = "catalog_id";
10888 /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
10889 /// ```
10890 pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10891 self.catalog = v.into();
10892 self
10893 }
10894}
10895
10896impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10897 fn typename() -> &'static str {
10898 "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10899 }
10900}
10901
10902/// Request for ListQuestions method.
10903#[derive(Clone, Default, PartialEq)]
10904#[non_exhaustive]
10905pub struct ListGenerativeQuestionConfigsRequest {
10906 /// Required. Resource name of the parent catalog.
10907 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10908 pub parent: std::string::String,
10909
10910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10911}
10912
10913impl ListGenerativeQuestionConfigsRequest {
10914 /// Creates a new default instance.
10915 pub fn new() -> Self {
10916 std::default::Default::default()
10917 }
10918
10919 /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10920 ///
10921 /// # Example
10922 /// ```ignore,no_run
10923 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10924 /// # let project_id = "project_id";
10925 /// # let location_id = "location_id";
10926 /// # let catalog_id = "catalog_id";
10927 /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
10928 /// ```
10929 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10930 self.parent = v.into();
10931 self
10932 }
10933}
10934
10935impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10936 fn typename() -> &'static str {
10937 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10938 }
10939}
10940
10941/// Response for ListQuestions method.
10942#[derive(Clone, Default, PartialEq)]
10943#[non_exhaustive]
10944pub struct ListGenerativeQuestionConfigsResponse {
10945 /// All the questions for a given catalog.
10946 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10947
10948 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10949}
10950
10951impl ListGenerativeQuestionConfigsResponse {
10952 /// Creates a new default instance.
10953 pub fn new() -> Self {
10954 std::default::Default::default()
10955 }
10956
10957 /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10958 ///
10959 /// # Example
10960 /// ```ignore,no_run
10961 /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10962 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10963 /// let x = ListGenerativeQuestionConfigsResponse::new()
10964 /// .set_generative_question_configs([
10965 /// GenerativeQuestionConfig::default()/* use setters */,
10966 /// GenerativeQuestionConfig::default()/* use (different) setters */,
10967 /// ]);
10968 /// ```
10969 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10970 where
10971 T: std::iter::IntoIterator<Item = V>,
10972 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10973 {
10974 use std::iter::Iterator;
10975 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10976 self
10977 }
10978}
10979
10980impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10981 fn typename() -> &'static str {
10982 "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10983 }
10984}
10985
10986/// Request for UpdateGenerativeQuestionConfig method.
10987#[derive(Clone, Default, PartialEq)]
10988#[non_exhaustive]
10989pub struct UpdateGenerativeQuestionConfigRequest {
10990 /// Required. The question to update.
10991 pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10992
10993 /// Optional. Indicates which fields in the provided
10994 /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10995 /// to update. The following are NOT supported:
10996 ///
10997 /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
10998 ///
10999 /// If not set or empty, all supported fields are updated.
11000 ///
11001 /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
11002 /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
11003 pub update_mask: std::option::Option<wkt::FieldMask>,
11004
11005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11006}
11007
11008impl UpdateGenerativeQuestionConfigRequest {
11009 /// Creates a new default instance.
11010 pub fn new() -> Self {
11011 std::default::Default::default()
11012 }
11013
11014 /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
11015 ///
11016 /// # Example
11017 /// ```ignore,no_run
11018 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11019 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11020 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
11021 /// ```
11022 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
11023 where
11024 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11025 {
11026 self.generative_question_config = std::option::Option::Some(v.into());
11027 self
11028 }
11029
11030 /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
11031 ///
11032 /// # Example
11033 /// ```ignore,no_run
11034 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11035 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11036 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
11037 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
11038 /// ```
11039 pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
11040 where
11041 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11042 {
11043 self.generative_question_config = v.map(|x| x.into());
11044 self
11045 }
11046
11047 /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
11048 ///
11049 /// # Example
11050 /// ```ignore,no_run
11051 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11052 /// use wkt::FieldMask;
11053 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11054 /// ```
11055 pub fn set_update_mask<T>(mut self, v: T) -> Self
11056 where
11057 T: std::convert::Into<wkt::FieldMask>,
11058 {
11059 self.update_mask = std::option::Option::Some(v.into());
11060 self
11061 }
11062
11063 /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
11064 ///
11065 /// # Example
11066 /// ```ignore,no_run
11067 /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11068 /// use wkt::FieldMask;
11069 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11070 /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11071 /// ```
11072 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11073 where
11074 T: std::convert::Into<wkt::FieldMask>,
11075 {
11076 self.update_mask = v.map(|x| x.into());
11077 self
11078 }
11079}
11080
11081impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
11082 fn typename() -> &'static str {
11083 "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
11084 }
11085}
11086
11087/// Request for BatchUpdateGenerativeQuestionConfig method.
11088#[derive(Clone, Default, PartialEq)]
11089#[non_exhaustive]
11090pub struct BatchUpdateGenerativeQuestionConfigsRequest {
11091 /// Optional. Resource name of the parent catalog.
11092 /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
11093 pub parent: std::string::String,
11094
11095 /// Required. The updates question configs.
11096 pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
11097
11098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11099}
11100
11101impl BatchUpdateGenerativeQuestionConfigsRequest {
11102 /// Creates a new default instance.
11103 pub fn new() -> Self {
11104 std::default::Default::default()
11105 }
11106
11107 /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
11108 ///
11109 /// # Example
11110 /// ```ignore,no_run
11111 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11112 /// # let project_id = "project_id";
11113 /// # let location_id = "location_id";
11114 /// # let catalog_id = "catalog_id";
11115 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
11116 /// ```
11117 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11118 self.parent = v.into();
11119 self
11120 }
11121
11122 /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
11123 ///
11124 /// # Example
11125 /// ```ignore,no_run
11126 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11127 /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11128 /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
11129 /// .set_requests([
11130 /// UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
11131 /// UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
11132 /// ]);
11133 /// ```
11134 pub fn set_requests<T, V>(mut self, v: T) -> Self
11135 where
11136 T: std::iter::IntoIterator<Item = V>,
11137 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
11138 {
11139 use std::iter::Iterator;
11140 self.requests = v.into_iter().map(|i| i.into()).collect();
11141 self
11142 }
11143}
11144
11145impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
11146 fn typename() -> &'static str {
11147 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
11148 }
11149}
11150
11151/// Aggregated response for UpdateGenerativeQuestionConfig method.
11152#[derive(Clone, Default, PartialEq)]
11153#[non_exhaustive]
11154pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11155 /// Optional. The updates question configs.
11156 pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11157
11158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11159}
11160
11161impl BatchUpdateGenerativeQuestionConfigsResponse {
11162 /// Creates a new default instance.
11163 pub fn new() -> Self {
11164 std::default::Default::default()
11165 }
11166
11167 /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11168 ///
11169 /// # Example
11170 /// ```ignore,no_run
11171 /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11172 /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11173 /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11174 /// .set_generative_question_configs([
11175 /// GenerativeQuestionConfig::default()/* use setters */,
11176 /// GenerativeQuestionConfig::default()/* use (different) setters */,
11177 /// ]);
11178 /// ```
11179 pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11180 where
11181 T: std::iter::IntoIterator<Item = V>,
11182 V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11183 {
11184 use std::iter::Iterator;
11185 self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11186 self
11187 }
11188}
11189
11190impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11191 fn typename() -> &'static str {
11192 "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11193 }
11194}
11195
11196/// Google Cloud Storage location for input content.
11197#[derive(Clone, Default, PartialEq)]
11198#[non_exhaustive]
11199pub struct GcsSource {
11200 /// Required. Google Cloud Storage URIs to input files. URI can be up to
11201 /// 2000 characters long. URIs can match the full object path (for example,
11202 /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11203 /// files, such as `gs://bucket/directory/*.json`. A request can
11204 /// contain at most 100 files, and each file can be up to 2 GB. See
11205 /// [Importing product
11206 /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11207 /// for the expected file format and setup instructions.
11208 pub input_uris: std::vec::Vec<std::string::String>,
11209
11210 /// The schema to use when parsing the data from the source.
11211 ///
11212 /// Supported values for product imports:
11213 ///
11214 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11215 /// per line. Each product must
11216 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11217 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11218 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11219 ///
11220 /// Supported values for user events imports:
11221 ///
11222 /// * `user_event` (default): One JSON
11223 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11224 /// * `user_event_ga360`: Using
11225 /// <https://support.google.com/analytics/answer/3437719>.
11226 ///
11227 /// Supported values for control imports:
11228 ///
11229 /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11230 /// per line.
11231 ///
11232 /// Supported values for catalog attribute imports:
11233 ///
11234 /// * `catalog_attribute` (default): One CSV
11235 /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11236 ///
11237 /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11238 /// [google.cloud.retail.v2.Control]: crate::model::Control
11239 /// [google.cloud.retail.v2.Product]: crate::model::Product
11240 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11241 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11242 pub data_schema: std::string::String,
11243
11244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11245}
11246
11247impl GcsSource {
11248 /// Creates a new default instance.
11249 pub fn new() -> Self {
11250 std::default::Default::default()
11251 }
11252
11253 /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11254 ///
11255 /// # Example
11256 /// ```ignore,no_run
11257 /// # use google_cloud_retail_v2::model::GcsSource;
11258 /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11259 /// ```
11260 pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11261 where
11262 T: std::iter::IntoIterator<Item = V>,
11263 V: std::convert::Into<std::string::String>,
11264 {
11265 use std::iter::Iterator;
11266 self.input_uris = v.into_iter().map(|i| i.into()).collect();
11267 self
11268 }
11269
11270 /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11271 ///
11272 /// # Example
11273 /// ```ignore,no_run
11274 /// # use google_cloud_retail_v2::model::GcsSource;
11275 /// let x = GcsSource::new().set_data_schema("example");
11276 /// ```
11277 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11278 self.data_schema = v.into();
11279 self
11280 }
11281}
11282
11283impl wkt::message::Message for GcsSource {
11284 fn typename() -> &'static str {
11285 "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11286 }
11287}
11288
11289/// BigQuery source import data from.
11290#[derive(Clone, Default, PartialEq)]
11291#[non_exhaustive]
11292pub struct BigQuerySource {
11293 /// The project ID (can be project # or ID) that the BigQuery source is in with
11294 /// a length limit of 128 characters. If not specified, inherits the project
11295 /// ID from the parent request.
11296 pub project_id: std::string::String,
11297
11298 /// Required. The BigQuery data set to copy the data from with a length limit
11299 /// of 1,024 characters.
11300 pub dataset_id: std::string::String,
11301
11302 /// Required. The BigQuery table to copy the data from with a length limit of
11303 /// 1,024 characters.
11304 pub table_id: std::string::String,
11305
11306 /// Intermediate Cloud Storage directory used for the import with a length
11307 /// limit of 2,000 characters. Can be specified if one wants to have the
11308 /// BigQuery export to a specific Cloud Storage directory.
11309 pub gcs_staging_dir: std::string::String,
11310
11311 /// The schema to use when parsing the data from the source.
11312 ///
11313 /// Supported values for product imports:
11314 ///
11315 /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11316 /// per line. Each product must
11317 /// have a valid [Product.id][google.cloud.retail.v2.Product.id].
11318 /// * `product_merchant_center`: See [Importing catalog data from Merchant
11319 /// Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11320 ///
11321 /// Supported values for user events imports:
11322 ///
11323 /// * `user_event` (default): One JSON
11324 /// [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11325 /// * `user_event_ga360`:
11326 /// The schema is available here:
11327 /// <https://support.google.com/analytics/answer/3437719>.
11328 /// * `user_event_ga4`:
11329 /// The schema is available here:
11330 /// <https://support.google.com/analytics/answer/7029846>.
11331 ///
11332 /// Supported values for autocomplete imports:
11333 ///
11334 /// * `suggestions` (default): One JSON completion suggestion per line.
11335 /// * `denylist`: One JSON deny suggestion per line.
11336 /// * `allowlist`: One JSON allow suggestion per line.
11337 ///
11338 /// [google.cloud.retail.v2.Product]: crate::model::Product
11339 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11340 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11341 pub data_schema: std::string::String,
11342
11343 /// BigQuery table partition info. Leave this empty if the BigQuery table
11344 /// is not partitioned.
11345 pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11346
11347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11348}
11349
11350impl BigQuerySource {
11351 /// Creates a new default instance.
11352 pub fn new() -> Self {
11353 std::default::Default::default()
11354 }
11355
11356 /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11357 ///
11358 /// # Example
11359 /// ```ignore,no_run
11360 /// # use google_cloud_retail_v2::model::BigQuerySource;
11361 /// let x = BigQuerySource::new().set_project_id("example");
11362 /// ```
11363 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11364 self.project_id = v.into();
11365 self
11366 }
11367
11368 /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11369 ///
11370 /// # Example
11371 /// ```ignore,no_run
11372 /// # use google_cloud_retail_v2::model::BigQuerySource;
11373 /// let x = BigQuerySource::new().set_dataset_id("example");
11374 /// ```
11375 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11376 self.dataset_id = v.into();
11377 self
11378 }
11379
11380 /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11381 ///
11382 /// # Example
11383 /// ```ignore,no_run
11384 /// # use google_cloud_retail_v2::model::BigQuerySource;
11385 /// let x = BigQuerySource::new().set_table_id("example");
11386 /// ```
11387 pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11388 self.table_id = v.into();
11389 self
11390 }
11391
11392 /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11393 ///
11394 /// # Example
11395 /// ```ignore,no_run
11396 /// # use google_cloud_retail_v2::model::BigQuerySource;
11397 /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11398 /// ```
11399 pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11400 self.gcs_staging_dir = v.into();
11401 self
11402 }
11403
11404 /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11405 ///
11406 /// # Example
11407 /// ```ignore,no_run
11408 /// # use google_cloud_retail_v2::model::BigQuerySource;
11409 /// let x = BigQuerySource::new().set_data_schema("example");
11410 /// ```
11411 pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11412 self.data_schema = v.into();
11413 self
11414 }
11415
11416 /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11417 ///
11418 /// Note that all the setters affecting `partition` are mutually
11419 /// exclusive.
11420 ///
11421 /// # Example
11422 /// ```ignore,no_run
11423 /// # use google_cloud_retail_v2::model::BigQuerySource;
11424 /// use google_cloud_type::model::Date;
11425 /// let x = BigQuerySource::new().set_partition(Some(
11426 /// google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11427 /// ```
11428 pub fn set_partition<
11429 T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11430 >(
11431 mut self,
11432 v: T,
11433 ) -> Self {
11434 self.partition = v.into();
11435 self
11436 }
11437
11438 /// The value of [partition][crate::model::BigQuerySource::partition]
11439 /// if it holds a `PartitionDate`, `None` if the field is not set or
11440 /// holds a different branch.
11441 pub fn partition_date(
11442 &self,
11443 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
11444 #[allow(unreachable_patterns)]
11445 self.partition.as_ref().and_then(|v| match v {
11446 crate::model::big_query_source::Partition::PartitionDate(v) => {
11447 std::option::Option::Some(v)
11448 }
11449 _ => std::option::Option::None,
11450 })
11451 }
11452
11453 /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11454 /// to hold a `PartitionDate`.
11455 ///
11456 /// Note that all the setters affecting `partition` are
11457 /// mutually exclusive.
11458 ///
11459 /// # Example
11460 /// ```ignore,no_run
11461 /// # use google_cloud_retail_v2::model::BigQuerySource;
11462 /// use google_cloud_type::model::Date;
11463 /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11464 /// assert!(x.partition_date().is_some());
11465 /// ```
11466 pub fn set_partition_date<
11467 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
11468 >(
11469 mut self,
11470 v: T,
11471 ) -> Self {
11472 self.partition = std::option::Option::Some(
11473 crate::model::big_query_source::Partition::PartitionDate(v.into()),
11474 );
11475 self
11476 }
11477}
11478
11479impl wkt::message::Message for BigQuerySource {
11480 fn typename() -> &'static str {
11481 "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11482 }
11483}
11484
11485/// Defines additional types related to [BigQuerySource].
11486pub mod big_query_source {
11487 #[allow(unused_imports)]
11488 use super::*;
11489
11490 /// BigQuery table partition info. Leave this empty if the BigQuery table
11491 /// is not partitioned.
11492 #[derive(Clone, Debug, PartialEq)]
11493 #[non_exhaustive]
11494 pub enum Partition {
11495 /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11496 PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
11497 }
11498}
11499
11500/// The inline source for the input config for ImportProducts method.
11501#[derive(Clone, Default, PartialEq)]
11502#[non_exhaustive]
11503pub struct ProductInlineSource {
11504 /// Required. A list of products to update/create. Each product must have a
11505 /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11506 /// 100 items.
11507 ///
11508 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11509 pub products: std::vec::Vec<crate::model::Product>,
11510
11511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11512}
11513
11514impl ProductInlineSource {
11515 /// Creates a new default instance.
11516 pub fn new() -> Self {
11517 std::default::Default::default()
11518 }
11519
11520 /// Sets the value of [products][crate::model::ProductInlineSource::products].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_cloud_retail_v2::model::ProductInlineSource;
11525 /// use google_cloud_retail_v2::model::Product;
11526 /// let x = ProductInlineSource::new()
11527 /// .set_products([
11528 /// Product::default()/* use setters */,
11529 /// Product::default()/* use (different) setters */,
11530 /// ]);
11531 /// ```
11532 pub fn set_products<T, V>(mut self, v: T) -> Self
11533 where
11534 T: std::iter::IntoIterator<Item = V>,
11535 V: std::convert::Into<crate::model::Product>,
11536 {
11537 use std::iter::Iterator;
11538 self.products = v.into_iter().map(|i| i.into()).collect();
11539 self
11540 }
11541}
11542
11543impl wkt::message::Message for ProductInlineSource {
11544 fn typename() -> &'static str {
11545 "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11546 }
11547}
11548
11549/// The inline source for the input config for ImportUserEvents method.
11550#[derive(Clone, Default, PartialEq)]
11551#[non_exhaustive]
11552pub struct UserEventInlineSource {
11553 /// Required. A list of user events to import. Recommended max of 10k items.
11554 pub user_events: std::vec::Vec<crate::model::UserEvent>,
11555
11556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11557}
11558
11559impl UserEventInlineSource {
11560 /// Creates a new default instance.
11561 pub fn new() -> Self {
11562 std::default::Default::default()
11563 }
11564
11565 /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11566 ///
11567 /// # Example
11568 /// ```ignore,no_run
11569 /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11570 /// use google_cloud_retail_v2::model::UserEvent;
11571 /// let x = UserEventInlineSource::new()
11572 /// .set_user_events([
11573 /// UserEvent::default()/* use setters */,
11574 /// UserEvent::default()/* use (different) setters */,
11575 /// ]);
11576 /// ```
11577 pub fn set_user_events<T, V>(mut self, v: T) -> Self
11578 where
11579 T: std::iter::IntoIterator<Item = V>,
11580 V: std::convert::Into<crate::model::UserEvent>,
11581 {
11582 use std::iter::Iterator;
11583 self.user_events = v.into_iter().map(|i| i.into()).collect();
11584 self
11585 }
11586}
11587
11588impl wkt::message::Message for UserEventInlineSource {
11589 fn typename() -> &'static str {
11590 "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11591 }
11592}
11593
11594/// Configuration of destination for Import related errors.
11595#[derive(Clone, Default, PartialEq)]
11596#[non_exhaustive]
11597pub struct ImportErrorsConfig {
11598 /// Required. Errors destination.
11599 pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11600
11601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11602}
11603
11604impl ImportErrorsConfig {
11605 /// Creates a new default instance.
11606 pub fn new() -> Self {
11607 std::default::Default::default()
11608 }
11609
11610 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11611 ///
11612 /// Note that all the setters affecting `destination` are mutually
11613 /// exclusive.
11614 ///
11615 /// # Example
11616 /// ```ignore,no_run
11617 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11618 /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11619 /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11620 /// ```
11621 pub fn set_destination<
11622 T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11623 >(
11624 mut self,
11625 v: T,
11626 ) -> Self {
11627 self.destination = v.into();
11628 self
11629 }
11630
11631 /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11632 /// if it holds a `GcsPrefix`, `None` if the field is not set or
11633 /// holds a different branch.
11634 pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11635 #[allow(unreachable_patterns)]
11636 self.destination.as_ref().and_then(|v| match v {
11637 crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11638 std::option::Option::Some(v)
11639 }
11640 _ => std::option::Option::None,
11641 })
11642 }
11643
11644 /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11645 /// to hold a `GcsPrefix`.
11646 ///
11647 /// Note that all the setters affecting `destination` are
11648 /// mutually exclusive.
11649 ///
11650 /// # Example
11651 /// ```ignore,no_run
11652 /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11653 /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11654 /// assert!(x.gcs_prefix().is_some());
11655 /// ```
11656 pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11657 self.destination = std::option::Option::Some(
11658 crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11659 );
11660 self
11661 }
11662}
11663
11664impl wkt::message::Message for ImportErrorsConfig {
11665 fn typename() -> &'static str {
11666 "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11667 }
11668}
11669
11670/// Defines additional types related to [ImportErrorsConfig].
11671pub mod import_errors_config {
11672 #[allow(unused_imports)]
11673 use super::*;
11674
11675 /// Required. Errors destination.
11676 #[derive(Clone, Debug, PartialEq)]
11677 #[non_exhaustive]
11678 pub enum Destination {
11679 /// Google Cloud Storage prefix for import errors. This must be an empty,
11680 /// existing Cloud Storage directory. Import errors are written to
11681 /// sharded files in this directory, one per line, as a JSON-encoded
11682 /// `google.rpc.Status` message.
11683 GcsPrefix(std::string::String),
11684 }
11685}
11686
11687/// Request message for Import methods.
11688#[derive(Clone, Default, PartialEq)]
11689#[non_exhaustive]
11690pub struct ImportProductsRequest {
11691 /// Required.
11692 /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11693 ///
11694 /// If no updateMask is specified, requires products.create permission.
11695 /// If updateMask is specified, requires products.update permission.
11696 pub parent: std::string::String,
11697
11698 /// Deprecated. This field has no effect.
11699 #[deprecated]
11700 pub request_id: std::string::String,
11701
11702 /// Required. The desired input location of the data.
11703 pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11704
11705 /// The desired location of errors incurred during the Import.
11706 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11707
11708 /// Indicates which fields in the provided imported `products` to update. If
11709 /// not set, all fields are updated. If provided, only the existing product
11710 /// fields are updated. Missing products will not be created.
11711 pub update_mask: std::option::Option<wkt::FieldMask>,
11712
11713 /// The mode of reconciliation between existing products and the products to be
11714 /// imported. Defaults to
11715 /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11716 ///
11717 /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11718 pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11719
11720 /// Full Pub/Sub topic name for receiving notification. If this field is set,
11721 /// when the import is finished, a notification is sent to
11722 /// specified Pub/Sub topic. The message data is JSON string of a
11723 /// [Operation][google.longrunning.Operation].
11724 ///
11725 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11726 /// to be within the same project as
11727 /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11728 /// Make sure that both
11729 /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11730 /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11731 /// have the `pubsub.topics.publish` IAM permission on the topic.
11732 ///
11733 /// Only supported when
11734 /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11735 /// is set to `FULL`.
11736 ///
11737 /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11738 /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11739 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
11740 pub notification_pubsub_topic: std::string::String,
11741
11742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11743}
11744
11745impl ImportProductsRequest {
11746 /// Creates a new default instance.
11747 pub fn new() -> Self {
11748 std::default::Default::default()
11749 }
11750
11751 /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11752 ///
11753 /// # Example
11754 /// ```ignore,no_run
11755 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11756 /// let x = ImportProductsRequest::new().set_parent("example");
11757 /// ```
11758 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11759 self.parent = v.into();
11760 self
11761 }
11762
11763 /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11764 ///
11765 /// # Example
11766 /// ```ignore,no_run
11767 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11768 /// let x = ImportProductsRequest::new().set_request_id("example");
11769 /// ```
11770 #[deprecated]
11771 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11772 self.request_id = v.into();
11773 self
11774 }
11775
11776 /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11777 ///
11778 /// # Example
11779 /// ```ignore,no_run
11780 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11781 /// use google_cloud_retail_v2::model::ProductInputConfig;
11782 /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11783 /// ```
11784 pub fn set_input_config<T>(mut self, v: T) -> Self
11785 where
11786 T: std::convert::Into<crate::model::ProductInputConfig>,
11787 {
11788 self.input_config = std::option::Option::Some(v.into());
11789 self
11790 }
11791
11792 /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11793 ///
11794 /// # Example
11795 /// ```ignore,no_run
11796 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11797 /// use google_cloud_retail_v2::model::ProductInputConfig;
11798 /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11799 /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11800 /// ```
11801 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11802 where
11803 T: std::convert::Into<crate::model::ProductInputConfig>,
11804 {
11805 self.input_config = v.map(|x| x.into());
11806 self
11807 }
11808
11809 /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11810 ///
11811 /// # Example
11812 /// ```ignore,no_run
11813 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11814 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11815 /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11816 /// ```
11817 pub fn set_errors_config<T>(mut self, v: T) -> Self
11818 where
11819 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11820 {
11821 self.errors_config = std::option::Option::Some(v.into());
11822 self
11823 }
11824
11825 /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11826 ///
11827 /// # Example
11828 /// ```ignore,no_run
11829 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11830 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11831 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11832 /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11833 /// ```
11834 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11835 where
11836 T: std::convert::Into<crate::model::ImportErrorsConfig>,
11837 {
11838 self.errors_config = v.map(|x| x.into());
11839 self
11840 }
11841
11842 /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11843 ///
11844 /// # Example
11845 /// ```ignore,no_run
11846 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11847 /// use wkt::FieldMask;
11848 /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11849 /// ```
11850 pub fn set_update_mask<T>(mut self, v: T) -> Self
11851 where
11852 T: std::convert::Into<wkt::FieldMask>,
11853 {
11854 self.update_mask = std::option::Option::Some(v.into());
11855 self
11856 }
11857
11858 /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11859 ///
11860 /// # Example
11861 /// ```ignore,no_run
11862 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11863 /// use wkt::FieldMask;
11864 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11865 /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11866 /// ```
11867 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11868 where
11869 T: std::convert::Into<wkt::FieldMask>,
11870 {
11871 self.update_mask = v.map(|x| x.into());
11872 self
11873 }
11874
11875 /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11876 ///
11877 /// # Example
11878 /// ```ignore,no_run
11879 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11880 /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11881 /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11882 /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11883 /// ```
11884 pub fn set_reconciliation_mode<
11885 T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11886 >(
11887 mut self,
11888 v: T,
11889 ) -> Self {
11890 self.reconciliation_mode = v.into();
11891 self
11892 }
11893
11894 /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11895 ///
11896 /// # Example
11897 /// ```ignore,no_run
11898 /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11899 /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11900 /// ```
11901 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11902 mut self,
11903 v: T,
11904 ) -> Self {
11905 self.notification_pubsub_topic = v.into();
11906 self
11907 }
11908}
11909
11910impl wkt::message::Message for ImportProductsRequest {
11911 fn typename() -> &'static str {
11912 "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11913 }
11914}
11915
11916/// Defines additional types related to [ImportProductsRequest].
11917pub mod import_products_request {
11918 #[allow(unused_imports)]
11919 use super::*;
11920
11921 /// Indicates how imported products are reconciled with the existing products
11922 /// created or imported before.
11923 ///
11924 /// # Working with unknown values
11925 ///
11926 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11927 /// additional enum variants at any time. Adding new variants is not considered
11928 /// a breaking change. Applications should write their code in anticipation of:
11929 ///
11930 /// - New values appearing in future releases of the client library, **and**
11931 /// - New values received dynamically, without application changes.
11932 ///
11933 /// Please consult the [Working with enums] section in the user guide for some
11934 /// guidelines.
11935 ///
11936 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11937 #[derive(Clone, Debug, PartialEq)]
11938 #[non_exhaustive]
11939 pub enum ReconciliationMode {
11940 /// Defaults to INCREMENTAL.
11941 Unspecified,
11942 /// Inserts new products or updates existing products.
11943 Incremental,
11944 /// Calculates diff and replaces the entire product dataset. Existing
11945 /// products may be deleted if they are not present in the source location.
11946 Full,
11947 /// If set, the enum was initialized with an unknown value.
11948 ///
11949 /// Applications can examine the value using [ReconciliationMode::value] or
11950 /// [ReconciliationMode::name].
11951 UnknownValue(reconciliation_mode::UnknownValue),
11952 }
11953
11954 #[doc(hidden)]
11955 pub mod reconciliation_mode {
11956 #[allow(unused_imports)]
11957 use super::*;
11958 #[derive(Clone, Debug, PartialEq)]
11959 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11960 }
11961
11962 impl ReconciliationMode {
11963 /// Gets the enum value.
11964 ///
11965 /// Returns `None` if the enum contains an unknown value deserialized from
11966 /// the string representation of enums.
11967 pub fn value(&self) -> std::option::Option<i32> {
11968 match self {
11969 Self::Unspecified => std::option::Option::Some(0),
11970 Self::Incremental => std::option::Option::Some(1),
11971 Self::Full => std::option::Option::Some(2),
11972 Self::UnknownValue(u) => u.0.value(),
11973 }
11974 }
11975
11976 /// Gets the enum value as a string.
11977 ///
11978 /// Returns `None` if the enum contains an unknown value deserialized from
11979 /// the integer representation of enums.
11980 pub fn name(&self) -> std::option::Option<&str> {
11981 match self {
11982 Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11983 Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11984 Self::Full => std::option::Option::Some("FULL"),
11985 Self::UnknownValue(u) => u.0.name(),
11986 }
11987 }
11988 }
11989
11990 impl std::default::Default for ReconciliationMode {
11991 fn default() -> Self {
11992 use std::convert::From;
11993 Self::from(0)
11994 }
11995 }
11996
11997 impl std::fmt::Display for ReconciliationMode {
11998 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11999 wkt::internal::display_enum(f, self.name(), self.value())
12000 }
12001 }
12002
12003 impl std::convert::From<i32> for ReconciliationMode {
12004 fn from(value: i32) -> Self {
12005 match value {
12006 0 => Self::Unspecified,
12007 1 => Self::Incremental,
12008 2 => Self::Full,
12009 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
12010 wkt::internal::UnknownEnumValue::Integer(value),
12011 )),
12012 }
12013 }
12014 }
12015
12016 impl std::convert::From<&str> for ReconciliationMode {
12017 fn from(value: &str) -> Self {
12018 use std::string::ToString;
12019 match value {
12020 "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
12021 "INCREMENTAL" => Self::Incremental,
12022 "FULL" => Self::Full,
12023 _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
12024 wkt::internal::UnknownEnumValue::String(value.to_string()),
12025 )),
12026 }
12027 }
12028 }
12029
12030 impl serde::ser::Serialize for ReconciliationMode {
12031 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12032 where
12033 S: serde::Serializer,
12034 {
12035 match self {
12036 Self::Unspecified => serializer.serialize_i32(0),
12037 Self::Incremental => serializer.serialize_i32(1),
12038 Self::Full => serializer.serialize_i32(2),
12039 Self::UnknownValue(u) => u.0.serialize(serializer),
12040 }
12041 }
12042 }
12043
12044 impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
12045 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12046 where
12047 D: serde::Deserializer<'de>,
12048 {
12049 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
12050 ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
12051 ))
12052 }
12053 }
12054}
12055
12056/// Request message for the ImportUserEvents request.
12057#[derive(Clone, Default, PartialEq)]
12058#[non_exhaustive]
12059pub struct ImportUserEventsRequest {
12060 /// Required. `projects/1234/locations/global/catalogs/default_catalog`
12061 pub parent: std::string::String,
12062
12063 /// Required. The desired input location of the data.
12064 pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
12065
12066 /// The desired location of errors incurred during the Import. Cannot be set
12067 /// for inline user event imports.
12068 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12069
12070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12071}
12072
12073impl ImportUserEventsRequest {
12074 /// Creates a new default instance.
12075 pub fn new() -> Self {
12076 std::default::Default::default()
12077 }
12078
12079 /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
12080 ///
12081 /// # Example
12082 /// ```ignore,no_run
12083 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12084 /// # let project_id = "project_id";
12085 /// # let location_id = "location_id";
12086 /// # let catalog_id = "catalog_id";
12087 /// let x = ImportUserEventsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
12088 /// ```
12089 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12090 self.parent = v.into();
12091 self
12092 }
12093
12094 /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12095 ///
12096 /// # Example
12097 /// ```ignore,no_run
12098 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12099 /// use google_cloud_retail_v2::model::UserEventInputConfig;
12100 /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
12101 /// ```
12102 pub fn set_input_config<T>(mut self, v: T) -> Self
12103 where
12104 T: std::convert::Into<crate::model::UserEventInputConfig>,
12105 {
12106 self.input_config = std::option::Option::Some(v.into());
12107 self
12108 }
12109
12110 /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12111 ///
12112 /// # Example
12113 /// ```ignore,no_run
12114 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12115 /// use google_cloud_retail_v2::model::UserEventInputConfig;
12116 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
12117 /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
12118 /// ```
12119 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12120 where
12121 T: std::convert::Into<crate::model::UserEventInputConfig>,
12122 {
12123 self.input_config = v.map(|x| x.into());
12124 self
12125 }
12126
12127 /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12128 ///
12129 /// # Example
12130 /// ```ignore,no_run
12131 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12132 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12133 /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12134 /// ```
12135 pub fn set_errors_config<T>(mut self, v: T) -> Self
12136 where
12137 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12138 {
12139 self.errors_config = std::option::Option::Some(v.into());
12140 self
12141 }
12142
12143 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12144 ///
12145 /// # Example
12146 /// ```ignore,no_run
12147 /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12148 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12149 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12150 /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12151 /// ```
12152 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12153 where
12154 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12155 {
12156 self.errors_config = v.map(|x| x.into());
12157 self
12158 }
12159}
12160
12161impl wkt::message::Message for ImportUserEventsRequest {
12162 fn typename() -> &'static str {
12163 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
12164 }
12165}
12166
12167/// Request message for ImportCompletionData methods.
12168#[derive(Clone, Default, PartialEq)]
12169#[non_exhaustive]
12170pub struct ImportCompletionDataRequest {
12171 /// Required. The catalog which the suggestions dataset belongs to.
12172 ///
12173 /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12174 pub parent: std::string::String,
12175
12176 /// Required. The desired input location of the data.
12177 pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12178
12179 /// Pub/Sub topic for receiving notification. If this field is set,
12180 /// when the import is finished, a notification is sent to
12181 /// specified Pub/Sub topic. The message data is JSON string of a
12182 /// [Operation][google.longrunning.Operation].
12183 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12184 ///
12185 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12186 pub notification_pubsub_topic: std::string::String,
12187
12188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12189}
12190
12191impl ImportCompletionDataRequest {
12192 /// Creates a new default instance.
12193 pub fn new() -> Self {
12194 std::default::Default::default()
12195 }
12196
12197 /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12198 ///
12199 /// # Example
12200 /// ```ignore,no_run
12201 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12202 /// # let project_id = "project_id";
12203 /// # let location_id = "location_id";
12204 /// # let catalog_id = "catalog_id";
12205 /// let x = ImportCompletionDataRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
12206 /// ```
12207 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12208 self.parent = v.into();
12209 self
12210 }
12211
12212 /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12213 ///
12214 /// # Example
12215 /// ```ignore,no_run
12216 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12217 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12218 /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12219 /// ```
12220 pub fn set_input_config<T>(mut self, v: T) -> Self
12221 where
12222 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12223 {
12224 self.input_config = std::option::Option::Some(v.into());
12225 self
12226 }
12227
12228 /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12229 ///
12230 /// # Example
12231 /// ```ignore,no_run
12232 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12233 /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12234 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12235 /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12236 /// ```
12237 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12238 where
12239 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12240 {
12241 self.input_config = v.map(|x| x.into());
12242 self
12243 }
12244
12245 /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12246 ///
12247 /// # Example
12248 /// ```ignore,no_run
12249 /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12250 /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12251 /// ```
12252 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12253 mut self,
12254 v: T,
12255 ) -> Self {
12256 self.notification_pubsub_topic = v.into();
12257 self
12258 }
12259}
12260
12261impl wkt::message::Message for ImportCompletionDataRequest {
12262 fn typename() -> &'static str {
12263 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12264 }
12265}
12266
12267/// The input config source for products.
12268#[derive(Clone, Default, PartialEq)]
12269#[non_exhaustive]
12270pub struct ProductInputConfig {
12271 /// Required. The source of the input.
12272 pub source: std::option::Option<crate::model::product_input_config::Source>,
12273
12274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12275}
12276
12277impl ProductInputConfig {
12278 /// Creates a new default instance.
12279 pub fn new() -> Self {
12280 std::default::Default::default()
12281 }
12282
12283 /// Sets the value of [source][crate::model::ProductInputConfig::source].
12284 ///
12285 /// Note that all the setters affecting `source` are mutually
12286 /// exclusive.
12287 ///
12288 /// # Example
12289 /// ```ignore,no_run
12290 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12291 /// use google_cloud_retail_v2::model::ProductInlineSource;
12292 /// let x = ProductInputConfig::new().set_source(Some(
12293 /// google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12294 /// ```
12295 pub fn set_source<
12296 T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12297 >(
12298 mut self,
12299 v: T,
12300 ) -> Self {
12301 self.source = v.into();
12302 self
12303 }
12304
12305 /// The value of [source][crate::model::ProductInputConfig::source]
12306 /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12307 /// holds a different branch.
12308 pub fn product_inline_source(
12309 &self,
12310 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12311 #[allow(unreachable_patterns)]
12312 self.source.as_ref().and_then(|v| match v {
12313 crate::model::product_input_config::Source::ProductInlineSource(v) => {
12314 std::option::Option::Some(v)
12315 }
12316 _ => std::option::Option::None,
12317 })
12318 }
12319
12320 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12321 /// to hold a `ProductInlineSource`.
12322 ///
12323 /// Note that all the setters affecting `source` are
12324 /// mutually exclusive.
12325 ///
12326 /// # Example
12327 /// ```ignore,no_run
12328 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12329 /// use google_cloud_retail_v2::model::ProductInlineSource;
12330 /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12331 /// assert!(x.product_inline_source().is_some());
12332 /// assert!(x.gcs_source().is_none());
12333 /// assert!(x.big_query_source().is_none());
12334 /// ```
12335 pub fn set_product_inline_source<
12336 T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12337 >(
12338 mut self,
12339 v: T,
12340 ) -> Self {
12341 self.source = std::option::Option::Some(
12342 crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12343 );
12344 self
12345 }
12346
12347 /// The value of [source][crate::model::ProductInputConfig::source]
12348 /// if it holds a `GcsSource`, `None` if the field is not set or
12349 /// holds a different branch.
12350 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12351 #[allow(unreachable_patterns)]
12352 self.source.as_ref().and_then(|v| match v {
12353 crate::model::product_input_config::Source::GcsSource(v) => {
12354 std::option::Option::Some(v)
12355 }
12356 _ => std::option::Option::None,
12357 })
12358 }
12359
12360 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12361 /// to hold a `GcsSource`.
12362 ///
12363 /// Note that all the setters affecting `source` are
12364 /// mutually exclusive.
12365 ///
12366 /// # Example
12367 /// ```ignore,no_run
12368 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12369 /// use google_cloud_retail_v2::model::GcsSource;
12370 /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12371 /// assert!(x.gcs_source().is_some());
12372 /// assert!(x.product_inline_source().is_none());
12373 /// assert!(x.big_query_source().is_none());
12374 /// ```
12375 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12376 mut self,
12377 v: T,
12378 ) -> Self {
12379 self.source = std::option::Option::Some(
12380 crate::model::product_input_config::Source::GcsSource(v.into()),
12381 );
12382 self
12383 }
12384
12385 /// The value of [source][crate::model::ProductInputConfig::source]
12386 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12387 /// holds a different branch.
12388 pub fn big_query_source(
12389 &self,
12390 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12391 #[allow(unreachable_patterns)]
12392 self.source.as_ref().and_then(|v| match v {
12393 crate::model::product_input_config::Source::BigQuerySource(v) => {
12394 std::option::Option::Some(v)
12395 }
12396 _ => std::option::Option::None,
12397 })
12398 }
12399
12400 /// Sets the value of [source][crate::model::ProductInputConfig::source]
12401 /// to hold a `BigQuerySource`.
12402 ///
12403 /// Note that all the setters affecting `source` are
12404 /// mutually exclusive.
12405 ///
12406 /// # Example
12407 /// ```ignore,no_run
12408 /// # use google_cloud_retail_v2::model::ProductInputConfig;
12409 /// use google_cloud_retail_v2::model::BigQuerySource;
12410 /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12411 /// assert!(x.big_query_source().is_some());
12412 /// assert!(x.product_inline_source().is_none());
12413 /// assert!(x.gcs_source().is_none());
12414 /// ```
12415 pub fn set_big_query_source<
12416 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12417 >(
12418 mut self,
12419 v: T,
12420 ) -> Self {
12421 self.source = std::option::Option::Some(
12422 crate::model::product_input_config::Source::BigQuerySource(v.into()),
12423 );
12424 self
12425 }
12426}
12427
12428impl wkt::message::Message for ProductInputConfig {
12429 fn typename() -> &'static str {
12430 "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12431 }
12432}
12433
12434/// Defines additional types related to [ProductInputConfig].
12435pub mod product_input_config {
12436 #[allow(unused_imports)]
12437 use super::*;
12438
12439 /// Required. The source of the input.
12440 #[derive(Clone, Debug, PartialEq)]
12441 #[non_exhaustive]
12442 pub enum Source {
12443 /// The Inline source for the input content for products.
12444 ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12445 /// Google Cloud Storage location for the input content.
12446 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12447 /// BigQuery input source.
12448 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12449 }
12450}
12451
12452/// The input config source for user events.
12453#[derive(Clone, Default, PartialEq)]
12454#[non_exhaustive]
12455pub struct UserEventInputConfig {
12456 /// The source of the input.
12457 pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12458
12459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12460}
12461
12462impl UserEventInputConfig {
12463 /// Creates a new default instance.
12464 pub fn new() -> Self {
12465 std::default::Default::default()
12466 }
12467
12468 /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12469 ///
12470 /// Note that all the setters affecting `source` are mutually
12471 /// exclusive.
12472 ///
12473 /// # Example
12474 /// ```ignore,no_run
12475 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12476 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12477 /// let x = UserEventInputConfig::new().set_source(Some(
12478 /// google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12479 /// ```
12480 pub fn set_source<
12481 T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12482 >(
12483 mut self,
12484 v: T,
12485 ) -> Self {
12486 self.source = v.into();
12487 self
12488 }
12489
12490 /// The value of [source][crate::model::UserEventInputConfig::source]
12491 /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12492 /// holds a different branch.
12493 pub fn user_event_inline_source(
12494 &self,
12495 ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12496 #[allow(unreachable_patterns)]
12497 self.source.as_ref().and_then(|v| match v {
12498 crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12499 std::option::Option::Some(v)
12500 }
12501 _ => std::option::Option::None,
12502 })
12503 }
12504
12505 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12506 /// to hold a `UserEventInlineSource`.
12507 ///
12508 /// Note that all the setters affecting `source` are
12509 /// mutually exclusive.
12510 ///
12511 /// # Example
12512 /// ```ignore,no_run
12513 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12514 /// use google_cloud_retail_v2::model::UserEventInlineSource;
12515 /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12516 /// assert!(x.user_event_inline_source().is_some());
12517 /// assert!(x.gcs_source().is_none());
12518 /// assert!(x.big_query_source().is_none());
12519 /// ```
12520 pub fn set_user_event_inline_source<
12521 T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12522 >(
12523 mut self,
12524 v: T,
12525 ) -> Self {
12526 self.source = std::option::Option::Some(
12527 crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12528 );
12529 self
12530 }
12531
12532 /// The value of [source][crate::model::UserEventInputConfig::source]
12533 /// if it holds a `GcsSource`, `None` if the field is not set or
12534 /// holds a different branch.
12535 pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12536 #[allow(unreachable_patterns)]
12537 self.source.as_ref().and_then(|v| match v {
12538 crate::model::user_event_input_config::Source::GcsSource(v) => {
12539 std::option::Option::Some(v)
12540 }
12541 _ => std::option::Option::None,
12542 })
12543 }
12544
12545 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12546 /// to hold a `GcsSource`.
12547 ///
12548 /// Note that all the setters affecting `source` are
12549 /// mutually exclusive.
12550 ///
12551 /// # Example
12552 /// ```ignore,no_run
12553 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12554 /// use google_cloud_retail_v2::model::GcsSource;
12555 /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12556 /// assert!(x.gcs_source().is_some());
12557 /// assert!(x.user_event_inline_source().is_none());
12558 /// assert!(x.big_query_source().is_none());
12559 /// ```
12560 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12561 mut self,
12562 v: T,
12563 ) -> Self {
12564 self.source = std::option::Option::Some(
12565 crate::model::user_event_input_config::Source::GcsSource(v.into()),
12566 );
12567 self
12568 }
12569
12570 /// The value of [source][crate::model::UserEventInputConfig::source]
12571 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12572 /// holds a different branch.
12573 pub fn big_query_source(
12574 &self,
12575 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12576 #[allow(unreachable_patterns)]
12577 self.source.as_ref().and_then(|v| match v {
12578 crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12579 std::option::Option::Some(v)
12580 }
12581 _ => std::option::Option::None,
12582 })
12583 }
12584
12585 /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12586 /// to hold a `BigQuerySource`.
12587 ///
12588 /// Note that all the setters affecting `source` are
12589 /// mutually exclusive.
12590 ///
12591 /// # Example
12592 /// ```ignore,no_run
12593 /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12594 /// use google_cloud_retail_v2::model::BigQuerySource;
12595 /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12596 /// assert!(x.big_query_source().is_some());
12597 /// assert!(x.user_event_inline_source().is_none());
12598 /// assert!(x.gcs_source().is_none());
12599 /// ```
12600 pub fn set_big_query_source<
12601 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12602 >(
12603 mut self,
12604 v: T,
12605 ) -> Self {
12606 self.source = std::option::Option::Some(
12607 crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12608 );
12609 self
12610 }
12611}
12612
12613impl wkt::message::Message for UserEventInputConfig {
12614 fn typename() -> &'static str {
12615 "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12616 }
12617}
12618
12619/// Defines additional types related to [UserEventInputConfig].
12620pub mod user_event_input_config {
12621 #[allow(unused_imports)]
12622 use super::*;
12623
12624 /// The source of the input.
12625 #[derive(Clone, Debug, PartialEq)]
12626 #[non_exhaustive]
12627 pub enum Source {
12628 /// Required. The Inline source for the input content for UserEvents.
12629 UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12630 /// Required. Google Cloud Storage location for the input content.
12631 GcsSource(std::boxed::Box<crate::model::GcsSource>),
12632 /// Required. BigQuery input source.
12633 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12634 }
12635}
12636
12637/// The input config source for completion data.
12638#[derive(Clone, Default, PartialEq)]
12639#[non_exhaustive]
12640pub struct CompletionDataInputConfig {
12641 /// The source of the input.
12642 ///
12643 /// Supported
12644 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12645 /// values for suggestions imports:
12646 ///
12647 /// * `suggestions` (default): One JSON completion suggestion per line.
12648 /// * `denylist`: One JSON deny suggestion per line.
12649 /// * `allowlist`: One JSON allow suggestion per line.
12650 ///
12651 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12652 pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12653
12654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12655}
12656
12657impl CompletionDataInputConfig {
12658 /// Creates a new default instance.
12659 pub fn new() -> Self {
12660 std::default::Default::default()
12661 }
12662
12663 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12664 ///
12665 /// Note that all the setters affecting `source` are mutually
12666 /// exclusive.
12667 ///
12668 /// # Example
12669 /// ```ignore,no_run
12670 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12671 /// use google_cloud_retail_v2::model::BigQuerySource;
12672 /// let x = CompletionDataInputConfig::new().set_source(Some(
12673 /// google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12674 /// ```
12675 pub fn set_source<
12676 T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12677 >(
12678 mut self,
12679 v: T,
12680 ) -> Self {
12681 self.source = v.into();
12682 self
12683 }
12684
12685 /// The value of [source][crate::model::CompletionDataInputConfig::source]
12686 /// if it holds a `BigQuerySource`, `None` if the field is not set or
12687 /// holds a different branch.
12688 pub fn big_query_source(
12689 &self,
12690 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12691 #[allow(unreachable_patterns)]
12692 self.source.as_ref().and_then(|v| match v {
12693 crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12694 std::option::Option::Some(v)
12695 }
12696 _ => std::option::Option::None,
12697 })
12698 }
12699
12700 /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12701 /// to hold a `BigQuerySource`.
12702 ///
12703 /// Note that all the setters affecting `source` are
12704 /// mutually exclusive.
12705 ///
12706 /// # Example
12707 /// ```ignore,no_run
12708 /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12709 /// use google_cloud_retail_v2::model::BigQuerySource;
12710 /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12711 /// assert!(x.big_query_source().is_some());
12712 /// ```
12713 pub fn set_big_query_source<
12714 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12715 >(
12716 mut self,
12717 v: T,
12718 ) -> Self {
12719 self.source = std::option::Option::Some(
12720 crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12721 );
12722 self
12723 }
12724}
12725
12726impl wkt::message::Message for CompletionDataInputConfig {
12727 fn typename() -> &'static str {
12728 "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12729 }
12730}
12731
12732/// Defines additional types related to [CompletionDataInputConfig].
12733pub mod completion_data_input_config {
12734 #[allow(unused_imports)]
12735 use super::*;
12736
12737 /// The source of the input.
12738 ///
12739 /// Supported
12740 /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12741 /// values for suggestions imports:
12742 ///
12743 /// * `suggestions` (default): One JSON completion suggestion per line.
12744 /// * `denylist`: One JSON deny suggestion per line.
12745 /// * `allowlist`: One JSON allow suggestion per line.
12746 ///
12747 /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12748 #[derive(Clone, Debug, PartialEq)]
12749 #[non_exhaustive]
12750 pub enum Source {
12751 /// Required. BigQuery input source.
12752 ///
12753 /// Add the IAM permission "BigQuery Data Viewer" for
12754 /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12755 /// using this feature otherwise an error is thrown.
12756 BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12757 }
12758}
12759
12760/// Metadata related to the progress of the Import operation. This is
12761/// returned by the google.longrunning.Operation.metadata field.
12762#[derive(Clone, Default, PartialEq)]
12763#[non_exhaustive]
12764pub struct ImportMetadata {
12765 /// Operation create time.
12766 pub create_time: std::option::Option<wkt::Timestamp>,
12767
12768 /// Operation last update time. If the operation is done, this is also the
12769 /// finish time.
12770 pub update_time: std::option::Option<wkt::Timestamp>,
12771
12772 /// Count of entries that were processed successfully.
12773 pub success_count: i64,
12774
12775 /// Count of entries that encountered errors while processing.
12776 pub failure_count: i64,
12777
12778 /// Deprecated. This field is never set.
12779 #[deprecated]
12780 pub request_id: std::string::String,
12781
12782 /// Pub/Sub topic for receiving notification. If this field is set,
12783 /// when the import is finished, a notification is sent to
12784 /// specified Pub/Sub topic. The message data is JSON string of a
12785 /// [Operation][google.longrunning.Operation].
12786 /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12787 ///
12788 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12789 pub notification_pubsub_topic: std::string::String,
12790
12791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12792}
12793
12794impl ImportMetadata {
12795 /// Creates a new default instance.
12796 pub fn new() -> Self {
12797 std::default::Default::default()
12798 }
12799
12800 /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12801 ///
12802 /// # Example
12803 /// ```ignore,no_run
12804 /// # use google_cloud_retail_v2::model::ImportMetadata;
12805 /// use wkt::Timestamp;
12806 /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12807 /// ```
12808 pub fn set_create_time<T>(mut self, v: T) -> Self
12809 where
12810 T: std::convert::Into<wkt::Timestamp>,
12811 {
12812 self.create_time = std::option::Option::Some(v.into());
12813 self
12814 }
12815
12816 /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12817 ///
12818 /// # Example
12819 /// ```ignore,no_run
12820 /// # use google_cloud_retail_v2::model::ImportMetadata;
12821 /// use wkt::Timestamp;
12822 /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12823 /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12824 /// ```
12825 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12826 where
12827 T: std::convert::Into<wkt::Timestamp>,
12828 {
12829 self.create_time = v.map(|x| x.into());
12830 self
12831 }
12832
12833 /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12834 ///
12835 /// # Example
12836 /// ```ignore,no_run
12837 /// # use google_cloud_retail_v2::model::ImportMetadata;
12838 /// use wkt::Timestamp;
12839 /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12840 /// ```
12841 pub fn set_update_time<T>(mut self, v: T) -> Self
12842 where
12843 T: std::convert::Into<wkt::Timestamp>,
12844 {
12845 self.update_time = std::option::Option::Some(v.into());
12846 self
12847 }
12848
12849 /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12850 ///
12851 /// # Example
12852 /// ```ignore,no_run
12853 /// # use google_cloud_retail_v2::model::ImportMetadata;
12854 /// use wkt::Timestamp;
12855 /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12856 /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12857 /// ```
12858 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12859 where
12860 T: std::convert::Into<wkt::Timestamp>,
12861 {
12862 self.update_time = v.map(|x| x.into());
12863 self
12864 }
12865
12866 /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12867 ///
12868 /// # Example
12869 /// ```ignore,no_run
12870 /// # use google_cloud_retail_v2::model::ImportMetadata;
12871 /// let x = ImportMetadata::new().set_success_count(42);
12872 /// ```
12873 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12874 self.success_count = v.into();
12875 self
12876 }
12877
12878 /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12879 ///
12880 /// # Example
12881 /// ```ignore,no_run
12882 /// # use google_cloud_retail_v2::model::ImportMetadata;
12883 /// let x = ImportMetadata::new().set_failure_count(42);
12884 /// ```
12885 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12886 self.failure_count = v.into();
12887 self
12888 }
12889
12890 /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12891 ///
12892 /// # Example
12893 /// ```ignore,no_run
12894 /// # use google_cloud_retail_v2::model::ImportMetadata;
12895 /// let x = ImportMetadata::new().set_request_id("example");
12896 /// ```
12897 #[deprecated]
12898 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12899 self.request_id = v.into();
12900 self
12901 }
12902
12903 /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12904 ///
12905 /// # Example
12906 /// ```ignore,no_run
12907 /// # use google_cloud_retail_v2::model::ImportMetadata;
12908 /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12909 /// ```
12910 pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12911 mut self,
12912 v: T,
12913 ) -> Self {
12914 self.notification_pubsub_topic = v.into();
12915 self
12916 }
12917}
12918
12919impl wkt::message::Message for ImportMetadata {
12920 fn typename() -> &'static str {
12921 "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12922 }
12923}
12924
12925/// Response of the
12926/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12927/// long running operation is done, then this message is returned by the
12928/// google.longrunning.Operations.response field if the operation was successful.
12929///
12930/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12931#[derive(Clone, Default, PartialEq)]
12932#[non_exhaustive]
12933pub struct ImportProductsResponse {
12934 /// A sample of errors encountered while processing the request.
12935 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12936
12937 /// Echoes the destination for the complete errors in the request if set.
12938 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12939
12940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12941}
12942
12943impl ImportProductsResponse {
12944 /// Creates a new default instance.
12945 pub fn new() -> Self {
12946 std::default::Default::default()
12947 }
12948
12949 /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12950 ///
12951 /// # Example
12952 /// ```ignore,no_run
12953 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12954 /// use google_cloud_rpc::model::Status;
12955 /// let x = ImportProductsResponse::new()
12956 /// .set_error_samples([
12957 /// Status::default()/* use setters */,
12958 /// Status::default()/* use (different) setters */,
12959 /// ]);
12960 /// ```
12961 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12962 where
12963 T: std::iter::IntoIterator<Item = V>,
12964 V: std::convert::Into<google_cloud_rpc::model::Status>,
12965 {
12966 use std::iter::Iterator;
12967 self.error_samples = v.into_iter().map(|i| i.into()).collect();
12968 self
12969 }
12970
12971 /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12972 ///
12973 /// # Example
12974 /// ```ignore,no_run
12975 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12976 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12977 /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12978 /// ```
12979 pub fn set_errors_config<T>(mut self, v: T) -> Self
12980 where
12981 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12982 {
12983 self.errors_config = std::option::Option::Some(v.into());
12984 self
12985 }
12986
12987 /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12988 ///
12989 /// # Example
12990 /// ```ignore,no_run
12991 /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12992 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12993 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12994 /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12995 /// ```
12996 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12997 where
12998 T: std::convert::Into<crate::model::ImportErrorsConfig>,
12999 {
13000 self.errors_config = v.map(|x| x.into());
13001 self
13002 }
13003}
13004
13005impl wkt::message::Message for ImportProductsResponse {
13006 fn typename() -> &'static str {
13007 "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
13008 }
13009}
13010
13011/// Response of the ImportUserEventsRequest. If the long running
13012/// operation was successful, then this message is returned by the
13013/// google.longrunning.Operations.response field if the operation was successful.
13014#[derive(Clone, Default, PartialEq)]
13015#[non_exhaustive]
13016pub struct ImportUserEventsResponse {
13017 /// A sample of errors encountered while processing the request.
13018 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13019
13020 /// Echoes the destination for the complete errors if this field was set in
13021 /// the request.
13022 pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
13023
13024 /// Aggregated statistics of user event import status.
13025 pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
13026
13027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13028}
13029
13030impl ImportUserEventsResponse {
13031 /// Creates a new default instance.
13032 pub fn new() -> Self {
13033 std::default::Default::default()
13034 }
13035
13036 /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
13037 ///
13038 /// # Example
13039 /// ```ignore,no_run
13040 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13041 /// use google_cloud_rpc::model::Status;
13042 /// let x = ImportUserEventsResponse::new()
13043 /// .set_error_samples([
13044 /// Status::default()/* use setters */,
13045 /// Status::default()/* use (different) setters */,
13046 /// ]);
13047 /// ```
13048 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13049 where
13050 T: std::iter::IntoIterator<Item = V>,
13051 V: std::convert::Into<google_cloud_rpc::model::Status>,
13052 {
13053 use std::iter::Iterator;
13054 self.error_samples = v.into_iter().map(|i| i.into()).collect();
13055 self
13056 }
13057
13058 /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
13059 ///
13060 /// # Example
13061 /// ```ignore,no_run
13062 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13063 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13064 /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
13065 /// ```
13066 pub fn set_errors_config<T>(mut self, v: T) -> Self
13067 where
13068 T: std::convert::Into<crate::model::ImportErrorsConfig>,
13069 {
13070 self.errors_config = std::option::Option::Some(v.into());
13071 self
13072 }
13073
13074 /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
13075 ///
13076 /// # Example
13077 /// ```ignore,no_run
13078 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13079 /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13080 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
13081 /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
13082 /// ```
13083 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
13084 where
13085 T: std::convert::Into<crate::model::ImportErrorsConfig>,
13086 {
13087 self.errors_config = v.map(|x| x.into());
13088 self
13089 }
13090
13091 /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13092 ///
13093 /// # Example
13094 /// ```ignore,no_run
13095 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13096 /// use google_cloud_retail_v2::model::UserEventImportSummary;
13097 /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
13098 /// ```
13099 pub fn set_import_summary<T>(mut self, v: T) -> Self
13100 where
13101 T: std::convert::Into<crate::model::UserEventImportSummary>,
13102 {
13103 self.import_summary = std::option::Option::Some(v.into());
13104 self
13105 }
13106
13107 /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13108 ///
13109 /// # Example
13110 /// ```ignore,no_run
13111 /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13112 /// use google_cloud_retail_v2::model::UserEventImportSummary;
13113 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
13114 /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
13115 /// ```
13116 pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
13117 where
13118 T: std::convert::Into<crate::model::UserEventImportSummary>,
13119 {
13120 self.import_summary = v.map(|x| x.into());
13121 self
13122 }
13123}
13124
13125impl wkt::message::Message for ImportUserEventsResponse {
13126 fn typename() -> &'static str {
13127 "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
13128 }
13129}
13130
13131/// A summary of import result. The UserEventImportSummary summarizes
13132/// the import status for user events.
13133#[derive(Clone, Default, PartialEq)]
13134#[non_exhaustive]
13135pub struct UserEventImportSummary {
13136 /// Count of user events imported with complete existing catalog information.
13137 pub joined_events_count: i64,
13138
13139 /// Count of user events imported, but with catalog information not found
13140 /// in the imported catalog.
13141 pub unjoined_events_count: i64,
13142
13143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13144}
13145
13146impl UserEventImportSummary {
13147 /// Creates a new default instance.
13148 pub fn new() -> Self {
13149 std::default::Default::default()
13150 }
13151
13152 /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
13153 ///
13154 /// # Example
13155 /// ```ignore,no_run
13156 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13157 /// let x = UserEventImportSummary::new().set_joined_events_count(42);
13158 /// ```
13159 pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13160 self.joined_events_count = v.into();
13161 self
13162 }
13163
13164 /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
13165 ///
13166 /// # Example
13167 /// ```ignore,no_run
13168 /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13169 /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
13170 /// ```
13171 pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13172 self.unjoined_events_count = v.into();
13173 self
13174 }
13175}
13176
13177impl wkt::message::Message for UserEventImportSummary {
13178 fn typename() -> &'static str {
13179 "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13180 }
13181}
13182
13183/// Response of the
13184/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13185/// If the long running operation is done, this message is returned by the
13186/// google.longrunning.Operations.response field if the operation is successful.
13187///
13188/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13189#[derive(Clone, Default, PartialEq)]
13190#[non_exhaustive]
13191pub struct ImportCompletionDataResponse {
13192 /// A sample of errors encountered while processing the request.
13193 pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13194
13195 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13196}
13197
13198impl ImportCompletionDataResponse {
13199 /// Creates a new default instance.
13200 pub fn new() -> Self {
13201 std::default::Default::default()
13202 }
13203
13204 /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13205 ///
13206 /// # Example
13207 /// ```ignore,no_run
13208 /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13209 /// use google_cloud_rpc::model::Status;
13210 /// let x = ImportCompletionDataResponse::new()
13211 /// .set_error_samples([
13212 /// Status::default()/* use setters */,
13213 /// Status::default()/* use (different) setters */,
13214 /// ]);
13215 /// ```
13216 pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13217 where
13218 T: std::iter::IntoIterator<Item = V>,
13219 V: std::convert::Into<google_cloud_rpc::model::Status>,
13220 {
13221 use std::iter::Iterator;
13222 self.error_samples = v.into_iter().map(|i| i.into()).collect();
13223 self
13224 }
13225}
13226
13227impl wkt::message::Message for ImportCompletionDataResponse {
13228 fn typename() -> &'static str {
13229 "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13230 }
13231}
13232
13233/// Metadata that describes the training and serving parameters of a
13234/// [Model][google.cloud.retail.v2.Model]. A
13235/// [Model][google.cloud.retail.v2.Model] can be associated with a
13236/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13237/// through the Predict API.
13238///
13239/// [google.cloud.retail.v2.Model]: crate::model::Model
13240/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13241#[derive(Clone, Default, PartialEq)]
13242#[non_exhaustive]
13243pub struct Model {
13244 /// Required. The fully qualified resource name of the model.
13245 ///
13246 /// Format:
13247 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13248 /// catalog_id has char limit of 50.
13249 /// recommendation_model_id has char limit of 40.
13250 pub name: std::string::String,
13251
13252 /// Required. The display name of the model.
13253 ///
13254 /// Should be human readable, used to display Recommendation Models in the
13255 /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13256 /// characters.
13257 pub display_name: std::string::String,
13258
13259 /// Optional. The training state that the model is in (e.g.
13260 /// `TRAINING` or `PAUSED`).
13261 ///
13262 /// Since part of the cost of running the service
13263 /// is frequency of training - this can be used to determine when to train
13264 /// model in order to control cost. If not specified: the default value for
13265 /// `CreateModel` method is `TRAINING`. The default value for
13266 /// `UpdateModel` method is to keep the state the same as before.
13267 pub training_state: crate::model::model::TrainingState,
13268
13269 /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13270 pub serving_state: crate::model::model::ServingState,
13271
13272 /// Output only. Timestamp the Recommendation Model was created at.
13273 pub create_time: std::option::Option<wkt::Timestamp>,
13274
13275 /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13276 /// if a Recommendation Model was paused - this would be the time the pause was
13277 /// initiated.
13278 pub update_time: std::option::Option<wkt::Timestamp>,
13279
13280 /// Required. The type of model e.g. `home-page`.
13281 ///
13282 /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13283 /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13284 /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13285 ///
13286 /// This field together with
13287 /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13288 /// describe model metadata to use to control model training and serving.
13289 /// See <https://cloud.google.com/retail/docs/models>
13290 /// for more details on what the model metadata control and which combination
13291 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13292 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13293 /// receive an error 400 if you try to create/update a recommendation with
13294 /// this set of knobs.
13295 ///
13296 /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13297 pub r#type: std::string::String,
13298
13299 /// Optional. The optimization objective e.g. `cvr`.
13300 ///
13301 /// Currently supported
13302 /// values: `ctr`, `cvr`, `revenue-per-order`.
13303 ///
13304 /// If not specified, we choose default based on model type.
13305 /// Default depends on type of recommendation:
13306 ///
13307 /// `recommended-for-you` => `ctr`
13308 ///
13309 /// `others-you-may-like` => `ctr`
13310 ///
13311 /// `frequently-bought-together` => `revenue_per_order`
13312 ///
13313 /// This field together with
13314 /// [optimization_objective][google.cloud.retail.v2.Model.type]
13315 /// describe model metadata to use to control model training and serving.
13316 /// See <https://cloud.google.com/retail/docs/models>
13317 /// for more details on what the model metadata control and which combination
13318 /// of parameters are valid. For invalid combinations of parameters (e.g. type
13319 /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13320 /// receive an error 400 if you try to create/update a recommendation with
13321 /// this set of knobs.
13322 ///
13323 /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13324 pub optimization_objective: std::string::String,
13325
13326 /// Optional. The state of periodic tuning.
13327 ///
13328 /// The period we use is 3 months - to do a
13329 /// one-off tune earlier use the `TuneModel` method. Default value
13330 /// is `PERIODIC_TUNING_ENABLED`.
13331 pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13332
13333 /// Output only. The timestamp when the latest successful tune finished.
13334 pub last_tune_time: std::option::Option<wkt::Timestamp>,
13335
13336 /// Output only. The tune operation associated with the model.
13337 ///
13338 /// Can be used to determine if there is an ongoing tune for this
13339 /// recommendation. Empty field implies no tune is goig on.
13340 pub tuning_operation: std::string::String,
13341
13342 /// Output only. The state of data requirements for this model: `DATA_OK` and
13343 /// `DATA_ERROR`.
13344 ///
13345 /// Recommendation model cannot be trained if the data is in
13346 /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13347 /// if serving state is `ACTIVE`: models were trained successfully before, but
13348 /// cannot be refreshed because model no longer has sufficient
13349 /// data for training.
13350 pub data_state: crate::model::model::DataState,
13351
13352 /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13353 /// by attributes is enabled for the model.
13354 pub filtering_option: crate::model::RecommendationsFilteringOption,
13355
13356 /// Output only. The list of valid serving configs associated with the
13357 /// PageOptimizationConfig.
13358 pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13359
13360 /// Optional. Additional model features config.
13361 pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13362
13363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13364}
13365
13366impl Model {
13367 /// Creates a new default instance.
13368 pub fn new() -> Self {
13369 std::default::Default::default()
13370 }
13371
13372 /// Sets the value of [name][crate::model::Model::name].
13373 ///
13374 /// # Example
13375 /// ```ignore,no_run
13376 /// # use google_cloud_retail_v2::model::Model;
13377 /// # let project_id = "project_id";
13378 /// # let location_id = "location_id";
13379 /// # let catalog_id = "catalog_id";
13380 /// # let model_id = "model_id";
13381 /// let x = Model::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
13382 /// ```
13383 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13384 self.name = v.into();
13385 self
13386 }
13387
13388 /// Sets the value of [display_name][crate::model::Model::display_name].
13389 ///
13390 /// # Example
13391 /// ```ignore,no_run
13392 /// # use google_cloud_retail_v2::model::Model;
13393 /// let x = Model::new().set_display_name("example");
13394 /// ```
13395 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13396 self.display_name = v.into();
13397 self
13398 }
13399
13400 /// Sets the value of [training_state][crate::model::Model::training_state].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_retail_v2::model::Model;
13405 /// use google_cloud_retail_v2::model::model::TrainingState;
13406 /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13407 /// let x1 = Model::new().set_training_state(TrainingState::Training);
13408 /// ```
13409 pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13410 mut self,
13411 v: T,
13412 ) -> Self {
13413 self.training_state = v.into();
13414 self
13415 }
13416
13417 /// Sets the value of [serving_state][crate::model::Model::serving_state].
13418 ///
13419 /// # Example
13420 /// ```ignore,no_run
13421 /// # use google_cloud_retail_v2::model::Model;
13422 /// use google_cloud_retail_v2::model::model::ServingState;
13423 /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13424 /// let x1 = Model::new().set_serving_state(ServingState::Active);
13425 /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13426 /// ```
13427 pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13428 mut self,
13429 v: T,
13430 ) -> Self {
13431 self.serving_state = v.into();
13432 self
13433 }
13434
13435 /// Sets the value of [create_time][crate::model::Model::create_time].
13436 ///
13437 /// # Example
13438 /// ```ignore,no_run
13439 /// # use google_cloud_retail_v2::model::Model;
13440 /// use wkt::Timestamp;
13441 /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
13442 /// ```
13443 pub fn set_create_time<T>(mut self, v: T) -> Self
13444 where
13445 T: std::convert::Into<wkt::Timestamp>,
13446 {
13447 self.create_time = std::option::Option::Some(v.into());
13448 self
13449 }
13450
13451 /// Sets or clears the value of [create_time][crate::model::Model::create_time].
13452 ///
13453 /// # Example
13454 /// ```ignore,no_run
13455 /// # use google_cloud_retail_v2::model::Model;
13456 /// use wkt::Timestamp;
13457 /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13458 /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13459 /// ```
13460 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13461 where
13462 T: std::convert::Into<wkt::Timestamp>,
13463 {
13464 self.create_time = v.map(|x| x.into());
13465 self
13466 }
13467
13468 /// Sets the value of [update_time][crate::model::Model::update_time].
13469 ///
13470 /// # Example
13471 /// ```ignore,no_run
13472 /// # use google_cloud_retail_v2::model::Model;
13473 /// use wkt::Timestamp;
13474 /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13475 /// ```
13476 pub fn set_update_time<T>(mut self, v: T) -> Self
13477 where
13478 T: std::convert::Into<wkt::Timestamp>,
13479 {
13480 self.update_time = std::option::Option::Some(v.into());
13481 self
13482 }
13483
13484 /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13485 ///
13486 /// # Example
13487 /// ```ignore,no_run
13488 /// # use google_cloud_retail_v2::model::Model;
13489 /// use wkt::Timestamp;
13490 /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13491 /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13492 /// ```
13493 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13494 where
13495 T: std::convert::Into<wkt::Timestamp>,
13496 {
13497 self.update_time = v.map(|x| x.into());
13498 self
13499 }
13500
13501 /// Sets the value of [r#type][crate::model::Model::type].
13502 ///
13503 /// # Example
13504 /// ```ignore,no_run
13505 /// # use google_cloud_retail_v2::model::Model;
13506 /// let x = Model::new().set_type("example");
13507 /// ```
13508 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13509 self.r#type = v.into();
13510 self
13511 }
13512
13513 /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13514 ///
13515 /// # Example
13516 /// ```ignore,no_run
13517 /// # use google_cloud_retail_v2::model::Model;
13518 /// let x = Model::new().set_optimization_objective("example");
13519 /// ```
13520 pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13521 mut self,
13522 v: T,
13523 ) -> Self {
13524 self.optimization_objective = v.into();
13525 self
13526 }
13527
13528 /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13529 ///
13530 /// # Example
13531 /// ```ignore,no_run
13532 /// # use google_cloud_retail_v2::model::Model;
13533 /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13534 /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13535 /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13536 /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13537 /// ```
13538 pub fn set_periodic_tuning_state<
13539 T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13540 >(
13541 mut self,
13542 v: T,
13543 ) -> Self {
13544 self.periodic_tuning_state = v.into();
13545 self
13546 }
13547
13548 /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13549 ///
13550 /// # Example
13551 /// ```ignore,no_run
13552 /// # use google_cloud_retail_v2::model::Model;
13553 /// use wkt::Timestamp;
13554 /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13555 /// ```
13556 pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13557 where
13558 T: std::convert::Into<wkt::Timestamp>,
13559 {
13560 self.last_tune_time = std::option::Option::Some(v.into());
13561 self
13562 }
13563
13564 /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13565 ///
13566 /// # Example
13567 /// ```ignore,no_run
13568 /// # use google_cloud_retail_v2::model::Model;
13569 /// use wkt::Timestamp;
13570 /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13571 /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13572 /// ```
13573 pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13574 where
13575 T: std::convert::Into<wkt::Timestamp>,
13576 {
13577 self.last_tune_time = v.map(|x| x.into());
13578 self
13579 }
13580
13581 /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13582 ///
13583 /// # Example
13584 /// ```ignore,no_run
13585 /// # use google_cloud_retail_v2::model::Model;
13586 /// let x = Model::new().set_tuning_operation("example");
13587 /// ```
13588 pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13589 mut self,
13590 v: T,
13591 ) -> Self {
13592 self.tuning_operation = v.into();
13593 self
13594 }
13595
13596 /// Sets the value of [data_state][crate::model::Model::data_state].
13597 ///
13598 /// # Example
13599 /// ```ignore,no_run
13600 /// # use google_cloud_retail_v2::model::Model;
13601 /// use google_cloud_retail_v2::model::model::DataState;
13602 /// let x0 = Model::new().set_data_state(DataState::DataOk);
13603 /// let x1 = Model::new().set_data_state(DataState::DataError);
13604 /// ```
13605 pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13606 mut self,
13607 v: T,
13608 ) -> Self {
13609 self.data_state = v.into();
13610 self
13611 }
13612
13613 /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13614 ///
13615 /// # Example
13616 /// ```ignore,no_run
13617 /// # use google_cloud_retail_v2::model::Model;
13618 /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13619 /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13620 /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13621 /// ```
13622 pub fn set_filtering_option<
13623 T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13624 >(
13625 mut self,
13626 v: T,
13627 ) -> Self {
13628 self.filtering_option = v.into();
13629 self
13630 }
13631
13632 /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13633 ///
13634 /// # Example
13635 /// ```ignore,no_run
13636 /// # use google_cloud_retail_v2::model::Model;
13637 /// use google_cloud_retail_v2::model::model::ServingConfigList;
13638 /// let x = Model::new()
13639 /// .set_serving_config_lists([
13640 /// ServingConfigList::default()/* use setters */,
13641 /// ServingConfigList::default()/* use (different) setters */,
13642 /// ]);
13643 /// ```
13644 pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13645 where
13646 T: std::iter::IntoIterator<Item = V>,
13647 V: std::convert::Into<crate::model::model::ServingConfigList>,
13648 {
13649 use std::iter::Iterator;
13650 self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13651 self
13652 }
13653
13654 /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13655 ///
13656 /// # Example
13657 /// ```ignore,no_run
13658 /// # use google_cloud_retail_v2::model::Model;
13659 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13660 /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13661 /// ```
13662 pub fn set_model_features_config<T>(mut self, v: T) -> Self
13663 where
13664 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13665 {
13666 self.model_features_config = std::option::Option::Some(v.into());
13667 self
13668 }
13669
13670 /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13671 ///
13672 /// # Example
13673 /// ```ignore,no_run
13674 /// # use google_cloud_retail_v2::model::Model;
13675 /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13676 /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13677 /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13678 /// ```
13679 pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13680 where
13681 T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13682 {
13683 self.model_features_config = v.map(|x| x.into());
13684 self
13685 }
13686}
13687
13688impl wkt::message::Message for Model {
13689 fn typename() -> &'static str {
13690 "type.googleapis.com/google.cloud.retail.v2.Model"
13691 }
13692}
13693
13694/// Defines additional types related to [Model].
13695pub mod model {
13696 #[allow(unused_imports)]
13697 use super::*;
13698
13699 /// Represents an ordered combination of valid serving configs, which
13700 /// can be used for `PAGE_OPTIMIZATION` recommendations.
13701 #[derive(Clone, Default, PartialEq)]
13702 #[non_exhaustive]
13703 pub struct ServingConfigList {
13704 /// Optional. A set of valid serving configs that may be used for
13705 /// `PAGE_OPTIMIZATION`.
13706 pub serving_config_ids: std::vec::Vec<std::string::String>,
13707
13708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13709 }
13710
13711 impl ServingConfigList {
13712 /// Creates a new default instance.
13713 pub fn new() -> Self {
13714 std::default::Default::default()
13715 }
13716
13717 /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13718 ///
13719 /// # Example
13720 /// ```ignore,no_run
13721 /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13722 /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13723 /// ```
13724 pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13725 where
13726 T: std::iter::IntoIterator<Item = V>,
13727 V: std::convert::Into<std::string::String>,
13728 {
13729 use std::iter::Iterator;
13730 self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13731 self
13732 }
13733 }
13734
13735 impl wkt::message::Message for ServingConfigList {
13736 fn typename() -> &'static str {
13737 "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13738 }
13739 }
13740
13741 /// Additional configs for the frequently-bought-together model type.
13742 #[derive(Clone, Default, PartialEq)]
13743 #[non_exhaustive]
13744 pub struct FrequentlyBoughtTogetherFeaturesConfig {
13745 /// Optional. Specifies the context of the model when it is used in predict
13746 /// requests. Can only be set for the `frequently-bought-together` type. If
13747 /// it isn't specified, it defaults to
13748 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13749 ///
13750 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13751 pub context_products_type: crate::model::model::ContextProductsType,
13752
13753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13754 }
13755
13756 impl FrequentlyBoughtTogetherFeaturesConfig {
13757 /// Creates a new default instance.
13758 pub fn new() -> Self {
13759 std::default::Default::default()
13760 }
13761
13762 /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13763 ///
13764 /// # Example
13765 /// ```ignore,no_run
13766 /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13767 /// use google_cloud_retail_v2::model::model::ContextProductsType;
13768 /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13769 /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13770 /// ```
13771 pub fn set_context_products_type<
13772 T: std::convert::Into<crate::model::model::ContextProductsType>,
13773 >(
13774 mut self,
13775 v: T,
13776 ) -> Self {
13777 self.context_products_type = v.into();
13778 self
13779 }
13780 }
13781
13782 impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13783 fn typename() -> &'static str {
13784 "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13785 }
13786 }
13787
13788 /// Additional model features config.
13789 #[derive(Clone, Default, PartialEq)]
13790 #[non_exhaustive]
13791 pub struct ModelFeaturesConfig {
13792 #[allow(missing_docs)]
13793 pub type_dedicated_config:
13794 std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13795
13796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13797 }
13798
13799 impl ModelFeaturesConfig {
13800 /// Creates a new default instance.
13801 pub fn new() -> Self {
13802 std::default::Default::default()
13803 }
13804
13805 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13806 ///
13807 /// Note that all the setters affecting `type_dedicated_config` are mutually
13808 /// exclusive.
13809 ///
13810 /// # Example
13811 /// ```ignore,no_run
13812 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13813 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13814 /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13815 /// google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13816 /// ```
13817 pub fn set_type_dedicated_config<
13818 T: std::convert::Into<
13819 std::option::Option<
13820 crate::model::model::model_features_config::TypeDedicatedConfig,
13821 >,
13822 >,
13823 >(
13824 mut self,
13825 v: T,
13826 ) -> Self {
13827 self.type_dedicated_config = v.into();
13828 self
13829 }
13830
13831 /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13832 /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13833 /// holds a different branch.
13834 pub fn frequently_bought_together_config(
13835 &self,
13836 ) -> std::option::Option<
13837 &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13838 > {
13839 #[allow(unreachable_patterns)]
13840 self.type_dedicated_config.as_ref().and_then(|v| match v {
13841 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13842 _ => std::option::Option::None,
13843 })
13844 }
13845
13846 /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13847 /// to hold a `FrequentlyBoughtTogetherConfig`.
13848 ///
13849 /// Note that all the setters affecting `type_dedicated_config` are
13850 /// mutually exclusive.
13851 ///
13852 /// # Example
13853 /// ```ignore,no_run
13854 /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13855 /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13856 /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13857 /// assert!(x.frequently_bought_together_config().is_some());
13858 /// ```
13859 pub fn set_frequently_bought_together_config<
13860 T: std::convert::Into<
13861 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13862 >,
13863 >(
13864 mut self,
13865 v: T,
13866 ) -> Self {
13867 self.type_dedicated_config = std::option::Option::Some(
13868 crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13869 v.into()
13870 )
13871 );
13872 self
13873 }
13874 }
13875
13876 impl wkt::message::Message for ModelFeaturesConfig {
13877 fn typename() -> &'static str {
13878 "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13879 }
13880 }
13881
13882 /// Defines additional types related to [ModelFeaturesConfig].
13883 pub mod model_features_config {
13884 #[allow(unused_imports)]
13885 use super::*;
13886
13887 #[allow(missing_docs)]
13888 #[derive(Clone, Debug, PartialEq)]
13889 #[non_exhaustive]
13890 pub enum TypeDedicatedConfig {
13891 /// Additional configs for frequently-bought-together models.
13892 FrequentlyBoughtTogetherConfig(
13893 std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13894 ),
13895 }
13896 }
13897
13898 /// The serving state of the model.
13899 ///
13900 /// # Working with unknown values
13901 ///
13902 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13903 /// additional enum variants at any time. Adding new variants is not considered
13904 /// a breaking change. Applications should write their code in anticipation of:
13905 ///
13906 /// - New values appearing in future releases of the client library, **and**
13907 /// - New values received dynamically, without application changes.
13908 ///
13909 /// Please consult the [Working with enums] section in the user guide for some
13910 /// guidelines.
13911 ///
13912 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13913 #[derive(Clone, Debug, PartialEq)]
13914 #[non_exhaustive]
13915 pub enum ServingState {
13916 /// Unspecified serving state.
13917 Unspecified,
13918 /// The model is not serving.
13919 Inactive,
13920 /// The model is serving and can be queried.
13921 Active,
13922 /// The model is trained on tuned hyperparameters and can be
13923 /// queried.
13924 Tuned,
13925 /// If set, the enum was initialized with an unknown value.
13926 ///
13927 /// Applications can examine the value using [ServingState::value] or
13928 /// [ServingState::name].
13929 UnknownValue(serving_state::UnknownValue),
13930 }
13931
13932 #[doc(hidden)]
13933 pub mod serving_state {
13934 #[allow(unused_imports)]
13935 use super::*;
13936 #[derive(Clone, Debug, PartialEq)]
13937 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13938 }
13939
13940 impl ServingState {
13941 /// Gets the enum value.
13942 ///
13943 /// Returns `None` if the enum contains an unknown value deserialized from
13944 /// the string representation of enums.
13945 pub fn value(&self) -> std::option::Option<i32> {
13946 match self {
13947 Self::Unspecified => std::option::Option::Some(0),
13948 Self::Inactive => std::option::Option::Some(1),
13949 Self::Active => std::option::Option::Some(2),
13950 Self::Tuned => std::option::Option::Some(3),
13951 Self::UnknownValue(u) => u.0.value(),
13952 }
13953 }
13954
13955 /// Gets the enum value as a string.
13956 ///
13957 /// Returns `None` if the enum contains an unknown value deserialized from
13958 /// the integer representation of enums.
13959 pub fn name(&self) -> std::option::Option<&str> {
13960 match self {
13961 Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13962 Self::Inactive => std::option::Option::Some("INACTIVE"),
13963 Self::Active => std::option::Option::Some("ACTIVE"),
13964 Self::Tuned => std::option::Option::Some("TUNED"),
13965 Self::UnknownValue(u) => u.0.name(),
13966 }
13967 }
13968 }
13969
13970 impl std::default::Default for ServingState {
13971 fn default() -> Self {
13972 use std::convert::From;
13973 Self::from(0)
13974 }
13975 }
13976
13977 impl std::fmt::Display for ServingState {
13978 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13979 wkt::internal::display_enum(f, self.name(), self.value())
13980 }
13981 }
13982
13983 impl std::convert::From<i32> for ServingState {
13984 fn from(value: i32) -> Self {
13985 match value {
13986 0 => Self::Unspecified,
13987 1 => Self::Inactive,
13988 2 => Self::Active,
13989 3 => Self::Tuned,
13990 _ => Self::UnknownValue(serving_state::UnknownValue(
13991 wkt::internal::UnknownEnumValue::Integer(value),
13992 )),
13993 }
13994 }
13995 }
13996
13997 impl std::convert::From<&str> for ServingState {
13998 fn from(value: &str) -> Self {
13999 use std::string::ToString;
14000 match value {
14001 "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
14002 "INACTIVE" => Self::Inactive,
14003 "ACTIVE" => Self::Active,
14004 "TUNED" => Self::Tuned,
14005 _ => Self::UnknownValue(serving_state::UnknownValue(
14006 wkt::internal::UnknownEnumValue::String(value.to_string()),
14007 )),
14008 }
14009 }
14010 }
14011
14012 impl serde::ser::Serialize for ServingState {
14013 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14014 where
14015 S: serde::Serializer,
14016 {
14017 match self {
14018 Self::Unspecified => serializer.serialize_i32(0),
14019 Self::Inactive => serializer.serialize_i32(1),
14020 Self::Active => serializer.serialize_i32(2),
14021 Self::Tuned => serializer.serialize_i32(3),
14022 Self::UnknownValue(u) => u.0.serialize(serializer),
14023 }
14024 }
14025 }
14026
14027 impl<'de> serde::de::Deserialize<'de> for ServingState {
14028 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14029 where
14030 D: serde::Deserializer<'de>,
14031 {
14032 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
14033 ".google.cloud.retail.v2.Model.ServingState",
14034 ))
14035 }
14036 }
14037
14038 /// The training state of the model.
14039 ///
14040 /// # Working with unknown values
14041 ///
14042 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14043 /// additional enum variants at any time. Adding new variants is not considered
14044 /// a breaking change. Applications should write their code in anticipation of:
14045 ///
14046 /// - New values appearing in future releases of the client library, **and**
14047 /// - New values received dynamically, without application changes.
14048 ///
14049 /// Please consult the [Working with enums] section in the user guide for some
14050 /// guidelines.
14051 ///
14052 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14053 #[derive(Clone, Debug, PartialEq)]
14054 #[non_exhaustive]
14055 pub enum TrainingState {
14056 /// Unspecified training state.
14057 Unspecified,
14058 /// The model training is paused.
14059 Paused,
14060 /// The model is training.
14061 Training,
14062 /// If set, the enum was initialized with an unknown value.
14063 ///
14064 /// Applications can examine the value using [TrainingState::value] or
14065 /// [TrainingState::name].
14066 UnknownValue(training_state::UnknownValue),
14067 }
14068
14069 #[doc(hidden)]
14070 pub mod training_state {
14071 #[allow(unused_imports)]
14072 use super::*;
14073 #[derive(Clone, Debug, PartialEq)]
14074 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14075 }
14076
14077 impl TrainingState {
14078 /// Gets the enum value.
14079 ///
14080 /// Returns `None` if the enum contains an unknown value deserialized from
14081 /// the string representation of enums.
14082 pub fn value(&self) -> std::option::Option<i32> {
14083 match self {
14084 Self::Unspecified => std::option::Option::Some(0),
14085 Self::Paused => std::option::Option::Some(1),
14086 Self::Training => std::option::Option::Some(2),
14087 Self::UnknownValue(u) => u.0.value(),
14088 }
14089 }
14090
14091 /// Gets the enum value as a string.
14092 ///
14093 /// Returns `None` if the enum contains an unknown value deserialized from
14094 /// the integer representation of enums.
14095 pub fn name(&self) -> std::option::Option<&str> {
14096 match self {
14097 Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
14098 Self::Paused => std::option::Option::Some("PAUSED"),
14099 Self::Training => std::option::Option::Some("TRAINING"),
14100 Self::UnknownValue(u) => u.0.name(),
14101 }
14102 }
14103 }
14104
14105 impl std::default::Default for TrainingState {
14106 fn default() -> Self {
14107 use std::convert::From;
14108 Self::from(0)
14109 }
14110 }
14111
14112 impl std::fmt::Display for TrainingState {
14113 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14114 wkt::internal::display_enum(f, self.name(), self.value())
14115 }
14116 }
14117
14118 impl std::convert::From<i32> for TrainingState {
14119 fn from(value: i32) -> Self {
14120 match value {
14121 0 => Self::Unspecified,
14122 1 => Self::Paused,
14123 2 => Self::Training,
14124 _ => Self::UnknownValue(training_state::UnknownValue(
14125 wkt::internal::UnknownEnumValue::Integer(value),
14126 )),
14127 }
14128 }
14129 }
14130
14131 impl std::convert::From<&str> for TrainingState {
14132 fn from(value: &str) -> Self {
14133 use std::string::ToString;
14134 match value {
14135 "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
14136 "PAUSED" => Self::Paused,
14137 "TRAINING" => Self::Training,
14138 _ => Self::UnknownValue(training_state::UnknownValue(
14139 wkt::internal::UnknownEnumValue::String(value.to_string()),
14140 )),
14141 }
14142 }
14143 }
14144
14145 impl serde::ser::Serialize for TrainingState {
14146 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14147 where
14148 S: serde::Serializer,
14149 {
14150 match self {
14151 Self::Unspecified => serializer.serialize_i32(0),
14152 Self::Paused => serializer.serialize_i32(1),
14153 Self::Training => serializer.serialize_i32(2),
14154 Self::UnknownValue(u) => u.0.serialize(serializer),
14155 }
14156 }
14157 }
14158
14159 impl<'de> serde::de::Deserialize<'de> for TrainingState {
14160 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14161 where
14162 D: serde::Deserializer<'de>,
14163 {
14164 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
14165 ".google.cloud.retail.v2.Model.TrainingState",
14166 ))
14167 }
14168 }
14169
14170 /// Describes whether periodic tuning is enabled for this model
14171 /// or not. Periodic tuning is scheduled at most every three months. You can
14172 /// start a tuning process manually by using the `TuneModel`
14173 /// method, which starts a tuning process immediately and resets the quarterly
14174 /// schedule. Enabling or disabling periodic tuning does not affect any
14175 /// current tuning processes.
14176 ///
14177 /// # Working with unknown values
14178 ///
14179 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14180 /// additional enum variants at any time. Adding new variants is not considered
14181 /// a breaking change. Applications should write their code in anticipation of:
14182 ///
14183 /// - New values appearing in future releases of the client library, **and**
14184 /// - New values received dynamically, without application changes.
14185 ///
14186 /// Please consult the [Working with enums] section in the user guide for some
14187 /// guidelines.
14188 ///
14189 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14190 #[derive(Clone, Debug, PartialEq)]
14191 #[non_exhaustive]
14192 pub enum PeriodicTuningState {
14193 /// Unspecified default value, should never be explicitly set.
14194 Unspecified,
14195 /// The model has periodic tuning disabled. Tuning
14196 /// can be reenabled by calling the `EnableModelPeriodicTuning`
14197 /// method or by calling the `TuneModel` method.
14198 PeriodicTuningDisabled,
14199 /// The model cannot be tuned with periodic tuning OR the
14200 /// `TuneModel` method. Hide the options in customer UI and
14201 /// reject any requests through the backend self serve API.
14202 AllTuningDisabled,
14203 /// The model has periodic tuning enabled. Tuning
14204 /// can be disabled by calling the `DisableModelPeriodicTuning`
14205 /// method.
14206 PeriodicTuningEnabled,
14207 /// If set, the enum was initialized with an unknown value.
14208 ///
14209 /// Applications can examine the value using [PeriodicTuningState::value] or
14210 /// [PeriodicTuningState::name].
14211 UnknownValue(periodic_tuning_state::UnknownValue),
14212 }
14213
14214 #[doc(hidden)]
14215 pub mod periodic_tuning_state {
14216 #[allow(unused_imports)]
14217 use super::*;
14218 #[derive(Clone, Debug, PartialEq)]
14219 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14220 }
14221
14222 impl PeriodicTuningState {
14223 /// Gets the enum value.
14224 ///
14225 /// Returns `None` if the enum contains an unknown value deserialized from
14226 /// the string representation of enums.
14227 pub fn value(&self) -> std::option::Option<i32> {
14228 match self {
14229 Self::Unspecified => std::option::Option::Some(0),
14230 Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14231 Self::AllTuningDisabled => std::option::Option::Some(3),
14232 Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14233 Self::UnknownValue(u) => u.0.value(),
14234 }
14235 }
14236
14237 /// Gets the enum value as a string.
14238 ///
14239 /// Returns `None` if the enum contains an unknown value deserialized from
14240 /// the integer representation of enums.
14241 pub fn name(&self) -> std::option::Option<&str> {
14242 match self {
14243 Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14244 Self::PeriodicTuningDisabled => {
14245 std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14246 }
14247 Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14248 Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14249 Self::UnknownValue(u) => u.0.name(),
14250 }
14251 }
14252 }
14253
14254 impl std::default::Default for PeriodicTuningState {
14255 fn default() -> Self {
14256 use std::convert::From;
14257 Self::from(0)
14258 }
14259 }
14260
14261 impl std::fmt::Display for PeriodicTuningState {
14262 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14263 wkt::internal::display_enum(f, self.name(), self.value())
14264 }
14265 }
14266
14267 impl std::convert::From<i32> for PeriodicTuningState {
14268 fn from(value: i32) -> Self {
14269 match value {
14270 0 => Self::Unspecified,
14271 1 => Self::PeriodicTuningDisabled,
14272 2 => Self::PeriodicTuningEnabled,
14273 3 => Self::AllTuningDisabled,
14274 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14275 wkt::internal::UnknownEnumValue::Integer(value),
14276 )),
14277 }
14278 }
14279 }
14280
14281 impl std::convert::From<&str> for PeriodicTuningState {
14282 fn from(value: &str) -> Self {
14283 use std::string::ToString;
14284 match value {
14285 "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14286 "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14287 "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14288 "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14289 _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14290 wkt::internal::UnknownEnumValue::String(value.to_string()),
14291 )),
14292 }
14293 }
14294 }
14295
14296 impl serde::ser::Serialize for PeriodicTuningState {
14297 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14298 where
14299 S: serde::Serializer,
14300 {
14301 match self {
14302 Self::Unspecified => serializer.serialize_i32(0),
14303 Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14304 Self::AllTuningDisabled => serializer.serialize_i32(3),
14305 Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14306 Self::UnknownValue(u) => u.0.serialize(serializer),
14307 }
14308 }
14309 }
14310
14311 impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14312 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14313 where
14314 D: serde::Deserializer<'de>,
14315 {
14316 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14317 ".google.cloud.retail.v2.Model.PeriodicTuningState",
14318 ))
14319 }
14320 }
14321
14322 /// Describes whether this model have sufficient training data
14323 /// to be continuously trained.
14324 ///
14325 /// # Working with unknown values
14326 ///
14327 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14328 /// additional enum variants at any time. Adding new variants is not considered
14329 /// a breaking change. Applications should write their code in anticipation of:
14330 ///
14331 /// - New values appearing in future releases of the client library, **and**
14332 /// - New values received dynamically, without application changes.
14333 ///
14334 /// Please consult the [Working with enums] section in the user guide for some
14335 /// guidelines.
14336 ///
14337 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14338 #[derive(Clone, Debug, PartialEq)]
14339 #[non_exhaustive]
14340 pub enum DataState {
14341 /// Unspecified default value, should never be explicitly set.
14342 Unspecified,
14343 /// The model has sufficient training data.
14344 DataOk,
14345 /// The model does not have sufficient training data. Error
14346 /// messages can be queried via Stackdriver.
14347 DataError,
14348 /// If set, the enum was initialized with an unknown value.
14349 ///
14350 /// Applications can examine the value using [DataState::value] or
14351 /// [DataState::name].
14352 UnknownValue(data_state::UnknownValue),
14353 }
14354
14355 #[doc(hidden)]
14356 pub mod data_state {
14357 #[allow(unused_imports)]
14358 use super::*;
14359 #[derive(Clone, Debug, PartialEq)]
14360 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14361 }
14362
14363 impl DataState {
14364 /// Gets the enum value.
14365 ///
14366 /// Returns `None` if the enum contains an unknown value deserialized from
14367 /// the string representation of enums.
14368 pub fn value(&self) -> std::option::Option<i32> {
14369 match self {
14370 Self::Unspecified => std::option::Option::Some(0),
14371 Self::DataOk => std::option::Option::Some(1),
14372 Self::DataError => std::option::Option::Some(2),
14373 Self::UnknownValue(u) => u.0.value(),
14374 }
14375 }
14376
14377 /// Gets the enum value as a string.
14378 ///
14379 /// Returns `None` if the enum contains an unknown value deserialized from
14380 /// the integer representation of enums.
14381 pub fn name(&self) -> std::option::Option<&str> {
14382 match self {
14383 Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14384 Self::DataOk => std::option::Option::Some("DATA_OK"),
14385 Self::DataError => std::option::Option::Some("DATA_ERROR"),
14386 Self::UnknownValue(u) => u.0.name(),
14387 }
14388 }
14389 }
14390
14391 impl std::default::Default for DataState {
14392 fn default() -> Self {
14393 use std::convert::From;
14394 Self::from(0)
14395 }
14396 }
14397
14398 impl std::fmt::Display for DataState {
14399 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14400 wkt::internal::display_enum(f, self.name(), self.value())
14401 }
14402 }
14403
14404 impl std::convert::From<i32> for DataState {
14405 fn from(value: i32) -> Self {
14406 match value {
14407 0 => Self::Unspecified,
14408 1 => Self::DataOk,
14409 2 => Self::DataError,
14410 _ => Self::UnknownValue(data_state::UnknownValue(
14411 wkt::internal::UnknownEnumValue::Integer(value),
14412 )),
14413 }
14414 }
14415 }
14416
14417 impl std::convert::From<&str> for DataState {
14418 fn from(value: &str) -> Self {
14419 use std::string::ToString;
14420 match value {
14421 "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14422 "DATA_OK" => Self::DataOk,
14423 "DATA_ERROR" => Self::DataError,
14424 _ => Self::UnknownValue(data_state::UnknownValue(
14425 wkt::internal::UnknownEnumValue::String(value.to_string()),
14426 )),
14427 }
14428 }
14429 }
14430
14431 impl serde::ser::Serialize for DataState {
14432 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14433 where
14434 S: serde::Serializer,
14435 {
14436 match self {
14437 Self::Unspecified => serializer.serialize_i32(0),
14438 Self::DataOk => serializer.serialize_i32(1),
14439 Self::DataError => serializer.serialize_i32(2),
14440 Self::UnknownValue(u) => u.0.serialize(serializer),
14441 }
14442 }
14443 }
14444
14445 impl<'de> serde::de::Deserialize<'de> for DataState {
14446 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14447 where
14448 D: serde::Deserializer<'de>,
14449 {
14450 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14451 ".google.cloud.retail.v2.Model.DataState",
14452 ))
14453 }
14454 }
14455
14456 /// Use single or multiple context products for recommendations.
14457 ///
14458 /// # Working with unknown values
14459 ///
14460 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14461 /// additional enum variants at any time. Adding new variants is not considered
14462 /// a breaking change. Applications should write their code in anticipation of:
14463 ///
14464 /// - New values appearing in future releases of the client library, **and**
14465 /// - New values received dynamically, without application changes.
14466 ///
14467 /// Please consult the [Working with enums] section in the user guide for some
14468 /// guidelines.
14469 ///
14470 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14471 #[derive(Clone, Debug, PartialEq)]
14472 #[non_exhaustive]
14473 pub enum ContextProductsType {
14474 /// Unspecified default value, should never be explicitly set.
14475 /// Defaults to
14476 /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14477 ///
14478 /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14479 Unspecified,
14480 /// Use only a single product as context for the recommendation. Typically
14481 /// used on pages like add-to-cart or product details.
14482 SingleContextProduct,
14483 /// Use one or multiple products as context for the recommendation. Typically
14484 /// used on shopping cart pages.
14485 MultipleContextProducts,
14486 /// If set, the enum was initialized with an unknown value.
14487 ///
14488 /// Applications can examine the value using [ContextProductsType::value] or
14489 /// [ContextProductsType::name].
14490 UnknownValue(context_products_type::UnknownValue),
14491 }
14492
14493 #[doc(hidden)]
14494 pub mod context_products_type {
14495 #[allow(unused_imports)]
14496 use super::*;
14497 #[derive(Clone, Debug, PartialEq)]
14498 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14499 }
14500
14501 impl ContextProductsType {
14502 /// Gets the enum value.
14503 ///
14504 /// Returns `None` if the enum contains an unknown value deserialized from
14505 /// the string representation of enums.
14506 pub fn value(&self) -> std::option::Option<i32> {
14507 match self {
14508 Self::Unspecified => std::option::Option::Some(0),
14509 Self::SingleContextProduct => std::option::Option::Some(1),
14510 Self::MultipleContextProducts => std::option::Option::Some(2),
14511 Self::UnknownValue(u) => u.0.value(),
14512 }
14513 }
14514
14515 /// Gets the enum value as a string.
14516 ///
14517 /// Returns `None` if the enum contains an unknown value deserialized from
14518 /// the integer representation of enums.
14519 pub fn name(&self) -> std::option::Option<&str> {
14520 match self {
14521 Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14522 Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14523 Self::MultipleContextProducts => {
14524 std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14525 }
14526 Self::UnknownValue(u) => u.0.name(),
14527 }
14528 }
14529 }
14530
14531 impl std::default::Default for ContextProductsType {
14532 fn default() -> Self {
14533 use std::convert::From;
14534 Self::from(0)
14535 }
14536 }
14537
14538 impl std::fmt::Display for ContextProductsType {
14539 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14540 wkt::internal::display_enum(f, self.name(), self.value())
14541 }
14542 }
14543
14544 impl std::convert::From<i32> for ContextProductsType {
14545 fn from(value: i32) -> Self {
14546 match value {
14547 0 => Self::Unspecified,
14548 1 => Self::SingleContextProduct,
14549 2 => Self::MultipleContextProducts,
14550 _ => Self::UnknownValue(context_products_type::UnknownValue(
14551 wkt::internal::UnknownEnumValue::Integer(value),
14552 )),
14553 }
14554 }
14555 }
14556
14557 impl std::convert::From<&str> for ContextProductsType {
14558 fn from(value: &str) -> Self {
14559 use std::string::ToString;
14560 match value {
14561 "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14562 "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14563 "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14564 _ => Self::UnknownValue(context_products_type::UnknownValue(
14565 wkt::internal::UnknownEnumValue::String(value.to_string()),
14566 )),
14567 }
14568 }
14569 }
14570
14571 impl serde::ser::Serialize for ContextProductsType {
14572 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14573 where
14574 S: serde::Serializer,
14575 {
14576 match self {
14577 Self::Unspecified => serializer.serialize_i32(0),
14578 Self::SingleContextProduct => serializer.serialize_i32(1),
14579 Self::MultipleContextProducts => serializer.serialize_i32(2),
14580 Self::UnknownValue(u) => u.0.serialize(serializer),
14581 }
14582 }
14583 }
14584
14585 impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14586 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14587 where
14588 D: serde::Deserializer<'de>,
14589 {
14590 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14591 ".google.cloud.retail.v2.Model.ContextProductsType",
14592 ))
14593 }
14594 }
14595}
14596
14597/// Request for creating a model.
14598#[derive(Clone, Default, PartialEq)]
14599#[non_exhaustive]
14600pub struct CreateModelRequest {
14601 /// Required. The parent resource under which to create the model. Format:
14602 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14603 pub parent: std::string::String,
14604
14605 /// Required. The payload of the [Model][google.cloud.retail.v2.Model] to
14606 /// create.
14607 ///
14608 /// [google.cloud.retail.v2.Model]: crate::model::Model
14609 pub model: std::option::Option<crate::model::Model>,
14610
14611 /// Optional. Whether to run a dry run to validate the request (without
14612 /// actually creating the model).
14613 pub dry_run: bool,
14614
14615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14616}
14617
14618impl CreateModelRequest {
14619 /// Creates a new default instance.
14620 pub fn new() -> Self {
14621 std::default::Default::default()
14622 }
14623
14624 /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14625 ///
14626 /// # Example
14627 /// ```ignore,no_run
14628 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14629 /// # let project_id = "project_id";
14630 /// # let location_id = "location_id";
14631 /// # let catalog_id = "catalog_id";
14632 /// let x = CreateModelRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
14633 /// ```
14634 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14635 self.parent = v.into();
14636 self
14637 }
14638
14639 /// Sets the value of [model][crate::model::CreateModelRequest::model].
14640 ///
14641 /// # Example
14642 /// ```ignore,no_run
14643 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14644 /// use google_cloud_retail_v2::model::Model;
14645 /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14646 /// ```
14647 pub fn set_model<T>(mut self, v: T) -> Self
14648 where
14649 T: std::convert::Into<crate::model::Model>,
14650 {
14651 self.model = std::option::Option::Some(v.into());
14652 self
14653 }
14654
14655 /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14656 ///
14657 /// # Example
14658 /// ```ignore,no_run
14659 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14660 /// use google_cloud_retail_v2::model::Model;
14661 /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14662 /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14663 /// ```
14664 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14665 where
14666 T: std::convert::Into<crate::model::Model>,
14667 {
14668 self.model = v.map(|x| x.into());
14669 self
14670 }
14671
14672 /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14673 ///
14674 /// # Example
14675 /// ```ignore,no_run
14676 /// # use google_cloud_retail_v2::model::CreateModelRequest;
14677 /// let x = CreateModelRequest::new().set_dry_run(true);
14678 /// ```
14679 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14680 self.dry_run = v.into();
14681 self
14682 }
14683}
14684
14685impl wkt::message::Message for CreateModelRequest {
14686 fn typename() -> &'static str {
14687 "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14688 }
14689}
14690
14691/// Request for updating an existing model.
14692#[derive(Clone, Default, PartialEq)]
14693#[non_exhaustive]
14694pub struct UpdateModelRequest {
14695 /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14696 ///
14697 /// [google.cloud.retail.v2.Model]: crate::model::Model
14698 pub model: std::option::Option<crate::model::Model>,
14699
14700 /// Optional. Indicates which fields in the provided 'model' to
14701 /// update. If not set, by default updates all fields.
14702 pub update_mask: std::option::Option<wkt::FieldMask>,
14703
14704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14705}
14706
14707impl UpdateModelRequest {
14708 /// Creates a new default instance.
14709 pub fn new() -> Self {
14710 std::default::Default::default()
14711 }
14712
14713 /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14714 ///
14715 /// # Example
14716 /// ```ignore,no_run
14717 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14718 /// use google_cloud_retail_v2::model::Model;
14719 /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14720 /// ```
14721 pub fn set_model<T>(mut self, v: T) -> Self
14722 where
14723 T: std::convert::Into<crate::model::Model>,
14724 {
14725 self.model = std::option::Option::Some(v.into());
14726 self
14727 }
14728
14729 /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14730 ///
14731 /// # Example
14732 /// ```ignore,no_run
14733 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14734 /// use google_cloud_retail_v2::model::Model;
14735 /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14736 /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14737 /// ```
14738 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14739 where
14740 T: std::convert::Into<crate::model::Model>,
14741 {
14742 self.model = v.map(|x| x.into());
14743 self
14744 }
14745
14746 /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14747 ///
14748 /// # Example
14749 /// ```ignore,no_run
14750 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14751 /// use wkt::FieldMask;
14752 /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14753 /// ```
14754 pub fn set_update_mask<T>(mut self, v: T) -> Self
14755 where
14756 T: std::convert::Into<wkt::FieldMask>,
14757 {
14758 self.update_mask = std::option::Option::Some(v.into());
14759 self
14760 }
14761
14762 /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14763 ///
14764 /// # Example
14765 /// ```ignore,no_run
14766 /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14767 /// use wkt::FieldMask;
14768 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14769 /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14770 /// ```
14771 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14772 where
14773 T: std::convert::Into<wkt::FieldMask>,
14774 {
14775 self.update_mask = v.map(|x| x.into());
14776 self
14777 }
14778}
14779
14780impl wkt::message::Message for UpdateModelRequest {
14781 fn typename() -> &'static str {
14782 "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14783 }
14784}
14785
14786/// Request for getting a model.
14787#[derive(Clone, Default, PartialEq)]
14788#[non_exhaustive]
14789pub struct GetModelRequest {
14790 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14791 /// get. Format:
14792 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14793 ///
14794 /// [google.cloud.retail.v2.Model]: crate::model::Model
14795 pub name: std::string::String,
14796
14797 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14798}
14799
14800impl GetModelRequest {
14801 /// Creates a new default instance.
14802 pub fn new() -> Self {
14803 std::default::Default::default()
14804 }
14805
14806 /// Sets the value of [name][crate::model::GetModelRequest::name].
14807 ///
14808 /// # Example
14809 /// ```ignore,no_run
14810 /// # use google_cloud_retail_v2::model::GetModelRequest;
14811 /// # let project_id = "project_id";
14812 /// # let location_id = "location_id";
14813 /// # let catalog_id = "catalog_id";
14814 /// # let model_id = "model_id";
14815 /// let x = GetModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
14816 /// ```
14817 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14818 self.name = v.into();
14819 self
14820 }
14821}
14822
14823impl wkt::message::Message for GetModelRequest {
14824 fn typename() -> &'static str {
14825 "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14826 }
14827}
14828
14829/// Request for pausing training of a model.
14830#[derive(Clone, Default, PartialEq)]
14831#[non_exhaustive]
14832pub struct PauseModelRequest {
14833 /// Required. The name of the model to pause.
14834 /// Format:
14835 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14836 pub name: std::string::String,
14837
14838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14839}
14840
14841impl PauseModelRequest {
14842 /// Creates a new default instance.
14843 pub fn new() -> Self {
14844 std::default::Default::default()
14845 }
14846
14847 /// Sets the value of [name][crate::model::PauseModelRequest::name].
14848 ///
14849 /// # Example
14850 /// ```ignore,no_run
14851 /// # use google_cloud_retail_v2::model::PauseModelRequest;
14852 /// # let project_id = "project_id";
14853 /// # let location_id = "location_id";
14854 /// # let catalog_id = "catalog_id";
14855 /// # let model_id = "model_id";
14856 /// let x = PauseModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
14857 /// ```
14858 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14859 self.name = v.into();
14860 self
14861 }
14862}
14863
14864impl wkt::message::Message for PauseModelRequest {
14865 fn typename() -> &'static str {
14866 "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14867 }
14868}
14869
14870/// Request for resuming training of a model.
14871#[derive(Clone, Default, PartialEq)]
14872#[non_exhaustive]
14873pub struct ResumeModelRequest {
14874 /// Required. The name of the model to resume.
14875 /// Format:
14876 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14877 pub name: std::string::String,
14878
14879 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14880}
14881
14882impl ResumeModelRequest {
14883 /// Creates a new default instance.
14884 pub fn new() -> Self {
14885 std::default::Default::default()
14886 }
14887
14888 /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14889 ///
14890 /// # Example
14891 /// ```ignore,no_run
14892 /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14893 /// let x = ResumeModelRequest::new().set_name("example");
14894 /// ```
14895 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14896 self.name = v.into();
14897 self
14898 }
14899}
14900
14901impl wkt::message::Message for ResumeModelRequest {
14902 fn typename() -> &'static str {
14903 "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14904 }
14905}
14906
14907/// Request for listing models associated with a resource.
14908#[derive(Clone, Default, PartialEq)]
14909#[non_exhaustive]
14910pub struct ListModelsRequest {
14911 /// Required. The parent for which to list models.
14912 /// Format:
14913 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14914 pub parent: std::string::String,
14915
14916 /// Optional. Maximum number of results to return. If unspecified, defaults
14917 /// to 50. Max allowed value is 1000.
14918 pub page_size: i32,
14919
14920 /// Optional. A page token, received from a previous `ListModels`
14921 /// call. Provide this to retrieve the subsequent page.
14922 pub page_token: std::string::String,
14923
14924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14925}
14926
14927impl ListModelsRequest {
14928 /// Creates a new default instance.
14929 pub fn new() -> Self {
14930 std::default::Default::default()
14931 }
14932
14933 /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14934 ///
14935 /// # Example
14936 /// ```ignore,no_run
14937 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14938 /// # let project_id = "project_id";
14939 /// # let location_id = "location_id";
14940 /// # let catalog_id = "catalog_id";
14941 /// let x = ListModelsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
14942 /// ```
14943 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14944 self.parent = v.into();
14945 self
14946 }
14947
14948 /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14949 ///
14950 /// # Example
14951 /// ```ignore,no_run
14952 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14953 /// let x = ListModelsRequest::new().set_page_size(42);
14954 /// ```
14955 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14956 self.page_size = v.into();
14957 self
14958 }
14959
14960 /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14961 ///
14962 /// # Example
14963 /// ```ignore,no_run
14964 /// # use google_cloud_retail_v2::model::ListModelsRequest;
14965 /// let x = ListModelsRequest::new().set_page_token("example");
14966 /// ```
14967 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14968 self.page_token = v.into();
14969 self
14970 }
14971}
14972
14973impl wkt::message::Message for ListModelsRequest {
14974 fn typename() -> &'static str {
14975 "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14976 }
14977}
14978
14979/// Request for deleting a model.
14980#[derive(Clone, Default, PartialEq)]
14981#[non_exhaustive]
14982pub struct DeleteModelRequest {
14983 /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14984 /// delete. Format:
14985 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14986 ///
14987 /// [google.cloud.retail.v2.Model]: crate::model::Model
14988 pub name: std::string::String,
14989
14990 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14991}
14992
14993impl DeleteModelRequest {
14994 /// Creates a new default instance.
14995 pub fn new() -> Self {
14996 std::default::Default::default()
14997 }
14998
14999 /// Sets the value of [name][crate::model::DeleteModelRequest::name].
15000 ///
15001 /// # Example
15002 /// ```ignore,no_run
15003 /// # use google_cloud_retail_v2::model::DeleteModelRequest;
15004 /// # let project_id = "project_id";
15005 /// # let location_id = "location_id";
15006 /// # let catalog_id = "catalog_id";
15007 /// # let model_id = "model_id";
15008 /// let x = DeleteModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
15009 /// ```
15010 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15011 self.name = v.into();
15012 self
15013 }
15014}
15015
15016impl wkt::message::Message for DeleteModelRequest {
15017 fn typename() -> &'static str {
15018 "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
15019 }
15020}
15021
15022/// Response to a ListModelRequest.
15023#[derive(Clone, Default, PartialEq)]
15024#[non_exhaustive]
15025pub struct ListModelsResponse {
15026 /// List of Models.
15027 pub models: std::vec::Vec<crate::model::Model>,
15028
15029 /// Pagination token, if not returned indicates the last page.
15030 pub next_page_token: std::string::String,
15031
15032 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15033}
15034
15035impl ListModelsResponse {
15036 /// Creates a new default instance.
15037 pub fn new() -> Self {
15038 std::default::Default::default()
15039 }
15040
15041 /// Sets the value of [models][crate::model::ListModelsResponse::models].
15042 ///
15043 /// # Example
15044 /// ```ignore,no_run
15045 /// # use google_cloud_retail_v2::model::ListModelsResponse;
15046 /// use google_cloud_retail_v2::model::Model;
15047 /// let x = ListModelsResponse::new()
15048 /// .set_models([
15049 /// Model::default()/* use setters */,
15050 /// Model::default()/* use (different) setters */,
15051 /// ]);
15052 /// ```
15053 pub fn set_models<T, V>(mut self, v: T) -> Self
15054 where
15055 T: std::iter::IntoIterator<Item = V>,
15056 V: std::convert::Into<crate::model::Model>,
15057 {
15058 use std::iter::Iterator;
15059 self.models = v.into_iter().map(|i| i.into()).collect();
15060 self
15061 }
15062
15063 /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
15064 ///
15065 /// # Example
15066 /// ```ignore,no_run
15067 /// # use google_cloud_retail_v2::model::ListModelsResponse;
15068 /// let x = ListModelsResponse::new().set_next_page_token("example");
15069 /// ```
15070 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15071 self.next_page_token = v.into();
15072 self
15073 }
15074}
15075
15076impl wkt::message::Message for ListModelsResponse {
15077 fn typename() -> &'static str {
15078 "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
15079 }
15080}
15081
15082#[doc(hidden)]
15083impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
15084 type PageItem = crate::model::Model;
15085
15086 fn items(self) -> std::vec::Vec<Self::PageItem> {
15087 self.models
15088 }
15089
15090 fn next_page_token(&self) -> std::string::String {
15091 use std::clone::Clone;
15092 self.next_page_token.clone()
15093 }
15094}
15095
15096/// Request to manually start a tuning process now (instead of waiting for
15097/// the periodically scheduled tuning to happen).
15098#[derive(Clone, Default, PartialEq)]
15099#[non_exhaustive]
15100pub struct TuneModelRequest {
15101 /// Required. The resource name of the model to tune.
15102 /// Format:
15103 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15104 pub name: std::string::String,
15105
15106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15107}
15108
15109impl TuneModelRequest {
15110 /// Creates a new default instance.
15111 pub fn new() -> Self {
15112 std::default::Default::default()
15113 }
15114
15115 /// Sets the value of [name][crate::model::TuneModelRequest::name].
15116 ///
15117 /// # Example
15118 /// ```ignore,no_run
15119 /// # use google_cloud_retail_v2::model::TuneModelRequest;
15120 /// # let project_id = "project_id";
15121 /// # let location_id = "location_id";
15122 /// # let catalog_id = "catalog_id";
15123 /// # let model_id = "model_id";
15124 /// let x = TuneModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
15125 /// ```
15126 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15127 self.name = v.into();
15128 self
15129 }
15130}
15131
15132impl wkt::message::Message for TuneModelRequest {
15133 fn typename() -> &'static str {
15134 "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
15135 }
15136}
15137
15138/// Metadata associated with a create operation.
15139#[derive(Clone, Default, PartialEq)]
15140#[non_exhaustive]
15141pub struct CreateModelMetadata {
15142 /// The resource name of the model that this create applies to.
15143 /// Format:
15144 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15145 pub model: std::string::String,
15146
15147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15148}
15149
15150impl CreateModelMetadata {
15151 /// Creates a new default instance.
15152 pub fn new() -> Self {
15153 std::default::Default::default()
15154 }
15155
15156 /// Sets the value of [model][crate::model::CreateModelMetadata::model].
15157 ///
15158 /// # Example
15159 /// ```ignore,no_run
15160 /// # use google_cloud_retail_v2::model::CreateModelMetadata;
15161 /// let x = CreateModelMetadata::new().set_model("example");
15162 /// ```
15163 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15164 self.model = v.into();
15165 self
15166 }
15167}
15168
15169impl wkt::message::Message for CreateModelMetadata {
15170 fn typename() -> &'static str {
15171 "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
15172 }
15173}
15174
15175/// Metadata associated with a tune operation.
15176#[derive(Clone, Default, PartialEq)]
15177#[non_exhaustive]
15178pub struct TuneModelMetadata {
15179 /// The resource name of the model that this tune applies to.
15180 /// Format:
15181 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15182 pub model: std::string::String,
15183
15184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15185}
15186
15187impl TuneModelMetadata {
15188 /// Creates a new default instance.
15189 pub fn new() -> Self {
15190 std::default::Default::default()
15191 }
15192
15193 /// Sets the value of [model][crate::model::TuneModelMetadata::model].
15194 ///
15195 /// # Example
15196 /// ```ignore,no_run
15197 /// # use google_cloud_retail_v2::model::TuneModelMetadata;
15198 /// let x = TuneModelMetadata::new().set_model("example");
15199 /// ```
15200 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15201 self.model = v.into();
15202 self
15203 }
15204}
15205
15206impl wkt::message::Message for TuneModelMetadata {
15207 fn typename() -> &'static str {
15208 "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
15209 }
15210}
15211
15212/// Response associated with a tune operation.
15213#[derive(Clone, Default, PartialEq)]
15214#[non_exhaustive]
15215pub struct TuneModelResponse {
15216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15217}
15218
15219impl TuneModelResponse {
15220 /// Creates a new default instance.
15221 pub fn new() -> Self {
15222 std::default::Default::default()
15223 }
15224}
15225
15226impl wkt::message::Message for TuneModelResponse {
15227 fn typename() -> &'static str {
15228 "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15229 }
15230}
15231
15232/// Request message for Predict method.
15233#[derive(Clone, Default, PartialEq)]
15234#[non_exhaustive]
15235pub struct PredictRequest {
15236 /// Required. Full resource name of the format:
15237 /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15238 /// or
15239 /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15240 /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15241 /// resource.
15242 /// The ID of the Recommendations AI serving config or placement.
15243 /// Before you can request predictions from your model, you must create at
15244 /// least one serving config or placement for it. For more information, see
15245 /// [Manage serving configs]
15246 /// (<https://cloud.google.com/retail/docs/manage-configs>).
15247 ///
15248 /// The full list of available serving configs can be seen at
15249 /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15250 pub placement: std::string::String,
15251
15252 /// Required. Context about the user, what they are looking at and what action
15253 /// they took to trigger the predict request. Note that this user event detail
15254 /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15255 /// request is required for event logging.
15256 ///
15257 /// Don't set
15258 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15259 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15260 /// fixed ID for different users. If you are trying to receive non-personalized
15261 /// recommendations (not recommended; this can negatively impact model
15262 /// performance), instead set
15263 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15264 /// random unique ID and leave
15265 /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15266 ///
15267 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15268 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15269 pub user_event: std::option::Option<crate::model::UserEvent>,
15270
15271 /// Maximum number of results to return. Set this property to the number of
15272 /// prediction results needed. If zero, the service will choose a reasonable
15273 /// default. The maximum allowed value is 100. Values above 100 will be coerced
15274 /// to 100.
15275 pub page_size: i32,
15276
15277 /// This field is not used; leave it unset.
15278 #[deprecated]
15279 pub page_token: std::string::String,
15280
15281 /// Filter for restricting prediction results with a length limit of 5,000
15282 /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15283 ///
15284 /// * Tag expressions. Restricts predictions to products that match all of the
15285 /// specified tags. Boolean operators `OR` and `NOT` are supported if the
15286 /// expression is enclosed in parentheses, and must be separated from the
15287 /// tag values by a space. `-"tagA"` is also supported and is equivalent to
15288 /// `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15289 /// with a size limit of 1,000 characters.
15290 ///
15291 /// Note: "Recently viewed" models don't support tag filtering at the
15292 /// moment.
15293 ///
15294 /// * filterOutOfStockItems. Restricts predictions to products that do not
15295 /// have a
15296 /// stockState value of OUT_OF_STOCK.
15297 ///
15298 ///
15299 /// Examples:
15300 ///
15301 /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15302 /// * filterOutOfStockItems tag=(-"promotional")
15303 /// * filterOutOfStockItems
15304 ///
15305 /// If your filter blocks all prediction results, the API will return *no*
15306 /// results. If instead you want empty result sets to return generic
15307 /// (unfiltered) popular products, set `strictFiltering` to False in
15308 /// `PredictRequest.params`. Note that the API will never return items with
15309 /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15310 ///
15311 /// If `filterSyntaxV2` is set to true under the `params` field, then
15312 /// attribute-based expressions are expected instead of the above described
15313 /// tag-based syntax. Examples:
15314 ///
15315 /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15316 /// * (availability: ANY("IN_STOCK")) AND
15317 /// (colors: ANY("Red") OR categories: ANY("Phones"))
15318 ///
15319 /// For more information, see
15320 /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15321 pub filter: std::string::String,
15322
15323 /// Use validate only mode for this prediction query. If set to true, a
15324 /// dummy model will be used that returns arbitrary products.
15325 /// Note that the validate only mode should only be used for testing the API,
15326 /// or if the model is not ready.
15327 pub validate_only: bool,
15328
15329 /// Additional domain specific parameters for the predictions.
15330 ///
15331 /// Allowed values:
15332 ///
15333 /// * `returnProduct`: Boolean. If set to true, the associated product
15334 /// object will be returned in the `results.metadata` field in the
15335 /// prediction response.
15336 /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15337 /// corresponding to each returned product will be set in the
15338 /// `results.metadata` field in the prediction response. The given
15339 /// 'score' indicates the probability of a product being clicked/purchased
15340 /// given the user's context and history.
15341 /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15342 /// will return generic (unfiltered) popular products instead of empty if
15343 /// your filter blocks all prediction results.
15344 /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15345 /// it needs to be one of {'no-price-reranking', 'low-price-reranking',
15346 /// 'medium-price-reranking', 'high-price-reranking'}. This gives
15347 /// request-level control and adjusts prediction results based on product
15348 /// price.
15349 /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15350 /// it needs to be one of {'no-diversity', 'low-diversity',
15351 /// 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15352 /// request-level control and adjusts prediction results based on product
15353 /// category.
15354 /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15355 /// field is interpreteted according to the new, attribute-based syntax.
15356 pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15357
15358 /// The labels applied to a resource must meet the following requirements:
15359 ///
15360 /// * Each resource can have multiple labels, up to a maximum of 64.
15361 /// * Each label must be a key-value pair.
15362 /// * Keys have a minimum length of 1 character and a maximum length of 63
15363 /// characters and cannot be empty. Values can be empty and have a maximum
15364 /// length of 63 characters.
15365 /// * Keys and values can contain only lowercase letters, numeric characters,
15366 /// underscores, and dashes. All characters must use UTF-8 encoding, and
15367 /// international characters are allowed.
15368 /// * The key portion of a label must be unique. However, you can use the same
15369 /// key with multiple resources.
15370 /// * Keys must start with a lowercase letter or international character.
15371 ///
15372 /// See [Google Cloud
15373 /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15374 /// for more details.
15375 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15376
15377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15378}
15379
15380impl PredictRequest {
15381 /// Creates a new default instance.
15382 pub fn new() -> Self {
15383 std::default::Default::default()
15384 }
15385
15386 /// Sets the value of [placement][crate::model::PredictRequest::placement].
15387 ///
15388 /// # Example
15389 /// ```ignore,no_run
15390 /// # use google_cloud_retail_v2::model::PredictRequest;
15391 /// let x = PredictRequest::new().set_placement("example");
15392 /// ```
15393 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15394 self.placement = v.into();
15395 self
15396 }
15397
15398 /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15399 ///
15400 /// # Example
15401 /// ```ignore,no_run
15402 /// # use google_cloud_retail_v2::model::PredictRequest;
15403 /// use google_cloud_retail_v2::model::UserEvent;
15404 /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15405 /// ```
15406 pub fn set_user_event<T>(mut self, v: T) -> Self
15407 where
15408 T: std::convert::Into<crate::model::UserEvent>,
15409 {
15410 self.user_event = std::option::Option::Some(v.into());
15411 self
15412 }
15413
15414 /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15415 ///
15416 /// # Example
15417 /// ```ignore,no_run
15418 /// # use google_cloud_retail_v2::model::PredictRequest;
15419 /// use google_cloud_retail_v2::model::UserEvent;
15420 /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15421 /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15422 /// ```
15423 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15424 where
15425 T: std::convert::Into<crate::model::UserEvent>,
15426 {
15427 self.user_event = v.map(|x| x.into());
15428 self
15429 }
15430
15431 /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15432 ///
15433 /// # Example
15434 /// ```ignore,no_run
15435 /// # use google_cloud_retail_v2::model::PredictRequest;
15436 /// let x = PredictRequest::new().set_page_size(42);
15437 /// ```
15438 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15439 self.page_size = v.into();
15440 self
15441 }
15442
15443 /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15444 ///
15445 /// # Example
15446 /// ```ignore,no_run
15447 /// # use google_cloud_retail_v2::model::PredictRequest;
15448 /// let x = PredictRequest::new().set_page_token("example");
15449 /// ```
15450 #[deprecated]
15451 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15452 self.page_token = v.into();
15453 self
15454 }
15455
15456 /// Sets the value of [filter][crate::model::PredictRequest::filter].
15457 ///
15458 /// # Example
15459 /// ```ignore,no_run
15460 /// # use google_cloud_retail_v2::model::PredictRequest;
15461 /// let x = PredictRequest::new().set_filter("example");
15462 /// ```
15463 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15464 self.filter = v.into();
15465 self
15466 }
15467
15468 /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15469 ///
15470 /// # Example
15471 /// ```ignore,no_run
15472 /// # use google_cloud_retail_v2::model::PredictRequest;
15473 /// let x = PredictRequest::new().set_validate_only(true);
15474 /// ```
15475 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15476 self.validate_only = v.into();
15477 self
15478 }
15479
15480 /// Sets the value of [params][crate::model::PredictRequest::params].
15481 ///
15482 /// # Example
15483 /// ```ignore,no_run
15484 /// # use google_cloud_retail_v2::model::PredictRequest;
15485 /// use wkt::Value;
15486 /// let x = PredictRequest::new().set_params([
15487 /// ("key0", Value::default()/* use setters */),
15488 /// ("key1", Value::default()/* use (different) setters */),
15489 /// ]);
15490 /// ```
15491 pub fn set_params<T, K, V>(mut self, v: T) -> Self
15492 where
15493 T: std::iter::IntoIterator<Item = (K, V)>,
15494 K: std::convert::Into<std::string::String>,
15495 V: std::convert::Into<wkt::Value>,
15496 {
15497 use std::iter::Iterator;
15498 self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15499 self
15500 }
15501
15502 /// Sets the value of [labels][crate::model::PredictRequest::labels].
15503 ///
15504 /// # Example
15505 /// ```ignore,no_run
15506 /// # use google_cloud_retail_v2::model::PredictRequest;
15507 /// let x = PredictRequest::new().set_labels([
15508 /// ("key0", "abc"),
15509 /// ("key1", "xyz"),
15510 /// ]);
15511 /// ```
15512 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15513 where
15514 T: std::iter::IntoIterator<Item = (K, V)>,
15515 K: std::convert::Into<std::string::String>,
15516 V: std::convert::Into<std::string::String>,
15517 {
15518 use std::iter::Iterator;
15519 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15520 self
15521 }
15522}
15523
15524impl wkt::message::Message for PredictRequest {
15525 fn typename() -> &'static str {
15526 "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15527 }
15528}
15529
15530/// Response message for predict method.
15531#[derive(Clone, Default, PartialEq)]
15532#[non_exhaustive]
15533pub struct PredictResponse {
15534 /// A list of recommended products. The order represents the ranking (from the
15535 /// most relevant product to the least).
15536 pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15537
15538 /// A unique attribution token. This should be included in the
15539 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15540 /// recommendation, which enables accurate attribution of recommendation model
15541 /// performance.
15542 ///
15543 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15544 pub attribution_token: std::string::String,
15545
15546 /// IDs of products in the request that were missing from the inventory.
15547 pub missing_ids: std::vec::Vec<std::string::String>,
15548
15549 /// True if the validateOnly property was set in the request.
15550 pub validate_only: bool,
15551
15552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15553}
15554
15555impl PredictResponse {
15556 /// Creates a new default instance.
15557 pub fn new() -> Self {
15558 std::default::Default::default()
15559 }
15560
15561 /// Sets the value of [results][crate::model::PredictResponse::results].
15562 ///
15563 /// # Example
15564 /// ```ignore,no_run
15565 /// # use google_cloud_retail_v2::model::PredictResponse;
15566 /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15567 /// let x = PredictResponse::new()
15568 /// .set_results([
15569 /// PredictionResult::default()/* use setters */,
15570 /// PredictionResult::default()/* use (different) setters */,
15571 /// ]);
15572 /// ```
15573 pub fn set_results<T, V>(mut self, v: T) -> Self
15574 where
15575 T: std::iter::IntoIterator<Item = V>,
15576 V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15577 {
15578 use std::iter::Iterator;
15579 self.results = v.into_iter().map(|i| i.into()).collect();
15580 self
15581 }
15582
15583 /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15584 ///
15585 /// # Example
15586 /// ```ignore,no_run
15587 /// # use google_cloud_retail_v2::model::PredictResponse;
15588 /// let x = PredictResponse::new().set_attribution_token("example");
15589 /// ```
15590 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15591 mut self,
15592 v: T,
15593 ) -> Self {
15594 self.attribution_token = v.into();
15595 self
15596 }
15597
15598 /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15599 ///
15600 /// # Example
15601 /// ```ignore,no_run
15602 /// # use google_cloud_retail_v2::model::PredictResponse;
15603 /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15604 /// ```
15605 pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15606 where
15607 T: std::iter::IntoIterator<Item = V>,
15608 V: std::convert::Into<std::string::String>,
15609 {
15610 use std::iter::Iterator;
15611 self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15612 self
15613 }
15614
15615 /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15616 ///
15617 /// # Example
15618 /// ```ignore,no_run
15619 /// # use google_cloud_retail_v2::model::PredictResponse;
15620 /// let x = PredictResponse::new().set_validate_only(true);
15621 /// ```
15622 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15623 self.validate_only = v.into();
15624 self
15625 }
15626}
15627
15628impl wkt::message::Message for PredictResponse {
15629 fn typename() -> &'static str {
15630 "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15631 }
15632}
15633
15634/// Defines additional types related to [PredictResponse].
15635pub mod predict_response {
15636 #[allow(unused_imports)]
15637 use super::*;
15638
15639 /// PredictionResult represents the recommendation prediction results.
15640 #[derive(Clone, Default, PartialEq)]
15641 #[non_exhaustive]
15642 pub struct PredictionResult {
15643 /// ID of the recommended product
15644 pub id: std::string::String,
15645
15646 /// Additional product metadata / annotations.
15647 ///
15648 /// Possible values:
15649 ///
15650 /// * `product`: JSON representation of the product. Is set if
15651 /// `returnProduct` is set to true in `PredictRequest.params`.
15652 /// * `score`: Prediction score in double value. Is set if
15653 /// `returnScore` is set to true in `PredictRequest.params`.
15654 pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15655
15656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15657 }
15658
15659 impl PredictionResult {
15660 /// Creates a new default instance.
15661 pub fn new() -> Self {
15662 std::default::Default::default()
15663 }
15664
15665 /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15666 ///
15667 /// # Example
15668 /// ```ignore,no_run
15669 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15670 /// let x = PredictionResult::new().set_id("example");
15671 /// ```
15672 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15673 self.id = v.into();
15674 self
15675 }
15676
15677 /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15678 ///
15679 /// # Example
15680 /// ```ignore,no_run
15681 /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15682 /// use wkt::Value;
15683 /// let x = PredictionResult::new().set_metadata([
15684 /// ("key0", Value::default()/* use setters */),
15685 /// ("key1", Value::default()/* use (different) setters */),
15686 /// ]);
15687 /// ```
15688 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15689 where
15690 T: std::iter::IntoIterator<Item = (K, V)>,
15691 K: std::convert::Into<std::string::String>,
15692 V: std::convert::Into<wkt::Value>,
15693 {
15694 use std::iter::Iterator;
15695 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15696 self
15697 }
15698 }
15699
15700 impl wkt::message::Message for PredictionResult {
15701 fn typename() -> &'static str {
15702 "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15703 }
15704 }
15705}
15706
15707/// Product captures all metadata information of items to be recommended or
15708/// searched.
15709#[derive(Clone, Default, PartialEq)]
15710#[non_exhaustive]
15711pub struct Product {
15712 /// Immutable. Full resource name of the product, such as
15713 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15714 pub name: std::string::String,
15715
15716 /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15717 /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15718 /// example, this field is "id_1", if
15719 /// [name][google.cloud.retail.v2.Product.name] is
15720 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15721 ///
15722 /// This field must be a UTF-8 encoded string with a length limit of 128
15723 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15724 ///
15725 /// Corresponding properties: Google Merchant Center property
15726 /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15727 /// property [Product.sku](https://schema.org/sku).
15728 ///
15729 /// [google.cloud.retail.v2.Product]: crate::model::Product
15730 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15731 pub id: std::string::String,
15732
15733 /// Immutable. The type of the product. Default to
15734 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15735 /// if unset.
15736 ///
15737 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15738 pub r#type: crate::model::product::Type,
15739
15740 /// Variant group identifier. Must be an
15741 /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15742 /// this product. Otherwise, an error is thrown.
15743 ///
15744 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15745 /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15746 /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15747 ///
15748 /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15749 /// be empty. A maximum of 2,000 products are allowed to share the same
15750 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15751 /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15752 /// error is returned.
15753 ///
15754 /// Corresponding properties: Google Merchant Center property
15755 /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15756 /// Schema.org property
15757 /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15758 ///
15759 /// [google.cloud.retail.v2.Product]: crate::model::Product
15760 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15761 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15762 pub primary_product_id: std::string::String,
15763
15764 /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15765 /// [type][google.cloud.retail.v2.Product.type] is
15766 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15767 ///
15768 /// Non-existent product ids are allowed.
15769 /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15770 /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15771 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15772 /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15773 /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15774 /// return.
15775 ///
15776 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15777 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15778 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15779 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15780 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15781 pub collection_member_ids: std::vec::Vec<std::string::String>,
15782
15783 /// The Global Trade Item Number (GTIN) of the product.
15784 ///
15785 /// This field must be a UTF-8 encoded string with a length limit of 128
15786 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15787 ///
15788 /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15789 /// returned.
15790 ///
15791 /// Corresponding properties: Google Merchant Center property
15792 /// [gtin](https://support.google.com/merchants/answer/6324461).
15793 /// Schema.org property
15794 /// [Product.isbn](https://schema.org/isbn),
15795 /// [Product.gtin8](https://schema.org/gtin8),
15796 /// [Product.gtin12](https://schema.org/gtin12),
15797 /// [Product.gtin13](https://schema.org/gtin13), or
15798 /// [Product.gtin14](https://schema.org/gtin14).
15799 ///
15800 /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15801 pub gtin: std::string::String,
15802
15803 /// Product categories. This field is repeated for supporting one product
15804 /// belonging to several parallel categories. Strongly recommended using the
15805 /// full path for better search / recommendation quality.
15806 ///
15807 /// To represent full path of category, use '>' sign to separate different
15808 /// hierarchies. If '>' is part of the category name, replace it with
15809 /// other character(s).
15810 ///
15811 /// For example, if a shoes product belongs to both
15812 /// ["Shoes & Accessories" -> "Shoes"] and
15813 /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15814 /// represented as:
15815 ///
15816 /// ```norust
15817 /// "categories": [
15818 /// "Shoes & Accessories > Shoes",
15819 /// "Sports & Fitness > Athletic Clothing > Shoes"
15820 /// ]
15821 /// ```
15822 ///
15823 /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15824 /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15825 /// error is returned.
15826 ///
15827 /// At most 250 values are allowed per
15828 /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15829 /// Google Cloud console. Empty values are not allowed. Each value must be a
15830 /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15831 /// INVALID_ARGUMENT error is returned.
15832 ///
15833 /// Corresponding properties: Google Merchant Center property
15834 /// [google_product_category][mc_google_product_category]. Schema.org property
15835 /// [Product.category] (<https://schema.org/category>).
15836 ///
15837 /// [google.cloud.retail.v2.Product]: crate::model::Product
15838 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15839 pub categories: std::vec::Vec<std::string::String>,
15840
15841 /// Required. Product title.
15842 ///
15843 /// This field must be a UTF-8 encoded string with a length limit of 1,000
15844 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15845 ///
15846 /// Corresponding properties: Google Merchant Center property
15847 /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15848 /// property [Product.name](https://schema.org/name).
15849 pub title: std::string::String,
15850
15851 /// The brands of the product.
15852 ///
15853 /// A maximum of 30 brands are allowed unless overridden through the Google
15854 /// Cloud console. Each
15855 /// brand must be a UTF-8 encoded string with a length limit of 1,000
15856 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15857 ///
15858 /// Corresponding properties: Google Merchant Center property
15859 /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15860 /// property [Product.brand](https://schema.org/brand).
15861 pub brands: std::vec::Vec<std::string::String>,
15862
15863 /// Product description.
15864 ///
15865 /// This field must be a UTF-8 encoded string with a length limit of 5,000
15866 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15867 ///
15868 /// Corresponding properties: Google Merchant Center property
15869 /// [description](https://support.google.com/merchants/answer/6324468).
15870 /// Schema.org property [Product.description](https://schema.org/description).
15871 pub description: std::string::String,
15872
15873 /// Language of the title/description and other string attributes. Use language
15874 /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15875 ///
15876 /// For product prediction, this field is ignored and the model automatically
15877 /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15878 /// can include text in different languages, but duplicating
15879 /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15880 /// languages can result in degraded model performance.
15881 ///
15882 /// For product search this field is in use. It defaults to "en-US" if unset.
15883 ///
15884 /// [google.cloud.retail.v2.Product]: crate::model::Product
15885 pub language_code: std::string::String,
15886
15887 /// Highly encouraged. Extra product attributes to be included. For example,
15888 /// for products, this could include the store name, vendor, style, color, etc.
15889 /// These are very strong signals for recommendation model, thus we highly
15890 /// recommend providing the attributes here.
15891 ///
15892 /// Features that can take on one of a limited number of possible values. Two
15893 /// types of features can be set are:
15894 ///
15895 /// Textual features. some examples would be the brand/maker of a product, or
15896 /// country of a customer. Numerical features. Some examples would be the
15897 /// height/weight of a product, or age of a customer.
15898 ///
15899 /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15900 /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15901 /// }`.
15902 ///
15903 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15904 /// error is returned:
15905 ///
15906 /// * Max entries count: 200.
15907 /// * The key must be a UTF-8 encoded string with a length limit of 128
15908 /// characters.
15909 /// * For indexable attribute, the key must match the pattern:
15910 /// `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15911 /// `KEY_1_LIKE_THIS`.
15912 /// * For text attributes, at most 400 values are allowed. Empty values are not
15913 /// allowed. Each value must be a non-empty UTF-8 encoded string with a
15914 /// length limit of 256 characters.
15915 /// * For number attributes, at most 400 values are allowed.
15916 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15917
15918 /// Custom tags associated with the product.
15919 ///
15920 /// At most 250 values are allowed per
15921 /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15922 /// encoded string with a length limit of 1,000 characters. Otherwise, an
15923 /// INVALID_ARGUMENT error is returned.
15924 ///
15925 /// This tag can be used for filtering recommendation results by passing the
15926 /// tag as part of the
15927 /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15928 ///
15929 /// Corresponding properties: Google Merchant Center property
15930 /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15931 ///
15932 /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15933 /// [google.cloud.retail.v2.Product]: crate::model::Product
15934 pub tags: std::vec::Vec<std::string::String>,
15935
15936 /// Product price and cost information.
15937 ///
15938 /// Corresponding properties: Google Merchant Center property
15939 /// [price](https://support.google.com/merchants/answer/6324371).
15940 pub price_info: std::option::Option<crate::model::PriceInfo>,
15941
15942 /// The rating of this product.
15943 pub rating: std::option::Option<crate::model::Rating>,
15944
15945 /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15946 /// available for
15947 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15948 /// that this is only applicable to
15949 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15950 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15951 /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15952 ///
15953 /// [google.cloud.retail.v2.Product]: crate::model::Product
15954 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15955 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15956 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15957 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15958 pub available_time: std::option::Option<wkt::Timestamp>,
15959
15960 /// The online availability of the [Product][google.cloud.retail.v2.Product].
15961 /// Default to
15962 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15963 ///
15964 /// For primary products with variants set the availability of the primary as
15965 /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15966 /// and set the true availability at the variant level. This way the primary
15967 /// product will be considered "in stock" as long as it has at least one
15968 /// variant in stock.
15969 ///
15970 /// For primary products with no variants set the true availability at the
15971 /// primary level.
15972 ///
15973 /// Corresponding properties: Google Merchant Center property
15974 /// [availability](https://support.google.com/merchants/answer/6324448).
15975 /// Schema.org property [Offer.availability](https://schema.org/availability).
15976 ///
15977 /// [google.cloud.retail.v2.Product]: crate::model::Product
15978 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15979 /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15980 pub availability: crate::model::product::Availability,
15981
15982 /// The available quantity of the item.
15983 pub available_quantity: std::option::Option<wkt::Int32Value>,
15984
15985 /// Fulfillment information, such as the store IDs for in-store pickup or
15986 /// region IDs for different shipping methods.
15987 ///
15988 /// All the elements must have distinct
15989 /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15990 /// Otherwise, an INVALID_ARGUMENT error is returned.
15991 ///
15992 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15993 pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15994
15995 /// Canonical URL directly linking to the product detail page.
15996 ///
15997 /// It is strongly recommended to provide a valid uri for the product,
15998 /// otherwise the service performance could be significantly degraded.
15999 ///
16000 /// This field must be a UTF-8 encoded string with a length limit of 5,000
16001 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
16002 ///
16003 /// Corresponding properties: Google Merchant Center property
16004 /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
16005 /// property [Offer.url](https://schema.org/url).
16006 pub uri: std::string::String,
16007
16008 /// Product images for the product. We highly recommend putting the main
16009 /// image first.
16010 ///
16011 /// A maximum of 300 images are allowed.
16012 ///
16013 /// Corresponding properties: Google Merchant Center property
16014 /// [image_link](https://support.google.com/merchants/answer/6324350).
16015 /// Schema.org property [Product.image](https://schema.org/image).
16016 pub images: std::vec::Vec<crate::model::Image>,
16017
16018 /// The target group associated with a given audience (e.g. male, veterans,
16019 /// car owners, musicians, etc.) of the product.
16020 pub audience: std::option::Option<crate::model::Audience>,
16021
16022 /// The color of the product.
16023 ///
16024 /// Corresponding properties: Google Merchant Center property
16025 /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
16026 /// property [Product.color](https://schema.org/color).
16027 pub color_info: std::option::Option<crate::model::ColorInfo>,
16028
16029 /// The size of the product. To represent different size systems or size types,
16030 /// consider using this format: [[[size_system:]size_type:]size_value].
16031 ///
16032 /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
16033 /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
16034 /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
16035 /// both size system and size type are empty, while size value is "32 inches".
16036 ///
16037 /// A maximum of 20 values are allowed per
16038 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16039 /// encoded string with a length limit of 128 characters. Otherwise, an
16040 /// INVALID_ARGUMENT error is returned.
16041 ///
16042 /// Corresponding properties: Google Merchant Center property
16043 /// [size](https://support.google.com/merchants/answer/6324492),
16044 /// [size_type](https://support.google.com/merchants/answer/6324497), and
16045 /// [size_system](https://support.google.com/merchants/answer/6324502).
16046 /// Schema.org property [Product.size](https://schema.org/size).
16047 ///
16048 /// [google.cloud.retail.v2.Product]: crate::model::Product
16049 pub sizes: std::vec::Vec<std::string::String>,
16050
16051 /// The material of the product. For example, "leather", "wooden".
16052 ///
16053 /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
16054 /// string with a length limit of 200 characters. Otherwise, an
16055 /// INVALID_ARGUMENT error is returned.
16056 ///
16057 /// Corresponding properties: Google Merchant Center property
16058 /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
16059 /// property [Product.material](https://schema.org/material).
16060 pub materials: std::vec::Vec<std::string::String>,
16061
16062 /// The pattern or graphic print of the product. For example, "striped", "polka
16063 /// dot", "paisley".
16064 ///
16065 /// A maximum of 20 values are allowed per
16066 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16067 /// encoded string with a length limit of 128 characters. Otherwise, an
16068 /// INVALID_ARGUMENT error is returned.
16069 ///
16070 /// Corresponding properties: Google Merchant Center property
16071 /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
16072 /// property [Product.pattern](https://schema.org/pattern).
16073 ///
16074 /// [google.cloud.retail.v2.Product]: crate::model::Product
16075 pub patterns: std::vec::Vec<std::string::String>,
16076
16077 /// The condition of the product. Strongly encouraged to use the standard
16078 /// values: "new", "refurbished", "used".
16079 ///
16080 /// A maximum of 1 value is allowed per
16081 /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16082 /// encoded string with a length limit of 128 characters. Otherwise, an
16083 /// INVALID_ARGUMENT error is returned.
16084 ///
16085 /// Corresponding properties: Google Merchant Center property
16086 /// [condition](https://support.google.com/merchants/answer/6324469).
16087 /// Schema.org property
16088 /// [Offer.itemCondition](https://schema.org/itemCondition).
16089 ///
16090 /// [google.cloud.retail.v2.Product]: crate::model::Product
16091 pub conditions: std::vec::Vec<std::string::String>,
16092
16093 /// The promotions applied to the product. A maximum of 10 values are allowed
16094 /// per [Product][google.cloud.retail.v2.Product]. Only
16095 /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
16096 /// will be used, other fields will be ignored if set.
16097 ///
16098 /// [google.cloud.retail.v2.Product]: crate::model::Product
16099 /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
16100 pub promotions: std::vec::Vec<crate::model::Promotion>,
16101
16102 /// The timestamp when the product is published by the retailer for the first
16103 /// time, which indicates the freshness of the products. Note that this field
16104 /// is different from
16105 /// [available_time][google.cloud.retail.v2.Product.available_time], given it
16106 /// purely describes product freshness regardless of when it is available on
16107 /// search and recommendation.
16108 ///
16109 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
16110 pub publish_time: std::option::Option<wkt::Timestamp>,
16111
16112 /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
16113 /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
16114 ///
16115 /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
16116 ///
16117 /// * [audience][google.cloud.retail.v2.Product.audience]
16118 /// * [availability][google.cloud.retail.v2.Product.availability]
16119 /// * [brands][google.cloud.retail.v2.Product.brands]
16120 /// * [color_info][google.cloud.retail.v2.Product.color_info]
16121 /// * [conditions][google.cloud.retail.v2.Product.conditions]
16122 /// * [gtin][google.cloud.retail.v2.Product.gtin]
16123 /// * [materials][google.cloud.retail.v2.Product.materials]
16124 /// * [name][google.cloud.retail.v2.Product.name]
16125 /// * [patterns][google.cloud.retail.v2.Product.patterns]
16126 /// * [price_info][google.cloud.retail.v2.Product.price_info]
16127 /// * [rating][google.cloud.retail.v2.Product.rating]
16128 /// * [sizes][google.cloud.retail.v2.Product.sizes]
16129 /// * [title][google.cloud.retail.v2.Product.title]
16130 /// * [uri][google.cloud.retail.v2.Product.uri]
16131 ///
16132 /// Supported fields only for
16133 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16134 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
16135 ///
16136 /// * [categories][google.cloud.retail.v2.Product.categories]
16137 /// * [description][google.cloud.retail.v2.Product.description]
16138 /// * [images][google.cloud.retail.v2.Product.images]
16139 ///
16140 /// Supported fields only for
16141 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
16142 ///
16143 /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
16144 ///
16145 /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
16146 /// retrievable, include paths of the form "attributes.key" where "key" is the
16147 /// key of a custom attribute, as specified in
16148 /// [attributes][google.cloud.retail.v2.Product.attributes].
16149 ///
16150 /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16151 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
16152 /// following fields are always returned in
16153 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
16154 ///
16155 /// * [name][google.cloud.retail.v2.Product.name]
16156 ///
16157 /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
16158 /// following fields are always returned in by default:
16159 ///
16160 /// * [name][google.cloud.retail.v2.Product.name]
16161 /// * [color_info][google.cloud.retail.v2.Product.color_info]
16162 ///
16163 /// Note: Returning more fields in
16164 /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
16165 /// response payload size and serving latency.
16166 ///
16167 /// This field is deprecated. Use the retrievable site-wide control instead.
16168 ///
16169 /// [google.cloud.retail.v2.Product]: crate::model::Product
16170 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
16171 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16172 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16173 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
16174 /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
16175 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
16176 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
16177 /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
16178 /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
16179 /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
16180 /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
16181 /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
16182 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
16183 /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
16184 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
16185 /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
16186 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
16187 /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
16188 /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
16189 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
16190 /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
16191 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
16192 /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
16193 #[deprecated]
16194 pub retrievable_fields: std::option::Option<wkt::FieldMask>,
16195
16196 /// Output only. Product variants grouped together on primary product which
16197 /// share similar product attributes. It's automatically grouped by
16198 /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
16199 /// all the product variants. Only populated for
16200 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16201 /// [Product][google.cloud.retail.v2.Product]s.
16202 ///
16203 /// Note: This field is OUTPUT_ONLY for
16204 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
16205 /// Do not set this field in API requests.
16206 ///
16207 /// [google.cloud.retail.v2.Product]: crate::model::Product
16208 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16209 /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
16210 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
16211 pub variants: std::vec::Vec<crate::model::Product>,
16212
16213 /// Output only. A list of local inventories specific to different places.
16214 ///
16215 /// This field can be managed by
16216 /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
16217 /// and
16218 /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
16219 /// APIs if fine-grained, high-volume updates are necessary.
16220 ///
16221 /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
16222 /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
16223 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
16224
16225 #[allow(missing_docs)]
16226 pub expiration: std::option::Option<crate::model::product::Expiration>,
16227
16228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16229}
16230
16231impl Product {
16232 /// Creates a new default instance.
16233 pub fn new() -> Self {
16234 std::default::Default::default()
16235 }
16236
16237 /// Sets the value of [name][crate::model::Product::name].
16238 ///
16239 /// # Example
16240 /// ```ignore,no_run
16241 /// # use google_cloud_retail_v2::model::Product;
16242 /// # let project_id = "project_id";
16243 /// # let location_id = "location_id";
16244 /// # let catalog_id = "catalog_id";
16245 /// # let branch_id = "branch_id";
16246 /// # let product_id = "product_id";
16247 /// let x = Product::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
16248 /// ```
16249 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16250 self.name = v.into();
16251 self
16252 }
16253
16254 /// Sets the value of [id][crate::model::Product::id].
16255 ///
16256 /// # Example
16257 /// ```ignore,no_run
16258 /// # use google_cloud_retail_v2::model::Product;
16259 /// let x = Product::new().set_id("example");
16260 /// ```
16261 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16262 self.id = v.into();
16263 self
16264 }
16265
16266 /// Sets the value of [r#type][crate::model::Product::type].
16267 ///
16268 /// # Example
16269 /// ```ignore,no_run
16270 /// # use google_cloud_retail_v2::model::Product;
16271 /// use google_cloud_retail_v2::model::product::Type;
16272 /// let x0 = Product::new().set_type(Type::Primary);
16273 /// let x1 = Product::new().set_type(Type::Variant);
16274 /// let x2 = Product::new().set_type(Type::Collection);
16275 /// ```
16276 pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16277 self.r#type = v.into();
16278 self
16279 }
16280
16281 /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16282 ///
16283 /// # Example
16284 /// ```ignore,no_run
16285 /// # use google_cloud_retail_v2::model::Product;
16286 /// let x = Product::new().set_primary_product_id("example");
16287 /// ```
16288 pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16289 mut self,
16290 v: T,
16291 ) -> Self {
16292 self.primary_product_id = v.into();
16293 self
16294 }
16295
16296 /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16297 ///
16298 /// # Example
16299 /// ```ignore,no_run
16300 /// # use google_cloud_retail_v2::model::Product;
16301 /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16302 /// ```
16303 pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16304 where
16305 T: std::iter::IntoIterator<Item = V>,
16306 V: std::convert::Into<std::string::String>,
16307 {
16308 use std::iter::Iterator;
16309 self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16310 self
16311 }
16312
16313 /// Sets the value of [gtin][crate::model::Product::gtin].
16314 ///
16315 /// # Example
16316 /// ```ignore,no_run
16317 /// # use google_cloud_retail_v2::model::Product;
16318 /// let x = Product::new().set_gtin("example");
16319 /// ```
16320 pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16321 self.gtin = v.into();
16322 self
16323 }
16324
16325 /// Sets the value of [categories][crate::model::Product::categories].
16326 ///
16327 /// # Example
16328 /// ```ignore,no_run
16329 /// # use google_cloud_retail_v2::model::Product;
16330 /// let x = Product::new().set_categories(["a", "b", "c"]);
16331 /// ```
16332 pub fn set_categories<T, V>(mut self, v: T) -> Self
16333 where
16334 T: std::iter::IntoIterator<Item = V>,
16335 V: std::convert::Into<std::string::String>,
16336 {
16337 use std::iter::Iterator;
16338 self.categories = v.into_iter().map(|i| i.into()).collect();
16339 self
16340 }
16341
16342 /// Sets the value of [title][crate::model::Product::title].
16343 ///
16344 /// # Example
16345 /// ```ignore,no_run
16346 /// # use google_cloud_retail_v2::model::Product;
16347 /// let x = Product::new().set_title("example");
16348 /// ```
16349 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16350 self.title = v.into();
16351 self
16352 }
16353
16354 /// Sets the value of [brands][crate::model::Product::brands].
16355 ///
16356 /// # Example
16357 /// ```ignore,no_run
16358 /// # use google_cloud_retail_v2::model::Product;
16359 /// let x = Product::new().set_brands(["a", "b", "c"]);
16360 /// ```
16361 pub fn set_brands<T, V>(mut self, v: T) -> Self
16362 where
16363 T: std::iter::IntoIterator<Item = V>,
16364 V: std::convert::Into<std::string::String>,
16365 {
16366 use std::iter::Iterator;
16367 self.brands = v.into_iter().map(|i| i.into()).collect();
16368 self
16369 }
16370
16371 /// Sets the value of [description][crate::model::Product::description].
16372 ///
16373 /// # Example
16374 /// ```ignore,no_run
16375 /// # use google_cloud_retail_v2::model::Product;
16376 /// let x = Product::new().set_description("example");
16377 /// ```
16378 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16379 self.description = v.into();
16380 self
16381 }
16382
16383 /// Sets the value of [language_code][crate::model::Product::language_code].
16384 ///
16385 /// # Example
16386 /// ```ignore,no_run
16387 /// # use google_cloud_retail_v2::model::Product;
16388 /// let x = Product::new().set_language_code("example");
16389 /// ```
16390 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16391 self.language_code = v.into();
16392 self
16393 }
16394
16395 /// Sets the value of [attributes][crate::model::Product::attributes].
16396 ///
16397 /// # Example
16398 /// ```ignore,no_run
16399 /// # use google_cloud_retail_v2::model::Product;
16400 /// use google_cloud_retail_v2::model::CustomAttribute;
16401 /// let x = Product::new().set_attributes([
16402 /// ("key0", CustomAttribute::default()/* use setters */),
16403 /// ("key1", CustomAttribute::default()/* use (different) setters */),
16404 /// ]);
16405 /// ```
16406 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16407 where
16408 T: std::iter::IntoIterator<Item = (K, V)>,
16409 K: std::convert::Into<std::string::String>,
16410 V: std::convert::Into<crate::model::CustomAttribute>,
16411 {
16412 use std::iter::Iterator;
16413 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16414 self
16415 }
16416
16417 /// Sets the value of [tags][crate::model::Product::tags].
16418 ///
16419 /// # Example
16420 /// ```ignore,no_run
16421 /// # use google_cloud_retail_v2::model::Product;
16422 /// let x = Product::new().set_tags(["a", "b", "c"]);
16423 /// ```
16424 pub fn set_tags<T, V>(mut self, v: T) -> Self
16425 where
16426 T: std::iter::IntoIterator<Item = V>,
16427 V: std::convert::Into<std::string::String>,
16428 {
16429 use std::iter::Iterator;
16430 self.tags = v.into_iter().map(|i| i.into()).collect();
16431 self
16432 }
16433
16434 /// Sets the value of [price_info][crate::model::Product::price_info].
16435 ///
16436 /// # Example
16437 /// ```ignore,no_run
16438 /// # use google_cloud_retail_v2::model::Product;
16439 /// use google_cloud_retail_v2::model::PriceInfo;
16440 /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16441 /// ```
16442 pub fn set_price_info<T>(mut self, v: T) -> Self
16443 where
16444 T: std::convert::Into<crate::model::PriceInfo>,
16445 {
16446 self.price_info = std::option::Option::Some(v.into());
16447 self
16448 }
16449
16450 /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16451 ///
16452 /// # Example
16453 /// ```ignore,no_run
16454 /// # use google_cloud_retail_v2::model::Product;
16455 /// use google_cloud_retail_v2::model::PriceInfo;
16456 /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16457 /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16458 /// ```
16459 pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16460 where
16461 T: std::convert::Into<crate::model::PriceInfo>,
16462 {
16463 self.price_info = v.map(|x| x.into());
16464 self
16465 }
16466
16467 /// Sets the value of [rating][crate::model::Product::rating].
16468 ///
16469 /// # Example
16470 /// ```ignore,no_run
16471 /// # use google_cloud_retail_v2::model::Product;
16472 /// use google_cloud_retail_v2::model::Rating;
16473 /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16474 /// ```
16475 pub fn set_rating<T>(mut self, v: T) -> Self
16476 where
16477 T: std::convert::Into<crate::model::Rating>,
16478 {
16479 self.rating = std::option::Option::Some(v.into());
16480 self
16481 }
16482
16483 /// Sets or clears the value of [rating][crate::model::Product::rating].
16484 ///
16485 /// # Example
16486 /// ```ignore,no_run
16487 /// # use google_cloud_retail_v2::model::Product;
16488 /// use google_cloud_retail_v2::model::Rating;
16489 /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16490 /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16491 /// ```
16492 pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16493 where
16494 T: std::convert::Into<crate::model::Rating>,
16495 {
16496 self.rating = v.map(|x| x.into());
16497 self
16498 }
16499
16500 /// Sets the value of [available_time][crate::model::Product::available_time].
16501 ///
16502 /// # Example
16503 /// ```ignore,no_run
16504 /// # use google_cloud_retail_v2::model::Product;
16505 /// use wkt::Timestamp;
16506 /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16507 /// ```
16508 pub fn set_available_time<T>(mut self, v: T) -> Self
16509 where
16510 T: std::convert::Into<wkt::Timestamp>,
16511 {
16512 self.available_time = std::option::Option::Some(v.into());
16513 self
16514 }
16515
16516 /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16517 ///
16518 /// # Example
16519 /// ```ignore,no_run
16520 /// # use google_cloud_retail_v2::model::Product;
16521 /// use wkt::Timestamp;
16522 /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16523 /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16524 /// ```
16525 pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16526 where
16527 T: std::convert::Into<wkt::Timestamp>,
16528 {
16529 self.available_time = v.map(|x| x.into());
16530 self
16531 }
16532
16533 /// Sets the value of [availability][crate::model::Product::availability].
16534 ///
16535 /// # Example
16536 /// ```ignore,no_run
16537 /// # use google_cloud_retail_v2::model::Product;
16538 /// use google_cloud_retail_v2::model::product::Availability;
16539 /// let x0 = Product::new().set_availability(Availability::InStock);
16540 /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16541 /// let x2 = Product::new().set_availability(Availability::Preorder);
16542 /// ```
16543 pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16544 mut self,
16545 v: T,
16546 ) -> Self {
16547 self.availability = v.into();
16548 self
16549 }
16550
16551 /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16552 ///
16553 /// # Example
16554 /// ```ignore,no_run
16555 /// # use google_cloud_retail_v2::model::Product;
16556 /// use wkt::Int32Value;
16557 /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16558 /// ```
16559 pub fn set_available_quantity<T>(mut self, v: T) -> Self
16560 where
16561 T: std::convert::Into<wkt::Int32Value>,
16562 {
16563 self.available_quantity = std::option::Option::Some(v.into());
16564 self
16565 }
16566
16567 /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16568 ///
16569 /// # Example
16570 /// ```ignore,no_run
16571 /// # use google_cloud_retail_v2::model::Product;
16572 /// use wkt::Int32Value;
16573 /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16574 /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16575 /// ```
16576 pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16577 where
16578 T: std::convert::Into<wkt::Int32Value>,
16579 {
16580 self.available_quantity = v.map(|x| x.into());
16581 self
16582 }
16583
16584 /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16585 ///
16586 /// # Example
16587 /// ```ignore,no_run
16588 /// # use google_cloud_retail_v2::model::Product;
16589 /// use google_cloud_retail_v2::model::FulfillmentInfo;
16590 /// let x = Product::new()
16591 /// .set_fulfillment_info([
16592 /// FulfillmentInfo::default()/* use setters */,
16593 /// FulfillmentInfo::default()/* use (different) setters */,
16594 /// ]);
16595 /// ```
16596 pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16597 where
16598 T: std::iter::IntoIterator<Item = V>,
16599 V: std::convert::Into<crate::model::FulfillmentInfo>,
16600 {
16601 use std::iter::Iterator;
16602 self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16603 self
16604 }
16605
16606 /// Sets the value of [uri][crate::model::Product::uri].
16607 ///
16608 /// # Example
16609 /// ```ignore,no_run
16610 /// # use google_cloud_retail_v2::model::Product;
16611 /// let x = Product::new().set_uri("example");
16612 /// ```
16613 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16614 self.uri = v.into();
16615 self
16616 }
16617
16618 /// Sets the value of [images][crate::model::Product::images].
16619 ///
16620 /// # Example
16621 /// ```ignore,no_run
16622 /// # use google_cloud_retail_v2::model::Product;
16623 /// use google_cloud_retail_v2::model::Image;
16624 /// let x = Product::new()
16625 /// .set_images([
16626 /// Image::default()/* use setters */,
16627 /// Image::default()/* use (different) setters */,
16628 /// ]);
16629 /// ```
16630 pub fn set_images<T, V>(mut self, v: T) -> Self
16631 where
16632 T: std::iter::IntoIterator<Item = V>,
16633 V: std::convert::Into<crate::model::Image>,
16634 {
16635 use std::iter::Iterator;
16636 self.images = v.into_iter().map(|i| i.into()).collect();
16637 self
16638 }
16639
16640 /// Sets the value of [audience][crate::model::Product::audience].
16641 ///
16642 /// # Example
16643 /// ```ignore,no_run
16644 /// # use google_cloud_retail_v2::model::Product;
16645 /// use google_cloud_retail_v2::model::Audience;
16646 /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16647 /// ```
16648 pub fn set_audience<T>(mut self, v: T) -> Self
16649 where
16650 T: std::convert::Into<crate::model::Audience>,
16651 {
16652 self.audience = std::option::Option::Some(v.into());
16653 self
16654 }
16655
16656 /// Sets or clears the value of [audience][crate::model::Product::audience].
16657 ///
16658 /// # Example
16659 /// ```ignore,no_run
16660 /// # use google_cloud_retail_v2::model::Product;
16661 /// use google_cloud_retail_v2::model::Audience;
16662 /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16663 /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16664 /// ```
16665 pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16666 where
16667 T: std::convert::Into<crate::model::Audience>,
16668 {
16669 self.audience = v.map(|x| x.into());
16670 self
16671 }
16672
16673 /// Sets the value of [color_info][crate::model::Product::color_info].
16674 ///
16675 /// # Example
16676 /// ```ignore,no_run
16677 /// # use google_cloud_retail_v2::model::Product;
16678 /// use google_cloud_retail_v2::model::ColorInfo;
16679 /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16680 /// ```
16681 pub fn set_color_info<T>(mut self, v: T) -> Self
16682 where
16683 T: std::convert::Into<crate::model::ColorInfo>,
16684 {
16685 self.color_info = std::option::Option::Some(v.into());
16686 self
16687 }
16688
16689 /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16690 ///
16691 /// # Example
16692 /// ```ignore,no_run
16693 /// # use google_cloud_retail_v2::model::Product;
16694 /// use google_cloud_retail_v2::model::ColorInfo;
16695 /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16696 /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16697 /// ```
16698 pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16699 where
16700 T: std::convert::Into<crate::model::ColorInfo>,
16701 {
16702 self.color_info = v.map(|x| x.into());
16703 self
16704 }
16705
16706 /// Sets the value of [sizes][crate::model::Product::sizes].
16707 ///
16708 /// # Example
16709 /// ```ignore,no_run
16710 /// # use google_cloud_retail_v2::model::Product;
16711 /// let x = Product::new().set_sizes(["a", "b", "c"]);
16712 /// ```
16713 pub fn set_sizes<T, V>(mut self, v: T) -> Self
16714 where
16715 T: std::iter::IntoIterator<Item = V>,
16716 V: std::convert::Into<std::string::String>,
16717 {
16718 use std::iter::Iterator;
16719 self.sizes = v.into_iter().map(|i| i.into()).collect();
16720 self
16721 }
16722
16723 /// Sets the value of [materials][crate::model::Product::materials].
16724 ///
16725 /// # Example
16726 /// ```ignore,no_run
16727 /// # use google_cloud_retail_v2::model::Product;
16728 /// let x = Product::new().set_materials(["a", "b", "c"]);
16729 /// ```
16730 pub fn set_materials<T, V>(mut self, v: T) -> Self
16731 where
16732 T: std::iter::IntoIterator<Item = V>,
16733 V: std::convert::Into<std::string::String>,
16734 {
16735 use std::iter::Iterator;
16736 self.materials = v.into_iter().map(|i| i.into()).collect();
16737 self
16738 }
16739
16740 /// Sets the value of [patterns][crate::model::Product::patterns].
16741 ///
16742 /// # Example
16743 /// ```ignore,no_run
16744 /// # use google_cloud_retail_v2::model::Product;
16745 /// let x = Product::new().set_patterns(["a", "b", "c"]);
16746 /// ```
16747 pub fn set_patterns<T, V>(mut self, v: T) -> Self
16748 where
16749 T: std::iter::IntoIterator<Item = V>,
16750 V: std::convert::Into<std::string::String>,
16751 {
16752 use std::iter::Iterator;
16753 self.patterns = v.into_iter().map(|i| i.into()).collect();
16754 self
16755 }
16756
16757 /// Sets the value of [conditions][crate::model::Product::conditions].
16758 ///
16759 /// # Example
16760 /// ```ignore,no_run
16761 /// # use google_cloud_retail_v2::model::Product;
16762 /// let x = Product::new().set_conditions(["a", "b", "c"]);
16763 /// ```
16764 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16765 where
16766 T: std::iter::IntoIterator<Item = V>,
16767 V: std::convert::Into<std::string::String>,
16768 {
16769 use std::iter::Iterator;
16770 self.conditions = v.into_iter().map(|i| i.into()).collect();
16771 self
16772 }
16773
16774 /// Sets the value of [promotions][crate::model::Product::promotions].
16775 ///
16776 /// # Example
16777 /// ```ignore,no_run
16778 /// # use google_cloud_retail_v2::model::Product;
16779 /// use google_cloud_retail_v2::model::Promotion;
16780 /// let x = Product::new()
16781 /// .set_promotions([
16782 /// Promotion::default()/* use setters */,
16783 /// Promotion::default()/* use (different) setters */,
16784 /// ]);
16785 /// ```
16786 pub fn set_promotions<T, V>(mut self, v: T) -> Self
16787 where
16788 T: std::iter::IntoIterator<Item = V>,
16789 V: std::convert::Into<crate::model::Promotion>,
16790 {
16791 use std::iter::Iterator;
16792 self.promotions = v.into_iter().map(|i| i.into()).collect();
16793 self
16794 }
16795
16796 /// Sets the value of [publish_time][crate::model::Product::publish_time].
16797 ///
16798 /// # Example
16799 /// ```ignore,no_run
16800 /// # use google_cloud_retail_v2::model::Product;
16801 /// use wkt::Timestamp;
16802 /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16803 /// ```
16804 pub fn set_publish_time<T>(mut self, v: T) -> Self
16805 where
16806 T: std::convert::Into<wkt::Timestamp>,
16807 {
16808 self.publish_time = std::option::Option::Some(v.into());
16809 self
16810 }
16811
16812 /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16813 ///
16814 /// # Example
16815 /// ```ignore,no_run
16816 /// # use google_cloud_retail_v2::model::Product;
16817 /// use wkt::Timestamp;
16818 /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16819 /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16820 /// ```
16821 pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16822 where
16823 T: std::convert::Into<wkt::Timestamp>,
16824 {
16825 self.publish_time = v.map(|x| x.into());
16826 self
16827 }
16828
16829 /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16830 ///
16831 /// # Example
16832 /// ```ignore,no_run
16833 /// # use google_cloud_retail_v2::model::Product;
16834 /// use wkt::FieldMask;
16835 /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16836 /// ```
16837 #[deprecated]
16838 pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16839 where
16840 T: std::convert::Into<wkt::FieldMask>,
16841 {
16842 self.retrievable_fields = std::option::Option::Some(v.into());
16843 self
16844 }
16845
16846 /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16847 ///
16848 /// # Example
16849 /// ```ignore,no_run
16850 /// # use google_cloud_retail_v2::model::Product;
16851 /// use wkt::FieldMask;
16852 /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16853 /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16854 /// ```
16855 #[deprecated]
16856 pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16857 where
16858 T: std::convert::Into<wkt::FieldMask>,
16859 {
16860 self.retrievable_fields = v.map(|x| x.into());
16861 self
16862 }
16863
16864 /// Sets the value of [variants][crate::model::Product::variants].
16865 ///
16866 /// # Example
16867 /// ```ignore,no_run
16868 /// # use google_cloud_retail_v2::model::Product;
16869 /// let x = Product::new()
16870 /// .set_variants([
16871 /// Product::default()/* use setters */,
16872 /// Product::default()/* use (different) setters */,
16873 /// ]);
16874 /// ```
16875 pub fn set_variants<T, V>(mut self, v: T) -> Self
16876 where
16877 T: std::iter::IntoIterator<Item = V>,
16878 V: std::convert::Into<crate::model::Product>,
16879 {
16880 use std::iter::Iterator;
16881 self.variants = v.into_iter().map(|i| i.into()).collect();
16882 self
16883 }
16884
16885 /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16886 ///
16887 /// # Example
16888 /// ```ignore,no_run
16889 /// # use google_cloud_retail_v2::model::Product;
16890 /// use google_cloud_retail_v2::model::LocalInventory;
16891 /// let x = Product::new()
16892 /// .set_local_inventories([
16893 /// LocalInventory::default()/* use setters */,
16894 /// LocalInventory::default()/* use (different) setters */,
16895 /// ]);
16896 /// ```
16897 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16898 where
16899 T: std::iter::IntoIterator<Item = V>,
16900 V: std::convert::Into<crate::model::LocalInventory>,
16901 {
16902 use std::iter::Iterator;
16903 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16904 self
16905 }
16906
16907 /// Sets the value of [expiration][crate::model::Product::expiration].
16908 ///
16909 /// Note that all the setters affecting `expiration` are mutually
16910 /// exclusive.
16911 ///
16912 /// # Example
16913 /// ```ignore,no_run
16914 /// # use google_cloud_retail_v2::model::Product;
16915 /// use wkt::Timestamp;
16916 /// let x = Product::new().set_expiration(Some(
16917 /// google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16918 /// ```
16919 pub fn set_expiration<
16920 T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16921 >(
16922 mut self,
16923 v: T,
16924 ) -> Self {
16925 self.expiration = v.into();
16926 self
16927 }
16928
16929 /// The value of [expiration][crate::model::Product::expiration]
16930 /// if it holds a `ExpireTime`, `None` if the field is not set or
16931 /// holds a different branch.
16932 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16933 #[allow(unreachable_patterns)]
16934 self.expiration.as_ref().and_then(|v| match v {
16935 crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16936 _ => std::option::Option::None,
16937 })
16938 }
16939
16940 /// Sets the value of [expiration][crate::model::Product::expiration]
16941 /// to hold a `ExpireTime`.
16942 ///
16943 /// Note that all the setters affecting `expiration` are
16944 /// mutually exclusive.
16945 ///
16946 /// # Example
16947 /// ```ignore,no_run
16948 /// # use google_cloud_retail_v2::model::Product;
16949 /// use wkt::Timestamp;
16950 /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16951 /// assert!(x.expire_time().is_some());
16952 /// assert!(x.ttl().is_none());
16953 /// ```
16954 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16955 mut self,
16956 v: T,
16957 ) -> Self {
16958 self.expiration =
16959 std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16960 self
16961 }
16962
16963 /// The value of [expiration][crate::model::Product::expiration]
16964 /// if it holds a `Ttl`, `None` if the field is not set or
16965 /// holds a different branch.
16966 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16967 #[allow(unreachable_patterns)]
16968 self.expiration.as_ref().and_then(|v| match v {
16969 crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16970 _ => std::option::Option::None,
16971 })
16972 }
16973
16974 /// Sets the value of [expiration][crate::model::Product::expiration]
16975 /// to hold a `Ttl`.
16976 ///
16977 /// Note that all the setters affecting `expiration` are
16978 /// mutually exclusive.
16979 ///
16980 /// # Example
16981 /// ```ignore,no_run
16982 /// # use google_cloud_retail_v2::model::Product;
16983 /// use wkt::Duration;
16984 /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16985 /// assert!(x.ttl().is_some());
16986 /// assert!(x.expire_time().is_none());
16987 /// ```
16988 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16989 self.expiration =
16990 std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16991 self
16992 }
16993}
16994
16995impl wkt::message::Message for Product {
16996 fn typename() -> &'static str {
16997 "type.googleapis.com/google.cloud.retail.v2.Product"
16998 }
16999}
17000
17001/// Defines additional types related to [Product].
17002pub mod product {
17003 #[allow(unused_imports)]
17004 use super::*;
17005
17006 /// The type of this product.
17007 ///
17008 /// # Working with unknown values
17009 ///
17010 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17011 /// additional enum variants at any time. Adding new variants is not considered
17012 /// a breaking change. Applications should write their code in anticipation of:
17013 ///
17014 /// - New values appearing in future releases of the client library, **and**
17015 /// - New values received dynamically, without application changes.
17016 ///
17017 /// Please consult the [Working with enums] section in the user guide for some
17018 /// guidelines.
17019 ///
17020 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17021 #[derive(Clone, Debug, PartialEq)]
17022 #[non_exhaustive]
17023 pub enum Type {
17024 /// Default value. Default to
17025 /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
17026 /// if unset.
17027 ///
17028 /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
17029 Unspecified,
17030 /// The primary type.
17031 ///
17032 /// As the primary unit for predicting, indexing and search serving, a
17033 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17034 /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
17035 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17036 /// [Product][google.cloud.retail.v2.Product]s.
17037 ///
17038 /// [google.cloud.retail.v2.Product]: crate::model::Product
17039 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17040 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17041 Primary,
17042 /// The variant type.
17043 ///
17044 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17045 /// [Product][google.cloud.retail.v2.Product]s usually share some common
17046 /// attributes on the same
17047 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17048 /// [Product][google.cloud.retail.v2.Product]s, but they have variant
17049 /// attributes like different colors, sizes and prices, etc.
17050 ///
17051 /// [google.cloud.retail.v2.Product]: crate::model::Product
17052 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17053 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17054 Variant,
17055 /// The collection type. Collection products are bundled
17056 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17057 /// [Product][google.cloud.retail.v2.Product]s or
17058 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17059 /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
17060 /// as a jewelry set with necklaces, earrings and rings, etc.
17061 ///
17062 /// [google.cloud.retail.v2.Product]: crate::model::Product
17063 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17064 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17065 Collection,
17066 /// If set, the enum was initialized with an unknown value.
17067 ///
17068 /// Applications can examine the value using [Type::value] or
17069 /// [Type::name].
17070 UnknownValue(r#type::UnknownValue),
17071 }
17072
17073 #[doc(hidden)]
17074 pub mod r#type {
17075 #[allow(unused_imports)]
17076 use super::*;
17077 #[derive(Clone, Debug, PartialEq)]
17078 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17079 }
17080
17081 impl Type {
17082 /// Gets the enum value.
17083 ///
17084 /// Returns `None` if the enum contains an unknown value deserialized from
17085 /// the string representation of enums.
17086 pub fn value(&self) -> std::option::Option<i32> {
17087 match self {
17088 Self::Unspecified => std::option::Option::Some(0),
17089 Self::Primary => std::option::Option::Some(1),
17090 Self::Variant => std::option::Option::Some(2),
17091 Self::Collection => std::option::Option::Some(3),
17092 Self::UnknownValue(u) => u.0.value(),
17093 }
17094 }
17095
17096 /// Gets the enum value as a string.
17097 ///
17098 /// Returns `None` if the enum contains an unknown value deserialized from
17099 /// the integer representation of enums.
17100 pub fn name(&self) -> std::option::Option<&str> {
17101 match self {
17102 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
17103 Self::Primary => std::option::Option::Some("PRIMARY"),
17104 Self::Variant => std::option::Option::Some("VARIANT"),
17105 Self::Collection => std::option::Option::Some("COLLECTION"),
17106 Self::UnknownValue(u) => u.0.name(),
17107 }
17108 }
17109 }
17110
17111 impl std::default::Default for Type {
17112 fn default() -> Self {
17113 use std::convert::From;
17114 Self::from(0)
17115 }
17116 }
17117
17118 impl std::fmt::Display for Type {
17119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17120 wkt::internal::display_enum(f, self.name(), self.value())
17121 }
17122 }
17123
17124 impl std::convert::From<i32> for Type {
17125 fn from(value: i32) -> Self {
17126 match value {
17127 0 => Self::Unspecified,
17128 1 => Self::Primary,
17129 2 => Self::Variant,
17130 3 => Self::Collection,
17131 _ => Self::UnknownValue(r#type::UnknownValue(
17132 wkt::internal::UnknownEnumValue::Integer(value),
17133 )),
17134 }
17135 }
17136 }
17137
17138 impl std::convert::From<&str> for Type {
17139 fn from(value: &str) -> Self {
17140 use std::string::ToString;
17141 match value {
17142 "TYPE_UNSPECIFIED" => Self::Unspecified,
17143 "PRIMARY" => Self::Primary,
17144 "VARIANT" => Self::Variant,
17145 "COLLECTION" => Self::Collection,
17146 _ => Self::UnknownValue(r#type::UnknownValue(
17147 wkt::internal::UnknownEnumValue::String(value.to_string()),
17148 )),
17149 }
17150 }
17151 }
17152
17153 impl serde::ser::Serialize for Type {
17154 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17155 where
17156 S: serde::Serializer,
17157 {
17158 match self {
17159 Self::Unspecified => serializer.serialize_i32(0),
17160 Self::Primary => serializer.serialize_i32(1),
17161 Self::Variant => serializer.serialize_i32(2),
17162 Self::Collection => serializer.serialize_i32(3),
17163 Self::UnknownValue(u) => u.0.serialize(serializer),
17164 }
17165 }
17166 }
17167
17168 impl<'de> serde::de::Deserialize<'de> for Type {
17169 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17170 where
17171 D: serde::Deserializer<'de>,
17172 {
17173 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
17174 ".google.cloud.retail.v2.Product.Type",
17175 ))
17176 }
17177 }
17178
17179 /// Product availability. If this field is unspecified, the product is
17180 /// assumed to be in stock.
17181 ///
17182 /// # Working with unknown values
17183 ///
17184 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17185 /// additional enum variants at any time. Adding new variants is not considered
17186 /// a breaking change. Applications should write their code in anticipation of:
17187 ///
17188 /// - New values appearing in future releases of the client library, **and**
17189 /// - New values received dynamically, without application changes.
17190 ///
17191 /// Please consult the [Working with enums] section in the user guide for some
17192 /// guidelines.
17193 ///
17194 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17195 #[derive(Clone, Debug, PartialEq)]
17196 #[non_exhaustive]
17197 pub enum Availability {
17198 /// Default product availability. Default to
17199 /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
17200 /// if unset.
17201 ///
17202 /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
17203 Unspecified,
17204 /// Product in stock.
17205 InStock,
17206 /// Product out of stock.
17207 OutOfStock,
17208 /// Product that is in pre-order state.
17209 Preorder,
17210 /// Product that is back-ordered (i.e. temporarily out of stock).
17211 Backorder,
17212 /// If set, the enum was initialized with an unknown value.
17213 ///
17214 /// Applications can examine the value using [Availability::value] or
17215 /// [Availability::name].
17216 UnknownValue(availability::UnknownValue),
17217 }
17218
17219 #[doc(hidden)]
17220 pub mod availability {
17221 #[allow(unused_imports)]
17222 use super::*;
17223 #[derive(Clone, Debug, PartialEq)]
17224 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17225 }
17226
17227 impl Availability {
17228 /// Gets the enum value.
17229 ///
17230 /// Returns `None` if the enum contains an unknown value deserialized from
17231 /// the string representation of enums.
17232 pub fn value(&self) -> std::option::Option<i32> {
17233 match self {
17234 Self::Unspecified => std::option::Option::Some(0),
17235 Self::InStock => std::option::Option::Some(1),
17236 Self::OutOfStock => std::option::Option::Some(2),
17237 Self::Preorder => std::option::Option::Some(3),
17238 Self::Backorder => std::option::Option::Some(4),
17239 Self::UnknownValue(u) => u.0.value(),
17240 }
17241 }
17242
17243 /// Gets the enum value as a string.
17244 ///
17245 /// Returns `None` if the enum contains an unknown value deserialized from
17246 /// the integer representation of enums.
17247 pub fn name(&self) -> std::option::Option<&str> {
17248 match self {
17249 Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17250 Self::InStock => std::option::Option::Some("IN_STOCK"),
17251 Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17252 Self::Preorder => std::option::Option::Some("PREORDER"),
17253 Self::Backorder => std::option::Option::Some("BACKORDER"),
17254 Self::UnknownValue(u) => u.0.name(),
17255 }
17256 }
17257 }
17258
17259 impl std::default::Default for Availability {
17260 fn default() -> Self {
17261 use std::convert::From;
17262 Self::from(0)
17263 }
17264 }
17265
17266 impl std::fmt::Display for Availability {
17267 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17268 wkt::internal::display_enum(f, self.name(), self.value())
17269 }
17270 }
17271
17272 impl std::convert::From<i32> for Availability {
17273 fn from(value: i32) -> Self {
17274 match value {
17275 0 => Self::Unspecified,
17276 1 => Self::InStock,
17277 2 => Self::OutOfStock,
17278 3 => Self::Preorder,
17279 4 => Self::Backorder,
17280 _ => Self::UnknownValue(availability::UnknownValue(
17281 wkt::internal::UnknownEnumValue::Integer(value),
17282 )),
17283 }
17284 }
17285 }
17286
17287 impl std::convert::From<&str> for Availability {
17288 fn from(value: &str) -> Self {
17289 use std::string::ToString;
17290 match value {
17291 "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17292 "IN_STOCK" => Self::InStock,
17293 "OUT_OF_STOCK" => Self::OutOfStock,
17294 "PREORDER" => Self::Preorder,
17295 "BACKORDER" => Self::Backorder,
17296 _ => Self::UnknownValue(availability::UnknownValue(
17297 wkt::internal::UnknownEnumValue::String(value.to_string()),
17298 )),
17299 }
17300 }
17301 }
17302
17303 impl serde::ser::Serialize for Availability {
17304 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17305 where
17306 S: serde::Serializer,
17307 {
17308 match self {
17309 Self::Unspecified => serializer.serialize_i32(0),
17310 Self::InStock => serializer.serialize_i32(1),
17311 Self::OutOfStock => serializer.serialize_i32(2),
17312 Self::Preorder => serializer.serialize_i32(3),
17313 Self::Backorder => serializer.serialize_i32(4),
17314 Self::UnknownValue(u) => u.0.serialize(serializer),
17315 }
17316 }
17317 }
17318
17319 impl<'de> serde::de::Deserialize<'de> for Availability {
17320 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17321 where
17322 D: serde::Deserializer<'de>,
17323 {
17324 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17325 ".google.cloud.retail.v2.Product.Availability",
17326 ))
17327 }
17328 }
17329
17330 #[allow(missing_docs)]
17331 #[derive(Clone, Debug, PartialEq)]
17332 #[non_exhaustive]
17333 pub enum Expiration {
17334 /// Note that this field is applied in the following ways:
17335 ///
17336 /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17337 /// when it is uploaded, this product
17338 /// is not indexed for search.
17339 ///
17340 /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17341 /// is uploaded, only the
17342 /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17343 /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17344 /// expireTime is respected, and
17345 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17346 /// expireTime is not used.
17347 ///
17348 ///
17349 /// In general, we suggest the users to delete the stale
17350 /// products explicitly, instead of using this field to determine staleness.
17351 ///
17352 /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17353 /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17354 /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17355 /// INVALID_ARGUMENT error is thrown.
17356 ///
17357 /// Corresponding properties: Google Merchant Center property
17358 /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17359 ///
17360 /// [google.cloud.retail.v2.Product]: crate::model::Product
17361 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17362 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17363 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17364 /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17365 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17366 /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17367 ExpireTime(std::boxed::Box<wkt::Timestamp>),
17368 /// Input only. The TTL (time to live) of the product. Note that this is only
17369 /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17370 /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17371 /// and ignored for
17372 /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17373 /// we suggest the users to delete the stale products explicitly, instead of
17374 /// using this field to determine staleness.
17375 ///
17376 /// If it is set, it must be a non-negative value, and
17377 /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17378 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17379 /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17380 /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17381 /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17382 ///
17383 /// If it is set, the product is not available for
17384 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17385 /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17386 /// However, the product can still be retrieved by
17387 /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17388 /// and
17389 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17390 ///
17391 /// [google.cloud.retail.v2.Product]: crate::model::Product
17392 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17393 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17394 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17395 /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17396 /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17397 /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17398 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17399 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17400 Ttl(std::boxed::Box<wkt::Duration>),
17401 }
17402}
17403
17404/// Request message for
17405/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17406/// method.
17407///
17408/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17409#[derive(Clone, Default, PartialEq)]
17410#[non_exhaustive]
17411pub struct CreateProductRequest {
17412 /// Required. The parent catalog resource name, such as
17413 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17414 pub parent: std::string::String,
17415
17416 /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17417 ///
17418 /// [google.cloud.retail.v2.Product]: crate::model::Product
17419 pub product: std::option::Option<crate::model::Product>,
17420
17421 /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17422 /// which will become the final component of the
17423 /// [Product.name][google.cloud.retail.v2.Product.name].
17424 ///
17425 /// If the caller does not have permission to create the
17426 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17427 /// exists, a PERMISSION_DENIED error is returned.
17428 ///
17429 /// This field must be unique among all
17430 /// [Product][google.cloud.retail.v2.Product]s with the same
17431 /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17432 /// ALREADY_EXISTS error is returned.
17433 ///
17434 /// This field must be a UTF-8 encoded string with a length limit of 128
17435 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17436 ///
17437 /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17438 /// [google.cloud.retail.v2.Product]: crate::model::Product
17439 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17440 pub product_id: std::string::String,
17441
17442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17443}
17444
17445impl CreateProductRequest {
17446 /// Creates a new default instance.
17447 pub fn new() -> Self {
17448 std::default::Default::default()
17449 }
17450
17451 /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17452 ///
17453 /// # Example
17454 /// ```ignore,no_run
17455 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17456 /// let x = CreateProductRequest::new().set_parent("example");
17457 /// ```
17458 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17459 self.parent = v.into();
17460 self
17461 }
17462
17463 /// Sets the value of [product][crate::model::CreateProductRequest::product].
17464 ///
17465 /// # Example
17466 /// ```ignore,no_run
17467 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17468 /// use google_cloud_retail_v2::model::Product;
17469 /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17470 /// ```
17471 pub fn set_product<T>(mut self, v: T) -> Self
17472 where
17473 T: std::convert::Into<crate::model::Product>,
17474 {
17475 self.product = std::option::Option::Some(v.into());
17476 self
17477 }
17478
17479 /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17480 ///
17481 /// # Example
17482 /// ```ignore,no_run
17483 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17484 /// use google_cloud_retail_v2::model::Product;
17485 /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17486 /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17487 /// ```
17488 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17489 where
17490 T: std::convert::Into<crate::model::Product>,
17491 {
17492 self.product = v.map(|x| x.into());
17493 self
17494 }
17495
17496 /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17497 ///
17498 /// # Example
17499 /// ```ignore,no_run
17500 /// # use google_cloud_retail_v2::model::CreateProductRequest;
17501 /// let x = CreateProductRequest::new().set_product_id("example");
17502 /// ```
17503 pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17504 self.product_id = v.into();
17505 self
17506 }
17507}
17508
17509impl wkt::message::Message for CreateProductRequest {
17510 fn typename() -> &'static str {
17511 "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17512 }
17513}
17514
17515/// Request message for
17516/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17517/// method.
17518///
17519/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17520#[derive(Clone, Default, PartialEq)]
17521#[non_exhaustive]
17522pub struct GetProductRequest {
17523 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17524 /// such as
17525 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17526 ///
17527 /// If the caller does not have permission to access the
17528 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17529 /// exists, a PERMISSION_DENIED error is returned.
17530 ///
17531 /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17532 /// a NOT_FOUND error is returned.
17533 ///
17534 /// [google.cloud.retail.v2.Product]: crate::model::Product
17535 pub name: std::string::String,
17536
17537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17538}
17539
17540impl GetProductRequest {
17541 /// Creates a new default instance.
17542 pub fn new() -> Self {
17543 std::default::Default::default()
17544 }
17545
17546 /// Sets the value of [name][crate::model::GetProductRequest::name].
17547 ///
17548 /// # Example
17549 /// ```ignore,no_run
17550 /// # use google_cloud_retail_v2::model::GetProductRequest;
17551 /// # let project_id = "project_id";
17552 /// # let location_id = "location_id";
17553 /// # let catalog_id = "catalog_id";
17554 /// # let branch_id = "branch_id";
17555 /// # let product_id = "product_id";
17556 /// let x = GetProductRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
17557 /// ```
17558 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17559 self.name = v.into();
17560 self
17561 }
17562}
17563
17564impl wkt::message::Message for GetProductRequest {
17565 fn typename() -> &'static str {
17566 "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17567 }
17568}
17569
17570/// Request message for
17571/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17572/// method.
17573///
17574/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17575#[derive(Clone, Default, PartialEq)]
17576#[non_exhaustive]
17577pub struct UpdateProductRequest {
17578 /// Required. The product to update/create.
17579 ///
17580 /// If the caller does not have permission to update the
17581 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17582 /// exists, a PERMISSION_DENIED error is returned.
17583 ///
17584 /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17585 /// and
17586 /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17587 /// is not set, a NOT_FOUND error is returned.
17588 ///
17589 /// [google.cloud.retail.v2.Product]: crate::model::Product
17590 /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17591 pub product: std::option::Option<crate::model::Product>,
17592
17593 /// Indicates which fields in the provided
17594 /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17595 /// output only fields are NOT supported. If not set, all supported fields (the
17596 /// fields that are neither immutable nor output only) are updated.
17597 ///
17598 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17599 /// is returned.
17600 ///
17601 /// The attribute key can be updated by setting the mask path as
17602 /// "attributes.${key_name}". If a key name is present in the mask but not in
17603 /// the patching product from the request, this key will be deleted after the
17604 /// update.
17605 ///
17606 /// [google.cloud.retail.v2.Product]: crate::model::Product
17607 pub update_mask: std::option::Option<wkt::FieldMask>,
17608
17609 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17610 /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17611 /// this situation, `update_mask` is ignored.
17612 ///
17613 /// [google.cloud.retail.v2.Product]: crate::model::Product
17614 pub allow_missing: bool,
17615
17616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17617}
17618
17619impl UpdateProductRequest {
17620 /// Creates a new default instance.
17621 pub fn new() -> Self {
17622 std::default::Default::default()
17623 }
17624
17625 /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17626 ///
17627 /// # Example
17628 /// ```ignore,no_run
17629 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17630 /// use google_cloud_retail_v2::model::Product;
17631 /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17632 /// ```
17633 pub fn set_product<T>(mut self, v: T) -> Self
17634 where
17635 T: std::convert::Into<crate::model::Product>,
17636 {
17637 self.product = std::option::Option::Some(v.into());
17638 self
17639 }
17640
17641 /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17642 ///
17643 /// # Example
17644 /// ```ignore,no_run
17645 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17646 /// use google_cloud_retail_v2::model::Product;
17647 /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17648 /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17649 /// ```
17650 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17651 where
17652 T: std::convert::Into<crate::model::Product>,
17653 {
17654 self.product = v.map(|x| x.into());
17655 self
17656 }
17657
17658 /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17659 ///
17660 /// # Example
17661 /// ```ignore,no_run
17662 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17663 /// use wkt::FieldMask;
17664 /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17665 /// ```
17666 pub fn set_update_mask<T>(mut self, v: T) -> Self
17667 where
17668 T: std::convert::Into<wkt::FieldMask>,
17669 {
17670 self.update_mask = std::option::Option::Some(v.into());
17671 self
17672 }
17673
17674 /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17675 ///
17676 /// # Example
17677 /// ```ignore,no_run
17678 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17679 /// use wkt::FieldMask;
17680 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17681 /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17682 /// ```
17683 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17684 where
17685 T: std::convert::Into<wkt::FieldMask>,
17686 {
17687 self.update_mask = v.map(|x| x.into());
17688 self
17689 }
17690
17691 /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17692 ///
17693 /// # Example
17694 /// ```ignore,no_run
17695 /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17696 /// let x = UpdateProductRequest::new().set_allow_missing(true);
17697 /// ```
17698 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17699 self.allow_missing = v.into();
17700 self
17701 }
17702}
17703
17704impl wkt::message::Message for UpdateProductRequest {
17705 fn typename() -> &'static str {
17706 "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17707 }
17708}
17709
17710/// Request message for
17711/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17712/// method.
17713///
17714/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17715#[derive(Clone, Default, PartialEq)]
17716#[non_exhaustive]
17717pub struct DeleteProductRequest {
17718 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17719 /// such as
17720 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17721 ///
17722 /// If the caller does not have permission to delete the
17723 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17724 /// exists, a PERMISSION_DENIED error is returned.
17725 ///
17726 /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17727 /// a NOT_FOUND error is returned.
17728 ///
17729 /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17730 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17731 /// [Product][google.cloud.retail.v2.Product] member nor a
17732 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17733 /// [Product][google.cloud.retail.v2.Product] with more than one
17734 /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17735 /// INVALID_ARGUMENT error is returned.
17736 ///
17737 /// All inventory information for the named
17738 /// [Product][google.cloud.retail.v2.Product] will be deleted.
17739 ///
17740 /// [google.cloud.retail.v2.Product]: crate::model::Product
17741 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17742 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17743 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17744 pub name: std::string::String,
17745
17746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17747}
17748
17749impl DeleteProductRequest {
17750 /// Creates a new default instance.
17751 pub fn new() -> Self {
17752 std::default::Default::default()
17753 }
17754
17755 /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17756 ///
17757 /// # Example
17758 /// ```ignore,no_run
17759 /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17760 /// # let project_id = "project_id";
17761 /// # let location_id = "location_id";
17762 /// # let catalog_id = "catalog_id";
17763 /// # let branch_id = "branch_id";
17764 /// # let product_id = "product_id";
17765 /// let x = DeleteProductRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
17766 /// ```
17767 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17768 self.name = v.into();
17769 self
17770 }
17771}
17772
17773impl wkt::message::Message for DeleteProductRequest {
17774 fn typename() -> &'static str {
17775 "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17776 }
17777}
17778
17779/// Request message for
17780/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17781/// method.
17782///
17783/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17784#[derive(Clone, Default, PartialEq)]
17785#[non_exhaustive]
17786pub struct ListProductsRequest {
17787 /// Required. The parent branch resource name, such as
17788 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17789 /// `default_branch` as the branch ID, to list products under the default
17790 /// branch.
17791 ///
17792 /// If the caller does not have permission to list
17793 /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17794 /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17795 ///
17796 /// [google.cloud.retail.v2.Product]: crate::model::Product
17797 pub parent: std::string::String,
17798
17799 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17800 /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17801 /// above 1000 will be coerced to 1000.
17802 ///
17803 /// If this field is negative, an INVALID_ARGUMENT error is returned.
17804 ///
17805 /// [google.cloud.retail.v2.Product]: crate::model::Product
17806 pub page_size: i32,
17807
17808 /// A page token
17809 /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17810 /// received from a previous
17811 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17812 /// call. Provide this to retrieve the subsequent page.
17813 ///
17814 /// When paginating, all other parameters provided to
17815 /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17816 /// must match the call that provided the page token. Otherwise, an
17817 /// INVALID_ARGUMENT error is returned.
17818 ///
17819 /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17820 /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17821 pub page_token: std::string::String,
17822
17823 /// A filter to apply on the list results. Supported features:
17824 ///
17825 /// * List all the products under the parent branch if
17826 /// [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17827 /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17828 /// [Product][google.cloud.retail.v2.Product]s sharing the same
17829 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17830 /// [Product][google.cloud.retail.v2.Product]. For example:
17831 /// `primary_product_id = "some_product_id"`
17832 /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17833 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17834 /// [Product][google.cloud.retail.v2.Product].
17835 /// For example:
17836 /// `collection_product_id = "some_product_id"`
17837 /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17838 /// For example:
17839 /// `type = "PRIMARY"`
17840 /// `type = "VARIANT"`
17841 /// `type = "COLLECTION"`
17842 ///
17843 /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17844 ///
17845 /// If the specified
17846 /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17847 /// [Product][google.cloud.retail.v2.Product] or
17848 /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17849 /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17850 /// is returned.
17851 ///
17852 /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17853 /// [google.cloud.retail.v2.Product]: crate::model::Product
17854 /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17855 /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17856 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17857 pub filter: std::string::String,
17858
17859 /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17860 /// responses. If not set or empty, the following fields are returned:
17861 ///
17862 /// * [Product.name][google.cloud.retail.v2.Product.name]
17863 /// * [Product.id][google.cloud.retail.v2.Product.id]
17864 /// * [Product.title][google.cloud.retail.v2.Product.title]
17865 /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17866 /// * [Product.images][google.cloud.retail.v2.Product.images]
17867 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17868 /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17869 ///
17870 /// If "*" is provided, all fields are returned.
17871 /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17872 /// matter what mask is set.
17873 ///
17874 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17875 /// is returned.
17876 ///
17877 /// [google.cloud.retail.v2.Product]: crate::model::Product
17878 /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17879 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17880 /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17881 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17882 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17883 /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17884 /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17885 pub read_mask: std::option::Option<wkt::FieldMask>,
17886
17887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17888}
17889
17890impl ListProductsRequest {
17891 /// Creates a new default instance.
17892 pub fn new() -> Self {
17893 std::default::Default::default()
17894 }
17895
17896 /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17897 ///
17898 /// # Example
17899 /// ```ignore,no_run
17900 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17901 /// let x = ListProductsRequest::new().set_parent("example");
17902 /// ```
17903 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17904 self.parent = v.into();
17905 self
17906 }
17907
17908 /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17909 ///
17910 /// # Example
17911 /// ```ignore,no_run
17912 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17913 /// let x = ListProductsRequest::new().set_page_size(42);
17914 /// ```
17915 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17916 self.page_size = v.into();
17917 self
17918 }
17919
17920 /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17921 ///
17922 /// # Example
17923 /// ```ignore,no_run
17924 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17925 /// let x = ListProductsRequest::new().set_page_token("example");
17926 /// ```
17927 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17928 self.page_token = v.into();
17929 self
17930 }
17931
17932 /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17933 ///
17934 /// # Example
17935 /// ```ignore,no_run
17936 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17937 /// let x = ListProductsRequest::new().set_filter("example");
17938 /// ```
17939 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17940 self.filter = v.into();
17941 self
17942 }
17943
17944 /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17945 ///
17946 /// # Example
17947 /// ```ignore,no_run
17948 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17949 /// use wkt::FieldMask;
17950 /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17951 /// ```
17952 pub fn set_read_mask<T>(mut self, v: T) -> Self
17953 where
17954 T: std::convert::Into<wkt::FieldMask>,
17955 {
17956 self.read_mask = std::option::Option::Some(v.into());
17957 self
17958 }
17959
17960 /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17961 ///
17962 /// # Example
17963 /// ```ignore,no_run
17964 /// # use google_cloud_retail_v2::model::ListProductsRequest;
17965 /// use wkt::FieldMask;
17966 /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17967 /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17968 /// ```
17969 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17970 where
17971 T: std::convert::Into<wkt::FieldMask>,
17972 {
17973 self.read_mask = v.map(|x| x.into());
17974 self
17975 }
17976}
17977
17978impl wkt::message::Message for ListProductsRequest {
17979 fn typename() -> &'static str {
17980 "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17981 }
17982}
17983
17984/// Response message for
17985/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17986/// method.
17987///
17988/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17989#[derive(Clone, Default, PartialEq)]
17990#[non_exhaustive]
17991pub struct ListProductsResponse {
17992 /// The [Product][google.cloud.retail.v2.Product]s.
17993 ///
17994 /// [google.cloud.retail.v2.Product]: crate::model::Product
17995 pub products: std::vec::Vec<crate::model::Product>,
17996
17997 /// A token that can be sent as
17998 /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
17999 /// to retrieve the next page. If this field is omitted, there are no
18000 /// subsequent pages.
18001 ///
18002 /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
18003 pub next_page_token: std::string::String,
18004
18005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18006}
18007
18008impl ListProductsResponse {
18009 /// Creates a new default instance.
18010 pub fn new() -> Self {
18011 std::default::Default::default()
18012 }
18013
18014 /// Sets the value of [products][crate::model::ListProductsResponse::products].
18015 ///
18016 /// # Example
18017 /// ```ignore,no_run
18018 /// # use google_cloud_retail_v2::model::ListProductsResponse;
18019 /// use google_cloud_retail_v2::model::Product;
18020 /// let x = ListProductsResponse::new()
18021 /// .set_products([
18022 /// Product::default()/* use setters */,
18023 /// Product::default()/* use (different) setters */,
18024 /// ]);
18025 /// ```
18026 pub fn set_products<T, V>(mut self, v: T) -> Self
18027 where
18028 T: std::iter::IntoIterator<Item = V>,
18029 V: std::convert::Into<crate::model::Product>,
18030 {
18031 use std::iter::Iterator;
18032 self.products = v.into_iter().map(|i| i.into()).collect();
18033 self
18034 }
18035
18036 /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
18037 ///
18038 /// # Example
18039 /// ```ignore,no_run
18040 /// # use google_cloud_retail_v2::model::ListProductsResponse;
18041 /// let x = ListProductsResponse::new().set_next_page_token("example");
18042 /// ```
18043 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18044 self.next_page_token = v.into();
18045 self
18046 }
18047}
18048
18049impl wkt::message::Message for ListProductsResponse {
18050 fn typename() -> &'static str {
18051 "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
18052 }
18053}
18054
18055#[doc(hidden)]
18056impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
18057 type PageItem = crate::model::Product;
18058
18059 fn items(self) -> std::vec::Vec<Self::PageItem> {
18060 self.products
18061 }
18062
18063 fn next_page_token(&self) -> std::string::String {
18064 use std::clone::Clone;
18065 self.next_page_token.clone()
18066 }
18067}
18068
18069/// Request message for
18070/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18071/// method.
18072///
18073/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18074#[derive(Clone, Default, PartialEq)]
18075#[non_exhaustive]
18076pub struct SetInventoryRequest {
18077 /// Required. The inventory information to update. The allowable fields to
18078 /// update are:
18079 ///
18080 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
18081 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
18082 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
18083 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18084 /// The updated inventory fields must be specified in
18085 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
18086 ///
18087 /// If
18088 /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
18089 /// is empty or invalid, an INVALID_ARGUMENT error is returned.
18090 ///
18091 /// If the caller does not have permission to update the
18092 /// [Product][google.cloud.retail.v2.Product] named in
18093 /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
18094 /// or not it exists, a PERMISSION_DENIED error is returned.
18095 ///
18096 /// If the [Product][google.cloud.retail.v2.Product] to update does not have
18097 /// existing inventory information, the provided inventory information will be
18098 /// inserted.
18099 ///
18100 /// If the [Product][google.cloud.retail.v2.Product] to update has existing
18101 /// inventory information, the provided inventory information will be merged
18102 /// while respecting the last update time for each inventory field, using the
18103 /// provided or default value for
18104 /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
18105 ///
18106 /// The caller can replace place IDs for a subset of fulfillment types in the
18107 /// following ways:
18108 ///
18109 /// * Adds "fulfillment_info" in
18110 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18111 /// * Specifies only the desired fulfillment types and corresponding place IDs
18112 /// to update in
18113 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18114 ///
18115 /// The caller can clear all place IDs from a subset of fulfillment types in
18116 /// the following ways:
18117 ///
18118 /// * Adds "fulfillment_info" in
18119 /// [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18120 /// * Specifies only the desired fulfillment types to clear in
18121 /// [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18122 /// * Checks that only the desired fulfillment info types have empty
18123 /// [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
18124 ///
18125 /// The last update time is recorded for the following inventory fields:
18126 ///
18127 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
18128 /// * [Product.availability][google.cloud.retail.v2.Product.availability]
18129 /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
18130 /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18131 ///
18132 /// If a full overwrite of inventory information while ignoring timestamps is
18133 /// needed,
18134 /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
18135 /// should be invoked instead.
18136 ///
18137 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
18138 /// [google.cloud.retail.v2.Product]: crate::model::Product
18139 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
18140 /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
18141 /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
18142 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18143 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
18144 /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
18145 /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
18146 /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
18147 pub inventory: std::option::Option<crate::model::Product>,
18148
18149 /// Indicates which inventory fields in the provided
18150 /// [Product][google.cloud.retail.v2.Product] to update.
18151 ///
18152 /// At least one field must be provided.
18153 ///
18154 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18155 /// is returned and the entire update will be ignored.
18156 ///
18157 /// [google.cloud.retail.v2.Product]: crate::model::Product
18158 pub set_mask: std::option::Option<wkt::FieldMask>,
18159
18160 /// The time when the request is issued, used to prevent
18161 /// out-of-order updates on inventory fields with the last update time
18162 /// recorded. If not provided, the internal system time will be used.
18163 pub set_time: std::option::Option<wkt::Timestamp>,
18164
18165 /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
18166 /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
18167 /// inventory update will still be processed and retained for at most 1 day
18168 /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
18169 /// false, a NOT_FOUND error is returned if the
18170 /// [Product][google.cloud.retail.v2.Product] is not found.
18171 ///
18172 /// [google.cloud.retail.v2.Product]: crate::model::Product
18173 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18174 pub allow_missing: bool,
18175
18176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18177}
18178
18179impl SetInventoryRequest {
18180 /// Creates a new default instance.
18181 pub fn new() -> Self {
18182 std::default::Default::default()
18183 }
18184
18185 /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
18186 ///
18187 /// # Example
18188 /// ```ignore,no_run
18189 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18190 /// use google_cloud_retail_v2::model::Product;
18191 /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
18192 /// ```
18193 pub fn set_inventory<T>(mut self, v: T) -> Self
18194 where
18195 T: std::convert::Into<crate::model::Product>,
18196 {
18197 self.inventory = std::option::Option::Some(v.into());
18198 self
18199 }
18200
18201 /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
18202 ///
18203 /// # Example
18204 /// ```ignore,no_run
18205 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18206 /// use google_cloud_retail_v2::model::Product;
18207 /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
18208 /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
18209 /// ```
18210 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
18211 where
18212 T: std::convert::Into<crate::model::Product>,
18213 {
18214 self.inventory = v.map(|x| x.into());
18215 self
18216 }
18217
18218 /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18219 ///
18220 /// # Example
18221 /// ```ignore,no_run
18222 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18223 /// use wkt::FieldMask;
18224 /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
18225 /// ```
18226 pub fn set_set_mask<T>(mut self, v: T) -> Self
18227 where
18228 T: std::convert::Into<wkt::FieldMask>,
18229 {
18230 self.set_mask = std::option::Option::Some(v.into());
18231 self
18232 }
18233
18234 /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18235 ///
18236 /// # Example
18237 /// ```ignore,no_run
18238 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18239 /// use wkt::FieldMask;
18240 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
18241 /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
18242 /// ```
18243 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
18244 where
18245 T: std::convert::Into<wkt::FieldMask>,
18246 {
18247 self.set_mask = v.map(|x| x.into());
18248 self
18249 }
18250
18251 /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18252 ///
18253 /// # Example
18254 /// ```ignore,no_run
18255 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18256 /// use wkt::Timestamp;
18257 /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18258 /// ```
18259 pub fn set_set_time<T>(mut self, v: T) -> Self
18260 where
18261 T: std::convert::Into<wkt::Timestamp>,
18262 {
18263 self.set_time = std::option::Option::Some(v.into());
18264 self
18265 }
18266
18267 /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18268 ///
18269 /// # Example
18270 /// ```ignore,no_run
18271 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18272 /// use wkt::Timestamp;
18273 /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18274 /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18275 /// ```
18276 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18277 where
18278 T: std::convert::Into<wkt::Timestamp>,
18279 {
18280 self.set_time = v.map(|x| x.into());
18281 self
18282 }
18283
18284 /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18285 ///
18286 /// # Example
18287 /// ```ignore,no_run
18288 /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18289 /// let x = SetInventoryRequest::new().set_allow_missing(true);
18290 /// ```
18291 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18292 self.allow_missing = v.into();
18293 self
18294 }
18295}
18296
18297impl wkt::message::Message for SetInventoryRequest {
18298 fn typename() -> &'static str {
18299 "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18300 }
18301}
18302
18303/// Metadata related to the progress of the SetInventory operation.
18304/// Currently empty because there is no meaningful metadata populated from the
18305/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18306/// method.
18307///
18308/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18309#[derive(Clone, Default, PartialEq)]
18310#[non_exhaustive]
18311pub struct SetInventoryMetadata {
18312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18313}
18314
18315impl SetInventoryMetadata {
18316 /// Creates a new default instance.
18317 pub fn new() -> Self {
18318 std::default::Default::default()
18319 }
18320}
18321
18322impl wkt::message::Message for SetInventoryMetadata {
18323 fn typename() -> &'static str {
18324 "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18325 }
18326}
18327
18328/// Response of the SetInventoryRequest. Currently empty because
18329/// there is no meaningful response populated from the
18330/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18331/// method.
18332///
18333/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18334#[derive(Clone, Default, PartialEq)]
18335#[non_exhaustive]
18336pub struct SetInventoryResponse {
18337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18338}
18339
18340impl SetInventoryResponse {
18341 /// Creates a new default instance.
18342 pub fn new() -> Self {
18343 std::default::Default::default()
18344 }
18345}
18346
18347impl wkt::message::Message for SetInventoryResponse {
18348 fn typename() -> &'static str {
18349 "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18350 }
18351}
18352
18353/// Request message for
18354/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18355/// method.
18356///
18357/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18358#[derive(Clone, Default, PartialEq)]
18359#[non_exhaustive]
18360pub struct AddFulfillmentPlacesRequest {
18361 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18362 /// such as
18363 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18364 ///
18365 /// If the caller does not have permission to access the
18366 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18367 /// exists, a PERMISSION_DENIED error is returned.
18368 ///
18369 /// [google.cloud.retail.v2.Product]: crate::model::Product
18370 pub product: std::string::String,
18371
18372 /// Required. The fulfillment type, including commonly used types (such as
18373 /// pickup in store and same day delivery), and custom types.
18374 ///
18375 /// Supported values:
18376 ///
18377 /// * "pickup-in-store"
18378 /// * "ship-to-store"
18379 /// * "same-day-delivery"
18380 /// * "next-day-delivery"
18381 /// * "custom-type-1"
18382 /// * "custom-type-2"
18383 /// * "custom-type-3"
18384 /// * "custom-type-4"
18385 /// * "custom-type-5"
18386 ///
18387 /// If this field is set to an invalid value other than these, an
18388 /// INVALID_ARGUMENT error is returned.
18389 ///
18390 /// This field directly corresponds to
18391 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18392 ///
18393 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18394 pub r#type: std::string::String,
18395
18396 /// Required. The IDs for this
18397 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18398 /// the store IDs for "pickup-in-store" or the region IDs for
18399 /// "same-day-delivery" to be added for this
18400 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18401 /// IDs will be automatically ignored.
18402 ///
18403 /// At least 1 value is required, and a maximum of 2000 values are allowed.
18404 /// Each value must be a string with a length limit of 10 characters, matching
18405 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18406 /// INVALID_ARGUMENT error is returned.
18407 ///
18408 /// If the total number of place IDs exceeds 2000 for this
18409 /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18410 /// adding, then the update will be rejected.
18411 ///
18412 /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18413 pub place_ids: std::vec::Vec<std::string::String>,
18414
18415 /// The time when the fulfillment updates are issued, used to prevent
18416 /// out-of-order updates on fulfillment information. If not provided, the
18417 /// internal system time will be used.
18418 pub add_time: std::option::Option<wkt::Timestamp>,
18419
18420 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18421 /// found, the fulfillment information will still be processed and retained for
18422 /// at most 1 day and processed once the
18423 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18424 /// NOT_FOUND error is returned if the
18425 /// [Product][google.cloud.retail.v2.Product] is not found.
18426 ///
18427 /// [google.cloud.retail.v2.Product]: crate::model::Product
18428 pub allow_missing: bool,
18429
18430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18431}
18432
18433impl AddFulfillmentPlacesRequest {
18434 /// Creates a new default instance.
18435 pub fn new() -> Self {
18436 std::default::Default::default()
18437 }
18438
18439 /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18440 ///
18441 /// # Example
18442 /// ```ignore,no_run
18443 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18444 /// # let project_id = "project_id";
18445 /// # let location_id = "location_id";
18446 /// # let catalog_id = "catalog_id";
18447 /// # let branch_id = "branch_id";
18448 /// # let product_id = "product_id";
18449 /// let x = AddFulfillmentPlacesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18450 /// ```
18451 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18452 self.product = v.into();
18453 self
18454 }
18455
18456 /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18457 ///
18458 /// # Example
18459 /// ```ignore,no_run
18460 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18461 /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18462 /// ```
18463 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18464 self.r#type = v.into();
18465 self
18466 }
18467
18468 /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18469 ///
18470 /// # Example
18471 /// ```ignore,no_run
18472 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18473 /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18474 /// ```
18475 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18476 where
18477 T: std::iter::IntoIterator<Item = V>,
18478 V: std::convert::Into<std::string::String>,
18479 {
18480 use std::iter::Iterator;
18481 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18482 self
18483 }
18484
18485 /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18486 ///
18487 /// # Example
18488 /// ```ignore,no_run
18489 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18490 /// use wkt::Timestamp;
18491 /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18492 /// ```
18493 pub fn set_add_time<T>(mut self, v: T) -> Self
18494 where
18495 T: std::convert::Into<wkt::Timestamp>,
18496 {
18497 self.add_time = std::option::Option::Some(v.into());
18498 self
18499 }
18500
18501 /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18502 ///
18503 /// # Example
18504 /// ```ignore,no_run
18505 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18506 /// use wkt::Timestamp;
18507 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18508 /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18509 /// ```
18510 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18511 where
18512 T: std::convert::Into<wkt::Timestamp>,
18513 {
18514 self.add_time = v.map(|x| x.into());
18515 self
18516 }
18517
18518 /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18519 ///
18520 /// # Example
18521 /// ```ignore,no_run
18522 /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18523 /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18524 /// ```
18525 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18526 self.allow_missing = v.into();
18527 self
18528 }
18529}
18530
18531impl wkt::message::Message for AddFulfillmentPlacesRequest {
18532 fn typename() -> &'static str {
18533 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18534 }
18535}
18536
18537/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18538/// Currently empty because there is no meaningful metadata populated from the
18539/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18540/// method.
18541///
18542/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18543#[derive(Clone, Default, PartialEq)]
18544#[non_exhaustive]
18545pub struct AddFulfillmentPlacesMetadata {
18546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18547}
18548
18549impl AddFulfillmentPlacesMetadata {
18550 /// Creates a new default instance.
18551 pub fn new() -> Self {
18552 std::default::Default::default()
18553 }
18554}
18555
18556impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18557 fn typename() -> &'static str {
18558 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18559 }
18560}
18561
18562/// Response of the AddFulfillmentPlacesRequest. Currently empty because
18563/// there is no meaningful response populated from the
18564/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18565/// method.
18566///
18567/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18568#[derive(Clone, Default, PartialEq)]
18569#[non_exhaustive]
18570pub struct AddFulfillmentPlacesResponse {
18571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18572}
18573
18574impl AddFulfillmentPlacesResponse {
18575 /// Creates a new default instance.
18576 pub fn new() -> Self {
18577 std::default::Default::default()
18578 }
18579}
18580
18581impl wkt::message::Message for AddFulfillmentPlacesResponse {
18582 fn typename() -> &'static str {
18583 "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18584 }
18585}
18586
18587/// Request message for
18588/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18589/// method.
18590///
18591/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18592#[derive(Clone, Default, PartialEq)]
18593#[non_exhaustive]
18594pub struct AddLocalInventoriesRequest {
18595 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18596 /// such as
18597 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18598 ///
18599 /// If the caller does not have permission to access the
18600 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18601 /// exists, a PERMISSION_DENIED error is returned.
18602 ///
18603 /// [google.cloud.retail.v2.Product]: crate::model::Product
18604 pub product: std::string::String,
18605
18606 /// Required. A list of inventory information at difference places. Each place
18607 /// is identified by its place ID. At most 3000 inventories are allowed per
18608 /// request.
18609 pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18610
18611 /// Indicates which inventory fields in the provided list of
18612 /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18613 /// field is updated to the provided value.
18614 ///
18615 /// If a field is set while the place does not have a previous local inventory,
18616 /// the local inventory at that store is created.
18617 ///
18618 /// If a field is set while the value of that field is not provided, the
18619 /// original field value, if it exists, is deleted.
18620 ///
18621 /// If the mask is not set or set with empty paths, all inventory fields will
18622 /// be updated.
18623 ///
18624 /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18625 /// is returned and the entire update will be ignored.
18626 ///
18627 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18628 pub add_mask: std::option::Option<wkt::FieldMask>,
18629
18630 /// The time when the inventory updates are issued. Used to prevent
18631 /// out-of-order updates on local inventory fields. If not provided, the
18632 /// internal system time will be used.
18633 pub add_time: std::option::Option<wkt::Timestamp>,
18634
18635 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18636 /// found, the local inventory will still be processed and retained for at most
18637 /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18638 /// created. If set to false, a NOT_FOUND error is returned if the
18639 /// [Product][google.cloud.retail.v2.Product] is not found.
18640 ///
18641 /// [google.cloud.retail.v2.Product]: crate::model::Product
18642 pub allow_missing: bool,
18643
18644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18645}
18646
18647impl AddLocalInventoriesRequest {
18648 /// Creates a new default instance.
18649 pub fn new() -> Self {
18650 std::default::Default::default()
18651 }
18652
18653 /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18654 ///
18655 /// # Example
18656 /// ```ignore,no_run
18657 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18658 /// # let project_id = "project_id";
18659 /// # let location_id = "location_id";
18660 /// # let catalog_id = "catalog_id";
18661 /// # let branch_id = "branch_id";
18662 /// # let product_id = "product_id";
18663 /// let x = AddLocalInventoriesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18664 /// ```
18665 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18666 self.product = v.into();
18667 self
18668 }
18669
18670 /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18671 ///
18672 /// # Example
18673 /// ```ignore,no_run
18674 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18675 /// use google_cloud_retail_v2::model::LocalInventory;
18676 /// let x = AddLocalInventoriesRequest::new()
18677 /// .set_local_inventories([
18678 /// LocalInventory::default()/* use setters */,
18679 /// LocalInventory::default()/* use (different) setters */,
18680 /// ]);
18681 /// ```
18682 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18683 where
18684 T: std::iter::IntoIterator<Item = V>,
18685 V: std::convert::Into<crate::model::LocalInventory>,
18686 {
18687 use std::iter::Iterator;
18688 self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18689 self
18690 }
18691
18692 /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18693 ///
18694 /// # Example
18695 /// ```ignore,no_run
18696 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18697 /// use wkt::FieldMask;
18698 /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18699 /// ```
18700 pub fn set_add_mask<T>(mut self, v: T) -> Self
18701 where
18702 T: std::convert::Into<wkt::FieldMask>,
18703 {
18704 self.add_mask = std::option::Option::Some(v.into());
18705 self
18706 }
18707
18708 /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18709 ///
18710 /// # Example
18711 /// ```ignore,no_run
18712 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18713 /// use wkt::FieldMask;
18714 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18715 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18716 /// ```
18717 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18718 where
18719 T: std::convert::Into<wkt::FieldMask>,
18720 {
18721 self.add_mask = v.map(|x| x.into());
18722 self
18723 }
18724
18725 /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18726 ///
18727 /// # Example
18728 /// ```ignore,no_run
18729 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18730 /// use wkt::Timestamp;
18731 /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18732 /// ```
18733 pub fn set_add_time<T>(mut self, v: T) -> Self
18734 where
18735 T: std::convert::Into<wkt::Timestamp>,
18736 {
18737 self.add_time = std::option::Option::Some(v.into());
18738 self
18739 }
18740
18741 /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18742 ///
18743 /// # Example
18744 /// ```ignore,no_run
18745 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18746 /// use wkt::Timestamp;
18747 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18748 /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18749 /// ```
18750 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18751 where
18752 T: std::convert::Into<wkt::Timestamp>,
18753 {
18754 self.add_time = v.map(|x| x.into());
18755 self
18756 }
18757
18758 /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18759 ///
18760 /// # Example
18761 /// ```ignore,no_run
18762 /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18763 /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18764 /// ```
18765 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18766 self.allow_missing = v.into();
18767 self
18768 }
18769}
18770
18771impl wkt::message::Message for AddLocalInventoriesRequest {
18772 fn typename() -> &'static str {
18773 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18774 }
18775}
18776
18777/// Metadata related to the progress of the AddLocalInventories operation.
18778/// Currently empty because there is no meaningful metadata populated from the
18779/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18780/// method.
18781///
18782/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18783#[derive(Clone, Default, PartialEq)]
18784#[non_exhaustive]
18785pub struct AddLocalInventoriesMetadata {
18786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18787}
18788
18789impl AddLocalInventoriesMetadata {
18790 /// Creates a new default instance.
18791 pub fn new() -> Self {
18792 std::default::Default::default()
18793 }
18794}
18795
18796impl wkt::message::Message for AddLocalInventoriesMetadata {
18797 fn typename() -> &'static str {
18798 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18799 }
18800}
18801
18802/// Response of the
18803/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18804/// API. Currently empty because there is no meaningful response populated from
18805/// the
18806/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18807/// method.
18808///
18809/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18810#[derive(Clone, Default, PartialEq)]
18811#[non_exhaustive]
18812pub struct AddLocalInventoriesResponse {
18813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18814}
18815
18816impl AddLocalInventoriesResponse {
18817 /// Creates a new default instance.
18818 pub fn new() -> Self {
18819 std::default::Default::default()
18820 }
18821}
18822
18823impl wkt::message::Message for AddLocalInventoriesResponse {
18824 fn typename() -> &'static str {
18825 "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18826 }
18827}
18828
18829/// Request message for
18830/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18831/// method.
18832///
18833/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18834#[derive(Clone, Default, PartialEq)]
18835#[non_exhaustive]
18836pub struct RemoveLocalInventoriesRequest {
18837 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18838 /// such as
18839 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18840 ///
18841 /// If the caller does not have permission to access the
18842 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18843 /// exists, a PERMISSION_DENIED error is returned.
18844 ///
18845 /// [google.cloud.retail.v2.Product]: crate::model::Product
18846 pub product: std::string::String,
18847
18848 /// Required. A list of place IDs to have their inventory deleted.
18849 /// At most 3000 place IDs are allowed per request.
18850 pub place_ids: std::vec::Vec<std::string::String>,
18851
18852 /// The time when the inventory deletions are issued. Used to prevent
18853 /// out-of-order updates and deletions on local inventory fields. If not
18854 /// provided, the internal system time will be used.
18855 pub remove_time: std::option::Option<wkt::Timestamp>,
18856
18857 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18858 /// found, the local inventory removal request will still be processed and
18859 /// retained for at most 1 day and processed once the
18860 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18861 /// NOT_FOUND error is returned if the
18862 /// [Product][google.cloud.retail.v2.Product] is not found.
18863 ///
18864 /// [google.cloud.retail.v2.Product]: crate::model::Product
18865 pub allow_missing: bool,
18866
18867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18868}
18869
18870impl RemoveLocalInventoriesRequest {
18871 /// Creates a new default instance.
18872 pub fn new() -> Self {
18873 std::default::Default::default()
18874 }
18875
18876 /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18877 ///
18878 /// # Example
18879 /// ```ignore,no_run
18880 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18881 /// # let project_id = "project_id";
18882 /// # let location_id = "location_id";
18883 /// # let catalog_id = "catalog_id";
18884 /// # let branch_id = "branch_id";
18885 /// # let product_id = "product_id";
18886 /// let x = RemoveLocalInventoriesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18887 /// ```
18888 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18889 self.product = v.into();
18890 self
18891 }
18892
18893 /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18894 ///
18895 /// # Example
18896 /// ```ignore,no_run
18897 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18898 /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18899 /// ```
18900 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18901 where
18902 T: std::iter::IntoIterator<Item = V>,
18903 V: std::convert::Into<std::string::String>,
18904 {
18905 use std::iter::Iterator;
18906 self.place_ids = v.into_iter().map(|i| i.into()).collect();
18907 self
18908 }
18909
18910 /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18911 ///
18912 /// # Example
18913 /// ```ignore,no_run
18914 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18915 /// use wkt::Timestamp;
18916 /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18917 /// ```
18918 pub fn set_remove_time<T>(mut self, v: T) -> Self
18919 where
18920 T: std::convert::Into<wkt::Timestamp>,
18921 {
18922 self.remove_time = std::option::Option::Some(v.into());
18923 self
18924 }
18925
18926 /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18927 ///
18928 /// # Example
18929 /// ```ignore,no_run
18930 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18931 /// use wkt::Timestamp;
18932 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18933 /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18934 /// ```
18935 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18936 where
18937 T: std::convert::Into<wkt::Timestamp>,
18938 {
18939 self.remove_time = v.map(|x| x.into());
18940 self
18941 }
18942
18943 /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18944 ///
18945 /// # Example
18946 /// ```ignore,no_run
18947 /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18948 /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18949 /// ```
18950 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18951 self.allow_missing = v.into();
18952 self
18953 }
18954}
18955
18956impl wkt::message::Message for RemoveLocalInventoriesRequest {
18957 fn typename() -> &'static str {
18958 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18959 }
18960}
18961
18962/// Metadata related to the progress of the RemoveLocalInventories operation.
18963/// Currently empty because there is no meaningful metadata populated from the
18964/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18965/// method.
18966///
18967/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18968#[derive(Clone, Default, PartialEq)]
18969#[non_exhaustive]
18970pub struct RemoveLocalInventoriesMetadata {
18971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18972}
18973
18974impl RemoveLocalInventoriesMetadata {
18975 /// Creates a new default instance.
18976 pub fn new() -> Self {
18977 std::default::Default::default()
18978 }
18979}
18980
18981impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18982 fn typename() -> &'static str {
18983 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18984 }
18985}
18986
18987/// Response of the
18988/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18989/// API. Currently empty because there is no meaningful response populated from
18990/// the
18991/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18992/// method.
18993///
18994/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18995#[derive(Clone, Default, PartialEq)]
18996#[non_exhaustive]
18997pub struct RemoveLocalInventoriesResponse {
18998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18999}
19000
19001impl RemoveLocalInventoriesResponse {
19002 /// Creates a new default instance.
19003 pub fn new() -> Self {
19004 std::default::Default::default()
19005 }
19006}
19007
19008impl wkt::message::Message for RemoveLocalInventoriesResponse {
19009 fn typename() -> &'static str {
19010 "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
19011 }
19012}
19013
19014/// Request message for
19015/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19016/// method.
19017///
19018/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19019#[derive(Clone, Default, PartialEq)]
19020#[non_exhaustive]
19021pub struct RemoveFulfillmentPlacesRequest {
19022 /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
19023 /// such as
19024 /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
19025 ///
19026 /// If the caller does not have permission to access the
19027 /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
19028 /// exists, a PERMISSION_DENIED error is returned.
19029 ///
19030 /// [google.cloud.retail.v2.Product]: crate::model::Product
19031 pub product: std::string::String,
19032
19033 /// Required. The fulfillment type, including commonly used types (such as
19034 /// pickup in store and same day delivery), and custom types.
19035 ///
19036 /// Supported values:
19037 ///
19038 /// * "pickup-in-store"
19039 /// * "ship-to-store"
19040 /// * "same-day-delivery"
19041 /// * "next-day-delivery"
19042 /// * "custom-type-1"
19043 /// * "custom-type-2"
19044 /// * "custom-type-3"
19045 /// * "custom-type-4"
19046 /// * "custom-type-5"
19047 ///
19048 /// If this field is set to an invalid value other than these, an
19049 /// INVALID_ARGUMENT error is returned.
19050 ///
19051 /// This field directly corresponds to
19052 /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
19053 ///
19054 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
19055 pub r#type: std::string::String,
19056
19057 /// Required. The IDs for this
19058 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
19059 /// the store IDs for "pickup-in-store" or the region IDs for
19060 /// "same-day-delivery", to be removed for this
19061 /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
19062 ///
19063 /// At least 1 value is required, and a maximum of 2000 values are allowed.
19064 /// Each value must be a string with a length limit of 10 characters, matching
19065 /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
19066 /// INVALID_ARGUMENT error is returned.
19067 ///
19068 /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
19069 pub place_ids: std::vec::Vec<std::string::String>,
19070
19071 /// The time when the fulfillment updates are issued, used to prevent
19072 /// out-of-order updates on fulfillment information. If not provided, the
19073 /// internal system time will be used.
19074 pub remove_time: std::option::Option<wkt::Timestamp>,
19075
19076 /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
19077 /// found, the fulfillment information will still be processed and retained for
19078 /// at most 1 day and processed once the
19079 /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
19080 /// NOT_FOUND error is returned if the
19081 /// [Product][google.cloud.retail.v2.Product] is not found.
19082 ///
19083 /// [google.cloud.retail.v2.Product]: crate::model::Product
19084 pub allow_missing: bool,
19085
19086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19087}
19088
19089impl RemoveFulfillmentPlacesRequest {
19090 /// Creates a new default instance.
19091 pub fn new() -> Self {
19092 std::default::Default::default()
19093 }
19094
19095 /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
19096 ///
19097 /// # Example
19098 /// ```ignore,no_run
19099 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19100 /// # let project_id = "project_id";
19101 /// # let location_id = "location_id";
19102 /// # let catalog_id = "catalog_id";
19103 /// # let branch_id = "branch_id";
19104 /// # let product_id = "product_id";
19105 /// let x = RemoveFulfillmentPlacesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
19106 /// ```
19107 pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19108 self.product = v.into();
19109 self
19110 }
19111
19112 /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
19113 ///
19114 /// # Example
19115 /// ```ignore,no_run
19116 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19117 /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
19118 /// ```
19119 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19120 self.r#type = v.into();
19121 self
19122 }
19123
19124 /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
19125 ///
19126 /// # Example
19127 /// ```ignore,no_run
19128 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19129 /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
19130 /// ```
19131 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
19132 where
19133 T: std::iter::IntoIterator<Item = V>,
19134 V: std::convert::Into<std::string::String>,
19135 {
19136 use std::iter::Iterator;
19137 self.place_ids = v.into_iter().map(|i| i.into()).collect();
19138 self
19139 }
19140
19141 /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19142 ///
19143 /// # Example
19144 /// ```ignore,no_run
19145 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19146 /// use wkt::Timestamp;
19147 /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
19148 /// ```
19149 pub fn set_remove_time<T>(mut self, v: T) -> Self
19150 where
19151 T: std::convert::Into<wkt::Timestamp>,
19152 {
19153 self.remove_time = std::option::Option::Some(v.into());
19154 self
19155 }
19156
19157 /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19158 ///
19159 /// # Example
19160 /// ```ignore,no_run
19161 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19162 /// use wkt::Timestamp;
19163 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
19164 /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
19165 /// ```
19166 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
19167 where
19168 T: std::convert::Into<wkt::Timestamp>,
19169 {
19170 self.remove_time = v.map(|x| x.into());
19171 self
19172 }
19173
19174 /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
19175 ///
19176 /// # Example
19177 /// ```ignore,no_run
19178 /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19179 /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
19180 /// ```
19181 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19182 self.allow_missing = v.into();
19183 self
19184 }
19185}
19186
19187impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
19188 fn typename() -> &'static str {
19189 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
19190 }
19191}
19192
19193/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
19194/// Currently empty because there is no meaningful metadata populated from the
19195/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19196/// method.
19197///
19198/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19199#[derive(Clone, Default, PartialEq)]
19200#[non_exhaustive]
19201pub struct RemoveFulfillmentPlacesMetadata {
19202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19203}
19204
19205impl RemoveFulfillmentPlacesMetadata {
19206 /// Creates a new default instance.
19207 pub fn new() -> Self {
19208 std::default::Default::default()
19209 }
19210}
19211
19212impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
19213 fn typename() -> &'static str {
19214 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
19215 }
19216}
19217
19218/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
19219/// is no meaningful response populated from the
19220/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19221/// method.
19222///
19223/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19224#[derive(Clone, Default, PartialEq)]
19225#[non_exhaustive]
19226pub struct RemoveFulfillmentPlacesResponse {
19227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19228}
19229
19230impl RemoveFulfillmentPlacesResponse {
19231 /// Creates a new default instance.
19232 pub fn new() -> Self {
19233 std::default::Default::default()
19234 }
19235}
19236
19237impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
19238 fn typename() -> &'static str {
19239 "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
19240 }
19241}
19242
19243/// Promotion information.
19244#[derive(Clone, Default, PartialEq)]
19245#[non_exhaustive]
19246pub struct Promotion {
19247 /// ID of the promotion. For example, "free gift".
19248 ///
19249 /// The value must be a UTF-8 encoded string with a length limit of 128
19250 /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
19251 /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
19252 /// returned.
19253 ///
19254 /// Corresponds to Google Merchant Center property
19255 /// [promotion_id](https://support.google.com/merchants/answer/7050148).
19256 pub promotion_id: std::string::String,
19257
19258 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19259}
19260
19261impl Promotion {
19262 /// Creates a new default instance.
19263 pub fn new() -> Self {
19264 std::default::Default::default()
19265 }
19266
19267 /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
19268 ///
19269 /// # Example
19270 /// ```ignore,no_run
19271 /// # use google_cloud_retail_v2::model::Promotion;
19272 /// let x = Promotion::new().set_promotion_id("example");
19273 /// ```
19274 pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19275 self.promotion_id = v.into();
19276 self
19277 }
19278}
19279
19280impl wkt::message::Message for Promotion {
19281 fn typename() -> &'static str {
19282 "type.googleapis.com/google.cloud.retail.v2.Promotion"
19283 }
19284}
19285
19286/// Metadata related to the progress of the Purge operation.
19287/// This will be returned by the google.longrunning.Operation.metadata field.
19288#[derive(Clone, Default, PartialEq)]
19289#[non_exhaustive]
19290pub struct PurgeMetadata {
19291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19292}
19293
19294impl PurgeMetadata {
19295 /// Creates a new default instance.
19296 pub fn new() -> Self {
19297 std::default::Default::default()
19298 }
19299}
19300
19301impl wkt::message::Message for PurgeMetadata {
19302 fn typename() -> &'static str {
19303 "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19304 }
19305}
19306
19307/// Metadata related to the progress of the PurgeProducts operation.
19308/// This will be returned by the google.longrunning.Operation.metadata field.
19309#[derive(Clone, Default, PartialEq)]
19310#[non_exhaustive]
19311pub struct PurgeProductsMetadata {
19312 /// Operation create time.
19313 pub create_time: std::option::Option<wkt::Timestamp>,
19314
19315 /// Operation last update time. If the operation is done, this is also the
19316 /// finish time.
19317 pub update_time: std::option::Option<wkt::Timestamp>,
19318
19319 /// Count of entries that were deleted successfully.
19320 pub success_count: i64,
19321
19322 /// Count of entries that encountered errors while processing.
19323 pub failure_count: i64,
19324
19325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19326}
19327
19328impl PurgeProductsMetadata {
19329 /// Creates a new default instance.
19330 pub fn new() -> Self {
19331 std::default::Default::default()
19332 }
19333
19334 /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19335 ///
19336 /// # Example
19337 /// ```ignore,no_run
19338 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19339 /// use wkt::Timestamp;
19340 /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19341 /// ```
19342 pub fn set_create_time<T>(mut self, v: T) -> Self
19343 where
19344 T: std::convert::Into<wkt::Timestamp>,
19345 {
19346 self.create_time = std::option::Option::Some(v.into());
19347 self
19348 }
19349
19350 /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19351 ///
19352 /// # Example
19353 /// ```ignore,no_run
19354 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19355 /// use wkt::Timestamp;
19356 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19357 /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19358 /// ```
19359 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19360 where
19361 T: std::convert::Into<wkt::Timestamp>,
19362 {
19363 self.create_time = v.map(|x| x.into());
19364 self
19365 }
19366
19367 /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19368 ///
19369 /// # Example
19370 /// ```ignore,no_run
19371 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19372 /// use wkt::Timestamp;
19373 /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19374 /// ```
19375 pub fn set_update_time<T>(mut self, v: T) -> Self
19376 where
19377 T: std::convert::Into<wkt::Timestamp>,
19378 {
19379 self.update_time = std::option::Option::Some(v.into());
19380 self
19381 }
19382
19383 /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19384 ///
19385 /// # Example
19386 /// ```ignore,no_run
19387 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19388 /// use wkt::Timestamp;
19389 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19390 /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19391 /// ```
19392 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19393 where
19394 T: std::convert::Into<wkt::Timestamp>,
19395 {
19396 self.update_time = v.map(|x| x.into());
19397 self
19398 }
19399
19400 /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19401 ///
19402 /// # Example
19403 /// ```ignore,no_run
19404 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19405 /// let x = PurgeProductsMetadata::new().set_success_count(42);
19406 /// ```
19407 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19408 self.success_count = v.into();
19409 self
19410 }
19411
19412 /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19413 ///
19414 /// # Example
19415 /// ```ignore,no_run
19416 /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19417 /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19418 /// ```
19419 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19420 self.failure_count = v.into();
19421 self
19422 }
19423}
19424
19425impl wkt::message::Message for PurgeProductsMetadata {
19426 fn typename() -> &'static str {
19427 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19428 }
19429}
19430
19431/// Request message for PurgeProducts method.
19432#[derive(Clone, Default, PartialEq)]
19433#[non_exhaustive]
19434pub struct PurgeProductsRequest {
19435 /// Required. The resource name of the branch under which the products are
19436 /// created. The format is
19437 /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19438 pub parent: std::string::String,
19439
19440 /// Required. The filter string to specify the products to be deleted with a
19441 /// length limit of 5,000 characters.
19442 ///
19443 /// Empty string filter is not allowed. "*" implies delete all items in a
19444 /// branch.
19445 ///
19446 /// The eligible fields for filtering are:
19447 ///
19448 /// * `availability`: Double quoted
19449 /// [Product.availability][google.cloud.retail.v2.Product.availability] string.
19450 /// * `create_time` : in ISO 8601 "zulu" format.
19451 ///
19452 /// Supported syntax:
19453 ///
19454 /// * Comparators (">", "<", ">=", "<=", "=").
19455 /// Examples:
19456 ///
19457 /// * create_time <= "2015-02-13T17:05:46Z"
19458 /// * availability = "IN_STOCK"
19459 /// * Conjunctions ("AND")
19460 /// Examples:
19461 ///
19462 /// * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19463 /// * Disjunctions ("OR")
19464 /// Examples:
19465 ///
19466 /// * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19467 /// * Can support nested queries.
19468 /// Examples:
19469 ///
19470 /// * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19471 /// OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19472 /// * Filter Limits:
19473 ///
19474 /// * Filter should not contain more than 6 conditions.
19475 /// * Max nesting depth should not exceed 2 levels.
19476 ///
19477 /// Examples queries:
19478 ///
19479 /// * Delete back order products created before a timestamp.
19480 /// create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19481 ///
19482 /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19483 pub filter: std::string::String,
19484
19485 /// Actually perform the purge.
19486 /// If `force` is set to false, the method will return the expected purge count
19487 /// without deleting any products.
19488 pub force: bool,
19489
19490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19491}
19492
19493impl PurgeProductsRequest {
19494 /// Creates a new default instance.
19495 pub fn new() -> Self {
19496 std::default::Default::default()
19497 }
19498
19499 /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19500 ///
19501 /// # Example
19502 /// ```ignore,no_run
19503 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19504 /// let x = PurgeProductsRequest::new().set_parent("example");
19505 /// ```
19506 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19507 self.parent = v.into();
19508 self
19509 }
19510
19511 /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19512 ///
19513 /// # Example
19514 /// ```ignore,no_run
19515 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19516 /// let x = PurgeProductsRequest::new().set_filter("example");
19517 /// ```
19518 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19519 self.filter = v.into();
19520 self
19521 }
19522
19523 /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19524 ///
19525 /// # Example
19526 /// ```ignore,no_run
19527 /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19528 /// let x = PurgeProductsRequest::new().set_force(true);
19529 /// ```
19530 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19531 self.force = v.into();
19532 self
19533 }
19534}
19535
19536impl wkt::message::Message for PurgeProductsRequest {
19537 fn typename() -> &'static str {
19538 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19539 }
19540}
19541
19542/// Response of the PurgeProductsRequest. If the long running operation is
19543/// successfully done, then this message is returned by the
19544/// google.longrunning.Operations.response field.
19545#[derive(Clone, Default, PartialEq)]
19546#[non_exhaustive]
19547pub struct PurgeProductsResponse {
19548 /// The total count of products purged as a result of the operation.
19549 pub purge_count: i64,
19550
19551 /// A sample of the product names that will be deleted.
19552 /// Only populated if `force` is set to false. A max of 100 names will be
19553 /// returned and the names are chosen at random.
19554 pub purge_sample: std::vec::Vec<std::string::String>,
19555
19556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19557}
19558
19559impl PurgeProductsResponse {
19560 /// Creates a new default instance.
19561 pub fn new() -> Self {
19562 std::default::Default::default()
19563 }
19564
19565 /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19566 ///
19567 /// # Example
19568 /// ```ignore,no_run
19569 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19570 /// let x = PurgeProductsResponse::new().set_purge_count(42);
19571 /// ```
19572 pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19573 self.purge_count = v.into();
19574 self
19575 }
19576
19577 /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19578 ///
19579 /// # Example
19580 /// ```ignore,no_run
19581 /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19582 /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19583 /// ```
19584 pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19585 where
19586 T: std::iter::IntoIterator<Item = V>,
19587 V: std::convert::Into<std::string::String>,
19588 {
19589 use std::iter::Iterator;
19590 self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19591 self
19592 }
19593}
19594
19595impl wkt::message::Message for PurgeProductsResponse {
19596 fn typename() -> &'static str {
19597 "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19598 }
19599}
19600
19601/// Request message for PurgeUserEvents method.
19602#[derive(Clone, Default, PartialEq)]
19603#[non_exhaustive]
19604pub struct PurgeUserEventsRequest {
19605 /// Required. The resource name of the catalog under which the events are
19606 /// created. The format is
19607 /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19608 pub parent: std::string::String,
19609
19610 /// Required. The filter string to specify the events to be deleted with a
19611 /// length limit of 5,000 characters. Empty string filter is not allowed. The
19612 /// eligible fields for filtering are:
19613 ///
19614 /// * `eventType`: Double quoted
19615 /// [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19616 /// * `eventTime`: in ISO 8601 "zulu" format.
19617 /// * `visitorId`: Double quoted string. Specifying this will delete all
19618 /// events associated with a visitor.
19619 /// * `userId`: Double quoted string. Specifying this will delete all events
19620 /// associated with a user.
19621 ///
19622 /// Examples:
19623 ///
19624 /// * Deleting all events in a time range:
19625 /// `eventTime > "2012-04-23T18:25:43.511Z"
19626 /// eventTime < "2012-04-23T18:30:43.511Z"`
19627 /// * Deleting specific eventType in time range:
19628 /// `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19629 /// * Deleting all events for a specific visitor:
19630 /// `visitorId = "visitor1024"`
19631 ///
19632 /// The filtering fields are assumed to have an implicit AND.
19633 ///
19634 /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19635 pub filter: std::string::String,
19636
19637 /// Actually perform the purge.
19638 /// If `force` is set to false, the method will return the expected purge count
19639 /// without deleting any user events.
19640 pub force: bool,
19641
19642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19643}
19644
19645impl PurgeUserEventsRequest {
19646 /// Creates a new default instance.
19647 pub fn new() -> Self {
19648 std::default::Default::default()
19649 }
19650
19651 /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19652 ///
19653 /// # Example
19654 /// ```ignore,no_run
19655 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19656 /// # let project_id = "project_id";
19657 /// # let location_id = "location_id";
19658 /// # let catalog_id = "catalog_id";
19659 /// let x = PurgeUserEventsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
19660 /// ```
19661 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19662 self.parent = v.into();
19663 self
19664 }
19665
19666 /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19667 ///
19668 /// # Example
19669 /// ```ignore,no_run
19670 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19671 /// let x = PurgeUserEventsRequest::new().set_filter("example");
19672 /// ```
19673 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19674 self.filter = v.into();
19675 self
19676 }
19677
19678 /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19679 ///
19680 /// # Example
19681 /// ```ignore,no_run
19682 /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19683 /// let x = PurgeUserEventsRequest::new().set_force(true);
19684 /// ```
19685 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19686 self.force = v.into();
19687 self
19688 }
19689}
19690
19691impl wkt::message::Message for PurgeUserEventsRequest {
19692 fn typename() -> &'static str {
19693 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19694 }
19695}
19696
19697/// Response of the PurgeUserEventsRequest. If the long running operation is
19698/// successfully done, then this message is returned by the
19699/// google.longrunning.Operations.response field.
19700#[derive(Clone, Default, PartialEq)]
19701#[non_exhaustive]
19702pub struct PurgeUserEventsResponse {
19703 /// The total count of events purged as a result of the operation.
19704 pub purged_events_count: i64,
19705
19706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19707}
19708
19709impl PurgeUserEventsResponse {
19710 /// Creates a new default instance.
19711 pub fn new() -> Self {
19712 std::default::Default::default()
19713 }
19714
19715 /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19716 ///
19717 /// # Example
19718 /// ```ignore,no_run
19719 /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19720 /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19721 /// ```
19722 pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19723 self.purged_events_count = v.into();
19724 self
19725 }
19726}
19727
19728impl wkt::message::Message for PurgeUserEventsResponse {
19729 fn typename() -> &'static str {
19730 "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19731 }
19732}
19733
19734/// Safety settings.
19735#[derive(Clone, Default, PartialEq)]
19736#[non_exhaustive]
19737pub struct SafetySetting {
19738 /// Harm category.
19739 pub category: crate::model::HarmCategory,
19740
19741 /// The harm block threshold.
19742 pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19743
19744 /// Optional. Specify if the threshold is used for probability or severity
19745 /// score. If not specified, the threshold is used for probability score.
19746 pub method: crate::model::safety_setting::HarmBlockMethod,
19747
19748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19749}
19750
19751impl SafetySetting {
19752 /// Creates a new default instance.
19753 pub fn new() -> Self {
19754 std::default::Default::default()
19755 }
19756
19757 /// Sets the value of [category][crate::model::SafetySetting::category].
19758 ///
19759 /// # Example
19760 /// ```ignore,no_run
19761 /// # use google_cloud_retail_v2::model::SafetySetting;
19762 /// use google_cloud_retail_v2::model::HarmCategory;
19763 /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19764 /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19765 /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19766 /// ```
19767 pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19768 self.category = v.into();
19769 self
19770 }
19771
19772 /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19773 ///
19774 /// # Example
19775 /// ```ignore,no_run
19776 /// # use google_cloud_retail_v2::model::SafetySetting;
19777 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19778 /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19779 /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19780 /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19781 /// ```
19782 pub fn set_threshold<
19783 T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19784 >(
19785 mut self,
19786 v: T,
19787 ) -> Self {
19788 self.threshold = v.into();
19789 self
19790 }
19791
19792 /// Sets the value of [method][crate::model::SafetySetting::method].
19793 ///
19794 /// # Example
19795 /// ```ignore,no_run
19796 /// # use google_cloud_retail_v2::model::SafetySetting;
19797 /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19798 /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19799 /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19800 /// ```
19801 pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19802 mut self,
19803 v: T,
19804 ) -> Self {
19805 self.method = v.into();
19806 self
19807 }
19808}
19809
19810impl wkt::message::Message for SafetySetting {
19811 fn typename() -> &'static str {
19812 "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19813 }
19814}
19815
19816/// Defines additional types related to [SafetySetting].
19817pub mod safety_setting {
19818 #[allow(unused_imports)]
19819 use super::*;
19820
19821 /// Probability based thresholds levels for blocking.
19822 ///
19823 /// # Working with unknown values
19824 ///
19825 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19826 /// additional enum variants at any time. Adding new variants is not considered
19827 /// a breaking change. Applications should write their code in anticipation of:
19828 ///
19829 /// - New values appearing in future releases of the client library, **and**
19830 /// - New values received dynamically, without application changes.
19831 ///
19832 /// Please consult the [Working with enums] section in the user guide for some
19833 /// guidelines.
19834 ///
19835 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19836 #[derive(Clone, Debug, PartialEq)]
19837 #[non_exhaustive]
19838 pub enum HarmBlockThreshold {
19839 /// Unspecified harm block threshold.
19840 Unspecified,
19841 /// Block low threshold and above (i.e. block more).
19842 BlockLowAndAbove,
19843 /// Block medium threshold and above.
19844 BlockMediumAndAbove,
19845 /// Block only high threshold (i.e. block less).
19846 BlockOnlyHigh,
19847 /// Block none.
19848 BlockNone,
19849 /// Turn off the safety filter.
19850 Off,
19851 /// If set, the enum was initialized with an unknown value.
19852 ///
19853 /// Applications can examine the value using [HarmBlockThreshold::value] or
19854 /// [HarmBlockThreshold::name].
19855 UnknownValue(harm_block_threshold::UnknownValue),
19856 }
19857
19858 #[doc(hidden)]
19859 pub mod harm_block_threshold {
19860 #[allow(unused_imports)]
19861 use super::*;
19862 #[derive(Clone, Debug, PartialEq)]
19863 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19864 }
19865
19866 impl HarmBlockThreshold {
19867 /// Gets the enum value.
19868 ///
19869 /// Returns `None` if the enum contains an unknown value deserialized from
19870 /// the string representation of enums.
19871 pub fn value(&self) -> std::option::Option<i32> {
19872 match self {
19873 Self::Unspecified => std::option::Option::Some(0),
19874 Self::BlockLowAndAbove => std::option::Option::Some(1),
19875 Self::BlockMediumAndAbove => std::option::Option::Some(2),
19876 Self::BlockOnlyHigh => std::option::Option::Some(3),
19877 Self::BlockNone => std::option::Option::Some(4),
19878 Self::Off => std::option::Option::Some(5),
19879 Self::UnknownValue(u) => u.0.value(),
19880 }
19881 }
19882
19883 /// Gets the enum value as a string.
19884 ///
19885 /// Returns `None` if the enum contains an unknown value deserialized from
19886 /// the integer representation of enums.
19887 pub fn name(&self) -> std::option::Option<&str> {
19888 match self {
19889 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19890 Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19891 Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19892 Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19893 Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19894 Self::Off => std::option::Option::Some("OFF"),
19895 Self::UnknownValue(u) => u.0.name(),
19896 }
19897 }
19898 }
19899
19900 impl std::default::Default for HarmBlockThreshold {
19901 fn default() -> Self {
19902 use std::convert::From;
19903 Self::from(0)
19904 }
19905 }
19906
19907 impl std::fmt::Display for HarmBlockThreshold {
19908 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19909 wkt::internal::display_enum(f, self.name(), self.value())
19910 }
19911 }
19912
19913 impl std::convert::From<i32> for HarmBlockThreshold {
19914 fn from(value: i32) -> Self {
19915 match value {
19916 0 => Self::Unspecified,
19917 1 => Self::BlockLowAndAbove,
19918 2 => Self::BlockMediumAndAbove,
19919 3 => Self::BlockOnlyHigh,
19920 4 => Self::BlockNone,
19921 5 => Self::Off,
19922 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19923 wkt::internal::UnknownEnumValue::Integer(value),
19924 )),
19925 }
19926 }
19927 }
19928
19929 impl std::convert::From<&str> for HarmBlockThreshold {
19930 fn from(value: &str) -> Self {
19931 use std::string::ToString;
19932 match value {
19933 "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19934 "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19935 "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19936 "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19937 "BLOCK_NONE" => Self::BlockNone,
19938 "OFF" => Self::Off,
19939 _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19940 wkt::internal::UnknownEnumValue::String(value.to_string()),
19941 )),
19942 }
19943 }
19944 }
19945
19946 impl serde::ser::Serialize for HarmBlockThreshold {
19947 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19948 where
19949 S: serde::Serializer,
19950 {
19951 match self {
19952 Self::Unspecified => serializer.serialize_i32(0),
19953 Self::BlockLowAndAbove => serializer.serialize_i32(1),
19954 Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19955 Self::BlockOnlyHigh => serializer.serialize_i32(3),
19956 Self::BlockNone => serializer.serialize_i32(4),
19957 Self::Off => serializer.serialize_i32(5),
19958 Self::UnknownValue(u) => u.0.serialize(serializer),
19959 }
19960 }
19961 }
19962
19963 impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19964 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19965 where
19966 D: serde::Deserializer<'de>,
19967 {
19968 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19969 ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19970 ))
19971 }
19972 }
19973
19974 /// Probability vs severity.
19975 ///
19976 /// # Working with unknown values
19977 ///
19978 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19979 /// additional enum variants at any time. Adding new variants is not considered
19980 /// a breaking change. Applications should write their code in anticipation of:
19981 ///
19982 /// - New values appearing in future releases of the client library, **and**
19983 /// - New values received dynamically, without application changes.
19984 ///
19985 /// Please consult the [Working with enums] section in the user guide for some
19986 /// guidelines.
19987 ///
19988 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19989 #[derive(Clone, Debug, PartialEq)]
19990 #[non_exhaustive]
19991 pub enum HarmBlockMethod {
19992 /// The harm block method is unspecified.
19993 Unspecified,
19994 /// The harm block method uses both probability and severity scores.
19995 Severity,
19996 /// The harm block method uses the probability score.
19997 Probability,
19998 /// If set, the enum was initialized with an unknown value.
19999 ///
20000 /// Applications can examine the value using [HarmBlockMethod::value] or
20001 /// [HarmBlockMethod::name].
20002 UnknownValue(harm_block_method::UnknownValue),
20003 }
20004
20005 #[doc(hidden)]
20006 pub mod harm_block_method {
20007 #[allow(unused_imports)]
20008 use super::*;
20009 #[derive(Clone, Debug, PartialEq)]
20010 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20011 }
20012
20013 impl HarmBlockMethod {
20014 /// Gets the enum value.
20015 ///
20016 /// Returns `None` if the enum contains an unknown value deserialized from
20017 /// the string representation of enums.
20018 pub fn value(&self) -> std::option::Option<i32> {
20019 match self {
20020 Self::Unspecified => std::option::Option::Some(0),
20021 Self::Severity => std::option::Option::Some(1),
20022 Self::Probability => std::option::Option::Some(2),
20023 Self::UnknownValue(u) => u.0.value(),
20024 }
20025 }
20026
20027 /// Gets the enum value as a string.
20028 ///
20029 /// Returns `None` if the enum contains an unknown value deserialized from
20030 /// the integer representation of enums.
20031 pub fn name(&self) -> std::option::Option<&str> {
20032 match self {
20033 Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
20034 Self::Severity => std::option::Option::Some("SEVERITY"),
20035 Self::Probability => std::option::Option::Some("PROBABILITY"),
20036 Self::UnknownValue(u) => u.0.name(),
20037 }
20038 }
20039 }
20040
20041 impl std::default::Default for HarmBlockMethod {
20042 fn default() -> Self {
20043 use std::convert::From;
20044 Self::from(0)
20045 }
20046 }
20047
20048 impl std::fmt::Display for HarmBlockMethod {
20049 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20050 wkt::internal::display_enum(f, self.name(), self.value())
20051 }
20052 }
20053
20054 impl std::convert::From<i32> for HarmBlockMethod {
20055 fn from(value: i32) -> Self {
20056 match value {
20057 0 => Self::Unspecified,
20058 1 => Self::Severity,
20059 2 => Self::Probability,
20060 _ => Self::UnknownValue(harm_block_method::UnknownValue(
20061 wkt::internal::UnknownEnumValue::Integer(value),
20062 )),
20063 }
20064 }
20065 }
20066
20067 impl std::convert::From<&str> for HarmBlockMethod {
20068 fn from(value: &str) -> Self {
20069 use std::string::ToString;
20070 match value {
20071 "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
20072 "SEVERITY" => Self::Severity,
20073 "PROBABILITY" => Self::Probability,
20074 _ => Self::UnknownValue(harm_block_method::UnknownValue(
20075 wkt::internal::UnknownEnumValue::String(value.to_string()),
20076 )),
20077 }
20078 }
20079 }
20080
20081 impl serde::ser::Serialize for HarmBlockMethod {
20082 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20083 where
20084 S: serde::Serializer,
20085 {
20086 match self {
20087 Self::Unspecified => serializer.serialize_i32(0),
20088 Self::Severity => serializer.serialize_i32(1),
20089 Self::Probability => serializer.serialize_i32(2),
20090 Self::UnknownValue(u) => u.0.serialize(serializer),
20091 }
20092 }
20093 }
20094
20095 impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
20096 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20097 where
20098 D: serde::Deserializer<'de>,
20099 {
20100 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
20101 ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
20102 ))
20103 }
20104 }
20105}
20106
20107/// Product attribute which structured by an attribute name and value. This
20108/// structure is used in conversational search filters and answers. For example,
20109/// if we have `name=color` and `value=red`, this means that the color is `red`.
20110#[derive(Clone, Default, PartialEq)]
20111#[non_exhaustive]
20112pub struct ProductAttributeValue {
20113 /// The attribute name.
20114 pub name: std::string::String,
20115
20116 /// The attribute value.
20117 pub value: std::string::String,
20118
20119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20120}
20121
20122impl ProductAttributeValue {
20123 /// Creates a new default instance.
20124 pub fn new() -> Self {
20125 std::default::Default::default()
20126 }
20127
20128 /// Sets the value of [name][crate::model::ProductAttributeValue::name].
20129 ///
20130 /// # Example
20131 /// ```ignore,no_run
20132 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20133 /// let x = ProductAttributeValue::new().set_name("example");
20134 /// ```
20135 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20136 self.name = v.into();
20137 self
20138 }
20139
20140 /// Sets the value of [value][crate::model::ProductAttributeValue::value].
20141 ///
20142 /// # Example
20143 /// ```ignore,no_run
20144 /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20145 /// let x = ProductAttributeValue::new().set_value("example");
20146 /// ```
20147 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20148 self.value = v.into();
20149 self
20150 }
20151}
20152
20153impl wkt::message::Message for ProductAttributeValue {
20154 fn typename() -> &'static str {
20155 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
20156 }
20157}
20158
20159/// Product attribute name and numeric interval.
20160#[derive(Clone, Default, PartialEq)]
20161#[non_exhaustive]
20162pub struct ProductAttributeInterval {
20163 /// The attribute name (e.g. "length")
20164 pub name: std::string::String,
20165
20166 /// The numeric interval (e.g. [10, 20))
20167 pub interval: std::option::Option<crate::model::Interval>,
20168
20169 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20170}
20171
20172impl ProductAttributeInterval {
20173 /// Creates a new default instance.
20174 pub fn new() -> Self {
20175 std::default::Default::default()
20176 }
20177
20178 /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
20179 ///
20180 /// # Example
20181 /// ```ignore,no_run
20182 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20183 /// let x = ProductAttributeInterval::new().set_name("example");
20184 /// ```
20185 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20186 self.name = v.into();
20187 self
20188 }
20189
20190 /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
20191 ///
20192 /// # Example
20193 /// ```ignore,no_run
20194 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20195 /// use google_cloud_retail_v2::model::Interval;
20196 /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
20197 /// ```
20198 pub fn set_interval<T>(mut self, v: T) -> Self
20199 where
20200 T: std::convert::Into<crate::model::Interval>,
20201 {
20202 self.interval = std::option::Option::Some(v.into());
20203 self
20204 }
20205
20206 /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
20207 ///
20208 /// # Example
20209 /// ```ignore,no_run
20210 /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20211 /// use google_cloud_retail_v2::model::Interval;
20212 /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
20213 /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
20214 /// ```
20215 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
20216 where
20217 T: std::convert::Into<crate::model::Interval>,
20218 {
20219 self.interval = v.map(|x| x.into());
20220 self
20221 }
20222}
20223
20224impl wkt::message::Message for ProductAttributeInterval {
20225 fn typename() -> &'static str {
20226 "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
20227 }
20228}
20229
20230/// This field specifies the tile information including an attribute key,
20231/// attribute value. More fields will be added in the future, eg: product id
20232/// or product counts, etc.
20233#[derive(Clone, Default, PartialEq)]
20234#[non_exhaustive]
20235pub struct Tile {
20236 /// The representative product id for this tile.
20237 pub representative_product_id: std::string::String,
20238
20239 /// The attribute key and value for the tile.
20240 pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
20241
20242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20243}
20244
20245impl Tile {
20246 /// Creates a new default instance.
20247 pub fn new() -> Self {
20248 std::default::Default::default()
20249 }
20250
20251 /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
20252 ///
20253 /// # Example
20254 /// ```ignore,no_run
20255 /// # use google_cloud_retail_v2::model::Tile;
20256 /// let x = Tile::new().set_representative_product_id("example");
20257 /// ```
20258 pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
20259 mut self,
20260 v: T,
20261 ) -> Self {
20262 self.representative_product_id = v.into();
20263 self
20264 }
20265
20266 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
20267 ///
20268 /// Note that all the setters affecting `product_attribute` are mutually
20269 /// exclusive.
20270 ///
20271 /// # Example
20272 /// ```ignore,no_run
20273 /// # use google_cloud_retail_v2::model::Tile;
20274 /// use google_cloud_retail_v2::model::ProductAttributeValue;
20275 /// let x = Tile::new().set_product_attribute(Some(
20276 /// google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
20277 /// ```
20278 pub fn set_product_attribute<
20279 T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
20280 >(
20281 mut self,
20282 v: T,
20283 ) -> Self {
20284 self.product_attribute = v.into();
20285 self
20286 }
20287
20288 /// The value of [product_attribute][crate::model::Tile::product_attribute]
20289 /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
20290 /// holds a different branch.
20291 pub fn product_attribute_value(
20292 &self,
20293 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
20294 #[allow(unreachable_patterns)]
20295 self.product_attribute.as_ref().and_then(|v| match v {
20296 crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
20297 std::option::Option::Some(v)
20298 }
20299 _ => std::option::Option::None,
20300 })
20301 }
20302
20303 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20304 /// to hold a `ProductAttributeValue`.
20305 ///
20306 /// Note that all the setters affecting `product_attribute` are
20307 /// mutually exclusive.
20308 ///
20309 /// # Example
20310 /// ```ignore,no_run
20311 /// # use google_cloud_retail_v2::model::Tile;
20312 /// use google_cloud_retail_v2::model::ProductAttributeValue;
20313 /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20314 /// assert!(x.product_attribute_value().is_some());
20315 /// assert!(x.product_attribute_interval().is_none());
20316 /// ```
20317 pub fn set_product_attribute_value<
20318 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20319 >(
20320 mut self,
20321 v: T,
20322 ) -> Self {
20323 self.product_attribute = std::option::Option::Some(
20324 crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20325 );
20326 self
20327 }
20328
20329 /// The value of [product_attribute][crate::model::Tile::product_attribute]
20330 /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20331 /// holds a different branch.
20332 pub fn product_attribute_interval(
20333 &self,
20334 ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20335 #[allow(unreachable_patterns)]
20336 self.product_attribute.as_ref().and_then(|v| match v {
20337 crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20338 std::option::Option::Some(v)
20339 }
20340 _ => std::option::Option::None,
20341 })
20342 }
20343
20344 /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20345 /// to hold a `ProductAttributeInterval`.
20346 ///
20347 /// Note that all the setters affecting `product_attribute` are
20348 /// mutually exclusive.
20349 ///
20350 /// # Example
20351 /// ```ignore,no_run
20352 /// # use google_cloud_retail_v2::model::Tile;
20353 /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20354 /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20355 /// assert!(x.product_attribute_interval().is_some());
20356 /// assert!(x.product_attribute_value().is_none());
20357 /// ```
20358 pub fn set_product_attribute_interval<
20359 T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20360 >(
20361 mut self,
20362 v: T,
20363 ) -> Self {
20364 self.product_attribute = std::option::Option::Some(
20365 crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20366 );
20367 self
20368 }
20369}
20370
20371impl wkt::message::Message for Tile {
20372 fn typename() -> &'static str {
20373 "type.googleapis.com/google.cloud.retail.v2.Tile"
20374 }
20375}
20376
20377/// Defines additional types related to [Tile].
20378pub mod tile {
20379 #[allow(unused_imports)]
20380 use super::*;
20381
20382 /// The attribute key and value for the tile.
20383 #[derive(Clone, Debug, PartialEq)]
20384 #[non_exhaustive]
20385 pub enum ProductAttribute {
20386 /// The product attribute key-value.
20387 ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20388 /// The product attribute key-numeric interval.
20389 ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20390 }
20391}
20392
20393/// Request message for
20394/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20395///
20396/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20397#[derive(Clone, Default, PartialEq)]
20398#[non_exhaustive]
20399pub struct SearchRequest {
20400 /// Required. The resource name of the Retail Search serving config, such as
20401 /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20402 /// or the name of the legacy placement resource, such as
20403 /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20404 /// This field is used to identify the serving config name and the set
20405 /// of models that are used to make the search.
20406 pub placement: std::string::String,
20407
20408 /// The branch resource name, such as
20409 /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20410 ///
20411 /// Use "default_branch" as the branch ID or leave this field empty, to search
20412 /// products under the default branch.
20413 pub branch: std::string::String,
20414
20415 /// Raw search query.
20416 ///
20417 /// If this field is empty, the request is considered a category browsing
20418 /// request and returned results are based on
20419 /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20420 /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20421 ///
20422 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20423 /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20424 pub query: std::string::String,
20425
20426 /// Required. A unique identifier for tracking visitors. For example, this
20427 /// could be implemented with an HTTP cookie, which should be able to uniquely
20428 /// identify a visitor on a single device. This unique identifier should not
20429 /// change if the visitor logs in or out of the website.
20430 ///
20431 /// This should be the same identifier as
20432 /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20433 ///
20434 /// The field must be a UTF-8 encoded string with a length limit of 128
20435 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20436 ///
20437 /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20438 pub visitor_id: std::string::String,
20439
20440 /// User information.
20441 pub user_info: std::option::Option<crate::model::UserInfo>,
20442
20443 /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20444 /// unspecified, defaults to a reasonable value. The maximum allowed value is
20445 /// 120. Values above 120 will be coerced to 120.
20446 ///
20447 /// If this field is negative, an INVALID_ARGUMENT is returned.
20448 ///
20449 /// [google.cloud.retail.v2.Product]: crate::model::Product
20450 pub page_size: i32,
20451
20452 /// A page token
20453 /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20454 /// received from a previous
20455 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20456 /// Provide this to retrieve the subsequent page.
20457 ///
20458 /// When paginating, all other parameters provided to
20459 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20460 /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20461 /// error is returned.
20462 ///
20463 /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20464 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20465 pub page_token: std::string::String,
20466
20467 /// A 0-indexed integer that specifies the current offset (that is, starting
20468 /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20469 /// deemed by the API as relevant) in search results. This field is only
20470 /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20471 /// is unset.
20472 ///
20473 /// If this field is negative, an INVALID_ARGUMENT is returned.
20474 ///
20475 /// [google.cloud.retail.v2.Product]: crate::model::Product
20476 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20477 pub offset: i32,
20478
20479 /// The filter syntax consists of an expression language for constructing a
20480 /// predicate from one or more fields of the products being filtered. Filter
20481 /// expression is case-sensitive. For more information, see
20482 /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20483 ///
20484 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20485 pub filter: std::string::String,
20486
20487 /// The default filter that is applied when a user performs a search without
20488 /// checking any filters on the search page.
20489 ///
20490 /// The filter applied to every search request when quality improvement such as
20491 /// query expansion is needed. In the case a query does not have a sufficient
20492 /// amount of results this filter will be used to determine whether or not to
20493 /// enable the query expansion flow. The original filter will still be used for
20494 /// the query expanded search.
20495 /// This field is strongly recommended to achieve high search quality.
20496 ///
20497 /// For more information about filter syntax, see
20498 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20499 ///
20500 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20501 pub canonical_filter: std::string::String,
20502
20503 /// The order in which products are returned. Products can be ordered by
20504 /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20505 /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20506 /// more information, see
20507 /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20508 ///
20509 /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20510 ///
20511 /// [google.cloud.retail.v2.Product]: crate::model::Product
20512 pub order_by: std::string::String,
20513
20514 /// Facet specifications for faceted search. If empty, no facets are returned.
20515 ///
20516 /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20517 /// is returned.
20518 pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20519
20520 /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20521 /// to enable dynamic facets. Do not set this field.
20522 ///
20523 /// The specification for dynamically generated facets. Notice that only
20524 /// textual facets can be dynamically generated.
20525 #[deprecated]
20526 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20527
20528 /// Boost specification to boost certain products. For more information, see
20529 /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20530 ///
20531 /// Notice that if both
20532 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20533 /// and
20534 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20535 /// are set, the boost conditions from both places are evaluated. If a search
20536 /// request matches multiple boost conditions, the final boost score is equal
20537 /// to the sum of the boost scores from all matched boost conditions.
20538 ///
20539 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20540 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20541 pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20542
20543 /// The query expansion specification that specifies the conditions under which
20544 /// query expansion occurs. For more information, see [Query
20545 /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20546 pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20547
20548 /// The keys to fetch and rollup the matching
20549 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20550 /// [Product][google.cloud.retail.v2.Product]s attributes,
20551 /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20552 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20553 /// attributes from all the matching
20554 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20555 /// [Product][google.cloud.retail.v2.Product]s or
20556 /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20557 /// de-duplicated. Notice that rollup attributes will lead to extra query
20558 /// latency. Maximum number of keys is 30.
20559 ///
20560 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20561 /// fulfillment type and a fulfillment ID must be provided in the format of
20562 /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20563 /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20564 ///
20565 /// Supported keys are:
20566 ///
20567 /// * colorFamilies
20568 /// * price
20569 /// * originalPrice
20570 /// * discount
20571 /// * variantId
20572 /// * inventory(place_id,price)
20573 /// * inventory(place_id,original_price)
20574 /// * inventory(place_id,attributes.key), where key is any key in the
20575 /// [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20576 /// map.
20577 /// * attributes.key, where key is any key in the
20578 /// [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20579 /// * pickupInStore.id, where id is any
20580 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20581 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20582 /// "pickup-in-store".
20583 /// * shipToStore.id, where id is any
20584 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20585 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20586 /// "ship-to-store".
20587 /// * sameDayDelivery.id, where id is any
20588 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20589 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20590 /// "same-day-delivery".
20591 /// * nextDayDelivery.id, where id is any
20592 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20593 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20594 /// "next-day-delivery".
20595 /// * customFulfillment1.id, where id is any
20596 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20597 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20598 /// "custom-type-1".
20599 /// * customFulfillment2.id, where id is any
20600 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20601 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20602 /// "custom-type-2".
20603 /// * customFulfillment3.id, where id is any
20604 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20605 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20606 /// "custom-type-3".
20607 /// * customFulfillment4.id, where id is any
20608 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20609 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20610 /// "custom-type-4".
20611 /// * customFulfillment5.id, where id is any
20612 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20613 /// for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20614 /// "custom-type-5".
20615 ///
20616 /// If this field is set to an invalid value other than these, an
20617 /// INVALID_ARGUMENT error is returned.
20618 ///
20619 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20620 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20621 /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20622 /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20623 /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20624 /// [google.cloud.retail.v2.Product]: crate::model::Product
20625 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20626 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20627 pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20628
20629 /// The categories associated with a category page. Must be set for category
20630 /// navigation queries to achieve good search quality. The format should be
20631 /// the same as
20632 /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20633 ///
20634 /// To represent full path of category, use '>' sign to separate different
20635 /// hierarchies. If '>' is part of the category name, replace it with
20636 /// other character(s).
20637 ///
20638 /// Category pages include special pages such as sales or promotions. For
20639 /// instance, a special sale page may have the category hierarchy:
20640 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20641 ///
20642 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20643 pub page_categories: std::vec::Vec<std::string::String>,
20644
20645 /// The search mode of the search request. If not specified, a single search
20646 /// request triggers both product search and faceted search.
20647 pub search_mode: crate::model::search_request::SearchMode,
20648
20649 /// The specification for personalization.
20650 ///
20651 /// Notice that if both
20652 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20653 /// and
20654 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20655 /// are set.
20656 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20657 /// will override
20658 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20659 ///
20660 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20661 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20662 pub personalization_spec:
20663 std::option::Option<crate::model::search_request::PersonalizationSpec>,
20664
20665 /// The labels applied to a resource must meet the following requirements:
20666 ///
20667 /// * Each resource can have multiple labels, up to a maximum of 64.
20668 /// * Each label must be a key-value pair.
20669 /// * Keys have a minimum length of 1 character and a maximum length of 63
20670 /// characters and cannot be empty. Values can be empty and have a maximum
20671 /// length of 63 characters.
20672 /// * Keys and values can contain only lowercase letters, numeric characters,
20673 /// underscores, and dashes. All characters must use UTF-8 encoding, and
20674 /// international characters are allowed.
20675 /// * The key portion of a label must be unique. However, you can use the same
20676 /// key with multiple resources.
20677 /// * Keys must start with a lowercase letter or international character.
20678 ///
20679 /// For more information, see [Requirements for
20680 /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20681 /// in the Resource Manager documentation.
20682 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20683
20684 /// The spell correction specification that specifies the mode under
20685 /// which spell correction will take effect.
20686 pub spell_correction_spec:
20687 std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20688
20689 /// The entity for customers that may run multiple different entities, domains,
20690 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20691 /// `google.com`, `youtube.com`, etc.
20692 /// If this is set, it should be exactly matched with
20693 /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20694 /// results boosted by entity.
20695 ///
20696 /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20697 pub entity: std::string::String,
20698
20699 /// Optional. This field specifies all conversational related parameters
20700 /// addition to traditional retail search.
20701 pub conversational_search_spec:
20702 std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20703
20704 /// Optional. This field specifies tile navigation related parameters.
20705 pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20706
20707 /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20708 /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20709 /// information, see [Standardized codes](https://google.aip.dev/143). This
20710 /// field helps to better interpret the query. If a value isn't specified, the
20711 /// query language code is automatically detected, which may not be accurate.
20712 pub language_code: std::string::String,
20713
20714 /// Optional. The Unicode country/region code (CLDR) of a location, such as
20715 /// "US" and "419"
20716 /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20717 /// For more information, see [Standardized codes](https://google.aip.dev/143).
20718 /// If set, then results will be boosted based on the region_code provided.
20719 pub region_code: std::string::String,
20720
20721 /// Optional. An id corresponding to a place, such as a store id or region id.
20722 /// When specified, we use the price from the local inventory with the matching
20723 /// product's
20724 /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20725 /// for revenue optimization.
20726 ///
20727 /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20728 pub place_id: std::string::String,
20729
20730 /// Optional. The user attributes that could be used for personalization of
20731 /// search results.
20732 ///
20733 /// * Populate at most 100 key-value pairs per query.
20734 /// * Only supports string keys and repeated string values.
20735 /// * Duplicate keys are not allowed within a single query.
20736 ///
20737 /// Example:
20738 /// user_attributes: [
20739 /// { key: "pets"
20740 /// value {
20741 /// values: "dog"
20742 /// values: "cat"
20743 /// }
20744 /// },
20745 /// { key: "state"
20746 /// value {
20747 /// values: "CA"
20748 /// }
20749 /// }
20750 /// ]
20751 pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20752
20753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20754}
20755
20756impl SearchRequest {
20757 /// Creates a new default instance.
20758 pub fn new() -> Self {
20759 std::default::Default::default()
20760 }
20761
20762 /// Sets the value of [placement][crate::model::SearchRequest::placement].
20763 ///
20764 /// # Example
20765 /// ```ignore,no_run
20766 /// # use google_cloud_retail_v2::model::SearchRequest;
20767 /// let x = SearchRequest::new().set_placement("example");
20768 /// ```
20769 pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20770 self.placement = v.into();
20771 self
20772 }
20773
20774 /// Sets the value of [branch][crate::model::SearchRequest::branch].
20775 ///
20776 /// # Example
20777 /// ```ignore,no_run
20778 /// # use google_cloud_retail_v2::model::SearchRequest;
20779 /// let x = SearchRequest::new().set_branch("example");
20780 /// ```
20781 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20782 self.branch = v.into();
20783 self
20784 }
20785
20786 /// Sets the value of [query][crate::model::SearchRequest::query].
20787 ///
20788 /// # Example
20789 /// ```ignore,no_run
20790 /// # use google_cloud_retail_v2::model::SearchRequest;
20791 /// let x = SearchRequest::new().set_query("example");
20792 /// ```
20793 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20794 self.query = v.into();
20795 self
20796 }
20797
20798 /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20799 ///
20800 /// # Example
20801 /// ```ignore,no_run
20802 /// # use google_cloud_retail_v2::model::SearchRequest;
20803 /// let x = SearchRequest::new().set_visitor_id("example");
20804 /// ```
20805 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20806 self.visitor_id = v.into();
20807 self
20808 }
20809
20810 /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20811 ///
20812 /// # Example
20813 /// ```ignore,no_run
20814 /// # use google_cloud_retail_v2::model::SearchRequest;
20815 /// use google_cloud_retail_v2::model::UserInfo;
20816 /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20817 /// ```
20818 pub fn set_user_info<T>(mut self, v: T) -> Self
20819 where
20820 T: std::convert::Into<crate::model::UserInfo>,
20821 {
20822 self.user_info = std::option::Option::Some(v.into());
20823 self
20824 }
20825
20826 /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20827 ///
20828 /// # Example
20829 /// ```ignore,no_run
20830 /// # use google_cloud_retail_v2::model::SearchRequest;
20831 /// use google_cloud_retail_v2::model::UserInfo;
20832 /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20833 /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20834 /// ```
20835 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20836 where
20837 T: std::convert::Into<crate::model::UserInfo>,
20838 {
20839 self.user_info = v.map(|x| x.into());
20840 self
20841 }
20842
20843 /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20844 ///
20845 /// # Example
20846 /// ```ignore,no_run
20847 /// # use google_cloud_retail_v2::model::SearchRequest;
20848 /// let x = SearchRequest::new().set_page_size(42);
20849 /// ```
20850 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20851 self.page_size = v.into();
20852 self
20853 }
20854
20855 /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20856 ///
20857 /// # Example
20858 /// ```ignore,no_run
20859 /// # use google_cloud_retail_v2::model::SearchRequest;
20860 /// let x = SearchRequest::new().set_page_token("example");
20861 /// ```
20862 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20863 self.page_token = v.into();
20864 self
20865 }
20866
20867 /// Sets the value of [offset][crate::model::SearchRequest::offset].
20868 ///
20869 /// # Example
20870 /// ```ignore,no_run
20871 /// # use google_cloud_retail_v2::model::SearchRequest;
20872 /// let x = SearchRequest::new().set_offset(42);
20873 /// ```
20874 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20875 self.offset = v.into();
20876 self
20877 }
20878
20879 /// Sets the value of [filter][crate::model::SearchRequest::filter].
20880 ///
20881 /// # Example
20882 /// ```ignore,no_run
20883 /// # use google_cloud_retail_v2::model::SearchRequest;
20884 /// let x = SearchRequest::new().set_filter("example");
20885 /// ```
20886 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20887 self.filter = v.into();
20888 self
20889 }
20890
20891 /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20892 ///
20893 /// # Example
20894 /// ```ignore,no_run
20895 /// # use google_cloud_retail_v2::model::SearchRequest;
20896 /// let x = SearchRequest::new().set_canonical_filter("example");
20897 /// ```
20898 pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20899 mut self,
20900 v: T,
20901 ) -> Self {
20902 self.canonical_filter = v.into();
20903 self
20904 }
20905
20906 /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20907 ///
20908 /// # Example
20909 /// ```ignore,no_run
20910 /// # use google_cloud_retail_v2::model::SearchRequest;
20911 /// let x = SearchRequest::new().set_order_by("example");
20912 /// ```
20913 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20914 self.order_by = v.into();
20915 self
20916 }
20917
20918 /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20919 ///
20920 /// # Example
20921 /// ```ignore,no_run
20922 /// # use google_cloud_retail_v2::model::SearchRequest;
20923 /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20924 /// let x = SearchRequest::new()
20925 /// .set_facet_specs([
20926 /// FacetSpec::default()/* use setters */,
20927 /// FacetSpec::default()/* use (different) setters */,
20928 /// ]);
20929 /// ```
20930 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20931 where
20932 T: std::iter::IntoIterator<Item = V>,
20933 V: std::convert::Into<crate::model::search_request::FacetSpec>,
20934 {
20935 use std::iter::Iterator;
20936 self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20937 self
20938 }
20939
20940 /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20941 ///
20942 /// # Example
20943 /// ```ignore,no_run
20944 /// # use google_cloud_retail_v2::model::SearchRequest;
20945 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20946 /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20947 /// ```
20948 #[deprecated]
20949 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20950 where
20951 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20952 {
20953 self.dynamic_facet_spec = std::option::Option::Some(v.into());
20954 self
20955 }
20956
20957 /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20958 ///
20959 /// # Example
20960 /// ```ignore,no_run
20961 /// # use google_cloud_retail_v2::model::SearchRequest;
20962 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20963 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20964 /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20965 /// ```
20966 #[deprecated]
20967 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20968 where
20969 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20970 {
20971 self.dynamic_facet_spec = v.map(|x| x.into());
20972 self
20973 }
20974
20975 /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20976 ///
20977 /// # Example
20978 /// ```ignore,no_run
20979 /// # use google_cloud_retail_v2::model::SearchRequest;
20980 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20981 /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20982 /// ```
20983 pub fn set_boost_spec<T>(mut self, v: T) -> Self
20984 where
20985 T: std::convert::Into<crate::model::search_request::BoostSpec>,
20986 {
20987 self.boost_spec = std::option::Option::Some(v.into());
20988 self
20989 }
20990
20991 /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20992 ///
20993 /// # Example
20994 /// ```ignore,no_run
20995 /// # use google_cloud_retail_v2::model::SearchRequest;
20996 /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20997 /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
20998 /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
20999 /// ```
21000 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
21001 where
21002 T: std::convert::Into<crate::model::search_request::BoostSpec>,
21003 {
21004 self.boost_spec = v.map(|x| x.into());
21005 self
21006 }
21007
21008 /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
21009 ///
21010 /// # Example
21011 /// ```ignore,no_run
21012 /// # use google_cloud_retail_v2::model::SearchRequest;
21013 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21014 /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
21015 /// ```
21016 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
21017 where
21018 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
21019 {
21020 self.query_expansion_spec = std::option::Option::Some(v.into());
21021 self
21022 }
21023
21024 /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
21025 ///
21026 /// # Example
21027 /// ```ignore,no_run
21028 /// # use google_cloud_retail_v2::model::SearchRequest;
21029 /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21030 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
21031 /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
21032 /// ```
21033 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
21034 where
21035 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
21036 {
21037 self.query_expansion_spec = v.map(|x| x.into());
21038 self
21039 }
21040
21041 /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
21042 ///
21043 /// # Example
21044 /// ```ignore,no_run
21045 /// # use google_cloud_retail_v2::model::SearchRequest;
21046 /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
21047 /// ```
21048 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
21049 where
21050 T: std::iter::IntoIterator<Item = V>,
21051 V: std::convert::Into<std::string::String>,
21052 {
21053 use std::iter::Iterator;
21054 self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
21055 self
21056 }
21057
21058 /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
21059 ///
21060 /// # Example
21061 /// ```ignore,no_run
21062 /// # use google_cloud_retail_v2::model::SearchRequest;
21063 /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
21064 /// ```
21065 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
21066 where
21067 T: std::iter::IntoIterator<Item = V>,
21068 V: std::convert::Into<std::string::String>,
21069 {
21070 use std::iter::Iterator;
21071 self.page_categories = v.into_iter().map(|i| i.into()).collect();
21072 self
21073 }
21074
21075 /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
21076 ///
21077 /// # Example
21078 /// ```ignore,no_run
21079 /// # use google_cloud_retail_v2::model::SearchRequest;
21080 /// use google_cloud_retail_v2::model::search_request::SearchMode;
21081 /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
21082 /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
21083 /// ```
21084 pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
21085 mut self,
21086 v: T,
21087 ) -> Self {
21088 self.search_mode = v.into();
21089 self
21090 }
21091
21092 /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
21093 ///
21094 /// # Example
21095 /// ```ignore,no_run
21096 /// # use google_cloud_retail_v2::model::SearchRequest;
21097 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
21098 /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
21099 /// ```
21100 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
21101 where
21102 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
21103 {
21104 self.personalization_spec = std::option::Option::Some(v.into());
21105 self
21106 }
21107
21108 /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
21109 ///
21110 /// # Example
21111 /// ```ignore,no_run
21112 /// # use google_cloud_retail_v2::model::SearchRequest;
21113 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
21114 /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
21115 /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
21116 /// ```
21117 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
21118 where
21119 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
21120 {
21121 self.personalization_spec = v.map(|x| x.into());
21122 self
21123 }
21124
21125 /// Sets the value of [labels][crate::model::SearchRequest::labels].
21126 ///
21127 /// # Example
21128 /// ```ignore,no_run
21129 /// # use google_cloud_retail_v2::model::SearchRequest;
21130 /// let x = SearchRequest::new().set_labels([
21131 /// ("key0", "abc"),
21132 /// ("key1", "xyz"),
21133 /// ]);
21134 /// ```
21135 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
21136 where
21137 T: std::iter::IntoIterator<Item = (K, V)>,
21138 K: std::convert::Into<std::string::String>,
21139 V: std::convert::Into<std::string::String>,
21140 {
21141 use std::iter::Iterator;
21142 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21143 self
21144 }
21145
21146 /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21147 ///
21148 /// # Example
21149 /// ```ignore,no_run
21150 /// # use google_cloud_retail_v2::model::SearchRequest;
21151 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21152 /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
21153 /// ```
21154 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
21155 where
21156 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21157 {
21158 self.spell_correction_spec = std::option::Option::Some(v.into());
21159 self
21160 }
21161
21162 /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21163 ///
21164 /// # Example
21165 /// ```ignore,no_run
21166 /// # use google_cloud_retail_v2::model::SearchRequest;
21167 /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21168 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
21169 /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
21170 /// ```
21171 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
21172 where
21173 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21174 {
21175 self.spell_correction_spec = v.map(|x| x.into());
21176 self
21177 }
21178
21179 /// Sets the value of [entity][crate::model::SearchRequest::entity].
21180 ///
21181 /// # Example
21182 /// ```ignore,no_run
21183 /// # use google_cloud_retail_v2::model::SearchRequest;
21184 /// let x = SearchRequest::new().set_entity("example");
21185 /// ```
21186 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21187 self.entity = v.into();
21188 self
21189 }
21190
21191 /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21192 ///
21193 /// # Example
21194 /// ```ignore,no_run
21195 /// # use google_cloud_retail_v2::model::SearchRequest;
21196 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21197 /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
21198 /// ```
21199 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
21200 where
21201 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21202 {
21203 self.conversational_search_spec = std::option::Option::Some(v.into());
21204 self
21205 }
21206
21207 /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21208 ///
21209 /// # Example
21210 /// ```ignore,no_run
21211 /// # use google_cloud_retail_v2::model::SearchRequest;
21212 /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21213 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
21214 /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
21215 /// ```
21216 pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
21217 where
21218 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21219 {
21220 self.conversational_search_spec = v.map(|x| x.into());
21221 self
21222 }
21223
21224 /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21225 ///
21226 /// # Example
21227 /// ```ignore,no_run
21228 /// # use google_cloud_retail_v2::model::SearchRequest;
21229 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21230 /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
21231 /// ```
21232 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
21233 where
21234 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21235 {
21236 self.tile_navigation_spec = std::option::Option::Some(v.into());
21237 self
21238 }
21239
21240 /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21241 ///
21242 /// # Example
21243 /// ```ignore,no_run
21244 /// # use google_cloud_retail_v2::model::SearchRequest;
21245 /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21246 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
21247 /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
21248 /// ```
21249 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
21250 where
21251 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21252 {
21253 self.tile_navigation_spec = v.map(|x| x.into());
21254 self
21255 }
21256
21257 /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
21258 ///
21259 /// # Example
21260 /// ```ignore,no_run
21261 /// # use google_cloud_retail_v2::model::SearchRequest;
21262 /// let x = SearchRequest::new().set_language_code("example");
21263 /// ```
21264 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21265 self.language_code = v.into();
21266 self
21267 }
21268
21269 /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
21270 ///
21271 /// # Example
21272 /// ```ignore,no_run
21273 /// # use google_cloud_retail_v2::model::SearchRequest;
21274 /// let x = SearchRequest::new().set_region_code("example");
21275 /// ```
21276 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21277 self.region_code = v.into();
21278 self
21279 }
21280
21281 /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
21282 ///
21283 /// # Example
21284 /// ```ignore,no_run
21285 /// # use google_cloud_retail_v2::model::SearchRequest;
21286 /// let x = SearchRequest::new().set_place_id("example");
21287 /// ```
21288 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21289 self.place_id = v.into();
21290 self
21291 }
21292
21293 /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
21294 ///
21295 /// # Example
21296 /// ```ignore,no_run
21297 /// # use google_cloud_retail_v2::model::SearchRequest;
21298 /// use google_cloud_retail_v2::model::StringList;
21299 /// let x = SearchRequest::new().set_user_attributes([
21300 /// ("key0", StringList::default()/* use setters */),
21301 /// ("key1", StringList::default()/* use (different) setters */),
21302 /// ]);
21303 /// ```
21304 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21305 where
21306 T: std::iter::IntoIterator<Item = (K, V)>,
21307 K: std::convert::Into<std::string::String>,
21308 V: std::convert::Into<crate::model::StringList>,
21309 {
21310 use std::iter::Iterator;
21311 self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21312 self
21313 }
21314}
21315
21316impl wkt::message::Message for SearchRequest {
21317 fn typename() -> &'static str {
21318 "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21319 }
21320}
21321
21322/// Defines additional types related to [SearchRequest].
21323pub mod search_request {
21324 #[allow(unused_imports)]
21325 use super::*;
21326
21327 /// A facet specification to perform faceted search.
21328 #[derive(Clone, Default, PartialEq)]
21329 #[non_exhaustive]
21330 pub struct FacetSpec {
21331 /// Required. The facet key specification.
21332 pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21333
21334 /// Maximum of facet values that should be returned for this facet. If
21335 /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21336 /// above 300 will be coerced to 300.
21337 ///
21338 /// If this field is negative, an INVALID_ARGUMENT is returned.
21339 pub limit: i32,
21340
21341 /// List of keys to exclude when faceting.
21342 ///
21343 /// By default,
21344 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21345 /// is not excluded from the filter unless it is listed in this field.
21346 ///
21347 /// Listing a facet key in this field allows its values to appear as facet
21348 /// results, even when they are filtered out of search results. Using this
21349 /// field does not affect what search results are returned.
21350 ///
21351 /// For example, suppose there are 100 products with the color facet "Red"
21352 /// and 200 products with the color facet "Blue". A query containing the
21353 /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21354 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21355 /// would by default return only "Red" products in the search results, and
21356 /// also return "Red" with count 100 as the only color facet. Although there
21357 /// are also blue products available, "Blue" would not be shown as an
21358 /// available facet value.
21359 ///
21360 /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21361 /// returns the facet values "Red" with count 100 and "Blue" with count
21362 /// 200, because the "colorFamilies" key is now excluded from the filter.
21363 /// Because this field doesn't affect search results, the search results
21364 /// are still correctly filtered to return only "Red" products.
21365 ///
21366 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21367 /// is returned.
21368 ///
21369 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21370 pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21371
21372 /// Enables dynamic position for this facet. If set to true, the position of
21373 /// this facet among all facets in the response is determined by Google
21374 /// Retail Search. It is ordered together with dynamic facets if dynamic
21375 /// facets is enabled. If set to false, the position of this facet in the
21376 /// response is the same as in the request, and it is ranked before
21377 /// the facets with dynamic position enable and all dynamic facets.
21378 ///
21379 /// For example, you may always want to have rating facet returned in
21380 /// the response, but it's not necessarily to always display the rating facet
21381 /// at the top. In that case, you can set enable_dynamic_position to true so
21382 /// that the position of rating facet in response is determined by
21383 /// Google Retail Search.
21384 ///
21385 /// Another example, assuming you have the following facets in the request:
21386 ///
21387 /// * "rating", enable_dynamic_position = true
21388 ///
21389 /// * "price", enable_dynamic_position = false
21390 ///
21391 /// * "brands", enable_dynamic_position = false
21392 ///
21393 ///
21394 /// And also you have a dynamic facets enable, which generates a facet
21395 /// "gender". Then, the final order of the facets in the response can be
21396 /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21397 /// "rating") depends on how Google Retail Search orders "gender" and
21398 /// "rating" facets. However, notice that "price" and "brands" are always
21399 /// ranked at first and second position because their enable_dynamic_position
21400 /// values are false.
21401 pub enable_dynamic_position: bool,
21402
21403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21404 }
21405
21406 impl FacetSpec {
21407 /// Creates a new default instance.
21408 pub fn new() -> Self {
21409 std::default::Default::default()
21410 }
21411
21412 /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21413 ///
21414 /// # Example
21415 /// ```ignore,no_run
21416 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21417 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21418 /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21419 /// ```
21420 pub fn set_facet_key<T>(mut self, v: T) -> Self
21421 where
21422 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21423 {
21424 self.facet_key = std::option::Option::Some(v.into());
21425 self
21426 }
21427
21428 /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21429 ///
21430 /// # Example
21431 /// ```ignore,no_run
21432 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21433 /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21434 /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21435 /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21436 /// ```
21437 pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21438 where
21439 T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21440 {
21441 self.facet_key = v.map(|x| x.into());
21442 self
21443 }
21444
21445 /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21446 ///
21447 /// # Example
21448 /// ```ignore,no_run
21449 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21450 /// let x = FacetSpec::new().set_limit(42);
21451 /// ```
21452 pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21453 self.limit = v.into();
21454 self
21455 }
21456
21457 /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21458 ///
21459 /// # Example
21460 /// ```ignore,no_run
21461 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21462 /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21463 /// ```
21464 pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21465 where
21466 T: std::iter::IntoIterator<Item = V>,
21467 V: std::convert::Into<std::string::String>,
21468 {
21469 use std::iter::Iterator;
21470 self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21471 self
21472 }
21473
21474 /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21475 ///
21476 /// # Example
21477 /// ```ignore,no_run
21478 /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21479 /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21480 /// ```
21481 pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21482 self.enable_dynamic_position = v.into();
21483 self
21484 }
21485 }
21486
21487 impl wkt::message::Message for FacetSpec {
21488 fn typename() -> &'static str {
21489 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21490 }
21491 }
21492
21493 /// Defines additional types related to [FacetSpec].
21494 pub mod facet_spec {
21495 #[allow(unused_imports)]
21496 use super::*;
21497
21498 /// Specifies how a facet is computed.
21499 #[derive(Clone, Default, PartialEq)]
21500 #[non_exhaustive]
21501 pub struct FacetKey {
21502 /// Required. Supported textual and numerical facet keys in
21503 /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21504 /// values are computed. Facet key is case-sensitive.
21505 ///
21506 /// Allowed facet keys when
21507 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21508 /// is not specified:
21509 ///
21510 /// * textual_field =
21511 ///
21512 /// * "brands"
21513 /// * "categories"
21514 /// * "genders"
21515 /// * "ageGroups"
21516 /// * "availability"
21517 /// * "colorFamilies"
21518 /// * "colors"
21519 /// * "sizes"
21520 /// * "materials"
21521 /// * "patterns"
21522 /// * "conditions"
21523 /// * "attributes.key"
21524 /// * "pickupInStore"
21525 /// * "shipToStore"
21526 /// * "sameDayDelivery"
21527 /// * "nextDayDelivery"
21528 /// * "customFulfillment1"
21529 /// * "customFulfillment2"
21530 /// * "customFulfillment3"
21531 /// * "customFulfillment4"
21532 /// * "customFulfillment5"
21533 /// * "inventory(place_id,attributes.key)"
21534 /// * numerical_field =
21535 ///
21536 /// * "price"
21537 /// * "discount"
21538 /// * "rating"
21539 /// * "ratingCount"
21540 /// * "attributes.key"
21541 /// * "inventory(place_id,price)"
21542 /// * "inventory(place_id,original_price)"
21543 /// * "inventory(place_id,attributes.key)"
21544 ///
21545 /// [google.cloud.retail.v2.Product]: crate::model::Product
21546 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21547 pub key: std::string::String,
21548
21549 /// Set only if values should be bucketized into intervals. Must be set
21550 /// for facets with numerical values. Must not be set for facet with text
21551 /// values. Maximum number of intervals is 40.
21552 ///
21553 /// For all numerical facet keys that appear in the list of products from
21554 /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21555 /// computed from their distribution weekly. If the model assigns a high
21556 /// score to a numerical facet key and its intervals are not specified in
21557 /// the search request, these percentiles become the bounds
21558 /// for its intervals and are returned in the response. If the
21559 /// facet key intervals are specified in the request, then the specified
21560 /// intervals are returned instead.
21561 pub intervals: std::vec::Vec<crate::model::Interval>,
21562
21563 /// Only get facet for the given restricted values. For example, when using
21564 /// "pickupInStore" as key and set restricted values to
21565 /// ["store123", "store456"], only facets for "store123" and "store456" are
21566 /// returned. Only supported on predefined textual fields, custom textual
21567 /// attributes and fulfillments. Maximum is 20.
21568 ///
21569 /// Must be set for the fulfillment facet keys:
21570 ///
21571 /// * pickupInStore
21572 ///
21573 /// * shipToStore
21574 ///
21575 /// * sameDayDelivery
21576 ///
21577 /// * nextDayDelivery
21578 ///
21579 /// * customFulfillment1
21580 ///
21581 /// * customFulfillment2
21582 ///
21583 /// * customFulfillment3
21584 ///
21585 /// * customFulfillment4
21586 ///
21587 /// * customFulfillment5
21588 ///
21589 pub restricted_values: std::vec::Vec<std::string::String>,
21590
21591 /// Only get facet values that start with the given string prefix. For
21592 /// example, suppose "categories" has three values "Women > Shoe",
21593 /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21594 /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21595 /// Only supported on textual fields. Maximum is 10.
21596 pub prefixes: std::vec::Vec<std::string::String>,
21597
21598 /// Only get facet values that contains the given strings. For example,
21599 /// suppose "categories" has three values "Women > Shoe",
21600 /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21601 /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21602 /// Only supported on textual fields. Maximum is 10.
21603 pub contains: std::vec::Vec<std::string::String>,
21604
21605 /// True to make facet keys case insensitive when getting faceting
21606 /// values with prefixes or contains; false otherwise.
21607 pub case_insensitive: bool,
21608
21609 /// The order in which
21610 /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21611 /// are returned.
21612 ///
21613 /// Allowed values are:
21614 ///
21615 /// * "count desc", which means order by
21616 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21617 /// descending.
21618 ///
21619 /// * "value desc", which means order by
21620 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21621 /// descending.
21622 /// Only applies to textual facets.
21623 ///
21624 ///
21625 /// If not set, textual values are sorted in [natural
21626 /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21627 /// intervals are sorted in the order given by
21628 /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21629 /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21630 /// are sorted in the order given by
21631 /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21632 ///
21633 /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21634 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21635 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21636 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21637 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21638 /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21639 pub order_by: std::string::String,
21640
21641 /// The query that is used to compute facet for the given facet key.
21642 /// When provided, it overrides the default behavior of facet
21643 /// computation. The query syntax is the same as a filter expression. See
21644 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21645 /// detail syntax and limitations. Notice that there is no limitation on
21646 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21647 /// when query is specified.
21648 ///
21649 /// In the response,
21650 /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21651 /// is always "1" and
21652 /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21653 /// is the number of results that match the query.
21654 ///
21655 /// For example, you can set a customized facet for "shipToStore",
21656 /// where
21657 /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21658 /// is "customizedShipToStore", and
21659 /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21660 /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21661 /// Then the facet counts the products that are both in stock and ship
21662 /// to store "123".
21663 ///
21664 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21665 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21666 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21667 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21668 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21669 pub query: std::string::String,
21670
21671 /// Returns the min and max value for each numerical facet intervals.
21672 /// Ignored for textual facets.
21673 pub return_min_max: bool,
21674
21675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21676 }
21677
21678 impl FacetKey {
21679 /// Creates a new default instance.
21680 pub fn new() -> Self {
21681 std::default::Default::default()
21682 }
21683
21684 /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21685 ///
21686 /// # Example
21687 /// ```ignore,no_run
21688 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21689 /// let x = FacetKey::new().set_key("example");
21690 /// ```
21691 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21692 self.key = v.into();
21693 self
21694 }
21695
21696 /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21697 ///
21698 /// # Example
21699 /// ```ignore,no_run
21700 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21701 /// use google_cloud_retail_v2::model::Interval;
21702 /// let x = FacetKey::new()
21703 /// .set_intervals([
21704 /// Interval::default()/* use setters */,
21705 /// Interval::default()/* use (different) setters */,
21706 /// ]);
21707 /// ```
21708 pub fn set_intervals<T, V>(mut self, v: T) -> Self
21709 where
21710 T: std::iter::IntoIterator<Item = V>,
21711 V: std::convert::Into<crate::model::Interval>,
21712 {
21713 use std::iter::Iterator;
21714 self.intervals = v.into_iter().map(|i| i.into()).collect();
21715 self
21716 }
21717
21718 /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21719 ///
21720 /// # Example
21721 /// ```ignore,no_run
21722 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21723 /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21724 /// ```
21725 pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21726 where
21727 T: std::iter::IntoIterator<Item = V>,
21728 V: std::convert::Into<std::string::String>,
21729 {
21730 use std::iter::Iterator;
21731 self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21732 self
21733 }
21734
21735 /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21736 ///
21737 /// # Example
21738 /// ```ignore,no_run
21739 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21740 /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21741 /// ```
21742 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21743 where
21744 T: std::iter::IntoIterator<Item = V>,
21745 V: std::convert::Into<std::string::String>,
21746 {
21747 use std::iter::Iterator;
21748 self.prefixes = v.into_iter().map(|i| i.into()).collect();
21749 self
21750 }
21751
21752 /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21753 ///
21754 /// # Example
21755 /// ```ignore,no_run
21756 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21757 /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21758 /// ```
21759 pub fn set_contains<T, V>(mut self, v: T) -> Self
21760 where
21761 T: std::iter::IntoIterator<Item = V>,
21762 V: std::convert::Into<std::string::String>,
21763 {
21764 use std::iter::Iterator;
21765 self.contains = v.into_iter().map(|i| i.into()).collect();
21766 self
21767 }
21768
21769 /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21770 ///
21771 /// # Example
21772 /// ```ignore,no_run
21773 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21774 /// let x = FacetKey::new().set_case_insensitive(true);
21775 /// ```
21776 pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21777 self.case_insensitive = v.into();
21778 self
21779 }
21780
21781 /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21782 ///
21783 /// # Example
21784 /// ```ignore,no_run
21785 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21786 /// let x = FacetKey::new().set_order_by("example");
21787 /// ```
21788 pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21789 mut self,
21790 v: T,
21791 ) -> Self {
21792 self.order_by = v.into();
21793 self
21794 }
21795
21796 /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21797 ///
21798 /// # Example
21799 /// ```ignore,no_run
21800 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21801 /// let x = FacetKey::new().set_query("example");
21802 /// ```
21803 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21804 self.query = v.into();
21805 self
21806 }
21807
21808 /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21809 ///
21810 /// # Example
21811 /// ```ignore,no_run
21812 /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21813 /// let x = FacetKey::new().set_return_min_max(true);
21814 /// ```
21815 pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21816 self.return_min_max = v.into();
21817 self
21818 }
21819 }
21820
21821 impl wkt::message::Message for FacetKey {
21822 fn typename() -> &'static str {
21823 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21824 }
21825 }
21826 }
21827
21828 /// The specifications of dynamically generated facets.
21829 #[derive(Clone, Default, PartialEq)]
21830 #[non_exhaustive]
21831 pub struct DynamicFacetSpec {
21832 /// Mode of the DynamicFacet feature.
21833 /// Defaults to
21834 /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21835 /// if it's unset.
21836 ///
21837 /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21838 pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21839
21840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21841 }
21842
21843 impl DynamicFacetSpec {
21844 /// Creates a new default instance.
21845 pub fn new() -> Self {
21846 std::default::Default::default()
21847 }
21848
21849 /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21850 ///
21851 /// # Example
21852 /// ```ignore,no_run
21853 /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21854 /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21855 /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21856 /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21857 /// ```
21858 pub fn set_mode<
21859 T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21860 >(
21861 mut self,
21862 v: T,
21863 ) -> Self {
21864 self.mode = v.into();
21865 self
21866 }
21867 }
21868
21869 impl wkt::message::Message for DynamicFacetSpec {
21870 fn typename() -> &'static str {
21871 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21872 }
21873 }
21874
21875 /// Defines additional types related to [DynamicFacetSpec].
21876 pub mod dynamic_facet_spec {
21877 #[allow(unused_imports)]
21878 use super::*;
21879
21880 /// Enum to control DynamicFacet mode
21881 ///
21882 /// # Working with unknown values
21883 ///
21884 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21885 /// additional enum variants at any time. Adding new variants is not considered
21886 /// a breaking change. Applications should write their code in anticipation of:
21887 ///
21888 /// - New values appearing in future releases of the client library, **and**
21889 /// - New values received dynamically, without application changes.
21890 ///
21891 /// Please consult the [Working with enums] section in the user guide for some
21892 /// guidelines.
21893 ///
21894 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21895 #[derive(Clone, Debug, PartialEq)]
21896 #[non_exhaustive]
21897 pub enum Mode {
21898 /// Default value.
21899 Unspecified,
21900 /// Disable Dynamic Facet.
21901 Disabled,
21902 /// Automatic mode built by Google Retail Search.
21903 Enabled,
21904 /// If set, the enum was initialized with an unknown value.
21905 ///
21906 /// Applications can examine the value using [Mode::value] or
21907 /// [Mode::name].
21908 UnknownValue(mode::UnknownValue),
21909 }
21910
21911 #[doc(hidden)]
21912 pub mod mode {
21913 #[allow(unused_imports)]
21914 use super::*;
21915 #[derive(Clone, Debug, PartialEq)]
21916 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21917 }
21918
21919 impl Mode {
21920 /// Gets the enum value.
21921 ///
21922 /// Returns `None` if the enum contains an unknown value deserialized from
21923 /// the string representation of enums.
21924 pub fn value(&self) -> std::option::Option<i32> {
21925 match self {
21926 Self::Unspecified => std::option::Option::Some(0),
21927 Self::Disabled => std::option::Option::Some(1),
21928 Self::Enabled => std::option::Option::Some(2),
21929 Self::UnknownValue(u) => u.0.value(),
21930 }
21931 }
21932
21933 /// Gets the enum value as a string.
21934 ///
21935 /// Returns `None` if the enum contains an unknown value deserialized from
21936 /// the integer representation of enums.
21937 pub fn name(&self) -> std::option::Option<&str> {
21938 match self {
21939 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21940 Self::Disabled => std::option::Option::Some("DISABLED"),
21941 Self::Enabled => std::option::Option::Some("ENABLED"),
21942 Self::UnknownValue(u) => u.0.name(),
21943 }
21944 }
21945 }
21946
21947 impl std::default::Default for Mode {
21948 fn default() -> Self {
21949 use std::convert::From;
21950 Self::from(0)
21951 }
21952 }
21953
21954 impl std::fmt::Display for Mode {
21955 fn fmt(
21956 &self,
21957 f: &mut std::fmt::Formatter<'_>,
21958 ) -> std::result::Result<(), std::fmt::Error> {
21959 wkt::internal::display_enum(f, self.name(), self.value())
21960 }
21961 }
21962
21963 impl std::convert::From<i32> for Mode {
21964 fn from(value: i32) -> Self {
21965 match value {
21966 0 => Self::Unspecified,
21967 1 => Self::Disabled,
21968 2 => Self::Enabled,
21969 _ => Self::UnknownValue(mode::UnknownValue(
21970 wkt::internal::UnknownEnumValue::Integer(value),
21971 )),
21972 }
21973 }
21974 }
21975
21976 impl std::convert::From<&str> for Mode {
21977 fn from(value: &str) -> Self {
21978 use std::string::ToString;
21979 match value {
21980 "MODE_UNSPECIFIED" => Self::Unspecified,
21981 "DISABLED" => Self::Disabled,
21982 "ENABLED" => Self::Enabled,
21983 _ => Self::UnknownValue(mode::UnknownValue(
21984 wkt::internal::UnknownEnumValue::String(value.to_string()),
21985 )),
21986 }
21987 }
21988 }
21989
21990 impl serde::ser::Serialize for Mode {
21991 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21992 where
21993 S: serde::Serializer,
21994 {
21995 match self {
21996 Self::Unspecified => serializer.serialize_i32(0),
21997 Self::Disabled => serializer.serialize_i32(1),
21998 Self::Enabled => serializer.serialize_i32(2),
21999 Self::UnknownValue(u) => u.0.serialize(serializer),
22000 }
22001 }
22002 }
22003
22004 impl<'de> serde::de::Deserialize<'de> for Mode {
22005 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22006 where
22007 D: serde::Deserializer<'de>,
22008 {
22009 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22010 ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
22011 ))
22012 }
22013 }
22014 }
22015
22016 /// Boost specification to boost certain items.
22017 #[derive(Clone, Default, PartialEq)]
22018 #[non_exhaustive]
22019 pub struct BoostSpec {
22020 /// Condition boost specifications. If a product matches multiple conditions
22021 /// in the specifications, boost scores from these specifications are all
22022 /// applied and combined in a non-linear way. Maximum number of
22023 /// specifications is 20.
22024 pub condition_boost_specs:
22025 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
22026
22027 /// Whether to skip boostspec validation. If this field is set to true,
22028 /// invalid
22029 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
22030 /// will be ignored and valid
22031 /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
22032 /// will still be applied.
22033 ///
22034 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
22035 pub skip_boost_spec_validation: std::option::Option<bool>,
22036
22037 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22038 }
22039
22040 impl BoostSpec {
22041 /// Creates a new default instance.
22042 pub fn new() -> Self {
22043 std::default::Default::default()
22044 }
22045
22046 /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
22047 ///
22048 /// # Example
22049 /// ```ignore,no_run
22050 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22051 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22052 /// let x = BoostSpec::new()
22053 /// .set_condition_boost_specs([
22054 /// ConditionBoostSpec::default()/* use setters */,
22055 /// ConditionBoostSpec::default()/* use (different) setters */,
22056 /// ]);
22057 /// ```
22058 pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
22059 where
22060 T: std::iter::IntoIterator<Item = V>,
22061 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
22062 {
22063 use std::iter::Iterator;
22064 self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
22065 self
22066 }
22067
22068 /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
22069 ///
22070 /// # Example
22071 /// ```ignore,no_run
22072 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22073 /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
22074 /// ```
22075 pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
22076 where
22077 T: std::convert::Into<bool>,
22078 {
22079 self.skip_boost_spec_validation = std::option::Option::Some(v.into());
22080 self
22081 }
22082
22083 /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
22084 ///
22085 /// # Example
22086 /// ```ignore,no_run
22087 /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22088 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
22089 /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
22090 /// ```
22091 pub fn set_or_clear_skip_boost_spec_validation<T>(
22092 mut self,
22093 v: std::option::Option<T>,
22094 ) -> Self
22095 where
22096 T: std::convert::Into<bool>,
22097 {
22098 self.skip_boost_spec_validation = v.map(|x| x.into());
22099 self
22100 }
22101 }
22102
22103 impl wkt::message::Message for BoostSpec {
22104 fn typename() -> &'static str {
22105 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
22106 }
22107 }
22108
22109 /// Defines additional types related to [BoostSpec].
22110 pub mod boost_spec {
22111 #[allow(unused_imports)]
22112 use super::*;
22113
22114 /// Boost applies to products which match a condition.
22115 #[derive(Clone, Default, PartialEq)]
22116 #[non_exhaustive]
22117 pub struct ConditionBoostSpec {
22118 /// An expression which specifies a boost condition. The syntax and
22119 /// supported fields are the same as a filter expression. See
22120 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
22121 /// detail syntax and limitations.
22122 ///
22123 /// Examples:
22124 ///
22125 /// * To boost products with product ID "product_1" or "product_2", and
22126 /// color
22127 /// "Red" or "Blue":
22128 /// * (id: ANY("product_1", "product_2")) AND (colorFamilies:
22129 /// ANY("Red","Blue"))
22130 ///
22131 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22132 pub condition: std::string::String,
22133
22134 /// Strength of the condition boost, which should be in [-1, 1]. Negative
22135 /// boost means demotion. Default is 0.0.
22136 ///
22137 /// Setting to 1.0 gives the item a big promotion. However, it does not
22138 /// necessarily mean that the boosted item will be the top result at all
22139 /// times, nor that other items will be excluded. Results could still be
22140 /// shown even when none of them matches the condition. And results that
22141 /// are significantly more relevant to the search query can still trump
22142 /// your heavily favored but irrelevant items.
22143 ///
22144 /// Setting to -1.0 gives the item a big demotion. However, results that
22145 /// are deeply relevant might still be shown. The item will have an
22146 /// upstream battle to get a fairly high ranking, but it is not blocked out
22147 /// completely.
22148 ///
22149 /// Setting to 0.0 means no boost applied. The boosting condition is
22150 /// ignored.
22151 pub boost: f32,
22152
22153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22154 }
22155
22156 impl ConditionBoostSpec {
22157 /// Creates a new default instance.
22158 pub fn new() -> Self {
22159 std::default::Default::default()
22160 }
22161
22162 /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
22163 ///
22164 /// # Example
22165 /// ```ignore,no_run
22166 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22167 /// let x = ConditionBoostSpec::new().set_condition("example");
22168 /// ```
22169 pub fn set_condition<T: std::convert::Into<std::string::String>>(
22170 mut self,
22171 v: T,
22172 ) -> Self {
22173 self.condition = v.into();
22174 self
22175 }
22176
22177 /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
22178 ///
22179 /// # Example
22180 /// ```ignore,no_run
22181 /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22182 /// let x = ConditionBoostSpec::new().set_boost(42.0);
22183 /// ```
22184 pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
22185 self.boost = v.into();
22186 self
22187 }
22188 }
22189
22190 impl wkt::message::Message for ConditionBoostSpec {
22191 fn typename() -> &'static str {
22192 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
22193 }
22194 }
22195 }
22196
22197 /// Specification to determine under which conditions query expansion should
22198 /// occur.
22199 #[derive(Clone, Default, PartialEq)]
22200 #[non_exhaustive]
22201 pub struct QueryExpansionSpec {
22202 /// The condition under which query expansion should occur. Default to
22203 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22204 ///
22205 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22206 pub condition: crate::model::search_request::query_expansion_spec::Condition,
22207
22208 /// Whether to pin unexpanded results. The default value is false. If this
22209 /// field is set to true,
22210 /// unexpanded products are always at the top of the search results, followed
22211 /// by the expanded results.
22212 pub pin_unexpanded_results: bool,
22213
22214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22215 }
22216
22217 impl QueryExpansionSpec {
22218 /// Creates a new default instance.
22219 pub fn new() -> Self {
22220 std::default::Default::default()
22221 }
22222
22223 /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
22224 ///
22225 /// # Example
22226 /// ```ignore,no_run
22227 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22228 /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
22229 /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
22230 /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
22231 /// ```
22232 pub fn set_condition<
22233 T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
22234 >(
22235 mut self,
22236 v: T,
22237 ) -> Self {
22238 self.condition = v.into();
22239 self
22240 }
22241
22242 /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
22243 ///
22244 /// # Example
22245 /// ```ignore,no_run
22246 /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22247 /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
22248 /// ```
22249 pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22250 self.pin_unexpanded_results = v.into();
22251 self
22252 }
22253 }
22254
22255 impl wkt::message::Message for QueryExpansionSpec {
22256 fn typename() -> &'static str {
22257 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
22258 }
22259 }
22260
22261 /// Defines additional types related to [QueryExpansionSpec].
22262 pub mod query_expansion_spec {
22263 #[allow(unused_imports)]
22264 use super::*;
22265
22266 /// Enum describing under which condition query expansion should occur.
22267 ///
22268 /// # Working with unknown values
22269 ///
22270 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22271 /// additional enum variants at any time. Adding new variants is not considered
22272 /// a breaking change. Applications should write their code in anticipation of:
22273 ///
22274 /// - New values appearing in future releases of the client library, **and**
22275 /// - New values received dynamically, without application changes.
22276 ///
22277 /// Please consult the [Working with enums] section in the user guide for some
22278 /// guidelines.
22279 ///
22280 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22281 #[derive(Clone, Debug, PartialEq)]
22282 #[non_exhaustive]
22283 pub enum Condition {
22284 /// Unspecified query expansion condition. In this case, server behavior
22285 /// defaults to
22286 /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22287 ///
22288 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22289 Unspecified,
22290 /// Disabled query expansion. Only the exact search query is used, even if
22291 /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
22292 /// is zero.
22293 ///
22294 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
22295 Disabled,
22296 /// Automatic query expansion built by Google Retail Search.
22297 Auto,
22298 /// If set, the enum was initialized with an unknown value.
22299 ///
22300 /// Applications can examine the value using [Condition::value] or
22301 /// [Condition::name].
22302 UnknownValue(condition::UnknownValue),
22303 }
22304
22305 #[doc(hidden)]
22306 pub mod condition {
22307 #[allow(unused_imports)]
22308 use super::*;
22309 #[derive(Clone, Debug, PartialEq)]
22310 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22311 }
22312
22313 impl Condition {
22314 /// Gets the enum value.
22315 ///
22316 /// Returns `None` if the enum contains an unknown value deserialized from
22317 /// the string representation of enums.
22318 pub fn value(&self) -> std::option::Option<i32> {
22319 match self {
22320 Self::Unspecified => std::option::Option::Some(0),
22321 Self::Disabled => std::option::Option::Some(1),
22322 Self::Auto => std::option::Option::Some(3),
22323 Self::UnknownValue(u) => u.0.value(),
22324 }
22325 }
22326
22327 /// Gets the enum value as a string.
22328 ///
22329 /// Returns `None` if the enum contains an unknown value deserialized from
22330 /// the integer representation of enums.
22331 pub fn name(&self) -> std::option::Option<&str> {
22332 match self {
22333 Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22334 Self::Disabled => std::option::Option::Some("DISABLED"),
22335 Self::Auto => std::option::Option::Some("AUTO"),
22336 Self::UnknownValue(u) => u.0.name(),
22337 }
22338 }
22339 }
22340
22341 impl std::default::Default for Condition {
22342 fn default() -> Self {
22343 use std::convert::From;
22344 Self::from(0)
22345 }
22346 }
22347
22348 impl std::fmt::Display for Condition {
22349 fn fmt(
22350 &self,
22351 f: &mut std::fmt::Formatter<'_>,
22352 ) -> std::result::Result<(), std::fmt::Error> {
22353 wkt::internal::display_enum(f, self.name(), self.value())
22354 }
22355 }
22356
22357 impl std::convert::From<i32> for Condition {
22358 fn from(value: i32) -> Self {
22359 match value {
22360 0 => Self::Unspecified,
22361 1 => Self::Disabled,
22362 3 => Self::Auto,
22363 _ => Self::UnknownValue(condition::UnknownValue(
22364 wkt::internal::UnknownEnumValue::Integer(value),
22365 )),
22366 }
22367 }
22368 }
22369
22370 impl std::convert::From<&str> for Condition {
22371 fn from(value: &str) -> Self {
22372 use std::string::ToString;
22373 match value {
22374 "CONDITION_UNSPECIFIED" => Self::Unspecified,
22375 "DISABLED" => Self::Disabled,
22376 "AUTO" => Self::Auto,
22377 _ => Self::UnknownValue(condition::UnknownValue(
22378 wkt::internal::UnknownEnumValue::String(value.to_string()),
22379 )),
22380 }
22381 }
22382 }
22383
22384 impl serde::ser::Serialize for Condition {
22385 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22386 where
22387 S: serde::Serializer,
22388 {
22389 match self {
22390 Self::Unspecified => serializer.serialize_i32(0),
22391 Self::Disabled => serializer.serialize_i32(1),
22392 Self::Auto => serializer.serialize_i32(3),
22393 Self::UnknownValue(u) => u.0.serialize(serializer),
22394 }
22395 }
22396 }
22397
22398 impl<'de> serde::de::Deserialize<'de> for Condition {
22399 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22400 where
22401 D: serde::Deserializer<'de>,
22402 {
22403 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22404 ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22405 ))
22406 }
22407 }
22408 }
22409
22410 /// The specification for personalization.
22411 #[derive(Clone, Default, PartialEq)]
22412 #[non_exhaustive]
22413 pub struct PersonalizationSpec {
22414 /// Defaults to
22415 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22416 ///
22417 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22418 pub mode: crate::model::search_request::personalization_spec::Mode,
22419
22420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22421 }
22422
22423 impl PersonalizationSpec {
22424 /// Creates a new default instance.
22425 pub fn new() -> Self {
22426 std::default::Default::default()
22427 }
22428
22429 /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22430 ///
22431 /// # Example
22432 /// ```ignore,no_run
22433 /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22434 /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22435 /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22436 /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22437 /// ```
22438 pub fn set_mode<
22439 T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22440 >(
22441 mut self,
22442 v: T,
22443 ) -> Self {
22444 self.mode = v.into();
22445 self
22446 }
22447 }
22448
22449 impl wkt::message::Message for PersonalizationSpec {
22450 fn typename() -> &'static str {
22451 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22452 }
22453 }
22454
22455 /// Defines additional types related to [PersonalizationSpec].
22456 pub mod personalization_spec {
22457 #[allow(unused_imports)]
22458 use super::*;
22459
22460 /// The personalization mode of each search request.
22461 ///
22462 /// # Working with unknown values
22463 ///
22464 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22465 /// additional enum variants at any time. Adding new variants is not considered
22466 /// a breaking change. Applications should write their code in anticipation of:
22467 ///
22468 /// - New values appearing in future releases of the client library, **and**
22469 /// - New values received dynamically, without application changes.
22470 ///
22471 /// Please consult the [Working with enums] section in the user guide for some
22472 /// guidelines.
22473 ///
22474 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22475 #[derive(Clone, Debug, PartialEq)]
22476 #[non_exhaustive]
22477 pub enum Mode {
22478 /// Default value. In this case, server behavior defaults to
22479 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22480 ///
22481 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22482 Unspecified,
22483 /// Let CRS decide whether to use personalization based on quality of user
22484 /// event data.
22485 Auto,
22486 /// Disable personalization.
22487 Disabled,
22488 /// If set, the enum was initialized with an unknown value.
22489 ///
22490 /// Applications can examine the value using [Mode::value] or
22491 /// [Mode::name].
22492 UnknownValue(mode::UnknownValue),
22493 }
22494
22495 #[doc(hidden)]
22496 pub mod mode {
22497 #[allow(unused_imports)]
22498 use super::*;
22499 #[derive(Clone, Debug, PartialEq)]
22500 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22501 }
22502
22503 impl Mode {
22504 /// Gets the enum value.
22505 ///
22506 /// Returns `None` if the enum contains an unknown value deserialized from
22507 /// the string representation of enums.
22508 pub fn value(&self) -> std::option::Option<i32> {
22509 match self {
22510 Self::Unspecified => std::option::Option::Some(0),
22511 Self::Auto => std::option::Option::Some(1),
22512 Self::Disabled => std::option::Option::Some(2),
22513 Self::UnknownValue(u) => u.0.value(),
22514 }
22515 }
22516
22517 /// Gets the enum value as a string.
22518 ///
22519 /// Returns `None` if the enum contains an unknown value deserialized from
22520 /// the integer representation of enums.
22521 pub fn name(&self) -> std::option::Option<&str> {
22522 match self {
22523 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22524 Self::Auto => std::option::Option::Some("AUTO"),
22525 Self::Disabled => std::option::Option::Some("DISABLED"),
22526 Self::UnknownValue(u) => u.0.name(),
22527 }
22528 }
22529 }
22530
22531 impl std::default::Default for Mode {
22532 fn default() -> Self {
22533 use std::convert::From;
22534 Self::from(0)
22535 }
22536 }
22537
22538 impl std::fmt::Display for Mode {
22539 fn fmt(
22540 &self,
22541 f: &mut std::fmt::Formatter<'_>,
22542 ) -> std::result::Result<(), std::fmt::Error> {
22543 wkt::internal::display_enum(f, self.name(), self.value())
22544 }
22545 }
22546
22547 impl std::convert::From<i32> for Mode {
22548 fn from(value: i32) -> Self {
22549 match value {
22550 0 => Self::Unspecified,
22551 1 => Self::Auto,
22552 2 => Self::Disabled,
22553 _ => Self::UnknownValue(mode::UnknownValue(
22554 wkt::internal::UnknownEnumValue::Integer(value),
22555 )),
22556 }
22557 }
22558 }
22559
22560 impl std::convert::From<&str> for Mode {
22561 fn from(value: &str) -> Self {
22562 use std::string::ToString;
22563 match value {
22564 "MODE_UNSPECIFIED" => Self::Unspecified,
22565 "AUTO" => Self::Auto,
22566 "DISABLED" => Self::Disabled,
22567 _ => Self::UnknownValue(mode::UnknownValue(
22568 wkt::internal::UnknownEnumValue::String(value.to_string()),
22569 )),
22570 }
22571 }
22572 }
22573
22574 impl serde::ser::Serialize for Mode {
22575 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22576 where
22577 S: serde::Serializer,
22578 {
22579 match self {
22580 Self::Unspecified => serializer.serialize_i32(0),
22581 Self::Auto => serializer.serialize_i32(1),
22582 Self::Disabled => serializer.serialize_i32(2),
22583 Self::UnknownValue(u) => u.0.serialize(serializer),
22584 }
22585 }
22586 }
22587
22588 impl<'de> serde::de::Deserialize<'de> for Mode {
22589 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22590 where
22591 D: serde::Deserializer<'de>,
22592 {
22593 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22594 ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22595 ))
22596 }
22597 }
22598 }
22599
22600 /// The specification for query spell correction.
22601 #[derive(Clone, Default, PartialEq)]
22602 #[non_exhaustive]
22603 pub struct SpellCorrectionSpec {
22604 /// The mode under which spell correction should take effect to
22605 /// replace the original search query. Default to
22606 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22607 ///
22608 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22609 pub mode: crate::model::search_request::spell_correction_spec::Mode,
22610
22611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22612 }
22613
22614 impl SpellCorrectionSpec {
22615 /// Creates a new default instance.
22616 pub fn new() -> Self {
22617 std::default::Default::default()
22618 }
22619
22620 /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22621 ///
22622 /// # Example
22623 /// ```ignore,no_run
22624 /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22625 /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22626 /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22627 /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22628 /// ```
22629 pub fn set_mode<
22630 T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22631 >(
22632 mut self,
22633 v: T,
22634 ) -> Self {
22635 self.mode = v.into();
22636 self
22637 }
22638 }
22639
22640 impl wkt::message::Message for SpellCorrectionSpec {
22641 fn typename() -> &'static str {
22642 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22643 }
22644 }
22645
22646 /// Defines additional types related to [SpellCorrectionSpec].
22647 pub mod spell_correction_spec {
22648 #[allow(unused_imports)]
22649 use super::*;
22650
22651 /// Enum describing under which mode spell correction should occur.
22652 ///
22653 /// # Working with unknown values
22654 ///
22655 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22656 /// additional enum variants at any time. Adding new variants is not considered
22657 /// a breaking change. Applications should write their code in anticipation of:
22658 ///
22659 /// - New values appearing in future releases of the client library, **and**
22660 /// - New values received dynamically, without application changes.
22661 ///
22662 /// Please consult the [Working with enums] section in the user guide for some
22663 /// guidelines.
22664 ///
22665 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22666 #[derive(Clone, Debug, PartialEq)]
22667 #[non_exhaustive]
22668 pub enum Mode {
22669 /// Unspecified spell correction mode. In this case, server behavior
22670 /// defaults to
22671 /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22672 ///
22673 /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22674 Unspecified,
22675 /// Google Retail Search will try to find a spell suggestion if there
22676 /// is any and put in the
22677 /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22678 /// The spell suggestion will not be used as the search query.
22679 ///
22680 /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22681 SuggestionOnly,
22682 /// Automatic spell correction built by Google Retail Search. Search will
22683 /// be based on the corrected query if found.
22684 Auto,
22685 /// If set, the enum was initialized with an unknown value.
22686 ///
22687 /// Applications can examine the value using [Mode::value] or
22688 /// [Mode::name].
22689 UnknownValue(mode::UnknownValue),
22690 }
22691
22692 #[doc(hidden)]
22693 pub mod mode {
22694 #[allow(unused_imports)]
22695 use super::*;
22696 #[derive(Clone, Debug, PartialEq)]
22697 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22698 }
22699
22700 impl Mode {
22701 /// Gets the enum value.
22702 ///
22703 /// Returns `None` if the enum contains an unknown value deserialized from
22704 /// the string representation of enums.
22705 pub fn value(&self) -> std::option::Option<i32> {
22706 match self {
22707 Self::Unspecified => std::option::Option::Some(0),
22708 Self::SuggestionOnly => std::option::Option::Some(1),
22709 Self::Auto => std::option::Option::Some(2),
22710 Self::UnknownValue(u) => u.0.value(),
22711 }
22712 }
22713
22714 /// Gets the enum value as a string.
22715 ///
22716 /// Returns `None` if the enum contains an unknown value deserialized from
22717 /// the integer representation of enums.
22718 pub fn name(&self) -> std::option::Option<&str> {
22719 match self {
22720 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22721 Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22722 Self::Auto => std::option::Option::Some("AUTO"),
22723 Self::UnknownValue(u) => u.0.name(),
22724 }
22725 }
22726 }
22727
22728 impl std::default::Default for Mode {
22729 fn default() -> Self {
22730 use std::convert::From;
22731 Self::from(0)
22732 }
22733 }
22734
22735 impl std::fmt::Display for Mode {
22736 fn fmt(
22737 &self,
22738 f: &mut std::fmt::Formatter<'_>,
22739 ) -> std::result::Result<(), std::fmt::Error> {
22740 wkt::internal::display_enum(f, self.name(), self.value())
22741 }
22742 }
22743
22744 impl std::convert::From<i32> for Mode {
22745 fn from(value: i32) -> Self {
22746 match value {
22747 0 => Self::Unspecified,
22748 1 => Self::SuggestionOnly,
22749 2 => Self::Auto,
22750 _ => Self::UnknownValue(mode::UnknownValue(
22751 wkt::internal::UnknownEnumValue::Integer(value),
22752 )),
22753 }
22754 }
22755 }
22756
22757 impl std::convert::From<&str> for Mode {
22758 fn from(value: &str) -> Self {
22759 use std::string::ToString;
22760 match value {
22761 "MODE_UNSPECIFIED" => Self::Unspecified,
22762 "SUGGESTION_ONLY" => Self::SuggestionOnly,
22763 "AUTO" => Self::Auto,
22764 _ => Self::UnknownValue(mode::UnknownValue(
22765 wkt::internal::UnknownEnumValue::String(value.to_string()),
22766 )),
22767 }
22768 }
22769 }
22770
22771 impl serde::ser::Serialize for Mode {
22772 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22773 where
22774 S: serde::Serializer,
22775 {
22776 match self {
22777 Self::Unspecified => serializer.serialize_i32(0),
22778 Self::SuggestionOnly => serializer.serialize_i32(1),
22779 Self::Auto => serializer.serialize_i32(2),
22780 Self::UnknownValue(u) => u.0.serialize(serializer),
22781 }
22782 }
22783 }
22784
22785 impl<'de> serde::de::Deserialize<'de> for Mode {
22786 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22787 where
22788 D: serde::Deserializer<'de>,
22789 {
22790 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22791 ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22792 ))
22793 }
22794 }
22795 }
22796
22797 /// This field specifies all conversational related parameters addition to
22798 /// traditional retail search.
22799 #[derive(Clone, Default, PartialEq)]
22800 #[non_exhaustive]
22801 pub struct ConversationalSearchSpec {
22802 /// This field specifies whether the customer would like to do conversational
22803 /// search. If this field is set to true, conversational related extra
22804 /// information will be returned from server side, including follow-up
22805 /// question, answer options, etc.
22806 pub followup_conversation_requested: bool,
22807
22808 /// This field specifies the conversation id, which maintains the state of
22809 /// the conversation between client side and server side. Use the value from
22810 /// the previous [ConversationalSearchResult.conversation_id][]. For the
22811 /// initial request, this should be empty.
22812 pub conversation_id: std::string::String,
22813
22814 /// This field specifies the current user answer during the conversational
22815 /// search. This can be either user selected from suggested answers or user
22816 /// input plain text.
22817 pub user_answer: std::option::Option<
22818 crate::model::search_request::conversational_search_spec::UserAnswer,
22819 >,
22820
22821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22822 }
22823
22824 impl ConversationalSearchSpec {
22825 /// Creates a new default instance.
22826 pub fn new() -> Self {
22827 std::default::Default::default()
22828 }
22829
22830 /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22831 ///
22832 /// # Example
22833 /// ```ignore,no_run
22834 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22835 /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22836 /// ```
22837 pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22838 mut self,
22839 v: T,
22840 ) -> Self {
22841 self.followup_conversation_requested = v.into();
22842 self
22843 }
22844
22845 /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22846 ///
22847 /// # Example
22848 /// ```ignore,no_run
22849 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22850 /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22851 /// ```
22852 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22853 mut self,
22854 v: T,
22855 ) -> Self {
22856 self.conversation_id = v.into();
22857 self
22858 }
22859
22860 /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22861 ///
22862 /// # Example
22863 /// ```ignore,no_run
22864 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22865 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22866 /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22867 /// ```
22868 pub fn set_user_answer<T>(mut self, v: T) -> Self
22869 where
22870 T: std::convert::Into<
22871 crate::model::search_request::conversational_search_spec::UserAnswer,
22872 >,
22873 {
22874 self.user_answer = std::option::Option::Some(v.into());
22875 self
22876 }
22877
22878 /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22879 ///
22880 /// # Example
22881 /// ```ignore,no_run
22882 /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22883 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22884 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22885 /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22886 /// ```
22887 pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22888 where
22889 T: std::convert::Into<
22890 crate::model::search_request::conversational_search_spec::UserAnswer,
22891 >,
22892 {
22893 self.user_answer = v.map(|x| x.into());
22894 self
22895 }
22896 }
22897
22898 impl wkt::message::Message for ConversationalSearchSpec {
22899 fn typename() -> &'static str {
22900 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22901 }
22902 }
22903
22904 /// Defines additional types related to [ConversationalSearchSpec].
22905 pub mod conversational_search_spec {
22906 #[allow(unused_imports)]
22907 use super::*;
22908
22909 /// This field specifies the current user answer during the conversational
22910 /// search. This can be either user selected from suggested answers or user
22911 /// input plain text.
22912 #[derive(Clone, Default, PartialEq)]
22913 #[non_exhaustive]
22914 pub struct UserAnswer {
22915 /// This field specifies the type of user answer.
22916 pub r#type: std::option::Option<
22917 crate::model::search_request::conversational_search_spec::user_answer::Type,
22918 >,
22919
22920 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22921 }
22922
22923 impl UserAnswer {
22924 /// Creates a new default instance.
22925 pub fn new() -> Self {
22926 std::default::Default::default()
22927 }
22928
22929 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22930 ///
22931 /// Note that all the setters affecting `r#type` are mutually
22932 /// exclusive.
22933 ///
22934 /// # Example
22935 /// ```ignore,no_run
22936 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22937 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22938 /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22939 /// ```
22940 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
22941 {
22942 self.r#type = v.into();
22943 self
22944 }
22945
22946 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22947 /// if it holds a `TextAnswer`, `None` if the field is not set or
22948 /// holds a different branch.
22949 pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22950 #[allow(unreachable_patterns)]
22951 self.r#type.as_ref().and_then(|v| match v {
22952 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22953 _ => std::option::Option::None,
22954 })
22955 }
22956
22957 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22958 /// to hold a `TextAnswer`.
22959 ///
22960 /// Note that all the setters affecting `r#type` are
22961 /// mutually exclusive.
22962 ///
22963 /// # Example
22964 /// ```ignore,no_run
22965 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22966 /// let x = UserAnswer::new().set_text_answer("example");
22967 /// assert!(x.text_answer().is_some());
22968 /// assert!(x.selected_answer().is_none());
22969 /// ```
22970 pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22971 mut self,
22972 v: T,
22973 ) -> Self {
22974 self.r#type = std::option::Option::Some(
22975 crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22976 v.into()
22977 )
22978 );
22979 self
22980 }
22981
22982 /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22983 /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22984 /// holds a different branch.
22985 pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22986 #[allow(unreachable_patterns)]
22987 self.r#type.as_ref().and_then(|v| match v {
22988 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22989 _ => std::option::Option::None,
22990 })
22991 }
22992
22993 /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22994 /// to hold a `SelectedAnswer`.
22995 ///
22996 /// Note that all the setters affecting `r#type` are
22997 /// mutually exclusive.
22998 ///
22999 /// # Example
23000 /// ```ignore,no_run
23001 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
23002 /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23003 /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
23004 /// assert!(x.selected_answer().is_some());
23005 /// assert!(x.text_answer().is_none());
23006 /// ```
23007 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{
23008 self.r#type = std::option::Option::Some(
23009 crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
23010 v.into()
23011 )
23012 );
23013 self
23014 }
23015 }
23016
23017 impl wkt::message::Message for UserAnswer {
23018 fn typename() -> &'static str {
23019 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
23020 }
23021 }
23022
23023 /// Defines additional types related to [UserAnswer].
23024 pub mod user_answer {
23025 #[allow(unused_imports)]
23026 use super::*;
23027
23028 /// This field specifies the selected answers during the conversational
23029 /// search.
23030 #[derive(Clone, Default, PartialEq)]
23031 #[non_exhaustive]
23032 pub struct SelectedAnswer {
23033 /// This field is deprecated and should not be set.
23034 #[deprecated]
23035 pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
23036
23037 /// This field specifies the selected answer which is a attribute
23038 /// key-value.
23039 pub product_attribute_value:
23040 std::option::Option<crate::model::ProductAttributeValue>,
23041
23042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23043 }
23044
23045 impl SelectedAnswer {
23046 /// Creates a new default instance.
23047 pub fn new() -> Self {
23048 std::default::Default::default()
23049 }
23050
23051 /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
23052 ///
23053 /// # Example
23054 /// ```ignore,no_run
23055 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23056 /// use google_cloud_retail_v2::model::ProductAttributeValue;
23057 /// let x = SelectedAnswer::new()
23058 /// .set_product_attribute_values([
23059 /// ProductAttributeValue::default()/* use setters */,
23060 /// ProductAttributeValue::default()/* use (different) setters */,
23061 /// ]);
23062 /// ```
23063 #[deprecated]
23064 pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
23065 where
23066 T: std::iter::IntoIterator<Item = V>,
23067 V: std::convert::Into<crate::model::ProductAttributeValue>,
23068 {
23069 use std::iter::Iterator;
23070 self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
23071 self
23072 }
23073
23074 /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
23075 ///
23076 /// # Example
23077 /// ```ignore,no_run
23078 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23079 /// use google_cloud_retail_v2::model::ProductAttributeValue;
23080 /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
23081 /// ```
23082 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
23083 where
23084 T: std::convert::Into<crate::model::ProductAttributeValue>,
23085 {
23086 self.product_attribute_value = std::option::Option::Some(v.into());
23087 self
23088 }
23089
23090 /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
23091 ///
23092 /// # Example
23093 /// ```ignore,no_run
23094 /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23095 /// use google_cloud_retail_v2::model::ProductAttributeValue;
23096 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
23097 /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
23098 /// ```
23099 pub fn set_or_clear_product_attribute_value<T>(
23100 mut self,
23101 v: std::option::Option<T>,
23102 ) -> Self
23103 where
23104 T: std::convert::Into<crate::model::ProductAttributeValue>,
23105 {
23106 self.product_attribute_value = v.map(|x| x.into());
23107 self
23108 }
23109 }
23110
23111 impl wkt::message::Message for SelectedAnswer {
23112 fn typename() -> &'static str {
23113 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
23114 }
23115 }
23116
23117 /// This field specifies the type of user answer.
23118 #[derive(Clone, Debug, PartialEq)]
23119 #[non_exhaustive]
23120 pub enum Type {
23121 /// This field specifies the incremental input text from the user during
23122 /// the conversational search.
23123 TextAnswer(std::string::String),
23124 /// This field specifies the selected attributes during the
23125 /// conversational search. This should be a subset of
23126 /// [ConversationalSearchResult.suggested_answers][].
23127 SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
23128 }
23129 }
23130 }
23131
23132 /// This field specifies tile navigation related parameters.
23133 #[derive(Clone, Default, PartialEq)]
23134 #[non_exhaustive]
23135 pub struct TileNavigationSpec {
23136 /// This field specifies whether the customer would like to request tile
23137 /// navigation.
23138 pub tile_navigation_requested: bool,
23139
23140 /// This optional field specifies the tiles which are already clicked in
23141 /// client side. While the feature works without this field set, particularly
23142 /// for an initial query, it is highly recommended to set this field because
23143 /// it can improve the quality of the search response and removes possible
23144 /// duplicate tiles.
23145 ///
23146 /// NOTE: This field is not being used for filtering search
23147 /// products. Client side should also put all the applied tiles in
23148 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
23149 ///
23150 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
23151 pub applied_tiles: std::vec::Vec<crate::model::Tile>,
23152
23153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23154 }
23155
23156 impl TileNavigationSpec {
23157 /// Creates a new default instance.
23158 pub fn new() -> Self {
23159 std::default::Default::default()
23160 }
23161
23162 /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
23163 ///
23164 /// # Example
23165 /// ```ignore,no_run
23166 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23167 /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
23168 /// ```
23169 pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23170 self.tile_navigation_requested = v.into();
23171 self
23172 }
23173
23174 /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
23175 ///
23176 /// # Example
23177 /// ```ignore,no_run
23178 /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23179 /// use google_cloud_retail_v2::model::Tile;
23180 /// let x = TileNavigationSpec::new()
23181 /// .set_applied_tiles([
23182 /// Tile::default()/* use setters */,
23183 /// Tile::default()/* use (different) setters */,
23184 /// ]);
23185 /// ```
23186 pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
23187 where
23188 T: std::iter::IntoIterator<Item = V>,
23189 V: std::convert::Into<crate::model::Tile>,
23190 {
23191 use std::iter::Iterator;
23192 self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
23193 self
23194 }
23195 }
23196
23197 impl wkt::message::Message for TileNavigationSpec {
23198 fn typename() -> &'static str {
23199 "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
23200 }
23201 }
23202
23203 /// The search mode of each search request.
23204 ///
23205 /// # Working with unknown values
23206 ///
23207 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23208 /// additional enum variants at any time. Adding new variants is not considered
23209 /// a breaking change. Applications should write their code in anticipation of:
23210 ///
23211 /// - New values appearing in future releases of the client library, **and**
23212 /// - New values received dynamically, without application changes.
23213 ///
23214 /// Please consult the [Working with enums] section in the user guide for some
23215 /// guidelines.
23216 ///
23217 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
23218 #[derive(Clone, Debug, PartialEq)]
23219 #[non_exhaustive]
23220 pub enum SearchMode {
23221 /// Default value. In this case both product search and faceted search will
23222 /// be performed. Both
23223 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23224 /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
23225 /// will be returned.
23226 ///
23227 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23228 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23229 Unspecified,
23230 /// Only product search will be performed. The faceted search will be
23231 /// disabled.
23232 ///
23233 /// Only
23234 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23235 /// will be returned.
23236 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23237 /// not be returned, even if
23238 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23239 /// or
23240 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23241 /// is set.
23242 ///
23243 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23244 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23245 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23246 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23247 ProductSearchOnly,
23248 /// Only faceted search will be performed. The product search will be
23249 /// disabled.
23250 ///
23251 /// When in this mode, one or both of
23252 /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23253 /// and
23254 /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23255 /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
23256 /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23257 /// be returned.
23258 /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23259 /// will not be returned.
23260 ///
23261 /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23262 /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23263 /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23264 /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23265 FacetedSearchOnly,
23266 /// If set, the enum was initialized with an unknown value.
23267 ///
23268 /// Applications can examine the value using [SearchMode::value] or
23269 /// [SearchMode::name].
23270 UnknownValue(search_mode::UnknownValue),
23271 }
23272
23273 #[doc(hidden)]
23274 pub mod search_mode {
23275 #[allow(unused_imports)]
23276 use super::*;
23277 #[derive(Clone, Debug, PartialEq)]
23278 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23279 }
23280
23281 impl SearchMode {
23282 /// Gets the enum value.
23283 ///
23284 /// Returns `None` if the enum contains an unknown value deserialized from
23285 /// the string representation of enums.
23286 pub fn value(&self) -> std::option::Option<i32> {
23287 match self {
23288 Self::Unspecified => std::option::Option::Some(0),
23289 Self::ProductSearchOnly => std::option::Option::Some(1),
23290 Self::FacetedSearchOnly => std::option::Option::Some(2),
23291 Self::UnknownValue(u) => u.0.value(),
23292 }
23293 }
23294
23295 /// Gets the enum value as a string.
23296 ///
23297 /// Returns `None` if the enum contains an unknown value deserialized from
23298 /// the integer representation of enums.
23299 pub fn name(&self) -> std::option::Option<&str> {
23300 match self {
23301 Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
23302 Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
23303 Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
23304 Self::UnknownValue(u) => u.0.name(),
23305 }
23306 }
23307 }
23308
23309 impl std::default::Default for SearchMode {
23310 fn default() -> Self {
23311 use std::convert::From;
23312 Self::from(0)
23313 }
23314 }
23315
23316 impl std::fmt::Display for SearchMode {
23317 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23318 wkt::internal::display_enum(f, self.name(), self.value())
23319 }
23320 }
23321
23322 impl std::convert::From<i32> for SearchMode {
23323 fn from(value: i32) -> Self {
23324 match value {
23325 0 => Self::Unspecified,
23326 1 => Self::ProductSearchOnly,
23327 2 => Self::FacetedSearchOnly,
23328 _ => Self::UnknownValue(search_mode::UnknownValue(
23329 wkt::internal::UnknownEnumValue::Integer(value),
23330 )),
23331 }
23332 }
23333 }
23334
23335 impl std::convert::From<&str> for SearchMode {
23336 fn from(value: &str) -> Self {
23337 use std::string::ToString;
23338 match value {
23339 "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23340 "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23341 "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23342 _ => Self::UnknownValue(search_mode::UnknownValue(
23343 wkt::internal::UnknownEnumValue::String(value.to_string()),
23344 )),
23345 }
23346 }
23347 }
23348
23349 impl serde::ser::Serialize for SearchMode {
23350 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23351 where
23352 S: serde::Serializer,
23353 {
23354 match self {
23355 Self::Unspecified => serializer.serialize_i32(0),
23356 Self::ProductSearchOnly => serializer.serialize_i32(1),
23357 Self::FacetedSearchOnly => serializer.serialize_i32(2),
23358 Self::UnknownValue(u) => u.0.serialize(serializer),
23359 }
23360 }
23361 }
23362
23363 impl<'de> serde::de::Deserialize<'de> for SearchMode {
23364 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23365 where
23366 D: serde::Deserializer<'de>,
23367 {
23368 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23369 ".google.cloud.retail.v2.SearchRequest.SearchMode",
23370 ))
23371 }
23372 }
23373}
23374
23375/// Response message for
23376/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23377///
23378/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23379#[derive(Clone, Default, PartialEq)]
23380#[non_exhaustive]
23381pub struct SearchResponse {
23382 /// A list of matched items. The order represents the ranking.
23383 pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23384
23385 /// Results of facets requested by user.
23386 pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23387
23388 /// The estimated total count of matched items irrespective of pagination. The
23389 /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23390 /// by pagination may be less than the
23391 /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23392 /// matches.
23393 ///
23394 /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23395 /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23396 pub total_size: i32,
23397
23398 /// Contains the spell corrected query, if found. If the spell correction type
23399 /// is AUTOMATIC, then the search results are based on corrected_query.
23400 /// Otherwise the original query is used for search.
23401 pub corrected_query: std::string::String,
23402
23403 /// A unique search token. This should be included in the
23404 /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23405 /// search, which enables accurate attribution of search model performance.
23406 ///
23407 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23408 pub attribution_token: std::string::String,
23409
23410 /// A token that can be sent as
23411 /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23412 /// to retrieve the next page. If this field is omitted, there are no
23413 /// subsequent pages.
23414 ///
23415 /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23416 pub next_page_token: std::string::String,
23417
23418 /// Query expansion information for the returned results.
23419 pub query_expansion_info:
23420 std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23421
23422 /// The URI of a customer-defined redirect page. If redirect action is
23423 /// triggered, no search is performed, and only
23424 /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23425 /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23426 /// are set in the response.
23427 ///
23428 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23429 /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23430 pub redirect_uri: std::string::String,
23431
23432 /// The fully qualified resource name of applied
23433 /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23434 pub applied_controls: std::vec::Vec<std::string::String>,
23435
23436 /// Metadata for pin controls which were applicable to the request.
23437 /// This contains two map fields, one for all matched pins and one for pins
23438 /// which were matched but not applied.
23439 ///
23440 /// The two maps are keyed by pin position, and the values are the product ids
23441 /// which were matched to that pin.
23442 pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23443
23444 /// The invalid
23445 /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23446 /// that are not applied during serving.
23447 ///
23448 /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23449 pub invalid_condition_boost_specs:
23450 std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23451
23452 /// Metadata related to A/B testing experiment associated with this
23453 /// response. Only exists when an experiment is triggered.
23454 pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23455
23456 /// This field specifies all related information that is needed on client
23457 /// side for UI rendering of conversational retail search.
23458 pub conversational_search_result:
23459 std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23460
23461 /// This field specifies all related information for tile navigation that will
23462 /// be used in client side.
23463 pub tile_navigation_result:
23464 std::option::Option<crate::model::search_response::TileNavigationResult>,
23465
23466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23467}
23468
23469impl SearchResponse {
23470 /// Creates a new default instance.
23471 pub fn new() -> Self {
23472 std::default::Default::default()
23473 }
23474
23475 /// Sets the value of [results][crate::model::SearchResponse::results].
23476 ///
23477 /// # Example
23478 /// ```ignore,no_run
23479 /// # use google_cloud_retail_v2::model::SearchResponse;
23480 /// use google_cloud_retail_v2::model::search_response::SearchResult;
23481 /// let x = SearchResponse::new()
23482 /// .set_results([
23483 /// SearchResult::default()/* use setters */,
23484 /// SearchResult::default()/* use (different) setters */,
23485 /// ]);
23486 /// ```
23487 pub fn set_results<T, V>(mut self, v: T) -> Self
23488 where
23489 T: std::iter::IntoIterator<Item = V>,
23490 V: std::convert::Into<crate::model::search_response::SearchResult>,
23491 {
23492 use std::iter::Iterator;
23493 self.results = v.into_iter().map(|i| i.into()).collect();
23494 self
23495 }
23496
23497 /// Sets the value of [facets][crate::model::SearchResponse::facets].
23498 ///
23499 /// # Example
23500 /// ```ignore,no_run
23501 /// # use google_cloud_retail_v2::model::SearchResponse;
23502 /// use google_cloud_retail_v2::model::search_response::Facet;
23503 /// let x = SearchResponse::new()
23504 /// .set_facets([
23505 /// Facet::default()/* use setters */,
23506 /// Facet::default()/* use (different) setters */,
23507 /// ]);
23508 /// ```
23509 pub fn set_facets<T, V>(mut self, v: T) -> Self
23510 where
23511 T: std::iter::IntoIterator<Item = V>,
23512 V: std::convert::Into<crate::model::search_response::Facet>,
23513 {
23514 use std::iter::Iterator;
23515 self.facets = v.into_iter().map(|i| i.into()).collect();
23516 self
23517 }
23518
23519 /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23520 ///
23521 /// # Example
23522 /// ```ignore,no_run
23523 /// # use google_cloud_retail_v2::model::SearchResponse;
23524 /// let x = SearchResponse::new().set_total_size(42);
23525 /// ```
23526 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23527 self.total_size = v.into();
23528 self
23529 }
23530
23531 /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23532 ///
23533 /// # Example
23534 /// ```ignore,no_run
23535 /// # use google_cloud_retail_v2::model::SearchResponse;
23536 /// let x = SearchResponse::new().set_corrected_query("example");
23537 /// ```
23538 pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23539 self.corrected_query = v.into();
23540 self
23541 }
23542
23543 /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23544 ///
23545 /// # Example
23546 /// ```ignore,no_run
23547 /// # use google_cloud_retail_v2::model::SearchResponse;
23548 /// let x = SearchResponse::new().set_attribution_token("example");
23549 /// ```
23550 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23551 mut self,
23552 v: T,
23553 ) -> Self {
23554 self.attribution_token = v.into();
23555 self
23556 }
23557
23558 /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23559 ///
23560 /// # Example
23561 /// ```ignore,no_run
23562 /// # use google_cloud_retail_v2::model::SearchResponse;
23563 /// let x = SearchResponse::new().set_next_page_token("example");
23564 /// ```
23565 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23566 self.next_page_token = v.into();
23567 self
23568 }
23569
23570 /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23571 ///
23572 /// # Example
23573 /// ```ignore,no_run
23574 /// # use google_cloud_retail_v2::model::SearchResponse;
23575 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23576 /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23577 /// ```
23578 pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23579 where
23580 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23581 {
23582 self.query_expansion_info = std::option::Option::Some(v.into());
23583 self
23584 }
23585
23586 /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23587 ///
23588 /// # Example
23589 /// ```ignore,no_run
23590 /// # use google_cloud_retail_v2::model::SearchResponse;
23591 /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23592 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23593 /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23594 /// ```
23595 pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23596 where
23597 T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23598 {
23599 self.query_expansion_info = v.map(|x| x.into());
23600 self
23601 }
23602
23603 /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23604 ///
23605 /// # Example
23606 /// ```ignore,no_run
23607 /// # use google_cloud_retail_v2::model::SearchResponse;
23608 /// let x = SearchResponse::new().set_redirect_uri("example");
23609 /// ```
23610 pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23611 self.redirect_uri = v.into();
23612 self
23613 }
23614
23615 /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23616 ///
23617 /// # Example
23618 /// ```ignore,no_run
23619 /// # use google_cloud_retail_v2::model::SearchResponse;
23620 /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23621 /// ```
23622 pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23623 where
23624 T: std::iter::IntoIterator<Item = V>,
23625 V: std::convert::Into<std::string::String>,
23626 {
23627 use std::iter::Iterator;
23628 self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23629 self
23630 }
23631
23632 /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23633 ///
23634 /// # Example
23635 /// ```ignore,no_run
23636 /// # use google_cloud_retail_v2::model::SearchResponse;
23637 /// use google_cloud_retail_v2::model::PinControlMetadata;
23638 /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23639 /// ```
23640 pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23641 where
23642 T: std::convert::Into<crate::model::PinControlMetadata>,
23643 {
23644 self.pin_control_metadata = std::option::Option::Some(v.into());
23645 self
23646 }
23647
23648 /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23649 ///
23650 /// # Example
23651 /// ```ignore,no_run
23652 /// # use google_cloud_retail_v2::model::SearchResponse;
23653 /// use google_cloud_retail_v2::model::PinControlMetadata;
23654 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23655 /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23656 /// ```
23657 pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23658 where
23659 T: std::convert::Into<crate::model::PinControlMetadata>,
23660 {
23661 self.pin_control_metadata = v.map(|x| x.into());
23662 self
23663 }
23664
23665 /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23666 ///
23667 /// # Example
23668 /// ```ignore,no_run
23669 /// # use google_cloud_retail_v2::model::SearchResponse;
23670 /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23671 /// let x = SearchResponse::new()
23672 /// .set_invalid_condition_boost_specs([
23673 /// ConditionBoostSpec::default()/* use setters */,
23674 /// ConditionBoostSpec::default()/* use (different) setters */,
23675 /// ]);
23676 /// ```
23677 pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23678 where
23679 T: std::iter::IntoIterator<Item = V>,
23680 V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23681 {
23682 use std::iter::Iterator;
23683 self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23684 self
23685 }
23686
23687 /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23688 ///
23689 /// # Example
23690 /// ```ignore,no_run
23691 /// # use google_cloud_retail_v2::model::SearchResponse;
23692 /// use google_cloud_retail_v2::model::ExperimentInfo;
23693 /// let x = SearchResponse::new()
23694 /// .set_experiment_info([
23695 /// ExperimentInfo::default()/* use setters */,
23696 /// ExperimentInfo::default()/* use (different) setters */,
23697 /// ]);
23698 /// ```
23699 pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23700 where
23701 T: std::iter::IntoIterator<Item = V>,
23702 V: std::convert::Into<crate::model::ExperimentInfo>,
23703 {
23704 use std::iter::Iterator;
23705 self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23706 self
23707 }
23708
23709 /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23710 ///
23711 /// # Example
23712 /// ```ignore,no_run
23713 /// # use google_cloud_retail_v2::model::SearchResponse;
23714 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23715 /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23716 /// ```
23717 pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23718 where
23719 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23720 {
23721 self.conversational_search_result = std::option::Option::Some(v.into());
23722 self
23723 }
23724
23725 /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23726 ///
23727 /// # Example
23728 /// ```ignore,no_run
23729 /// # use google_cloud_retail_v2::model::SearchResponse;
23730 /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23731 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23732 /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23733 /// ```
23734 pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23735 where
23736 T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23737 {
23738 self.conversational_search_result = v.map(|x| x.into());
23739 self
23740 }
23741
23742 /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23743 ///
23744 /// # Example
23745 /// ```ignore,no_run
23746 /// # use google_cloud_retail_v2::model::SearchResponse;
23747 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23748 /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23749 /// ```
23750 pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23751 where
23752 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23753 {
23754 self.tile_navigation_result = std::option::Option::Some(v.into());
23755 self
23756 }
23757
23758 /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23759 ///
23760 /// # Example
23761 /// ```ignore,no_run
23762 /// # use google_cloud_retail_v2::model::SearchResponse;
23763 /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23764 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23765 /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23766 /// ```
23767 pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23768 where
23769 T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23770 {
23771 self.tile_navigation_result = v.map(|x| x.into());
23772 self
23773 }
23774}
23775
23776impl wkt::message::Message for SearchResponse {
23777 fn typename() -> &'static str {
23778 "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23779 }
23780}
23781
23782#[doc(hidden)]
23783impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
23784 type PageItem = crate::model::search_response::SearchResult;
23785
23786 fn items(self) -> std::vec::Vec<Self::PageItem> {
23787 self.results
23788 }
23789
23790 fn next_page_token(&self) -> std::string::String {
23791 use std::clone::Clone;
23792 self.next_page_token.clone()
23793 }
23794}
23795
23796/// Defines additional types related to [SearchResponse].
23797pub mod search_response {
23798 #[allow(unused_imports)]
23799 use super::*;
23800
23801 /// Represents the search results.
23802 #[derive(Clone, Default, PartialEq)]
23803 #[non_exhaustive]
23804 pub struct SearchResult {
23805 /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23806 /// [Product][google.cloud.retail.v2.Product].
23807 ///
23808 /// [google.cloud.retail.v2.Product]: crate::model::Product
23809 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23810 pub id: std::string::String,
23811
23812 /// The product data snippet in the search response. Only
23813 /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23814 /// populated.
23815 ///
23816 /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23817 /// product variants that match the search query. If there are multiple
23818 /// product variants matching the query, top 5 most relevant product variants
23819 /// are returned and ordered by relevancy.
23820 ///
23821 /// If relevancy can be deternmined, use
23822 /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23823 /// to look up matched product variants fields. If relevancy cannot be
23824 /// determined, e.g. when searching "shoe" all products in a shoe product can
23825 /// be a match, 5 product variants are returned but order is meaningless.
23826 ///
23827 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23828 /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23829 /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23830 pub product: std::option::Option<crate::model::Product>,
23831
23832 /// The count of matched
23833 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23834 /// [Product][google.cloud.retail.v2.Product]s.
23835 ///
23836 /// [google.cloud.retail.v2.Product]: crate::model::Product
23837 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23838 pub matching_variant_count: i32,
23839
23840 /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23841 /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23842 /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23843 /// matched. The key is the
23844 /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23845 /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23846 /// matched attributes cannot be determined, this map will be empty.
23847 ///
23848 /// For example, a key "sku1" with field mask
23849 /// "products.color_info" indicates there is a match between
23850 /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23851 ///
23852 /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23853 /// [google.cloud.retail.v2.Product]: crate::model::Product
23854 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23855 /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23856 pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23857
23858 /// The rollup matching
23859 /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23860 /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23861 /// the
23862 /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23863 /// The values are the merged and de-duplicated
23864 /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23865 /// rollup values are respect filter. For example, when filtering by
23866 /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23867 /// returned.
23868 ///
23869 /// For textual and numerical attributes, the rollup values is a list of
23870 /// string or double values with type
23871 /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23872 /// there are two variants with colors "red" and "blue", the rollup values
23873 /// are
23874 ///
23875 /// ```norust
23876 /// { key: "colorFamilies"
23877 /// value {
23878 /// list_value {
23879 /// values { string_value: "red" }
23880 /// values { string_value: "blue" }
23881 /// }
23882 /// }
23883 /// }
23884 /// ```
23885 ///
23886 /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23887 /// values is a double value with type
23888 /// [google.protobuf.Value][google.protobuf.Value]. For example,
23889 /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23890 /// are 10 variants in this product are available in the store "store1".
23891 ///
23892 /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23893 /// [google.cloud.retail.v2.Product]: crate::model::Product
23894 /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23895 /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23896 /// [google.protobuf.ListValue]: wkt::ListValue
23897 /// [google.protobuf.Value]: wkt::Value
23898 pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23899
23900 /// Specifies previous events related to this product for this user based on
23901 /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23902 /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23903 /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23904 ///
23905 /// This is set only when
23906 /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23907 /// is
23908 /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23909 ///
23910 /// Possible values:
23911 ///
23912 /// * `purchased`: Indicates that this product has been purchased before.
23913 ///
23914 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23915 /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23916 /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23917 /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23918 /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23919 pub personal_labels: std::vec::Vec<std::string::String>,
23920
23921 /// Google provided available scores.
23922 pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23923
23924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23925 }
23926
23927 impl SearchResult {
23928 /// Creates a new default instance.
23929 pub fn new() -> Self {
23930 std::default::Default::default()
23931 }
23932
23933 /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23934 ///
23935 /// # Example
23936 /// ```ignore,no_run
23937 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23938 /// let x = SearchResult::new().set_id("example");
23939 /// ```
23940 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23941 self.id = v.into();
23942 self
23943 }
23944
23945 /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23946 ///
23947 /// # Example
23948 /// ```ignore,no_run
23949 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23950 /// use google_cloud_retail_v2::model::Product;
23951 /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23952 /// ```
23953 pub fn set_product<T>(mut self, v: T) -> Self
23954 where
23955 T: std::convert::Into<crate::model::Product>,
23956 {
23957 self.product = std::option::Option::Some(v.into());
23958 self
23959 }
23960
23961 /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23962 ///
23963 /// # Example
23964 /// ```ignore,no_run
23965 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23966 /// use google_cloud_retail_v2::model::Product;
23967 /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23968 /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23969 /// ```
23970 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23971 where
23972 T: std::convert::Into<crate::model::Product>,
23973 {
23974 self.product = v.map(|x| x.into());
23975 self
23976 }
23977
23978 /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23979 ///
23980 /// # Example
23981 /// ```ignore,no_run
23982 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23983 /// let x = SearchResult::new().set_matching_variant_count(42);
23984 /// ```
23985 pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23986 self.matching_variant_count = v.into();
23987 self
23988 }
23989
23990 /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23991 ///
23992 /// # Example
23993 /// ```ignore,no_run
23994 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23995 /// use wkt::FieldMask;
23996 /// let x = SearchResult::new().set_matching_variant_fields([
23997 /// ("key0", FieldMask::default()/* use setters */),
23998 /// ("key1", FieldMask::default()/* use (different) setters */),
23999 /// ]);
24000 /// ```
24001 pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
24002 where
24003 T: std::iter::IntoIterator<Item = (K, V)>,
24004 K: std::convert::Into<std::string::String>,
24005 V: std::convert::Into<wkt::FieldMask>,
24006 {
24007 use std::iter::Iterator;
24008 self.matching_variant_fields =
24009 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24010 self
24011 }
24012
24013 /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
24014 ///
24015 /// # Example
24016 /// ```ignore,no_run
24017 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24018 /// use wkt::Value;
24019 /// let x = SearchResult::new().set_variant_rollup_values([
24020 /// ("key0", Value::default()/* use setters */),
24021 /// ("key1", Value::default()/* use (different) setters */),
24022 /// ]);
24023 /// ```
24024 pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
24025 where
24026 T: std::iter::IntoIterator<Item = (K, V)>,
24027 K: std::convert::Into<std::string::String>,
24028 V: std::convert::Into<wkt::Value>,
24029 {
24030 use std::iter::Iterator;
24031 self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24032 self
24033 }
24034
24035 /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
24036 ///
24037 /// # Example
24038 /// ```ignore,no_run
24039 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24040 /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
24041 /// ```
24042 pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
24043 where
24044 T: std::iter::IntoIterator<Item = V>,
24045 V: std::convert::Into<std::string::String>,
24046 {
24047 use std::iter::Iterator;
24048 self.personal_labels = v.into_iter().map(|i| i.into()).collect();
24049 self
24050 }
24051
24052 /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
24053 ///
24054 /// # Example
24055 /// ```ignore,no_run
24056 /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24057 /// use google_cloud_retail_v2::model::DoubleList;
24058 /// let x = SearchResult::new().set_model_scores([
24059 /// ("key0", DoubleList::default()/* use setters */),
24060 /// ("key1", DoubleList::default()/* use (different) setters */),
24061 /// ]);
24062 /// ```
24063 pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
24064 where
24065 T: std::iter::IntoIterator<Item = (K, V)>,
24066 K: std::convert::Into<std::string::String>,
24067 V: std::convert::Into<crate::model::DoubleList>,
24068 {
24069 use std::iter::Iterator;
24070 self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24071 self
24072 }
24073 }
24074
24075 impl wkt::message::Message for SearchResult {
24076 fn typename() -> &'static str {
24077 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
24078 }
24079 }
24080
24081 /// A facet result.
24082 #[derive(Clone, Default, PartialEq)]
24083 #[non_exhaustive]
24084 pub struct Facet {
24085 /// The key for this facet. E.g., "colorFamilies" or "price" or
24086 /// "attributes.attr1".
24087 pub key: std::string::String,
24088
24089 /// The facet values for this field.
24090 pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
24091
24092 /// Whether the facet is dynamically generated.
24093 pub dynamic_facet: bool,
24094
24095 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24096 }
24097
24098 impl Facet {
24099 /// Creates a new default instance.
24100 pub fn new() -> Self {
24101 std::default::Default::default()
24102 }
24103
24104 /// Sets the value of [key][crate::model::search_response::Facet::key].
24105 ///
24106 /// # Example
24107 /// ```ignore,no_run
24108 /// # use google_cloud_retail_v2::model::search_response::Facet;
24109 /// let x = Facet::new().set_key("example");
24110 /// ```
24111 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24112 self.key = v.into();
24113 self
24114 }
24115
24116 /// Sets the value of [values][crate::model::search_response::Facet::values].
24117 ///
24118 /// # Example
24119 /// ```ignore,no_run
24120 /// # use google_cloud_retail_v2::model::search_response::Facet;
24121 /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24122 /// let x = Facet::new()
24123 /// .set_values([
24124 /// FacetValue::default()/* use setters */,
24125 /// FacetValue::default()/* use (different) setters */,
24126 /// ]);
24127 /// ```
24128 pub fn set_values<T, V>(mut self, v: T) -> Self
24129 where
24130 T: std::iter::IntoIterator<Item = V>,
24131 V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
24132 {
24133 use std::iter::Iterator;
24134 self.values = v.into_iter().map(|i| i.into()).collect();
24135 self
24136 }
24137
24138 /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
24139 ///
24140 /// # Example
24141 /// ```ignore,no_run
24142 /// # use google_cloud_retail_v2::model::search_response::Facet;
24143 /// let x = Facet::new().set_dynamic_facet(true);
24144 /// ```
24145 pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24146 self.dynamic_facet = v.into();
24147 self
24148 }
24149 }
24150
24151 impl wkt::message::Message for Facet {
24152 fn typename() -> &'static str {
24153 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
24154 }
24155 }
24156
24157 /// Defines additional types related to [Facet].
24158 pub mod facet {
24159 #[allow(unused_imports)]
24160 use super::*;
24161
24162 /// A facet value which contains value names and their count.
24163 #[derive(Clone, Default, PartialEq)]
24164 #[non_exhaustive]
24165 pub struct FacetValue {
24166 /// Number of items that have this facet value.
24167 pub count: i64,
24168
24169 /// The minimum value in the
24170 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24171 /// Only supported on numerical facets and returned if
24172 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24173 /// is true.
24174 ///
24175 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24176 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24177 pub min_value: f64,
24178
24179 /// The maximum value in the
24180 /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24181 /// Only supported on numerical facets and returned if
24182 /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24183 /// is true.
24184 ///
24185 /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24186 /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24187 pub max_value: f64,
24188
24189 /// A facet value which contains values.
24190 pub facet_value:
24191 std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
24192
24193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24194 }
24195
24196 impl FacetValue {
24197 /// Creates a new default instance.
24198 pub fn new() -> Self {
24199 std::default::Default::default()
24200 }
24201
24202 /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
24203 ///
24204 /// # Example
24205 /// ```ignore,no_run
24206 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24207 /// let x = FacetValue::new().set_count(42);
24208 /// ```
24209 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24210 self.count = v.into();
24211 self
24212 }
24213
24214 /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
24215 ///
24216 /// # Example
24217 /// ```ignore,no_run
24218 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24219 /// let x = FacetValue::new().set_min_value(42.0);
24220 /// ```
24221 pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24222 self.min_value = v.into();
24223 self
24224 }
24225
24226 /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
24227 ///
24228 /// # Example
24229 /// ```ignore,no_run
24230 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24231 /// let x = FacetValue::new().set_max_value(42.0);
24232 /// ```
24233 pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24234 self.max_value = v.into();
24235 self
24236 }
24237
24238 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
24239 ///
24240 /// Note that all the setters affecting `facet_value` are mutually
24241 /// exclusive.
24242 ///
24243 /// # Example
24244 /// ```ignore,no_run
24245 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24246 /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
24247 /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
24248 /// ```
24249 pub fn set_facet_value<
24250 T: std::convert::Into<
24251 std::option::Option<
24252 crate::model::search_response::facet::facet_value::FacetValue,
24253 >,
24254 >,
24255 >(
24256 mut self,
24257 v: T,
24258 ) -> Self {
24259 self.facet_value = v.into();
24260 self
24261 }
24262
24263 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24264 /// if it holds a `Value`, `None` if the field is not set or
24265 /// holds a different branch.
24266 pub fn value(&self) -> std::option::Option<&std::string::String> {
24267 #[allow(unreachable_patterns)]
24268 self.facet_value.as_ref().and_then(|v| match v {
24269 crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
24270 std::option::Option::Some(v)
24271 }
24272 _ => std::option::Option::None,
24273 })
24274 }
24275
24276 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24277 /// to hold a `Value`.
24278 ///
24279 /// Note that all the setters affecting `facet_value` are
24280 /// mutually exclusive.
24281 ///
24282 /// # Example
24283 /// ```ignore,no_run
24284 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24285 /// let x = FacetValue::new().set_value("example");
24286 /// assert!(x.value().is_some());
24287 /// assert!(x.interval().is_none());
24288 /// ```
24289 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24290 self.facet_value = std::option::Option::Some(
24291 crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
24292 );
24293 self
24294 }
24295
24296 /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24297 /// if it holds a `Interval`, `None` if the field is not set or
24298 /// holds a different branch.
24299 pub fn interval(
24300 &self,
24301 ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
24302 #[allow(unreachable_patterns)]
24303 self.facet_value.as_ref().and_then(|v| match v {
24304 crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
24305 std::option::Option::Some(v)
24306 }
24307 _ => std::option::Option::None,
24308 })
24309 }
24310
24311 /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24312 /// to hold a `Interval`.
24313 ///
24314 /// Note that all the setters affecting `facet_value` are
24315 /// mutually exclusive.
24316 ///
24317 /// # Example
24318 /// ```ignore,no_run
24319 /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24320 /// use google_cloud_retail_v2::model::Interval;
24321 /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24322 /// assert!(x.interval().is_some());
24323 /// assert!(x.value().is_none());
24324 /// ```
24325 pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24326 mut self,
24327 v: T,
24328 ) -> Self {
24329 self.facet_value = std::option::Option::Some(
24330 crate::model::search_response::facet::facet_value::FacetValue::Interval(
24331 v.into(),
24332 ),
24333 );
24334 self
24335 }
24336 }
24337
24338 impl wkt::message::Message for FacetValue {
24339 fn typename() -> &'static str {
24340 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24341 }
24342 }
24343
24344 /// Defines additional types related to [FacetValue].
24345 pub mod facet_value {
24346 #[allow(unused_imports)]
24347 use super::*;
24348
24349 /// A facet value which contains values.
24350 #[derive(Clone, Debug, PartialEq)]
24351 #[non_exhaustive]
24352 pub enum FacetValue {
24353 /// Text value of a facet, such as "Black" for facet "colorFamilies".
24354 Value(std::string::String),
24355 /// Interval value for a facet, such as [10, 20) for facet "price".
24356 Interval(std::boxed::Box<crate::model::Interval>),
24357 }
24358 }
24359 }
24360
24361 /// Information describing query expansion including whether expansion has
24362 /// occurred.
24363 #[derive(Clone, Default, PartialEq)]
24364 #[non_exhaustive]
24365 pub struct QueryExpansionInfo {
24366 /// Bool describing whether query expansion has occurred.
24367 pub expanded_query: bool,
24368
24369 /// Number of pinned results. This field will only be set when expansion
24370 /// happens and
24371 /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24372 /// is set to true.
24373 ///
24374 /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24375 pub pinned_result_count: i64,
24376
24377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24378 }
24379
24380 impl QueryExpansionInfo {
24381 /// Creates a new default instance.
24382 pub fn new() -> Self {
24383 std::default::Default::default()
24384 }
24385
24386 /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24387 ///
24388 /// # Example
24389 /// ```ignore,no_run
24390 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24391 /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24392 /// ```
24393 pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24394 self.expanded_query = v.into();
24395 self
24396 }
24397
24398 /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24399 ///
24400 /// # Example
24401 /// ```ignore,no_run
24402 /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24403 /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24404 /// ```
24405 pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24406 self.pinned_result_count = v.into();
24407 self
24408 }
24409 }
24410
24411 impl wkt::message::Message for QueryExpansionInfo {
24412 fn typename() -> &'static str {
24413 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24414 }
24415 }
24416
24417 /// This field specifies all related information that is needed on client
24418 /// side for UI rendering of conversational retail search.
24419 #[derive(Clone, Default, PartialEq)]
24420 #[non_exhaustive]
24421 pub struct ConversationalSearchResult {
24422 /// Conversation UUID. This field will be stored in client side storage to
24423 /// maintain the conversation session with server and will be used for next
24424 /// search request's
24425 /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24426 /// to restore conversation state in server.
24427 ///
24428 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24429 pub conversation_id: std::string::String,
24430
24431 /// The current refined query for the conversational search. This field
24432 /// will be used in customer UI that the query in the search bar should be
24433 /// replaced with the refined query. For example, if
24434 /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24435 /// `dress` and next
24436 /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24437 /// is `red color`, which does not match any product attribute value filters,
24438 /// the refined query will be `dress, red color`.
24439 ///
24440 /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24441 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24442 pub refined_query: std::string::String,
24443
24444 /// This field is deprecated but will be kept for backward compatibility.
24445 /// There is expected to have only one additional filter and the value will
24446 /// be the same to the same as field `additional_filter`.
24447 #[deprecated]
24448 pub additional_filters: std::vec::Vec<
24449 crate::model::search_response::conversational_search_result::AdditionalFilter,
24450 >,
24451
24452 /// The follow-up question. e.g., `What is the color?`
24453 pub followup_question: std::string::String,
24454
24455 /// The answer options provided to client for the follow-up question.
24456 pub suggested_answers: std::vec::Vec<
24457 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24458 >,
24459
24460 /// This is the incremental additional filters implied from the current
24461 /// user answer. User should add the suggested addition filters to the
24462 /// previous
24463 /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], and
24464 /// use the merged filter in the follow up search request.
24465 ///
24466 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24467 pub additional_filter: std::option::Option<
24468 crate::model::search_response::conversational_search_result::AdditionalFilter,
24469 >,
24470
24471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24472 }
24473
24474 impl ConversationalSearchResult {
24475 /// Creates a new default instance.
24476 pub fn new() -> Self {
24477 std::default::Default::default()
24478 }
24479
24480 /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24481 ///
24482 /// # Example
24483 /// ```ignore,no_run
24484 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24485 /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24486 /// ```
24487 pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24488 mut self,
24489 v: T,
24490 ) -> Self {
24491 self.conversation_id = v.into();
24492 self
24493 }
24494
24495 /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24496 ///
24497 /// # Example
24498 /// ```ignore,no_run
24499 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24500 /// let x = ConversationalSearchResult::new().set_refined_query("example");
24501 /// ```
24502 pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24503 mut self,
24504 v: T,
24505 ) -> Self {
24506 self.refined_query = v.into();
24507 self
24508 }
24509
24510 /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24511 ///
24512 /// # Example
24513 /// ```ignore,no_run
24514 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24515 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24516 /// let x = ConversationalSearchResult::new()
24517 /// .set_additional_filters([
24518 /// AdditionalFilter::default()/* use setters */,
24519 /// AdditionalFilter::default()/* use (different) setters */,
24520 /// ]);
24521 /// ```
24522 #[deprecated]
24523 pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24524 where
24525 T: std::iter::IntoIterator<Item = V>,
24526 V: std::convert::Into<
24527 crate::model::search_response::conversational_search_result::AdditionalFilter,
24528 >,
24529 {
24530 use std::iter::Iterator;
24531 self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24532 self
24533 }
24534
24535 /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24536 ///
24537 /// # Example
24538 /// ```ignore,no_run
24539 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24540 /// let x = ConversationalSearchResult::new().set_followup_question("example");
24541 /// ```
24542 pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24543 mut self,
24544 v: T,
24545 ) -> Self {
24546 self.followup_question = v.into();
24547 self
24548 }
24549
24550 /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24551 ///
24552 /// # Example
24553 /// ```ignore,no_run
24554 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24555 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24556 /// let x = ConversationalSearchResult::new()
24557 /// .set_suggested_answers([
24558 /// SuggestedAnswer::default()/* use setters */,
24559 /// SuggestedAnswer::default()/* use (different) setters */,
24560 /// ]);
24561 /// ```
24562 pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24563 where
24564 T: std::iter::IntoIterator<Item = V>,
24565 V: std::convert::Into<
24566 crate::model::search_response::conversational_search_result::SuggestedAnswer,
24567 >,
24568 {
24569 use std::iter::Iterator;
24570 self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24571 self
24572 }
24573
24574 /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24575 ///
24576 /// # Example
24577 /// ```ignore,no_run
24578 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24579 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24580 /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24581 /// ```
24582 pub fn set_additional_filter<T>(mut self, v: T) -> Self
24583 where
24584 T: std::convert::Into<
24585 crate::model::search_response::conversational_search_result::AdditionalFilter,
24586 >,
24587 {
24588 self.additional_filter = std::option::Option::Some(v.into());
24589 self
24590 }
24591
24592 /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24593 ///
24594 /// # Example
24595 /// ```ignore,no_run
24596 /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24597 /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24598 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24599 /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24600 /// ```
24601 pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24602 where
24603 T: std::convert::Into<
24604 crate::model::search_response::conversational_search_result::AdditionalFilter,
24605 >,
24606 {
24607 self.additional_filter = v.map(|x| x.into());
24608 self
24609 }
24610 }
24611
24612 impl wkt::message::Message for ConversationalSearchResult {
24613 fn typename() -> &'static str {
24614 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24615 }
24616 }
24617
24618 /// Defines additional types related to [ConversationalSearchResult].
24619 pub mod conversational_search_result {
24620 #[allow(unused_imports)]
24621 use super::*;
24622
24623 /// Suggested answers to the follow-up question.
24624 #[derive(Clone, Default, PartialEq)]
24625 #[non_exhaustive]
24626 pub struct SuggestedAnswer {
24627 /// Product attribute value, including an attribute key and an
24628 /// attribute value. Other types can be added here in the future.
24629 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24630
24631 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24632 }
24633
24634 impl SuggestedAnswer {
24635 /// Creates a new default instance.
24636 pub fn new() -> Self {
24637 std::default::Default::default()
24638 }
24639
24640 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24641 ///
24642 /// # Example
24643 /// ```ignore,no_run
24644 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24645 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24646 /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24647 /// ```
24648 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24649 where
24650 T: std::convert::Into<crate::model::ProductAttributeValue>,
24651 {
24652 self.product_attribute_value = std::option::Option::Some(v.into());
24653 self
24654 }
24655
24656 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24657 ///
24658 /// # Example
24659 /// ```ignore,no_run
24660 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24661 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24662 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24663 /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24664 /// ```
24665 pub fn set_or_clear_product_attribute_value<T>(
24666 mut self,
24667 v: std::option::Option<T>,
24668 ) -> Self
24669 where
24670 T: std::convert::Into<crate::model::ProductAttributeValue>,
24671 {
24672 self.product_attribute_value = v.map(|x| x.into());
24673 self
24674 }
24675 }
24676
24677 impl wkt::message::Message for SuggestedAnswer {
24678 fn typename() -> &'static str {
24679 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24680 }
24681 }
24682
24683 /// Additional filter that client side need to apply.
24684 #[derive(Clone, Default, PartialEq)]
24685 #[non_exhaustive]
24686 pub struct AdditionalFilter {
24687 /// Product attribute value, including an attribute key and an
24688 /// attribute value. Other types can be added here in the future.
24689 pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24690
24691 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24692 }
24693
24694 impl AdditionalFilter {
24695 /// Creates a new default instance.
24696 pub fn new() -> Self {
24697 std::default::Default::default()
24698 }
24699
24700 /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24701 ///
24702 /// # Example
24703 /// ```ignore,no_run
24704 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24705 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24706 /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24707 /// ```
24708 pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24709 where
24710 T: std::convert::Into<crate::model::ProductAttributeValue>,
24711 {
24712 self.product_attribute_value = std::option::Option::Some(v.into());
24713 self
24714 }
24715
24716 /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24717 ///
24718 /// # Example
24719 /// ```ignore,no_run
24720 /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24721 /// use google_cloud_retail_v2::model::ProductAttributeValue;
24722 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24723 /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24724 /// ```
24725 pub fn set_or_clear_product_attribute_value<T>(
24726 mut self,
24727 v: std::option::Option<T>,
24728 ) -> Self
24729 where
24730 T: std::convert::Into<crate::model::ProductAttributeValue>,
24731 {
24732 self.product_attribute_value = v.map(|x| x.into());
24733 self
24734 }
24735 }
24736
24737 impl wkt::message::Message for AdditionalFilter {
24738 fn typename() -> &'static str {
24739 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24740 }
24741 }
24742 }
24743
24744 /// This field specifies all related information for tile navigation that will
24745 /// be used in client side.
24746 #[derive(Clone, Default, PartialEq)]
24747 #[non_exhaustive]
24748 pub struct TileNavigationResult {
24749 /// The current tiles that are used for tile navigation, sorted by
24750 /// engagement.
24751 pub tiles: std::vec::Vec<crate::model::Tile>,
24752
24753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24754 }
24755
24756 impl TileNavigationResult {
24757 /// Creates a new default instance.
24758 pub fn new() -> Self {
24759 std::default::Default::default()
24760 }
24761
24762 /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24763 ///
24764 /// # Example
24765 /// ```ignore,no_run
24766 /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24767 /// use google_cloud_retail_v2::model::Tile;
24768 /// let x = TileNavigationResult::new()
24769 /// .set_tiles([
24770 /// Tile::default()/* use setters */,
24771 /// Tile::default()/* use (different) setters */,
24772 /// ]);
24773 /// ```
24774 pub fn set_tiles<T, V>(mut self, v: T) -> Self
24775 where
24776 T: std::iter::IntoIterator<Item = V>,
24777 V: std::convert::Into<crate::model::Tile>,
24778 {
24779 use std::iter::Iterator;
24780 self.tiles = v.into_iter().map(|i| i.into()).collect();
24781 self
24782 }
24783 }
24784
24785 impl wkt::message::Message for TileNavigationResult {
24786 fn typename() -> &'static str {
24787 "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24788 }
24789 }
24790}
24791
24792/// Metadata for active A/B testing experiment.
24793#[derive(Clone, Default, PartialEq)]
24794#[non_exhaustive]
24795pub struct ExperimentInfo {
24796 /// The fully qualified resource name of the experiment that provides the
24797 /// serving config under test, should an active experiment exist. For example:
24798 /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24799 pub experiment: std::string::String,
24800
24801 /// Information associated with the specific experiment entity being recorded.
24802 pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24803
24804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24805}
24806
24807impl ExperimentInfo {
24808 /// Creates a new default instance.
24809 pub fn new() -> Self {
24810 std::default::Default::default()
24811 }
24812
24813 /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24814 ///
24815 /// # Example
24816 /// ```ignore,no_run
24817 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24818 /// let x = ExperimentInfo::new().set_experiment("example");
24819 /// ```
24820 pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24821 self.experiment = v.into();
24822 self
24823 }
24824
24825 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24826 ///
24827 /// Note that all the setters affecting `experiment_metadata` are mutually
24828 /// exclusive.
24829 ///
24830 /// # Example
24831 /// ```ignore,no_run
24832 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24833 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24834 /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24835 /// google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24836 /// ```
24837 pub fn set_experiment_metadata<
24838 T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24839 >(
24840 mut self,
24841 v: T,
24842 ) -> Self {
24843 self.experiment_metadata = v.into();
24844 self
24845 }
24846
24847 /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24848 /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24849 /// holds a different branch.
24850 pub fn serving_config_experiment(
24851 &self,
24852 ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24853 {
24854 #[allow(unreachable_patterns)]
24855 self.experiment_metadata.as_ref().and_then(|v| match v {
24856 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24857 std::option::Option::Some(v)
24858 }
24859 _ => std::option::Option::None,
24860 })
24861 }
24862
24863 /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24864 /// to hold a `ServingConfigExperiment`.
24865 ///
24866 /// Note that all the setters affecting `experiment_metadata` are
24867 /// mutually exclusive.
24868 ///
24869 /// # Example
24870 /// ```ignore,no_run
24871 /// # use google_cloud_retail_v2::model::ExperimentInfo;
24872 /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24873 /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24874 /// assert!(x.serving_config_experiment().is_some());
24875 /// ```
24876 pub fn set_serving_config_experiment<
24877 T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24878 >(
24879 mut self,
24880 v: T,
24881 ) -> Self {
24882 self.experiment_metadata = std::option::Option::Some(
24883 crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24884 );
24885 self
24886 }
24887}
24888
24889impl wkt::message::Message for ExperimentInfo {
24890 fn typename() -> &'static str {
24891 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24892 }
24893}
24894
24895/// Defines additional types related to [ExperimentInfo].
24896pub mod experiment_info {
24897 #[allow(unused_imports)]
24898 use super::*;
24899
24900 /// Metadata for active serving config A/B tests.
24901 #[derive(Clone, Default, PartialEq)]
24902 #[non_exhaustive]
24903 pub struct ServingConfigExperiment {
24904 /// The fully qualified resource name of the original
24905 /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24906 /// in the search request prior to reassignment by experiment API. For
24907 /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24908 ///
24909 /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24910 pub original_serving_config: std::string::String,
24911
24912 /// The fully qualified resource name of the serving config
24913 /// `Experiment.VariantArm.serving_config_id` responsible for generating
24914 /// the search response. For example:
24915 /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24916 pub experiment_serving_config: std::string::String,
24917
24918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24919 }
24920
24921 impl ServingConfigExperiment {
24922 /// Creates a new default instance.
24923 pub fn new() -> Self {
24924 std::default::Default::default()
24925 }
24926
24927 /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24928 ///
24929 /// # Example
24930 /// ```ignore,no_run
24931 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24932 /// # let project_id = "project_id";
24933 /// # let location_id = "location_id";
24934 /// # let catalog_id = "catalog_id";
24935 /// # let serving_config_id = "serving_config_id";
24936 /// let x = ServingConfigExperiment::new().set_original_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
24937 /// ```
24938 pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24939 mut self,
24940 v: T,
24941 ) -> Self {
24942 self.original_serving_config = v.into();
24943 self
24944 }
24945
24946 /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24947 ///
24948 /// # Example
24949 /// ```ignore,no_run
24950 /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24951 /// # let project_id = "project_id";
24952 /// # let location_id = "location_id";
24953 /// # let catalog_id = "catalog_id";
24954 /// # let serving_config_id = "serving_config_id";
24955 /// let x = ServingConfigExperiment::new().set_experiment_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
24956 /// ```
24957 pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24958 mut self,
24959 v: T,
24960 ) -> Self {
24961 self.experiment_serving_config = v.into();
24962 self
24963 }
24964 }
24965
24966 impl wkt::message::Message for ServingConfigExperiment {
24967 fn typename() -> &'static str {
24968 "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24969 }
24970 }
24971
24972 /// Information associated with the specific experiment entity being recorded.
24973 #[derive(Clone, Debug, PartialEq)]
24974 #[non_exhaustive]
24975 pub enum ExperimentMetadata {
24976 /// A/B test between existing Cloud Retail Search
24977 /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24978 ///
24979 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24980 ServingConfigExperiment(
24981 std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24982 ),
24983 }
24984}
24985
24986/// Configures metadata that is used to generate serving time results (e.g.
24987/// search results or recommendation predictions).
24988#[derive(Clone, Default, PartialEq)]
24989#[non_exhaustive]
24990pub struct ServingConfig {
24991 /// Immutable. Fully qualified name
24992 /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24993 pub name: std::string::String,
24994
24995 /// Required. The human readable serving config display name. Used in Retail
24996 /// UI.
24997 ///
24998 /// This field must be a UTF-8 encoded string with a length limit of 128
24999 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
25000 pub display_name: std::string::String,
25001
25002 /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
25003 /// to use at serving time. Currently only RecommendationModels are supported:
25004 /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
25005 /// Can be changed but only to a compatible model (e.g.
25006 /// others-you-may-like CTR to others-you-may-like CVR).
25007 ///
25008 /// Required when
25009 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25010 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25011 ///
25012 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
25013 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25014 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25015 pub model_id: std::string::String,
25016
25017 /// How much price ranking we want in serving results.
25018 /// Price reranking causes product items with a similar
25019 /// recommendation probability to be ordered by price, with the
25020 /// highest-priced items first. This setting could result in a decrease in
25021 /// click-through and conversion rates.
25022 /// Allowed values are:
25023 ///
25024 /// * `no-price-reranking`
25025 /// * `low-price-reranking`
25026 /// * `medium-price-reranking`
25027 /// * `high-price-reranking`
25028 ///
25029 /// If not specified, we choose default based on model type. Default value:
25030 /// `no-price-reranking`.
25031 ///
25032 /// Can only be set if
25033 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25034 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25035 ///
25036 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25037 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25038 pub price_reranking_level: std::string::String,
25039
25040 /// Facet specifications for faceted search. If empty, no facets are returned.
25041 /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
25042 /// resources with only the Facet control set. These controls are assumed to be
25043 /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
25044 /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
25045 /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
25046 /// is returned.
25047 ///
25048 /// Can only be set if
25049 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25050 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25051 ///
25052 /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
25053 /// [google.cloud.retail.v2.Control]: crate::model::Control
25054 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25055 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25056 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25057 pub facet_control_ids: std::vec::Vec<std::string::String>,
25058
25059 /// The specification for dynamically generated facets. Notice that only
25060 /// textual facets can be dynamically generated.
25061 ///
25062 /// Can only be set if
25063 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25064 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25065 ///
25066 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25067 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25068 pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
25069
25070 /// Condition boost specifications. If a product matches multiple conditions
25071 /// in the specifications, boost scores from these specifications are all
25072 /// applied and combined in a non-linear way. Maximum number of
25073 /// specifications is 100.
25074 ///
25075 /// Notice that if both
25076 /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
25077 /// and
25078 /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
25079 /// are set, the boost conditions from both places are evaluated. If a search
25080 /// request matches multiple boost conditions, the final boost score is equal
25081 /// to the sum of the boost scores from all matched boost conditions.
25082 ///
25083 /// Can only be set if
25084 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25085 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25086 ///
25087 /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
25088 /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
25089 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25090 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25091 pub boost_control_ids: std::vec::Vec<std::string::String>,
25092
25093 /// Condition filter specifications. If a product matches multiple conditions
25094 /// in the specifications, filters from these specifications are all
25095 /// applied and combined via the AND operator. Maximum number of
25096 /// specifications is 100.
25097 ///
25098 /// Can only be set if
25099 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25100 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25101 ///
25102 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25103 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25104 pub filter_control_ids: std::vec::Vec<std::string::String>,
25105
25106 /// Condition redirect specifications. Only the first triggered redirect action
25107 /// is applied, even if multiple apply. Maximum number of specifications is
25108 /// 1000.
25109 ///
25110 /// Can only be set if
25111 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25112 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25113 ///
25114 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25115 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25116 pub redirect_control_ids: std::vec::Vec<std::string::String>,
25117
25118 /// Condition synonyms specifications. If multiple syonyms conditions match,
25119 /// all matching synonyms control in the list will execute. Order of controls
25120 /// in the list will not matter. Maximum number of specifications is
25121 /// 100.
25122 ///
25123 /// Can only be set if
25124 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25125 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25126 ///
25127 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25128 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25129 pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
25130
25131 /// Condition oneway synonyms specifications. If multiple oneway synonyms
25132 /// conditions match, all matching oneway synonyms controls in the list will
25133 /// execute. Order of controls in the list will not matter. Maximum number of
25134 /// specifications is 100.
25135 ///
25136 /// Can only be set if
25137 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25138 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25139 ///
25140 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25141 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25142 pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
25143
25144 /// Condition do not associate specifications. If multiple do not associate
25145 /// conditions match, all matching do not associate controls in the list will
25146 /// execute.
25147 ///
25148 /// - Order does not matter.
25149 /// - Maximum number of specifications is 100.
25150 ///
25151 /// Can only be set if
25152 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25153 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25154 ///
25155 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25156 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25157 pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
25158
25159 /// Condition replacement specifications.
25160 ///
25161 /// - Applied according to the order in the list.
25162 /// - A previously replaced term can not be re-replaced.
25163 /// - Maximum number of specifications is 100.
25164 ///
25165 /// Can only be set if
25166 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25167 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25168 ///
25169 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25170 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25171 pub replacement_control_ids: std::vec::Vec<std::string::String>,
25172
25173 /// Condition ignore specifications. If multiple ignore
25174 /// conditions match, all matching ignore controls in the list will
25175 /// execute.
25176 ///
25177 /// - Order does not matter.
25178 /// - Maximum number of specifications is 100.
25179 ///
25180 /// Can only be set if
25181 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25182 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25183 ///
25184 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25185 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25186 pub ignore_control_ids: std::vec::Vec<std::string::String>,
25187
25188 /// How much diversity to use in recommendation model results e.g.
25189 /// `medium-diversity` or `high-diversity`. Currently supported values:
25190 ///
25191 /// * `no-diversity`
25192 /// * `low-diversity`
25193 /// * `medium-diversity`
25194 /// * `high-diversity`
25195 /// * `auto-diversity`
25196 ///
25197 /// If not specified, we choose default based on recommendation model
25198 /// type. Default value: `no-diversity`.
25199 ///
25200 /// Can only be set if
25201 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25202 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25203 ///
25204 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25205 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25206 pub diversity_level: std::string::String,
25207
25208 /// What kind of diversity to use - data driven or rule based. If unset, the
25209 /// server behavior defaults to
25210 /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
25211 ///
25212 /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
25213 pub diversity_type: crate::model::serving_config::DiversityType,
25214
25215 /// Whether to add additional category filters on the `similar-items` model.
25216 /// If not specified, we enable it by default.
25217 /// Allowed values are:
25218 ///
25219 /// * `no-category-match`: No additional filtering of original results from
25220 /// the model and the customer's filters.
25221 /// * `relaxed-category-match`: Only keep results with categories that match
25222 /// at least one item categories in the PredictRequests's context item.
25223 /// * If customer also sends filters in the PredictRequest, then the results
25224 /// will satisfy both conditions (user given and category match).
25225 ///
25226 /// Can only be set if
25227 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25228 /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25229 ///
25230 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25231 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25232 pub enable_category_filter_level: std::string::String,
25233
25234 /// When the flag is enabled, the products in the denylist will not be filtered
25235 /// out in the recommendation filtering results.
25236 pub ignore_recs_denylist: bool,
25237
25238 /// The specification for personalization spec.
25239 ///
25240 /// Can only be set if
25241 /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25242 /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25243 ///
25244 /// Notice that if both
25245 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
25246 /// and
25247 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25248 /// are set.
25249 /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25250 /// will override
25251 /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
25252 ///
25253 /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
25254 /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
25255 /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25256 /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25257 pub personalization_spec:
25258 std::option::Option<crate::model::search_request::PersonalizationSpec>,
25259
25260 /// Required. Immutable. Specifies the solution types that a serving config can
25261 /// be associated with. Currently we support setting only one type of solution.
25262 pub solution_types: std::vec::Vec<crate::model::SolutionType>,
25263
25264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25265}
25266
25267impl ServingConfig {
25268 /// Creates a new default instance.
25269 pub fn new() -> Self {
25270 std::default::Default::default()
25271 }
25272
25273 /// Sets the value of [name][crate::model::ServingConfig::name].
25274 ///
25275 /// # Example
25276 /// ```ignore,no_run
25277 /// # use google_cloud_retail_v2::model::ServingConfig;
25278 /// # let project_id = "project_id";
25279 /// # let location_id = "location_id";
25280 /// # let catalog_id = "catalog_id";
25281 /// # let serving_config_id = "serving_config_id";
25282 /// let x = ServingConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
25283 /// ```
25284 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25285 self.name = v.into();
25286 self
25287 }
25288
25289 /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
25290 ///
25291 /// # Example
25292 /// ```ignore,no_run
25293 /// # use google_cloud_retail_v2::model::ServingConfig;
25294 /// let x = ServingConfig::new().set_display_name("example");
25295 /// ```
25296 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25297 self.display_name = v.into();
25298 self
25299 }
25300
25301 /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
25302 ///
25303 /// # Example
25304 /// ```ignore,no_run
25305 /// # use google_cloud_retail_v2::model::ServingConfig;
25306 /// let x = ServingConfig::new().set_model_id("example");
25307 /// ```
25308 pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25309 self.model_id = v.into();
25310 self
25311 }
25312
25313 /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
25314 ///
25315 /// # Example
25316 /// ```ignore,no_run
25317 /// # use google_cloud_retail_v2::model::ServingConfig;
25318 /// let x = ServingConfig::new().set_price_reranking_level("example");
25319 /// ```
25320 pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
25321 mut self,
25322 v: T,
25323 ) -> Self {
25324 self.price_reranking_level = v.into();
25325 self
25326 }
25327
25328 /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
25329 ///
25330 /// # Example
25331 /// ```ignore,no_run
25332 /// # use google_cloud_retail_v2::model::ServingConfig;
25333 /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
25334 /// ```
25335 pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25336 where
25337 T: std::iter::IntoIterator<Item = V>,
25338 V: std::convert::Into<std::string::String>,
25339 {
25340 use std::iter::Iterator;
25341 self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25342 self
25343 }
25344
25345 /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25346 ///
25347 /// # Example
25348 /// ```ignore,no_run
25349 /// # use google_cloud_retail_v2::model::ServingConfig;
25350 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25351 /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25352 /// ```
25353 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25354 where
25355 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25356 {
25357 self.dynamic_facet_spec = std::option::Option::Some(v.into());
25358 self
25359 }
25360
25361 /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25362 ///
25363 /// # Example
25364 /// ```ignore,no_run
25365 /// # use google_cloud_retail_v2::model::ServingConfig;
25366 /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25367 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25368 /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25369 /// ```
25370 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25371 where
25372 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25373 {
25374 self.dynamic_facet_spec = v.map(|x| x.into());
25375 self
25376 }
25377
25378 /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25379 ///
25380 /// # Example
25381 /// ```ignore,no_run
25382 /// # use google_cloud_retail_v2::model::ServingConfig;
25383 /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25384 /// ```
25385 pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25386 where
25387 T: std::iter::IntoIterator<Item = V>,
25388 V: std::convert::Into<std::string::String>,
25389 {
25390 use std::iter::Iterator;
25391 self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25392 self
25393 }
25394
25395 /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25396 ///
25397 /// # Example
25398 /// ```ignore,no_run
25399 /// # use google_cloud_retail_v2::model::ServingConfig;
25400 /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25401 /// ```
25402 pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25403 where
25404 T: std::iter::IntoIterator<Item = V>,
25405 V: std::convert::Into<std::string::String>,
25406 {
25407 use std::iter::Iterator;
25408 self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25409 self
25410 }
25411
25412 /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25413 ///
25414 /// # Example
25415 /// ```ignore,no_run
25416 /// # use google_cloud_retail_v2::model::ServingConfig;
25417 /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25418 /// ```
25419 pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25420 where
25421 T: std::iter::IntoIterator<Item = V>,
25422 V: std::convert::Into<std::string::String>,
25423 {
25424 use std::iter::Iterator;
25425 self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25426 self
25427 }
25428
25429 /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25430 ///
25431 /// # Example
25432 /// ```ignore,no_run
25433 /// # use google_cloud_retail_v2::model::ServingConfig;
25434 /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25435 /// ```
25436 pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25437 where
25438 T: std::iter::IntoIterator<Item = V>,
25439 V: std::convert::Into<std::string::String>,
25440 {
25441 use std::iter::Iterator;
25442 self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25443 self
25444 }
25445
25446 /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25447 ///
25448 /// # Example
25449 /// ```ignore,no_run
25450 /// # use google_cloud_retail_v2::model::ServingConfig;
25451 /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25452 /// ```
25453 pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25454 where
25455 T: std::iter::IntoIterator<Item = V>,
25456 V: std::convert::Into<std::string::String>,
25457 {
25458 use std::iter::Iterator;
25459 self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25460 self
25461 }
25462
25463 /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25464 ///
25465 /// # Example
25466 /// ```ignore,no_run
25467 /// # use google_cloud_retail_v2::model::ServingConfig;
25468 /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25469 /// ```
25470 pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25471 where
25472 T: std::iter::IntoIterator<Item = V>,
25473 V: std::convert::Into<std::string::String>,
25474 {
25475 use std::iter::Iterator;
25476 self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25477 self
25478 }
25479
25480 /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25481 ///
25482 /// # Example
25483 /// ```ignore,no_run
25484 /// # use google_cloud_retail_v2::model::ServingConfig;
25485 /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25486 /// ```
25487 pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25488 where
25489 T: std::iter::IntoIterator<Item = V>,
25490 V: std::convert::Into<std::string::String>,
25491 {
25492 use std::iter::Iterator;
25493 self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25494 self
25495 }
25496
25497 /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25498 ///
25499 /// # Example
25500 /// ```ignore,no_run
25501 /// # use google_cloud_retail_v2::model::ServingConfig;
25502 /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25503 /// ```
25504 pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25505 where
25506 T: std::iter::IntoIterator<Item = V>,
25507 V: std::convert::Into<std::string::String>,
25508 {
25509 use std::iter::Iterator;
25510 self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25511 self
25512 }
25513
25514 /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25515 ///
25516 /// # Example
25517 /// ```ignore,no_run
25518 /// # use google_cloud_retail_v2::model::ServingConfig;
25519 /// let x = ServingConfig::new().set_diversity_level("example");
25520 /// ```
25521 pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25522 self.diversity_level = v.into();
25523 self
25524 }
25525
25526 /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25527 ///
25528 /// # Example
25529 /// ```ignore,no_run
25530 /// # use google_cloud_retail_v2::model::ServingConfig;
25531 /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25532 /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25533 /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25534 /// ```
25535 pub fn set_diversity_type<
25536 T: std::convert::Into<crate::model::serving_config::DiversityType>,
25537 >(
25538 mut self,
25539 v: T,
25540 ) -> Self {
25541 self.diversity_type = v.into();
25542 self
25543 }
25544
25545 /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25546 ///
25547 /// # Example
25548 /// ```ignore,no_run
25549 /// # use google_cloud_retail_v2::model::ServingConfig;
25550 /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25551 /// ```
25552 pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25553 mut self,
25554 v: T,
25555 ) -> Self {
25556 self.enable_category_filter_level = v.into();
25557 self
25558 }
25559
25560 /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25561 ///
25562 /// # Example
25563 /// ```ignore,no_run
25564 /// # use google_cloud_retail_v2::model::ServingConfig;
25565 /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25566 /// ```
25567 pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25568 self.ignore_recs_denylist = v.into();
25569 self
25570 }
25571
25572 /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25573 ///
25574 /// # Example
25575 /// ```ignore,no_run
25576 /// # use google_cloud_retail_v2::model::ServingConfig;
25577 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25578 /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25579 /// ```
25580 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25581 where
25582 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25583 {
25584 self.personalization_spec = std::option::Option::Some(v.into());
25585 self
25586 }
25587
25588 /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25589 ///
25590 /// # Example
25591 /// ```ignore,no_run
25592 /// # use google_cloud_retail_v2::model::ServingConfig;
25593 /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25594 /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25595 /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25596 /// ```
25597 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25598 where
25599 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25600 {
25601 self.personalization_spec = v.map(|x| x.into());
25602 self
25603 }
25604
25605 /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25606 ///
25607 /// # Example
25608 /// ```ignore,no_run
25609 /// # use google_cloud_retail_v2::model::ServingConfig;
25610 /// use google_cloud_retail_v2::model::SolutionType;
25611 /// let x = ServingConfig::new().set_solution_types([
25612 /// SolutionType::Recommendation,
25613 /// SolutionType::Search,
25614 /// ]);
25615 /// ```
25616 pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25617 where
25618 T: std::iter::IntoIterator<Item = V>,
25619 V: std::convert::Into<crate::model::SolutionType>,
25620 {
25621 use std::iter::Iterator;
25622 self.solution_types = v.into_iter().map(|i| i.into()).collect();
25623 self
25624 }
25625}
25626
25627impl wkt::message::Message for ServingConfig {
25628 fn typename() -> &'static str {
25629 "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25630 }
25631}
25632
25633/// Defines additional types related to [ServingConfig].
25634pub mod serving_config {
25635 #[allow(unused_imports)]
25636 use super::*;
25637
25638 /// What type of diversity - data or rule based.
25639 ///
25640 /// # Working with unknown values
25641 ///
25642 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25643 /// additional enum variants at any time. Adding new variants is not considered
25644 /// a breaking change. Applications should write their code in anticipation of:
25645 ///
25646 /// - New values appearing in future releases of the client library, **and**
25647 /// - New values received dynamically, without application changes.
25648 ///
25649 /// Please consult the [Working with enums] section in the user guide for some
25650 /// guidelines.
25651 ///
25652 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25653 #[derive(Clone, Debug, PartialEq)]
25654 #[non_exhaustive]
25655 pub enum DiversityType {
25656 /// Default value.
25657 Unspecified,
25658 /// Rule based diversity.
25659 RuleBasedDiversity,
25660 /// Data driven diversity.
25661 DataDrivenDiversity,
25662 /// If set, the enum was initialized with an unknown value.
25663 ///
25664 /// Applications can examine the value using [DiversityType::value] or
25665 /// [DiversityType::name].
25666 UnknownValue(diversity_type::UnknownValue),
25667 }
25668
25669 #[doc(hidden)]
25670 pub mod diversity_type {
25671 #[allow(unused_imports)]
25672 use super::*;
25673 #[derive(Clone, Debug, PartialEq)]
25674 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25675 }
25676
25677 impl DiversityType {
25678 /// Gets the enum value.
25679 ///
25680 /// Returns `None` if the enum contains an unknown value deserialized from
25681 /// the string representation of enums.
25682 pub fn value(&self) -> std::option::Option<i32> {
25683 match self {
25684 Self::Unspecified => std::option::Option::Some(0),
25685 Self::RuleBasedDiversity => std::option::Option::Some(2),
25686 Self::DataDrivenDiversity => std::option::Option::Some(3),
25687 Self::UnknownValue(u) => u.0.value(),
25688 }
25689 }
25690
25691 /// Gets the enum value as a string.
25692 ///
25693 /// Returns `None` if the enum contains an unknown value deserialized from
25694 /// the integer representation of enums.
25695 pub fn name(&self) -> std::option::Option<&str> {
25696 match self {
25697 Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25698 Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25699 Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25700 Self::UnknownValue(u) => u.0.name(),
25701 }
25702 }
25703 }
25704
25705 impl std::default::Default for DiversityType {
25706 fn default() -> Self {
25707 use std::convert::From;
25708 Self::from(0)
25709 }
25710 }
25711
25712 impl std::fmt::Display for DiversityType {
25713 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25714 wkt::internal::display_enum(f, self.name(), self.value())
25715 }
25716 }
25717
25718 impl std::convert::From<i32> for DiversityType {
25719 fn from(value: i32) -> Self {
25720 match value {
25721 0 => Self::Unspecified,
25722 2 => Self::RuleBasedDiversity,
25723 3 => Self::DataDrivenDiversity,
25724 _ => Self::UnknownValue(diversity_type::UnknownValue(
25725 wkt::internal::UnknownEnumValue::Integer(value),
25726 )),
25727 }
25728 }
25729 }
25730
25731 impl std::convert::From<&str> for DiversityType {
25732 fn from(value: &str) -> Self {
25733 use std::string::ToString;
25734 match value {
25735 "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25736 "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25737 "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25738 _ => Self::UnknownValue(diversity_type::UnknownValue(
25739 wkt::internal::UnknownEnumValue::String(value.to_string()),
25740 )),
25741 }
25742 }
25743 }
25744
25745 impl serde::ser::Serialize for DiversityType {
25746 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25747 where
25748 S: serde::Serializer,
25749 {
25750 match self {
25751 Self::Unspecified => serializer.serialize_i32(0),
25752 Self::RuleBasedDiversity => serializer.serialize_i32(2),
25753 Self::DataDrivenDiversity => serializer.serialize_i32(3),
25754 Self::UnknownValue(u) => u.0.serialize(serializer),
25755 }
25756 }
25757 }
25758
25759 impl<'de> serde::de::Deserialize<'de> for DiversityType {
25760 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25761 where
25762 D: serde::Deserializer<'de>,
25763 {
25764 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25765 ".google.cloud.retail.v2.ServingConfig.DiversityType",
25766 ))
25767 }
25768 }
25769}
25770
25771/// Request for CreateServingConfig method.
25772#[derive(Clone, Default, PartialEq)]
25773#[non_exhaustive]
25774pub struct CreateServingConfigRequest {
25775 /// Required. Full resource name of parent. Format:
25776 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25777 pub parent: std::string::String,
25778
25779 /// Required. The ServingConfig to create.
25780 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25781
25782 /// Required. The ID to use for the ServingConfig, which will become the final
25783 /// component of the ServingConfig's resource name.
25784 ///
25785 /// This value should be 4-63 characters, and valid characters
25786 /// are /[a-z][0-9]-_/.
25787 pub serving_config_id: std::string::String,
25788
25789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25790}
25791
25792impl CreateServingConfigRequest {
25793 /// Creates a new default instance.
25794 pub fn new() -> Self {
25795 std::default::Default::default()
25796 }
25797
25798 /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25799 ///
25800 /// # Example
25801 /// ```ignore,no_run
25802 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25803 /// # let project_id = "project_id";
25804 /// # let location_id = "location_id";
25805 /// # let catalog_id = "catalog_id";
25806 /// let x = CreateServingConfigRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
25807 /// ```
25808 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25809 self.parent = v.into();
25810 self
25811 }
25812
25813 /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25814 ///
25815 /// # Example
25816 /// ```ignore,no_run
25817 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25818 /// use google_cloud_retail_v2::model::ServingConfig;
25819 /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25820 /// ```
25821 pub fn set_serving_config<T>(mut self, v: T) -> Self
25822 where
25823 T: std::convert::Into<crate::model::ServingConfig>,
25824 {
25825 self.serving_config = std::option::Option::Some(v.into());
25826 self
25827 }
25828
25829 /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25830 ///
25831 /// # Example
25832 /// ```ignore,no_run
25833 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25834 /// use google_cloud_retail_v2::model::ServingConfig;
25835 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25836 /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25837 /// ```
25838 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25839 where
25840 T: std::convert::Into<crate::model::ServingConfig>,
25841 {
25842 self.serving_config = v.map(|x| x.into());
25843 self
25844 }
25845
25846 /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25847 ///
25848 /// # Example
25849 /// ```ignore,no_run
25850 /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25851 /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25852 /// ```
25853 pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25854 mut self,
25855 v: T,
25856 ) -> Self {
25857 self.serving_config_id = v.into();
25858 self
25859 }
25860}
25861
25862impl wkt::message::Message for CreateServingConfigRequest {
25863 fn typename() -> &'static str {
25864 "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25865 }
25866}
25867
25868/// Request for UpdateServingConfig method.
25869#[derive(Clone, Default, PartialEq)]
25870#[non_exhaustive]
25871pub struct UpdateServingConfigRequest {
25872 /// Required. The ServingConfig to update.
25873 pub serving_config: std::option::Option<crate::model::ServingConfig>,
25874
25875 /// Indicates which fields in the provided
25876 /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25877 /// following are NOT supported:
25878 ///
25879 /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25880 ///
25881 /// If not set, all supported fields are updated.
25882 ///
25883 /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25884 /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25885 pub update_mask: std::option::Option<wkt::FieldMask>,
25886
25887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25888}
25889
25890impl UpdateServingConfigRequest {
25891 /// Creates a new default instance.
25892 pub fn new() -> Self {
25893 std::default::Default::default()
25894 }
25895
25896 /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25897 ///
25898 /// # Example
25899 /// ```ignore,no_run
25900 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25901 /// use google_cloud_retail_v2::model::ServingConfig;
25902 /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25903 /// ```
25904 pub fn set_serving_config<T>(mut self, v: T) -> Self
25905 where
25906 T: std::convert::Into<crate::model::ServingConfig>,
25907 {
25908 self.serving_config = std::option::Option::Some(v.into());
25909 self
25910 }
25911
25912 /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25913 ///
25914 /// # Example
25915 /// ```ignore,no_run
25916 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25917 /// use google_cloud_retail_v2::model::ServingConfig;
25918 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25919 /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25920 /// ```
25921 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25922 where
25923 T: std::convert::Into<crate::model::ServingConfig>,
25924 {
25925 self.serving_config = v.map(|x| x.into());
25926 self
25927 }
25928
25929 /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25930 ///
25931 /// # Example
25932 /// ```ignore,no_run
25933 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25934 /// use wkt::FieldMask;
25935 /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25936 /// ```
25937 pub fn set_update_mask<T>(mut self, v: T) -> Self
25938 where
25939 T: std::convert::Into<wkt::FieldMask>,
25940 {
25941 self.update_mask = std::option::Option::Some(v.into());
25942 self
25943 }
25944
25945 /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25946 ///
25947 /// # Example
25948 /// ```ignore,no_run
25949 /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25950 /// use wkt::FieldMask;
25951 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25952 /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25953 /// ```
25954 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25955 where
25956 T: std::convert::Into<wkt::FieldMask>,
25957 {
25958 self.update_mask = v.map(|x| x.into());
25959 self
25960 }
25961}
25962
25963impl wkt::message::Message for UpdateServingConfigRequest {
25964 fn typename() -> &'static str {
25965 "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25966 }
25967}
25968
25969/// Request for DeleteServingConfig method.
25970#[derive(Clone, Default, PartialEq)]
25971#[non_exhaustive]
25972pub struct DeleteServingConfigRequest {
25973 /// Required. The resource name of the ServingConfig to delete. Format:
25974 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25975 pub name: std::string::String,
25976
25977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25978}
25979
25980impl DeleteServingConfigRequest {
25981 /// Creates a new default instance.
25982 pub fn new() -> Self {
25983 std::default::Default::default()
25984 }
25985
25986 /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25987 ///
25988 /// # Example
25989 /// ```ignore,no_run
25990 /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25991 /// # let project_id = "project_id";
25992 /// # let location_id = "location_id";
25993 /// # let catalog_id = "catalog_id";
25994 /// # let serving_config_id = "serving_config_id";
25995 /// let x = DeleteServingConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
25996 /// ```
25997 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25998 self.name = v.into();
25999 self
26000 }
26001}
26002
26003impl wkt::message::Message for DeleteServingConfigRequest {
26004 fn typename() -> &'static str {
26005 "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
26006 }
26007}
26008
26009/// Request for GetServingConfig method.
26010#[derive(Clone, Default, PartialEq)]
26011#[non_exhaustive]
26012pub struct GetServingConfigRequest {
26013 /// Required. The resource name of the ServingConfig to get. Format:
26014 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26015 pub name: std::string::String,
26016
26017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26018}
26019
26020impl GetServingConfigRequest {
26021 /// Creates a new default instance.
26022 pub fn new() -> Self {
26023 std::default::Default::default()
26024 }
26025
26026 /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
26027 ///
26028 /// # Example
26029 /// ```ignore,no_run
26030 /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
26031 /// # let project_id = "project_id";
26032 /// # let location_id = "location_id";
26033 /// # let catalog_id = "catalog_id";
26034 /// # let serving_config_id = "serving_config_id";
26035 /// let x = GetServingConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26036 /// ```
26037 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26038 self.name = v.into();
26039 self
26040 }
26041}
26042
26043impl wkt::message::Message for GetServingConfigRequest {
26044 fn typename() -> &'static str {
26045 "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
26046 }
26047}
26048
26049/// Request for ListServingConfigs method.
26050#[derive(Clone, Default, PartialEq)]
26051#[non_exhaustive]
26052pub struct ListServingConfigsRequest {
26053 /// Required. The catalog resource name. Format:
26054 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
26055 pub parent: std::string::String,
26056
26057 /// Optional. Maximum number of results to return. If unspecified, defaults
26058 /// to 100. If a value greater than 100 is provided, at most 100 results are
26059 /// returned.
26060 pub page_size: i32,
26061
26062 /// Optional. A page token, received from a previous `ListServingConfigs` call.
26063 /// Provide this to retrieve the subsequent page.
26064 pub page_token: std::string::String,
26065
26066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26067}
26068
26069impl ListServingConfigsRequest {
26070 /// Creates a new default instance.
26071 pub fn new() -> Self {
26072 std::default::Default::default()
26073 }
26074
26075 /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
26076 ///
26077 /// # Example
26078 /// ```ignore,no_run
26079 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26080 /// # let project_id = "project_id";
26081 /// # let location_id = "location_id";
26082 /// # let catalog_id = "catalog_id";
26083 /// let x = ListServingConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
26084 /// ```
26085 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26086 self.parent = v.into();
26087 self
26088 }
26089
26090 /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
26091 ///
26092 /// # Example
26093 /// ```ignore,no_run
26094 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26095 /// let x = ListServingConfigsRequest::new().set_page_size(42);
26096 /// ```
26097 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26098 self.page_size = v.into();
26099 self
26100 }
26101
26102 /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
26103 ///
26104 /// # Example
26105 /// ```ignore,no_run
26106 /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26107 /// let x = ListServingConfigsRequest::new().set_page_token("example");
26108 /// ```
26109 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26110 self.page_token = v.into();
26111 self
26112 }
26113}
26114
26115impl wkt::message::Message for ListServingConfigsRequest {
26116 fn typename() -> &'static str {
26117 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
26118 }
26119}
26120
26121/// Response for ListServingConfigs method.
26122#[derive(Clone, Default, PartialEq)]
26123#[non_exhaustive]
26124pub struct ListServingConfigsResponse {
26125 /// All the ServingConfigs for a given catalog.
26126 pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
26127
26128 /// Pagination token, if not returned indicates the last page.
26129 pub next_page_token: std::string::String,
26130
26131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26132}
26133
26134impl ListServingConfigsResponse {
26135 /// Creates a new default instance.
26136 pub fn new() -> Self {
26137 std::default::Default::default()
26138 }
26139
26140 /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
26141 ///
26142 /// # Example
26143 /// ```ignore,no_run
26144 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
26145 /// use google_cloud_retail_v2::model::ServingConfig;
26146 /// let x = ListServingConfigsResponse::new()
26147 /// .set_serving_configs([
26148 /// ServingConfig::default()/* use setters */,
26149 /// ServingConfig::default()/* use (different) setters */,
26150 /// ]);
26151 /// ```
26152 pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
26153 where
26154 T: std::iter::IntoIterator<Item = V>,
26155 V: std::convert::Into<crate::model::ServingConfig>,
26156 {
26157 use std::iter::Iterator;
26158 self.serving_configs = v.into_iter().map(|i| i.into()).collect();
26159 self
26160 }
26161
26162 /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
26163 ///
26164 /// # Example
26165 /// ```ignore,no_run
26166 /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
26167 /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
26168 /// ```
26169 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26170 self.next_page_token = v.into();
26171 self
26172 }
26173}
26174
26175impl wkt::message::Message for ListServingConfigsResponse {
26176 fn typename() -> &'static str {
26177 "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
26178 }
26179}
26180
26181#[doc(hidden)]
26182impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
26183 type PageItem = crate::model::ServingConfig;
26184
26185 fn items(self) -> std::vec::Vec<Self::PageItem> {
26186 self.serving_configs
26187 }
26188
26189 fn next_page_token(&self) -> std::string::String {
26190 use std::clone::Clone;
26191 self.next_page_token.clone()
26192 }
26193}
26194
26195/// Request for AddControl method.
26196#[derive(Clone, Default, PartialEq)]
26197#[non_exhaustive]
26198pub struct AddControlRequest {
26199 /// Required. The source ServingConfig resource name . Format:
26200 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26201 pub serving_config: std::string::String,
26202
26203 /// Required. The id of the control to apply. Assumed to be in the same catalog
26204 /// as the serving config - if id is not found a NOT_FOUND error is returned.
26205 pub control_id: std::string::String,
26206
26207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26208}
26209
26210impl AddControlRequest {
26211 /// Creates a new default instance.
26212 pub fn new() -> Self {
26213 std::default::Default::default()
26214 }
26215
26216 /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
26217 ///
26218 /// # Example
26219 /// ```ignore,no_run
26220 /// # use google_cloud_retail_v2::model::AddControlRequest;
26221 /// # let project_id = "project_id";
26222 /// # let location_id = "location_id";
26223 /// # let catalog_id = "catalog_id";
26224 /// # let serving_config_id = "serving_config_id";
26225 /// let x = AddControlRequest::new().set_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26226 /// ```
26227 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26228 self.serving_config = v.into();
26229 self
26230 }
26231
26232 /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
26233 ///
26234 /// # Example
26235 /// ```ignore,no_run
26236 /// # use google_cloud_retail_v2::model::AddControlRequest;
26237 /// let x = AddControlRequest::new().set_control_id("example");
26238 /// ```
26239 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26240 self.control_id = v.into();
26241 self
26242 }
26243}
26244
26245impl wkt::message::Message for AddControlRequest {
26246 fn typename() -> &'static str {
26247 "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
26248 }
26249}
26250
26251/// Request for RemoveControl method.
26252#[derive(Clone, Default, PartialEq)]
26253#[non_exhaustive]
26254pub struct RemoveControlRequest {
26255 /// Required. The source ServingConfig resource name . Format:
26256 /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26257 pub serving_config: std::string::String,
26258
26259 /// Required. The id of the control to apply. Assumed to be in the same catalog
26260 /// as the serving config.
26261 pub control_id: std::string::String,
26262
26263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26264}
26265
26266impl RemoveControlRequest {
26267 /// Creates a new default instance.
26268 pub fn new() -> Self {
26269 std::default::Default::default()
26270 }
26271
26272 /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
26273 ///
26274 /// # Example
26275 /// ```ignore,no_run
26276 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26277 /// # let project_id = "project_id";
26278 /// # let location_id = "location_id";
26279 /// # let catalog_id = "catalog_id";
26280 /// # let serving_config_id = "serving_config_id";
26281 /// let x = RemoveControlRequest::new().set_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26282 /// ```
26283 pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26284 self.serving_config = v.into();
26285 self
26286 }
26287
26288 /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
26289 ///
26290 /// # Example
26291 /// ```ignore,no_run
26292 /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26293 /// let x = RemoveControlRequest::new().set_control_id("example");
26294 /// ```
26295 pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26296 self.control_id = v.into();
26297 self
26298 }
26299}
26300
26301impl wkt::message::Message for RemoveControlRequest {
26302 fn typename() -> &'static str {
26303 "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
26304 }
26305}
26306
26307/// UserEvent captures all metadata information Retail API needs to know about
26308/// how end users interact with customers' website.
26309#[derive(Clone, Default, PartialEq)]
26310#[non_exhaustive]
26311pub struct UserEvent {
26312 /// Required. User event type. Allowed values are:
26313 ///
26314 /// * `add-to-cart`: Products being added to cart.
26315 /// * `remove-from-cart`: Products being removed from cart.
26316 /// * `category-page-view`: Special pages such as sale or promotion pages
26317 /// viewed.
26318 /// * `detail-page-view`: Products detail page viewed.
26319 /// * `home-page-view`: Homepage viewed.
26320 /// * `purchase-complete`: User finishing a purchase.
26321 /// * `search`: Product search.
26322 /// * `shopping-cart-page-view`: User viewing a shopping cart.
26323 pub event_type: std::string::String,
26324
26325 /// Required. A unique identifier for tracking visitors.
26326 ///
26327 /// For example, this could be implemented with an HTTP cookie, which should be
26328 /// able to uniquely identify a visitor on a single device. This unique
26329 /// identifier should not change if the visitor log in/out of the website.
26330 ///
26331 /// Don't set the field to the same fixed ID for different users. This mixes
26332 /// the event history of those users together, which results in degraded model
26333 /// quality.
26334 ///
26335 /// The field must be a UTF-8 encoded string with a length limit of 128
26336 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26337 ///
26338 /// The field should not contain PII or user-data. We recommend to use Google
26339 /// Analytics [Client
26340 /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
26341 /// for this field.
26342 pub visitor_id: std::string::String,
26343
26344 /// A unique identifier for tracking a visitor session with a length limit of
26345 /// 128 bytes. A session is an aggregation of an end user behavior in a time
26346 /// span.
26347 ///
26348 /// A general guideline to populate the session_id:
26349 ///
26350 /// 1. If user has no activity for 30 min, a new session_id should be assigned.
26351 /// 1. The session_id should be unique across users, suggest use uuid or add
26352 /// visitor_id as prefix.
26353 pub session_id: std::string::String,
26354
26355 /// Only required for
26356 /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
26357 /// method. Timestamp of when the user event happened.
26358 ///
26359 /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
26360 pub event_time: std::option::Option<wkt::Timestamp>,
26361
26362 /// A list of identifiers for the independent experiment groups this user event
26363 /// belongs to. This is used to distinguish between user events associated with
26364 /// different experiment setups (e.g. using Retail API, using different
26365 /// recommendation models).
26366 pub experiment_ids: std::vec::Vec<std::string::String>,
26367
26368 /// Highly recommended for user events that are the result of
26369 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26370 /// This field enables accurate attribution of recommendation model
26371 /// performance.
26372 ///
26373 /// The value must be a valid
26374 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26375 /// for user events that are the result of
26376 /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26377 /// The value must be a valid
26378 /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26379 /// for user events that are the result of
26380 /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26381 ///
26382 /// This token enables us to accurately attribute page view or purchase back to
26383 /// the event and the particular predict response containing this
26384 /// clicked/purchased product. If user clicks on product K in the
26385 /// recommendation results, pass
26386 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26387 /// as a URL parameter to product K's page. When recording events on product
26388 /// K's page, log the
26389 /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26390 /// to this field.
26391 ///
26392 /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26393 /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26394 /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26395 /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26396 pub attribution_token: std::string::String,
26397
26398 /// The main product details related to the event.
26399 ///
26400 /// This field is optional except for the following event types:
26401 ///
26402 /// * `add-to-cart`
26403 /// * `detail-page-view`
26404 /// * `purchase-complete`
26405 ///
26406 /// In a `search` event, this field represents the products returned to the end
26407 /// user on the current page (the end user may have not finished browsing the
26408 /// whole page yet). When a new page is returned to the end user, after
26409 /// pagination/filtering/ordering even for the same query, a new `search` event
26410 /// with different
26411 /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26412 /// desired. The end user may have not finished browsing the whole page yet.
26413 ///
26414 /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26415 pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26416
26417 /// The main auto-completion details related to the event.
26418 ///
26419 /// This field should be set for `search` event when autocomplete function is
26420 /// enabled and the user clicks a suggestion for search.
26421 pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26422
26423 /// Extra user event features to include in the recommendation model.
26424 ///
26425 /// If you provide custom attributes for ingested user events, also include
26426 /// them in the user events that you associate with prediction requests. Custom
26427 /// attribute formatting must be consistent between imported events and events
26428 /// provided with prediction requests. This lets the Retail API use
26429 /// those custom attributes when training models and serving predictions, which
26430 /// helps improve recommendation quality.
26431 ///
26432 /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26433 /// error is returned:
26434 ///
26435 /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26436 /// characters.
26437 /// * For text attributes, at most 400 values are allowed. Empty values are not
26438 /// allowed. Each value must be a UTF-8 encoded string with a length limit of
26439 /// 256 characters.
26440 /// * For number attributes, at most 400 values are allowed.
26441 ///
26442 /// For product recommendations, an example of extra user information is
26443 /// traffic_channel, which is how a user arrives at the site. Users can arrive
26444 /// at the site by coming to the site directly, coming through Google
26445 /// search, or in other ways.
26446 pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26447
26448 /// The ID or name of the associated shopping cart. This ID is used
26449 /// to associate multiple items added or present in the cart before purchase.
26450 ///
26451 /// This can only be set for `add-to-cart`, `purchase-complete`, or
26452 /// `shopping-cart-page-view` events.
26453 pub cart_id: std::string::String,
26454
26455 /// A transaction represents the entire purchase transaction.
26456 ///
26457 /// Required for `purchase-complete` events. Other event types should not set
26458 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26459 pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26460
26461 /// The user's search query.
26462 ///
26463 /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26464 /// definition.
26465 ///
26466 /// The value must be a UTF-8 encoded string with a length limit of 5,000
26467 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26468 ///
26469 /// At least one of
26470 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26471 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26472 /// required for `search` events. Other event types should not set this field.
26473 /// Otherwise, an INVALID_ARGUMENT error is returned.
26474 ///
26475 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26476 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26477 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26478 pub search_query: std::string::String,
26479
26480 /// The filter syntax consists of an expression language for constructing a
26481 /// predicate from one or more fields of the products being filtered.
26482 ///
26483 /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26484 /// definition and syntax.
26485 ///
26486 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26487 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26488 ///
26489 /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26490 pub filter: std::string::String,
26491
26492 /// The order in which products are returned.
26493 ///
26494 /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26495 /// for definition and syntax.
26496 ///
26497 /// The value must be a UTF-8 encoded string with a length limit of 1,000
26498 /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26499 ///
26500 /// This can only be set for `search` events. Other event types should not set
26501 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26502 ///
26503 /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26504 pub order_by: std::string::String,
26505
26506 /// An integer that specifies the current offset for pagination (the 0-indexed
26507 /// starting location, amongst the products deemed by the API as relevant).
26508 ///
26509 /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26510 /// definition.
26511 ///
26512 /// If this field is negative, an INVALID_ARGUMENT is returned.
26513 ///
26514 /// This can only be set for `search` events. Other event types should not set
26515 /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26516 ///
26517 /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26518 pub offset: i32,
26519
26520 /// The categories associated with a category page.
26521 ///
26522 /// To represent full path of category, use '>' sign to separate different
26523 /// hierarchies. If '>' is part of the category name, replace it with
26524 /// other character(s).
26525 ///
26526 /// Category pages include special pages such as sales or promotions. For
26527 /// instance, a special sale page may have the category hierarchy:
26528 /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26529 ///
26530 /// Required for `category-page-view` events. At least one of
26531 /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26532 /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26533 /// required for `search` events. Other event types should not set this field.
26534 /// Otherwise, an INVALID_ARGUMENT error is returned.
26535 ///
26536 /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26537 /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26538 pub page_categories: std::vec::Vec<std::string::String>,
26539
26540 /// User information.
26541 pub user_info: std::option::Option<crate::model::UserInfo>,
26542
26543 /// Complete URL (window.location.href) of the user's current page.
26544 ///
26545 /// When using the client side event reporting with JavaScript pixel and Google
26546 /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26547 /// characters.
26548 pub uri: std::string::String,
26549
26550 /// The referrer URL of the current page.
26551 ///
26552 /// When using the client side event reporting with JavaScript pixel and Google
26553 /// Tag Manager, this value is filled in automatically.
26554 pub referrer_uri: std::string::String,
26555
26556 /// A unique ID of a web page view.
26557 ///
26558 /// This should be kept the same for all user events triggered from the same
26559 /// pageview. For example, an item detail page view could trigger multiple
26560 /// events as the user is browsing the page. The `pageViewId` property should
26561 /// be kept the same for all these events so that they can be grouped together
26562 /// properly.
26563 ///
26564 /// When using the client side event reporting with JavaScript pixel and Google
26565 /// Tag Manager, this value is filled in automatically.
26566 pub page_view_id: std::string::String,
26567
26568 /// The entity for customers that may run multiple different entities, domains,
26569 /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26570 /// `google.com`, `youtube.com`, etc.
26571 /// We recommend that you set this field to get better per-entity search,
26572 /// completion, and prediction results.
26573 pub entity: std::string::String,
26574
26575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26576}
26577
26578impl UserEvent {
26579 /// Creates a new default instance.
26580 pub fn new() -> Self {
26581 std::default::Default::default()
26582 }
26583
26584 /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26585 ///
26586 /// # Example
26587 /// ```ignore,no_run
26588 /// # use google_cloud_retail_v2::model::UserEvent;
26589 /// let x = UserEvent::new().set_event_type("example");
26590 /// ```
26591 pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26592 self.event_type = v.into();
26593 self
26594 }
26595
26596 /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26597 ///
26598 /// # Example
26599 /// ```ignore,no_run
26600 /// # use google_cloud_retail_v2::model::UserEvent;
26601 /// let x = UserEvent::new().set_visitor_id("example");
26602 /// ```
26603 pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26604 self.visitor_id = v.into();
26605 self
26606 }
26607
26608 /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26609 ///
26610 /// # Example
26611 /// ```ignore,no_run
26612 /// # use google_cloud_retail_v2::model::UserEvent;
26613 /// let x = UserEvent::new().set_session_id("example");
26614 /// ```
26615 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26616 self.session_id = v.into();
26617 self
26618 }
26619
26620 /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26621 ///
26622 /// # Example
26623 /// ```ignore,no_run
26624 /// # use google_cloud_retail_v2::model::UserEvent;
26625 /// use wkt::Timestamp;
26626 /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26627 /// ```
26628 pub fn set_event_time<T>(mut self, v: T) -> Self
26629 where
26630 T: std::convert::Into<wkt::Timestamp>,
26631 {
26632 self.event_time = std::option::Option::Some(v.into());
26633 self
26634 }
26635
26636 /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26637 ///
26638 /// # Example
26639 /// ```ignore,no_run
26640 /// # use google_cloud_retail_v2::model::UserEvent;
26641 /// use wkt::Timestamp;
26642 /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26643 /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26644 /// ```
26645 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26646 where
26647 T: std::convert::Into<wkt::Timestamp>,
26648 {
26649 self.event_time = v.map(|x| x.into());
26650 self
26651 }
26652
26653 /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26654 ///
26655 /// # Example
26656 /// ```ignore,no_run
26657 /// # use google_cloud_retail_v2::model::UserEvent;
26658 /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26659 /// ```
26660 pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
26661 where
26662 T: std::iter::IntoIterator<Item = V>,
26663 V: std::convert::Into<std::string::String>,
26664 {
26665 use std::iter::Iterator;
26666 self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26667 self
26668 }
26669
26670 /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26671 ///
26672 /// # Example
26673 /// ```ignore,no_run
26674 /// # use google_cloud_retail_v2::model::UserEvent;
26675 /// let x = UserEvent::new().set_attribution_token("example");
26676 /// ```
26677 pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26678 mut self,
26679 v: T,
26680 ) -> Self {
26681 self.attribution_token = v.into();
26682 self
26683 }
26684
26685 /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26686 ///
26687 /// # Example
26688 /// ```ignore,no_run
26689 /// # use google_cloud_retail_v2::model::UserEvent;
26690 /// use google_cloud_retail_v2::model::ProductDetail;
26691 /// let x = UserEvent::new()
26692 /// .set_product_details([
26693 /// ProductDetail::default()/* use setters */,
26694 /// ProductDetail::default()/* use (different) setters */,
26695 /// ]);
26696 /// ```
26697 pub fn set_product_details<T, V>(mut self, v: T) -> Self
26698 where
26699 T: std::iter::IntoIterator<Item = V>,
26700 V: std::convert::Into<crate::model::ProductDetail>,
26701 {
26702 use std::iter::Iterator;
26703 self.product_details = v.into_iter().map(|i| i.into()).collect();
26704 self
26705 }
26706
26707 /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26708 ///
26709 /// # Example
26710 /// ```ignore,no_run
26711 /// # use google_cloud_retail_v2::model::UserEvent;
26712 /// use google_cloud_retail_v2::model::CompletionDetail;
26713 /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26714 /// ```
26715 pub fn set_completion_detail<T>(mut self, v: T) -> Self
26716 where
26717 T: std::convert::Into<crate::model::CompletionDetail>,
26718 {
26719 self.completion_detail = std::option::Option::Some(v.into());
26720 self
26721 }
26722
26723 /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26724 ///
26725 /// # Example
26726 /// ```ignore,no_run
26727 /// # use google_cloud_retail_v2::model::UserEvent;
26728 /// use google_cloud_retail_v2::model::CompletionDetail;
26729 /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26730 /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26731 /// ```
26732 pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26733 where
26734 T: std::convert::Into<crate::model::CompletionDetail>,
26735 {
26736 self.completion_detail = v.map(|x| x.into());
26737 self
26738 }
26739
26740 /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26741 ///
26742 /// # Example
26743 /// ```ignore,no_run
26744 /// # use google_cloud_retail_v2::model::UserEvent;
26745 /// use google_cloud_retail_v2::model::CustomAttribute;
26746 /// let x = UserEvent::new().set_attributes([
26747 /// ("key0", CustomAttribute::default()/* use setters */),
26748 /// ("key1", CustomAttribute::default()/* use (different) setters */),
26749 /// ]);
26750 /// ```
26751 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26752 where
26753 T: std::iter::IntoIterator<Item = (K, V)>,
26754 K: std::convert::Into<std::string::String>,
26755 V: std::convert::Into<crate::model::CustomAttribute>,
26756 {
26757 use std::iter::Iterator;
26758 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26759 self
26760 }
26761
26762 /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26763 ///
26764 /// # Example
26765 /// ```ignore,no_run
26766 /// # use google_cloud_retail_v2::model::UserEvent;
26767 /// let x = UserEvent::new().set_cart_id("example");
26768 /// ```
26769 pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26770 self.cart_id = v.into();
26771 self
26772 }
26773
26774 /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26775 ///
26776 /// # Example
26777 /// ```ignore,no_run
26778 /// # use google_cloud_retail_v2::model::UserEvent;
26779 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26780 /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26781 /// ```
26782 pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26783 where
26784 T: std::convert::Into<crate::model::PurchaseTransaction>,
26785 {
26786 self.purchase_transaction = std::option::Option::Some(v.into());
26787 self
26788 }
26789
26790 /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26791 ///
26792 /// # Example
26793 /// ```ignore,no_run
26794 /// # use google_cloud_retail_v2::model::UserEvent;
26795 /// use google_cloud_retail_v2::model::PurchaseTransaction;
26796 /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26797 /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26798 /// ```
26799 pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26800 where
26801 T: std::convert::Into<crate::model::PurchaseTransaction>,
26802 {
26803 self.purchase_transaction = v.map(|x| x.into());
26804 self
26805 }
26806
26807 /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26808 ///
26809 /// # Example
26810 /// ```ignore,no_run
26811 /// # use google_cloud_retail_v2::model::UserEvent;
26812 /// let x = UserEvent::new().set_search_query("example");
26813 /// ```
26814 pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26815 self.search_query = v.into();
26816 self
26817 }
26818
26819 /// Sets the value of [filter][crate::model::UserEvent::filter].
26820 ///
26821 /// # Example
26822 /// ```ignore,no_run
26823 /// # use google_cloud_retail_v2::model::UserEvent;
26824 /// let x = UserEvent::new().set_filter("example");
26825 /// ```
26826 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26827 self.filter = v.into();
26828 self
26829 }
26830
26831 /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26832 ///
26833 /// # Example
26834 /// ```ignore,no_run
26835 /// # use google_cloud_retail_v2::model::UserEvent;
26836 /// let x = UserEvent::new().set_order_by("example");
26837 /// ```
26838 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26839 self.order_by = v.into();
26840 self
26841 }
26842
26843 /// Sets the value of [offset][crate::model::UserEvent::offset].
26844 ///
26845 /// # Example
26846 /// ```ignore,no_run
26847 /// # use google_cloud_retail_v2::model::UserEvent;
26848 /// let x = UserEvent::new().set_offset(42);
26849 /// ```
26850 pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26851 self.offset = v.into();
26852 self
26853 }
26854
26855 /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26856 ///
26857 /// # Example
26858 /// ```ignore,no_run
26859 /// # use google_cloud_retail_v2::model::UserEvent;
26860 /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26861 /// ```
26862 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26863 where
26864 T: std::iter::IntoIterator<Item = V>,
26865 V: std::convert::Into<std::string::String>,
26866 {
26867 use std::iter::Iterator;
26868 self.page_categories = v.into_iter().map(|i| i.into()).collect();
26869 self
26870 }
26871
26872 /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26873 ///
26874 /// # Example
26875 /// ```ignore,no_run
26876 /// # use google_cloud_retail_v2::model::UserEvent;
26877 /// use google_cloud_retail_v2::model::UserInfo;
26878 /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26879 /// ```
26880 pub fn set_user_info<T>(mut self, v: T) -> Self
26881 where
26882 T: std::convert::Into<crate::model::UserInfo>,
26883 {
26884 self.user_info = std::option::Option::Some(v.into());
26885 self
26886 }
26887
26888 /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26889 ///
26890 /// # Example
26891 /// ```ignore,no_run
26892 /// # use google_cloud_retail_v2::model::UserEvent;
26893 /// use google_cloud_retail_v2::model::UserInfo;
26894 /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26895 /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26896 /// ```
26897 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26898 where
26899 T: std::convert::Into<crate::model::UserInfo>,
26900 {
26901 self.user_info = v.map(|x| x.into());
26902 self
26903 }
26904
26905 /// Sets the value of [uri][crate::model::UserEvent::uri].
26906 ///
26907 /// # Example
26908 /// ```ignore,no_run
26909 /// # use google_cloud_retail_v2::model::UserEvent;
26910 /// let x = UserEvent::new().set_uri("example");
26911 /// ```
26912 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26913 self.uri = v.into();
26914 self
26915 }
26916
26917 /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26918 ///
26919 /// # Example
26920 /// ```ignore,no_run
26921 /// # use google_cloud_retail_v2::model::UserEvent;
26922 /// let x = UserEvent::new().set_referrer_uri("example");
26923 /// ```
26924 pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26925 self.referrer_uri = v.into();
26926 self
26927 }
26928
26929 /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26930 ///
26931 /// # Example
26932 /// ```ignore,no_run
26933 /// # use google_cloud_retail_v2::model::UserEvent;
26934 /// let x = UserEvent::new().set_page_view_id("example");
26935 /// ```
26936 pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26937 self.page_view_id = v.into();
26938 self
26939 }
26940
26941 /// Sets the value of [entity][crate::model::UserEvent::entity].
26942 ///
26943 /// # Example
26944 /// ```ignore,no_run
26945 /// # use google_cloud_retail_v2::model::UserEvent;
26946 /// let x = UserEvent::new().set_entity("example");
26947 /// ```
26948 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26949 self.entity = v.into();
26950 self
26951 }
26952}
26953
26954impl wkt::message::Message for UserEvent {
26955 fn typename() -> &'static str {
26956 "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26957 }
26958}
26959
26960/// Detailed product information associated with a user event.
26961#[derive(Clone, Default, PartialEq)]
26962#[non_exhaustive]
26963pub struct ProductDetail {
26964 /// Required. [Product][google.cloud.retail.v2.Product] information.
26965 ///
26966 /// Required field(s):
26967 ///
26968 /// * [Product.id][google.cloud.retail.v2.Product.id]
26969 ///
26970 /// Optional override field(s):
26971 ///
26972 /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26973 ///
26974 /// If any supported optional fields are provided, we will treat them as a full
26975 /// override when looking up product information from the catalog. Thus, it is
26976 /// important to ensure that the overriding fields are accurate and
26977 /// complete.
26978 ///
26979 /// All other product fields are ignored and instead populated via catalog
26980 /// lookup after event ingestion.
26981 ///
26982 /// [google.cloud.retail.v2.Product]: crate::model::Product
26983 /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26984 /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26985 pub product: std::option::Option<crate::model::Product>,
26986
26987 /// Quantity of the product associated with the user event.
26988 ///
26989 /// For example, this field will be 2 if two products are added to the shopping
26990 /// cart for `purchase-complete` event. Required for `add-to-cart` and
26991 /// `purchase-complete` event types.
26992 pub quantity: std::option::Option<wkt::Int32Value>,
26993
26994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26995}
26996
26997impl ProductDetail {
26998 /// Creates a new default instance.
26999 pub fn new() -> Self {
27000 std::default::Default::default()
27001 }
27002
27003 /// Sets the value of [product][crate::model::ProductDetail::product].
27004 ///
27005 /// # Example
27006 /// ```ignore,no_run
27007 /// # use google_cloud_retail_v2::model::ProductDetail;
27008 /// use google_cloud_retail_v2::model::Product;
27009 /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
27010 /// ```
27011 pub fn set_product<T>(mut self, v: T) -> Self
27012 where
27013 T: std::convert::Into<crate::model::Product>,
27014 {
27015 self.product = std::option::Option::Some(v.into());
27016 self
27017 }
27018
27019 /// Sets or clears the value of [product][crate::model::ProductDetail::product].
27020 ///
27021 /// # Example
27022 /// ```ignore,no_run
27023 /// # use google_cloud_retail_v2::model::ProductDetail;
27024 /// use google_cloud_retail_v2::model::Product;
27025 /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
27026 /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
27027 /// ```
27028 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
27029 where
27030 T: std::convert::Into<crate::model::Product>,
27031 {
27032 self.product = v.map(|x| x.into());
27033 self
27034 }
27035
27036 /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
27037 ///
27038 /// # Example
27039 /// ```ignore,no_run
27040 /// # use google_cloud_retail_v2::model::ProductDetail;
27041 /// use wkt::Int32Value;
27042 /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
27043 /// ```
27044 pub fn set_quantity<T>(mut self, v: T) -> Self
27045 where
27046 T: std::convert::Into<wkt::Int32Value>,
27047 {
27048 self.quantity = std::option::Option::Some(v.into());
27049 self
27050 }
27051
27052 /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
27053 ///
27054 /// # Example
27055 /// ```ignore,no_run
27056 /// # use google_cloud_retail_v2::model::ProductDetail;
27057 /// use wkt::Int32Value;
27058 /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
27059 /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
27060 /// ```
27061 pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
27062 where
27063 T: std::convert::Into<wkt::Int32Value>,
27064 {
27065 self.quantity = v.map(|x| x.into());
27066 self
27067 }
27068}
27069
27070impl wkt::message::Message for ProductDetail {
27071 fn typename() -> &'static str {
27072 "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
27073 }
27074}
27075
27076/// Detailed completion information including completion attribution token and
27077/// clicked completion info.
27078#[derive(Clone, Default, PartialEq)]
27079#[non_exhaustive]
27080pub struct CompletionDetail {
27081 /// Completion attribution token in
27082 /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
27083 ///
27084 /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
27085 pub completion_attribution_token: std::string::String,
27086
27087 /// End user selected
27088 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
27089 ///
27090 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
27091 pub selected_suggestion: std::string::String,
27092
27093 /// End user selected
27094 /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
27095 /// position, starting from 0.
27096 ///
27097 /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
27098 pub selected_position: i32,
27099
27100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27101}
27102
27103impl CompletionDetail {
27104 /// Creates a new default instance.
27105 pub fn new() -> Self {
27106 std::default::Default::default()
27107 }
27108
27109 /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
27110 ///
27111 /// # Example
27112 /// ```ignore,no_run
27113 /// # use google_cloud_retail_v2::model::CompletionDetail;
27114 /// let x = CompletionDetail::new().set_completion_attribution_token("example");
27115 /// ```
27116 pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
27117 mut self,
27118 v: T,
27119 ) -> Self {
27120 self.completion_attribution_token = v.into();
27121 self
27122 }
27123
27124 /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
27125 ///
27126 /// # Example
27127 /// ```ignore,no_run
27128 /// # use google_cloud_retail_v2::model::CompletionDetail;
27129 /// let x = CompletionDetail::new().set_selected_suggestion("example");
27130 /// ```
27131 pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
27132 mut self,
27133 v: T,
27134 ) -> Self {
27135 self.selected_suggestion = v.into();
27136 self
27137 }
27138
27139 /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
27140 ///
27141 /// # Example
27142 /// ```ignore,no_run
27143 /// # use google_cloud_retail_v2::model::CompletionDetail;
27144 /// let x = CompletionDetail::new().set_selected_position(42);
27145 /// ```
27146 pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
27147 self.selected_position = v.into();
27148 self
27149 }
27150}
27151
27152impl wkt::message::Message for CompletionDetail {
27153 fn typename() -> &'static str {
27154 "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
27155 }
27156}
27157
27158/// A transaction represents the entire purchase transaction.
27159#[derive(Clone, Default, PartialEq)]
27160#[non_exhaustive]
27161pub struct PurchaseTransaction {
27162 /// The transaction ID with a length limit of 128 characters.
27163 pub id: std::string::String,
27164
27165 /// Required. Total non-zero revenue or grand total associated with the
27166 /// transaction. This value include shipping, tax, or other adjustments to
27167 /// total revenue that you want to include as part of your revenue
27168 /// calculations.
27169 pub revenue: f32,
27170
27171 /// All the taxes associated with the transaction.
27172 pub tax: f32,
27173
27174 /// All the costs associated with the products. These can be manufacturing
27175 /// costs, shipping expenses not borne by the end user, or any other costs,
27176 /// such that:
27177 ///
27178 /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
27179 /// [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
27180 /// [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
27181 ///
27182 /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
27183 /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
27184 /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
27185 pub cost: f32,
27186
27187 /// Required. Currency code. Use three-character ISO-4217 code.
27188 pub currency_code: std::string::String,
27189
27190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27191}
27192
27193impl PurchaseTransaction {
27194 /// Creates a new default instance.
27195 pub fn new() -> Self {
27196 std::default::Default::default()
27197 }
27198
27199 /// Sets the value of [id][crate::model::PurchaseTransaction::id].
27200 ///
27201 /// # Example
27202 /// ```ignore,no_run
27203 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27204 /// let x = PurchaseTransaction::new().set_id("example");
27205 /// ```
27206 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27207 self.id = v.into();
27208 self
27209 }
27210
27211 /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
27212 ///
27213 /// # Example
27214 /// ```ignore,no_run
27215 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27216 /// let x = PurchaseTransaction::new().set_revenue(42.0);
27217 /// ```
27218 pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27219 self.revenue = v.into();
27220 self
27221 }
27222
27223 /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
27224 ///
27225 /// # Example
27226 /// ```ignore,no_run
27227 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27228 /// let x = PurchaseTransaction::new().set_tax(42.0);
27229 /// ```
27230 pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27231 self.tax = v.into();
27232 self
27233 }
27234
27235 /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
27236 ///
27237 /// # Example
27238 /// ```ignore,no_run
27239 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27240 /// let x = PurchaseTransaction::new().set_cost(42.0);
27241 /// ```
27242 pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27243 self.cost = v.into();
27244 self
27245 }
27246
27247 /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
27248 ///
27249 /// # Example
27250 /// ```ignore,no_run
27251 /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27252 /// let x = PurchaseTransaction::new().set_currency_code("example");
27253 /// ```
27254 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27255 self.currency_code = v.into();
27256 self
27257 }
27258}
27259
27260impl wkt::message::Message for PurchaseTransaction {
27261 fn typename() -> &'static str {
27262 "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
27263 }
27264}
27265
27266/// Request message for WriteUserEvent method.
27267#[derive(Clone, Default, PartialEq)]
27268#[non_exhaustive]
27269pub struct WriteUserEventRequest {
27270 /// Required. The parent catalog resource name, such as
27271 /// `projects/1234/locations/global/catalogs/default_catalog`.
27272 pub parent: std::string::String,
27273
27274 /// Required. User event to write.
27275 pub user_event: std::option::Option<crate::model::UserEvent>,
27276
27277 /// If set to true, the user event will be written asynchronously after
27278 /// validation, and the API will respond without waiting for the write.
27279 /// Therefore, silent failures can occur even if the API returns success. In
27280 /// case of silent failures, error messages can be found in Stackdriver logs.
27281 pub write_async: bool,
27282
27283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27284}
27285
27286impl WriteUserEventRequest {
27287 /// Creates a new default instance.
27288 pub fn new() -> Self {
27289 std::default::Default::default()
27290 }
27291
27292 /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
27293 ///
27294 /// # Example
27295 /// ```ignore,no_run
27296 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27297 /// let x = WriteUserEventRequest::new().set_parent("example");
27298 /// ```
27299 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27300 self.parent = v.into();
27301 self
27302 }
27303
27304 /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27305 ///
27306 /// # Example
27307 /// ```ignore,no_run
27308 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27309 /// use google_cloud_retail_v2::model::UserEvent;
27310 /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
27311 /// ```
27312 pub fn set_user_event<T>(mut self, v: T) -> Self
27313 where
27314 T: std::convert::Into<crate::model::UserEvent>,
27315 {
27316 self.user_event = std::option::Option::Some(v.into());
27317 self
27318 }
27319
27320 /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27321 ///
27322 /// # Example
27323 /// ```ignore,no_run
27324 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27325 /// use google_cloud_retail_v2::model::UserEvent;
27326 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
27327 /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
27328 /// ```
27329 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
27330 where
27331 T: std::convert::Into<crate::model::UserEvent>,
27332 {
27333 self.user_event = v.map(|x| x.into());
27334 self
27335 }
27336
27337 /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
27338 ///
27339 /// # Example
27340 /// ```ignore,no_run
27341 /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27342 /// let x = WriteUserEventRequest::new().set_write_async(true);
27343 /// ```
27344 pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
27345 self.write_async = v.into();
27346 self
27347 }
27348}
27349
27350impl wkt::message::Message for WriteUserEventRequest {
27351 fn typename() -> &'static str {
27352 "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
27353 }
27354}
27355
27356/// Request message for CollectUserEvent method.
27357#[derive(Clone, Default, PartialEq)]
27358#[non_exhaustive]
27359pub struct CollectUserEventRequest {
27360 /// Required. The parent catalog name, such as
27361 /// `projects/1234/locations/global/catalogs/default_catalog`.
27362 pub parent: std::string::String,
27363
27364 /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
27365 /// characters.
27366 pub user_event: std::string::String,
27367
27368 /// The URL including cgi-parameters but excluding the hash fragment with a
27369 /// length limit of 5,000 characters. This is often more useful than the
27370 /// referer URL, because many browsers only send the domain for 3rd party
27371 /// requests.
27372 pub uri: std::string::String,
27373
27374 /// The event timestamp in milliseconds. This prevents browser caching of
27375 /// otherwise identical get requests. The name is abbreviated to reduce the
27376 /// payload bytes.
27377 pub ets: i64,
27378
27379 /// An arbitrary serialized JSON string that contains necessary information
27380 /// that can comprise a user event. When this field is specified, the
27381 /// user_event field will be ignored. Note: line-delimited JSON is not
27382 /// supported, a single JSON only.
27383 pub raw_json: std::string::String,
27384
27385 /// The rule that can convert the raw_json to a user event. It is needed
27386 /// only when the raw_json is set.
27387 pub conversion_rule:
27388 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27389
27390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27391}
27392
27393impl CollectUserEventRequest {
27394 /// Creates a new default instance.
27395 pub fn new() -> Self {
27396 std::default::Default::default()
27397 }
27398
27399 /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27400 ///
27401 /// # Example
27402 /// ```ignore,no_run
27403 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27404 /// let x = CollectUserEventRequest::new().set_parent("example");
27405 /// ```
27406 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27407 self.parent = v.into();
27408 self
27409 }
27410
27411 /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27412 ///
27413 /// # Example
27414 /// ```ignore,no_run
27415 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27416 /// let x = CollectUserEventRequest::new().set_user_event("example");
27417 /// ```
27418 pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27419 self.user_event = v.into();
27420 self
27421 }
27422
27423 /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27424 ///
27425 /// # Example
27426 /// ```ignore,no_run
27427 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27428 /// let x = CollectUserEventRequest::new().set_uri("example");
27429 /// ```
27430 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27431 self.uri = v.into();
27432 self
27433 }
27434
27435 /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27436 ///
27437 /// # Example
27438 /// ```ignore,no_run
27439 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27440 /// let x = CollectUserEventRequest::new().set_ets(42);
27441 /// ```
27442 pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27443 self.ets = v.into();
27444 self
27445 }
27446
27447 /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27448 ///
27449 /// # Example
27450 /// ```ignore,no_run
27451 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27452 /// let x = CollectUserEventRequest::new().set_raw_json("example");
27453 /// ```
27454 pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27455 self.raw_json = v.into();
27456 self
27457 }
27458
27459 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27460 ///
27461 /// Note that all the setters affecting `conversion_rule` are mutually
27462 /// exclusive.
27463 ///
27464 /// # Example
27465 /// ```ignore,no_run
27466 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27467 /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27468 /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27469 /// ```
27470 pub fn set_conversion_rule<
27471 T: std::convert::Into<
27472 std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27473 >,
27474 >(
27475 mut self,
27476 v: T,
27477 ) -> Self {
27478 self.conversion_rule = v.into();
27479 self
27480 }
27481
27482 /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27483 /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27484 /// holds a different branch.
27485 pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27486 #[allow(unreachable_patterns)]
27487 self.conversion_rule.as_ref().and_then(|v| match v {
27488 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27489 std::option::Option::Some(v)
27490 }
27491 _ => std::option::Option::None,
27492 })
27493 }
27494
27495 /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27496 /// to hold a `PrebuiltRule`.
27497 ///
27498 /// Note that all the setters affecting `conversion_rule` are
27499 /// mutually exclusive.
27500 ///
27501 /// # Example
27502 /// ```ignore,no_run
27503 /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27504 /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27505 /// assert!(x.prebuilt_rule().is_some());
27506 /// ```
27507 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27508 self.conversion_rule = std::option::Option::Some(
27509 crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27510 );
27511 self
27512 }
27513}
27514
27515impl wkt::message::Message for CollectUserEventRequest {
27516 fn typename() -> &'static str {
27517 "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27518 }
27519}
27520
27521/// Defines additional types related to [CollectUserEventRequest].
27522pub mod collect_user_event_request {
27523 #[allow(unused_imports)]
27524 use super::*;
27525
27526 /// The rule that can convert the raw_json to a user event. It is needed
27527 /// only when the raw_json is set.
27528 #[derive(Clone, Debug, PartialEq)]
27529 #[non_exhaustive]
27530 pub enum ConversionRule {
27531 /// The prebuilt rule name that can convert a specific type of raw_json.
27532 /// For example: "ga4_bq" rule for the GA4 user event schema.
27533 PrebuiltRule(std::string::String),
27534 }
27535}
27536
27537/// Request message for RejoinUserEvents method.
27538#[derive(Clone, Default, PartialEq)]
27539#[non_exhaustive]
27540pub struct RejoinUserEventsRequest {
27541 /// Required. The parent catalog resource name, such as
27542 /// `projects/1234/locations/global/catalogs/default_catalog`.
27543 pub parent: std::string::String,
27544
27545 /// The type of the user event rejoin to define the scope and range of the user
27546 /// events to be rejoined with the latest product catalog. Defaults to
27547 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27548 /// an invalid integer value.
27549 pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27550
27551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27552}
27553
27554impl RejoinUserEventsRequest {
27555 /// Creates a new default instance.
27556 pub fn new() -> Self {
27557 std::default::Default::default()
27558 }
27559
27560 /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27561 ///
27562 /// # Example
27563 /// ```ignore,no_run
27564 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27565 /// let x = RejoinUserEventsRequest::new().set_parent("example");
27566 /// ```
27567 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27568 self.parent = v.into();
27569 self
27570 }
27571
27572 /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27573 ///
27574 /// # Example
27575 /// ```ignore,no_run
27576 /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27577 /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27578 /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27579 /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27580 /// ```
27581 pub fn set_user_event_rejoin_scope<
27582 T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27583 >(
27584 mut self,
27585 v: T,
27586 ) -> Self {
27587 self.user_event_rejoin_scope = v.into();
27588 self
27589 }
27590}
27591
27592impl wkt::message::Message for RejoinUserEventsRequest {
27593 fn typename() -> &'static str {
27594 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27595 }
27596}
27597
27598/// Defines additional types related to [RejoinUserEventsRequest].
27599pub mod rejoin_user_events_request {
27600 #[allow(unused_imports)]
27601 use super::*;
27602
27603 /// The scope of user events to be rejoined with the latest product catalog.
27604 /// If the rejoining aims at reducing number of unjoined events, set
27605 /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27606 /// If the rejoining aims at correcting product catalog information in joined
27607 /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27608 /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27609 /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27610 ///
27611 /// # Working with unknown values
27612 ///
27613 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27614 /// additional enum variants at any time. Adding new variants is not considered
27615 /// a breaking change. Applications should write their code in anticipation of:
27616 ///
27617 /// - New values appearing in future releases of the client library, **and**
27618 /// - New values received dynamically, without application changes.
27619 ///
27620 /// Please consult the [Working with enums] section in the user guide for some
27621 /// guidelines.
27622 ///
27623 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27624 #[derive(Clone, Debug, PartialEq)]
27625 #[non_exhaustive]
27626 pub enum UserEventRejoinScope {
27627 /// Rejoin all events with the latest product catalog, including both joined
27628 /// events and unjoined events.
27629 Unspecified,
27630 /// Only rejoin joined events with the latest product catalog.
27631 JoinedEvents,
27632 /// Only rejoin unjoined events with the latest product catalog.
27633 UnjoinedEvents,
27634 /// If set, the enum was initialized with an unknown value.
27635 ///
27636 /// Applications can examine the value using [UserEventRejoinScope::value] or
27637 /// [UserEventRejoinScope::name].
27638 UnknownValue(user_event_rejoin_scope::UnknownValue),
27639 }
27640
27641 #[doc(hidden)]
27642 pub mod user_event_rejoin_scope {
27643 #[allow(unused_imports)]
27644 use super::*;
27645 #[derive(Clone, Debug, PartialEq)]
27646 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27647 }
27648
27649 impl UserEventRejoinScope {
27650 /// Gets the enum value.
27651 ///
27652 /// Returns `None` if the enum contains an unknown value deserialized from
27653 /// the string representation of enums.
27654 pub fn value(&self) -> std::option::Option<i32> {
27655 match self {
27656 Self::Unspecified => std::option::Option::Some(0),
27657 Self::JoinedEvents => std::option::Option::Some(1),
27658 Self::UnjoinedEvents => std::option::Option::Some(2),
27659 Self::UnknownValue(u) => u.0.value(),
27660 }
27661 }
27662
27663 /// Gets the enum value as a string.
27664 ///
27665 /// Returns `None` if the enum contains an unknown value deserialized from
27666 /// the integer representation of enums.
27667 pub fn name(&self) -> std::option::Option<&str> {
27668 match self {
27669 Self::Unspecified => {
27670 std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27671 }
27672 Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27673 Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27674 Self::UnknownValue(u) => u.0.name(),
27675 }
27676 }
27677 }
27678
27679 impl std::default::Default for UserEventRejoinScope {
27680 fn default() -> Self {
27681 use std::convert::From;
27682 Self::from(0)
27683 }
27684 }
27685
27686 impl std::fmt::Display for UserEventRejoinScope {
27687 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27688 wkt::internal::display_enum(f, self.name(), self.value())
27689 }
27690 }
27691
27692 impl std::convert::From<i32> for UserEventRejoinScope {
27693 fn from(value: i32) -> Self {
27694 match value {
27695 0 => Self::Unspecified,
27696 1 => Self::JoinedEvents,
27697 2 => Self::UnjoinedEvents,
27698 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27699 wkt::internal::UnknownEnumValue::Integer(value),
27700 )),
27701 }
27702 }
27703 }
27704
27705 impl std::convert::From<&str> for UserEventRejoinScope {
27706 fn from(value: &str) -> Self {
27707 use std::string::ToString;
27708 match value {
27709 "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27710 "JOINED_EVENTS" => Self::JoinedEvents,
27711 "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27712 _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27713 wkt::internal::UnknownEnumValue::String(value.to_string()),
27714 )),
27715 }
27716 }
27717 }
27718
27719 impl serde::ser::Serialize for UserEventRejoinScope {
27720 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27721 where
27722 S: serde::Serializer,
27723 {
27724 match self {
27725 Self::Unspecified => serializer.serialize_i32(0),
27726 Self::JoinedEvents => serializer.serialize_i32(1),
27727 Self::UnjoinedEvents => serializer.serialize_i32(2),
27728 Self::UnknownValue(u) => u.0.serialize(serializer),
27729 }
27730 }
27731 }
27732
27733 impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27734 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27735 where
27736 D: serde::Deserializer<'de>,
27737 {
27738 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27739 ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27740 ))
27741 }
27742 }
27743}
27744
27745/// Response message for `RejoinUserEvents` method.
27746#[derive(Clone, Default, PartialEq)]
27747#[non_exhaustive]
27748pub struct RejoinUserEventsResponse {
27749 /// Number of user events that were joined with latest product catalog.
27750 pub rejoined_user_events_count: i64,
27751
27752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27753}
27754
27755impl RejoinUserEventsResponse {
27756 /// Creates a new default instance.
27757 pub fn new() -> Self {
27758 std::default::Default::default()
27759 }
27760
27761 /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27762 ///
27763 /// # Example
27764 /// ```ignore,no_run
27765 /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27766 /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27767 /// ```
27768 pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27769 self.rejoined_user_events_count = v.into();
27770 self
27771 }
27772}
27773
27774impl wkt::message::Message for RejoinUserEventsResponse {
27775 fn typename() -> &'static str {
27776 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27777 }
27778}
27779
27780/// Metadata for `RejoinUserEvents` method.
27781#[derive(Clone, Default, PartialEq)]
27782#[non_exhaustive]
27783pub struct RejoinUserEventsMetadata {
27784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27785}
27786
27787impl RejoinUserEventsMetadata {
27788 /// Creates a new default instance.
27789 pub fn new() -> Self {
27790 std::default::Default::default()
27791 }
27792}
27793
27794impl wkt::message::Message for RejoinUserEventsMetadata {
27795 fn typename() -> &'static str {
27796 "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27797 }
27798}
27799
27800/// At which level we offer configuration for attributes.
27801///
27802/// # Working with unknown values
27803///
27804/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27805/// additional enum variants at any time. Adding new variants is not considered
27806/// a breaking change. Applications should write their code in anticipation of:
27807///
27808/// - New values appearing in future releases of the client library, **and**
27809/// - New values received dynamically, without application changes.
27810///
27811/// Please consult the [Working with enums] section in the user guide for some
27812/// guidelines.
27813///
27814/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27815#[derive(Clone, Debug, PartialEq)]
27816#[non_exhaustive]
27817pub enum AttributeConfigLevel {
27818 /// Value used when unset. In this case, server behavior defaults to
27819 /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27820 ///
27821 /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27822 Unspecified,
27823 /// At this level, we honor the attribute configurations set in
27824 /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27825 ///
27826 /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27827 ProductLevelAttributeConfig,
27828 /// At this level, we honor the attribute configurations set in
27829 /// `CatalogConfig.attribute_configs`.
27830 CatalogLevelAttributeConfig,
27831 /// If set, the enum was initialized with an unknown value.
27832 ///
27833 /// Applications can examine the value using [AttributeConfigLevel::value] or
27834 /// [AttributeConfigLevel::name].
27835 UnknownValue(attribute_config_level::UnknownValue),
27836}
27837
27838#[doc(hidden)]
27839pub mod attribute_config_level {
27840 #[allow(unused_imports)]
27841 use super::*;
27842 #[derive(Clone, Debug, PartialEq)]
27843 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27844}
27845
27846impl AttributeConfigLevel {
27847 /// Gets the enum value.
27848 ///
27849 /// Returns `None` if the enum contains an unknown value deserialized from
27850 /// the string representation of enums.
27851 pub fn value(&self) -> std::option::Option<i32> {
27852 match self {
27853 Self::Unspecified => std::option::Option::Some(0),
27854 Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27855 Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27856 Self::UnknownValue(u) => u.0.value(),
27857 }
27858 }
27859
27860 /// Gets the enum value as a string.
27861 ///
27862 /// Returns `None` if the enum contains an unknown value deserialized from
27863 /// the integer representation of enums.
27864 pub fn name(&self) -> std::option::Option<&str> {
27865 match self {
27866 Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27867 Self::ProductLevelAttributeConfig => {
27868 std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27869 }
27870 Self::CatalogLevelAttributeConfig => {
27871 std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27872 }
27873 Self::UnknownValue(u) => u.0.name(),
27874 }
27875 }
27876}
27877
27878impl std::default::Default for AttributeConfigLevel {
27879 fn default() -> Self {
27880 use std::convert::From;
27881 Self::from(0)
27882 }
27883}
27884
27885impl std::fmt::Display for AttributeConfigLevel {
27886 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27887 wkt::internal::display_enum(f, self.name(), self.value())
27888 }
27889}
27890
27891impl std::convert::From<i32> for AttributeConfigLevel {
27892 fn from(value: i32) -> Self {
27893 match value {
27894 0 => Self::Unspecified,
27895 1 => Self::ProductLevelAttributeConfig,
27896 2 => Self::CatalogLevelAttributeConfig,
27897 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27898 wkt::internal::UnknownEnumValue::Integer(value),
27899 )),
27900 }
27901 }
27902}
27903
27904impl std::convert::From<&str> for AttributeConfigLevel {
27905 fn from(value: &str) -> Self {
27906 use std::string::ToString;
27907 match value {
27908 "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27909 "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27910 "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27911 _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27912 wkt::internal::UnknownEnumValue::String(value.to_string()),
27913 )),
27914 }
27915 }
27916}
27917
27918impl serde::ser::Serialize for AttributeConfigLevel {
27919 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27920 where
27921 S: serde::Serializer,
27922 {
27923 match self {
27924 Self::Unspecified => serializer.serialize_i32(0),
27925 Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27926 Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27927 Self::UnknownValue(u) => u.0.serialize(serializer),
27928 }
27929 }
27930}
27931
27932impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27933 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27934 where
27935 D: serde::Deserializer<'de>,
27936 {
27937 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27938 ".google.cloud.retail.v2.AttributeConfigLevel",
27939 ))
27940 }
27941}
27942
27943/// The type of solution.
27944///
27945/// # Working with unknown values
27946///
27947/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27948/// additional enum variants at any time. Adding new variants is not considered
27949/// a breaking change. Applications should write their code in anticipation of:
27950///
27951/// - New values appearing in future releases of the client library, **and**
27952/// - New values received dynamically, without application changes.
27953///
27954/// Please consult the [Working with enums] section in the user guide for some
27955/// guidelines.
27956///
27957/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27958#[derive(Clone, Debug, PartialEq)]
27959#[non_exhaustive]
27960pub enum SolutionType {
27961 /// Default value.
27962 Unspecified,
27963 /// Used for Recommendations AI.
27964 Recommendation,
27965 /// Used for Retail Search.
27966 Search,
27967 /// If set, the enum was initialized with an unknown value.
27968 ///
27969 /// Applications can examine the value using [SolutionType::value] or
27970 /// [SolutionType::name].
27971 UnknownValue(solution_type::UnknownValue),
27972}
27973
27974#[doc(hidden)]
27975pub mod solution_type {
27976 #[allow(unused_imports)]
27977 use super::*;
27978 #[derive(Clone, Debug, PartialEq)]
27979 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27980}
27981
27982impl SolutionType {
27983 /// Gets the enum value.
27984 ///
27985 /// Returns `None` if the enum contains an unknown value deserialized from
27986 /// the string representation of enums.
27987 pub fn value(&self) -> std::option::Option<i32> {
27988 match self {
27989 Self::Unspecified => std::option::Option::Some(0),
27990 Self::Recommendation => std::option::Option::Some(1),
27991 Self::Search => std::option::Option::Some(2),
27992 Self::UnknownValue(u) => u.0.value(),
27993 }
27994 }
27995
27996 /// Gets the enum value as a string.
27997 ///
27998 /// Returns `None` if the enum contains an unknown value deserialized from
27999 /// the integer representation of enums.
28000 pub fn name(&self) -> std::option::Option<&str> {
28001 match self {
28002 Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
28003 Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
28004 Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
28005 Self::UnknownValue(u) => u.0.name(),
28006 }
28007 }
28008}
28009
28010impl std::default::Default for SolutionType {
28011 fn default() -> Self {
28012 use std::convert::From;
28013 Self::from(0)
28014 }
28015}
28016
28017impl std::fmt::Display for SolutionType {
28018 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28019 wkt::internal::display_enum(f, self.name(), self.value())
28020 }
28021}
28022
28023impl std::convert::From<i32> for SolutionType {
28024 fn from(value: i32) -> Self {
28025 match value {
28026 0 => Self::Unspecified,
28027 1 => Self::Recommendation,
28028 2 => Self::Search,
28029 _ => Self::UnknownValue(solution_type::UnknownValue(
28030 wkt::internal::UnknownEnumValue::Integer(value),
28031 )),
28032 }
28033 }
28034}
28035
28036impl std::convert::From<&str> for SolutionType {
28037 fn from(value: &str) -> Self {
28038 use std::string::ToString;
28039 match value {
28040 "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
28041 "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
28042 "SOLUTION_TYPE_SEARCH" => Self::Search,
28043 _ => Self::UnknownValue(solution_type::UnknownValue(
28044 wkt::internal::UnknownEnumValue::String(value.to_string()),
28045 )),
28046 }
28047 }
28048}
28049
28050impl serde::ser::Serialize for SolutionType {
28051 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28052 where
28053 S: serde::Serializer,
28054 {
28055 match self {
28056 Self::Unspecified => serializer.serialize_i32(0),
28057 Self::Recommendation => serializer.serialize_i32(1),
28058 Self::Search => serializer.serialize_i32(2),
28059 Self::UnknownValue(u) => u.0.serialize(serializer),
28060 }
28061 }
28062}
28063
28064impl<'de> serde::de::Deserialize<'de> for SolutionType {
28065 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28066 where
28067 D: serde::Deserializer<'de>,
28068 {
28069 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
28070 ".google.cloud.retail.v2.SolutionType",
28071 ))
28072 }
28073}
28074
28075/// If filtering for recommendations is enabled.
28076///
28077/// # Working with unknown values
28078///
28079/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28080/// additional enum variants at any time. Adding new variants is not considered
28081/// a breaking change. Applications should write their code in anticipation of:
28082///
28083/// - New values appearing in future releases of the client library, **and**
28084/// - New values received dynamically, without application changes.
28085///
28086/// Please consult the [Working with enums] section in the user guide for some
28087/// guidelines.
28088///
28089/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28090#[derive(Clone, Debug, PartialEq)]
28091#[non_exhaustive]
28092pub enum RecommendationsFilteringOption {
28093 /// Value used when unset.
28094 /// In this case, server behavior defaults to
28095 /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
28096 ///
28097 /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
28098 Unspecified,
28099 /// Recommendation filtering is disabled.
28100 RecommendationsFilteringDisabled,
28101 /// Recommendation filtering is enabled.
28102 RecommendationsFilteringEnabled,
28103 /// If set, the enum was initialized with an unknown value.
28104 ///
28105 /// Applications can examine the value using [RecommendationsFilteringOption::value] or
28106 /// [RecommendationsFilteringOption::name].
28107 UnknownValue(recommendations_filtering_option::UnknownValue),
28108}
28109
28110#[doc(hidden)]
28111pub mod recommendations_filtering_option {
28112 #[allow(unused_imports)]
28113 use super::*;
28114 #[derive(Clone, Debug, PartialEq)]
28115 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28116}
28117
28118impl RecommendationsFilteringOption {
28119 /// Gets the enum value.
28120 ///
28121 /// Returns `None` if the enum contains an unknown value deserialized from
28122 /// the string representation of enums.
28123 pub fn value(&self) -> std::option::Option<i32> {
28124 match self {
28125 Self::Unspecified => std::option::Option::Some(0),
28126 Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
28127 Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
28128 Self::UnknownValue(u) => u.0.value(),
28129 }
28130 }
28131
28132 /// Gets the enum value as a string.
28133 ///
28134 /// Returns `None` if the enum contains an unknown value deserialized from
28135 /// the integer representation of enums.
28136 pub fn name(&self) -> std::option::Option<&str> {
28137 match self {
28138 Self::Unspecified => {
28139 std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
28140 }
28141 Self::RecommendationsFilteringDisabled => {
28142 std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
28143 }
28144 Self::RecommendationsFilteringEnabled => {
28145 std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
28146 }
28147 Self::UnknownValue(u) => u.0.name(),
28148 }
28149 }
28150}
28151
28152impl std::default::Default for RecommendationsFilteringOption {
28153 fn default() -> Self {
28154 use std::convert::From;
28155 Self::from(0)
28156 }
28157}
28158
28159impl std::fmt::Display for RecommendationsFilteringOption {
28160 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28161 wkt::internal::display_enum(f, self.name(), self.value())
28162 }
28163}
28164
28165impl std::convert::From<i32> for RecommendationsFilteringOption {
28166 fn from(value: i32) -> Self {
28167 match value {
28168 0 => Self::Unspecified,
28169 1 => Self::RecommendationsFilteringDisabled,
28170 3 => Self::RecommendationsFilteringEnabled,
28171 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28172 wkt::internal::UnknownEnumValue::Integer(value),
28173 )),
28174 }
28175 }
28176}
28177
28178impl std::convert::From<&str> for RecommendationsFilteringOption {
28179 fn from(value: &str) -> Self {
28180 use std::string::ToString;
28181 match value {
28182 "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
28183 "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
28184 "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
28185 _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28186 wkt::internal::UnknownEnumValue::String(value.to_string()),
28187 )),
28188 }
28189 }
28190}
28191
28192impl serde::ser::Serialize for RecommendationsFilteringOption {
28193 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28194 where
28195 S: serde::Serializer,
28196 {
28197 match self {
28198 Self::Unspecified => serializer.serialize_i32(0),
28199 Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
28200 Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
28201 Self::UnknownValue(u) => u.0.serialize(serializer),
28202 }
28203 }
28204}
28205
28206impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
28207 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28208 where
28209 D: serde::Deserializer<'de>,
28210 {
28211 deserializer.deserialize_any(
28212 wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
28213 ".google.cloud.retail.v2.RecommendationsFilteringOption",
28214 ),
28215 )
28216 }
28217}
28218
28219/// The use case of Cloud Retail Search.
28220///
28221/// # Working with unknown values
28222///
28223/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28224/// additional enum variants at any time. Adding new variants is not considered
28225/// a breaking change. Applications should write their code in anticipation of:
28226///
28227/// - New values appearing in future releases of the client library, **and**
28228/// - New values received dynamically, without application changes.
28229///
28230/// Please consult the [Working with enums] section in the user guide for some
28231/// guidelines.
28232///
28233/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28234#[derive(Clone, Debug, PartialEq)]
28235#[non_exhaustive]
28236pub enum SearchSolutionUseCase {
28237 /// The value when it's unspecified. In this case, server behavior defaults to
28238 /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
28239 ///
28240 /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
28241 Unspecified,
28242 /// Search use case. Expects the traffic has a non-empty
28243 /// [query][google.cloud.retail.v2.SearchRequest.query].
28244 ///
28245 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28246 Search,
28247 /// Browse use case. Expects the traffic has an empty
28248 /// [query][google.cloud.retail.v2.SearchRequest.query].
28249 ///
28250 /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28251 Browse,
28252 /// If set, the enum was initialized with an unknown value.
28253 ///
28254 /// Applications can examine the value using [SearchSolutionUseCase::value] or
28255 /// [SearchSolutionUseCase::name].
28256 UnknownValue(search_solution_use_case::UnknownValue),
28257}
28258
28259#[doc(hidden)]
28260pub mod search_solution_use_case {
28261 #[allow(unused_imports)]
28262 use super::*;
28263 #[derive(Clone, Debug, PartialEq)]
28264 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28265}
28266
28267impl SearchSolutionUseCase {
28268 /// Gets the enum value.
28269 ///
28270 /// Returns `None` if the enum contains an unknown value deserialized from
28271 /// the string representation of enums.
28272 pub fn value(&self) -> std::option::Option<i32> {
28273 match self {
28274 Self::Unspecified => std::option::Option::Some(0),
28275 Self::Search => std::option::Option::Some(1),
28276 Self::Browse => std::option::Option::Some(2),
28277 Self::UnknownValue(u) => u.0.value(),
28278 }
28279 }
28280
28281 /// Gets the enum value as a string.
28282 ///
28283 /// Returns `None` if the enum contains an unknown value deserialized from
28284 /// the integer representation of enums.
28285 pub fn name(&self) -> std::option::Option<&str> {
28286 match self {
28287 Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
28288 Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
28289 Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
28290 Self::UnknownValue(u) => u.0.name(),
28291 }
28292 }
28293}
28294
28295impl std::default::Default for SearchSolutionUseCase {
28296 fn default() -> Self {
28297 use std::convert::From;
28298 Self::from(0)
28299 }
28300}
28301
28302impl std::fmt::Display for SearchSolutionUseCase {
28303 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28304 wkt::internal::display_enum(f, self.name(), self.value())
28305 }
28306}
28307
28308impl std::convert::From<i32> for SearchSolutionUseCase {
28309 fn from(value: i32) -> Self {
28310 match value {
28311 0 => Self::Unspecified,
28312 1 => Self::Search,
28313 2 => Self::Browse,
28314 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28315 wkt::internal::UnknownEnumValue::Integer(value),
28316 )),
28317 }
28318 }
28319}
28320
28321impl std::convert::From<&str> for SearchSolutionUseCase {
28322 fn from(value: &str) -> Self {
28323 use std::string::ToString;
28324 match value {
28325 "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
28326 "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
28327 "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
28328 _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28329 wkt::internal::UnknownEnumValue::String(value.to_string()),
28330 )),
28331 }
28332 }
28333}
28334
28335impl serde::ser::Serialize for SearchSolutionUseCase {
28336 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28337 where
28338 S: serde::Serializer,
28339 {
28340 match self {
28341 Self::Unspecified => serializer.serialize_i32(0),
28342 Self::Search => serializer.serialize_i32(1),
28343 Self::Browse => serializer.serialize_i32(2),
28344 Self::UnknownValue(u) => u.0.serialize(serializer),
28345 }
28346 }
28347}
28348
28349impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
28350 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28351 where
28352 D: serde::Deserializer<'de>,
28353 {
28354 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
28355 ".google.cloud.retail.v2.SearchSolutionUseCase",
28356 ))
28357 }
28358}
28359
28360/// Harm categories that will block the content.
28361///
28362/// # Working with unknown values
28363///
28364/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28365/// additional enum variants at any time. Adding new variants is not considered
28366/// a breaking change. Applications should write their code in anticipation of:
28367///
28368/// - New values appearing in future releases of the client library, **and**
28369/// - New values received dynamically, without application changes.
28370///
28371/// Please consult the [Working with enums] section in the user guide for some
28372/// guidelines.
28373///
28374/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28375#[derive(Clone, Debug, PartialEq)]
28376#[non_exhaustive]
28377pub enum HarmCategory {
28378 /// The harm category is unspecified.
28379 Unspecified,
28380 /// The harm category is hate speech.
28381 HateSpeech,
28382 /// The harm category is dangerous content.
28383 DangerousContent,
28384 /// The harm category is harassment.
28385 Harassment,
28386 /// The harm category is sexually explicit content.
28387 SexuallyExplicit,
28388 /// The harm category is civic integrity.
28389 CivicIntegrity,
28390 /// If set, the enum was initialized with an unknown value.
28391 ///
28392 /// Applications can examine the value using [HarmCategory::value] or
28393 /// [HarmCategory::name].
28394 UnknownValue(harm_category::UnknownValue),
28395}
28396
28397#[doc(hidden)]
28398pub mod harm_category {
28399 #[allow(unused_imports)]
28400 use super::*;
28401 #[derive(Clone, Debug, PartialEq)]
28402 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28403}
28404
28405impl HarmCategory {
28406 /// Gets the enum value.
28407 ///
28408 /// Returns `None` if the enum contains an unknown value deserialized from
28409 /// the string representation of enums.
28410 pub fn value(&self) -> std::option::Option<i32> {
28411 match self {
28412 Self::Unspecified => std::option::Option::Some(0),
28413 Self::HateSpeech => std::option::Option::Some(1),
28414 Self::DangerousContent => std::option::Option::Some(2),
28415 Self::Harassment => std::option::Option::Some(3),
28416 Self::SexuallyExplicit => std::option::Option::Some(4),
28417 Self::CivicIntegrity => std::option::Option::Some(5),
28418 Self::UnknownValue(u) => u.0.value(),
28419 }
28420 }
28421
28422 /// Gets the enum value as a string.
28423 ///
28424 /// Returns `None` if the enum contains an unknown value deserialized from
28425 /// the integer representation of enums.
28426 pub fn name(&self) -> std::option::Option<&str> {
28427 match self {
28428 Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28429 Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28430 Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28431 Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28432 Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28433 Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28434 Self::UnknownValue(u) => u.0.name(),
28435 }
28436 }
28437}
28438
28439impl std::default::Default for HarmCategory {
28440 fn default() -> Self {
28441 use std::convert::From;
28442 Self::from(0)
28443 }
28444}
28445
28446impl std::fmt::Display for HarmCategory {
28447 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28448 wkt::internal::display_enum(f, self.name(), self.value())
28449 }
28450}
28451
28452impl std::convert::From<i32> for HarmCategory {
28453 fn from(value: i32) -> Self {
28454 match value {
28455 0 => Self::Unspecified,
28456 1 => Self::HateSpeech,
28457 2 => Self::DangerousContent,
28458 3 => Self::Harassment,
28459 4 => Self::SexuallyExplicit,
28460 5 => Self::CivicIntegrity,
28461 _ => Self::UnknownValue(harm_category::UnknownValue(
28462 wkt::internal::UnknownEnumValue::Integer(value),
28463 )),
28464 }
28465 }
28466}
28467
28468impl std::convert::From<&str> for HarmCategory {
28469 fn from(value: &str) -> Self {
28470 use std::string::ToString;
28471 match value {
28472 "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28473 "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28474 "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28475 "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28476 "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28477 "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28478 _ => Self::UnknownValue(harm_category::UnknownValue(
28479 wkt::internal::UnknownEnumValue::String(value.to_string()),
28480 )),
28481 }
28482 }
28483}
28484
28485impl serde::ser::Serialize for HarmCategory {
28486 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28487 where
28488 S: serde::Serializer,
28489 {
28490 match self {
28491 Self::Unspecified => serializer.serialize_i32(0),
28492 Self::HateSpeech => serializer.serialize_i32(1),
28493 Self::DangerousContent => serializer.serialize_i32(2),
28494 Self::Harassment => serializer.serialize_i32(3),
28495 Self::SexuallyExplicit => serializer.serialize_i32(4),
28496 Self::CivicIntegrity => serializer.serialize_i32(5),
28497 Self::UnknownValue(u) => u.0.serialize(serializer),
28498 }
28499 }
28500}
28501
28502impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28503 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28504 where
28505 D: serde::Deserializer<'de>,
28506 {
28507 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28508 ".google.cloud.retail.v2.HarmCategory",
28509 ))
28510 }
28511}