#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_api;
extern crate google_cloud_gax;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
extern crate google_cloud_rpc;
extern crate google_cloud_type;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductLevelConfig {
pub ingestion_product_type: std::string::String,
pub merchant_center_product_id_field: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductLevelConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.ingestion_product_type = v.into();
self
}
pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.merchant_center_product_id_field = v.into();
self
}
}
impl wkt::message::Message for ProductLevelConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CatalogAttribute {
pub key: std::string::String,
pub in_use: bool,
pub r#type: crate::model::catalog_attribute::AttributeType,
pub indexable_option: crate::model::catalog_attribute::IndexableOption,
pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
pub searchable_option: crate::model::catalog_attribute::SearchableOption,
pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CatalogAttribute {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.in_use = v.into();
self
}
pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
pub fn set_indexable_option<
T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
>(
mut self,
v: T,
) -> Self {
self.indexable_option = v.into();
self
}
pub fn set_dynamic_facetable_option<
T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
>(
mut self,
v: T,
) -> Self {
self.dynamic_facetable_option = v.into();
self
}
pub fn set_searchable_option<
T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
>(
mut self,
v: T,
) -> Self {
self.searchable_option = v.into();
self
}
pub fn set_exact_searchable_option<
T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
>(
mut self,
v: T,
) -> Self {
self.exact_searchable_option = v.into();
self
}
pub fn set_retrievable_option<
T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
>(
mut self,
v: T,
) -> Self {
self.retrievable_option = v.into();
self
}
pub fn set_facet_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
{
self.facet_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
{
self.facet_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CatalogAttribute {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
}
}
pub mod catalog_attribute {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FacetConfig {
pub facet_intervals: std::vec::Vec<crate::model::Interval>,
pub ignored_facet_values:
std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
pub merged_facet_values:
std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
pub merged_facet:
std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
pub rerank_config:
std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FacetConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Interval>,
{
use std::iter::Iterator;
self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
>,
{
use std::iter::Iterator;
self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
{
use std::iter::Iterator;
self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_merged_facet<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
{
self.merged_facet = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
{
self.merged_facet = v.map(|x| x.into());
self
}
pub fn set_rerank_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
{
self.rerank_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
{
self.rerank_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FacetConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
}
}
pub mod facet_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IgnoredFacetValues {
pub values: std::vec::Vec<std::string::String>,
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IgnoredFacetValues {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for IgnoredFacetValues {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MergedFacetValue {
pub values: std::vec::Vec<std::string::String>,
pub merged_value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MergedFacetValue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.merged_value = v.into();
self
}
}
impl wkt::message::Message for MergedFacetValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MergedFacet {
pub merged_facet_key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MergedFacet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.merged_facet_key = v.into();
self
}
}
impl wkt::message::Message for MergedFacet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RerankConfig {
pub rerank_facet: bool,
pub facet_values: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RerankConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.rerank_facet = v.into();
self
}
pub fn set_facet_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.facet_values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RerankConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttributeType {
Unknown,
Textual,
Numerical,
UnknownValue(attribute_type::UnknownValue),
}
#[doc(hidden)]
pub mod attribute_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttributeType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unknown => std::option::Option::Some(0),
Self::Textual => std::option::Option::Some(1),
Self::Numerical => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::Textual => std::option::Option::Some("TEXTUAL"),
Self::Numerical => std::option::Option::Some("NUMERICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttributeType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttributeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttributeType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unknown,
1 => Self::Textual,
2 => Self::Numerical,
_ => Self::UnknownValue(attribute_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttributeType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UNKNOWN" => Self::Unknown,
"TEXTUAL" => Self::Textual,
"NUMERICAL" => Self::Numerical,
_ => Self::UnknownValue(attribute_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttributeType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unknown => serializer.serialize_i32(0),
Self::Textual => serializer.serialize_i32(1),
Self::Numerical => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttributeType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
".google.cloud.retail.v2.CatalogAttribute.AttributeType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IndexableOption {
Unspecified,
IndexableEnabled,
IndexableDisabled,
UnknownValue(indexable_option::UnknownValue),
}
#[doc(hidden)]
pub mod indexable_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IndexableOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::IndexableEnabled => std::option::Option::Some(1),
Self::IndexableDisabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IndexableOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IndexableOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for IndexableOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::IndexableEnabled,
2 => Self::IndexableDisabled,
_ => Self::UnknownValue(indexable_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IndexableOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
"INDEXABLE_ENABLED" => Self::IndexableEnabled,
"INDEXABLE_DISABLED" => Self::IndexableDisabled,
_ => Self::UnknownValue(indexable_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IndexableOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::IndexableEnabled => serializer.serialize_i32(1),
Self::IndexableDisabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IndexableOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DynamicFacetableOption {
Unspecified,
DynamicFacetableEnabled,
DynamicFacetableDisabled,
UnknownValue(dynamic_facetable_option::UnknownValue),
}
#[doc(hidden)]
pub mod dynamic_facetable_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DynamicFacetableOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DynamicFacetableEnabled => std::option::Option::Some(1),
Self::DynamicFacetableDisabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
}
Self::DynamicFacetableEnabled => {
std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
}
Self::DynamicFacetableDisabled => {
std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DynamicFacetableOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DynamicFacetableOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DynamicFacetableOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DynamicFacetableEnabled,
2 => Self::DynamicFacetableDisabled,
_ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DynamicFacetableOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
"DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
"DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
_ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DynamicFacetableOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SearchableOption {
Unspecified,
SearchableEnabled,
SearchableDisabled,
UnknownValue(searchable_option::UnknownValue),
}
#[doc(hidden)]
pub mod searchable_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SearchableOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SearchableEnabled => std::option::Option::Some(1),
Self::SearchableDisabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SearchableOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SearchableOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SearchableOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SearchableEnabled,
2 => Self::SearchableDisabled,
_ => Self::UnknownValue(searchable_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SearchableOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
"SEARCHABLE_ENABLED" => Self::SearchableEnabled,
"SEARCHABLE_DISABLED" => Self::SearchableDisabled,
_ => Self::UnknownValue(searchable_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SearchableOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::SearchableEnabled => serializer.serialize_i32(1),
Self::SearchableDisabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SearchableOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ExactSearchableOption {
Unspecified,
ExactSearchableEnabled,
ExactSearchableDisabled,
UnknownValue(exact_searchable_option::UnknownValue),
}
#[doc(hidden)]
pub mod exact_searchable_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ExactSearchableOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ExactSearchableEnabled => std::option::Option::Some(1),
Self::ExactSearchableDisabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
}
Self::ExactSearchableEnabled => {
std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
}
Self::ExactSearchableDisabled => {
std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ExactSearchableOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ExactSearchableOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ExactSearchableOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ExactSearchableEnabled,
2 => Self::ExactSearchableDisabled,
_ => Self::UnknownValue(exact_searchable_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ExactSearchableOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
"EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
"EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
_ => Self::UnknownValue(exact_searchable_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ExactSearchableOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ExactSearchableEnabled => serializer.serialize_i32(1),
Self::ExactSearchableDisabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RetrievableOption {
Unspecified,
RetrievableEnabled,
RetrievableDisabled,
UnknownValue(retrievable_option::UnknownValue),
}
#[doc(hidden)]
pub mod retrievable_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RetrievableOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RetrievableEnabled => std::option::Option::Some(1),
Self::RetrievableDisabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RetrievableOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RetrievableOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RetrievableOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::RetrievableEnabled,
2 => Self::RetrievableDisabled,
_ => Self::UnknownValue(retrievable_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RetrievableOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
"RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
"RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
_ => Self::UnknownValue(retrievable_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RetrievableOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RetrievableEnabled => serializer.serialize_i32(1),
Self::RetrievableDisabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttributesConfig {
pub name: std::string::String,
pub catalog_attributes:
std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
pub attribute_config_level: crate::model::AttributeConfigLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttributesConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::CatalogAttribute>,
{
use std::iter::Iterator;
self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
mut self,
v: T,
) -> Self {
self.attribute_config_level = v.into();
self
}
}
impl wkt::message::Message for AttributesConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompletionConfig {
pub name: std::string::String,
pub matching_order: std::string::String,
pub max_suggestions: i32,
pub min_prefix_length: i32,
pub auto_learning: bool,
pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
pub last_suggestions_import_operation: std::string::String,
pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
pub last_denylist_import_operation: std::string::String,
pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
pub last_allowlist_import_operation: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompletionConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.matching_order = v.into();
self
}
pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_suggestions = v.into();
self
}
pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.min_prefix_length = v.into();
self
}
pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.auto_learning = v.into();
self
}
pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.suggestions_input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.suggestions_input_config = v.map(|x| x.into());
self
}
pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.last_suggestions_import_operation = v.into();
self
}
pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.denylist_input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.denylist_input_config = v.map(|x| x.into());
self
}
pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.last_denylist_import_operation = v.into();
self
}
pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.allowlist_input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.allowlist_input_config = v.map(|x| x.into());
self
}
pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.last_allowlist_import_operation = v.into();
self
}
}
impl wkt::message::Message for CompletionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Catalog {
pub name: std::string::String,
pub display_name: std::string::String,
pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Catalog {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_product_level_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductLevelConfig>,
{
self.product_level_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ProductLevelConfig>,
{
self.product_level_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Catalog {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Catalog"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListCatalogsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListCatalogsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListCatalogsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListCatalogsResponse {
pub catalogs: std::vec::Vec<crate::model::Catalog>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListCatalogsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalogs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Catalog>,
{
use std::iter::Iterator;
self.catalogs = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListCatalogsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
type PageItem = crate::model::Catalog;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.catalogs
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateCatalogRequest {
pub catalog: std::option::Option<crate::model::Catalog>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateCatalogRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Catalog>,
{
self.catalog = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Catalog>,
{
self.catalog = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateCatalogRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetDefaultBranchRequest {
pub catalog: std::string::String,
pub branch_id: std::string::String,
pub note: std::string::String,
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SetDefaultBranchRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.branch_id = v.into();
self
}
pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note = v.into();
self
}
pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
impl wkt::message::Message for SetDefaultBranchRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDefaultBranchRequest {
pub catalog: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetDefaultBranchRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
}
impl wkt::message::Message for GetDefaultBranchRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDefaultBranchResponse {
pub branch: std::string::String,
pub set_time: std::option::Option<wkt::Timestamp>,
pub note: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetDefaultBranchResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.branch = v.into();
self
}
pub fn set_set_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.set_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.set_time = v.map(|x| x.into());
self
}
pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note = v.into();
self
}
}
impl wkt::message::Message for GetDefaultBranchResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetCompletionConfigRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetCompletionConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetCompletionConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateCompletionConfigRequest {
pub completion_config: std::option::Option<crate::model::CompletionConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateCompletionConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_completion_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionConfig>,
{
self.completion_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionConfig>,
{
self.completion_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateCompletionConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAttributesConfigRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetAttributesConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetAttributesConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAttributesConfigRequest {
pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateAttributesConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attributes_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AttributesConfig>,
{
self.attributes_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AttributesConfig>,
{
self.attributes_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateAttributesConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddCatalogAttributeRequest {
pub attributes_config: std::string::String,
pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddCatalogAttributeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attributes_config = v.into();
self
}
pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CatalogAttribute>,
{
self.catalog_attribute = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CatalogAttribute>,
{
self.catalog_attribute = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AddCatalogAttributeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveCatalogAttributeRequest {
pub attributes_config: std::string::String,
pub key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveCatalogAttributeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attributes_config = v.into();
self
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
}
impl wkt::message::Message for RemoveCatalogAttributeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReplaceCatalogAttributeRequest {
pub attributes_config: std::string::String,
pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReplaceCatalogAttributeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attributes_config = v.into();
self
}
pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CatalogAttribute>,
{
self.catalog_attribute = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CatalogAttribute>,
{
self.catalog_attribute = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ReplaceCatalogAttributeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Condition {
pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
pub page_categories: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Condition {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::condition::QueryTerm>,
{
use std::iter::Iterator;
self.query_terms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::condition::TimeRange>,
{
use std::iter::Iterator;
self.active_time_range = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_page_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.page_categories = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Condition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Condition"
}
}
pub mod condition {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryTerm {
pub value: std::string::String,
pub full_match: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryTerm {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.full_match = v.into();
self
}
}
impl wkt::message::Message for QueryTerm {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TimeRange {
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TimeRange {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TimeRange {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Rule {
pub condition: std::option::Option<crate::model::Condition>,
pub action: std::option::Option<crate::model::rule::Action>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Rule {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_condition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Condition>,
{
self.condition = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Condition>,
{
self.condition = v.map(|x| x.into());
self
}
pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
mut self,
v: T,
) -> Self {
self.action = v.into();
self
}
pub fn boost_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_boost_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
>(
mut self,
v: T,
) -> Self {
self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
self
}
pub fn redirect_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_redirect_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
self
}
pub fn oneway_synonyms_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_oneway_synonyms_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
self
}
pub fn do_not_associate_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_do_not_associate_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
self
}
pub fn replacement_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_replacement_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
self
}
pub fn ignore_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_ignore_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
>(
mut self,
v: T,
) -> Self {
self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
self
}
pub fn filter_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_filter_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
>(
mut self,
v: T,
) -> Self {
self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
self
}
pub fn twoway_synonyms_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_twoway_synonyms_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
self
}
pub fn force_return_facet_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_force_return_facet_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
self
}
pub fn remove_facet_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_remove_facet_action<
T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
>(
mut self,
v: T,
) -> Self {
self.action =
std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
self
}
pub fn pin_action(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
#[allow(unreachable_patterns)]
self.action.as_ref().and_then(|v| match v {
crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
mut self,
v: T,
) -> Self {
self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
self
}
}
impl wkt::message::Message for Rule {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule"
}
}
pub mod rule {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostAction {
pub boost: f32,
pub products_filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BoostAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.products_filter = v.into();
self
}
}
impl wkt::message::Message for BoostAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FilterAction {
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FilterAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for FilterAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RedirectAction {
pub redirect_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RedirectAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.redirect_uri = v.into();
self
}
}
impl wkt::message::Message for RedirectAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TwowaySynonymsAction {
pub synonyms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TwowaySynonymsAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_synonyms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.synonyms = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TwowaySynonymsAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OnewaySynonymsAction {
pub query_terms: std::vec::Vec<std::string::String>,
pub synonyms: std::vec::Vec<std::string::String>,
pub oneway_terms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OnewaySynonymsAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.query_terms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_synonyms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.synonyms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for OnewaySynonymsAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DoNotAssociateAction {
pub query_terms: std::vec::Vec<std::string::String>,
pub do_not_associate_terms: std::vec::Vec<std::string::String>,
pub terms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DoNotAssociateAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.query_terms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.terms = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DoNotAssociateAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReplacementAction {
pub query_terms: std::vec::Vec<std::string::String>,
pub replacement_term: std::string::String,
pub term: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReplacementAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.query_terms = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.replacement_term = v.into();
self
}
pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.term = v.into();
self
}
}
impl wkt::message::Message for ReplacementAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IgnoreAction {
pub ignore_terms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IgnoreAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IgnoreAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ForceReturnFacetAction {
pub facet_position_adjustments:
std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ForceReturnFacetAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
>,
{
use std::iter::Iterator;
self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ForceReturnFacetAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
}
}
pub mod force_return_facet_action {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FacetPositionAdjustment {
pub attribute_name: std::string::String,
pub position: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FacetPositionAdjustment {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attribute_name = v.into();
self
}
pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.position = v.into();
self
}
}
impl wkt::message::Message for FacetPositionAdjustment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveFacetAction {
pub attribute_names: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveFacetAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.attribute_names = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RemoveFacetAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PinAction {
pub pin_map: std::collections::HashMap<i64, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PinAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<i64>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for PinAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Action {
BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
PinAction(std::boxed::Box<crate::model::rule::PinAction>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Audience {
pub genders: std::vec::Vec<std::string::String>,
pub age_groups: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Audience {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_genders<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.genders = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_age_groups<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.age_groups = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Audience {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Audience"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ColorInfo {
pub color_families: std::vec::Vec<std::string::String>,
pub colors: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ColorInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_color_families<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.color_families = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_colors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.colors = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ColorInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ColorInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomAttribute {
pub text: std::vec::Vec<std::string::String>,
pub numbers: std::vec::Vec<f64>,
#[deprecated]
pub searchable: std::option::Option<bool>,
#[deprecated]
pub indexable: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CustomAttribute {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_text<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.text = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_numbers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<f64>,
{
use std::iter::Iterator;
self.numbers = v.into_iter().map(|i| i.into()).collect();
self
}
#[deprecated]
pub fn set_searchable<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.searchable = std::option::Option::Some(v.into());
self
}
#[deprecated]
pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.searchable = v.map(|x| x.into());
self
}
#[deprecated]
pub fn set_indexable<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.indexable = std::option::Option::Some(v.into());
self
}
#[deprecated]
pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.indexable = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CustomAttribute {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FulfillmentInfo {
pub r#type: std::string::String,
pub place_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FulfillmentInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_place_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.place_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for FulfillmentInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Image {
pub uri: std::string::String,
pub height: i32,
pub width: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Image {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.height = v.into();
self
}
pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.width = v.into();
self
}
}
impl wkt::message::Message for Image {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Image"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Interval {
pub min: std::option::Option<crate::model::interval::Min>,
pub max: std::option::Option<crate::model::interval::Max>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Interval {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
mut self,
v: T,
) -> Self {
self.min = v.into();
self
}
pub fn minimum(&self) -> std::option::Option<&f64> {
#[allow(unreachable_patterns)]
self.min.as_ref().and_then(|v| match v {
crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
self
}
pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
#[allow(unreachable_patterns)]
self.min.as_ref().and_then(|v| match v {
crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.min =
std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
self
}
pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
mut self,
v: T,
) -> Self {
self.max = v.into();
self
}
pub fn maximum(&self) -> std::option::Option<&f64> {
#[allow(unreachable_patterns)]
self.max.as_ref().and_then(|v| match v {
crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
self
}
pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
#[allow(unreachable_patterns)]
self.max.as_ref().and_then(|v| match v {
crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.max =
std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
self
}
}
impl wkt::message::Message for Interval {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Interval"
}
}
pub mod interval {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Min {
Minimum(f64),
ExclusiveMinimum(f64),
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Max {
Maximum(f64),
ExclusiveMaximum(f64),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PriceInfo {
pub currency_code: std::string::String,
pub price: f32,
pub original_price: f32,
pub cost: f32,
pub price_effective_time: std::option::Option<wkt::Timestamp>,
pub price_expire_time: std::option::Option<wkt::Timestamp>,
pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PriceInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.currency_code = v.into();
self
}
pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.price = v.into();
self
}
pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.original_price = v.into();
self
}
pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.cost = v.into();
self
}
pub fn set_price_effective_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.price_effective_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.price_effective_time = v.map(|x| x.into());
self
}
pub fn set_price_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.price_expire_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.price_expire_time = v.map(|x| x.into());
self
}
pub fn set_price_range<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::price_info::PriceRange>,
{
self.price_range = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::price_info::PriceRange>,
{
self.price_range = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PriceInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PriceInfo"
}
}
pub mod price_info {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PriceRange {
pub price: std::option::Option<crate::model::Interval>,
pub original_price: std::option::Option<crate::model::Interval>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PriceRange {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_price<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.price = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.price = v.map(|x| x.into());
self
}
pub fn set_original_price<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.original_price = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.original_price = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PriceRange {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Rating {
pub rating_count: i32,
pub average_rating: f32,
pub rating_histogram: std::vec::Vec<i32>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Rating {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.rating_count = v.into();
self
}
pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.average_rating = v.into();
self
}
pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Rating {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Rating"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserInfo {
pub user_id: std::string::String,
pub ip_address: std::string::String,
pub user_agent: std::string::String,
pub direct_user_request: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_id = v.into();
self
}
pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ip_address = v.into();
self
}
pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_agent = v.into();
self
}
pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.direct_user_request = v.into();
self
}
}
impl wkt::message::Message for UserInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UserInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocalInventory {
pub place_id: std::string::String,
pub price_info: std::option::Option<crate::model::PriceInfo>,
pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
pub fulfillment_types: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocalInventory {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.place_id = v.into();
self
}
pub fn set_price_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PriceInfo>,
{
self.price_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PriceInfo>,
{
self.price_info = v.map(|x| x.into());
self
}
pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::CustomAttribute>,
{
use std::iter::Iterator;
self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for LocalInventory {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.LocalInventory"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PinControlMetadata {
pub all_matched_pins:
std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
pub dropped_pins:
std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PinControlMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<i64>,
V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
{
use std::iter::Iterator;
self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<i64>,
V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
{
use std::iter::Iterator;
self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for PinControlMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
}
}
pub mod pin_control_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductPins {
pub product_id: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductPins {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_id<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.product_id = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ProductPins {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StringList {
pub values: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StringList {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StringList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.StringList"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DoubleList {
pub values: std::vec::Vec<f64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DoubleList {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<f64>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DoubleList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.DoubleList"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompleteQueryRequest {
pub catalog: std::string::String,
pub query: std::string::String,
pub visitor_id: std::string::String,
pub language_codes: std::vec::Vec<std::string::String>,
pub device_type: std::string::String,
pub dataset: std::string::String,
pub max_suggestions: i32,
pub enable_attribute_suggestions: bool,
pub entity: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompleteQueryRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.visitor_id = v.into();
self
}
pub fn set_language_codes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.language_codes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.device_type = v.into();
self
}
pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset = v.into();
self
}
pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_suggestions = v.into();
self
}
pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_attribute_suggestions = v.into();
self
}
pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entity = v.into();
self
}
}
impl wkt::message::Message for CompleteQueryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompleteQueryResponse {
pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
pub attribution_token: std::string::String,
#[deprecated]
pub recent_search_results:
std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
pub attribute_results: std::collections::HashMap<
std::string::String,
crate::model::complete_query_response::AttributeResult,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompleteQueryResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_completion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
{
use std::iter::Iterator;
self.completion_results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attribution_token = v.into();
self
}
#[deprecated]
pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
{
use std::iter::Iterator;
self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
{
use std::iter::Iterator;
self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for CompleteQueryResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
}
}
pub mod complete_query_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompletionResult {
pub suggestion: std::string::String,
pub attributes:
std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompletionResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.suggestion = v.into();
self
}
pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::CustomAttribute>,
{
use std::iter::Iterator;
self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for CompletionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
#[deprecated]
pub struct RecentSearchResult {
pub recent_search: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecentSearchResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.recent_search = v.into();
self
}
}
impl wkt::message::Message for RecentSearchResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttributeResult {
pub suggestions: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttributeResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_suggestions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.suggestions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AttributeResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Control {
pub name: std::string::String,
pub display_name: std::string::String,
pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
pub solution_types: std::vec::Vec<crate::model::SolutionType>,
pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
pub control: std::option::Option<crate::model::control::Control>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Control {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_solution_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SolutionType>,
{
use std::iter::Iterator;
self.solution_types = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SearchSolutionUseCase>,
{
use std::iter::Iterator;
self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_control<
T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
>(
mut self,
v: T,
) -> Self {
self.control = v.into();
self
}
pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
#[allow(unreachable_patterns)]
self.control.as_ref().and_then(|v| match v {
crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
mut self,
v: T,
) -> Self {
self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
self
}
}
impl wkt::message::Message for Control {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Control"
}
}
pub mod control {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Control {
Rule(std::boxed::Box<crate::model::Rule>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateControlRequest {
pub parent: std::string::String,
pub control: std::option::Option<crate::model::Control>,
pub control_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_control<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Control>,
{
self.control = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Control>,
{
self.control = v.map(|x| x.into());
self
}
pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.control_id = v.into();
self
}
}
impl wkt::message::Message for CreateControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateControlRequest {
pub control: std::option::Option<crate::model::Control>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_control<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Control>,
{
self.control = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Control>,
{
self.control = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteControlRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetControlRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListControlsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListControlsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ListControlsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListControlsResponse {
pub controls: std::vec::Vec<crate::model::Control>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListControlsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_controls<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Control>,
{
use std::iter::Iterator;
self.controls = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListControlsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
type PageItem = crate::model::Control;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.controls
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalSearchRequest {
pub placement: std::string::String,
pub branch: std::string::String,
pub query: std::string::String,
pub page_categories: std::vec::Vec<std::string::String>,
pub conversation_id: std::string::String,
pub search_params:
std::option::Option<crate::model::conversational_search_request::SearchParams>,
pub visitor_id: std::string::String,
pub user_info: std::option::Option<crate::model::UserInfo>,
pub conversational_filtering_spec: std::option::Option<
crate::model::conversational_search_request::ConversationalFilteringSpec,
>,
pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalSearchRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.placement = v.into();
self
}
pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.branch = v.into();
self
}
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
pub fn set_page_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.page_categories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation_id = v.into();
self
}
pub fn set_search_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
{
self.search_params = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
{
self.search_params = v.map(|x| x.into());
self
}
pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.visitor_id = v.into();
self
}
pub fn set_user_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = v.map(|x| x.into());
self
}
pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::conversational_search_request::ConversationalFilteringSpec,
>,
{
self.conversational_filtering_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_conversational_filtering_spec<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<
crate::model::conversational_search_request::ConversationalFilteringSpec,
>,
{
self.conversational_filtering_spec = v.map(|x| x.into());
self
}
pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SafetySetting>,
{
use std::iter::Iterator;
self.safety_settings = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ConversationalSearchRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
}
}
pub mod conversational_search_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchParams {
pub filter: std::string::String,
pub canonical_filter: std::string::String,
pub sort_by: std::string::String,
pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SearchParams {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.canonical_filter = v.into();
self
}
pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sort_by = v.into();
self
}
pub fn set_boost_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::BoostSpec>,
{
self.boost_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::BoostSpec>,
{
self.boost_spec = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SearchParams {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserAnswer {
pub r#type:
std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<
T: std::convert::Into<
std::option::Option<
crate::model::conversational_search_request::user_answer::Type,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = std::option::Option::Some(
crate::model::conversational_search_request::user_answer::Type::TextAnswer(
v.into(),
),
);
self
}
pub fn selected_answer(
&self,
) -> std::option::Option<
&std::boxed::Box<
crate::model::conversational_search_request::user_answer::SelectedAnswer,
>,
> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_selected_answer<
T: std::convert::Into<
std::boxed::Box<
crate::model::conversational_search_request::user_answer::SelectedAnswer,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(
crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
v.into(),
),
);
self
}
}
impl wkt::message::Message for UserAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
}
}
pub mod user_answer {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SelectedAnswer {
pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SelectedAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SelectedAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
TextAnswer(std::string::String),
SelectedAnswer(
std::boxed::Box<
crate::model::conversational_search_request::user_answer::SelectedAnswer,
>,
),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalFilteringSpec {
#[deprecated]
pub enable_conversational_filtering: bool,
pub user_answer:
std::option::Option<crate::model::conversational_search_request::UserAnswer>,
pub conversational_filtering_mode:
crate::model::conversational_search_request::conversational_filtering_spec::Mode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalFilteringSpec {
pub fn new() -> Self {
std::default::Default::default()
}
#[deprecated]
pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_conversational_filtering = v.into();
self
}
pub fn set_user_answer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
{
self.user_answer = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
{
self.user_answer = v.map(|x| x.into());
self
}
pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
self.conversational_filtering_mode = v.into();
self
}
}
impl wkt::message::Message for ConversationalFilteringSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
}
}
pub mod conversational_filtering_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
Unspecified,
Disabled,
Enabled,
ConversationalFilterOnly,
UnknownValue(mode::UnknownValue),
}
#[doc(hidden)]
pub mod mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Mode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Disabled => std::option::Option::Some(1),
Self::Enabled => std::option::Option::Some(2),
Self::ConversationalFilterOnly => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::Enabled => std::option::Option::Some("ENABLED"),
Self::ConversationalFilterOnly => {
std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Mode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Mode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Mode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Disabled,
2 => Self::Enabled,
3 => Self::ConversationalFilterOnly,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Mode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODE_UNSPECIFIED" => Self::Unspecified,
"DISABLED" => Self::Disabled,
"ENABLED" => Self::Enabled,
"CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Mode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Disabled => serializer.serialize_i32(1),
Self::Enabled => serializer.serialize_i32(2),
Self::ConversationalFilterOnly => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Mode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
}
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalSearchResponse {
pub user_query_types: std::vec::Vec<std::string::String>,
pub conversational_text_response: std::string::String,
pub followup_question:
std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
pub conversation_id: std::string::String,
pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
pub conversational_filtering_result: std::option::Option<
crate::model::conversational_search_response::ConversationalFilteringResult,
>,
pub state: crate::model::conversational_search_response::State,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalSearchResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.user_query_types = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversational_text_response = v.into();
self
}
pub fn set_followup_question<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
{
self.followup_question = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
{
self.followup_question = v.map(|x| x.into());
self
}
pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation_id = v.into();
self
}
pub fn set_refined_search<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
{
use std::iter::Iterator;
self.refined_search = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::conversational_search_response::ConversationalFilteringResult,
>,
{
self.conversational_filtering_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_conversational_filtering_result<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<
crate::model::conversational_search_response::ConversationalFilteringResult,
>,
{
self.conversational_filtering_result = v.map(|x| x.into());
self
}
pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for ConversationalSearchResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
}
}
pub mod conversational_search_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FollowupQuestion {
pub followup_question: std::string::String,
pub suggested_answers: std::vec::Vec<
crate::model::conversational_search_response::followup_question::SuggestedAnswer,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FollowupQuestion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.followup_question = v.into();
self
}
pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
{
use std::iter::Iterator;
self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for FollowupQuestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
}
}
pub mod followup_question {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestedAnswer {
pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SuggestedAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SuggestedAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RefinedSearch {
pub query: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RefinedSearch {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
}
impl wkt::message::Message for RefinedSearch {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalFilteringResult {
pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalFilteringResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_followup_question<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
{
self.followup_question = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
{
self.followup_question = v.map(|x| x.into());
self
}
pub fn set_additional_filter<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
{
self.additional_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
{
self.additional_filter = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ConversationalFilteringResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
}
}
pub mod conversational_filtering_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdditionalFilter {
pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AdditionalFilter {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AdditionalFilter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Streaming,
Succeeded,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Streaming => std::option::Option::Some(1),
Self::Succeeded => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Streaming => std::option::Option::Some("STREAMING"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Streaming,
2 => Self::Succeeded,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"STREAMING" => Self::Streaming,
"SUCCEEDED" => Self::Succeeded,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Streaming => serializer.serialize_i32(1),
Self::Succeeded => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.retail.v2.ConversationalSearchResponse.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OutputConfig {
pub destination: std::option::Option<crate::model::output_config::Destination>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OutputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_destination<
T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = v.into();
self
}
pub fn gcs_destination(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
#[allow(unreachable_patterns)]
self.destination.as_ref().and_then(|v| match v {
crate::model::output_config::Destination::GcsDestination(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_destination<
T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = std::option::Option::Some(
crate::model::output_config::Destination::GcsDestination(v.into()),
);
self
}
pub fn bigquery_destination(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
{
#[allow(unreachable_patterns)]
self.destination.as_ref().and_then(|v| match v {
crate::model::output_config::Destination::BigqueryDestination(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_bigquery_destination<
T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = std::option::Option::Some(
crate::model::output_config::Destination::BigqueryDestination(v.into()),
);
self
}
}
impl wkt::message::Message for OutputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.OutputConfig"
}
}
pub mod output_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsDestination {
pub output_uri_prefix: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcsDestination {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_uri_prefix = v.into();
self
}
}
impl wkt::message::Message for GcsDestination {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigQueryDestination {
pub dataset_id: std::string::String,
pub table_id_prefix: std::string::String,
pub table_type: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigQueryDestination {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.table_id_prefix = v.into();
self
}
pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_type = v.into();
self
}
}
impl wkt::message::Message for BigQueryDestination {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Destination {
GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportErrorsConfig {
pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportErrorsConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_destination<
T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = v.into();
self
}
pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.destination.as_ref().and_then(|v| match v {
crate::model::export_errors_config::Destination::GcsPrefix(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.destination = std::option::Option::Some(
crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
);
self
}
}
impl wkt::message::Message for ExportErrorsConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
}
}
pub mod export_errors_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Destination {
GcsPrefix(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportAnalyticsMetricsRequest {
pub catalog: std::string::String,
pub output_config: std::option::Option<crate::model::OutputConfig>,
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportAnalyticsMetricsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
pub fn set_output_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputConfig>,
{
self.output_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputConfig>,
{
self.output_config = v.map(|x| x.into());
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ExportAnalyticsMetricsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ExportMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportAnalyticsMetricsResponse {
pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
pub output_result: std::option::Option<crate::model::OutputResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportAnalyticsMetricsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error_samples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.error_samples = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_errors_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExportErrorsConfig>,
{
self.errors_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExportErrorsConfig>,
{
self.errors_config = v.map(|x| x.into());
self
}
pub fn set_output_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputResult>,
{
self.output_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputResult>,
{
self.output_result = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ExportAnalyticsMetricsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OutputResult {
pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OutputResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BigQueryOutputResult>,
{
use std::iter::Iterator;
self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GcsOutputResult>,
{
use std::iter::Iterator;
self.gcs_result = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for OutputResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.OutputResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigQueryOutputResult {
pub dataset_id: std::string::String,
pub table_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigQueryOutputResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
}
impl wkt::message::Message for BigQueryOutputResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsOutputResult {
pub output_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcsOutputResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.output_uri = v.into();
self
}
}
impl wkt::message::Message for GcsOutputResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerativeQuestionsFeatureConfig {
pub catalog: std::string::String,
pub feature_enabled: bool,
pub minimum_products: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerativeQuestionsFeatureConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.feature_enabled = v.into();
self
}
pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.minimum_products = v.into();
self
}
}
impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerativeQuestionConfig {
pub catalog: std::string::String,
pub facet: std::string::String,
pub generated_question: std::string::String,
pub final_question: std::string::String,
pub example_values: std::vec::Vec<std::string::String>,
pub frequency: f32,
pub allowed_in_conversation: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerativeQuestionConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.facet = v.into();
self
}
pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.generated_question = v.into();
self
}
pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.final_question = v.into();
self
}
pub fn set_example_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.example_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.frequency = v.into();
self
}
pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allowed_in_conversation = v.into();
self
}
}
impl wkt::message::Message for GenerativeQuestionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
pub generative_questions_feature_config:
std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateGenerativeQuestionsFeatureConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
{
self.generative_questions_feature_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_generative_questions_feature_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
{
self.generative_questions_feature_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGenerativeQuestionsFeatureConfigRequest {
pub catalog: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetGenerativeQuestionsFeatureConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.catalog = v.into();
self
}
}
impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGenerativeQuestionConfigsRequest {
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListGenerativeQuestionConfigsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGenerativeQuestionConfigsResponse {
pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListGenerativeQuestionConfigsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
{
use std::iter::Iterator;
self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateGenerativeQuestionConfigRequest {
pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateGenerativeQuestionConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_generative_question_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
{
self.generative_question_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
{
self.generative_question_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateGenerativeQuestionConfigsRequest {
pub parent: std::string::String,
pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchUpdateGenerativeQuestionConfigsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
{
use std::iter::Iterator;
self.requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateGenerativeQuestionConfigsResponse {
pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchUpdateGenerativeQuestionConfigsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
{
use std::iter::Iterator;
self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsSource {
pub input_uris: std::vec::Vec<std::string::String>,
pub data_schema: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcsSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_input_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.input_uris = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.data_schema = v.into();
self
}
}
impl wkt::message::Message for GcsSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GcsSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigQuerySource {
pub project_id: std::string::String,
pub dataset_id: std::string::String,
pub table_id: std::string::String,
pub gcs_staging_dir: std::string::String,
pub data_schema: std::string::String,
pub partition: std::option::Option<crate::model::big_query_source::Partition>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigQuerySource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.gcs_staging_dir = v.into();
self
}
pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.data_schema = v.into();
self
}
pub fn set_partition<
T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
>(
mut self,
v: T,
) -> Self {
self.partition = v.into();
self
}
pub fn partition_date(
&self,
) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
#[allow(unreachable_patterns)]
self.partition.as_ref().and_then(|v| match v {
crate::model::big_query_source::Partition::PartitionDate(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_partition_date<
T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
>(
mut self,
v: T,
) -> Self {
self.partition = std::option::Option::Some(
crate::model::big_query_source::Partition::PartitionDate(v.into()),
);
self
}
}
impl wkt::message::Message for BigQuerySource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
}
}
pub mod big_query_source {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Partition {
PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductInlineSource {
pub products: std::vec::Vec<crate::model::Product>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductInlineSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_products<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Product>,
{
use std::iter::Iterator;
self.products = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ProductInlineSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserEventInlineSource {
pub user_events: std::vec::Vec<crate::model::UserEvent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserEventInlineSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_user_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UserEvent>,
{
use std::iter::Iterator;
self.user_events = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for UserEventInlineSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportErrorsConfig {
pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportErrorsConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_destination<
T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = v.into();
self
}
pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.destination.as_ref().and_then(|v| match v {
crate::model::import_errors_config::Destination::GcsPrefix(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.destination = std::option::Option::Some(
crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
);
self
}
}
impl wkt::message::Message for ImportErrorsConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
}
}
pub mod import_errors_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Destination {
GcsPrefix(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportProductsRequest {
pub parent: std::string::String,
#[deprecated]
pub request_id: std::string::String,
pub input_config: std::option::Option<crate::model::ProductInputConfig>,
pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
pub notification_pubsub_topic: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportProductsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
#[deprecated]
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
pub fn set_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductInputConfig>,
{
self.input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ProductInputConfig>,
{
self.input_config = v.map(|x| x.into());
self
}
pub fn set_errors_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_reconciliation_mode<
T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
>(
mut self,
v: T,
) -> Self {
self.reconciliation_mode = v.into();
self
}
pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.notification_pubsub_topic = v.into();
self
}
}
impl wkt::message::Message for ImportProductsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
}
}
pub mod import_products_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReconciliationMode {
Unspecified,
Incremental,
Full,
UnknownValue(reconciliation_mode::UnknownValue),
}
#[doc(hidden)]
pub mod reconciliation_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ReconciliationMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Incremental => std::option::Option::Some(1),
Self::Full => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
Self::Incremental => std::option::Option::Some("INCREMENTAL"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ReconciliationMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ReconciliationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ReconciliationMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Incremental,
2 => Self::Full,
_ => Self::UnknownValue(reconciliation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ReconciliationMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
"INCREMENTAL" => Self::Incremental,
"FULL" => Self::Full,
_ => Self::UnknownValue(reconciliation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ReconciliationMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Incremental => serializer.serialize_i32(1),
Self::Full => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportUserEventsRequest {
pub parent: std::string::String,
pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportUserEventsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserEventInputConfig>,
{
self.input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserEventInputConfig>,
{
self.input_config = v.map(|x| x.into());
self
}
pub fn set_errors_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ImportUserEventsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportCompletionDataRequest {
pub parent: std::string::String,
pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
pub notification_pubsub_topic: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportCompletionDataRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.input_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionDataInputConfig>,
{
self.input_config = v.map(|x| x.into());
self
}
pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.notification_pubsub_topic = v.into();
self
}
}
impl wkt::message::Message for ImportCompletionDataRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductInputConfig {
pub source: std::option::Option<crate::model::product_input_config::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductInputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
pub fn product_inline_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::product_input_config::Source::ProductInlineSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_product_inline_source<
T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::product_input_config::Source::ProductInlineSource(v.into()),
);
self
}
pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::product_input_config::Source::GcsSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::product_input_config::Source::GcsSource(v.into()),
);
self
}
pub fn big_query_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::product_input_config::Source::BigQuerySource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_big_query_source<
T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::product_input_config::Source::BigQuerySource(v.into()),
);
self
}
}
impl wkt::message::Message for ProductInputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
}
}
pub mod product_input_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
GcsSource(std::boxed::Box<crate::model::GcsSource>),
BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserEventInputConfig {
pub source: std::option::Option<crate::model::user_event_input_config::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserEventInputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
pub fn user_event_inline_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_user_event_inline_source<
T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
);
self
}
pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::user_event_input_config::Source::GcsSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::user_event_input_config::Source::GcsSource(v.into()),
);
self
}
pub fn big_query_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::user_event_input_config::Source::BigQuerySource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_big_query_source<
T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
);
self
}
}
impl wkt::message::Message for UserEventInputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
}
}
pub mod user_event_input_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
GcsSource(std::boxed::Box<crate::model::GcsSource>),
BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompletionDataInputConfig {
pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompletionDataInputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
pub fn big_query_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_big_query_source<
T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
);
self
}
}
impl wkt::message::Message for CompletionDataInputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
}
}
pub mod completion_data_input_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub success_count: i64,
pub failure_count: i64,
#[deprecated]
pub request_id: std::string::String,
pub notification_pubsub_topic: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.success_count = v.into();
self
}
pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.failure_count = v.into();
self
}
#[deprecated]
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.notification_pubsub_topic = v.into();
self
}
}
impl wkt::message::Message for ImportMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportProductsResponse {
pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportProductsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error_samples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.error_samples = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_errors_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ImportProductsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportUserEventsResponse {
pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportUserEventsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error_samples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.error_samples = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_errors_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportErrorsConfig>,
{
self.errors_config = v.map(|x| x.into());
self
}
pub fn set_import_summary<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserEventImportSummary>,
{
self.import_summary = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserEventImportSummary>,
{
self.import_summary = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ImportUserEventsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserEventImportSummary {
pub joined_events_count: i64,
pub unjoined_events_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserEventImportSummary {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.joined_events_count = v.into();
self
}
pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.unjoined_events_count = v.into();
self
}
}
impl wkt::message::Message for UserEventImportSummary {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportCompletionDataResponse {
pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportCompletionDataResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error_samples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.error_samples = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ImportCompletionDataResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Model {
pub name: std::string::String,
pub display_name: std::string::String,
pub training_state: crate::model::model::TrainingState,
pub serving_state: crate::model::model::ServingState,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub r#type: std::string::String,
pub optimization_objective: std::string::String,
pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
pub last_tune_time: std::option::Option<wkt::Timestamp>,
pub tuning_operation: std::string::String,
pub data_state: crate::model::model::DataState,
pub filtering_option: crate::model::RecommendationsFilteringOption,
pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Model {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
mut self,
v: T,
) -> Self {
self.training_state = v.into();
self
}
pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
mut self,
v: T,
) -> Self {
self.serving_state = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.optimization_objective = v.into();
self
}
pub fn set_periodic_tuning_state<
T: std::convert::Into<crate::model::model::PeriodicTuningState>,
>(
mut self,
v: T,
) -> Self {
self.periodic_tuning_state = v.into();
self
}
pub fn set_last_tune_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_tune_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_tune_time = v.map(|x| x.into());
self
}
pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.tuning_operation = v.into();
self
}
pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
mut self,
v: T,
) -> Self {
self.data_state = v.into();
self
}
pub fn set_filtering_option<
T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
>(
mut self,
v: T,
) -> Self {
self.filtering_option = v.into();
self
}
pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::ServingConfigList>,
{
use std::iter::Iterator;
self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_model_features_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
{
self.model_features_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
{
self.model_features_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Model {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Model"
}
}
pub mod model {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServingConfigList {
pub serving_config_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServingConfigList {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServingConfigList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FrequentlyBoughtTogetherFeaturesConfig {
pub context_products_type: crate::model::model::ContextProductsType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FrequentlyBoughtTogetherFeaturesConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_context_products_type<
T: std::convert::Into<crate::model::model::ContextProductsType>,
>(
mut self,
v: T,
) -> Self {
self.context_products_type = v.into();
self
}
}
impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelFeaturesConfig {
#[allow(missing_docs)]
pub type_dedicated_config:
std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelFeaturesConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type_dedicated_config<
T: std::convert::Into<
std::option::Option<
crate::model::model::model_features_config::TypeDedicatedConfig,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.type_dedicated_config = v.into();
self
}
pub fn frequently_bought_together_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
> {
#[allow(unreachable_patterns)]
self.type_dedicated_config.as_ref().and_then(|v| match v {
crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_frequently_bought_together_config<
T: std::convert::Into<
std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.type_dedicated_config = std::option::Option::Some(
crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
v.into()
)
);
self
}
}
impl wkt::message::Message for ModelFeaturesConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
}
}
pub mod model_features_config {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TypeDedicatedConfig {
FrequentlyBoughtTogetherConfig(
std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
),
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServingState {
Unspecified,
Inactive,
Active,
Tuned,
UnknownValue(serving_state::UnknownValue),
}
#[doc(hidden)]
pub mod serving_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ServingState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Inactive => std::option::Option::Some(1),
Self::Active => std::option::Option::Some(2),
Self::Tuned => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
Self::Inactive => std::option::Option::Some("INACTIVE"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Tuned => std::option::Option::Some("TUNED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ServingState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ServingState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ServingState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Inactive,
2 => Self::Active,
3 => Self::Tuned,
_ => Self::UnknownValue(serving_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ServingState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
"INACTIVE" => Self::Inactive,
"ACTIVE" => Self::Active,
"TUNED" => Self::Tuned,
_ => Self::UnknownValue(serving_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ServingState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Inactive => serializer.serialize_i32(1),
Self::Active => serializer.serialize_i32(2),
Self::Tuned => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ServingState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
".google.cloud.retail.v2.Model.ServingState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TrainingState {
Unspecified,
Paused,
Training,
UnknownValue(training_state::UnknownValue),
}
#[doc(hidden)]
pub mod training_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TrainingState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Paused => std::option::Option::Some(1),
Self::Training => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
Self::Paused => std::option::Option::Some("PAUSED"),
Self::Training => std::option::Option::Some("TRAINING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TrainingState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TrainingState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TrainingState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Paused,
2 => Self::Training,
_ => Self::UnknownValue(training_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TrainingState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
"PAUSED" => Self::Paused,
"TRAINING" => Self::Training,
_ => Self::UnknownValue(training_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TrainingState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Paused => serializer.serialize_i32(1),
Self::Training => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TrainingState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
".google.cloud.retail.v2.Model.TrainingState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PeriodicTuningState {
Unspecified,
PeriodicTuningDisabled,
AllTuningDisabled,
PeriodicTuningEnabled,
UnknownValue(periodic_tuning_state::UnknownValue),
}
#[doc(hidden)]
pub mod periodic_tuning_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PeriodicTuningState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PeriodicTuningDisabled => std::option::Option::Some(1),
Self::AllTuningDisabled => std::option::Option::Some(3),
Self::PeriodicTuningEnabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
Self::PeriodicTuningDisabled => {
std::option::Option::Some("PERIODIC_TUNING_DISABLED")
}
Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PeriodicTuningState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PeriodicTuningState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PeriodicTuningState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PeriodicTuningDisabled,
2 => Self::PeriodicTuningEnabled,
3 => Self::AllTuningDisabled,
_ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PeriodicTuningState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
"PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
"ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
"PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
_ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PeriodicTuningState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
Self::AllTuningDisabled => serializer.serialize_i32(3),
Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
".google.cloud.retail.v2.Model.PeriodicTuningState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataState {
Unspecified,
DataOk,
DataError,
UnknownValue(data_state::UnknownValue),
}
#[doc(hidden)]
pub mod data_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DataState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DataOk => std::option::Option::Some(1),
Self::DataError => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
Self::DataOk => std::option::Option::Some("DATA_OK"),
Self::DataError => std::option::Option::Some("DATA_ERROR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DataState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DataState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DataState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DataOk,
2 => Self::DataError,
_ => Self::UnknownValue(data_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DataState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATA_STATE_UNSPECIFIED" => Self::Unspecified,
"DATA_OK" => Self::DataOk,
"DATA_ERROR" => Self::DataError,
_ => Self::UnknownValue(data_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DataState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::DataOk => serializer.serialize_i32(1),
Self::DataError => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DataState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
".google.cloud.retail.v2.Model.DataState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ContextProductsType {
Unspecified,
SingleContextProduct,
MultipleContextProducts,
UnknownValue(context_products_type::UnknownValue),
}
#[doc(hidden)]
pub mod context_products_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ContextProductsType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SingleContextProduct => std::option::Option::Some(1),
Self::MultipleContextProducts => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
Self::MultipleContextProducts => {
std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ContextProductsType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ContextProductsType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ContextProductsType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SingleContextProduct,
2 => Self::MultipleContextProducts,
_ => Self::UnknownValue(context_products_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ContextProductsType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
"SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
"MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
_ => Self::UnknownValue(context_products_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ContextProductsType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::SingleContextProduct => serializer.serialize_i32(1),
Self::MultipleContextProducts => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
".google.cloud.retail.v2.Model.ContextProductsType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateModelRequest {
pub parent: std::string::String,
pub model: std::option::Option<crate::model::Model>,
pub dry_run: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = v.map(|x| x.into());
self
}
pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.dry_run = v.into();
self
}
}
impl wkt::message::Message for CreateModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateModelRequest {
pub model: std::option::Option<crate::model::Model>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetModelRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PauseModelRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PauseModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for PauseModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResumeModelRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResumeModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for ResumeModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListModelsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListModelsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListModelsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteModelRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListModelsResponse {
pub models: std::vec::Vec<crate::model::Model>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListModelsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_models<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Model>,
{
use std::iter::Iterator;
self.models = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListModelsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
type PageItem = crate::model::Model;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.models
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TuneModelRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TuneModelRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for TuneModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateModelMetadata {
pub model: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateModelMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
}
impl wkt::message::Message for CreateModelMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TuneModelMetadata {
pub model: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TuneModelMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
}
impl wkt::message::Message for TuneModelMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TuneModelResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TuneModelResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for TuneModelResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PredictRequest {
pub placement: std::string::String,
pub user_event: std::option::Option<crate::model::UserEvent>,
pub page_size: i32,
#[deprecated]
pub page_token: std::string::String,
pub filter: std::string::String,
pub validate_only: bool,
pub params: std::collections::HashMap<std::string::String, wkt::Value>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PredictRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.placement = v.into();
self
}
pub fn set_user_event<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserEvent>,
{
self.user_event = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserEvent>,
{
self.user_event = v.map(|x| x.into());
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
#[deprecated]
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_params<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for PredictRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PredictRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PredictResponse {
pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
pub attribution_token: std::string::String,
pub missing_ids: std::vec::Vec<std::string::String>,
pub validate_only: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PredictResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::predict_response::PredictionResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attribution_token = v.into();
self
}
pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.missing_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
}
impl wkt::message::Message for PredictResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PredictResponse"
}
}
pub mod predict_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PredictionResult {
pub id: std::string::String,
pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PredictionResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for PredictionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Product {
pub name: std::string::String,
pub id: std::string::String,
pub r#type: crate::model::product::Type,
pub primary_product_id: std::string::String,
pub collection_member_ids: std::vec::Vec<std::string::String>,
pub gtin: std::string::String,
pub categories: std::vec::Vec<std::string::String>,
pub title: std::string::String,
pub brands: std::vec::Vec<std::string::String>,
pub description: std::string::String,
pub language_code: std::string::String,
pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
pub tags: std::vec::Vec<std::string::String>,
pub price_info: std::option::Option<crate::model::PriceInfo>,
pub rating: std::option::Option<crate::model::Rating>,
pub available_time: std::option::Option<wkt::Timestamp>,
pub availability: crate::model::product::Availability,
pub available_quantity: std::option::Option<wkt::Int32Value>,
pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
pub uri: std::string::String,
pub images: std::vec::Vec<crate::model::Image>,
pub audience: std::option::Option<crate::model::Audience>,
pub color_info: std::option::Option<crate::model::ColorInfo>,
pub sizes: std::vec::Vec<std::string::String>,
pub materials: std::vec::Vec<std::string::String>,
pub patterns: std::vec::Vec<std::string::String>,
pub conditions: std::vec::Vec<std::string::String>,
pub promotions: std::vec::Vec<crate::model::Promotion>,
pub publish_time: std::option::Option<wkt::Timestamp>,
#[deprecated]
pub retrievable_fields: std::option::Option<wkt::FieldMask>,
pub variants: std::vec::Vec<crate::model::Product>,
pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
#[allow(missing_docs)]
pub expiration: std::option::Option<crate::model::product::Expiration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Product {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.primary_product_id = v.into();
self
}
pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.gtin = v.into();
self
}
pub fn set_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.categories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
pub fn set_brands<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.brands = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::CustomAttribute>,
{
use std::iter::Iterator;
self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_tags<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.tags = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_price_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PriceInfo>,
{
self.price_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PriceInfo>,
{
self.price_info = v.map(|x| x.into());
self
}
pub fn set_rating<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Rating>,
{
self.rating = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Rating>,
{
self.rating = v.map(|x| x.into());
self
}
pub fn set_available_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.available_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.available_time = v.map(|x| x.into());
self
}
pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
mut self,
v: T,
) -> Self {
self.availability = v.into();
self
}
pub fn set_available_quantity<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.available_quantity = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.available_quantity = v.map(|x| x.into());
self
}
pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::FulfillmentInfo>,
{
use std::iter::Iterator;
self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_images<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Image>,
{
use std::iter::Iterator;
self.images = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_audience<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Audience>,
{
self.audience = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Audience>,
{
self.audience = v.map(|x| x.into());
self
}
pub fn set_color_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ColorInfo>,
{
self.color_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ColorInfo>,
{
self.color_info = v.map(|x| x.into());
self
}
pub fn set_sizes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.sizes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_materials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.materials = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_patterns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.patterns = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_conditions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.conditions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_promotions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Promotion>,
{
use std::iter::Iterator;
self.promotions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_publish_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.publish_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.publish_time = v.map(|x| x.into());
self
}
#[deprecated]
pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.retrievable_fields = std::option::Option::Some(v.into());
self
}
#[deprecated]
pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.retrievable_fields = v.map(|x| x.into());
self
}
pub fn set_variants<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Product>,
{
use std::iter::Iterator;
self.variants = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::LocalInventory>,
{
use std::iter::Iterator;
self.local_inventories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_expiration<
T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
>(
mut self,
v: T,
) -> Self {
self.expiration = v.into();
self
}
pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
#[allow(unreachable_patterns)]
self.expiration.as_ref().and_then(|v| match v {
crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.expiration =
std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
self
}
pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.expiration.as_ref().and_then(|v| match v {
crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
self.expiration =
std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
self
}
}
impl wkt::message::Message for Product {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Product"
}
}
pub mod product {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
Unspecified,
Primary,
Variant,
Collection,
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Type {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Primary => std::option::Option::Some(1),
Self::Variant => std::option::Option::Some(2),
Self::Collection => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::Primary => std::option::Option::Some("PRIMARY"),
Self::Variant => std::option::Option::Some("VARIANT"),
Self::Collection => std::option::Option::Some("COLLECTION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Primary,
2 => Self::Variant,
3 => Self::Collection,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"PRIMARY" => Self::Primary,
"VARIANT" => Self::Variant,
"COLLECTION" => Self::Collection,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Type {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Primary => serializer.serialize_i32(1),
Self::Variant => serializer.serialize_i32(2),
Self::Collection => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Type {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
".google.cloud.retail.v2.Product.Type",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Availability {
Unspecified,
InStock,
OutOfStock,
Preorder,
Backorder,
UnknownValue(availability::UnknownValue),
}
#[doc(hidden)]
pub mod availability {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Availability {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::InStock => std::option::Option::Some(1),
Self::OutOfStock => std::option::Option::Some(2),
Self::Preorder => std::option::Option::Some(3),
Self::Backorder => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
Self::InStock => std::option::Option::Some("IN_STOCK"),
Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
Self::Preorder => std::option::Option::Some("PREORDER"),
Self::Backorder => std::option::Option::Some("BACKORDER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Availability {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Availability {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Availability {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::InStock,
2 => Self::OutOfStock,
3 => Self::Preorder,
4 => Self::Backorder,
_ => Self::UnknownValue(availability::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Availability {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
"IN_STOCK" => Self::InStock,
"OUT_OF_STOCK" => Self::OutOfStock,
"PREORDER" => Self::Preorder,
"BACKORDER" => Self::Backorder,
_ => Self::UnknownValue(availability::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Availability {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::InStock => serializer.serialize_i32(1),
Self::OutOfStock => serializer.serialize_i32(2),
Self::Preorder => serializer.serialize_i32(3),
Self::Backorder => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Availability {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
".google.cloud.retail.v2.Product.Availability",
))
}
}
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Expiration {
ExpireTime(std::boxed::Box<wkt::Timestamp>),
Ttl(std::boxed::Box<wkt::Duration>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateProductRequest {
pub parent: std::string::String,
pub product: std::option::Option<crate::model::Product>,
pub product_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateProductRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_product<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = v.map(|x| x.into());
self
}
pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.product_id = v.into();
self
}
}
impl wkt::message::Message for CreateProductRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProductRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetProductRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetProductRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateProductRequest {
pub product: std::option::Option<crate::model::Product>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateProductRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for UpdateProductRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProductRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteProductRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteProductRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProductsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub read_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListProductsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.read_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.read_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ListProductsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProductsResponse {
pub products: std::vec::Vec<crate::model::Product>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListProductsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_products<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Product>,
{
use std::iter::Iterator;
self.products = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListProductsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
type PageItem = crate::model::Product;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.products
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetInventoryRequest {
pub inventory: std::option::Option<crate::model::Product>,
pub set_mask: std::option::Option<wkt::FieldMask>,
pub set_time: std::option::Option<wkt::Timestamp>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SetInventoryRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_inventory<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.inventory = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.inventory = v.map(|x| x.into());
self
}
pub fn set_set_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.set_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.set_mask = v.map(|x| x.into());
self
}
pub fn set_set_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.set_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.set_time = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for SetInventoryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetInventoryMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SetInventoryMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SetInventoryMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetInventoryResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SetInventoryResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SetInventoryResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddFulfillmentPlacesRequest {
pub product: std::string::String,
pub r#type: std::string::String,
pub place_ids: std::vec::Vec<std::string::String>,
pub add_time: std::option::Option<wkt::Timestamp>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddFulfillmentPlacesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.product = v.into();
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_place_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.place_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_add_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.add_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.add_time = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for AddFulfillmentPlacesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddFulfillmentPlacesMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddFulfillmentPlacesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AddFulfillmentPlacesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddFulfillmentPlacesResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddFulfillmentPlacesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AddFulfillmentPlacesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddLocalInventoriesRequest {
pub product: std::string::String,
pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
pub add_mask: std::option::Option<wkt::FieldMask>,
pub add_time: std::option::Option<wkt::Timestamp>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddLocalInventoriesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.product = v.into();
self
}
pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::LocalInventory>,
{
use std::iter::Iterator;
self.local_inventories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_add_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.add_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.add_mask = v.map(|x| x.into());
self
}
pub fn set_add_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.add_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.add_time = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for AddLocalInventoriesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddLocalInventoriesMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddLocalInventoriesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AddLocalInventoriesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddLocalInventoriesResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddLocalInventoriesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AddLocalInventoriesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveLocalInventoriesRequest {
pub product: std::string::String,
pub place_ids: std::vec::Vec<std::string::String>,
pub remove_time: std::option::Option<wkt::Timestamp>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveLocalInventoriesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.product = v.into();
self
}
pub fn set_place_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.place_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_remove_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.remove_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.remove_time = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for RemoveLocalInventoriesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveLocalInventoriesMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveLocalInventoriesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for RemoveLocalInventoriesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveLocalInventoriesResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveLocalInventoriesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for RemoveLocalInventoriesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveFulfillmentPlacesRequest {
pub product: std::string::String,
pub r#type: std::string::String,
pub place_ids: std::vec::Vec<std::string::String>,
pub remove_time: std::option::Option<wkt::Timestamp>,
pub allow_missing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveFulfillmentPlacesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.product = v.into();
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_place_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.place_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_remove_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.remove_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.remove_time = v.map(|x| x.into());
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
}
impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveFulfillmentPlacesMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveFulfillmentPlacesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveFulfillmentPlacesResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveFulfillmentPlacesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Promotion {
pub promotion_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Promotion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.promotion_id = v.into();
self
}
}
impl wkt::message::Message for Promotion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Promotion"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for PurgeMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeProductsMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub success_count: i64,
pub failure_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeProductsMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.success_count = v.into();
self
}
pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.failure_count = v.into();
self
}
}
impl wkt::message::Message for PurgeProductsMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeProductsRequest {
pub parent: std::string::String,
pub filter: std::string::String,
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeProductsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
impl wkt::message::Message for PurgeProductsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeProductsResponse {
pub purge_count: i64,
pub purge_sample: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeProductsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.purge_count = v.into();
self
}
pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.purge_sample = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PurgeProductsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeUserEventsRequest {
pub parent: std::string::String,
pub filter: std::string::String,
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeUserEventsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
impl wkt::message::Message for PurgeUserEventsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeUserEventsResponse {
pub purged_events_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeUserEventsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.purged_events_count = v.into();
self
}
}
impl wkt::message::Message for PurgeUserEventsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SafetySetting {
pub category: crate::model::HarmCategory,
pub threshold: crate::model::safety_setting::HarmBlockThreshold,
pub method: crate::model::safety_setting::HarmBlockMethod,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SafetySetting {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
self.category = v.into();
self
}
pub fn set_threshold<
T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
>(
mut self,
v: T,
) -> Self {
self.threshold = v.into();
self
}
pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
mut self,
v: T,
) -> Self {
self.method = v.into();
self
}
}
impl wkt::message::Message for SafetySetting {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SafetySetting"
}
}
pub mod safety_setting {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HarmBlockThreshold {
Unspecified,
BlockLowAndAbove,
BlockMediumAndAbove,
BlockOnlyHigh,
BlockNone,
Off,
UnknownValue(harm_block_threshold::UnknownValue),
}
#[doc(hidden)]
pub mod harm_block_threshold {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HarmBlockThreshold {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::BlockLowAndAbove => std::option::Option::Some(1),
Self::BlockMediumAndAbove => std::option::Option::Some(2),
Self::BlockOnlyHigh => std::option::Option::Some(3),
Self::BlockNone => std::option::Option::Some(4),
Self::Off => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
Self::Off => std::option::Option::Some("OFF"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HarmBlockThreshold {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HarmBlockThreshold {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for HarmBlockThreshold {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::BlockLowAndAbove,
2 => Self::BlockMediumAndAbove,
3 => Self::BlockOnlyHigh,
4 => Self::BlockNone,
5 => Self::Off,
_ => Self::UnknownValue(harm_block_threshold::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HarmBlockThreshold {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
"BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
"BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
"BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
"BLOCK_NONE" => Self::BlockNone,
"OFF" => Self::Off,
_ => Self::UnknownValue(harm_block_threshold::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HarmBlockThreshold {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::BlockLowAndAbove => serializer.serialize_i32(1),
Self::BlockMediumAndAbove => serializer.serialize_i32(2),
Self::BlockOnlyHigh => serializer.serialize_i32(3),
Self::BlockNone => serializer.serialize_i32(4),
Self::Off => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HarmBlockMethod {
Unspecified,
Severity,
Probability,
UnknownValue(harm_block_method::UnknownValue),
}
#[doc(hidden)]
pub mod harm_block_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HarmBlockMethod {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Severity => std::option::Option::Some(1),
Self::Probability => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
Self::Severity => std::option::Option::Some("SEVERITY"),
Self::Probability => std::option::Option::Some("PROBABILITY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HarmBlockMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HarmBlockMethod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for HarmBlockMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Severity,
2 => Self::Probability,
_ => Self::UnknownValue(harm_block_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HarmBlockMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
"SEVERITY" => Self::Severity,
"PROBABILITY" => Self::Probability,
_ => Self::UnknownValue(harm_block_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HarmBlockMethod {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Severity => serializer.serialize_i32(1),
Self::Probability => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductAttributeValue {
pub name: std::string::String,
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductAttributeValue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for ProductAttributeValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductAttributeInterval {
pub name: std::string::String,
pub interval: std::option::Option<crate::model::Interval>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductAttributeInterval {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_interval<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.interval = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Interval>,
{
self.interval = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ProductAttributeInterval {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Tile {
pub representative_product_id: std::string::String,
pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Tile {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.representative_product_id = v.into();
self
}
pub fn set_product_attribute<
T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
>(
mut self,
v: T,
) -> Self {
self.product_attribute = v.into();
self
}
pub fn product_attribute_value(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
#[allow(unreachable_patterns)]
self.product_attribute.as_ref().and_then(|v| match v {
crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_product_attribute_value<
T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
>(
mut self,
v: T,
) -> Self {
self.product_attribute = std::option::Option::Some(
crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
);
self
}
pub fn product_attribute_interval(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
#[allow(unreachable_patterns)]
self.product_attribute.as_ref().and_then(|v| match v {
crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_product_attribute_interval<
T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
>(
mut self,
v: T,
) -> Self {
self.product_attribute = std::option::Option::Some(
crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
);
self
}
}
impl wkt::message::Message for Tile {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.Tile"
}
}
pub mod tile {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ProductAttribute {
ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchRequest {
pub placement: std::string::String,
pub branch: std::string::String,
pub query: std::string::String,
pub visitor_id: std::string::String,
pub user_info: std::option::Option<crate::model::UserInfo>,
pub page_size: i32,
pub page_token: std::string::String,
pub offset: i32,
pub filter: std::string::String,
pub canonical_filter: std::string::String,
pub order_by: std::string::String,
pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
#[deprecated]
pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
pub variant_rollup_keys: std::vec::Vec<std::string::String>,
pub page_categories: std::vec::Vec<std::string::String>,
pub search_mode: crate::model::search_request::SearchMode,
pub personalization_spec:
std::option::Option<crate::model::search_request::PersonalizationSpec>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub spell_correction_spec:
std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
pub entity: std::string::String,
pub conversational_search_spec:
std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
pub language_code: std::string::String,
pub region_code: std::string::String,
pub place_id: std::string::String,
pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SearchRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.placement = v.into();
self
}
pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.branch = v.into();
self
}
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.visitor_id = v.into();
self
}
pub fn set_user_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = v.map(|x| x.into());
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.offset = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.canonical_filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_request::FacetSpec>,
{
use std::iter::Iterator;
self.facet_specs = v.into_iter().map(|i| i.into()).collect();
self
}
#[deprecated]
pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
{
self.dynamic_facet_spec = std::option::Option::Some(v.into());
self
}
#[deprecated]
pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
{
self.dynamic_facet_spec = v.map(|x| x.into());
self
}
pub fn set_boost_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::BoostSpec>,
{
self.boost_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::BoostSpec>,
{
self.boost_spec = v.map(|x| x.into());
self
}
pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
{
self.query_expansion_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
{
self.query_expansion_spec = v.map(|x| x.into());
self
}
pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_page_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.page_categories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
mut self,
v: T,
) -> Self {
self.search_mode = v.into();
self
}
pub fn set_personalization_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
{
self.personalization_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
{
self.personalization_spec = v.map(|x| x.into());
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
{
self.spell_correction_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
{
self.spell_correction_spec = v.map(|x| x.into());
self
}
pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entity = v.into();
self
}
pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
{
self.conversational_search_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
{
self.conversational_search_spec = v.map(|x| x.into());
self
}
pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
{
self.tile_navigation_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
{
self.tile_navigation_spec = v.map(|x| x.into());
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.region_code = v.into();
self
}
pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.place_id = v.into();
self
}
pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::StringList>,
{
use std::iter::Iterator;
self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for SearchRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest"
}
}
pub mod search_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FacetSpec {
pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
pub limit: i32,
pub excluded_filter_keys: std::vec::Vec<std::string::String>,
pub enable_dynamic_position: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FacetSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_facet_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
{
self.facet_key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
{
self.facet_key = v.map(|x| x.into());
self
}
pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.limit = v.into();
self
}
pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_dynamic_position = v.into();
self
}
}
impl wkt::message::Message for FacetSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
}
}
pub mod facet_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FacetKey {
pub key: std::string::String,
pub intervals: std::vec::Vec<crate::model::Interval>,
pub restricted_values: std::vec::Vec<std::string::String>,
pub prefixes: std::vec::Vec<std::string::String>,
pub contains: std::vec::Vec<std::string::String>,
pub case_insensitive: bool,
pub order_by: std::string::String,
pub query: std::string::String,
pub return_min_max: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FacetKey {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
pub fn set_intervals<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Interval>,
{
use std::iter::Iterator;
self.intervals = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.restricted_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_prefixes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.prefixes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_contains<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.contains = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.case_insensitive = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.order_by = v.into();
self
}
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_min_max = v.into();
self
}
}
impl wkt::message::Message for FacetKey {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DynamicFacetSpec {
pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DynamicFacetSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mode<
T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
}
impl wkt::message::Message for DynamicFacetSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
}
}
pub mod dynamic_facet_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
Unspecified,
Disabled,
Enabled,
UnknownValue(mode::UnknownValue),
}
#[doc(hidden)]
pub mod mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Mode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Disabled => std::option::Option::Some(1),
Self::Enabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::Enabled => std::option::Option::Some("ENABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Mode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Mode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Mode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Disabled,
2 => Self::Enabled,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Mode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODE_UNSPECIFIED" => Self::Unspecified,
"DISABLED" => Self::Disabled,
"ENABLED" => Self::Enabled,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Mode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Disabled => serializer.serialize_i32(1),
Self::Enabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Mode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostSpec {
pub condition_boost_specs:
std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
pub skip_boost_spec_validation: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BoostSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
{
use std::iter::Iterator;
self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.skip_boost_spec_validation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_skip_boost_spec_validation<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<bool>,
{
self.skip_boost_spec_validation = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BoostSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
}
}
pub mod boost_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConditionBoostSpec {
pub condition: std::string::String,
pub boost: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConditionBoostSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_condition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.condition = v.into();
self
}
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
}
impl wkt::message::Message for ConditionBoostSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryExpansionSpec {
pub condition: crate::model::search_request::query_expansion_spec::Condition,
pub pin_unexpanded_results: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryExpansionSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_condition<
T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
>(
mut self,
v: T,
) -> Self {
self.condition = v.into();
self
}
pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.pin_unexpanded_results = v.into();
self
}
}
impl wkt::message::Message for QueryExpansionSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
}
}
pub mod query_expansion_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Condition {
Unspecified,
Disabled,
Auto,
UnknownValue(condition::UnknownValue),
}
#[doc(hidden)]
pub mod condition {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Condition {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Disabled => std::option::Option::Some(1),
Self::Auto => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::Auto => std::option::Option::Some("AUTO"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Condition {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Condition {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Condition {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Disabled,
3 => Self::Auto,
_ => Self::UnknownValue(condition::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Condition {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONDITION_UNSPECIFIED" => Self::Unspecified,
"DISABLED" => Self::Disabled,
"AUTO" => Self::Auto,
_ => Self::UnknownValue(condition::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Condition {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Disabled => serializer.serialize_i32(1),
Self::Auto => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Condition {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PersonalizationSpec {
pub mode: crate::model::search_request::personalization_spec::Mode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PersonalizationSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mode<
T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
}
impl wkt::message::Message for PersonalizationSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
}
}
pub mod personalization_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
Unspecified,
Auto,
Disabled,
UnknownValue(mode::UnknownValue),
}
#[doc(hidden)]
pub mod mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Mode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Auto => std::option::Option::Some(1),
Self::Disabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
Self::Auto => std::option::Option::Some("AUTO"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Mode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Mode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Mode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Auto,
2 => Self::Disabled,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Mode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODE_UNSPECIFIED" => Self::Unspecified,
"AUTO" => Self::Auto,
"DISABLED" => Self::Disabled,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Mode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Auto => serializer.serialize_i32(1),
Self::Disabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Mode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpellCorrectionSpec {
pub mode: crate::model::search_request::spell_correction_spec::Mode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SpellCorrectionSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mode<
T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
}
impl wkt::message::Message for SpellCorrectionSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
}
}
pub mod spell_correction_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
Unspecified,
SuggestionOnly,
Auto,
UnknownValue(mode::UnknownValue),
}
#[doc(hidden)]
pub mod mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Mode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SuggestionOnly => std::option::Option::Some(1),
Self::Auto => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
Self::Auto => std::option::Option::Some("AUTO"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Mode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Mode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Mode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SuggestionOnly,
2 => Self::Auto,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Mode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODE_UNSPECIFIED" => Self::Unspecified,
"SUGGESTION_ONLY" => Self::SuggestionOnly,
"AUTO" => Self::Auto,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Mode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::SuggestionOnly => serializer.serialize_i32(1),
Self::Auto => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Mode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalSearchSpec {
pub followup_conversation_requested: bool,
pub conversation_id: std::string::String,
pub user_answer: std::option::Option<
crate::model::search_request::conversational_search_spec::UserAnswer,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalSearchSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.followup_conversation_requested = v.into();
self
}
pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_id = v.into();
self
}
pub fn set_user_answer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::search_request::conversational_search_spec::UserAnswer,
>,
{
self.user_answer = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::search_request::conversational_search_spec::UserAnswer,
>,
{
self.user_answer = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ConversationalSearchSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
}
}
pub mod conversational_search_spec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserAnswer {
pub r#type: std::option::Option<
crate::model::search_request::conversational_search_spec::user_answer::Type,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
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
{
self.r#type = v.into();
self
}
pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(
crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
v.into()
)
);
self
}
pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
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{
self.r#type = std::option::Option::Some(
crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
v.into()
)
);
self
}
}
impl wkt::message::Message for UserAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
}
}
pub mod user_answer {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SelectedAnswer {
#[deprecated]
pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
pub product_attribute_value:
std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SelectedAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
#[deprecated]
pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ProductAttributeValue>,
{
use std::iter::Iterator;
self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SelectedAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
TextAnswer(std::string::String),
SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TileNavigationSpec {
pub tile_navigation_requested: bool,
pub applied_tiles: std::vec::Vec<crate::model::Tile>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TileNavigationSpec {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.tile_navigation_requested = v.into();
self
}
pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tile>,
{
use std::iter::Iterator;
self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TileNavigationSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SearchMode {
Unspecified,
ProductSearchOnly,
FacetedSearchOnly,
UnknownValue(search_mode::UnknownValue),
}
#[doc(hidden)]
pub mod search_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SearchMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ProductSearchOnly => std::option::Option::Some(1),
Self::FacetedSearchOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SearchMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SearchMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SearchMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ProductSearchOnly,
2 => Self::FacetedSearchOnly,
_ => Self::UnknownValue(search_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SearchMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
"PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
"FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
_ => Self::UnknownValue(search_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SearchMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ProductSearchOnly => serializer.serialize_i32(1),
Self::FacetedSearchOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SearchMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
".google.cloud.retail.v2.SearchRequest.SearchMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchResponse {
pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
pub facets: std::vec::Vec<crate::model::search_response::Facet>,
pub total_size: i32,
pub corrected_query: std::string::String,
pub attribution_token: std::string::String,
pub next_page_token: std::string::String,
pub query_expansion_info:
std::option::Option<crate::model::search_response::QueryExpansionInfo>,
pub redirect_uri: std::string::String,
pub applied_controls: std::vec::Vec<std::string::String>,
pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
pub invalid_condition_boost_specs:
std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
pub conversational_search_result:
std::option::Option<crate::model::search_response::ConversationalSearchResult>,
pub tile_navigation_result:
std::option::Option<crate::model::search_response::TileNavigationResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SearchResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_response::SearchResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_facets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_response::Facet>,
{
use std::iter::Iterator;
self.facets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.total_size = v.into();
self
}
pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.corrected_query = v.into();
self
}
pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attribution_token = v.into();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
{
self.query_expansion_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
{
self.query_expansion_info = v.map(|x| x.into());
self
}
pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.redirect_uri = v.into();
self
}
pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.applied_controls = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PinControlMetadata>,
{
self.pin_control_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PinControlMetadata>,
{
self.pin_control_metadata = v.map(|x| x.into());
self
}
pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
{
use std::iter::Iterator;
self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ExperimentInfo>,
{
use std::iter::Iterator;
self.experiment_info = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
{
self.conversational_search_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
{
self.conversational_search_result = v.map(|x| x.into());
self
}
pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
{
self.tile_navigation_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
{
self.tile_navigation_result = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SearchResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
type PageItem = crate::model::search_response::SearchResult;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.results
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
pub mod search_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchResult {
pub id: std::string::String,
pub product: std::option::Option<crate::model::Product>,
pub matching_variant_count: i32,
pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
pub personal_labels: std::vec::Vec<std::string::String>,
pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SearchResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_product<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = v.map(|x| x.into());
self
}
pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.matching_variant_count = v.into();
self
}
pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::FieldMask>,
{
use std::iter::Iterator;
self.matching_variant_fields =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.personal_labels = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::DoubleList>,
{
use std::iter::Iterator;
self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for SearchResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Facet {
pub key: std::string::String,
pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
pub dynamic_facet: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Facet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.dynamic_facet = v.into();
self
}
}
impl wkt::message::Message for Facet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
}
}
pub mod facet {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FacetValue {
pub count: i64,
pub min_value: f64,
pub max_value: f64,
pub facet_value:
std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FacetValue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.count = v.into();
self
}
pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.min_value = v.into();
self
}
pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.max_value = v.into();
self
}
pub fn set_facet_value<
T: std::convert::Into<
std::option::Option<
crate::model::search_response::facet::facet_value::FacetValue,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.facet_value = v.into();
self
}
pub fn value(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.facet_value.as_ref().and_then(|v| match v {
crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.facet_value = std::option::Option::Some(
crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
);
self
}
pub fn interval(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
#[allow(unreachable_patterns)]
self.facet_value.as_ref().and_then(|v| match v {
crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
mut self,
v: T,
) -> Self {
self.facet_value = std::option::Option::Some(
crate::model::search_response::facet::facet_value::FacetValue::Interval(
v.into(),
),
);
self
}
}
impl wkt::message::Message for FacetValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
}
}
pub mod facet_value {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FacetValue {
Value(std::string::String),
Interval(std::boxed::Box<crate::model::Interval>),
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryExpansionInfo {
pub expanded_query: bool,
pub pinned_result_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryExpansionInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.expanded_query = v.into();
self
}
pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.pinned_result_count = v.into();
self
}
}
impl wkt::message::Message for QueryExpansionInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationalSearchResult {
pub conversation_id: std::string::String,
pub refined_query: std::string::String,
#[deprecated]
pub additional_filters: std::vec::Vec<
crate::model::search_response::conversational_search_result::AdditionalFilter,
>,
pub followup_question: std::string::String,
pub suggested_answers: std::vec::Vec<
crate::model::search_response::conversational_search_result::SuggestedAnswer,
>,
pub additional_filter: std::option::Option<
crate::model::search_response::conversational_search_result::AdditionalFilter,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConversationalSearchResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_id = v.into();
self
}
pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.refined_query = v.into();
self
}
#[deprecated]
pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::search_response::conversational_search_result::AdditionalFilter,
>,
{
use std::iter::Iterator;
self.additional_filters = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.followup_question = v.into();
self
}
pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::search_response::conversational_search_result::SuggestedAnswer,
>,
{
use std::iter::Iterator;
self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_additional_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::search_response::conversational_search_result::AdditionalFilter,
>,
{
self.additional_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::search_response::conversational_search_result::AdditionalFilter,
>,
{
self.additional_filter = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ConversationalSearchResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
}
}
pub mod conversational_search_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestedAnswer {
pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SuggestedAnswer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SuggestedAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdditionalFilter {
pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AdditionalFilter {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product_attribute_value<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ProductAttributeValue>,
{
self.product_attribute_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AdditionalFilter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TileNavigationResult {
pub tiles: std::vec::Vec<crate::model::Tile>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TileNavigationResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tiles<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tile>,
{
use std::iter::Iterator;
self.tiles = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TileNavigationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExperimentInfo {
pub experiment: std::string::String,
pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExperimentInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.experiment = v.into();
self
}
pub fn set_experiment_metadata<
T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.experiment_metadata = v.into();
self
}
pub fn serving_config_experiment(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
{
#[allow(unreachable_patterns)]
self.experiment_metadata.as_ref().and_then(|v| match v {
crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_serving_config_experiment<
T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
>(
mut self,
v: T,
) -> Self {
self.experiment_metadata = std::option::Option::Some(
crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
);
self
}
}
impl wkt::message::Message for ExperimentInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
}
}
pub mod experiment_info {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServingConfigExperiment {
pub original_serving_config: std::string::String,
pub experiment_serving_config: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServingConfigExperiment {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.original_serving_config = v.into();
self
}
pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.experiment_serving_config = v.into();
self
}
}
impl wkt::message::Message for ServingConfigExperiment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ExperimentMetadata {
ServingConfigExperiment(
std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServingConfig {
pub name: std::string::String,
pub display_name: std::string::String,
pub model_id: std::string::String,
pub price_reranking_level: std::string::String,
pub facet_control_ids: std::vec::Vec<std::string::String>,
pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
pub boost_control_ids: std::vec::Vec<std::string::String>,
pub filter_control_ids: std::vec::Vec<std::string::String>,
pub redirect_control_ids: std::vec::Vec<std::string::String>,
pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
pub replacement_control_ids: std::vec::Vec<std::string::String>,
pub ignore_control_ids: std::vec::Vec<std::string::String>,
pub diversity_level: std::string::String,
pub diversity_type: crate::model::serving_config::DiversityType,
pub enable_category_filter_level: std::string::String,
pub ignore_recs_denylist: bool,
pub personalization_spec:
std::option::Option<crate::model::search_request::PersonalizationSpec>,
pub solution_types: std::vec::Vec<crate::model::SolutionType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServingConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model_id = v.into();
self
}
pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.price_reranking_level = v.into();
self
}
pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
{
self.dynamic_facet_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
{
self.dynamic_facet_spec = v.map(|x| x.into());
self
}
pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.diversity_level = v.into();
self
}
pub fn set_diversity_type<
T: std::convert::Into<crate::model::serving_config::DiversityType>,
>(
mut self,
v: T,
) -> Self {
self.diversity_type = v.into();
self
}
pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.enable_category_filter_level = v.into();
self
}
pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.ignore_recs_denylist = v.into();
self
}
pub fn set_personalization_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
{
self.personalization_spec = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
{
self.personalization_spec = v.map(|x| x.into());
self
}
pub fn set_solution_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SolutionType>,
{
use std::iter::Iterator;
self.solution_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ServingConfig"
}
}
pub mod serving_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DiversityType {
Unspecified,
RuleBasedDiversity,
DataDrivenDiversity,
UnknownValue(diversity_type::UnknownValue),
}
#[doc(hidden)]
pub mod diversity_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DiversityType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RuleBasedDiversity => std::option::Option::Some(2),
Self::DataDrivenDiversity => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DiversityType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DiversityType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DiversityType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::RuleBasedDiversity,
3 => Self::DataDrivenDiversity,
_ => Self::UnknownValue(diversity_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DiversityType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
"RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
"DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
_ => Self::UnknownValue(diversity_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DiversityType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RuleBasedDiversity => serializer.serialize_i32(2),
Self::DataDrivenDiversity => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DiversityType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
".google.cloud.retail.v2.ServingConfig.DiversityType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServingConfigRequest {
pub parent: std::string::String,
pub serving_config: std::option::Option<crate::model::ServingConfig>,
pub serving_config_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateServingConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_serving_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServingConfig>,
{
self.serving_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServingConfig>,
{
self.serving_config = v.map(|x| x.into());
self
}
pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.serving_config_id = v.into();
self
}
}
impl wkt::message::Message for CreateServingConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateServingConfigRequest {
pub serving_config: std::option::Option<crate::model::ServingConfig>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateServingConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serving_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServingConfig>,
{
self.serving_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServingConfig>,
{
self.serving_config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateServingConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServingConfigRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteServingConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteServingConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServingConfigRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetServingConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetServingConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServingConfigsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListServingConfigsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListServingConfigsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServingConfigsResponse {
pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListServingConfigsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ServingConfig>,
{
use std::iter::Iterator;
self.serving_configs = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListServingConfigsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
type PageItem = crate::model::ServingConfig;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.serving_configs
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddControlRequest {
pub serving_config: std::string::String,
pub control_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AddControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.serving_config = v.into();
self
}
pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.control_id = v.into();
self
}
}
impl wkt::message::Message for AddControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveControlRequest {
pub serving_config: std::string::String,
pub control_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoveControlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.serving_config = v.into();
self
}
pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.control_id = v.into();
self
}
}
impl wkt::message::Message for RemoveControlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserEvent {
pub event_type: std::string::String,
pub visitor_id: std::string::String,
pub session_id: std::string::String,
pub event_time: std::option::Option<wkt::Timestamp>,
pub experiment_ids: std::vec::Vec<std::string::String>,
pub attribution_token: std::string::String,
pub product_details: std::vec::Vec<crate::model::ProductDetail>,
pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
pub cart_id: std::string::String,
pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
pub search_query: std::string::String,
pub filter: std::string::String,
pub order_by: std::string::String,
pub offset: i32,
pub page_categories: std::vec::Vec<std::string::String>,
pub user_info: std::option::Option<crate::model::UserInfo>,
pub uri: std::string::String,
pub referrer_uri: std::string::String,
pub page_view_id: std::string::String,
pub entity: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserEvent {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.event_type = v.into();
self
}
pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.visitor_id = v.into();
self
}
pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session_id = v.into();
self
}
pub fn set_event_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.event_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.event_time = v.map(|x| x.into());
self
}
pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.attribution_token = v.into();
self
}
pub fn set_product_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ProductDetail>,
{
use std::iter::Iterator;
self.product_details = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_completion_detail<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CompletionDetail>,
{
self.completion_detail = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CompletionDetail>,
{
self.completion_detail = v.map(|x| x.into());
self
}
pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::CustomAttribute>,
{
use std::iter::Iterator;
self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cart_id = v.into();
self
}
pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PurchaseTransaction>,
{
self.purchase_transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PurchaseTransaction>,
{
self.purchase_transaction = v.map(|x| x.into());
self
}
pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.search_query = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.offset = v.into();
self
}
pub fn set_page_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.page_categories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_user_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserInfo>,
{
self.user_info = v.map(|x| x.into());
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.referrer_uri = v.into();
self
}
pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_view_id = v.into();
self
}
pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entity = v.into();
self
}
}
impl wkt::message::Message for UserEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.UserEvent"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProductDetail {
pub product: std::option::Option<crate::model::Product>,
pub quantity: std::option::Option<wkt::Int32Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProductDetail {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_product<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Product>,
{
self.product = v.map(|x| x.into());
self
}
pub fn set_quantity<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.quantity = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.quantity = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ProductDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.ProductDetail"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompletionDetail {
pub completion_attribution_token: std::string::String,
pub selected_suggestion: std::string::String,
pub selected_position: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CompletionDetail {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.completion_attribution_token = v.into();
self
}
pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.selected_suggestion = v.into();
self
}
pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.selected_position = v.into();
self
}
}
impl wkt::message::Message for CompletionDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurchaseTransaction {
pub id: std::string::String,
pub revenue: f32,
pub tax: f32,
pub cost: f32,
pub currency_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurchaseTransaction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.revenue = v.into();
self
}
pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.tax = v.into();
self
}
pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.cost = v.into();
self
}
pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.currency_code = v.into();
self
}
}
impl wkt::message::Message for PurchaseTransaction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WriteUserEventRequest {
pub parent: std::string::String,
pub user_event: std::option::Option<crate::model::UserEvent>,
pub write_async: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl WriteUserEventRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_user_event<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UserEvent>,
{
self.user_event = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UserEvent>,
{
self.user_event = v.map(|x| x.into());
self
}
pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.write_async = v.into();
self
}
}
impl wkt::message::Message for WriteUserEventRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CollectUserEventRequest {
pub parent: std::string::String,
pub user_event: std::string::String,
pub uri: std::string::String,
pub ets: i64,
pub raw_json: std::string::String,
pub conversion_rule:
std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CollectUserEventRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_event = v.into();
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.ets = v.into();
self
}
pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.raw_json = v.into();
self
}
pub fn set_conversion_rule<
T: std::convert::Into<
std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
>,
>(
mut self,
v: T,
) -> Self {
self.conversion_rule = v.into();
self
}
pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.conversion_rule.as_ref().and_then(|v| match v {
crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversion_rule = std::option::Option::Some(
crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
);
self
}
}
impl wkt::message::Message for CollectUserEventRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
}
}
pub mod collect_user_event_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConversionRule {
PrebuiltRule(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RejoinUserEventsRequest {
pub parent: std::string::String,
pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RejoinUserEventsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_user_event_rejoin_scope<
T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
>(
mut self,
v: T,
) -> Self {
self.user_event_rejoin_scope = v.into();
self
}
}
impl wkt::message::Message for RejoinUserEventsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
}
}
pub mod rejoin_user_events_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UserEventRejoinScope {
Unspecified,
JoinedEvents,
UnjoinedEvents,
UnknownValue(user_event_rejoin_scope::UnknownValue),
}
#[doc(hidden)]
pub mod user_event_rejoin_scope {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UserEventRejoinScope {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::JoinedEvents => std::option::Option::Some(1),
Self::UnjoinedEvents => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
}
Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UserEventRejoinScope {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UserEventRejoinScope {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for UserEventRejoinScope {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::JoinedEvents,
2 => Self::UnjoinedEvents,
_ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UserEventRejoinScope {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
"JOINED_EVENTS" => Self::JoinedEvents,
"UNJOINED_EVENTS" => Self::UnjoinedEvents,
_ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UserEventRejoinScope {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::JoinedEvents => serializer.serialize_i32(1),
Self::UnjoinedEvents => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RejoinUserEventsResponse {
pub rejoined_user_events_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RejoinUserEventsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.rejoined_user_events_count = v.into();
self
}
}
impl wkt::message::Message for RejoinUserEventsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RejoinUserEventsMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RejoinUserEventsMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for RejoinUserEventsMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttributeConfigLevel {
Unspecified,
ProductLevelAttributeConfig,
CatalogLevelAttributeConfig,
UnknownValue(attribute_config_level::UnknownValue),
}
#[doc(hidden)]
pub mod attribute_config_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttributeConfigLevel {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
Self::ProductLevelAttributeConfig => {
std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
}
Self::CatalogLevelAttributeConfig => {
std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttributeConfigLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttributeConfigLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttributeConfigLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ProductLevelAttributeConfig,
2 => Self::CatalogLevelAttributeConfig,
_ => Self::UnknownValue(attribute_config_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttributeConfigLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
"PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
"CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
_ => Self::UnknownValue(attribute_config_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttributeConfigLevel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
".google.cloud.retail.v2.AttributeConfigLevel",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SolutionType {
Unspecified,
Recommendation,
Search,
UnknownValue(solution_type::UnknownValue),
}
#[doc(hidden)]
pub mod solution_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SolutionType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Recommendation => std::option::Option::Some(1),
Self::Search => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SolutionType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SolutionType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SolutionType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Recommendation,
2 => Self::Search,
_ => Self::UnknownValue(solution_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SolutionType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
"SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
"SOLUTION_TYPE_SEARCH" => Self::Search,
_ => Self::UnknownValue(solution_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SolutionType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Recommendation => serializer.serialize_i32(1),
Self::Search => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SolutionType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
".google.cloud.retail.v2.SolutionType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RecommendationsFilteringOption {
Unspecified,
RecommendationsFilteringDisabled,
RecommendationsFilteringEnabled,
UnknownValue(recommendations_filtering_option::UnknownValue),
}
#[doc(hidden)]
pub mod recommendations_filtering_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RecommendationsFilteringOption {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
}
Self::RecommendationsFilteringDisabled => {
std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
}
Self::RecommendationsFilteringEnabled => {
std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RecommendationsFilteringOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RecommendationsFilteringOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RecommendationsFilteringOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::RecommendationsFilteringDisabled,
3 => Self::RecommendationsFilteringEnabled,
_ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RecommendationsFilteringOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
"RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
"RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
_ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RecommendationsFilteringOption {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
".google.cloud.retail.v2.RecommendationsFilteringOption",
),
)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SearchSolutionUseCase {
Unspecified,
Search,
Browse,
UnknownValue(search_solution_use_case::UnknownValue),
}
#[doc(hidden)]
pub mod search_solution_use_case {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SearchSolutionUseCase {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Search => std::option::Option::Some(1),
Self::Browse => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SearchSolutionUseCase {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SearchSolutionUseCase {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SearchSolutionUseCase {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Search,
2 => Self::Browse,
_ => Self::UnknownValue(search_solution_use_case::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SearchSolutionUseCase {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
"SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
"SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
_ => Self::UnknownValue(search_solution_use_case::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SearchSolutionUseCase {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Search => serializer.serialize_i32(1),
Self::Browse => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
".google.cloud.retail.v2.SearchSolutionUseCase",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HarmCategory {
Unspecified,
HateSpeech,
DangerousContent,
Harassment,
SexuallyExplicit,
CivicIntegrity,
UnknownValue(harm_category::UnknownValue),
}
#[doc(hidden)]
pub mod harm_category {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HarmCategory {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::HateSpeech => std::option::Option::Some(1),
Self::DangerousContent => std::option::Option::Some(2),
Self::Harassment => std::option::Option::Some(3),
Self::SexuallyExplicit => std::option::Option::Some(4),
Self::CivicIntegrity => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HarmCategory {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HarmCategory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for HarmCategory {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::HateSpeech,
2 => Self::DangerousContent,
3 => Self::Harassment,
4 => Self::SexuallyExplicit,
5 => Self::CivicIntegrity,
_ => Self::UnknownValue(harm_category::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HarmCategory {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
"HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
"HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
"HARM_CATEGORY_HARASSMENT" => Self::Harassment,
"HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
"HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
_ => Self::UnknownValue(harm_category::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HarmCategory {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::HateSpeech => serializer.serialize_i32(1),
Self::DangerousContent => serializer.serialize_i32(2),
Self::Harassment => serializer.serialize_i32(3),
Self::SexuallyExplicit => serializer.serialize_i32(4),
Self::CivicIntegrity => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HarmCategory {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
".google.cloud.retail.v2.HarmCategory",
))
}
}